diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-02-14 04:05:15 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:31:37 +0000 |
| commit | 88b1c13f143d471356118f9b869f3adcf5be29ab (patch) | |
| tree | 59da55496cf06b107cf5c882a9369edaef042ad0 /Graphics/GraphicsEngine | |
| parent | Removed duplicates of FindImmutableSampler (diff) | |
| download | DiligentCore-88b1c13f143d471356118f9b869f3adcf5be29ab.tar.gz DiligentCore-88b1c13f143d471356118f9b869f3adcf5be29ab.zip | |
Few minor updates to PipelineResourceSignature{Vk and D3D12}Impl
Diffstat (limited to 'Graphics/GraphicsEngine')
| -rw-r--r-- | Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp | 20 | ||||
| -rw-r--r-- | Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp | 6 |
2 files changed, 19 insertions, 7 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index 913418fa..e76f38fc 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -132,9 +132,10 @@ protected: { const auto& Res = Desc.Resources[i]; - VERIFY(Res.Name != nullptr, "Name can't be null. This error should've been caught by ValidatePipelineResourceSignatureDesc."); - VERIFY(Res.ShaderStages != SHADER_TYPE_UNKNOWN, "ShaderStages can't be SHADER_TYPE_UNKNOWN. This error should've been caught by ValidatePipelineResourceSignatureDesc."); - VERIFY(Res.ArraySize != 0, "ArraySize can't be 0. This error should've been caught by ValidatePipelineResourceSignatureDesc."); + VERIFY(Res.Name != nullptr, "Name can't be null. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); + VERIFY(Res.Name[0] != '\0', "Name can't be empty. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); + VERIFY(Res.ShaderStages != SHADER_TYPE_UNKNOWN, "ShaderStages can't be SHADER_TYPE_UNKNOWN. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); + VERIFY(Res.ArraySize != 0, "ArraySize can't be 0. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); Allocator.AddSpaceForString(Res.Name); } @@ -142,7 +143,9 @@ protected: for (Uint32 i = 0; i < Desc.NumImmutableSamplers; ++i) { VERIFY(Desc.ImmutableSamplers[i].SamplerOrTextureName != nullptr, - "SamplerOrTextureName can't be null. This error should've been caught by ValidatePipelineResourceSignatureDesc."); + "SamplerOrTextureName can't be null. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); + VERIFY(Desc.ImmutableSamplers[i].SamplerOrTextureName[0] != '\0', + "SamplerOrTextureName can't be empty. This error should've been caught by ValidatePipelineResourceSignatureDesc()."); Allocator.AddSpaceForString(Desc.ImmutableSamplers[i].SamplerOrTextureName); } @@ -160,7 +163,8 @@ protected: { auto& Dst = pResources[i]; Dst = Desc.Resources[i]; - Dst.Name = Allocator.CopyString(Desc.Resources[i].Name); + VERIFY_EXPR(Desc.Resources[i].Name != nullptr && Desc.Resources[i].Name[0] != '\0'); + Dst.Name = Allocator.CopyString(Desc.Resources[i].Name); ++m_ResourceOffsets[Dst.VarType + 1]; } @@ -186,8 +190,9 @@ protected: for (Uint32 i = 0; i < Desc.NumImmutableSamplers; ++i) { - auto& Dst = pSamplers[i]; - Dst = Desc.ImmutableSamplers[i]; + auto& Dst = pSamplers[i]; + Dst = Desc.ImmutableSamplers[i]; + VERIFY_EXPR(Desc.ImmutableSamplers[i].SamplerOrTextureName != nullptr && Desc.ImmutableSamplers[i].SamplerOrTextureName[0] != '\0'); Dst.SamplerOrTextureName = Allocator.CopyString(Desc.ImmutableSamplers[i].SamplerOrTextureName); } @@ -274,6 +279,7 @@ protected: protected: size_t m_Hash = 0; + // Resource offsets (e.g. index of the first resource), for each variable type. std::array<Uint16, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES + 1> m_ResourceOffsets = {}; // Shader stages that have resources. diff --git a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp index d11cd0ba..2c2abbe3 100644 --- a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp +++ b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp @@ -63,6 +63,9 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& if (Res.Name == nullptr) LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].Name must not be null"); + if (Res.Name[0] == '\0') + LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].Name must not be empty"); + if (Res.ShaderStages == SHADER_TYPE_UNKNOWN) LOG_PRS_ERROR_AND_THROW("Desc.Resources[", i, "].ShaderStages must not be SHADER_TYPE_UNKNOWN"); @@ -202,6 +205,9 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& if (SamDesc.SamplerOrTextureName == nullptr) LOG_PRS_ERROR_AND_THROW("Desc.ImmutableSamplers[", i, "].SamplerOrTextureName must not be null"); + if (SamDesc.SamplerOrTextureName[0] == '\0') + LOG_PRS_ERROR_AND_THROW("Desc.ImmutableSamplers[", i, "].SamplerOrTextureName must not be empty"); + auto& UsedStages = ImtblSamShaderStages[SamDesc.SamplerOrTextureName]; if ((UsedStages & SamDesc.ShaderStages) != 0) { |
