mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-28 07:30:22 +01:00
nir: add offset_shift intrinsic index
For load/store intrinsics that take an offset, this specifies the amount the offset is shifted left to calculate the final offset: offset = (offset_src + base) << offset_shift This is useful for backends that have memory operations that use offset units other than bytes (i.e., where the shift is implicit). Signed-off-by: Job Noorman <jnoorman@igalia.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35092>
This commit is contained in:
parent
ebea9ce825
commit
7cc09e9952
2 changed files with 20 additions and 0 deletions
|
|
@ -214,6 +214,20 @@ index("unsigned", "stack_size")
|
|||
index("unsigned", "align_mul")
|
||||
index("unsigned", "align_offset")
|
||||
|
||||
# For load/store intrinsics that take an offset, the amount the offset is
|
||||
# shifted left to calculate the final byte offset:
|
||||
#
|
||||
# offset = (offset_src + base) << offset_shift
|
||||
#
|
||||
# It is unspecified how overflows due to offset_shift are handled: they may
|
||||
# either be treated as out-of-bounds, or wrap around and generate an in-bounds
|
||||
# offset. NIR passes may implement either behavior and may not be consistent
|
||||
# about it.
|
||||
#
|
||||
# This is useful for backends that have memory operations that use offset units
|
||||
# other than bytes (i.e., where the shift is implicit).
|
||||
index("unsigned", "offset_shift")
|
||||
|
||||
# The Vulkan descriptor type for a vulkan_resource_[re]index intrinsic.
|
||||
index("unsigned", "desc_type")
|
||||
|
||||
|
|
|
|||
|
|
@ -809,6 +809,12 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
|
|||
(state->shader->info.stage == MESA_SHADER_FRAGMENT &&
|
||||
instr->intrinsic == nir_intrinsic_load_input_vertex));
|
||||
}
|
||||
|
||||
if (nir_intrinsic_has_offset_shift(instr) &&
|
||||
nir_intrinsic_has_align(instr)) {
|
||||
unsigned min_align = 1 << nir_intrinsic_offset_shift(instr);
|
||||
validate_assert(state, nir_intrinsic_align(instr) >= min_align);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue