mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 06:10:13 +01:00
libagx: move index size helpers to the gpu
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32759>
This commit is contained in:
parent
b5d41bc0fb
commit
686daf2524
2 changed files with 24 additions and 18 deletions
|
|
@ -104,24 +104,6 @@ agx_translate_sample_count(unsigned samples)
|
|||
}
|
||||
}
|
||||
|
||||
static inline enum agx_index_size
|
||||
agx_translate_index_size(uint8_t size_B)
|
||||
{
|
||||
/* Index sizes are encoded logarithmically */
|
||||
STATIC_ASSERT(__builtin_ctz(1) == AGX_INDEX_SIZE_U8);
|
||||
STATIC_ASSERT(__builtin_ctz(2) == AGX_INDEX_SIZE_U16);
|
||||
STATIC_ASSERT(__builtin_ctz(4) == AGX_INDEX_SIZE_U32);
|
||||
|
||||
assert((size_B == 1) || (size_B == 2) || (size_B == 4));
|
||||
return __builtin_ctz(size_B);
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
agx_index_size_to_B(enum agx_index_size size)
|
||||
{
|
||||
return 1 << size;
|
||||
}
|
||||
|
||||
static enum agx_conservative_depth
|
||||
agx_translate_depth_layout(enum gl_frag_depth_layout layout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,30 @@
|
|||
memcpy(ptr, &src, sizeof(src)); \
|
||||
ptr = (GLOBAL void *)(((uintptr_t)ptr) + sizeof(src));
|
||||
|
||||
static inline enum agx_index_size
|
||||
agx_translate_index_size(uint8_t size_B)
|
||||
{
|
||||
/* Index sizes are encoded logarithmically */
|
||||
static_assert(__builtin_ctz(1) == AGX_INDEX_SIZE_U8);
|
||||
static_assert(__builtin_ctz(2) == AGX_INDEX_SIZE_U16);
|
||||
static_assert(__builtin_ctz(4) == AGX_INDEX_SIZE_U32);
|
||||
|
||||
assert((size_B == 1) || (size_B == 2) || (size_B == 4));
|
||||
return __builtin_ctz(size_B);
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
agx_indices_to_B(unsigned x, enum agx_index_size size)
|
||||
{
|
||||
return x << size;
|
||||
}
|
||||
|
||||
static inline uint8_t
|
||||
agx_index_size_to_B(enum agx_index_size size)
|
||||
{
|
||||
return agx_indices_to_B(1, size);
|
||||
}
|
||||
|
||||
struct agx_workgroup {
|
||||
uint32_t x, y, z;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue