Open cdotstout opened 5 months ago
The line in question does spv::MemoryAccessMask accessMask = spv::MemoryAccessMask(TranslateMemoryAccess(coherentFlags) & ~spv::MemoryAccessMakePointerAvailableKHRMask
which is a pattern that is kind of unavoidable when your enum is a bitmask. Wouldn't the combined values after a bitwise OR also not technically be members of the enum type, resulting in the same problem? In which case this is really a problem with spirv.hpp
.
Yes, the problem is inherent in doing bitwise operations on an enum type that is really a bunch of masks.
I wonder if switching to spirv.hpp11 would help because then those enums are enum classes based on unsigned
which we can presume are 32bit.
(Note: Glslang's spirv.hpp is a copy of the original spirv.hpp from the SPIRV-Headers project. It gets copied in on an as needed basis.)
Oh, nope. I think that wouldn't help. See https://cplusplus.github.io/CWG/issues/1766.html which says casting a numeric value to an enum type that doesn't have that value is undefined behaviour.
So that's interesting...
Branch based on glslang commit 57d86ab763da7b2cd1e00ecec8aa697403a8fd20
Some of the bitwise operators for mask combining in SPIRV.hpp create mask values that are outside the valid range of the enum, which apparently is undefined behavior as flagged by the Fuchsia platform build: