Mesa (main): zink: clamp dynamic renderArea to framebuffer size
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 14 20:32:32 UTC 2022
Module: Mesa
Branch: main
Commit: 8c0f3cdfac5dc3d2bb5ee2fb153481e4b786fdfe
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8c0f3cdfac5dc3d2bb5ee2fb153481e4b786fdfe
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Jun 9 09:18:08 2022 -0400
zink: clamp dynamic renderArea to framebuffer size
it's illegal to have a renderArea larger than the attachments, so perform
clamping to avoid that scenario
Fixes: c81cd989c85 ("zink: use dynamic rendering (most of the time)")
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16947>
---
src/gallium/drivers/zink/zink_context.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index bd790cae37e..82903ed77f0 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -2051,6 +2051,11 @@ begin_rendering(struct zink_context *ctx)
else
ctx->dynamic_fb.attachments[i].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
ctx->gfx_pipeline_state.rendering_formats[i] = surf ? surf->info.format[0] : VK_FORMAT_R8G8B8A8_UNORM;
+ /* use dummy fb size of 1024 if no surf exists */
+ unsigned width = surf ? surf->base.texture->width0 : 1024;
+ unsigned height = surf ? surf->base.texture->height0 : 1024;
+ ctx->dynamic_fb.info.renderArea.extent.width = MIN2(ctx->dynamic_fb.info.renderArea.extent.width, width);
+ ctx->dynamic_fb.info.renderArea.extent.height = MIN2(ctx->dynamic_fb.info.renderArea.extent.height, height);
}
/* unset depth and stencil info: reset below */
More information about the mesa-commit
mailing list