anv: fix up dynamic clip emission
There were 2 issues :
* We were not emitting the clip state when the pipeline changed
* On Gen7 we did not program the front facing & cull mode dynamic
values in the clip state
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: c34d8ac26e
("anv: handle dynamic viewport count")
Closes https://gitlab.freedesktop.org/mesa/mesa/-/issues/3379
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6265>
This commit is contained in:
parent
240c0746d1
commit
ffc8f2ba4c
|
@ -72,8 +72,6 @@ void genX(flush_pipeline_select_gpgpu)(struct anv_cmd_buffer *cmd_buffer);
|
|||
void genX(cmd_buffer_config_l3)(struct anv_cmd_buffer *cmd_buffer,
|
||||
const struct gen_l3_config *cfg);
|
||||
|
||||
void genX(cmd_buffer_emit_clip)(struct anv_cmd_buffer *cmd_buffer);
|
||||
|
||||
void genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer);
|
||||
void genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer);
|
||||
|
||||
|
|
|
@ -3263,26 +3263,44 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer,
|
|||
cmd_buffer->state.push_constants_dirty &= ~flushed;
|
||||
}
|
||||
|
||||
void
|
||||
genX(cmd_buffer_emit_clip)(struct anv_cmd_buffer *cmd_buffer)
|
||||
static void
|
||||
cmd_buffer_emit_clip(struct anv_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
const uint32_t clip_states =
|
||||
#if GEN_GEN <= 7
|
||||
ANV_CMD_DIRTY_DYNAMIC_FRONT_FACE |
|
||||
ANV_CMD_DIRTY_DYNAMIC_CULL_MODE |
|
||||
#endif
|
||||
ANV_CMD_DIRTY_DYNAMIC_VIEWPORT |
|
||||
ANV_CMD_DIRTY_PIPELINE;
|
||||
|
||||
if ((cmd_buffer->state.gfx.dirty & clip_states) == 0)
|
||||
return;
|
||||
|
||||
#if GEN_GEN <= 7
|
||||
const struct anv_dynamic_state *d = &cmd_buffer->state.gfx.dynamic;
|
||||
#endif
|
||||
struct GENX(3DSTATE_CLIP) clip = {
|
||||
GENX(3DSTATE_CLIP_header),
|
||||
#if GEN_GEN <= 7
|
||||
.FrontWinding = genX(vk_to_gen_front_face)[d->front_face],
|
||||
.CullMode = genX(vk_to_gen_cullmode)[d->cull_mode],
|
||||
#endif
|
||||
};
|
||||
uint32_t dwords[GENX(3DSTATE_CLIP_length)];
|
||||
|
||||
struct anv_graphics_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
|
||||
|
||||
if (cmd_buffer->state.gfx.dirty & (ANV_CMD_DIRTY_PIPELINE |
|
||||
ANV_CMD_DIRTY_DYNAMIC_VIEWPORT)) {
|
||||
uint32_t dwords[GENX(3DSTATE_CLIP_length)];
|
||||
int32_t count =
|
||||
const struct brw_vue_prog_data *last =
|
||||
anv_pipeline_get_last_vue_prog_data(pipeline);
|
||||
if (last->vue_map.slots_valid & VARYING_BIT_VIEWPORT) {
|
||||
clip.MaximumVPIndex =
|
||||
cmd_buffer->state.gfx.dynamic.viewport.count > 0 ?
|
||||
cmd_buffer->state.gfx.dynamic.viewport.count - 1 : 0;
|
||||
|
||||
struct GENX(3DSTATE_CLIP) clip = {
|
||||
GENX(3DSTATE_CLIP_header),
|
||||
.MaximumVPIndex = count,
|
||||
};
|
||||
GENX(3DSTATE_CLIP_pack)(NULL, dwords, &clip);
|
||||
anv_batch_emit_merge(&cmd_buffer->batch, dwords,
|
||||
pipeline->gen7.clip);
|
||||
cmd_buffer->state.gfx.dynamic.viewport.count - 1 : 0;
|
||||
}
|
||||
|
||||
GENX(3DSTATE_CLIP_pack)(NULL, dwords, &clip);
|
||||
anv_batch_emit_merge(&cmd_buffer->batch, dwords,
|
||||
pipeline->gen7.clip);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3469,10 +3487,10 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
|
|||
if (dirty)
|
||||
cmd_buffer_emit_descriptor_pointers(cmd_buffer, dirty);
|
||||
|
||||
if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_VIEWPORT) {
|
||||
genX(cmd_buffer_emit_clip)(cmd_buffer);
|
||||
cmd_buffer_emit_clip(cmd_buffer);
|
||||
|
||||
if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_DYNAMIC_VIEWPORT)
|
||||
gen8_cmd_buffer_emit_viewport(cmd_buffer);
|
||||
}
|
||||
|
||||
if (cmd_buffer->state.gfx.dirty & (ANV_CMD_DIRTY_DYNAMIC_VIEWPORT |
|
||||
ANV_CMD_DIRTY_PIPELINE)) {
|
||||
|
|
Loading…
Reference in New Issue