diff options
author | Jason Ekstrand <[email protected]> | 2017-12-01 14:43:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-08 15:43:25 -0800 |
commit | 0c879b62b0ee33a6eafcd5a38e4f50d3eabf5450 (patch) | |
tree | 85b6b5d75b75b4019503a3b55426bd590220933f /src | |
parent | 1968cd07a220f38f1655ea946e25a882312bdb32 (diff) |
anv/cmd_buffer: Add some stage asserts
There are several places where we look up opcodes in an array of stages.
Assert that the we don't end up going out-of-bounds.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index e4362d12059..16b4ca68786 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1822,6 +1822,9 @@ cmd_buffer_emit_descriptor_pointers(struct anv_cmd_buffer *cmd_buffer, }; anv_foreach_stage(s, stages) { + assert(s < ARRAY_SIZE(binding_table_opcodes)); + assert(binding_table_opcodes[s] > 0); + if (cmd_buffer->state.samplers[s].alloc_size > 0) { anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_SAMPLER_STATE_POINTERS_VS), ssp) { @@ -1858,6 +1861,9 @@ cmd_buffer_flush_push_constants(struct anv_cmd_buffer *cmd_buffer) if (stage == MESA_SHADER_COMPUTE) continue; + assert(stage < ARRAY_SIZE(push_constant_opcodes)); + assert(push_constant_opcodes[stage] > 0); + struct anv_state state = anv_cmd_buffer_push_constants(cmd_buffer, stage); if (state.offset == 0) { |