From 465e53fd32f983aadc2e46c6cee3a0d7b836fe64 Mon Sep 17 00:00:00 2001 From: assiduous Date: Sat, 1 Aug 2020 11:46:38 -0700 Subject: Implemented BeginRenderPass/NextSubpass/EndRenderPass in Vulkan backend --- Graphics/GraphicsEngine/interface/DeviceContext.h | 12 ++++++ Graphics/GraphicsEngine/interface/GraphicsTypes.h | 49 +++++++++++++++++++++++ Graphics/GraphicsEngine/interface/Texture.h | 48 +--------------------- 3 files changed, 62 insertions(+), 47 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 8136c582..5eca22a9 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -617,9 +617,21 @@ typedef struct CopyTextureAttribs CopyTextureAttribs; /// This structure is used by IDeviceContext::BeginRenderPass(). struct BeginRenderPassAttribs { + /// Render pass to begin. IRenderPass* pRenderPass DEFAULT_INITIALIZER(nullptr); + /// Framebuffer containing the attachments that are used with the render pass. IFramebuffer* pFramebuffer DEFAULT_INITIALIZER(nullptr); + + /// The number of elements in pClearValues array. + Uint32 ClearValueCount DEFAULT_INITIALIZER(0); + + /// A pointer to an array of ClearValueCount OptimizedClearValue structures that contains + /// clear values for each attachment, if the attachment uses a LoadOp value of ATTACHMENT_LOAD_OP_CLEAR + /// or if the attachment has a depth/stencil format and uses a StencilLoadOp value of ATTACHMENT_LOAD_OP_CLEAR. + /// The array is indexed by attachment number. Only elements corresponding to cleared attachments are used. + /// Other elements of pClearValues are ignored. + OptimizedClearValue* pClearValues DEFAULT_INITIALIZER(nullptr); }; typedef struct BeginRenderPassAttribs BeginRenderPassAttribs; diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h index 5fbb5412..796d7449 100644 --- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h +++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h @@ -1079,6 +1079,55 @@ DILIGENT_TYPED_ENUM(PRIMITIVE_TOPOLOGY, Uint8) PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES }; + +/// Defines optimized depth-stencil clear value. +struct DepthStencilClearValue +{ + /// Depth clear value + Float32 Depth DEFAULT_INITIALIZER(1.f); + /// Stencil clear value + Uint8 Stencil DEFAULT_INITIALIZER(0); + +#if DILIGENT_CPP_INTERFACE + DepthStencilClearValue()noexcept{} + + DepthStencilClearValue(Float32 _Depth, + Uint8 _Stencil)noexcept : + Depth {_Depth }, + Stencil {_Stencil} + {} +#endif +}; +typedef struct DepthStencilClearValue DepthStencilClearValue; + +/// Defines optimized clear value. +struct OptimizedClearValue +{ + /// Format + TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); + + /// Render target clear value + Float32 Color[4] DEFAULT_INITIALIZER({}); + + /// Depth stencil clear value + DepthStencilClearValue DepthStencil; + +#if DILIGENT_CPP_INTERFACE + bool operator == (const OptimizedClearValue& rhs)const + { + return Format == rhs.Format && + Color[0] == rhs.Color[0] && + Color[1] == rhs.Color[1] && + Color[2] == rhs.Color[2] && + Color[3] == rhs.Color[3] && + DepthStencil.Depth == rhs.DepthStencil.Depth && + DepthStencil.Stencil == rhs.DepthStencil.Stencil; + } +#endif +}; +typedef struct OptimizedClearValue OptimizedClearValue; + + /// Describes common device object attributes struct DeviceObjectAttribs { diff --git a/Graphics/GraphicsEngine/interface/Texture.h b/Graphics/GraphicsEngine/interface/Texture.h index 294bb875..3f61338f 100644 --- a/Graphics/GraphicsEngine/interface/Texture.h +++ b/Graphics/GraphicsEngine/interface/Texture.h @@ -32,6 +32,7 @@ /// \file /// Definition of the Diligent::ITexture interface and related data structures +#include "GraphicsTypes.h" #include "DeviceObject.h" #include "TextureView.h" @@ -42,53 +43,6 @@ DILIGENT_BEGIN_NAMESPACE(Diligent) static const INTERFACE_ID IID_Texture = {0xa64b0e60, 0x1b5e, 0x4cfd,{0xb8, 0x80, 0x66, 0x3a, 0x1a, 0xdc, 0xbe, 0x98}}; -/// Defines optimized depth-stencil clear value. -struct DepthStencilClearValue -{ - /// Depth clear value - Float32 Depth DEFAULT_INITIALIZER(1.f); - /// Stencil clear value - Uint8 Stencil DEFAULT_INITIALIZER(0); - -#if DILIGENT_CPP_INTERFACE - DepthStencilClearValue()noexcept{} - - DepthStencilClearValue(Float32 _Depth, - Uint8 _Stencil)noexcept : - Depth {_Depth }, - Stencil {_Stencil} - {} -#endif -}; -typedef struct DepthStencilClearValue DepthStencilClearValue; - -/// Defines optimized clear value. -struct OptimizedClearValue -{ - /// Format - TEXTURE_FORMAT Format DEFAULT_INITIALIZER(TEX_FORMAT_UNKNOWN); - - /// Render target clear value - Float32 Color[4] DEFAULT_INITIALIZER({}); - - /// Depth stencil clear value - DepthStencilClearValue DepthStencil; - -#if DILIGENT_CPP_INTERFACE - bool operator == (const OptimizedClearValue& rhs)const - { - return Format == rhs.Format && - Color[0] == rhs.Color[0] && - Color[1] == rhs.Color[1] && - Color[2] == rhs.Color[2] && - Color[3] == rhs.Color[3] && - DepthStencil.Depth == rhs.DepthStencil.Depth && - DepthStencil.Stencil == rhs.DepthStencil.Stencil; - } -#endif -}; -typedef struct OptimizedClearValue OptimizedClearValue; - /// Texture description struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs) -- cgit v1.2.3