brw: use meaningful io locations for system values

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32418>
This commit is contained in:
Lionel Landwerlin
2024-12-02 15:00:07 +02:00
committed by Marge Bot
parent 6b99bf76ca
commit f19c5f4fcc
2 changed files with 11 additions and 3 deletions
+8
View File
@@ -230,6 +230,14 @@ struct brw_base_prog_key {
#define MAX_VK_VERT_ATTRIB (VERT_ATTRIB_GENERIC0 + 29)
#define MAX_HW_VERT_ATTRIB (VERT_ATTRIB_GENERIC0 + 34)
/**
* Use the last 2 slots :
* - slot 32: start vertex, vertex count, instance count, start instance
* - slot 33: base vertex, base instance, draw id
*/
#define BRW_SVGS_VE_INDEX (32)
#define BRW_DRAWID_VE_INDEX (33)
/** The program key for Vertex Shaders. */
struct brw_vs_prog_key {
struct brw_base_prog_key base;
+3 -3
View File
@@ -464,6 +464,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir)
load->src[0] = nir_src_for_ssa(nir_imm_int(&b, 0));
unsigned input_offset = 0;
unsigned location = BRW_SVGS_VE_INDEX;
switch (intrin->intrinsic) {
case nir_intrinsic_load_first_vertex:
nir_intrinsic_set_component(load, 0);
@@ -483,6 +484,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir)
* gl_VertexID and friends if any of them exist.
*/
input_offset += has_sgvs ? 1 : 0;
location = BRW_DRAWID_VE_INDEX;
if (intrin->intrinsic == nir_intrinsic_load_draw_id)
nir_intrinsic_set_component(load, 0);
else
@@ -498,7 +500,7 @@ brw_nir_lower_vs_inputs(nir_shader *nir)
*/
nir_intrinsic_set_base(load, num_inputs + input_offset);
struct nir_io_semantics io = {
.location = util_last_bit64(nir->info.inputs_read) + input_offset,
.location = VERT_ATTRIB_GENERIC0 + location,
.num_slots = 1,
};
nir_intrinsic_set_io_semantics(load, io);
@@ -2484,5 +2486,3 @@ brw_nir_lower_simd(nir_shader *nir, unsigned dispatch_width)
return nir_shader_lower_instructions(nir, filter_simd, lower_simd,
(void *)(uintptr_t)dispatch_width);
}