From 0606e960bdb3895ce5effba8128b1c4b372a1ba0 Mon Sep 17 00:00:00 2001 From: assiduous Date: Tue, 2 Mar 2021 19:10:09 -0800 Subject: Unified pipeline resource compatibility validation in D3D12 and Vk; added more PRS creation failure tests --- .../src/PipelineStateVkImpl.cpp | 28 ++++------------------ 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') 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; -- cgit v1.2.3