diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 0d0dfabf4ef..f34ec23f0d0 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -70,6 +70,7 @@ #endif #include "util/u_vector.h" #include "util/u_math.h" +#include "util/u_tristate.h" #include "util/vma.h" #include "util/xmlconfig.h" #include "vk_acceleration_structure.h" @@ -4456,7 +4457,7 @@ struct anv_cmd_graphics_state { uint32_t index_size; uint32_t indirect_data_stride; - bool indirect_data_stride_aligned; + enum u_tristate indirect_data_stride_aligned; struct vk_vertex_input_state vertex_input; struct vk_sample_locations_state sample_locations; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index fb970d0066e..f827ba57ce8 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3663,6 +3663,17 @@ genX(CmdExecuteCommands)( container->state.gfx.viewport_set |= secondary->state.gfx.viewport_set; + /* Copy the mode of the secondary if set, at the next draw if things + * don't match we will reprogram. + */ + if (secondary->state.gfx.indirect_data_stride_aligned != + U_TRISTATE_UNSET) { + container->state.gfx.indirect_data_stride_aligned = + secondary->state.gfx.indirect_data_stride_aligned; + container->state.gfx.indirect_data_stride = + secondary->state.gfx.indirect_data_stride; + } + db_mode = secondary->state.current_db_mode; } diff --git a/src/intel/vulkan/genX_cmd_draw.c b/src/intel/vulkan/genX_cmd_draw.c index 9fdfe1e5c10..6824b00d0c7 100644 --- a/src/intel/vulkan/genX_cmd_draw.c +++ b/src/intel/vulkan/genX_cmd_draw.c @@ -985,8 +985,9 @@ cmd_buffer_flush_gfx_state(struct anv_cmd_buffer *cmd_buffer) #if GFX_VER >= 20 if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_INDIRECT_DATA_STRIDE) { anv_batch_emit(&cmd_buffer->batch, GENX(STATE_BYTE_STRIDE), sb_stride) { - sb_stride.ByteStride = cmd_buffer->state.gfx.indirect_data_stride; - sb_stride.ByteStrideEnable = !cmd_buffer->state.gfx.indirect_data_stride_aligned; + sb_stride.ByteStride = cmd_buffer->state.gfx.indirect_data_stride >> 2; + sb_stride.ByteStrideEnable = + cmd_buffer->state.gfx.indirect_data_stride_aligned == U_TRISTATE_NO; } } #endif @@ -1894,7 +1895,7 @@ cmd_buffer_set_indirect_stride(struct anv_cmd_buffer *cmd_buffer, UNREACHABLE("unhandled cmd type"); } - bool aligned = stride == data_stride; + enum u_tristate aligned = u_tristate_make(stride == data_stride); #if GFX_VER >= 20 /* The stride can change as long as it matches the default command stride @@ -1908,7 +1909,7 @@ cmd_buffer_set_indirect_stride(struct anv_cmd_buffer *cmd_buffer, gfx_state->indirect_data_stride = stride; gfx_state->indirect_data_stride_aligned = aligned; gfx_state->dirty |= ANV_CMD_DIRTY_INDIRECT_DATA_STRIDE; - } else if (!gfx_state->indirect_data_stride_aligned && + } else if (gfx_state->indirect_data_stride_aligned == U_TRISTATE_NO && gfx_state->indirect_data_stride != stride) { gfx_state->indirect_data_stride = stride; gfx_state->indirect_data_stride_aligned = aligned;