Module: Mesa Branch: main Commit: ca4ec49b0e0f51a3245c924ab50379673f11abfb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca4ec49b0e0f51a3245c924ab50379673f11abfb
Author: Tapani Pälli <[email protected]> Date: Tue Mar 28 19:07:22 2023 +0300 anv: use primitive ID override when shader does not supply it Patch moves over this fix from iris driver. Fixes following test on DG2: dEQP-VK.rasterization.culling.primitive_id Cc: mesa-stable Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Ivan Briano <[email protected]> [v1] Reviewed-by: Lionel Landwerlin <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22130> --- src/intel/vulkan/genX_pipeline.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 6223f0d98bf..68c5eb9dbaa 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -512,6 +512,19 @@ emit_3dstate_sbe(struct anv_graphics_pipeline *pipeline) sbe.VertexURBEntryReadLength = DIV_ROUND_UP(max_source_attr + 1, 2); sbe.ForceVertexURBEntryReadOffset = true; sbe.ForceVertexURBEntryReadLength = true; + + /* Ask the hardware to supply PrimitiveID if the fragment shader + * reads it but a previous stage didn't write one. + */ + if ((wm_prog_data->inputs & VARYING_BIT_PRIMITIVE_ID) && + fs_input_map->varying_to_slot[VARYING_SLOT_PRIMITIVE_ID] == -1) { + sbe.PrimitiveIDOverrideAttributeSelect = + wm_prog_data->urb_setup[VARYING_SLOT_PRIMITIVE_ID]; + sbe.PrimitiveIDOverrideComponentX = true; + sbe.PrimitiveIDOverrideComponentY = true; + sbe.PrimitiveIDOverrideComponentZ = true; + sbe.PrimitiveIDOverrideComponentW = true; + } } else { assert(anv_pipeline_is_mesh(pipeline)); #if GFX_VERx10 >= 125
