From e25f4b2299f34bbd375238c21e73523283ac0029 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 4 Feb 2018 23:57:43 +0100 Subject: [PATCH] [d3d11] Implemented ClearUnorderedAccessViewUint for images --- src/d3d11/d3d11_blend.cpp | 2 -- src/d3d11/d3d11_context.cpp | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/d3d11/d3d11_blend.cpp b/src/d3d11/d3d11_blend.cpp index d22b0469..90aeb478 100644 --- a/src/d3d11/d3d11_blend.cpp +++ b/src/d3d11/d3d11_blend.cpp @@ -85,8 +85,6 @@ namespace dxvk { mode.alphaSrcFactor = DecodeBlendFactor(BlendDesc.SrcBlendAlpha, true); mode.alphaDstFactor = DecodeBlendFactor(BlendDesc.DestBlendAlpha, true); mode.alphaBlendOp = DecodeBlendOp(BlendDesc.BlendOpAlpha); - // TODO find out if D3D11 wants us to apply the write mask if blending - // is disabled as well. This is standard behaviour in Vulkan. mode.writeMask = BlendDesc.RenderTargetWriteMask; return mode; } diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 6de6ea01..c5e8d2a5 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -466,7 +466,24 @@ namespace dxvk { void STDMETHODCALLTYPE D3D11DeviceContext::ClearUnorderedAccessViewUint( ID3D11UnorderedAccessView* pUnorderedAccessView, const UINT Values[4]) { - Logger::err("D3D11DeviceContext::ClearUnorderedAccessViewUint: Not implemented"); + auto uav = static_cast(pUnorderedAccessView); + + if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) { + Logger::err("D3D11: ClearUnorderedAccessViewUint: Not supported for buffers"); + } else { + VkClearColorValue clearValue; + + for (uint32_t i = 0; i < 4; i++) + clearValue.uint32[i] = Values[i]; + + EmitCs([ + cClearValue = clearValue, + cDstView = uav->GetImageView() + ] (DxvkContext* ctx) { + ctx->clearColorImage(cDstView->image(), + cClearValue, cDstView->subresources()); + }); + } }