D3D12: derive T2T workaround from TextureCopyBetweenDimensionsSupported

Query D3D12_FEATURE_DATA_D3D12_OPTIONS13 to determine whether the device
supports copies between textures of different dimensions. If it does
not, or if D3D12_FEATURE_D3D12_OPTIONS13 is not supported, force enable
toggle
D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions.

Fixed: dawn:1216
Change-Id: I976e7fad291126f8dcee31ce6b681314d38e69e7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120882
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2023-02-21 23:14:46 +00:00 committed by Dawn LUCI CQ
parent 053fca884a
commit 4a88a3287e
1 changed files with 12 additions and 4 deletions

View File

@ -554,10 +554,18 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
deviceToggles->ForceSet(Toggle::NoWorkaroundDstAlphaBlendDoesNotWork, true);
}
// TODO(http://crbug.com/dawn/1216): Actually query D3D12_FEATURE_DATA_D3D12_OPTIONS13.
// This is blocked on updating the Windows SDK.
deviceToggles->ForceSet(
Toggle::D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions, true);
D3D12_FEATURE_DATA_D3D12_OPTIONS13 featureData13;
if (FAILED(mD3d12Device->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS13, &featureData13,
sizeof(featureData13)))) {
// If the platform doesn't support D3D12_FEATURE_D3D12_OPTIONS13, default initialize the
// struct to set all features to false.
featureData13 = {};
}
if (!featureData13.TextureCopyBetweenDimensionsSupported) {
deviceToggles->ForceSet(
Toggle::D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions, true);
}
}
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,