diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h index 3009161fc3f..3152dc3005a 100644 --- a/src/intel/compiler/brw_compiler.h +++ b/src/intel/compiler/brw_compiler.h @@ -1472,6 +1472,7 @@ struct brw_compile_vs_params { const struct brw_vs_prog_key *key; struct brw_vs_prog_data *prog_data; + bool edgeflag_is_last; /* true for gallium */ bool shader_time; int shader_time_index; diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index ee5f3cf40bd..6169fe99fbf 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -160,6 +160,7 @@ remap_patch_urb_offsets(nir_block *block, nir_builder *b, void brw_nir_lower_vs_inputs(nir_shader *nir, + bool edgeflag_is_last, const uint8_t *vs_attrib_wa_flags) { /* Start with the location of the variable's base. */ @@ -270,8 +271,16 @@ brw_nir_lower_vs_inputs(nir_shader *nir, * before it and counting the bits. */ int attr = nir_intrinsic_base(intrin); - int slot = util_bitcount64(nir->info.inputs_read & - BITFIELD64_MASK(attr)); + uint64_t inputs_read = nir->info.inputs_read; + int slot = -1; + if (edgeflag_is_last) { + inputs_read &= ~BITFIELD64_BIT(VERT_ATTRIB_EDGEFLAG); + if (attr == VERT_ATTRIB_EDGEFLAG) + slot = num_inputs - 1; + } + if (slot == -1) + slot = util_bitcount64(inputs_read & + BITFIELD64_MASK(attr)); nir_intrinsic_set_base(intrin, slot); break; } diff --git a/src/intel/compiler/brw_nir.h b/src/intel/compiler/brw_nir.h index 0e46e80f421..7a8b3051090 100644 --- a/src/intel/compiler/brw_nir.h +++ b/src/intel/compiler/brw_nir.h @@ -105,6 +105,7 @@ void brw_nir_lower_legacy_clipping(nir_shader *nir, int nr_userclip_plane_consts, struct brw_stage_prog_data *prog_data); void brw_nir_lower_vs_inputs(nir_shader *nir, + bool edgeflag_is_last, const uint8_t *vs_attrib_wa_flags); void brw_nir_lower_vue_inputs(nir_shader *nir, const struct brw_vue_map *vue_map); diff --git a/src/intel/compiler/brw_vec4.cpp b/src/intel/compiler/brw_vec4.cpp index 8fefecd6429..a6ce2efcfd8 100644 --- a/src/intel/compiler/brw_vec4.cpp +++ b/src/intel/compiler/brw_vec4.cpp @@ -2905,7 +2905,7 @@ brw_compile_vs(const struct brw_compiler *compiler, prog_data->inputs_read = nir->info.inputs_read; prog_data->double_inputs_read = nir->info.vs.double_inputs; - brw_nir_lower_vs_inputs(nir, key->gl_attrib_wa_flags); + brw_nir_lower_vs_inputs(nir, params->edgeflag_is_last, key->gl_attrib_wa_flags); brw_nir_lower_vue_outputs(nir); brw_postprocess_nir(nir, compiler, is_scalar, debug_enabled, key->base.robust_buffer_access);