zink: Fix MSVC RTC in zink_get_framebuffer_imageless()
authorCharles Baker <charles@juicelabs.co>
Fri, 21 Jan 2022 07:41:54 +0000 (20:41 +1300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 8 Feb 2022 14:43:00 +0000 (14:43 +0000)
commit418c77640bfe433caf3edccec5a43bd86c7e04f3
tree16a18f866dedc8804e16093388e0814bb57e5888
parent86cb664cd8548f05d3a0fc07fea3a14e34ba60cc
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>
src/gallium/drivers/zink/zink_framebuffer.c