diff options
author | Mike Blumenkrantz <michael.blumenkrantz@gmail.com> | 2024-02-08 08:29:25 -0500 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-02-14 18:35:58 +0000 |
commit | 5d81698c5501b00b8e4877e0614d10c461266360 (patch) | |
tree | efccd3c7bda0aaaae327d8cd4253ba83fa83219c | |
parent | f5ab22d0c090b331565e34dc5983791dcaa538e8 (diff) |
zink: adjust swizzled deref loads by the variable component offset
this code is intended to transform a block like:
```
32 %306 = @load_interpolated_input (%34, %0 (0x0)) (base=3, component=2, dest_type=float32, io location=VARYING_SLOT_VAR3 slots=1)
32x2 %307 = fsub %305, %306.xx
```
into derefs. the existing code generates this:
```
decl_var shader_in INTERP_MODE_NONE none vec2 #7 (VARYING_SLOT_VAR3.zw, 0, 0)
32 %516 = deref_var  (shader_in vec2)
32x2 %517 = @load_deref (%516) (access=none)
32 %518 = mov %517.z
error: src->swizzle[i] < num_components (../src/compiler/nir/nir_validate.c:216)
```
the problem is attempting to reapply the component offset to a variable which is
already at an offset
fixes #10567
Fixes: 17a35412dcc ("zink: re-rework i/o variable handling to make having variables entirely optional")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27522>
(cherry picked from commit 0a243a7241e26292ca55a97f5f8d464001b532cd)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/gallium/drivers/zink/zink_compiler.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json index bd8cd127cd8..ee4016166ae 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2414,7 +2414,7 @@ "description": "zink: adjust swizzled deref loads by the variable component offset", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "17a35412dcc77a3058107100d27f734796a9d0ca", "notes": null diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c index 5c3c1f1ed7d..e1411bcb841 100644 --- a/src/gallium/drivers/zink/zink_compiler.c +++ b/src/gallium/drivers/zink/zink_compiler.c @@ -3764,7 +3764,7 @@ add_derefs_instr(nir_builder *b, nir_intrinsic_instr *intr, void *data) } /* filter needed components */ if (intr->num_components < load->num_components) - load = nir_channels(b, load, BITFIELD_MASK(intr->num_components) << c); + load = nir_channels(b, load, BITFIELD_MASK(intr->num_components) << (c - var->data.location_frac)); nir_def_rewrite_uses(&intr->def, load); } else { nir_def *store = intr->src[0].ssa; |