From 7710b1be46281df91b6f04408e3f4423824f21e3 Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Thu, 26 Oct 2023 15:50:17 -0700 Subject: [PATCH] fix: SymOverrideInfo bitfields should be the same type (#1745) Stephen Friedman alerted me to the fact that on Windows, bit fields within a struct will only be combined if they are the same type. We were a bit sloppy in the defintion of SymOverrideInfo, and that was causing the struct to end up a different size in Windows. I think the solution is that all those bit fields should be `unsigned int`. --------- Signed-off-by: Larry Gritz --- src/liboslexec/oslexec_pvt.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/liboslexec/oslexec_pvt.h b/src/liboslexec/oslexec_pvt.h index 05ae2e999..740304962 100644 --- a/src/liboslexec/oslexec_pvt.h +++ b/src/liboslexec/oslexec_pvt.h @@ -1468,11 +1468,13 @@ class ShaderInstance { /// instance overrides from the master copy. struct SymOverrideInfo { // Using bit fields to keep the data in 8 bytes in total. - unsigned char m_valuesource : 3; - bool m_connected_down : 1; - bool m_interpolated : 1; - bool m_interactive : 1; - int m_arraylen : 26; + // Note: it's important that all the bitfields are the same type + // (unsigned int), or MSVS won't merge them properly into one int. + unsigned int m_valuesource : 3; + unsigned int m_connected_down : 1; + unsigned int m_interpolated : 1; + unsigned int m_interactive : 1; + unsigned int m_arraylen : 26; int m_data_offset; SymOverrideInfo()