summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-26 21:58:20 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:12 +0000
commited3961215d0ef02ff8c78e9030ab85793d2880af (patch)
tree13dda96e8132a1081f7883403f38f545ee792b19 /Graphics/GraphicsEngineVulkan
parentAdded PSO creation failure tests for mesh & ray tracing pipelines, fixed ray ... (diff)
downloadDiligentCore-ed3961215d0ef02ff8c78e9030ab85793d2880af.tar.gz
DiligentCore-ed3961215d0ef02ff8c78e9030ab85793d2880af.zip
Few updates to PipelineStateVkImpl and PipelineStateD3D12Impl
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp7
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp43
2 files changed, 27 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
index febc0002..f8fae8ee 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
@@ -61,8 +61,11 @@ void PipelineLayoutVk::Create(RenderDeviceVkImpl* pDeviceVk, PIPELINE_TYPE Pipel
VERIFY(m_SignatureCount == 0 && m_DescrSetCount == 0 && !m_VkPipelineLayout,
"This pipeline layout is already initialized");
- PipelineResourceSignatureVkImpl::CopyResourceSignatures(PipelineType, SignatureCount, ppSignatures,
- m_Signatures.data(), m_Signatures.size(), m_SignatureCount);
+ auto MaxSignatureBindIndex =
+ PipelineResourceSignatureVkImpl::CopyResourceSignatures(PipelineType, SignatureCount, ppSignatures,
+ m_Signatures.data(), m_Signatures.size());
+ m_SignatureCount = static_cast<Uint8>(MaxSignatureBindIndex + 1);
+ VERIFY_EXPR(m_SignatureCount == MaxSignatureBindIndex + 1);
std::array<VkDescriptorSetLayout, MAX_RESOURCE_SIGNATURES * PipelineResourceSignatureVkImpl::MAX_DESCRIPTOR_SETS> DescSetLayouts;
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index ac09e78d..ade2d0f1 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -588,28 +588,29 @@ void GetShaderResourceTypeAndFlags(SPIRVShaderResourceAttribs::ResourceType Type
}
}
-void VerifyResourceMerge(const SPIRVShaderResourceAttribs& ExistingRes,
+void VerifyResourceMerge(const PipelineStateDesc& PSODesc,
+ const SPIRVShaderResourceAttribs& ExistingRes,
const SPIRVShaderResourceAttribs& NewResAttribs)
{
- DEV_CHECK_ERR(ExistingRes.Type == NewResAttribs.Type,
- "Shader variable '", NewResAttribs.Name,
- "' exists in multiple shaders from the same shader stage, but its type is not consistent between "
- "shaders. All variables with the same name from the same shader stage must have the same type.");
-
- DEV_CHECK_ERR(ExistingRes.ResourceDim == NewResAttribs.ResourceDim,
- "Shader variable '", NewResAttribs.Name,
- "' exists in multiple shaders from the same shader stage, but its resource dimension is not consistent between "
- "shaders. All variables with the same name from the same shader stage must have the same resource dimension.");
-
- DEV_CHECK_ERR(ExistingRes.ArraySize == NewResAttribs.ArraySize,
- "Shader variable '", NewResAttribs.Name,
- "' exists in multiple shaders from the same shader stage, but its array size is not consistent between "
- "shaders. All variables with the same name from the same shader stage must have the same array size.");
-
- DEV_CHECK_ERR(ExistingRes.IsMS == NewResAttribs.IsMS,
- "Shader variable '", NewResAttribs.Name,
- "' exists in multiple shaders from the same shader stage, but its multisample flag is not consistent between "
- "shaders. All variables with the same name from the same shader stage must either be multisample or non-multisample.");
+#define LOG_RESOURCE_MERGE_ERROR_AND_THROW(PropertyName) \
+ LOG_ERROR_AND_THROW("Shader variable '", NewResAttribs.Name, \
+ "' is shared between multiple shaders in pipeline '", (PSODesc.Name ? PSODesc.Name : ""), \
+ "', but its " PropertyName " varies. A variable shared between multiple shaders " \
+ "must be defined identically in all shaders. Either use separate variables for " \
+ "different shader stages, change resource name or make sure that " PropertyName " is consistent.");
+
+ if (ExistingRes.Type != NewResAttribs.Type)
+ LOG_RESOURCE_MERGE_ERROR_AND_THROW("type");
+
+ if (ExistingRes.ResourceDim != NewResAttribs.ResourceDim)
+ LOG_RESOURCE_MERGE_ERROR_AND_THROW("resource dimension");
+
+ if (ExistingRes.ArraySize != NewResAttribs.ArraySize)
+ LOG_RESOURCE_MERGE_ERROR_AND_THROW("array size");
+
+ if (ExistingRes.IsMS != NewResAttribs.IsMS)
+ LOG_RESOURCE_MERGE_ERROR_AND_THROW("mutlisample state");
+#undef LOG_RESOURCE_MERGE_ERROR_AND_THROW
}
} // namespace
@@ -816,7 +817,7 @@ void PipelineStateVkImpl::CreateDefaultSignature(const PipelineStateCreateInfo&
}
else
{
- VerifyResourceMerge(IterAndAssigned.first->Attribs, Attribs);
+ VerifyResourceMerge(CreateInfo.PSODesc, IterAndAssigned.first->Attribs, Attribs);
}
});