mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
spirv: Don't add 0.5 to array indicies for OpImageSampleExplicitLod
This fixes CLs 1.2 1Darray and 2Darray images. Fixes:589d918a4f("spirv: Add 0.5 to integer coordinates for OpImageSampleExplicitLod") Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13401> (cherry picked from commitf6ecd284e5)
This commit is contained in:
parent
bac2dd958a
commit
7456331987
2 changed files with 11 additions and 4 deletions
|
|
@ -958,7 +958,7 @@
|
|||
"description": "spirv: Don't add 0.5 to array indicies for OpImageSampleExplicitLod",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "589d918a4f9da83e3ae441aa674372a141d23349"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2825,9 +2825,16 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
|||
"Unless the Kernel capability is being used, the coordinate parameter "
|
||||
"OpImageSampleExplicitLod must be floating point.");
|
||||
|
||||
p->src = nir_src_for_ssa(
|
||||
nir_fadd(&b->nb, nir_i2f32(&b->nb, p->src.ssa),
|
||||
nir_imm_float(&b->nb, 0.5)));
|
||||
nir_ssa_def *coords[4];
|
||||
nir_ssa_def *f0_5 = nir_imm_float(&b->nb, 0.5);
|
||||
for (unsigned i = 0; i < coord_components; i++) {
|
||||
coords[i] = nir_i2f32(&b->nb, nir_channel(&b->nb, p->src.ssa, i));
|
||||
|
||||
if (!is_array || i != coord_components - 1)
|
||||
coords[i] = nir_fadd(&b->nb, coords[i], f0_5);
|
||||
}
|
||||
|
||||
p->src = nir_src_for_ssa(nir_vec(&b->nb, coords, coord_components));
|
||||
}
|
||||
|
||||
p->src_type = nir_tex_src_coord;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue