v3dv: rewrite dirty state handling
The current implementation assumed that we would clear all dirty state after we have emitted a pipeline, but that is not always true. In particular, we don't emit blend constants unless we need them, so we can't clear its dirty bit until we have bound a pipeline that actually requires them. The change implemented here has individual emit functions clear pipeline states they hadle as they emit the corresponding state and we clear the dirty pipeline bit at the end. This fixes some CTS pipeline blend tests where we have multiple draws with blending and only some of them require blend constants. In this case, the original behavior would clear the blend constants dirty bit on draw calls that don't actually emit blend constants (because they don't need them), making the later draw calls that do need them fail because they don't emit them either (since the previous draw calls cleared the dirty bit). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
committed by
Marge Bot
parent
c525849d95
commit
7c1910f453
@@ -1664,7 +1664,7 @@ cmd_buffer_bind_pipeline_static_state(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
}
|
||||
|
||||
if (!(dynamic_mask & V3DV_DYNAMIC_BLEND_CONSTANTS)) {
|
||||
if (memcmp(&dest->blend_constants, &src->blend_constants,
|
||||
if (memcmp(dest->blend_constants, src->blend_constants,
|
||||
sizeof(src->blend_constants))) {
|
||||
memcpy(dest->blend_constants, src->blend_constants,
|
||||
sizeof(src->blend_constants));
|
||||
@@ -1949,6 +1949,8 @@ emit_scissor(struct v3dv_cmd_buffer *cmd_buffer)
|
||||
clip_window.extent.height = maxy - miny;
|
||||
|
||||
emit_clip_window(cmd_buffer->state.job, &clip_window);
|
||||
|
||||
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_SCISSOR;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1985,6 +1987,8 @@ emit_viewport(struct v3dv_cmd_buffer *cmd_buffer)
|
||||
vp.viewport_centre_x_coordinate = vptranslate[0];
|
||||
vp.viewport_centre_y_coordinate = vptranslate[1];
|
||||
}
|
||||
|
||||
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_VIEWPORT;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2069,8 +2073,9 @@ emit_blend(struct v3dv_cmd_buffer *cmd_buffer)
|
||||
}
|
||||
|
||||
if (pipeline->blend.needs_color_constants &&
|
||||
(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_BLEND_CONSTANTS)) {
|
||||
cl_emit_prepacked(&job->bcl, &pipeline->blend.constant_color);
|
||||
cmd_buffer->state.dirty & V3DV_CMD_DIRTY_BLEND_CONSTANTS) {
|
||||
cl_emit_prepacked(&job->bcl, &pipeline->blend.constant_color);
|
||||
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_BLEND_CONSTANTS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2314,6 +2319,10 @@ emit_graphics_pipeline(struct v3dv_cmd_buffer *cmd_buffer)
|
||||
emit_centroid_flags)) {
|
||||
cl_emit(&job->bcl, ZERO_ALL_CENTROID_FLAGS, flags);
|
||||
}
|
||||
|
||||
cmd_buffer->state.dirty &= ~(V3DV_CMD_DIRTY_VERTEX_BUFFER |
|
||||
V3DV_CMD_DIRTY_DESCRIPTOR_SETS |
|
||||
V3DV_CMD_DIRTY_PUSH_CONSTANTS);
|
||||
}
|
||||
|
||||
/* FIXME: C&P from v3dx_draw. Refactor to common place? */
|
||||
@@ -2440,9 +2449,10 @@ cmd_buffer_emit_pre_draw(struct v3dv_cmd_buffer *cmd_buffer)
|
||||
if (*dirty & dynamic_stencil_dirty_flags)
|
||||
emit_stencil(cmd_buffer);
|
||||
|
||||
emit_blend(cmd_buffer);
|
||||
if (*dirty & (V3DV_CMD_DIRTY_PIPELINE | V3DV_CMD_DIRTY_BLEND_CONSTANTS))
|
||||
emit_blend(cmd_buffer);
|
||||
|
||||
cmd_buffer->state.dirty &= ~(*dirty);
|
||||
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_PIPELINE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user