From 786d4b12dd3b38678c466a2df49ac6669ee6eb98 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 5 Jan 2023 01:30:54 +0000 Subject: [PATCH] Don't clear depth stencil textures when created as committed resource The toggle D3D12ForceClearCopyableDepthStencilTextureOnCreation can be disabled when the toggle D3D12Allocate2DTexturewithCopyDstAsCommittedResource is enabled because with D3D12Allocate2DTexturewithCopyDstAsCommittedResource all the depth stencil textures (can only be 2D textures) with CopyDst usage have already been created with CreateCommittedResource() instead of CreatePlacedResource(), thus the driver issue about creating depth stencil texture on a dirty heap with CreatePlacedResource() won't be triggered. Bug: dawn:1487, chromium:1237175 Change-Id: I872d4d95e6e05e1bcf9489b31a72e61f957de3e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116129 Kokoro: Kokoro Commit-Queue: Jiawei Shao Reviewed-by: Austin Eng Reviewed-by: Corentin Wallez --- src/dawn/native/d3d12/DeviceD3D12.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dawn/native/d3d12/DeviceD3D12.cpp b/src/dawn/native/d3d12/DeviceD3D12.cpp index 0be01d0ec4..8ee99cfab2 100644 --- a/src/dawn/native/d3d12/DeviceD3D12.cpp +++ b/src/dawn/native/d3d12/DeviceD3D12.cpp @@ -733,6 +733,10 @@ void Device::InitTogglesFromDriver() { if ((gpu_info::IsIntelGen9(vendorId, deviceId) && !gpu_info::IsSkylake(deviceId)) || gpu_info::IsIntelGen11(vendorId, deviceId)) { SetToggle(Toggle::D3D12Allocate2DTexturewithCopyDstAsCommittedResource, true); + // Now we don't need to force clearing depth stencil textures with CopyDst as all the depth + // stencil textures (can only be 2D textures) will be created with CreateCommittedResource() + // instead of CreatePlacedResource(). + SetToggle(Toggle::D3D12ForceClearCopyableDepthStencilTextureOnCreation, false); } // Currently this toggle is only needed on Intel Gen9 and Gen9.5 GPUs.