d3d11: Fix crash when srv is submitted to ClearUnorderedAccessViewUint

* 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.
This commit is contained in:
Dean Beeler 2024-01-23 07:01:12 -08:00 committed by GitHub
parent 6199776869
commit d4c5fc74e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 3 deletions

View File

@ -386,11 +386,16 @@ namespace dxvk {
const UINT Values[4]) {
D3D10DeviceLock lock = LockContext();
auto uav = static_cast<D3D11UnorderedAccessView*>(pUnorderedAccessView);
if (!uav)
if (!pUnorderedAccessView)
return;
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;