Module: Mesa Branch: main Commit: 427cc8d55ebed209f56c24375f601f69e9477d6d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=427cc8d55ebed209f56c24375f601f69e9477d6d
Author: Erik Faye-Lund <[email protected]> Date: Mon Apr 26 17:11:01 2021 +0200 lavapipe: tolerate NULL image-buffer view descriptors Reviewed-by: Dave Airlie <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16137> --- src/gallium/frontends/lavapipe/lvp_execute.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c index 0b06ca1f2cb..2565fa09555 100644 --- a/src/gallium/frontends/lavapipe/lvp_execute.c +++ b/src/gallium/frontends/lavapipe/lvp_execute.c @@ -1242,10 +1242,17 @@ static void fill_image_buffer_view_stage(struct rendering_state *state, return; idx += array_idx; idx += dyn_info->stage[stage].image_count; - state->iv[p_stage][idx].resource = bv->buffer->bo; - state->iv[p_stage][idx].format = bv->pformat; - state->iv[p_stage][idx].u.buf.offset = bv->offset + bv->buffer->offset; - state->iv[p_stage][idx].u.buf.size = bv->range == VK_WHOLE_SIZE ? (bv->buffer->size - bv->offset): bv->range; + if (bv) { + state->iv[p_stage][idx].resource = bv->buffer->bo; + state->iv[p_stage][idx].format = bv->pformat; + state->iv[p_stage][idx].u.buf.offset = bv->offset + bv->buffer->offset; + state->iv[p_stage][idx].u.buf.size = bv->range == VK_WHOLE_SIZE ? (bv->buffer->size - bv->offset): bv->range; + } else { + state->iv[p_stage][idx].resource = NULL; + state->iv[p_stage][idx].format = PIPE_FORMAT_NONE; + state->iv[p_stage][idx].u.buf.offset = 0; + state->iv[p_stage][idx].u.buf.size = 0; + } if (state->num_shader_images[p_stage] <= idx) state->num_shader_images[p_stage] = idx + 1; state->iv_dirty[p_stage] = true;
