From d4e8c8f874d57edc8eb67a4bc1172cdfe6791327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 20 Aug 2024 07:56:14 +0300 Subject: [PATCH] anv: move setting 3DSTATE_CLIP::MaximumVPIndex from loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Loop iterates viewports but for MaximumVPIndex we only need viewport count and last stage that writes viewport. Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/genX_gfx_state.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index d1979199677..96114f1a619 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -1279,6 +1279,16 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer) mesh_prog_data->map.start_dw[VARYING_SLOT_VIEWPORT] >= 0; } + /* From the Vulkan 1.0.45 spec: + * + * "If the last active vertex processing stage shader entry + * point's interface does not include a variable decorated with + * ViewportIndex, then the first viewport is used." + */ + SET(CLIP, clip.MaximumVPIndex, (last_raster_stage_write_viewport && + dyn->vp.viewport_count > 0) ? + dyn->vp.viewport_count - 1 : 0); + struct anv_instance *instance = cmd_buffer->device->physical->instance; const VkViewport *viewports = dyn->vp.viewports; @@ -1402,16 +1412,6 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer) SET(VIEWPORT_CC, vp_cc.elem[i].MinimumDepth, min_depth); SET(VIEWPORT_CC, vp_cc.elem[i].MaximumDepth, max_depth); - - /* From the Vulkan 1.0.45 spec: - * - * "If the last active vertex processing stage shader entry - * point's interface does not include a variable decorated with - * ViewportIndex, then the first viewport is used." - */ - SET(CLIP, clip.MaximumVPIndex, (last_raster_stage_write_viewport && - dyn->vp.viewport_count > 0) ? - dyn->vp.viewport_count - 1 : 0); } /* If the HW state is already considered dirty or the previous