From 48417c7d19bda4720b17c0c9b71e6241ab64edbb Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 19 Sep 2019 13:56:50 +0200 Subject: [PATCH] [d3d11] Implement DiscardView1 Basically just behave like DiscardView if no rects are passed to the function, otherwise ignore the call since we can't discard individual rectangles in any meaningful way. --- src/d3d11/d3d11_context.cpp | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index ec9ee2f3..31fa0070 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -101,8 +101,20 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView(ID3D11View* pResourceView) { + DiscardView1(pResourceView, nullptr, 0); + } + + + void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView1( + ID3D11View* pResourceView, + const D3D11_RECT* pRects, + UINT NumRects) { D3D10DeviceLock lock = LockContext(); + // We don't support discarding individual rectangles + if (!pResourceView || (NumRects && pRects)) + return; + // ID3D11View has no methods to query the exact type of // the view, so we'll have to check each possible class auto dsv = dynamic_cast(pResourceView); @@ -114,25 +126,15 @@ namespace dxvk { if (rtv) view = rtv->GetImageView(); if (uav) view = uav->GetImageView(); - if (view != nullptr) { - EmitCs([cView = std::move(view)] - (DxvkContext* ctx) { - ctx->discardImage( - cView->image(), - cView->subresources()); - }); - } - } - - - void STDMETHODCALLTYPE D3D11DeviceContext::DiscardView1( - ID3D11View* pResourceView, - const D3D11_RECT* pRects, - UINT NumRects) { - static bool s_errorShown = false; + if (view == nullptr) + return; - if (!std::exchange(s_errorShown, true)) - Logger::err("D3D11DeviceContext::DiscardView1: Not implemented"); + EmitCs([cView = std::move(view)] + (DxvkContext* ctx) { + ctx->discardImage( + cView->image(), + cView->subresources()); + }); }