summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-12-01 04:20:46 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-12-01 04:20:46 +0000
commit1303ae5da64c35a56768edecdf60d57f7a2fe628 (patch)
treeb240850db3f521a636bdd71435a9aafda99a89c5 /Graphics/GraphicsEngine
parentImproved type safety of different flag types (diff)
downloadDiligentCore-1303ae5da64c35a56768edecdf60d57f7a2fe628.tar.gz
DiligentCore-1303ae5da64c35a56768edecdf60d57f7a2fe628.zip
Added explicit state transition flags to SetRenderTargets method
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.h5
-rw-r--r--Graphics/GraphicsEngine/interface/DeviceContext.h28
2 files changed, 30 insertions, 3 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h
index 293e438c..0bbdd843 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.h
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h
@@ -107,7 +107,7 @@ public:
/// Caches the render target and depth stencil views. Returns true if any view is different
/// from the cached value and false otherwise.
- inline bool SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, Uint32 Dummy = 0 );
+ inline bool SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil);
/// Base implementation of IDeviceContext::UpdateBuffer(); validates input parameters.
virtual void UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const PVoid pData)override = 0;
@@ -462,7 +462,8 @@ inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType
}
template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
-inline bool DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> :: SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, Uint32 Dummy )
+inline bool DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> ::
+ SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil )
{
bool bBindRenderTargets = false;
m_FramebufferWidth = 0;
diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h
index 70088d2a..236d5e51 100644
--- a/Graphics/GraphicsEngine/interface/DeviceContext.h
+++ b/Graphics/GraphicsEngine/interface/DeviceContext.h
@@ -269,6 +269,31 @@ enum COMMIT_SHADER_RESOURCES_FLAGS : Uint8
};
DEFINE_FLAG_ENUM_OPERATORS(COMMIT_SHADER_RESOURCES_FLAGS)
+/// Additional flags for IDeviceContext::SetRenderTargets() command that define
+/// which resources need to be transitioned by the command.
+enum SET_RENDER_TARGETS_FLAGS
+{
+ /// Perform no state transitions
+ SET_RENDER_TARGETS_FLAG_NONE = 0x00,
+
+ /// Transition color targets to Diligent::RESOURCE_STATE_RENDER_TARGET state (see Diligent::RESOURCE_STATE).
+ /// Textures in unknown state will not be transitioned.
+ SET_RENDER_TARGETS_FLAG_TRANSITION_COLOR = 0x01,
+
+ /// Transition depth buffer to Diligent::RESOURCE_STATE_DEPTH_WRITE state (see Diligent::RESOURCE_STATE).
+ /// If the texture is in unknown state, the flag will have no effect.
+ SET_RENDER_TARGETS_FLAG_TRANSITION_DEPTH = 0x02,
+
+ /// Transition all color targets and depth buffer
+ SET_RENDER_TARGETS_FLAG_TRANSITION_ALL = (SET_RENDER_TARGETS_FLAG_TRANSITION_COLOR | SET_RENDER_TARGETS_FLAG_TRANSITION_DEPTH),
+
+ /// Verify the state of color/depth targets not being transitioned. This flag
+ /// only has effect in debug and development builds. No validation is performed
+ /// in release build and the flag is ignored.
+ SET_RENDER_TARGETS_FLAG_VERIFY_STATES = 0x04
+};
+DEFINE_FLAG_ENUM_OPERATORS(SET_RENDER_TARGETS_FLAGS)
+
/// Describes the viewport.
@@ -516,6 +541,7 @@ public:
/// \param [in] pDepthStencil - Pointer to the ITextureView that represents the depth stencil to
/// bind to the device. The view type must be
/// Diligent::TEXTURE_VIEW_DEPTH_STENCIL.
+ /// \param [in] Flags - Flags defining required resource transitions.
/// \remarks
/// The device context will keep strong references to all bound render target
/// and depth-stencil views. Thus these views (and consequently referenced textures)
@@ -525,7 +551,7 @@ public:
/// following call:
///
/// pContext->SetRenderTargets(0, nullptr, nullptr);
- virtual void SetRenderTargets(Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil) = 0;
+ virtual void SetRenderTargets(Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, SET_RENDER_TARGETS_FLAGS Flags) = 0;
/// Executes a draw command