diff options
| author | SirKingg <65892540+SirKingg@users.noreply.github.com> | 2026-11-22 16:59:20 +0100 |
|---|---|---|
| committer | SirKingg <65892540+SirKingg@users.noreply.github.com> | 2026-11-22 16:59:20 +0100 |
| commit | 849f4b7a9c9ccdd921ab34c8afd033b82be501df (patch) | |
| tree | c8a804af3ddb8d9979eb705fe875095d7e722129 /runtime/shims/d3d12_com.cpp | |
| parent | 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff) | |
d3d12: reject integer formats in plain resolves (D3D-274)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 55c6f86a8..7f6599b91 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -433,9 +433,19 @@ public: | |||
| 433 | 433 | ||
| 434 | // The format picks the member of a typeless family to resolve as; the textures' own format is used. | 434 | // The format picks the member of a typeless family to resolve as; the textures' own format is used. |
| 435 | void STDMETHODCALLTYPE ResolveSubresource(ID3D12Resource* dst, UINT dst_subresource, ID3D12Resource* src, | 435 | void STDMETHODCALLTYPE ResolveSubresource(ID3D12Resource* dst, UINT dst_subresource, ID3D12Resource* src, |
| 436 | UINT src_subresource, DXGI_FORMAT) override { | 436 | UINT src_subresource, DXGI_FORMAT format) override { |
| 437 | d3d12_trace::record("ID3D12GraphicsCommandList::ResolveSubresource"); | 437 | d3d12_trace::record("ID3D12GraphicsCommandList::ResolveSubresource"); |
| 438 | if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false); | 438 | if (type_ == D3D12_COMMAND_LIST_TYPE_BUNDLE) return check(false); |
| 439 | const auto integer_color = [](ID3D12Resource* resource) { | ||
| 440 | if (!resource) return false; | ||
| 441 | const auto desc = resource->GetDesc(); | ||
| 442 | return !(desc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) && | ||
| 443 | color_resolve_format_is_integer(desc.Format); | ||
| 444 | }; | ||
| 445 | if (color_resolve_format_is_integer(format) || integer_color(dst) || integer_color(src)) { | ||
| 446 | note_once("ResolveSubresource refused: integer colour formats cannot be resolved"); | ||
| 447 | return check(false); | ||
| 448 | } | ||
| 439 | check(list_.resolve_subresource({resource_id(dst), dst_subresource, resource_id(src), src_subresource})); | 449 | check(list_.resolve_subresource({resource_id(dst), dst_subresource, resource_id(src), src_subresource})); |
| 440 | } | 450 | } |
| 441 | 451 | ||