nir/opt_varyings: handle user barycentrics
This failed an assertion because the barycentric src wasn't an intrinsic. v2: also do it in backward_inter_shader_code_motion Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> (v1) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33024>
This commit is contained in:
@@ -2599,8 +2599,10 @@ get_input_qualifier(struct linkage_info *linkage, unsigned i)
|
||||
}
|
||||
|
||||
assert(load->intrinsic == nir_intrinsic_load_interpolated_input);
|
||||
nir_intrinsic_instr *baryc =
|
||||
nir_instr_as_intrinsic(load->src[0].ssa->parent_instr);
|
||||
|
||||
nir_instr *baryc_instr = load->src[0].ssa->parent_instr;
|
||||
nir_intrinsic_instr *baryc = baryc_instr->type == nir_instr_type_intrinsic ?
|
||||
nir_instr_as_intrinsic(baryc_instr) : NULL;
|
||||
|
||||
if (linkage->has_flexible_interp) {
|
||||
if (is_color) {
|
||||
@@ -2611,6 +2613,12 @@ get_input_qualifier(struct linkage_info *linkage, unsigned i)
|
||||
}
|
||||
}
|
||||
|
||||
/* This is either lowered barycentric_at_offset/at_sample or user
|
||||
* barycentrics. Treat it like barycentric_at_offset.
|
||||
*/
|
||||
if (!baryc)
|
||||
return QUAL_SKIP;
|
||||
|
||||
/* If interpolateAt{Centroid,Offset,Sample} is used, see if there is
|
||||
* another load that doesn't use those, so that we get the real qualifier.
|
||||
*/
|
||||
@@ -3903,8 +3911,15 @@ backward_inter_shader_code_motion(struct linkage_info *linkage,
|
||||
switch (load->intrinsic) {
|
||||
case nir_intrinsic_load_interpolated_input: {
|
||||
assert(linkage->consumer_stage == MESA_SHADER_FRAGMENT);
|
||||
nir_intrinsic_instr *baryc =
|
||||
nir_instr_as_intrinsic(load->src[0].ssa->parent_instr);
|
||||
nir_instr *baryc_instr = load->src[0].ssa->parent_instr;
|
||||
|
||||
/* This is either lowered barycentric_at_offset/at_sample or user
|
||||
* barycentrics. Treat it like barycentric_at_offset.
|
||||
*/
|
||||
if (baryc_instr->type != nir_instr_type_intrinsic)
|
||||
continue;
|
||||
|
||||
nir_intrinsic_instr *baryc = nir_instr_as_intrinsic(baryc_instr);
|
||||
nir_intrinsic_op op = baryc->intrinsic;
|
||||
enum glsl_interp_mode interp = nir_intrinsic_interp_mode(baryc);
|
||||
bool linear = interp == INTERP_MODE_NOPERSPECTIVE;
|
||||
|
||||
Reference in New Issue
Block a user