D3D12: Fix warning of invalid small resources alignment
If we build Dawn end2end tests on SDK 10.0.22621.0 and run it on
another device with SDK 10.0.26100.0, the warning of
CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE will not
be filtered because this message id is not available on 22621 and was
not added to the deny list during the compilation. Redefined a new
message id using the value on 22621 for workaround.
Bug: 381742470
Change-Id: Ib4017e76b19b274ca7cd0e3152b7415f8750881f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/228234
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
index 69527ad..344ed9c 100644
--- a/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
+++ b/src/dawn/native/d3d12/PhysicalDeviceD3D12.cpp
@@ -45,6 +45,17 @@
namespace dawn::native::d3d12 {
+// The D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE(1380) was introduced
+// in SDK 10.0.26100.0. Redefine the message name to allows it to be compiled on both
+// SDK 10.0.22621.0 and SDK 10.0.26100.0.
+#if D3D12_SDK_VERSION >= 612
+const D3D12_MESSAGE_ID DAWN_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE =
+ D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE;
+#else
+const D3D12_MESSAGE_ID DAWN_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE =
+ D3D12_MESSAGE_ID(1380);
+#endif
+
PhysicalDevice::PhysicalDevice(Backend* backend, ComPtr<IDXGIAdapter4> hardwareAdapter)
: Base(backend, std::move(hardwareAdapter), wgpu::BackendType::D3D12) {}
@@ -491,10 +502,8 @@
// get rejected and generate a debug error. Then, we request 0 to get the allowed
// allowed alignment.
D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT,
-#if D3D12_SDK_VERSION >= 612
- // This message id for small resource alignment was introduced in SDK 10.0.26100.0.
- D3D12_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE,
-#endif
+ // This message id is added for invalid small resource alignment.
+ DAWN_MESSAGE_ID_CREATERESOURCE_INVALIDALIGNMENT_SMALLRESOURCE,
// WebGPU allows OOB vertex buffer access and relies on D3D12's robust buffer access
// behavior.