nir: apply interpolated input intrinsics setting when lowering clipdist
For drivers that use this in fragment shaders, load_input is going to produce incorrect results (flat-shaded values). Fixes clipping tests on a4xx. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13900>
This commit is contained in:
@@ -115,10 +115,23 @@ load_clipdist_input(nir_builder *b, nir_variable *in, int location_offset,
|
|||||||
.num_slots = 1,
|
.num_slots = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
nir_ssa_def *load =
|
nir_ssa_def *load;
|
||||||
nir_load_input(b, 4, 32, nir_imm_int(b, 0),
|
if (b->shader->options->use_interpolated_input_intrinsics) {
|
||||||
.base = in->data.driver_location + location_offset,
|
/* TODO: use sample when per-sample shading? */
|
||||||
.io_semantics = semantics);
|
nir_ssa_def *barycentric = nir_load_barycentric(
|
||||||
|
b, nir_intrinsic_load_barycentric_pixel, INTERP_MODE_NONE);
|
||||||
|
load = nir_load_interpolated_input(
|
||||||
|
b, 4, 32, barycentric, nir_imm_int(b, 0),
|
||||||
|
.base = in->data.driver_location + location_offset,
|
||||||
|
.dest_type = nir_type_float32,
|
||||||
|
.io_semantics = semantics);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
load = nir_load_input(b, 4, 32, nir_imm_int(b, 0),
|
||||||
|
.base = in->data.driver_location + location_offset,
|
||||||
|
.dest_type = nir_type_float32,
|
||||||
|
.io_semantics = semantics);
|
||||||
|
}
|
||||||
|
|
||||||
val[0] = nir_channel(b, load, 0);
|
val[0] = nir_channel(b, load, 0);
|
||||||
val[1] = nir_channel(b, load, 1);
|
val[1] = nir_channel(b, load, 1);
|
||||||
|
Reference in New Issue
Block a user