diff --git a/.pick_status.json b/.pick_status.json index bb017a3cc9e..27dffd47a88 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1094,7 +1094,7 @@ "description": "anv: only set 3DSTATE_CLIP::MaximumVPIndex once", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "50f6903bd9c472eef2af2cbf62027df3bbe0ca8a", "notes": null 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 @@ -972,19 +972,6 @@ emit_3dstate_clip(struct anv_graphics_pipeline *pipeline, const struct brw_vue_prog_data *last = anv_pipeline_get_last_vue_prog_data(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 @@ -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;