From b8f8c9a337c22ccc24ed7ba4eac58fd100c5f04a Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Mon, 27 Feb 2023 18:03:44 +0800 Subject: [PATCH] added GetIndex at VKShaderParse.h --- VKShaderParse.h | 27 ++++++++++++++++----------- glsl2spv.cpp | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/VKShaderParse.h b/VKShaderParse.h index a3df6a3..fe8bf22 100644 --- a/VKShaderParse.h +++ b/VKShaderParse.h @@ -49,7 +49,12 @@ public: return compiler->get_name(res.id); } - const uint32_t GetSet(const spirv_cross::Resource &res)const + const uint32_t GetIndex(const spirv_cross::Resource &res)const + { + return compiler->get_decoration(res.id,spv::DecorationIndex); + } + + const uint32_t GetDescriptorSet(const spirv_cross::Resource &res)const { return compiler->get_decoration(res.id,spv::DecorationDescriptorSet); } @@ -64,6 +69,16 @@ public: return compiler->get_decoration(res.id,spv::DecorationLocation); } + const uint32_t GetOffset(const spirv_cross::Resource& res)const + { + return compiler->get_decoration(res.id,spv::DecorationOffset); + } + + const uint32_t GetInputAttachmentIndex(const spirv_cross::Resource& res)const + { + return compiler->get_decoration(res.id,spv::DecorationInputAttachmentIndex); + } + void GetFormat(const spirv_cross::Resource &res,spirv_cross::SPIRType::BaseType *base_type,uint8_t *vecsize) { const spirv_cross::SPIRType &type=compiler->get_type(res.type_id); @@ -72,18 +87,8 @@ public: *vecsize =type.vecsize; } - const uint32_t GetOffset(const spirv_cross::Resource& res)const - { - return compiler->get_decoration(res.id,spv::DecorationOffset); - } - const uint32_t GetBufferSize(const spirv_cross::Resource& res)const { return (uint32_t)(compiler->get_declared_struct_size(compiler->get_type(res.base_type_id))); } - - const uint32_t GetInputAttachmentIndex(const spirv_cross::Resource& res)const - { - return compiler->get_decoration(res.id,spv::DecorationInputAttachmentIndex); - } };//class ShaderParse diff --git a/glsl2spv.cpp b/glsl2spv.cpp index ae7f5b8..97b86a1 100644 --- a/glsl2spv.cpp +++ b/glsl2spv.cpp @@ -399,7 +399,7 @@ void OutputShaderResource(ShaderResourceData *ssd,ShaderParse *sp,co for(const spirv_cross::Resource &obj:res) { strcpy(sr->name,sp->GetName(obj).c_str()); - sr->set = sp->GetSet(obj); + sr->set = sp->GetDescriptorSet(obj); sr->binding=sp->GetBinding(obj); ++sr;