zink: Fix MSVC RTC in zink_get_framebuffer_imageless()
The bit fields in zink_framebuffer_state cause a false positive with MSVC's run-time checks enabled. setting state.num_attachments in zink_get_framebuffer_imageless(). Writing some bits of num_attachments involves reading bits from layers and samples that haven't been initialized. Fixed by assigning to num_attachments earlier in the function. Not quite sure why that makes a difference but at a guess there's a heuristic that considers assignment close to declaration as initialization. Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14566>
This commit is contained in:
@@ -143,6 +143,8 @@ zink_get_framebuffer_imageless(struct zink_context *ctx)
|
||||
assert(zink_screen(ctx->base.screen)->info.have_KHR_imageless_framebuffer);
|
||||
|
||||
struct zink_framebuffer_state state;
|
||||
state.num_attachments = ctx->fb_state.nr_cbufs;
|
||||
|
||||
const unsigned cresolve_offset = ctx->fb_state.nr_cbufs + !!ctx->fb_state.zsbuf;
|
||||
unsigned num_resolves = 0;
|
||||
for (int i = 0; i < ctx->fb_state.nr_cbufs; i++) {
|
||||
@@ -160,7 +162,6 @@ zink_get_framebuffer_imageless(struct zink_context *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
state.num_attachments = ctx->fb_state.nr_cbufs;
|
||||
const unsigned zsresolve_offset = cresolve_offset + num_resolves;
|
||||
if (ctx->fb_state.zsbuf) {
|
||||
struct pipe_surface *psurf = ctx->fb_state.zsbuf;
|
||||
|
||||
Reference in New Issue
Block a user