diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-02-16 03:06:56 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:31:38 +0000 |
| commit | 7a148ffcd6569ad21dc112c1823feb7b7477cb10 (patch) | |
| tree | 0627fc491cf9a8f4424c74d67aa1fb1053d16b17 /Graphics/GraphicsEngineD3D12 | |
| parent | optimize root view updates (diff) | |
| download | DiligentCore-7a148ffcd6569ad21dc112c1823feb7b7477cb10.tar.gz DiligentCore-7a148ffcd6569ad21dc112c1823feb7b7477cb10.zip | |
Removed duplicates of FindAssignedSampler and FindImmutableSampler functions
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
3 files changed, 5 insertions, 31 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp index c747dda2..386aeb84 100644 --- a/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/PipelineResourceSignatureD3D12Impl.hpp @@ -289,8 +289,6 @@ private: std::vector<Uint32, STDAllocatorRawMem<Uint32>> GetCacheTableSizes() const; - Uint32 FindAssignedSampler(const PipelineResourceDesc& SepImg) const; - private: ResourceAttribs* m_pResourceAttribs = nullptr; // [m_Desc.NumResources] diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp index 243cf9c0..6a1adb64 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp @@ -193,7 +193,7 @@ void PipelineResourceSignatureD3D12Impl::CreateLayout() // Index of the assigned sampler, for every texture SRV in m_Desc.Resources, or InvalidSamplerInd. std::vector<Uint32> TextureSrvToAssignedSamplerInd(m_Desc.NumResources, ResourceAttribs::InvalidSamplerInd); // Index of the immutable sampler for every sampler in m_Desc.Resources, or -1. - std::vector<int> ResourceToImmutableSamplerInd(m_Desc.NumResources, -1); + std::vector<Int32> ResourceToImmutableSamplerInd(m_Desc.NumResources, -1); for (Uint32 i = 0; i < m_Desc.NumResources; ++i) { const auto& ResDesc = m_Desc.Resources[i]; @@ -222,7 +222,7 @@ void PipelineResourceSignatureD3D12Impl::CreateLayout() if (ResDesc.ResourceType == SHADER_RESOURCE_TYPE_TEXTURE_SRV) { - TextureSrvToAssignedSamplerInd[i] = FindAssignedSampler(ResDesc); + TextureSrvToAssignedSamplerInd[i] = FindAssignedSampler(ResDesc, ResourceAttribs::InvalidSamplerInd); } } @@ -367,32 +367,6 @@ void PipelineResourceSignatureD3D12Impl::CreateLayout() } } -Uint32 PipelineResourceSignatureD3D12Impl::FindAssignedSampler(const PipelineResourceDesc& SepImg) const -{ - Uint32 SamplerInd = ResourceAttribs::InvalidSamplerInd; - if (IsUsingCombinedSamplers()) - { - const auto IdxRange = GetResourceIndexRange(SepImg.VarType); - - for (Uint32 i = IdxRange.first; i < IdxRange.second; ++i) - { - const auto& Res = m_Desc.Resources[i]; - VERIFY_EXPR(SepImg.VarType == Res.VarType); - - if (Res.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER && - (SepImg.ShaderStages & Res.ShaderStages) && - StreqSuff(Res.Name, SepImg.Name, GetCombinedSamplerSuffix())) - { - VERIFY_EXPR((Res.ShaderStages & SepImg.ShaderStages) == SepImg.ShaderStages); - SamplerInd = i; - break; - } - } - } - return SamplerInd; -} - - PipelineResourceSignatureD3D12Impl::~PipelineResourceSignatureD3D12Impl() { Destruct(); diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index 908965f8..a4c8769c 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -692,7 +692,9 @@ void PipelineStateD3D12Impl::InitRootSignature(const PipelineStateCreateInfo& Cr if (m_RootSig->GetTotalSpaces() > 1 && !IsSM51orAbove) { - LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' compiled with shader model 5.0 or below that is not compatible with register spaces that is used in DirectX 12."); + LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, + "' is compiled using SM5.0 or below that only supports single register space. " + "Compile the shader using SM5.1+ or change the resource layout to use only one space."); } if (IsDXILBytecode(pBytecode->GetBufferPointer(), pBytecode->GetBufferSize())) |
