nir/lower_input_attachments: Don't ignore tex coordinates
The SPIR-V spec is pretty clear that coordinates on subpass attachments
are relative to the current pixel. They're required to be zero but we
should stay consistent with ourselves (we already do this for image
intrinsics) and with the spec.
Fixes: 84b08971fb ("nir/lower_input_attachments: lower nir_texop_fragment_{mask}_fetch")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35551>
This commit is contained in:
committed by
Marge Bot
parent
9a52b9372c
commit
2c13e1e655
@@ -177,9 +177,12 @@ try_lower_input_texop(nir_builder *b, nir_tex_instr *tex,
|
||||
nir_def *frag_coord = load_frag_coord(b, deref, options);
|
||||
frag_coord = nir_f2i32(b, frag_coord);
|
||||
|
||||
nir_def *offset = nir_trim_vector(b, tex->src[coord_src_idx].src.ssa, 2);
|
||||
nir_def *pos = nir_iadd(b, frag_coord, offset);
|
||||
|
||||
nir_def *layer = load_layer_id(b, options);
|
||||
nir_def *coord = nir_vec3(b, nir_channel(b, frag_coord, 0),
|
||||
nir_channel(b, frag_coord, 1), layer);
|
||||
nir_def *coord = nir_vec3(b, nir_channel(b, pos, 0),
|
||||
nir_channel(b, pos, 1), layer);
|
||||
|
||||
tex->coord_components = 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user