v3dv: always emit index buffer state for new jobs
New jobs need to re-emit all state. Typically, this is achieved by resetting all dirty state flags when we start a new job, but for index buffers we were not using a dirty bit because we always emit them immediately. This patch adds the bit and only tries to skip index buffer state if the bit is not dirty, which will ensure that we will always emit it for new jobs. This fixes a regression in the shadowmapping demo from Sascha Willems introduced with "v3dv: try harder to skip emission of redundant state". Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
committed by
Marge Bot
parent
2f1c15116f
commit
1d6edcc3e8
@@ -4083,10 +4083,17 @@ v3dv_CmdBindIndexBuffer(VkCommandBuffer commandBuffer,
|
||||
v3dv_return_if_oom(cmd_buffer, NULL);
|
||||
|
||||
const uint32_t index_size = get_index_size(indexType);
|
||||
if (buffer == cmd_buffer->state.index_buffer.buffer &&
|
||||
offset == cmd_buffer->state.index_buffer.offset &&
|
||||
index_size == cmd_buffer->state.index_buffer.index_size) {
|
||||
return;
|
||||
|
||||
/* If we have started a new job we always need to emit index buffer state.
|
||||
* We know we are in that scenario because that is the only case where we
|
||||
* set the dirty bit.
|
||||
*/
|
||||
if (!(cmd_buffer->state.dirty & V3DV_CMD_DIRTY_INDEX_BUFFER)) {
|
||||
if (buffer == cmd_buffer->state.index_buffer.buffer &&
|
||||
offset == cmd_buffer->state.index_buffer.offset &&
|
||||
index_size == cmd_buffer->state.index_buffer.index_size) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cl_emit(&job->bcl, INDEX_BUFFER_SETUP, ib) {
|
||||
@@ -4098,6 +4105,8 @@ v3dv_CmdBindIndexBuffer(VkCommandBuffer commandBuffer,
|
||||
cmd_buffer->state.index_buffer.buffer = buffer;
|
||||
cmd_buffer->state.index_buffer.offset = offset;
|
||||
cmd_buffer->state.index_buffer.index_size = index_size;
|
||||
|
||||
cmd_buffer->state.dirty &= ~V3DV_CMD_DIRTY_INDEX_BUFFER;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -605,13 +605,14 @@ enum v3dv_cmd_dirty_bits {
|
||||
V3DV_CMD_DIRTY_STENCIL_REFERENCE = 1 << 4,
|
||||
V3DV_CMD_DIRTY_PIPELINE = 1 << 5,
|
||||
V3DV_CMD_DIRTY_VERTEX_BUFFER = 1 << 6,
|
||||
V3DV_CMD_DIRTY_DESCRIPTOR_SETS = 1 << 7,
|
||||
V3DV_CMD_DIRTY_COMPUTE_DESCRIPTOR_SETS = 1 << 8,
|
||||
V3DV_CMD_DIRTY_PUSH_CONSTANTS = 1 << 9,
|
||||
V3DV_CMD_DIRTY_BLEND_CONSTANTS = 1 << 10,
|
||||
V3DV_CMD_DIRTY_OCCLUSION_QUERY = 1 << 11,
|
||||
V3DV_CMD_DIRTY_DEPTH_BIAS = 1 << 12,
|
||||
V3DV_CMD_DIRTY_LINE_WIDTH = 1 << 13,
|
||||
V3DV_CMD_DIRTY_INDEX_BUFFER = 1 << 7,
|
||||
V3DV_CMD_DIRTY_DESCRIPTOR_SETS = 1 << 8,
|
||||
V3DV_CMD_DIRTY_COMPUTE_DESCRIPTOR_SETS = 1 << 9,
|
||||
V3DV_CMD_DIRTY_PUSH_CONSTANTS = 1 << 10,
|
||||
V3DV_CMD_DIRTY_BLEND_CONSTANTS = 1 << 11,
|
||||
V3DV_CMD_DIRTY_OCCLUSION_QUERY = 1 << 12,
|
||||
V3DV_CMD_DIRTY_DEPTH_BIAS = 1 << 13,
|
||||
V3DV_CMD_DIRTY_LINE_WIDTH = 1 << 14,
|
||||
};
|
||||
|
||||
struct v3dv_dynamic_state {
|
||||
|
||||
Reference in New Issue
Block a user