anv: move setting 3DSTATE_CLIP::MaximumVPIndex from loop

Loop iterates viewports but for MaximumVPIndex we only need viewport
count and last stage that writes viewport.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30732>
This commit is contained in:
Tapani Pälli 2024-08-20 07:56:14 +03:00 committed by Marge Bot
parent 3967b4bf22
commit d4e8c8f874

View file

@ -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