Temporarily Disable Use of D3D12 Render Pass API
Due to significant performance regressions on Intel Gen11 Graphics,
temporarily disable use of the D3D12 Render Pass API until a workaround
infrastructure can be implemented.
Bug: dawn:310
Change-Id: I994a2c2a0f6a3b61c48b083c73d6e0d3f8910dfa
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14663
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
diff --git a/src/common/BUILD.gn b/src/common/BUILD.gn
index a005613..6306ed9 100644
--- a/src/common/BUILD.gn
+++ b/src/common/BUILD.gn
@@ -105,6 +105,8 @@
"Constants.h",
"DynamicLib.cpp",
"DynamicLib.h",
+ "GPUInfo.cpp",
+ "GPUInfo.h",
"HashUtils.h",
"Log.cpp",
"Log.h",
diff --git a/src/common/Constants.h b/src/common/Constants.h
index fee8a4f..c157c06 100644
--- a/src/common/Constants.h
+++ b/src/common/Constants.h
@@ -51,13 +51,6 @@
static constexpr float kLodMin = 0.0;
static constexpr float kLodMax = 1000.0;
-static constexpr uint32_t kVendorID_AMD = 0x1002;
-static constexpr uint32_t kVendorID_ARM = 0x13B5;
-static constexpr uint32_t kVendorID_ImgTec = 0x1010;
-static constexpr uint32_t kVendorID_Intel = 0x8086;
-static constexpr uint32_t kVendorID_Nvidia = 0x10DE;
-static constexpr uint32_t kVendorID_Qualcomm = 0x5143;
-
// Max texture size constants
static constexpr uint32_t kMaxTextureSize = 8192u;
static constexpr uint32_t kMaxTexture2DArrayLayers = 256u;
diff --git a/src/common/GPUInfo.cpp b/src/common/GPUInfo.cpp
new file mode 100644
index 0000000..5d80fde
--- /dev/null
+++ b/src/common/GPUInfo.cpp
@@ -0,0 +1,36 @@
+// Copyright 2019 The Dawn Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "common/GPUInfo.h"
+
+namespace gpu_info {
+ bool IsAMD(PCIVendorID vendorId) {
+ return vendorId == kVendorID_AMD;
+ }
+ bool IsARM(PCIVendorID vendorId) {
+ return vendorId == kVendorID_ARM;
+ }
+ bool IsImgTec(PCIVendorID vendorId) {
+ return vendorId == kVendorID_ImgTec;
+ }
+ bool IsIntel(PCIVendorID vendorId) {
+ return vendorId == kVendorID_Intel;
+ }
+ bool IsNvidia(PCIVendorID vendorId) {
+ return vendorId == kVendorID_Nvidia;
+ }
+ bool IsQualcomm(PCIVendorID vendorId) {
+ return vendorId == kVendorID_Qualcomm;
+ }
+} // namespace gpu_info
diff --git a/src/common/GPUInfo.h b/src/common/GPUInfo.h
new file mode 100644
index 0000000..29d6bb9
--- /dev/null
+++ b/src/common/GPUInfo.h
@@ -0,0 +1,39 @@
+// Copyright 2019 The Dawn Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef COMMON_GPUINFO_H
+#define COMMON_GPUINFO_H
+
+#include <cstdint>
+
+using PCIVendorID = uint32_t;
+
+namespace gpu_info {
+
+ static constexpr PCIVendorID kVendorID_AMD = 0x1002;
+ static constexpr PCIVendorID kVendorID_ARM = 0x13B5;
+ static constexpr PCIVendorID kVendorID_ImgTec = 0x1010;
+ static constexpr PCIVendorID kVendorID_Intel = 0x8086;
+ static constexpr PCIVendorID kVendorID_Nvidia = 0x10DE;
+ static constexpr PCIVendorID kVendorID_Qualcomm = 0x5143;
+
+ bool IsAMD(PCIVendorID vendorId);
+ bool IsARM(PCIVendorID vendorId);
+ bool IsImgTec(PCIVendorID vendorId);
+ bool IsIntel(PCIVendorID vendorId);
+ bool IsNvidia(PCIVendorID vendorId);
+ bool IsQualcomm(PCIVendorID vendorId);
+
+} // namespace gpu_info
+#endif // COMMON_GPUINFO_H
\ No newline at end of file
diff --git a/src/dawn_native/d3d12/AdapterD3D12.cpp b/src/dawn_native/d3d12/AdapterD3D12.cpp
index c39791a..c26399b 100644
--- a/src/dawn_native/d3d12/AdapterD3D12.cpp
+++ b/src/dawn_native/d3d12/AdapterD3D12.cpp
@@ -66,14 +66,14 @@
return DAWN_DEVICE_LOST_ERROR("D3D12CreateDevice failed");
}
- DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));
-
DXGI_ADAPTER_DESC1 adapterDesc;
mHardwareAdapter->GetDesc1(&adapterDesc);
mPCIInfo.deviceId = adapterDesc.DeviceId;
mPCIInfo.vendorId = adapterDesc.VendorId;
+ DAWN_TRY_ASSIGN(mDeviceInfo, GatherDeviceInfo(*this));
+
if (adapterDesc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
mDeviceType = DeviceType::CPU;
} else {
diff --git a/src/dawn_native/d3d12/D3D12Info.cpp b/src/dawn_native/d3d12/D3D12Info.cpp
index de9bd03..6505e44 100644
--- a/src/dawn_native/d3d12/D3D12Info.cpp
+++ b/src/dawn_native/d3d12/D3D12Info.cpp
@@ -14,6 +14,7 @@
#include "dawn_native/d3d12/D3D12Info.h"
+#include "common/GPUInfo.h"
#include "dawn_native/d3d12/AdapterD3D12.h"
#include "dawn_native/d3d12/BackendD3D12.h"
#include "dawn_native/d3d12/D3D12Error.h"
@@ -45,12 +46,17 @@
// Windows builds 1809 and above can use the D3D12 render pass API. If we query
// CheckFeatureSupport for D3D12_FEATURE_D3D12_OPTIONS5 successfully, then we can use
// the render pass API.
+ info.supportsRenderPass = false;
D3D12_FEATURE_DATA_D3D12_OPTIONS5 featureOptions5 = {};
if (SUCCEEDED(adapter.GetDevice()->CheckFeatureSupport(
D3D12_FEATURE_D3D12_OPTIONS5, &featureOptions5, sizeof(featureOptions5)))) {
- info.supportsRenderPass = true;
- } else {
- info.supportsRenderPass = false;
+ // Performance regressions been observed when using a render pass on Intel graphics with
+ // RENDER_PASS_TIER_1 available, so fall back to a software emulated render pass on
+ // these platforms.
+ if (featureOptions5.RenderPassesTier < D3D12_RENDER_PASS_TIER_1 ||
+ !gpu_info::IsIntel(adapter.GetPCIInfo().vendorId)) {
+ info.supportsRenderPass = true;
+ }
}
return info;
diff --git a/src/dawn_native/metal/BackendMTL.mm b/src/dawn_native/metal/BackendMTL.mm
index 015a2af..f2ef973 100644
--- a/src/dawn_native/metal/BackendMTL.mm
+++ b/src/dawn_native/metal/BackendMTL.mm
@@ -14,7 +14,7 @@
#include "dawn_native/metal/BackendMTL.h"
-#include "common/Constants.h"
+#include "common/GPUInfo.h"
#include "common/Platform.h"
#include "dawn_native/Instance.h"
#include "dawn_native/MetalBackend.h"
@@ -39,11 +39,11 @@
};
#if defined(DAWN_PLATFORM_MACOS)
- const Vendor kVendors[] = {{"AMD", kVendorID_AMD},
- {"Radeon", kVendorID_AMD},
- {"Intel", kVendorID_Intel},
- {"Geforce", kVendorID_Nvidia},
- {"Quadro", kVendorID_Nvidia}};
+ const Vendor kVendors[] = {{"AMD", gpu_info::kVendorID_AMD},
+ {"Radeon", gpu_info::kVendorID_AMD},
+ {"Intel", gpu_info::kVendorID_Intel},
+ {"Geforce", gpu_info::kVendorID_Nvidia},
+ {"Quadro", gpu_info::kVendorID_Nvidia}};
// Find vendor ID from MTLDevice name.
MaybeError GetVendorIdFromVendors(id<MTLDevice> device, PCIIDs* ids) {
diff --git a/src/dawn_native/opengl/BackendGL.cpp b/src/dawn_native/opengl/BackendGL.cpp
index a8f98ae..cfdfb46 100644
--- a/src/dawn_native/opengl/BackendGL.cpp
+++ b/src/dawn_native/opengl/BackendGL.cpp
@@ -14,7 +14,7 @@
#include "dawn_native/opengl/BackendGL.h"
-#include "common/Constants.h"
+#include "common/GPUInfo.h"
#include "common/Log.h"
#include "dawn_native/Instance.h"
#include "dawn_native/OpenGLBackend.h"
@@ -31,12 +31,12 @@
uint32_t vendorId;
};
- const Vendor kVendors[] = {{"ATI", kVendorID_AMD},
- {"ARM", kVendorID_ARM},
- {"Imagination", kVendorID_ImgTec},
- {"Intel", kVendorID_Intel},
- {"NVIDIA", kVendorID_Nvidia},
- {"Qualcomm", kVendorID_Qualcomm}};
+ const Vendor kVendors[] = {{"ATI", gpu_info::kVendorID_AMD},
+ {"ARM", gpu_info::kVendorID_ARM},
+ {"Imagination", gpu_info::kVendorID_ImgTec},
+ {"Intel", gpu_info::kVendorID_Intel},
+ {"NVIDIA", gpu_info::kVendorID_Nvidia},
+ {"Qualcomm", gpu_info::kVendorID_Qualcomm}};
uint32_t GetVendorIdFromVendors(const char* vendor) {
uint32_t vendorId = 0;
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp
index 86235ba..0f419e4 100644
--- a/src/tests/DawnTest.cpp
+++ b/src/tests/DawnTest.cpp
@@ -15,7 +15,7 @@
#include "tests/DawnTest.h"
#include "common/Assert.h"
-#include "common/Constants.h"
+#include "common/GPUInfo.h"
#include "common/Log.h"
#include "common/Math.h"
#include "common/Platform.h"
@@ -362,27 +362,27 @@
}
bool DawnTestBase::IsAMD() const {
- return mPCIInfo.vendorId == kVendorID_AMD;
+ return gpu_info::IsAMD(mPCIInfo.vendorId);
}
bool DawnTestBase::IsARM() const {
- return mPCIInfo.vendorId == kVendorID_ARM;
+ return gpu_info::IsARM(mPCIInfo.vendorId);
}
bool DawnTestBase::IsImgTec() const {
- return mPCIInfo.vendorId == kVendorID_ImgTec;
+ return gpu_info::IsImgTec(mPCIInfo.vendorId);
}
bool DawnTestBase::IsIntel() const {
- return mPCIInfo.vendorId == kVendorID_Intel;
+ return gpu_info::IsIntel(mPCIInfo.vendorId);
}
bool DawnTestBase::IsNvidia() const {
- return mPCIInfo.vendorId == kVendorID_Nvidia;
+ return gpu_info::IsNvidia(mPCIInfo.vendorId);
}
bool DawnTestBase::IsQualcomm() const {
- return mPCIInfo.vendorId == kVendorID_Qualcomm;
+ return gpu_info::IsQualcomm(mPCIInfo.vendorId);
}
bool DawnTestBase::IsWindows() const {