mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 14:10:09 +01:00
anv: Add an align_down_u32 helper
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3777>
This commit is contained in:
parent
61ac8cf083
commit
faea84e254
2 changed files with 9 additions and 2 deletions
|
|
@ -74,7 +74,7 @@ anv_nir_compute_push_layout(const struct anv_physical_device *pdevice,
|
|||
* push_end (no push constants is indicated by push_start = UINT_MAX).
|
||||
*/
|
||||
push_start = MIN2(push_start, push_end);
|
||||
push_start &= ~31u;
|
||||
push_start = align_down_u32(push_start, 32);
|
||||
|
||||
if (has_push_intrinsic) {
|
||||
nir_foreach_function(function, nir) {
|
||||
|
|
|
|||
|
|
@ -231,11 +231,18 @@ align_down_npot_u32(uint32_t v, uint32_t a)
|
|||
return v - (v % a);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
align_down_u32(uint32_t v, uint32_t a)
|
||||
{
|
||||
assert(a != 0 && a == (a & -a));
|
||||
return v & ~(a - 1);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
align_u32(uint32_t v, uint32_t a)
|
||||
{
|
||||
assert(a != 0 && a == (a & -a));
|
||||
return (v + a - 1) & ~(a - 1);
|
||||
return align_down_u32(v + a - 1, a);
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue