d3d11: enable d3d11 if dawn is not build with chromium

This CL enable build d3d11 by default, if dawn is not build with
chromium. d3d11 backend is not full implemented yet, so no tests
will run against d3d11 backend.

Bug: dawn:1705
Change-Id: Id689ab5168511af0f75f0b3537f246713de5ca45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127260
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
Peng Huang 2023-04-14 02:05:17 +00:00 committed by Dawn LUCI CQ
parent 34d52ffa4c
commit f5966b09e1
6 changed files with 32 additions and 6 deletions

View File

@ -55,7 +55,7 @@ declare_args() {
dawn_complete_static_libs = false dawn_complete_static_libs = false
# Enables the compilation of Dawn's D3D11 backend # Enables the compilation of Dawn's D3D11 backend
dawn_enable_d3d11 = false dawn_enable_d3d11 = is_win && !build_with_chromium
# Enables the compilation of Dawn's D3D12 backend # Enables the compilation of Dawn's D3D12 backend
dawn_enable_d3d12 = is_win dawn_enable_d3d12 = is_win

View File

@ -29,6 +29,12 @@ BackendTestConfig::BackendTestConfig(wgpu::BackendType backendType,
forceEnabledWorkarounds(forceEnabledWorkarounds), forceEnabledWorkarounds(forceEnabledWorkarounds),
forceDisabledWorkarounds(forceDisabledWorkarounds) {} forceDisabledWorkarounds(forceDisabledWorkarounds) {}
BackendTestConfig D3D11Backend(std::initializer_list<const char*> forceEnabledWorkarounds,
std::initializer_list<const char*> forceDisabledWorkarounds) {
return BackendTestConfig(wgpu::BackendType::D3D11, forceEnabledWorkarounds,
forceDisabledWorkarounds);
}
BackendTestConfig D3D12Backend(std::initializer_list<const char*> forceEnabledWorkarounds, BackendTestConfig D3D12Backend(std::initializer_list<const char*> forceEnabledWorkarounds,
std::initializer_list<const char*> forceDisabledWorkarounds) { std::initializer_list<const char*> forceDisabledWorkarounds) {
return BackendTestConfig(wgpu::BackendType::D3D12, forceEnabledWorkarounds, return BackendTestConfig(wgpu::BackendType::D3D12, forceEnabledWorkarounds,
@ -71,6 +77,8 @@ TestAdapterProperties::TestAdapterProperties(const wgpu::AdapterProperties& prop
std::string TestAdapterProperties::ParamName() const { std::string TestAdapterProperties::ParamName() const {
switch (backendType) { switch (backendType) {
case wgpu::BackendType::D3D11:
return "D3D11";
case wgpu::BackendType::D3D12: case wgpu::BackendType::D3D12:
return "D3D12"; return "D3D12";
case wgpu::BackendType::Metal: case wgpu::BackendType::Metal:

View File

@ -59,6 +59,9 @@ struct AdapterTestParam {
std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param); std::ostream& operator<<(std::ostream& os, const AdapterTestParam& param);
BackendTestConfig D3D11Backend(std::initializer_list<const char*> forceEnabledWorkarounds = {},
std::initializer_list<const char*> forceDisabledWorkarounds = {});
BackendTestConfig D3D12Backend(std::initializer_list<const char*> forceEnabledWorkarounds = {}, BackendTestConfig D3D12Backend(std::initializer_list<const char*> forceEnabledWorkarounds = {},
std::initializer_list<const char*> forceDisabledWorkarounds = {}); std::initializer_list<const char*> forceDisabledWorkarounds = {});

View File

@ -299,7 +299,9 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) {
argLen = sizeof(kBackendArg) - 1; argLen = sizeof(kBackendArg) - 1;
if (strncmp(argv[i], kBackendArg, argLen) == 0) { if (strncmp(argv[i], kBackendArg, argLen) == 0) {
const char* param = argv[i] + argLen; const char* param = argv[i] + argLen;
if (strcmp("d3d12", param) == 0) { if (strcmp("d3d11", param) == 0) {
mBackendTypeFilter = wgpu::BackendType::D3D11;
} else if (strcmp("d3d12", param) == 0) {
mBackendTypeFilter = wgpu::BackendType::D3D12; mBackendTypeFilter = wgpu::BackendType::D3D12;
} else if (strcmp("metal", param) == 0) { } else if (strcmp("metal", param) == 0) {
mBackendTypeFilter = wgpu::BackendType::Metal; mBackendTypeFilter = wgpu::BackendType::Metal;
@ -720,9 +722,9 @@ DawnTestBase::~DawnTestBase() {
mAdapter = nullptr; mAdapter = nullptr;
mInstance = nullptr; mInstance = nullptr;
// D3D12's GPU-based validation will accumulate objects over time if the backend device is not // D3D11 and D3D12's GPU-based validation will accumulate objects over time if the backend
// destroyed and recreated, so we reset it here. // device is not destroyed and recreated, so we reset it here.
if (IsD3D12() && IsBackendValidationEnabled()) { if ((IsD3D11() || IsD3D12()) && IsBackendValidationEnabled()) {
mBackendAdapter.ResetInternalDeviceForTesting(); mBackendAdapter.ResetInternalDeviceForTesting();
} }
mWireHelper.reset(); mWireHelper.reset();
@ -733,6 +735,10 @@ DawnTestBase::~DawnTestBase() {
gCurrentTest = nullptr; gCurrentTest = nullptr;
} }
bool DawnTestBase::IsD3D11() const {
return mParam.adapterProperties.backendType == wgpu::BackendType::D3D11;
}
bool DawnTestBase::IsD3D12() const { bool DawnTestBase::IsD3D12() const {
return mParam.adapterProperties.backendType == wgpu::BackendType::D3D12; return mParam.adapterProperties.backendType == wgpu::BackendType::D3D12;
} }
@ -1560,7 +1566,7 @@ void DawnTestBase::SlotMapCallback(WGPUBufferMapAsyncStatus status, void* userda
void DawnTestBase::ResolveExpectations() { void DawnTestBase::ResolveExpectations() {
for (const auto& expectation : mDeferredExpectations) { for (const auto& expectation : mDeferredExpectations) {
DAWN_ASSERT(mReadbackSlots[expectation.readbackSlot].mappedData != nullptr); EXPECT_TRUE(mReadbackSlots[expectation.readbackSlot].mappedData != nullptr);
// Get a pointer to the mapped copy of the data for the expectation. // Get a pointer to the mapped copy of the data for the expectation.
const char* data = const char* data =

View File

@ -224,6 +224,7 @@ class DawnTestBase {
void SetUp(); void SetUp();
void TearDown(); void TearDown();
bool IsD3D11() const;
bool IsD3D12() const; bool IsD3D12() const;
bool IsMetal() const; bool IsMetal() const;
bool IsNull() const; bool IsNull() const;

View File

@ -83,6 +83,10 @@ TEST_F(DeviceInitializationTest, DeviceOutlivesInstance) {
if (properties.backendType == wgpu::BackendType::Null) { if (properties.backendType == wgpu::BackendType::Null) {
continue; continue;
} }
// TODO(dawn:1705): Remove this once D3D11 backend is fully implemented.
if (properties.backendType == wgpu::BackendType::D3D11) {
continue;
}
availableAdapterProperties.push_back(properties); availableAdapterProperties.push_back(properties);
} }
} }
@ -131,6 +135,10 @@ TEST_F(DeviceInitializationTest, AdapterOutlivesInstance) {
if (properties.backendType == wgpu::BackendType::Null) { if (properties.backendType == wgpu::BackendType::Null) {
continue; continue;
} }
// TODO(dawn:1705): Remove this once D3D11 backend is fully implemented.
if (properties.backendType == wgpu::BackendType::D3D11) {
continue;
}
availableAdapterProperties.push_back(properties); availableAdapterProperties.push_back(properties);
} }
} }