D3D11: Don't return error if CheckFeatureSupport(Options5) fails.
D3D11_FEATURE_DATA_D3D11_OPTIONS5 is only supported since Windows 10
build 20348. Older versions of windows might return false if we try
to call CheckFeatureSupport() with this options struct. We should not
return error in that case to allow older clients to use Dawn/D3D11.
Bug: chromium:381669128
Change-Id: Ibea5bb30f57ed85d36d6bf4b4960cab17b9f2e68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/220154
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
diff --git a/src/dawn/native/d3d11/DeviceInfoD3D11.cpp b/src/dawn/native/d3d11/DeviceInfoD3D11.cpp
index 9d04721..cedf3bd 100644
--- a/src/dawn/native/d3d11/DeviceInfoD3D11.cpp
+++ b/src/dawn/native/d3d11/DeviceInfoD3D11.cpp
@@ -67,11 +67,13 @@
// requires at-least D3D11_SHARED_RESOURCE_TIER_2 support.
// https://docs.microsoft.com/en-us/windows/win32/api/d3d11/ne-d3d11-d3d11_shared_resource_tier
D3D11_FEATURE_DATA_D3D11_OPTIONS5 featureOptions5{};
- DAWN_TRY(CheckHRESULT(device->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS5,
- &featureOptions5, sizeof(featureOptions5)),
- "D3D11_FEATURE_D3D11_OPTIONS5"));
- info.supportsSharedResourceCapabilityTier2 =
- featureOptions5.SharedResourceTier >= D3D11_SHARED_RESOURCE_TIER_2;
+ if (SUCCEEDED(device->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS5, &featureOptions5,
+ sizeof(featureOptions5)))) {
+ info.supportsSharedResourceCapabilityTier2 =
+ featureOptions5.SharedResourceTier >= D3D11_SHARED_RESOURCE_TIER_2;
+ } else {
+ info.supportsSharedResourceCapabilityTier2 = false;
+ }
DXGI_ADAPTER_DESC3 adapterDesc3;
DAWN_TRY(CheckHRESULT(adapter->GetDesc3(&adapterDesc3), "IDXGIAdapter4::GetDesc3()"));