summaryrefslogtreecommitdiffstats
path: root/Graphics/GLSLTools
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-08-30 16:31:11 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-08-30 16:31:11 +0000
commitfbcafa67111e79752b96866bf42fce31836ee442 (patch)
treeeda1f74bcecfc522ed0add585964f4af39e0ced5 /Graphics/GLSLTools
parentFixed compressed texture initialization in Vk (diff)
downloadDiligentCore-fbcafa67111e79752b96866bf42fce31836ee442.tar.gz
DiligentCore-fbcafa67111e79752b96866bf42fce31836ee442.zip
Fixed shader parsing errors caused by incorrect representation of signed enums as bit fields
Diffstat (limited to 'Graphics/GLSLTools')
-rw-r--r--Graphics/GLSLTools/include/SPIRVShaderResources.h9
1 files changed, 7 insertions, 2 deletions
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