summaryrefslogtreecommitdiffstats
path: root/Graphics/GLSLTools
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-05-06 01:00:06 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-05-06 01:00:06 +0000
commitf61a2f2e7812df47776868336aec4e9e4f560b0c (patch)
tree747221d09412f52de006c90efcfde4ae50f8b179 /Graphics/GLSLTools
parentAdded shader variable type parsing in Vulkan (diff)
downloadDiligentCore-f61a2f2e7812df47776868336aec4e9e4f560b0c.tar.gz
DiligentCore-f61a2f2e7812df47776868336aec4e9e4f560b0c.zip
Added stubs for shader resource layout initialization from pipeline layout
Diffstat (limited to 'Graphics/GLSLTools')
-rw-r--r--Graphics/GLSLTools/include/SPIRVShaderResources.h10
-rw-r--r--Graphics/GLSLTools/src/SPIRVShaderResources.cpp12
2 files changed, 3 insertions, 19 deletions
diff --git a/Graphics/GLSLTools/include/SPIRVShaderResources.h b/Graphics/GLSLTools/include/SPIRVShaderResources.h
index df853933..504a0b08 100644
--- a/Graphics/GLSLTools/include/SPIRVShaderResources.h
+++ b/Graphics/GLSLTools/include/SPIRVShaderResources.h
@@ -80,16 +80,14 @@ struct SPIRVShaderResourceAttribs
const String Name;
- const Uint16 Binding;
const Uint16 ArraySize;
+ const ResourceType Type;
+ const SHADER_VARIABLE_TYPE VarType : 8;
// offset in SPIRV words (uint32_t) for a decoration which was originally declared in the SPIRV binary
const uint32_t BindingDecorationOffset;
const uint32_t DescriptorSetDecorationOffset;
- const Uint8 DescriptorSet;
- const ResourceType Type : 4;
- const SHADER_VARIABLE_TYPE VarType : 4;
SPIRVShaderResourceAttribs(const spirv_cross::Compiler &Compiler, const spirv_cross::Resource &Res, ResourceType _Type, SHADER_VARIABLE_TYPE _VarType);
@@ -104,9 +102,7 @@ struct SPIRVShaderResourceAttribs
bool IsCompatibleWith(const SPIRVShaderResourceAttribs& Attibs)const
{
- return Binding == Attibs.Binding &&
- DescriptorSet == Attibs.DescriptorSet &&
- ArraySize == Attibs.ArraySize &&
+ return ArraySize == Attibs.ArraySize &&
Type == Attibs.Type;
}
};
diff --git a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp
index 854f6582..0b869339 100644
--- a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp
+++ b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp
@@ -49,26 +49,14 @@ static uint32_t GetDecorationOffset(const spirv_cross::Compiler &Compiler,
return offset;
}
-template<typename Type>
-static Type GetDecoration(const spirv_cross::Compiler &Compiler,
- const spirv_cross::Resource &Res,
- spv::Decoration Decoration)
-{
- auto dec = Compiler.get_decoration(Res.id, Decoration);
- VERIFY(dec <= std::numeric_limits<Type>::max(), "Decoration value exceeds maximum representable value ", std::numeric_limits<Type>::max());
- return static_cast<Type>(dec);
-}
-
SPIRVShaderResourceAttribs::SPIRVShaderResourceAttribs(const spirv_cross::Compiler &Compiler,
const spirv_cross::Resource &Res,
ResourceType _Type,
SHADER_VARIABLE_TYPE _VarType) :
Name(Res.name),
- Binding(GetDecoration<decltype(Binding)>(Compiler, Res, spv::DecorationBinding)),
ArraySize(GetResourceArraySize<decltype(ArraySize)>(Compiler, Res)),
BindingDecorationOffset(GetDecorationOffset(Compiler, Res, spv::Decoration::DecorationBinding)),
DescriptorSetDecorationOffset(GetDecorationOffset(Compiler, Res, spv::Decoration::DecorationDescriptorSet)),
- DescriptorSet(GetDecoration<decltype(DescriptorSet)>(Compiler,Res, spv::DecorationDescriptorSet)),
Type(_Type),
VarType(_VarType)
{