1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[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.
This commit is contained in:
Philip Rebohle 2019-09-19 13:56:50 +02:00
parent 0338b70596
commit 48417c7d19
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -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<D3D11DepthStencilView*>(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());
});
}