From 7a148ffcd6569ad21dc112c1823feb7b7477cb10 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 15 Feb 2021 19:06:56 -0800 Subject: Removed duplicates of FindAssignedSampler and FindImmutableSampler functions --- .../include/PipelineResourceSignatureD3D12Impl.hpp | 2 -- .../src/PipelineResourceSignatureD3D12Impl.cpp | 30 ++-------------------- .../src/PipelineStateD3D12Impl.cpp | 4 ++- 3 files changed, 5 insertions(+), 31 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') 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> 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 TextureSrvToAssignedSamplerInd(m_Desc.NumResources, ResourceAttribs::InvalidSamplerInd); // Index of the immutable sampler for every sampler in m_Desc.Resources, or -1. - std::vector ResourceToImmutableSamplerInd(m_Desc.NumResources, -1); + std::vector 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())) -- cgit v1.2.3