mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-27 04:04:23 +08:00
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>
This commit is contained in:
parent
7c73346549
commit
982106e676
@ -1262,10 +1262,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;
|
||||
|
||||
@ -1390,7 +1403,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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user