Skip to content

Commit

Permalink
d3d11: Fix crash when srv is submitted to ClearUnorderedAccessViewUint
Browse files Browse the repository at this point in the history
* The Settlers submits (possibly incorrectly) an SRV to ClearUnorderedAccessViewUint. The static_cast in the function does not translate correctly and crashes.

Native D3D11 behavior is to ignore the bad parameter entirely. It does not clear the SRV nor does it fault or even error with the DEBUG validator.
  • Loading branch information
canadacow authored Jan 23, 2024
1 parent 6199776 commit d4c5fc7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/d3d11/d3d11_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,11 +386,16 @@ namespace dxvk {
const UINT Values[4]) {
D3D10DeviceLock lock = LockContext();

auto uav = static_cast<D3D11UnorderedAccessView*>(pUnorderedAccessView);
if (!pUnorderedAccessView)
return;

if (!uav)
Com<ID3D11UnorderedAccessView> qiUav;

if (FAILED(pUnorderedAccessView->QueryInterface(IID_PPV_ARGS(&qiUav))))
return;

auto uav = static_cast<D3D11UnorderedAccessView*>(qiUav.ptr());

// Gather UAV format info. We'll use this to determine
// whether we need to create a temporary view or not.
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
Expand Down

0 comments on commit d4c5fc7

Please sign in to comment.