anv: null check for buffer before reading size

v2: move assignment under existing check (Nanley)

Fixes: b9a05447a1 ("anv: dynamic vertex input binding stride and size support")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6369>
(cherry picked from commit 709dffa856)
This commit is contained in:
Tapani Pälli 2020-08-18 15:16:37 +03:00 committed by Dylan Baker
parent d74b2bf797
commit f7a4d89b19
2 changed files with 6 additions and 6 deletions

View file

@ -805,7 +805,7 @@
"description": "anv: null check for buffer before reading size",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "b9a05447a1976101c04a02f5588c51de0b0f6573"
},

View file

@ -3344,13 +3344,13 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
bool dynamic_stride = cmd_buffer->state.gfx.dynamic.dyn_vbo_stride;
bool dynamic_size = cmd_buffer->state.gfx.dynamic.dyn_vbo_size;
uint32_t stride = dynamic_stride ?
cmd_buffer->state.vertex_bindings[vb].stride : pipeline->vb[vb].stride;
uint32_t size = dynamic_size ?
cmd_buffer->state.vertex_bindings[vb].size : buffer->size;
struct GENX(VERTEX_BUFFER_STATE) state;
if (buffer) {
uint32_t stride = dynamic_stride ?
cmd_buffer->state.vertex_bindings[vb].stride : pipeline->vb[vb].stride;
uint32_t size = dynamic_size ?
cmd_buffer->state.vertex_bindings[vb].size : buffer->size;
state = (struct GENX(VERTEX_BUFFER_STATE)) {
.VertexBufferIndex = vb,