mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-19 06:18:24 +02:00
nir/lower_ssbo: take offset_shift into account
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/41477>
This commit is contained in:
parent
c0c1a2b0af
commit
ca9c01ddc5
1 changed files with 8 additions and 1 deletions
|
|
@ -12,13 +12,20 @@
|
|||
* load_ssbo_address. Run nir_lower_robust_access first for bounds checks.
|
||||
*/
|
||||
|
||||
static nir_def *
|
||||
get_offset(nir_builder *b, nir_intrinsic_instr *intr)
|
||||
{
|
||||
return nir_ishl_imm(b, nir_get_io_offset_src(intr)->ssa,
|
||||
nir_intrinsic_offset_shift(intr));
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
calc_address(nir_builder *b, nir_intrinsic_instr *intr,
|
||||
const nir_lower_ssbo_options *opts)
|
||||
{
|
||||
unsigned index_src = intr->intrinsic == nir_intrinsic_store_ssbo ? 1 : 0;
|
||||
bool lower_offset = !opts || !opts->native_offset;
|
||||
nir_def *offset = nir_get_io_offset_src(intr)->ssa;
|
||||
nir_def *offset = get_offset(b, intr);
|
||||
nir_def *addr =
|
||||
nir_load_ssbo_address(b, 1, 64, intr->src[index_src].ssa,
|
||||
lower_offset ? nir_imm_int(b, 0) : offset);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue