summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-01-26 07:15:53 +0000
committerazhirnov <zh1dron@gmail.com>2021-01-26 07:15:53 +0000
commit51f876af24d24e923a08af00a69e9f5d9ec6bcfe (patch)
treeacc2411776b145326d788de99e2ff135e4e604ab /Graphics
parentremove assigned samplers from SPIRV resources (diff)
downloadDiligentCore-51f876af24d24e923a08af00a69e9f5d9ec6bcfe.tar.gz
DiligentCore-51f876af24d24e923a08af00a69e9f5d9ec6bcfe.zip
allow to combine graphics PRS with mesh pipeline
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp24
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h3
-rw-r--r--Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp10
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp13
-rw-r--r--Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp2
5 files changed, 31 insertions, 21 deletions
diff --git a/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp b/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp
index af4a04ea..0cac3ff5 100644
--- a/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp
+++ b/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp
@@ -1453,35 +1453,33 @@ SHADER_TYPE GetShaderTypeFromPipelineIndex(Int32 Index, PIPELINE_TYPE PipelineTy
PIPELINE_TYPE PipelineTypeFromShaderStages(SHADER_TYPE ShaderStages)
{
+ if ((ShaderStages & ~SHADER_TYPE_PIXEL) & SHADER_TYPE_ALL_MESH)
+ {
+ VERIFY((ShaderStages & SHADER_TYPE_ALL_MESH) == ShaderStages,
+ "Mesh shading pipeline stages can't be combined with other shader stages");
+ return PIPELINE_TYPE_MESH;
+ }
if (ShaderStages & SHADER_TYPE_ALL_GRAPHICS)
{
VERIFY((ShaderStages & SHADER_TYPE_ALL_GRAPHICS) == ShaderStages,
"Graphics pipeline stages can't be combined with other shader stages");
return PIPELINE_TYPE_GRAPHICS;
}
- else if (ShaderStages & SHADER_TYPE_COMPUTE)
+ if (ShaderStages & SHADER_TYPE_COMPUTE)
{
VERIFY((ShaderStages & SHADER_TYPE_COMPUTE) == ShaderStages,
"Compute stage can't be combined with any other shader stage");
return PIPELINE_TYPE_COMPUTE;
}
- else if (ShaderStages & SHADER_TYPE_ALL_MESH)
- {
- VERIFY((ShaderStages & SHADER_TYPE_ALL_MESH) == ShaderStages,
- "Mesh shading pipeline stages can't be combined with other shader stages");
- return PIPELINE_TYPE_MESH;
- }
- else if (ShaderStages & SHADER_TYPE_ALL_RAY_TRACING)
+ if (ShaderStages & SHADER_TYPE_ALL_RAY_TRACING)
{
VERIFY((ShaderStages & SHADER_TYPE_ALL_RAY_TRACING) == ShaderStages,
"Ray tracing pipeline stages can't be combined with other shader stages");
return PIPELINE_TYPE_RAY_TRACING;
}
- else
- {
- UNEXPECTED("Unknown shader stage");
- return PIPELINE_TYPE_INVALID;
- }
+
+ UNEXPECTED("Unknown shader stage");
+ return PIPELINE_TYPE_INVALID;
}
Uint32 GetStagingTextureLocationOffset(const TextureDesc& TexDesc,
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index 28207960..063b6777 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -71,7 +71,8 @@ DILIGENT_TYPED_ENUM(SHADER_TYPE, Uint32)
/// All mesh shading pipeline stages
SHADER_TYPE_ALL_MESH = SHADER_TYPE_AMPLIFICATION |
- SHADER_TYPE_MESH,
+ SHADER_TYPE_MESH |
+ SHADER_TYPE_PIXEL,
/// All ray-tracing pipeline shader stages
SHADER_TYPE_ALL_RAY_TRACING = SHADER_TYPE_RAY_GEN |
diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
index 660815f6..87cf1da0 100644
--- a/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
+++ b/Graphics/GraphicsEngineVulkan/include/PipelineLayoutVk.hpp
@@ -46,7 +46,7 @@ public:
PipelineLayoutVk();
~PipelineLayoutVk();
- void Create(RenderDeviceVkImpl* pDeviceVk, IPipelineResourceSignature** ppSignatures, Uint32 SignatureCount);
+ void Create(RenderDeviceVkImpl* pDeviceVk, PIPELINE_TYPE PipelineType, IPipelineResourceSignature** ppSignatures, Uint32 SignatureCount);
void Release(RenderDeviceVkImpl* pDeviceVkImpl, Uint64 CommandQueueMask);
size_t GetHash() const;
@@ -69,10 +69,10 @@ public:
struct ResourceInfo
{
- SHADER_RESOURCE_TYPE Type = SHADER_RESOURCE_TYPE_UNKNOWN;
-
- Uint32 DescrSetIndex = 0;
- Uint32 BindingIndex = 0;
+ IPipelineResourceSignature* Signature = nullptr;
+ SHADER_RESOURCE_TYPE Type = SHADER_RESOURCE_TYPE_UNKNOWN;
+ Uint32 DescrSetIndex = 0;
+ Uint32 BindingIndex = 0;
};
bool GetResourceInfo(const char* Name, SHADER_TYPE Stage, ResourceInfo& Info) const;
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
index 969fe16e..e190c4fd 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayoutVk.cpp
@@ -56,7 +56,7 @@ void PipelineLayoutVk::Release(RenderDeviceVkImpl* pDeviceVk, Uint64 CommandQueu
}
}
-void PipelineLayoutVk::Create(RenderDeviceVkImpl* pDeviceVk, IPipelineResourceSignature** ppSignatures, Uint32 SignatureCount)
+void PipelineLayoutVk::Create(RenderDeviceVkImpl* pDeviceVk, PIPELINE_TYPE PipelineType, IPipelineResourceSignature** ppSignatures, Uint32 SignatureCount)
{
VERIFY(m_SignatureCount == 0 && m_DescrSetCount == 0 && !m_VkPipelineLayout,
"This pipeline layout is already initialized");
@@ -68,6 +68,7 @@ void PipelineLayoutVk::Create(RenderDeviceVkImpl* pDeviceVk, IPipelineResourceSi
const Uint8 Index = pSignature->GetDesc().BindingIndex;
+#ifdef DILIGENT_DEBUG
VERIFY(Index < m_Signatures.size(),
"Pipeline resource signature specifies binding index ", Uint32{Index}, " that exceeds the limit (", m_Signatures.size() - 1,
"). This error should've been caught by ValidatePipelineResourceSignatureDesc.");
@@ -77,6 +78,16 @@ void PipelineLayoutVk::Create(RenderDeviceVkImpl* pDeviceVk, IPipelineResourceSi
" conflicts with another resource signature '", m_Signatures[Index]->GetDesc().Name,
"' that uses the same index. This error should've been caught by ValidatePipelineResourceSignatures.");
+ for (Uint32 s = 0, StageCount = pSignature->GetNumShaderStages(); s < StageCount; ++s)
+ {
+ const auto ShaderType = pSignature->GetShaderStageType(s);
+ VERIFY(IsConsistentShaderType(ShaderType, PipelineType),
+ "Pipeline resource signature '", pSignature->GetDesc().Name, "' at index ", Uint32{Index},
+ " has shader stage '", GetShaderTypeLiteralName(ShaderType), "' that is not compatible with pipeline type '",
+ GetPipelineTypeString(PipelineType), "'.");
+ }
+#endif
+
m_SignatureCount = std::max<Uint8>(m_SignatureCount, Index + 1);
m_Signatures[Index] = pSignature;
}
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
index 41585909..2817a53a 100644
--- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp
@@ -830,7 +830,7 @@ void PipelineStateVkImpl::InitPipelineLayout(const PipelineStateCreateInfo& Crea
}
}
- m_PipelineLayout.Create(GetDevice(), Signatures.data(), SignatureCount);
+ m_PipelineLayout.Create(GetDevice(), CreateInfo.PSODesc.PipelineType, Signatures.data(), SignatureCount);
// verify that pipeline layout is compatible with shader resources and
// remap resource bindings