zink: use a safer iteration for fb surfaces during rp init
doing a pointer iteration looks cool, but if the array is full, then it goes out of bounds and we crash Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9542>
This commit is contained in:
parent
38f7faa8a4
commit
86bd643d6a
|
@ -1154,8 +1154,11 @@ zink_begin_render_pass(struct zink_context *ctx, struct zink_batch *batch)
|
||||||
framebuffer_state_buffer_barriers_setup(ctx, fb_state, batch);
|
framebuffer_state_buffer_barriers_setup(ctx, fb_state, batch);
|
||||||
|
|
||||||
zink_batch_reference_framebuffer(batch, ctx->framebuffer);
|
zink_batch_reference_framebuffer(batch, ctx->framebuffer);
|
||||||
for (struct zink_surface **surf = (struct zink_surface **)ctx->framebuffer->surfaces; *surf; surf++)
|
for (int i = 0; i < ARRAY_SIZE(ctx->framebuffer->surfaces); i++) {
|
||||||
zink_batch_reference_resource_rw(batch, zink_resource((*surf)->base.texture), true);
|
if (!ctx->framebuffer->surfaces[i])
|
||||||
|
break;
|
||||||
|
zink_batch_reference_resource_rw(batch, zink_resource(ctx->framebuffer->surfaces[i]->texture), true);
|
||||||
|
}
|
||||||
|
|
||||||
vkCmdBeginRenderPass(batch->cmdbuf, &rpbi, VK_SUBPASS_CONTENTS_INLINE);
|
vkCmdBeginRenderPass(batch->cmdbuf, &rpbi, VK_SUBPASS_CONTENTS_INLINE);
|
||||||
batch->in_rp = true;
|
batch->in_rp = true;
|
||||||
|
|
Loading…
Reference in New Issue