Closed MasonRemaley closed 4 days ago
This brings the copy of
spirv.hpp
that glslang uses in line with what is done in thespirv.hpp11
file in the spirv-headers repo, [...]
Out of curiosity, what does the .hpp11
extension mean? I saw it when setting up my build, but am not familiar with the convention.
I build my engine with Zig, which enables LLVM's Undefined Behavior Sanitizer by default in debug builds. UBSAN caught undefined behavior during shader compilation at the following location:
The explanation is that enums when used as bitflags in C++ must declare a backing type. If they don't, you can end up with "out of range" values (for example when bitwise negated as is the case in this trace) leading to undefined behavior when converting to/from integral values.
It's a bit hard to follow, but see the discussion here on C++ enums and undefined behavior.
Thankfully, the fix is easy. This PR simply sets the relevant enum backing types to
unsigned int
. I choseunsigned int
since these enums are already assumed to be unsigned ints in other parts of the code anyway.