From fbcafa67111e79752b96866bf42fce31836ee442 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Thu, 30 Aug 2018 09:31:11 -0700 Subject: Fixed shader parsing errors caused by incorrect representation of signed enums as bit fields --- Graphics/GLSLTools/include/SPIRVShaderResources.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Graphics/GLSLTools') diff --git a/Graphics/GLSLTools/include/SPIRVShaderResources.h b/Graphics/GLSLTools/include/SPIRVShaderResources.h index 58e003e2..d87f1f39 100644 --- a/Graphics/GLSLTools/include/SPIRVShaderResources.h +++ b/Graphics/GLSLTools/include/SPIRVShaderResources.h @@ -86,10 +86,15 @@ struct SPIRVShaderResourceAttribs NumResourceTypes }; + static constexpr const Uint32 ResourceTypeBits = 4; + static constexpr const Uint32 VarTypeBits = 4; + static_assert(SHADER_VARIABLE_TYPE_NUM_TYPES < (1 << VarTypeBits), "Not enough bits to represent SHADER_VARIABLE_TYPE"); + static_assert(NumResourceTypes < (1 << ResourceTypeBits), "Not enough bits to represent ResourceType"); + const char *Name; const Uint16 ArraySize; - const ResourceType Type : 4; - const SHADER_VARIABLE_TYPE VarType : 4; + const ResourceType Type : ResourceTypeBits; + const SHADER_VARIABLE_TYPE VarType : VarTypeBits; const Int8 StaticSamplerInd; // Offset in SPIRV words (uint32_t) of binding & descriptor set decorations in SPIRV binary -- cgit v1.2.3