summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-04-17 16:20:09 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-04-17 16:20:09 +0000
commiteb129d6308eaca88131656fd58124355cb1b391a (patch)
tree5335bb16ba10f6aa26d436b6d47318fc5fde9f16 /Graphics/GraphicsEngineD3D12
parentImplementing device context in vulkan (diff)
downloadDiligentCore-eb129d6308eaca88131656fd58124355cb1b391a.tar.gz
DiligentCore-eb129d6308eaca88131656fd58124355cb1b391a.zip
Added template version of RawPtr function to allow more convenient type conversion
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp26
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/RootSignature.cpp22
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp6
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp8
6 files changed, 34 insertions, 34 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
index f2c7d805..9fbb8785 100644
--- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp
@@ -77,7 +77,7 @@ namespace Diligent
DeviceContextD3D12Impl::~DeviceContextD3D12Impl()
{
if(m_bIsDeferred)
- ValidatedCast<RenderDeviceD3D12Impl>(m_pDevice.RawPtr())->DisposeCommandContext(m_pCurrCmdCtx);
+ m_pDevice.RawPtr<RenderDeviceD3D12Impl>()->DisposeCommandContext(m_pCurrCmdCtx);
else
{
if (m_NumCommandsInCurCtx != 0)
@@ -169,7 +169,7 @@ namespace Diligent
return;
auto *pCtx = RequestCmdContext();
- auto *pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(m_pPipelineState.RawPtr());
+ auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>();
m_pCommittedResourceCache = pPipelineStateD3D12->CommitAndTransitionShaderResources(pShaderResourceBinding, *pCtx, true, (Flags & COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES)!=0);
}
@@ -257,7 +257,7 @@ namespace Diligent
void DeviceContextD3D12Impl::CommitD3D12VertexBuffers(GraphicsContext &GraphCtx)
{
- auto *pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(m_pPipelineState.RawPtr());
+ auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>();
// Do not initialize array with zeroes for performance reasons
D3D12_VERTEX_BUFFER_VIEW VBViews[MaxBufferSlots];// = {}
@@ -331,7 +331,7 @@ namespace Diligent
CommitD3D12IndexBuffer(DrawAttribs.IndexType);
}
- auto *pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(m_pPipelineState.RawPtr());
+ auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>();
if(m_bCommittedD3D12VBsUpToDate)
TransitionD3D12VertexBuffers(GraphCtx);
@@ -397,7 +397,7 @@ namespace Diligent
}
#endif
- auto *pPipelineStateD3D12 = ValidatedCast<PipelineStateD3D12Impl>(m_pPipelineState.RawPtr());
+ auto *pPipelineStateD3D12 = m_pPipelineState.RawPtr<PipelineStateD3D12Impl>();
auto &ComputeCtx = RequestCmdContext()->AsComputeContext();
ComputeCtx.SetRootSignature( pPipelineStateD3D12->GetD3D12RootSignature() );
@@ -453,7 +453,7 @@ namespace Diligent
{
if (m_pSwapChain)
{
- pDSVD3D12 = ValidatedCast<ISwapChainD3D12>(m_pSwapChain.RawPtr())->GetDepthBufferDSV();
+ pDSVD3D12 = m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetDepthBufferDSV();
}
else
{
@@ -485,7 +485,7 @@ namespace Diligent
{
if (m_pSwapChain)
{
- pd3d12RTV = ValidatedCast<ISwapChainD3D12>(m_pSwapChain.RawPtr())->GetCurrentBackBufferRTV();
+ pd3d12RTV = m_pSwapChain.RawPtr<ISwapChainD3D12>()->GetCurrentBackBufferRTV();
}
else
{
@@ -506,7 +506,7 @@ namespace Diligent
void DeviceContextD3D12Impl::Flush(bool RequestNewCmdCtx)
{
- auto pDeviceD3D12Impl = ValidatedCast<RenderDeviceD3D12Impl>(m_pDevice.RawPtr());
+ auto pDeviceD3D12Impl = m_pDevice.RawPtr<RenderDeviceD3D12Impl>();
if( m_pCurrCmdCtx )
{
VERIFY(!m_bIsDeferred, "Deferred contexts cannot execute command lists directly");
@@ -680,7 +680,7 @@ namespace Diligent
if (m_pSwapChain)
{
NumRenderTargets = 1;
- auto *pSwapChainD3D12 = ValidatedCast<ISwapChainD3D12>(m_pSwapChain.RawPtr());
+ auto *pSwapChainD3D12 = m_pSwapChain.RawPtr<ISwapChainD3D12>();
ppRTVs[0] = pSwapChainD3D12->GetCurrentBackBufferRTV();
pDSV = pSwapChainD3D12->GetDepthBufferDSV();
}
@@ -693,8 +693,8 @@ namespace Diligent
else
{
for( Uint32 rt = 0; rt < NumRenderTargets; ++rt )
- ppRTVs[rt] = ValidatedCast<ITextureViewD3D12>(m_pBoundRenderTargets[rt].RawPtr());
- pDSV = ValidatedCast<ITextureViewD3D12>(m_pBoundDepthStencil.RawPtr());
+ ppRTVs[rt] = m_pBoundRenderTargets[rt].RawPtr<ITextureViewD3D12>();
+ pDSV = m_pBoundDepthStencil.RawPtr<ITextureViewD3D12>();
}
RequestCmdContext()->AsGraphicsContext().SetRenderTargets(NumRenderTargets, ppRTVs, pDSV);
}
@@ -838,7 +838,7 @@ namespace Diligent
void DeviceContextD3D12Impl::GenerateMips(TextureViewD3D12Impl *pTexView)
{
auto *pCtx = RequestCmdContext();
- m_MipsGenerator.GenerateMips(ValidatedCast<RenderDeviceD3D12Impl>(m_pDevice.RawPtr()), pTexView, *pCtx);
+ m_MipsGenerator.GenerateMips(m_pDevice.RawPtr<RenderDeviceD3D12Impl>(), pTexView, *pCtx);
++m_NumCommandsInCurCtx;
}
@@ -866,7 +866,7 @@ namespace Diligent
InvalidateState();
CommandListD3D12Impl* pCmdListD3D12 = ValidatedCast<CommandListD3D12Impl>(pCommandList);
- ValidatedCast<RenderDeviceD3D12Impl>(m_pDevice.RawPtr())->CloseAndExecuteCommandContext(pCmdListD3D12->Close(), true);
+ m_pDevice.RawPtr<RenderDeviceD3D12Impl>()->CloseAndExecuteCommandContext(pCmdListD3D12->Close(), true);
}
void DeviceContextD3D12Impl::TransitionTextureState(ITexture *pTexture, D3D12_RESOURCE_STATES State)
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
index 027b94bf..3fe77025 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp
@@ -202,7 +202,7 @@ void RenderDeviceD3D12Impl::FinishFrame(bool ReleaseAllResources)
{
if (auto pImmediateCtx = m_wpImmediateContext.Lock())
{
- auto pImmediateCtxD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pImmediateCtx.RawPtr());
+ auto pImmediateCtxD3D12 = pImmediateCtx.RawPtr<DeviceContextD3D12Impl>();
if(pImmediateCtxD3D12->GetNumCommandsInCtx() != 0)
LOG_ERROR_MESSAGE("There are outstanding commands in the immediate device context when finishing the frame. This is an error and may cause unpredicted behaviour. Call Flush() to submit all commands for execution before finishing the frame");
}
@@ -211,7 +211,7 @@ void RenderDeviceD3D12Impl::FinishFrame(bool ReleaseAllResources)
{
if (auto pDeferredCtx = wpDeferredCtx.Lock())
{
- auto pDeferredCtxD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pDeferredCtx.RawPtr());
+ auto pDeferredCtxD3D12 = pDeferredCtx.RawPtr<DeviceContextD3D12Impl>();
if(pDeferredCtxD3D12->GetNumCommandsInCtx() != 0)
LOG_ERROR_MESSAGE("There are outstanding commands in the deferred device context when finishing the frame. This is an error and may cause unpredicted behaviour. Close all deferred contexts and execute them before finishing the frame");
}
diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
index 8f05e917..9fed8e56 100644
--- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceFactoryD3D12.cpp
@@ -385,7 +385,7 @@ void EngineFactoryD3D12Impl::CreateSwapChainD3D12( IRenderDevice *pDevice,
{
if (auto pDeferredCtx = pDeviceD3D12->GetDeferredContext(ctx))
{
- auto *pDeferredCtxD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pDeferredCtx.RawPtr());
+ auto *pDeferredCtxD3D12 = pDeferredCtx.RawPtr<DeviceContextD3D12Impl>();
pDeferredCtxD3D12->SetSwapChain(pSwapChainD3D12);
// We cannot bind default render target here because
// there is no guarantee that deferred context will be used
diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
index 2011bebe..dbe18717 100644
--- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp
@@ -643,7 +643,7 @@ void TransitionResource(CommandContext &Ctx,
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV, "Unexpected descriptor range type");
// Not using QueryInterface() for the sake of efficiency
- auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffToTransition = Res.pObject.RawPtr<BufferD3D12Impl>();
if( !pBuffToTransition->CheckAllStates(D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER) )
Ctx.TransitionResource(pBuffToTransition, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER );
}
@@ -652,7 +652,7 @@ void TransitionResource(CommandContext &Ctx,
case CachedResourceType::BufSRV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
- auto *pBuffViewD3D12 = ValidatedCast<BufferViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffViewD3D12 = Res.pObject.RawPtr<BufferViewD3D12Impl>();
auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(pBuffViewD3D12->GetBuffer());
if( !pBuffToTransition->CheckAllStates(D3D12_RESOURCE_STATE_SHADER_RESOURCE) )
Ctx.TransitionResource(pBuffToTransition, D3D12_RESOURCE_STATE_SHADER_RESOURCE );
@@ -662,7 +662,7 @@ void TransitionResource(CommandContext &Ctx,
case CachedResourceType::BufUAV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Unexpected descriptor range type");
- auto *pBuffViewD3D12 = ValidatedCast<BufferViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffViewD3D12 = Res.pObject.RawPtr<BufferViewD3D12Impl>();
auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(pBuffViewD3D12->GetBuffer());
if( !pBuffToTransition->CheckAllStates(D3D12_RESOURCE_STATE_UNORDERED_ACCESS) )
Ctx.TransitionResource(pBuffToTransition, D3D12_RESOURCE_STATE_UNORDERED_ACCESS );
@@ -672,7 +672,7 @@ void TransitionResource(CommandContext &Ctx,
case CachedResourceType::TexSRV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
- auto *pTexViewD3D12 = ValidatedCast<TextureViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pTexViewD3D12 = Res.pObject.RawPtr<TextureViewD3D12Impl>();
auto *pTexToTransition = ValidatedCast<TextureD3D12Impl>(pTexViewD3D12->GetTexture());
if( !pTexToTransition->CheckAllStates(D3D12_RESOURCE_STATE_SHADER_RESOURCE) )
Ctx.TransitionResource(pTexToTransition, D3D12_RESOURCE_STATE_SHADER_RESOURCE );
@@ -682,7 +682,7 @@ void TransitionResource(CommandContext &Ctx,
case CachedResourceType::TexUAV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Unexpected descriptor range type");
- auto *pTexViewD3D12 = ValidatedCast<TextureViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pTexViewD3D12 = Res.pObject.RawPtr<TextureViewD3D12Impl>();
auto *pTexToTransition = ValidatedCast<TextureD3D12Impl>(pTexViewD3D12->GetTexture());
if( !pTexToTransition->CheckAllStates(D3D12_RESOURCE_STATE_UNORDERED_ACCESS) )
Ctx.TransitionResource(pTexToTransition, D3D12_RESOURCE_STATE_UNORDERED_ACCESS );
@@ -711,7 +711,7 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res,
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_CBV, "Unexpected descriptor range type");
// Not using QueryInterface() for the sake of efficiency
- auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffToTransition = Res.pObject.RawPtr<BufferD3D12Impl>();
auto State = pBuffToTransition->GetState();
if( (State & D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER) != D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER )
LOG_ERROR_MESSAGE("Resource \"", pBuffToTransition->GetDesc().Name, "\" is not in D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER state. Did you forget to call TransitionShaderResources() or specify COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES flag in a call to CommitShaderResources()?" );
@@ -721,7 +721,7 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res,
case CachedResourceType::BufSRV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
- auto *pBuffViewD3D12 = ValidatedCast<BufferViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffViewD3D12 = Res.pObject.RawPtr<BufferViewD3D12Impl>();
auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(pBuffViewD3D12->GetBuffer());
auto State = pBuffToTransition->GetState();
if( (State & D3D12_RESOURCE_STATE_SHADER_RESOURCE) != D3D12_RESOURCE_STATE_SHADER_RESOURCE )
@@ -732,7 +732,7 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res,
case CachedResourceType::BufUAV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Unexpected descriptor range type");
- auto *pBuffViewD3D12 = ValidatedCast<BufferViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffViewD3D12 = Res.pObject.RawPtr<BufferViewD3D12Impl>();
auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(pBuffViewD3D12->GetBuffer());
auto State = pBuffToTransition->GetState();
if( (State & D3D12_RESOURCE_STATE_UNORDERED_ACCESS) != D3D12_RESOURCE_STATE_UNORDERED_ACCESS )
@@ -743,7 +743,7 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res,
case CachedResourceType::TexSRV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_SRV, "Unexpected descriptor range type");
- auto *pTexViewD3D12 = ValidatedCast<TextureViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pTexViewD3D12 = Res.pObject.RawPtr<TextureViewD3D12Impl>();
auto *pTexToTransition = ValidatedCast<TextureD3D12Impl>(pTexViewD3D12->GetTexture());
auto State = pTexToTransition->GetState();
if( (State & D3D12_RESOURCE_STATE_SHADER_RESOURCE) != D3D12_RESOURCE_STATE_SHADER_RESOURCE )
@@ -754,7 +754,7 @@ void DbgVerifyResourceState(ShaderResourceCacheD3D12::Resource &Res,
case CachedResourceType::TexUAV:
{
VERIFY(RangeType == D3D12_DESCRIPTOR_RANGE_TYPE_UAV, "Unexpected descriptor range type");
- auto *pTexViewD3D12 = ValidatedCast<TextureViewD3D12Impl>(Res.pObject.RawPtr());
+ auto *pTexViewD3D12 = Res.pObject.RawPtr<TextureViewD3D12Impl>();
auto *pTexToTransition = ValidatedCast<TextureD3D12Impl>(pTexViewD3D12->GetTexture());
auto State = pTexToTransition->GetState();
if( (State & D3D12_RESOURCE_STATE_UNORDERED_ACCESS) != D3D12_RESOURCE_STATE_UNORDERED_ACCESS )
@@ -1018,7 +1018,7 @@ void RootSignature::CommitRootViews(ShaderResourceCacheD3D12& ResourceCache,
#endif
auto& Res = ResourceCache.GetRootTable(RootInd).GetResource(0, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, dbgShaderType);
- auto *pBuffToTransition = ValidatedCast<BufferD3D12Impl>(Res.pObject.RawPtr());
+ auto *pBuffToTransition = Res.pObject.RawPtr<BufferD3D12Impl>();
if( !pBuffToTransition->CheckAllStates(D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER) )
Ctx.TransitionResource(pBuffToTransition, D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER);
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
index 5fc8d9b5..c8476e4c 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp
@@ -734,7 +734,7 @@ bool ShaderResourceLayoutD3D12::SRV_CBV_UAV::IsBound(Uint32 ArrayIndex)
auto &CachedRes = RootTable.GetResource(OffsetFromTableStart + ArrayIndex, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_ParentResLayout.m_pResources->GetShaderType());
if( CachedRes.pObject != nullptr )
{
- VERIFY(CachedRes.CPUDescriptorHandle.ptr != 0 || ValidatedCast<BufferD3D12Impl>(CachedRes.pObject.RawPtr())->GetDesc().Usage == USAGE_DYNAMIC, "No relevant descriptor handle");
+ VERIFY(CachedRes.CPUDescriptorHandle.ptr != 0 || CachedRes.pObject.RawPtr<BufferD3D12Impl>()->GetDesc().Usage == USAGE_DYNAMIC, "No relevant descriptor handle");
return true;
}
}
@@ -948,7 +948,7 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const
if( !CachedRes.pObject ||
// Dynamic buffers do not have CPU descriptor handle as they do not keep D3D12 buffer, and space is allocated from the GPU ring buffer
- CachedRes.CPUDescriptorHandle.ptr == 0 && !(CachedRes.Type==CachedResourceType::CBV && ValidatedCast<const BufferD3D12Impl>(CachedRes.pObject.RawPtr())->GetDesc().Usage == USAGE_DYNAMIC) )
+ CachedRes.CPUDescriptorHandle.ptr == 0 && !(CachedRes.Type==CachedResourceType::CBV && CachedRes.pObject.RawPtr<const BufferD3D12Impl>()->GetDesc().Usage == USAGE_DYNAMIC) )
LOG_ERROR_MESSAGE( "No resource is bound to ", GetShaderVariableTypeLiteralName(res.Attribs.GetVariableType()), " variable \"", res.Attribs.GetPrintName(ArrInd), "\" in shader \"", GetShaderName(), "\"" );
if (res.Attribs.BindCount > 1 && res.IsValidSampler())
@@ -958,7 +958,7 @@ void ShaderResourceLayoutD3D12::dbgVerifyBindings()const
if(SamInfo.Attribs.BindCount == 1)
{
const auto &CachedSampler = m_pResourceCache->GetRootTable(SamInfo.RootIndex).GetResource(SamInfo.OffsetFromTableStart, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, m_pResources->GetShaderType());
- if( auto *pTexView = ValidatedCast<const ITextureView>(CachedRes.pObject.RawPtr()) )
+ if( auto *pTexView = CachedRes.pObject.RawPtr<const ITextureView>() )
{
auto *pSampler = const_cast<ITextureView*>(pTexView)->GetSampler();
if (pSampler != nullptr && CachedSampler.pObject != pSampler)
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
index 8e5beb12..7aba15b9 100644
--- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
@@ -70,7 +70,7 @@ void SwapChainD3D12Impl::InitBuffersAndViews()
BackBufferDesc.Name = Name.c_str();
RefCntAutoPtr<TextureD3D12Impl> pBackBufferTex;
- ValidatedCast<RenderDeviceD3D12Impl>(m_pRenderDevice.RawPtr())->CreateTexture(BackBufferDesc, pBackBuffer, &pBackBufferTex);
+ m_pRenderDevice.RawPtr<RenderDeviceD3D12Impl>()->CreateTexture(BackBufferDesc, pBackBuffer, &pBackBufferTex);
TextureViewDesc RTVDesc;
RTVDesc.ViewType = TEXTURE_VIEW_RENDER_TARGET;
RefCntAutoPtr<ITextureView> pRTV;
@@ -151,12 +151,12 @@ void SwapChainD3D12Impl::UpdateSwapChain(bool CreateNew)
VERIFY(pDeviceContext, "Immediate context has been released");
if (pDeviceContext)
{
- RenderDeviceD3D12Impl *pDeviceD3D12 = ValidatedCast<RenderDeviceD3D12Impl>(m_pRenderDevice.RawPtr());
+ RenderDeviceD3D12Impl *pDeviceD3D12 = m_pRenderDevice.RawPtr<RenderDeviceD3D12Impl>();
pDeviceContext->Flush();
try
{
- auto *pImmediateCtxD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pDeviceContext.RawPtr());
+ auto *pImmediateCtxD3D12 = pDeviceContext.RawPtr<DeviceContextD3D12Impl>();
bool bIsDefaultFBBound = pImmediateCtxD3D12->IsDefaultFBBound();
// All references to the swap chain must be released before it can be resized
@@ -170,7 +170,7 @@ void SwapChainD3D12Impl::UpdateSwapChain(bool CreateNew)
if(CreateNew)
{
m_pSwapChain.Release();
- auto *pd3d12CmdQueue = ValidatedCast<RenderDeviceD3D12Impl>(m_pRenderDevice.RawPtr())->GetCmdQueue()->GetD3D12CommandQueue();
+ auto *pd3d12CmdQueue = m_pRenderDevice.RawPtr<RenderDeviceD3D12Impl>()->GetCmdQueue()->GetD3D12CommandQueue();
CreateDXGISwapChain(pd3d12CmdQueue);
}
else