diff options
author | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2024-08-07 10:17:00 +0300 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2024-08-20 17:58:07 +0200 |
commit | 9817d44c27071e5786ffd5c225d0d306a998bb0c (patch) | |
tree | 8e17203165d1e16dcd3c4a3a034685815918ffd0 /src/intel | |
parent | 98f760e17bc87674b620fceaa046f7af74c5c27e (diff) |
anv: only set 3DSTATE_CLIP::MaximumVPIndex once
Currently we can end up merging 2 prepacked 3DSTATE_CLIP instructions
where 2 different places in the driver fill the MaximumVPIndex.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 50f6903bd9 ("anv: add new low level emission & dirty state tracking")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30684>
(cherry picked from commit 982106e6768e6f69d71710e314325c813591452d)
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/genX_gfx_state.c | 22 | ||||
-rw-r--r-- | src/intel/vulkan/genX_pipeline.c | 19 |
2 files changed, 21 insertions, 20 deletions
diff --git a/src/intel/vulkan/genX_gfx_state.c b/src/intel/vulkan/genX_gfx_state.c index 68fa487550e..768796f5391 100644 --- a/src/intel/vulkan/genX_gfx_state.c +++ b/src/intel/vulkan/genX_gfx_state.c @@ -1235,10 +1235,23 @@ genX(cmd_buffer_flush_gfx_runtime_state)(struct anv_cmd_buffer *cmd_buffer) } if ((gfx->dirty & ANV_CMD_DIRTY_RENDER_AREA) || + (gfx->dirty & ANV_CMD_DIRTY_PIPELINE) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_VIEWPORTS) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_SCISSORS) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_RS_DEPTH_CLAMP_ENABLE) || BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VP_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE)) { + bool last_raster_stage_write_viewport; + if (anv_pipeline_is_primitive(pipeline)) { + const struct brw_vue_prog_data *last = + anv_pipeline_get_last_vue_prog_data(pipeline); + last_raster_stage_write_viewport = + (last->vue_map.slots_valid & VARYING_BIT_VIEWPORT) != 0; + } else { + const struct brw_mesh_prog_data *mesh_prog_data = get_mesh_prog_data(pipeline); + last_raster_stage_write_viewport = + mesh_prog_data->map.start_dw[VARYING_SLOT_VIEWPORT] >= 0; + } + struct anv_instance *instance = cmd_buffer->device->physical->instance; const VkViewport *viewports = dyn->vp.viewports; @@ -1363,7 +1376,14 @@ 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); - SET(CLIP, clip.MaximumVPIndex, dyn->vp.viewport_count > 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); } diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 33507d1a4d8..52006582500 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -974,19 +974,6 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline, /* 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." - */ - if (vp && (last->vue_map.slots_valid & VARYING_BIT_VIEWPORT)) { - clip.MaximumVPIndex = vp->viewport_count > 0 ? - vp->viewport_count - 1 : 0; - } else { - clip.MaximumVPIndex = 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 Layer, then * the first layer is used." @@ -996,12 +983,6 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline, } else if (anv_pipeline_is_mesh(pipeline)) { const struct brw_mesh_prog_data *mesh_prog_data = get_mesh_prog_data(pipeline); - if (vp && vp->viewport_count > 0 && - mesh_prog_data->map.start_dw[VARYING_SLOT_VIEWPORT] >= 0) { - clip.MaximumVPIndex = vp->viewport_count - 1; - } else { - clip.MaximumVPIndex = 0; - } clip.ForceZeroRTAIndexEnable = mesh_prog_data->map.start_dw[VARYING_SLOT_LAYER] < 0; |