From 33abaf2d0edbbda77ad4a91fd201ae60f6fcc12a Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 28 Mar 2025 12:39:31 +0200 Subject: [PATCH] anv: simplify SBE emission MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using 3DSTATE_SBE_SWIZ for providing the implicit PrimitiveID value (when not written by the previous stage) seems to be the legacy way of doing things on Gfx7 and prior. On Gfx8+ we got this new 3DSTATE_SBE::PrimitiveIDOverrideAttributeSelect to get the HW to write the value wherever we want. Signed-off-by: Lionel Landwerlin Reviewed-by: Tapani Pälli Part-of: --- src/intel/vulkan/genX_pipeline.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 9582d2e2f4c..66650c87472 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -523,7 +523,7 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline) */ if (anv_pipeline_is_primitive(pipeline)) { for (uint8_t idx = 0; idx < wm_prog_data->urb_setup_attribs_count; idx++) { - uint8_t attr = wm_prog_data->urb_setup_attribs[idx]; + gl_varying_slot attr = wm_prog_data->urb_setup_attribs[idx]; int input_index = wm_prog_data->urb_setup[attr]; assert(0 <= input_index); @@ -534,22 +534,8 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline) } const int slot = vue_map->varying_to_slot[attr]; - - if (slot == -1) { - /* This attribute does not exist in the VUE--that means that - * the vertex shader did not write to it. It could be that it's - * a regular varying read by the fragment shader but not - * written by the vertex shader or it's gl_PrimitiveID. In the - * first case the value is undefined, in the second it needs to - * be gl_PrimitiveID. - */ - swiz.Attribute[input_index].ConstantSource = PRIM_ID; - swiz.Attribute[input_index].ComponentOverrideX = true; - swiz.Attribute[input_index].ComponentOverrideY = true; - swiz.Attribute[input_index].ComponentOverrideZ = true; - swiz.Attribute[input_index].ComponentOverrideW = true; + if (slot == -1) continue; - } /* We have to subtract two slots to account for the URB entry * output read offset in the VS and GS stages.