summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D11
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2019-12-24 17:10:27 +0000
committerassiduous <assiduous@diligentgraphics.com>2019-12-24 17:10:27 +0000
commit583f60ce9f3bec7625393f94ee3693934ae5791b (patch)
treef2ac411359d021f7d07956cec650f6fc567710a5 /Graphics/GraphicsEngineD3D11
parentDisabled SetRenderTarget(0, nullptr, nullptr) usage (fixed https://github.com... (diff)
downloadDiligentCore-583f60ce9f3bec7625393f94ee3693934ae5791b.tar.gz
DiligentCore-583f60ce9f3bec7625393f94ee3693934ae5791b.zip
Reworked ClearRenderTarget and ClearDepthStencil methods to not take nullptr
Diffstat (limited to 'Graphics/GraphicsEngineD3D11')
-rwxr-xr-xGraphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp36
1 files changed, 8 insertions, 28 deletions
diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
index 676c6d73..1c0328b5 100755
--- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
+++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp
@@ -911,20 +911,11 @@ void DeviceContextD3D11Impl::ClearDepthStencil(ITextureView* pV
Uint8 Stencil,
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
- if (pView == nullptr)
- {
- if (m_pBoundDepthStencil == nullptr)
- {
- LOG_ERROR_MESSAGE("ClearDepthStencil(nullptr, ...) is invalid because no depth-stencil buffer is currently bound.");
- return;
- }
- pView = m_pBoundDepthStencil;
- }
+ if (!TDeviceContextBase::ClearDepthStencil(pView))
+ return;
+
+ VERIFY_EXPR(pView != nullptr);
-#ifdef DEVELOPMENT
- const auto& ViewDesc = pView->GetDesc();
- VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL, "Incorrect view type: depth stencil is expected");
-#endif
auto* pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView);
auto* pd3d11DSV = static_cast<ID3D11DepthStencilView*>(pViewD3D11->GetD3D11View());
@@ -938,22 +929,11 @@ void DeviceContextD3D11Impl::ClearDepthStencil(ITextureView* pV
void DeviceContextD3D11Impl::ClearRenderTarget(ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
- if (pView == nullptr)
- {
- if (m_NumBoundRenderTargets != 1)
- {
- LOG_ERROR_MESSAGE("ClearRenderTarget(nullptr, ...) semantic is only allowed when single render target is bound to the context. ",
- m_NumBoundRenderTargets, " render ",
- (m_NumBoundRenderTargets != 1 ? "targets are" : "target is"), " currently bound");
- return;
- }
- pView = m_pBoundRenderTargets[0];
- }
+ if (!TDeviceContextBase::ClearRenderTarget(pView))
+ return;
+
+ VERIFY_EXPR(pView != nullptr);
-#ifdef DEVELOPMENT
- const auto& ViewDesc = pView->GetDesc();
- VERIFY(ViewDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET, "Incorrect view type: render target is expected");
-#endif
auto* pViewD3D11 = ValidatedCast<TextureViewD3D11Impl>(pView);
auto* pd3d11RTV = static_cast<ID3D11RenderTargetView*>(pViewD3D11->GetD3D11View());