pan/lib: Refactor pan_padded_vertex_count
We are going to move everything in pan_encode.h for CL usage. This inline the code used by pan_padded_vertex_count. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35490>
This commit is contained in:
@@ -33,21 +33,15 @@
|
||||
* exactly how the hardware calculates this (which is why the
|
||||
* algorithm is so weird) or else instancing will break. */
|
||||
|
||||
/* Given an odd number (of the form 2k + 1), compute k */
|
||||
#define ODD(odd) ((odd - 1) >> 1)
|
||||
|
||||
static unsigned
|
||||
pan_small_padded_vertex_count(unsigned idx)
|
||||
unsigned
|
||||
pan_padded_vertex_count(unsigned vertex_count)
|
||||
{
|
||||
if (idx < 10)
|
||||
return idx;
|
||||
else
|
||||
return (idx + 1) & ~1;
|
||||
}
|
||||
if (vertex_count < 10)
|
||||
return vertex_count;
|
||||
|
||||
if (vertex_count < 20)
|
||||
return (vertex_count + 1) & ~1;
|
||||
|
||||
static unsigned
|
||||
pan_large_padded_vertex_count(uint32_t vertex_count)
|
||||
{
|
||||
/* First, we have to find the highest set one */
|
||||
unsigned highest = 32 - __builtin_clz(vertex_count);
|
||||
|
||||
@@ -78,15 +72,6 @@ pan_large_padded_vertex_count(uint32_t vertex_count)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned
|
||||
pan_padded_vertex_count(unsigned vertex_count)
|
||||
{
|
||||
if (vertex_count < 20)
|
||||
return pan_small_padded_vertex_count(vertex_count);
|
||||
else
|
||||
return pan_large_padded_vertex_count(vertex_count);
|
||||
}
|
||||
|
||||
unsigned
|
||||
pan_compute_magic_divisor(unsigned hw_divisor, unsigned *divisor_r,
|
||||
unsigned *divisor_e)
|
||||
|
||||
Reference in New Issue
Block a user