anv: fix issues found with indirect data stride
Use tristate for the aligned setting, otherwise it is always
first disabled which contributes to the condition if we set the
new stride active.
v2: set ByteStride in dword units and take secondary cmdbuf
in to account (Lionel)
Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Nataraj Deshpande <nataraj.deshpande@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38349>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user