From 1e2632939aa072ca549416aaa57f767f34d28b1b Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sat, 10 Aug 2019 19:39:09 -0700 Subject: Fixed issue with reflecting Uniform Texel Buffers in Vulkan backend --- Graphics/GLSLTools/src/SPIRVShaderResources.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Graphics/GLSLTools') diff --git a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp index 10752550..5d701294 100644 --- a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp +++ b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp @@ -402,6 +402,11 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator, Uint32 CurrSepImg = 0; for (const auto& SepImg : resources.separate_images) { + const auto& type = Compiler.get_type(SepImg.type_id); + auto ResType = type.image.dim == spv::DimBuffer ? + SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer : + SPIRVShaderResourceAttribs::ResourceType::SeparateImage; + Uint32 SamplerInd = SPIRVShaderResourceAttribs::InvalidSepSmplrOrImgInd; if (CombinedSamplerSuffix != nullptr) { @@ -417,14 +422,22 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator, } if (SamplerInd == NumSepSmpls) SamplerInd = SPIRVShaderResourceAttribs::InvalidSepSmplrOrImgInd; + else + { + if (ResType == SPIRVShaderResourceAttribs::ResourceType::UniformTexelBuffer) + { + LOG_WARNING_MESSAGE("Combined image sampler assigned to uniform texel buffer '", SepImg.name, "' will be ignored"); + SamplerInd = SPIRVShaderResourceAttribs::InvalidSepSmplrOrImgInd; + } + } } auto* pNewSepImg = new (&GetSepImg(CurrSepImg++)) SPIRVShaderResourceAttribs(Compiler, SepImg, m_ResourceNames.CopyString(SepImg.name), - SPIRVShaderResourceAttribs::ResourceType::SeparateImage, + ResType, SamplerInd); - if (pNewSepImg->IsValidSepSamplerAssigned()) + if (ResType == SPIRVShaderResourceAttribs::ResourceType::SeparateImage && pNewSepImg->IsValidSepSamplerAssigned()) { #ifdef DEVELOPMENT const auto& SepSmplr = GetSepSmplr(pNewSepImg->GetAssignedSepSamplerInd()); -- cgit v1.2.3