diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-03 03:10:09 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:14 +0000 |
| commit | 0606e960bdb3895ce5effba8128b1c4b372a1ba0 (patch) | |
| tree | 3b15c0612c536bcdda6752b34d8bc71bd21764c7 /Graphics/GraphicsEngineVulkan | |
| parent | Removed mutable fields from ResourceBindingMap (diff) | |
| download | DiligentCore-0606e960bdb3895ce5effba8128b1c4b372a1ba0.tar.gz DiligentCore-0606e960bdb3895ce5effba8128b1c4b372a1ba0.zip | |
Unified pipeline resource compatibility validation in D3D12 and Vk; added more PRS creation failure tests
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index ade2d0f1..3a3f8092 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -922,8 +922,8 @@ void PipelineStateVkImpl::InitPipelineLayout(const PipelineStateCreateInfo& Crea } if (!Info) { - LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource with name '", SPIRVAttribs.Name, - "' that is not present in any pipeline resource signature that is used to create pipeline state '", + LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource '", SPIRVAttribs.Name, + "' that is not present in any pipeline resource signature used to create pipeline state '", m_Desc.Name, "'."); } @@ -934,33 +934,15 @@ void PipelineStateVkImpl::InitPipelineLayout(const PipelineStateCreateInfo& Crea { LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource with name '", SPIRVAttribs.Name, "' and type '", GetShaderResourceTypeLiteralName(Type), "' that is not compatible with type '", - GetShaderResourceTypeLiteralName(Info.Type), "' in pipeline resource signature '", Info.Signature->GetDesc().Name, "'."); + GetShaderResourceTypeLiteralName(Info.Type), "' specified in pipeline resource signature '", Info.Signature->GetDesc().Name, "'."); } if (Info.ResIndex != ~0u) { const auto& ResDesc = Info.Signature->GetResourceDesc(Info.ResIndex); - - if ((Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER) != (ResDesc.Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER)) - { - LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource '", SPIRVAttribs.Name, - "' that is", ((Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER) ? "" : " not"), - " labeled as formatted buffer, while the same resource specified by the pipeline resource signature '", - Info.Signature->GetDesc().Name, "' is", ((ResDesc.Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER) ? "" : " not"), - " labeled as such."); - } - - // SPIRVAttribs.ArraySize == 0 means that the resource is a runtime-sized array and ResDesc.ArraySize from the - // resource signature may have any non-zero value. - VERIFY(ResDesc.ArraySize > 0, "ResDesc.ArraySize can't be zero. This error should've be caught by ValidatePipelineResourceSignatureDesc()."); - if (ResDesc.ArraySize < SPIRVAttribs.ArraySize) - { - LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource '", SPIRVAttribs.Name, - "' whose array size (", SPIRVAttribs.ArraySize, ") is greater than the array size (", - ResDesc.ArraySize, ") specified by the pipeline resource signature '", Info.Signature->GetDesc().Name, "'."); - } + ValidatePipelineResourceCompatibility(ResDesc, Type, Flags, SPIRVAttribs.ArraySize, + pShader->GetDesc().Name, Info.Signature->GetDesc().Name); } - SPIRV[SPIRVAttribs.BindingDecorationOffset] = Info.BindingIndex; SPIRV[SPIRVAttribs.DescriptorSetDecorationOffset] = Info.DescrSetIndex; |
