summaryrefslogtreecommitdiffstats
path: root/Graphics
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-07-25 08:39:16 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-07-25 08:39:16 +0000
commit90c56caa809cccccdec4cde3d1705fc4bb94de15 (patch)
tree28c006bd7b74fd792577607dc020ae60a7a9bbcd /Graphics
parentRemoved unnecessary conversion from m_pPipelineState to target implementation... (diff)
downloadDiligentCore-90c56caa809cccccdec4cde3d1705fc4bb94de15.tar.gz
DiligentCore-90c56caa809cccccdec4cde3d1705fc4bb94de15.zip
Few improvements to RefCntAutoPtr & DeviceContextBase::SetPipelineState
Diffstat (limited to 'Graphics')
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.h9
-rw-r--r--Graphics/GraphicsEngine/include/DeviceObjectBase.h2
-rw-r--r--Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp5
-rw-r--r--Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp6
6 files changed, 15 insertions, 15 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h
index 037e6ba4..4a78a2e8 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.h
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h
@@ -90,9 +90,6 @@ public:
inline virtual void InvalidateState()override = 0;
- /// Base implementation of IDeviceContext::SetPipelineState(); caches references to the pipeline state object.
- inline virtual void SetPipelineState(IPipelineState* pPipelineState)override = 0;
-
/// Base implementation of IDeviceContext::CommitShaderResources(); validates parameters.
inline bool CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, Uint32 Flags, int);
@@ -139,6 +136,8 @@ protected:
inline bool SetStencilRef(Uint32 StencilRef, int Dummy);
+ inline void SetPipelineState(PipelineStateImplType* pPipelineState, int /*Dummy*/);
+
/// Clears all cached resources
inline void ClearStateCache();
@@ -257,9 +256,9 @@ inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType
}
template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
-inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> :: SetPipelineState(IPipelineState* pPipelineState)
+inline void DeviceContextBase<BaseInterface, BufferImplType, TextureViewImplType, PipelineStateImplType> :: SetPipelineState(PipelineStateImplType* pPipelineState, int /*Dummy*/)
{
- m_pPipelineState = ValidatedCast<PipelineStateImplType>(pPipelineState);
+ m_pPipelineState = pPipelineState;
}
template<typename BaseInterface, typename BufferImplType, typename TextureViewImplType, typename PipelineStateImplType>
diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.h b/Graphics/GraphicsEngine/include/DeviceObjectBase.h
index a0038e46..b7874487 100644
--- a/Graphics/GraphicsEngine/include/DeviceObjectBase.h
+++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.h
@@ -85,7 +85,7 @@ public:
{
// Render device owns allocators for all types of device objects,
// so it must be destroyed after all device objects are released.
- // Consider the following scenario: an object A ownes last strong
+ // Consider the following scenario: an object A owns the last strong
// reference to the device:
//
// 1. A::~A() completes
diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
index bc0222c8..a36260ef 100644
--- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
@@ -79,9 +79,9 @@ namespace Diligent
void DeviceContextD3D11Impl::SetPipelineState(IPipelineState* pPipelineState)
{
- TDeviceContextBase::SetPipelineState( pPipelineState );
auto* pPipelineStateD3D11 = ValidatedCast<PipelineStateD3D11Impl>(pPipelineState);
- auto &Desc = pPipelineStateD3D11->GetDesc();
+ TDeviceContextBase::SetPipelineState( pPipelineStateD3D11, 0 /*Dummy*/ );
+ auto& Desc = pPipelineStateD3D11->GetDesc();
if (Desc.IsComputePipeline)
{
auto* pd3d11CS = pPipelineStateD3D11->GetD3D11ComputeShader();
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index c4c4f11b..d5210e40 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -102,7 +102,7 @@ namespace Diligent
Flush(true);
}
- auto *pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(pPipelineState);
+ auto* pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(pPipelineState);
const auto &PSODesc = pPipelineStateD3D12->GetDesc();
bool CommitStates = false;
@@ -126,7 +126,7 @@ namespace Diligent
CommitScissor = OldPSODesc.GraphicsPipeline.RasterizerDesc.ScissorEnable != PSODesc.GraphicsPipeline.RasterizerDesc.ScissorEnable;
}
- TDeviceContextBase::SetPipelineState( pPipelineState );
+ TDeviceContextBase::SetPipelineState( pPipelineStateD3D12, 0 /*Dummy*/ );
auto *pCmdCtx = RequestCmdContext();
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
index b83b07e7..394542aa 100644
--- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp
@@ -65,9 +65,10 @@ namespace Diligent
void DeviceContextGLImpl::SetPipelineState(IPipelineState *pPipelineState)
{
- TDeviceContextBase::SetPipelineState(pPipelineState);
+ auto* pPipelineStateGLImpl = ValidatedCast<PipelineStateGLImpl>(pPipelineState);
+ TDeviceContextBase::SetPipelineState(pPipelineStateGLImpl, 0 /*Dummy*/);
- const auto &Desc = pPipelineState->GetDesc();
+ const auto& Desc = pPipelineStateGLImpl->GetDesc();
if (Desc.IsComputePipeline)
{
}
diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
index 4b0af79e..ba888614 100644
--- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp
@@ -200,8 +200,8 @@ namespace Diligent
Flush();
}
- auto *pPipelineStateVk = ValidatedCast<PipelineStateVkImpl>(pPipelineState);
- const auto &PSODesc = pPipelineStateVk->GetDesc();
+ auto* pPipelineStateVk = ValidatedCast<PipelineStateVkImpl>(pPipelineState);
+ const auto& PSODesc = pPipelineStateVk->GetDesc();
bool CommitStates = false;
bool CommitScissor = false;
@@ -224,7 +224,7 @@ namespace Diligent
CommitScissor = !OldPSODesc.GraphicsPipeline.RasterizerDesc.ScissorEnable;
}
- TDeviceContextBase::SetPipelineState( pPipelineState );
+ TDeviceContextBase::SetPipelineState( pPipelineStateVk, 0 /*Dummy*/ );
EnsureVkCmdBuffer();
if (PSODesc.IsComputePipeline)