summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-04 21:05:42 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-04 21:05:42 +0000
commit86bd2d7175d3e2d0f5c1c313a802a22c9f95b4ea (patch)
treee4d8d6f4f90a4805d6d230d6fd7f49390be4cdab /Graphics/GraphicsEngine
parentAdded render pass MS resolve test (diff)
downloadDiligentCore-86bd2d7175d3e2d0f5c1c313a802a22c9f95b4ea.tar.gz
DiligentCore-86bd2d7175d3e2d0f5c1c313a802a22c9f95b4ea.zip
Implemented input attachments in Vulkan backend; added test
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/TextureBase.hpp3
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h15
-rw-r--r--Graphics/GraphicsEngine/interface/Shader.h11
-rw-r--r--Graphics/GraphicsEngine/src/RenderPassBase.cpp8
4 files changed, 27 insertions, 10 deletions
diff --git a/Graphics/GraphicsEngine/include/TextureBase.hpp b/Graphics/GraphicsEngine/include/TextureBase.hpp
index 38414be2..fd0256b6 100644
--- a/Graphics/GraphicsEngine/include/TextureBase.hpp
+++ b/Graphics/GraphicsEngine/include/TextureBase.hpp
@@ -123,6 +123,9 @@ public:
") correspond to one of ", pDevice->GetCommandQueueCount(), " available device command queues");
this->m_Desc.CommandQueueMask &= DeviceQueuesMask;
+ if ((this->m_Desc.BindFlags & BIND_INPUT_ATTACHMENT) != 0)
+ this->m_Desc.BindFlags |= BIND_SHADER_RESOURCE;
+
// Validate correctness of texture description
ValidateTextureDesc(this->m_Desc);
}
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 3c0ca99a..727888d9 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1644,6 +1644,7 @@ struct VulkanDescriptorPoolSize
Uint32 NumStorageBufferDescriptors DEFAULT_INITIALIZER(0);
Uint32 NumUniformTexelBufferDescriptors DEFAULT_INITIALIZER(0);
Uint32 NumStorageTexelBufferDescriptors DEFAULT_INITIALIZER(0);
+ Uint32 NumInputAttachmentDescriptors DEFAULT_INITIALIZER(0);
#if DILIGENT_CPP_INTERFACE
VulkanDescriptorPoolSize()noexcept {}
@@ -1656,7 +1657,8 @@ struct VulkanDescriptorPoolSize
Uint32 _NumUniformBufferDescriptors,
Uint32 _NumStorageBufferDescriptors,
Uint32 _NumUniformTexelBufferDescriptors,
- Uint32 _NumStorageTexelBufferDescriptors)noexcept :
+ Uint32 _NumStorageTexelBufferDescriptors,
+ Uint32 _NumInputAttachmentDescriptors)noexcept :
MaxDescriptorSets {_MaxDescriptorSets },
NumSeparateSamplerDescriptors {_NumSeparateSamplerDescriptors },
NumCombinedSamplerDescriptors {_NumCombinedSamplerDescriptors },
@@ -1665,7 +1667,8 @@ struct VulkanDescriptorPoolSize
NumUniformBufferDescriptors {_NumUniformBufferDescriptors },
NumStorageBufferDescriptors {_NumStorageBufferDescriptors },
NumUniformTexelBufferDescriptors{_NumUniformTexelBufferDescriptors},
- NumStorageTexelBufferDescriptors{_NumStorageTexelBufferDescriptors}
+ NumStorageTexelBufferDescriptors{_NumStorageTexelBufferDescriptors},
+ NumInputAttachmentDescriptors {_NumInputAttachmentDescriptors }
{
// On clang aggregate initialization fails to compile if
// structure members have default initializers
@@ -1700,8 +1703,8 @@ struct EngineVkCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
/// the engine creates another one.
VulkanDescriptorPoolSize MainDescriptorPoolSize
#if DILIGENT_CPP_INTERFACE
- //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
- {8192, 1024, 8192, 8192, 1024, 4096, 4096, 1024, 1024}
+ //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB InptAtt
+ {8192, 1024, 8192, 8192, 1024, 4096, 4096, 1024, 1024, 256}
#endif
;
@@ -1712,8 +1715,8 @@ struct EngineVkCreateInfo DILIGENT_DERIVE(EngineCreateInfo)
VulkanDescriptorPoolSize DynamicDescriptorPoolSize
#if DILIGENT_CPP_INTERFACE
- //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB
- {2048, 256, 2048, 2048, 256, 1024, 1024, 256, 256}
+ //Max SepSm CmbSm SmpImg StrImg UB SB UTxB StTxB InptAtt
+ {2048, 256, 2048, 2048, 256, 1024, 1024, 256, 256, 64}
#endif
;
diff --git a/Graphics/GraphicsEngine/interface/Shader.h b/Graphics/GraphicsEngine/interface/Shader.h
index eacd35f0..f3df92d3 100644
--- a/Graphics/GraphicsEngine/interface/Shader.h
+++ b/Graphics/GraphicsEngine/interface/Shader.h
@@ -283,8 +283,10 @@ struct ShaderCreateInfo
};
typedef struct ShaderCreateInfo ShaderCreateInfo;
+// clang-format off
/// Describes shader resource type
-DILIGENT_TYPED_ENUM(SHADER_RESOURCE_TYPE, Uint8){
+DILIGENT_TYPED_ENUM(SHADER_RESOURCE_TYPE, Uint8)
+{
/// Shader resource type is unknown
SHADER_RESOURCE_TYPE_UNKNOWN = 0,
@@ -304,7 +306,12 @@ DILIGENT_TYPED_ENUM(SHADER_RESOURCE_TYPE, Uint8){
SHADER_RESOURCE_TYPE_BUFFER_UAV,
/// Sampler (separate sampler)
- SHADER_RESOURCE_TYPE_SAMPLER};
+ SHADER_RESOURCE_TYPE_SAMPLER,
+
+ /// Input attachment in a render pass
+ SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT
+};
+// clang-format on
/// Shader resource description
struct ShaderResourceDesc
diff --git a/Graphics/GraphicsEngine/src/RenderPassBase.cpp b/Graphics/GraphicsEngine/src/RenderPassBase.cpp
index a0548e4d..b6b38dd0 100644
--- a/Graphics/GraphicsEngine/src/RenderPassBase.cpp
+++ b/Graphics/GraphicsEngine/src/RenderPassBase.cpp
@@ -89,7 +89,8 @@ void ValidateRenderPassDesc(const RenderPassDesc& Desc)
Attachment.InitialState != RESOURCE_STATE_RESOLVE_DEST &&
Attachment.InitialState != RESOURCE_STATE_RESOLVE_SOURCE &&
Attachment.InitialState != RESOURCE_STATE_COPY_DEST &&
- Attachment.InitialState != RESOURCE_STATE_COPY_SOURCE)
+ Attachment.InitialState != RESOURCE_STATE_COPY_SOURCE &&
+ Attachment.InitialState != RESOURCE_STATE_INPUT_ATTACHMENT)
{
LOG_RENDER_PASS_ERROR_AND_THROW("the initial state of depth-stencil attachment ", i, " (", GetResourceStateString(Attachment.InitialState), ") is invalid.");
}
@@ -101,7 +102,8 @@ void ValidateRenderPassDesc(const RenderPassDesc& Desc)
Attachment.FinalState != RESOURCE_STATE_RESOLVE_DEST &&
Attachment.FinalState != RESOURCE_STATE_RESOLVE_SOURCE &&
Attachment.FinalState != RESOURCE_STATE_COPY_DEST &&
- Attachment.FinalState != RESOURCE_STATE_COPY_SOURCE)
+ Attachment.FinalState != RESOURCE_STATE_COPY_SOURCE &&
+ Attachment.FinalState != RESOURCE_STATE_INPUT_ATTACHMENT)
{
LOG_RENDER_PASS_ERROR_AND_THROW("the final state of depth-stencil attachment ", i, " (", GetResourceStateString(Attachment.FinalState), ") is invalid.");
}
@@ -114,6 +116,7 @@ void ValidateRenderPassDesc(const RenderPassDesc& Desc)
Attachment.InitialState != RESOURCE_STATE_RESOLVE_DEST &&
Attachment.InitialState != RESOURCE_STATE_RESOLVE_SOURCE &&
Attachment.InitialState != RESOURCE_STATE_COPY_SOURCE &&
+ Attachment.InitialState != RESOURCE_STATE_INPUT_ATTACHMENT &&
Attachment.InitialState != RESOURCE_STATE_PRESENT)
{
LOG_RENDER_PASS_ERROR_AND_THROW("the initial state of color attachment ", i, " (", GetResourceStateString(Attachment.InitialState), ") is invalid.");
@@ -125,6 +128,7 @@ void ValidateRenderPassDesc(const RenderPassDesc& Desc)
Attachment.FinalState != RESOURCE_STATE_RESOLVE_DEST &&
Attachment.FinalState != RESOURCE_STATE_RESOLVE_SOURCE &&
Attachment.FinalState != RESOURCE_STATE_COPY_SOURCE &&
+ Attachment.FinalState != RESOURCE_STATE_INPUT_ATTACHMENT &&
Attachment.FinalState != RESOURCE_STATE_PRESENT)
{
LOG_RENDER_PASS_ERROR_AND_THROW("the final state of color attachment ", i, " (", GetResourceStateString(Attachment.FinalState), ") is invalid.");