D3D12: Allocate renderable 2D textures as committed resources on Intel GPUs

This patch adds a workaround on Intel Gen9.5 and Gen11 GPUs to always
allocate renderable 2D textures as committed resources instead of
placed resources to mitigate a driver bug about CreatePlacedResource().

Bug: dawn:1628
Change-Id: I38062115d94933bd58e571c812ff6888e9781df6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/100640
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Jiawei Shao 2023-02-07 15:09:58 +00:00 committed by Dawn LUCI CQ
parent ad73301856
commit c272282e97
5 changed files with 13 additions and 17 deletions

View File

@ -320,11 +320,11 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
"default on Qualcomm GPUs, which have been observed experiencing a driver crash in this "
"situation.",
"https://crbug.com/dawn/1564"}},
{Toggle::D3D12Allocate2DTexturewithCopyDstAsCommittedResource,
{"d3d12_allocate_2d_texture_with_copy_dst_as_committed_resource",
"Allocate each 2D texture with CopyDst usage as committed resources instead of placed "
"resources. This toggle is enabled by default on D3D12 backends using Intel Gen9.5 and Gen11 "
"GPUs due to a driver issue on Intel D3D12 driver.",
{Toggle::D3D12Allocate2DTextureWithCopyDstOrRenderAttachmentAsCommittedResource,
{"d3d12_allocate_2d_texture_with_copy_dst_or_render_attachment_as_committed_resource",
"Allocate each 2D texture with CopyDst or RenderAttachment usage as committed resources "
"instead of placed resources. This toggle is enabled by default on D3D12 backends using "
"Intel Gen9.5 and Gen11 GPUs due to a driver issue on Intel D3D12 driver.",
"https://crbug.com/1237175"}},
{Toggle::MetalUseCombinedDepthStencilFormatForStencil8,
{"metal_use_combined_depth_stencil_format_for_stencil8",

View File

@ -81,7 +81,7 @@ enum class Toggle {
ApplyClearBigIntegerColorValueWithDraw,
MetalUseMockBlitEncoderForWriteTimestamp,
VulkanSplitCommandBufferOnDepthStencilComputeSampleAfterRenderPass,
D3D12Allocate2DTexturewithCopyDstAsCommittedResource,
D3D12Allocate2DTextureWithCopyDstOrRenderAttachmentAsCommittedResource,
MetalUseCombinedDepthStencilFormatForStencil8,
MetalUseBothDepthAndStencilAttachmentsForCombinedDepthStencilFormats,
UseBlitForBufferToDepthTextureCopy,

View File

@ -721,11 +721,12 @@ void Device::InitTogglesFromDriver() {
}
}
// Currently this workaround is only needed on Intel Gen9.5 and Gen11 GPUs.
// See http://crbug.com/1237175 for more information.
// Currently these workarounds are only needed on Intel Gen9.5 and Gen11 GPUs.
// See http://crbug.com/1237175 and http://crbug.com/dawn/1628 for more information.
if ((gpu_info::IsIntelGen9(vendorId, deviceId) && !gpu_info::IsSkylake(deviceId)) ||
gpu_info::IsIntelGen11(vendorId, deviceId)) {
SetToggle(Toggle::D3D12Allocate2DTexturewithCopyDstAsCommittedResource, true);
SetToggle(Toggle::D3D12Allocate2DTextureWithCopyDstOrRenderAttachmentAsCommittedResource,
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().

View File

@ -611,9 +611,10 @@ MaybeError Texture::InitializeAsInternalTexture() {
bytesPerBlock = GetFormat().GetAspectInfo(wgpu::TextureAspect::All).block.byteSize;
}
bool forceAllocateAsCommittedResource =
device->IsToggleEnabled(Toggle::D3D12Allocate2DTexturewithCopyDstAsCommittedResource) &&
(device->IsToggleEnabled(
Toggle::D3D12Allocate2DTextureWithCopyDstOrRenderAttachmentAsCommittedResource)) &&
GetDimension() == wgpu::TextureDimension::e2D &&
(GetInternalUsage() & wgpu::TextureUsage::CopyDst);
(GetInternalUsage() & (wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment));
DAWN_TRY_ASSIGN(mResourceAllocation,
device->AllocateMemory(D3D12_HEAP_TYPE_DEFAULT, resourceDescriptor,
D3D12_RESOURCE_STATE_COMMON, bytesPerBlock,

View File

@ -312,12 +312,6 @@ crbug.com/dawn/1500 [ intel-gen-9 monterey ] webgpu:api,operation,command_buffer
################################################################################
crbug.com/dawn/1599 [ webgpu-adapter-swiftshader ] webgpu:web_platform,copyToTexture,canvas:color_space_conversion:* [ Failure ]
################################################################################
# webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:* fail on win10 Intel
# KEEP
################################################################################
crbug.com/dawn/1628 [ intel-gen-9 win10 ] webgpu:api,operation,render_pass,storeOp:render_pass_store_op,color_attachment_only:* [ Failure ]
################################################################################
# untriaged failures
################################################################################