Rename namespace dawn_native to dawn::native. But keep a namespace alias to avoid breaking project that depend on the previous namespace name while they get updated. Done with through the following steps: - git grep -l dawn_native:: | xargs sed -i "" "s/dawn_native::/dawn::native::/g" - git grep -l "namespace dawn_native" | xargs sed -i "" "s/namespace dawn_native/namespace dawn::native/g" - git cl format - Manual fixups in generator/templates (and the addition of namespace_case in dawn_json_generator.py). - The addition of the namespace alias in DawnNative.h Bug: dawn:824 Change-Id: I676cc4e3ced2e0e4bab32a0d66d7eaf9537e3f09 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/75982 Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Auto-Submit: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/DawnNativeTest.cpp b/src/tests/DawnNativeTest.cpp index 20d7146..7532dfd 100644 --- a/src/tests/DawnNativeTest.cpp +++ b/src/tests/DawnNativeTest.cpp
@@ -19,7 +19,7 @@ #include "dawn/dawn_proc.h" #include "dawn_native/ErrorData.h" -namespace dawn_native { +namespace dawn::native { void AddFatalDawnFailure(const char* expression, const ErrorData* error) { const auto& backtrace = error->GetBacktrace(); @@ -29,10 +29,10 @@ ::testing::TestPartResult::kFatalFailure); } -} // namespace dawn_native +} // namespace dawn::native DawnNativeTest::DawnNativeTest() { - dawnProcSetProcs(&dawn_native::GetProcs()); + dawnProcSetProcs(&dawn::native::GetProcs()); } DawnNativeTest::~DawnNativeTest() { @@ -41,10 +41,10 @@ } void DawnNativeTest::SetUp() { - instance = std::make_unique<dawn_native::Instance>(); + instance = std::make_unique<dawn::native::Instance>(); instance->DiscoverDefaultAdapters(); - std::vector<dawn_native::Adapter> adapters = instance->GetAdapters(); + std::vector<dawn::native::Adapter> adapters = instance->GetAdapters(); // DawnNative unittests run against the null backend, find the corresponding adapter bool foundNullAdapter = false;
diff --git a/src/tests/DawnNativeTest.h b/src/tests/DawnNativeTest.h index 91904a3..ab44e39 100644 --- a/src/tests/DawnNativeTest.h +++ b/src/tests/DawnNativeTest.h
@@ -21,7 +21,7 @@ #include "dawn_native/DawnNative.h" #include "dawn_native/ErrorData.h" -namespace dawn_native { +namespace dawn::native { // This is similar to DAWN_TRY_ASSIGN but produces a fatal GTest error if EXPR is an error. #define DAWN_ASSERT_AND_ASSIGN(VAR, EXPR) \ @@ -29,7 +29,7 @@ void AddFatalDawnFailure(const char* expression, const ErrorData* error); -} // namespace dawn_native +} // namespace dawn::native class DawnNativeTest : public ::testing::Test { public: @@ -42,8 +42,8 @@ virtual WGPUDevice CreateTestDevice(); protected: - std::unique_ptr<dawn_native::Instance> instance; - dawn_native::Adapter adapter; + std::unique_ptr<dawn::native::Instance> instance; + dawn::native::Adapter adapter; wgpu::Device device; private:
diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 4102c0f..5189592 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp
@@ -234,7 +234,7 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) { ParseArgs(argc, argv); - if (mBackendValidationLevel != dawn_native::BackendValidationLevel::Disabled) { + if (mBackendValidationLevel != dawn::native::BackendValidationLevel::Disabled) { mPlatformDebugLogger = std::unique_ptr<utils::PlatformDebugLogger>(utils::CreatePlatformDebugLogger()); } @@ -245,7 +245,7 @@ // because the Vulkan validation layers use static global mutexes which behave badly when // Chromium's test launcher forks the test process. The instance will be recreated on test // environment setup. - std::unique_ptr<dawn_native::Instance> instance = CreateInstanceAndDiscoverAdapters(); + std::unique_ptr<dawn::native::Instance> instance = CreateInstanceAndDiscoverAdapters(); ASSERT(instance); SelectPreferredAdapterProperties(instance.get()); @@ -273,17 +273,17 @@ const char* level = argv[i] + argLen; if (level[0] != '\0') { if (strcmp(level, "=full") == 0) { - mBackendValidationLevel = dawn_native::BackendValidationLevel::Full; + mBackendValidationLevel = dawn::native::BackendValidationLevel::Full; } else if (strcmp(level, "=partial") == 0) { - mBackendValidationLevel = dawn_native::BackendValidationLevel::Partial; + mBackendValidationLevel = dawn::native::BackendValidationLevel::Partial; } else if (strcmp(level, "=disabled") == 0) { - mBackendValidationLevel = dawn_native::BackendValidationLevel::Disabled; + mBackendValidationLevel = dawn::native::BackendValidationLevel::Disabled; } else { dawn::ErrorLog() << "Invalid backend validation level" << level; UNREACHABLE(); } } else { - mBackendValidationLevel = dawn_native::BackendValidationLevel::Partial; + mBackendValidationLevel = dawn::native::BackendValidationLevel::Partial; } continue; } @@ -410,8 +410,8 @@ } } -std::unique_ptr<dawn_native::Instance> DawnTestEnvironment::CreateInstanceAndDiscoverAdapters() { - auto instance = std::make_unique<dawn_native::Instance>(); +std::unique_ptr<dawn::native::Instance> DawnTestEnvironment::CreateInstanceAndDiscoverAdapters() { + auto instance = std::make_unique<dawn::native::Instance>(); instance->EnableBeginCaptureOnStartup(mBeginCaptureOnStartup); instance->SetBackendValidationLevel(mBackendValidationLevel); instance->DiscoverDefaultAdapters(); @@ -430,7 +430,7 @@ mOpenGLWindow = glfwCreateWindow(400, 400, "Dawn OpenGL test window", nullptr, nullptr); glfwMakeContextCurrent(mOpenGLWindow); - dawn_native::opengl::AdapterDiscoveryOptions adapterOptions; + dawn::native::opengl::AdapterDiscoveryOptions adapterOptions; adapterOptions.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress); instance->DiscoverAdapters(&adapterOptions); #endif // DAWN_ENABLE_BACKEND_DESKTOP_GL @@ -455,7 +455,7 @@ mOpenGLESWindow = glfwCreateWindow(400, 400, "Dawn OpenGLES test window", nullptr, nullptr); glfwMakeContextCurrent(mOpenGLESWindow); - dawn_native::opengl::AdapterDiscoveryOptionsES adapterOptionsES; + dawn::native::opengl::AdapterDiscoveryOptionsES adapterOptionsES; adapterOptionsES.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress); instance->DiscoverAdapters(&adapterOptionsES); glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); @@ -472,12 +472,12 @@ return mOpenGLESWindow; } -void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn_native::Instance* instance) { +void DawnTestEnvironment::SelectPreferredAdapterProperties(const dawn::native::Instance* instance) { // Get the first available preferred device type. wgpu::AdapterType preferredDeviceType = static_cast<wgpu::AdapterType>(-1); bool hasDevicePreference = false; for (wgpu::AdapterType devicePreference : mDevicePreferences) { - for (const dawn_native::Adapter& adapter : instance->GetAdapters()) { + for (const dawn::native::Adapter& adapter : instance->GetAdapters()) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties); @@ -493,7 +493,7 @@ } std::set<std::pair<wgpu::BackendType, std::string>> adapterNameSet; - for (const dawn_native::Adapter& adapter : instance->GetAdapters()) { + for (const dawn::native::Adapter& adapter : instance->GetAdapters()) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties); @@ -559,7 +559,7 @@ } void DawnTestEnvironment::PrintTestConfigurationAndAdapterInfo( - dawn_native::Instance* instance) const { + dawn::native::Instance* instance) const { dawn::LogMessage log = dawn::InfoLog(); log << "Testing configuration\n" "---------------------\n" @@ -572,13 +572,13 @@ "BackendValidation: "; switch (mBackendValidationLevel) { - case dawn_native::BackendValidationLevel::Full: + case dawn::native::BackendValidationLevel::Full: log << "full"; break; - case dawn_native::BackendValidationLevel::Partial: + case dawn::native::BackendValidationLevel::Partial: log << "partial"; break; - case dawn_native::BackendValidationLevel::Disabled: + case dawn::native::BackendValidationLevel::Disabled: log << "disabled"; break; default: @@ -589,7 +589,7 @@ log << "\n" "Enabled Toggles\n"; for (const std::string& toggle : GetEnabledToggles()) { - const dawn_native::ToggleInfo* info = instance->GetToggleInfo(toggle.c_str()); + const dawn::native::ToggleInfo* info = instance->GetToggleInfo(toggle.c_str()); ASSERT(info != nullptr); log << " - " << info->name << ": " << info->description << "\n"; } @@ -599,7 +599,7 @@ log << "\n" "Disabled Toggles\n"; for (const std::string& toggle : GetDisabledToggles()) { - const dawn_native::ToggleInfo* info = instance->GetToggleInfo(toggle.c_str()); + const dawn::native::ToggleInfo* info = instance->GetToggleInfo(toggle.c_str()); ASSERT(info != nullptr); log << " - " << info->name << ": " << info->description << "\n"; } @@ -651,11 +651,11 @@ return mRunSuppressedTests; } -dawn_native::BackendValidationLevel DawnTestEnvironment::GetBackendValidationLevel() const { +dawn::native::BackendValidationLevel DawnTestEnvironment::GetBackendValidationLevel() const { return mBackendValidationLevel; } -dawn_native::Instance* DawnTestEnvironment::GetInstance() const { +dawn::native::Instance* DawnTestEnvironment::GetInstance() const { return mInstance.get(); } @@ -807,7 +807,7 @@ } bool DawnTestBase::IsBackendValidationEnabled() const { - return gTestEnv->GetBackendValidationLevel() != dawn_native::BackendValidationLevel::Disabled; + return gTestEnv->GetBackendValidationLevel() != dawn::native::BackendValidationLevel::Disabled; } bool DawnTestBase::RunSuppressedTests() const { @@ -827,7 +827,7 @@ } bool DawnTestBase::HasToggleEnabled(const char* toggle) const { - auto toggles = dawn_native::GetTogglesUsed(backendDevice); + auto toggles = dawn::native::GetTogglesUsed(backendDevice); return std::find_if(toggles.begin(), toggles.end(), [toggle](const char* name) { return strcmp(toggle, name) == 0; }) != toggles.end(); @@ -853,7 +853,7 @@ return gTestEnv->GetInstance()->Get(); } -dawn_native::Adapter DawnTestBase::GetAdapter() const { +dawn::native::Adapter DawnTestBase::GetAdapter() const { return mBackendAdapter; } @@ -872,7 +872,7 @@ wgpu::SupportedLimits DawnTestBase::GetSupportedLimits() { WGPUSupportedLimits supportedLimits; supportedLimits.nextInChain = nullptr; - dawn_native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); + dawn::native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); return *reinterpret_cast<wgpu::SupportedLimits*>(&supportedLimits); } @@ -880,9 +880,9 @@ ASSERT(mBackendAdapter); std::vector<wgpu::FeatureName> supportedFeatures; uint32_t count = - dawn_native::GetProcs().adapterEnumerateFeatures(mBackendAdapter.Get(), nullptr); + dawn::native::GetProcs().adapterEnumerateFeatures(mBackendAdapter.Get(), nullptr); supportedFeatures.resize(count); - dawn_native::GetProcs().adapterEnumerateFeatures( + dawn::native::GetProcs().adapterEnumerateFeatures( mBackendAdapter.Get(), reinterpret_cast<WGPUFeatureName*>(&supportedFeatures[0])); std::unordered_set<wgpu::FeatureName> supportedSet; @@ -903,7 +903,7 @@ // Find the adapter that exactly matches our adapter properties. const auto& adapters = gTestEnv->GetInstance()->GetAdapters(); const auto& it = std::find_if( - adapters.begin(), adapters.end(), [&](const dawn_native::Adapter& adapter) { + adapters.begin(), adapters.end(), [&](const dawn::native::Adapter& adapter) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties); @@ -943,14 +943,14 @@ forceDisabledToggles.push_back("disallow_unsafe_apis"); for (const std::string& toggle : gTestEnv->GetEnabledToggles()) { - const dawn_native::ToggleInfo* info = + const dawn::native::ToggleInfo* info = gTestEnv->GetInstance()->GetToggleInfo(toggle.c_str()); ASSERT(info != nullptr); forceEnabledToggles.push_back(info->name); } for (const std::string& toggle : gTestEnv->GetDisabledToggles()) { - const dawn_native::ToggleInfo* info = + const dawn::native::ToggleInfo* info = gTestEnv->GetInstance()->GetToggleInfo(toggle.c_str()); ASSERT(info != nullptr); forceDisabledToggles.push_back(info->name); @@ -1024,7 +1024,7 @@ if (!UsesWire()) { EXPECT_EQ(mLastWarningCount, - dawn_native::GetDeprecationWarningCountForTesting(device.Get())); + dawn::native::GetDeprecationWarningCountForTesting(device.Get())); } // The device will be destroyed soon after, so we want to set the expectation.
diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index e79a3e4..9c9f228 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h
@@ -224,8 +224,8 @@ void TearDown() override; bool UsesWire() const; - dawn_native::BackendValidationLevel GetBackendValidationLevel() const; - dawn_native::Instance* GetInstance() const; + dawn::native::BackendValidationLevel GetBackendValidationLevel() const; + dawn::native::Instance* GetInstance() const; bool HasVendorIdFilter() const; uint32_t GetVendorIdFilter() const; bool HasBackendTypeFilter() const; @@ -240,17 +240,17 @@ bool RunSuppressedTests() const; protected: - std::unique_ptr<dawn_native::Instance> mInstance; + std::unique_ptr<dawn::native::Instance> mInstance; private: void ParseArgs(int argc, char** argv); - std::unique_ptr<dawn_native::Instance> CreateInstanceAndDiscoverAdapters(); - void SelectPreferredAdapterProperties(const dawn_native::Instance* instance); - void PrintTestConfigurationAndAdapterInfo(dawn_native::Instance* instance) const; + std::unique_ptr<dawn::native::Instance> CreateInstanceAndDiscoverAdapters(); + void SelectPreferredAdapterProperties(const dawn::native::Instance* instance); + void PrintTestConfigurationAndAdapterInfo(dawn::native::Instance* instance) const; bool mUseWire = false; - dawn_native::BackendValidationLevel mBackendValidationLevel = - dawn_native::BackendValidationLevel::Disabled; + dawn::native::BackendValidationLevel mBackendValidationLevel = + dawn::native::BackendValidationLevel::Disabled; bool mBeginCaptureOnStartup = false; bool mHasVendorIdFilter = false; uint32_t mVendorIdFilter = 0; @@ -322,7 +322,7 @@ wgpu::BackendType GetBackendTypeFilter() const; wgpu::Instance GetInstance() const; - dawn_native::Adapter GetAdapter() const; + dawn::native::Adapter GetAdapter() const; virtual std::unique_ptr<dawn::platform::Platform> CreateTestPlatform(); @@ -597,7 +597,7 @@ // Assuming the data is mapped, checks all expectations void ResolveExpectations(); - dawn_native::Adapter mBackendAdapter; + dawn::native::Adapter mBackendAdapter; std::unique_ptr<dawn::platform::Platform> mTestPlatform; }; @@ -621,22 +621,22 @@ #define DAWN_SUPPRESS_TEST_IF(condition) \ DAWN_SKIP_TEST_IF_BASE(!RunSuppressedTests() && condition, "suppressed", condition) -#define EXPECT_DEPRECATION_WARNINGS(statement, n) \ - do { \ - if (UsesWire()) { \ - statement; \ - } else { \ - size_t warningsBefore = \ - dawn_native::GetDeprecationWarningCountForTesting(device.Get()); \ - statement; \ - size_t warningsAfter = \ - dawn_native::GetDeprecationWarningCountForTesting(device.Get()); \ - EXPECT_EQ(mLastWarningCount, warningsBefore); \ - if (!HasToggleEnabled("skip_validation")) { \ - EXPECT_EQ(warningsAfter, warningsBefore + n); \ - } \ - mLastWarningCount = warningsAfter; \ - } \ +#define EXPECT_DEPRECATION_WARNINGS(statement, n) \ + do { \ + if (UsesWire()) { \ + statement; \ + } else { \ + size_t warningsBefore = \ + dawn::native::GetDeprecationWarningCountForTesting(device.Get()); \ + statement; \ + size_t warningsAfter = \ + dawn::native::GetDeprecationWarningCountForTesting(device.Get()); \ + EXPECT_EQ(mLastWarningCount, warningsBefore); \ + if (!HasToggleEnabled("skip_validation")) { \ + EXPECT_EQ(warningsAfter, warningsBefore + n); \ + } \ + mLastWarningCount = warningsAfter; \ + } \ } while (0) #define EXPECT_DEPRECATION_WARNING(statement) EXPECT_DEPRECATION_WARNINGS(statement, 1)
diff --git a/src/tests/end2end/AdapterDiscoveryTests.cpp b/src/tests/end2end/AdapterDiscoveryTests.cpp index a15fb70..8957ee4 100644 --- a/src/tests/end2end/AdapterDiscoveryTests.cpp +++ b/src/tests/end2end/AdapterDiscoveryTests.cpp
@@ -48,9 +48,9 @@ #if defined(DAWN_ENABLE_BACKEND_VULKAN) // Test only discovering the SwiftShader adapter TEST(AdapterDiscoveryTests, OnlySwiftShader) { - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::vulkan::AdapterDiscoveryOptions options; + dawn::native::vulkan::AdapterDiscoveryOptions options; options.forceSwiftShader = true; instance.DiscoverAdapters(&options); @@ -68,9 +68,9 @@ // Test discovering only Vulkan adapters TEST(AdapterDiscoveryTests, OnlyVulkan) { - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::vulkan::AdapterDiscoveryOptions options; + dawn::native::vulkan::AdapterDiscoveryOptions options; instance.DiscoverAdapters(&options); const auto& adapters = instance.GetAdapters(); @@ -86,9 +86,9 @@ #if defined(DAWN_ENABLE_BACKEND_D3D12) // Test discovering only D3D12 adapters TEST(AdapterDiscoveryTests, OnlyD3D12) { - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::d3d12::AdapterDiscoveryOptions options; + dawn::native::d3d12::AdapterDiscoveryOptions options; instance.DiscoverAdapters(&options); const auto& adapters = instance.GetAdapters(); @@ -114,9 +114,9 @@ break; // No more adapters to enumerate. } - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::d3d12::AdapterDiscoveryOptions options; + dawn::native::d3d12::AdapterDiscoveryOptions options; options.dxgiAdapter = std::move(dxgiAdapter); instance.DiscoverAdapters(&options); @@ -134,9 +134,9 @@ #if defined(DAWN_ENABLE_BACKEND_METAL) // Test discovering only Metal adapters TEST(AdapterDiscoveryTests, OnlyMetal) { - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::metal::AdapterDiscoveryOptions options; + dawn::native::metal::AdapterDiscoveryOptions options; instance.DiscoverAdapters(&options); const auto& adapters = instance.GetAdapters(); @@ -166,9 +166,9 @@ glfwCreateWindow(400, 400, "Dawn OpenGL test window", nullptr, nullptr); glfwMakeContextCurrent(window); - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::opengl::AdapterDiscoveryOptions options; + dawn::native::opengl::AdapterDiscoveryOptions options; options.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress); instance.DiscoverAdapters(&options); glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); @@ -207,9 +207,9 @@ glfwCreateWindow(400, 400, "Dawn OpenGLES test window", nullptr, nullptr); glfwMakeContextCurrent(window); - dawn_native::Instance instance; + dawn::native::Instance instance; - dawn_native::opengl::AdapterDiscoveryOptionsES options; + dawn::native::opengl::AdapterDiscoveryOptionsES options; options.getProc = reinterpret_cast<void* (*)(const char*)>(glfwGetProcAddress); instance.DiscoverAdapters(&options); glfwWindowHint(GLFW_VISIBLE, GLFW_TRUE); @@ -230,10 +230,10 @@ // Test discovering the Metal backend, then the Vulkan backend // does not duplicate adapters. TEST(AdapterDiscoveryTests, OneBackendThenTheOther) { - dawn_native::Instance instance; + dawn::native::Instance instance; uint32_t metalAdapterCount = 0; { - dawn_native::metal::AdapterDiscoveryOptions options; + dawn::native::metal::AdapterDiscoveryOptions options; instance.DiscoverAdapters(&options); const auto& adapters = instance.GetAdapters(); @@ -246,7 +246,7 @@ } } { - dawn_native::vulkan::AdapterDiscoveryOptions options; + dawn::native::vulkan::AdapterDiscoveryOptions options; instance.DiscoverAdapters(&options); uint32_t metalAdapterCount2 = 0;
diff --git a/src/tests/end2end/BufferZeroInitTests.cpp b/src/tests/end2end/BufferZeroInitTests.cpp index 76f51fe..dfda1fd 100644 --- a/src/tests/end2end/BufferZeroInitTests.cpp +++ b/src/tests/end2end/BufferZeroInitTests.cpp
@@ -19,16 +19,16 @@ #include "utils/TestUtils.h" #include "utils/WGPUHelpers.h" -#define EXPECT_LAZY_CLEAR(N, statement) \ - do { \ - if (UsesWire()) { \ - statement; \ - } else { \ - size_t lazyClearsBefore = dawn_native::GetLazyClearCountForTesting(device.Get()); \ - statement; \ - size_t lazyClearsAfter = dawn_native::GetLazyClearCountForTesting(device.Get()); \ - EXPECT_EQ(N, lazyClearsAfter - lazyClearsBefore); \ - } \ +#define EXPECT_LAZY_CLEAR(N, statement) \ + do { \ + if (UsesWire()) { \ + statement; \ + } else { \ + size_t lazyClearsBefore = dawn::native::GetLazyClearCountForTesting(device.Get()); \ + statement; \ + size_t lazyClearsAfter = dawn::native::GetLazyClearCountForTesting(device.Get()); \ + EXPECT_EQ(N, lazyClearsAfter - lazyClearsBefore); \ + } \ } while (0) namespace {
diff --git a/src/tests/end2end/D3D12ResourceWrappingTests.cpp b/src/tests/end2end/D3D12ResourceWrappingTests.cpp index 81a6b52..8d780cb 100644 --- a/src/tests/end2end/D3D12ResourceWrappingTests.cpp +++ b/src/tests/end2end/D3D12ResourceWrappingTests.cpp
@@ -27,7 +27,7 @@ namespace { - using dawn_native::d3d12::kDXGIKeyedMutexAcquireReleaseKey; + using dawn::native::d3d12::kDXGIKeyedMutexAcquireReleaseKey; class D3D12ResourceTestBase : public DawnTest { protected: @@ -43,7 +43,7 @@ } // Create the D3D11 device/contexts that will be used in subsequent tests - ComPtr<ID3D12Device> d3d12Device = dawn_native::d3d12::GetD3D12Device(device.Get()); + ComPtr<ID3D12Device> d3d12Device = dawn::native::d3d12::GetD3D12Device(device.Get()); const LUID adapterLuid = d3d12Device->GetAdapterLuid(); @@ -94,7 +94,7 @@ const D3D11_TEXTURE2D_DESC* baseD3dDescriptor, wgpu::Texture* dawnTexture, ID3D11Texture2D** d3d11TextureOut, - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI>* + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI>* externalImageOut = nullptr) const { ComPtr<ID3D11Texture2D> d3d11Texture; HRESULT hr = mD3d11Device->CreateTexture2D(baseD3dDescriptor, nullptr, &d3d11Texture); @@ -110,13 +110,13 @@ &sharedHandle); ASSERT_EQ(hr, S_OK); - dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; + dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; externalImageDesc.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(dawnDesc); externalImageDesc.sharedHandle = sharedHandle; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage = - dawn_native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage = + dawn::native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); // Now that we've created all of our resources, we can close the handle // since we no longer need it. @@ -127,7 +127,7 @@ return; } - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDesc->usage); *dawnTexture = wgpu::Texture::Acquire( @@ -377,15 +377,15 @@ hr = dxgiKeyedMutex->ReleaseSync(kDXGIKeyedMutexAcquireReleaseKey); ASSERT_EQ(hr, S_OK); - dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {}; + dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc = {}; externalImageDesc.sharedHandle = sharedHandle; externalImageDesc.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(dawnDescriptor); - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage = - dawn_native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage = + dawn::native::d3d12::ExternalImageDXGI::Create(device.Get(), &externalImageDesc); - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.isInitialized = isInitialized; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(dawnDescriptor->usage); @@ -588,7 +588,7 @@ // Create the first Dawn texture then clear it to red. wgpu::Texture texture; ComPtr<ID3D11Texture2D> d3d11Texture; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage; + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); { @@ -604,7 +604,7 @@ texture.Destroy(); // Create another Dawn texture then clear it with another color. - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage); @@ -630,7 +630,7 @@ // Create the first Dawn texture then clear it to red. wgpu::Texture texture1; ComPtr<ID3D11Texture2D> d3d11Texture; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage; + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture1, &d3d11Texture, &externalImage); { @@ -642,7 +642,7 @@ } // Create another Dawn texture then clear it with another color. - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage); @@ -673,12 +673,12 @@ TEST_P(D3D12SharedHandleUsageTests, ExternalImageUsage) { DAWN_TEST_UNSUPPORTED_IF(UsesWire()); - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.isInitialized = true; wgpu::Texture texture; ComPtr<ID3D11Texture2D> d3d11Texture; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage; + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage; WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, &externalImage); ASSERT_NE(texture.Get(), nullptr); @@ -700,7 +700,7 @@ wgpu::Texture texture; ComPtr<ID3D11Texture2D> d3d11Texture; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage; + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage; // Create the Dawn texture then clear it to red using the first (default) device. WrapSharedHandle(&baseDawnDescriptor, &baseD3dDescriptor, &texture, &d3d11Texture, @@ -715,7 +715,7 @@ texture.Destroy(); // Create the Dawn texture then clear it to blue using the second device. - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(baseDawnDescriptor.usage); wgpu::Device otherDevice = wgpu::Device::Acquire(GetAdapter().CreateDevice());
diff --git a/src/tests/end2end/DeviceInitializationTests.cpp b/src/tests/end2end/DeviceInitializationTests.cpp index 0eb1795..0c342cc 100644 --- a/src/tests/end2end/DeviceInitializationTests.cpp +++ b/src/tests/end2end/DeviceInitializationTests.cpp
@@ -19,7 +19,7 @@ class DeviceInitializationTest : public testing::Test { void SetUp() override { - dawnProcSetProcs(&dawn_native::GetProcs()); + dawnProcSetProcs(&dawn::native::GetProcs()); } void TearDown() override { @@ -34,9 +34,9 @@ // We want to create a device on a fresh instance and adapter each time. std::vector<wgpu::AdapterProperties> availableAdapterProperties; { - auto instance = std::make_unique<dawn_native::Instance>(); + auto instance = std::make_unique<dawn::native::Instance>(); instance->DiscoverDefaultAdapters(); - for (const dawn_native::Adapter& adapter : instance->GetAdapters()) { + for (const dawn::native::Adapter& adapter : instance->GetAdapters()) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties); @@ -50,9 +50,9 @@ for (const wgpu::AdapterProperties& desiredProperties : availableAdapterProperties) { wgpu::Device device; - auto instance = std::make_unique<dawn_native::Instance>(); + auto instance = std::make_unique<dawn::native::Instance>(); instance->DiscoverDefaultAdapters(); - for (dawn_native::Adapter& adapter : instance->GetAdapters()) { + for (dawn::native::Adapter& adapter : instance->GetAdapters()) { wgpu::AdapterProperties properties; adapter.GetProperties(&properties);
diff --git a/src/tests/end2end/IOSurfaceWrappingTests.cpp b/src/tests/end2end/IOSurfaceWrappingTests.cpp index f8af8a0..98781c4 100644 --- a/src/tests/end2end/IOSurfaceWrappingTests.cpp +++ b/src/tests/end2end/IOSurfaceWrappingTests.cpp
@@ -98,13 +98,13 @@ IOSurfaceRef ioSurface, uint32_t plane, bool isInitialized = true) { - dawn_native::metal::ExternalImageDescriptorIOSurface externDesc; + dawn::native::metal::ExternalImageDescriptorIOSurface externDesc; externDesc.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(descriptor); externDesc.ioSurface = ioSurface; externDesc.plane = plane; externDesc.isInitialized = isInitialized; - WGPUTexture texture = dawn_native::metal::WrapIOSurface(device.Get(), &externDesc); + WGPUTexture texture = dawn::native::metal::WrapIOSurface(device.Get(), &externDesc); return wgpu::Texture::Acquire(texture); } }; @@ -362,7 +362,7 @@ queue.Submit(1, &commands); // Wait for the commands touching the IOSurface to be scheduled - dawn_native::metal::WaitForCommandsToBeScheduled(device.Get()); + dawn::native::metal::WaitForCommandsToBeScheduled(device.Get()); // Check the correct data was written IOSurfaceLock(ioSurface, kIOSurfaceLockReadOnly, nullptr);
diff --git a/src/tests/end2end/TextureZeroInitTests.cpp b/src/tests/end2end/TextureZeroInitTests.cpp index 63ccded..403712b 100644 --- a/src/tests/end2end/TextureZeroInitTests.cpp +++ b/src/tests/end2end/TextureZeroInitTests.cpp
@@ -19,16 +19,16 @@ #include "utils/TestUtils.h" #include "utils/WGPUHelpers.h" -#define EXPECT_LAZY_CLEAR(N, statement) \ - do { \ - if (UsesWire()) { \ - statement; \ - } else { \ - size_t lazyClearsBefore = dawn_native::GetLazyClearCountForTesting(device.Get()); \ - statement; \ - size_t lazyClearsAfter = dawn_native::GetLazyClearCountForTesting(device.Get()); \ - EXPECT_EQ(N, lazyClearsAfter - lazyClearsBefore); \ - } \ +#define EXPECT_LAZY_CLEAR(N, statement) \ + do { \ + if (UsesWire()) { \ + statement; \ + } else { \ + size_t lazyClearsBefore = dawn::native::GetLazyClearCountForTesting(device.Get()); \ + statement; \ + size_t lazyClearsAfter = dawn::native::GetLazyClearCountForTesting(device.Get()); \ + EXPECT_EQ(N, lazyClearsAfter - lazyClearsBefore); \ + } \ } while (0) class TextureZeroInitTest : public DawnTest { @@ -136,7 +136,7 @@ EXPECT_LAZY_CLEAR(1u, EXPECT_PIXEL_RGBA8_EQ(filledWithZeros, texture, 0, 0)); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // This tests that the code path of CopyTextureToBuffer with multiple texture array layers clears @@ -171,7 +171,8 @@ EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer)); // Expect texture subresource initialized to be true - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, kArrayLayers)); + EXPECT_TRUE( + dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, kArrayLayers)); const std::vector<RGBA8> kExpectedAllZero(kSize * kSize, {0, 0, 0, 0}); for (uint32_t layer = 0; layer < kArrayLayers; ++layer) { @@ -220,7 +221,7 @@ baseMipLevel); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( renderPass.color.Get(), baseMipLevel, 1, baseArrayLayer, 1)); } @@ -263,7 +264,7 @@ baseMipLevel); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( renderPass.color.Get(), baseMipLevel, 1, baseArrayLayer, 1)); } @@ -295,7 +296,7 @@ EXPECT_TEXTURE_EQ(expected.data(), texture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // Test for a copy only to a subset of the subresource, lazy init is necessary to clear the other @@ -330,7 +331,7 @@ EXPECT_TEXTURE_EQ(expectedZeros.data(), texture, {kSize / 2, 0}, {kSize / 2, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // This tests CopyBufferToTexture fully overwrites a range of subresources, so lazy initialization @@ -361,8 +362,8 @@ EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); // Expect texture subresource initialized to be true - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer, - kCopyLayerCount)); + EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer, + kCopyLayerCount)); const std::vector<RGBA8> expected100(kSize * kSize, {100, 100, 100, 100}); for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) { @@ -402,8 +403,8 @@ EXPECT_TEXTURE_EQ(expected.data(), dstTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(dstTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(dstTexture.Get(), 0, 1, 0, 1)); } // This Tests the CopyTextureToTexture's copy only to a subset of the subresource, lazy init is @@ -459,8 +460,8 @@ EXPECT_TEXTURE_EQ(expectedWithZeros.data(), dstTexture, {kSize / 2, 0}, {kSize / 2, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(dstTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(dstTexture.Get(), 0, 1, 0, 1)); } // This tests the texture with depth attachment and load op load will init depth stencil texture to @@ -502,7 +503,7 @@ EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); } // This tests the texture with stencil attachment and load op load will init depth stencil texture @@ -544,7 +545,7 @@ EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); } // This tests the texture with depth stencil attachment and load op load will init depth stencil @@ -583,7 +584,7 @@ EXPECT_TEXTURE_EQ(expected.data(), srcTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(srcTexture.Get(), 0, 1, 0, 1)); } // Test that clear state is tracked independently for depth/stencil textures. @@ -615,11 +616,11 @@ } // "all" subresources are not initialized; Depth is not initialized - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_All)); - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // Now load both depth and stencil. Depth should be cleared and stencil should stay the same @@ -654,11 +655,11 @@ } // Everything is initialized now - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_All)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // TODO(crbug.com/dawn/439): Implement stencil copies on other platforms @@ -690,11 +691,11 @@ } // "all" subresources are not initialized; Stencil is not initialized - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_All)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // Now load both depth and stencil. Stencil should be cleared and depth should stay the same @@ -728,11 +729,11 @@ } // Everything is initialized now - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_All)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // TODO(crbug.com/dawn/439): Implement stencil copies on other platforms @@ -775,11 +776,11 @@ } // "all" subresources are not initialized; Stencil is not initialized - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, - 0, 1, WGPUTextureAspect_All)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0, - 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized( + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, + 0, 1, WGPUTextureAspect_All)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( + depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized( depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // Check by copy that the stencil data is lazily cleared to 0. @@ -788,12 +789,12 @@ {kSize, kSize}, 0, wgpu::TextureAspect::StencilOnly)); // Everything is initialized now - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0, - 1, WGPUTextureAspect_All)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0, - 1, WGPUTextureAspect_DepthOnly)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, 0, - 1, WGPUTextureAspect_StencilOnly)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, 1, + 0, 1, WGPUTextureAspect_All)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( + depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_DepthOnly)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( + depthStencilTexture.Get(), 0, 1, 0, 1, WGPUTextureAspect_StencilOnly)); // Now load both depth and stencil. Stencil should be cleared and depth should stay the same // at 0.3. @@ -846,7 +847,7 @@ // Expect texture subresource initialized to be true EXPECT_EQ(true, - dawn_native::IsTextureSubresourceInitialized(renderPass.color.Get(), 0, 1, 0, 1)); + dawn::native::IsTextureSubresourceInitialized(renderPass.color.Get(), 0, 1, 0, 1)); } // This tests the clearing of sampled textures in render pass @@ -890,7 +891,7 @@ EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize}); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1)); } // This is a regression test for a bug where a texture wouldn't get clear for a pass if at least @@ -950,7 +951,7 @@ EXPECT_TEXTURE_EQ(&RGBA8::kZero, texture, {0, 0, 1}, {1, 1}); // The whole texture is now initialized. - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 2)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 2)); } // This tests the clearing of sampled textures during compute pass @@ -1012,7 +1013,7 @@ EXPECT_BUFFER_U32_RANGE_EQ(expectedWithZeros.data(), bufferTex, 0, kFormatBlockByteSize); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // This tests that the code path of CopyTextureToBuffer clears correctly for non-renderable textures @@ -1045,7 +1046,7 @@ EXPECT_BUFFER_U32_RANGE_EQ(expectedWithZeros.data(), bufferDst, 0, kSize); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // This tests that the code path of CopyTextureToBuffer clears correctly for non-renderable textures @@ -1080,7 +1081,7 @@ EXPECT_BUFFER_U32_RANGE_EQ(expectedWithZeros.data(), bufferDst, 0, kUnalignedSize); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // This tests that the code path of CopyTextureToBuffer clears correctly for non-renderable textures @@ -1114,7 +1115,7 @@ EXPECT_BUFFER_U32_RANGE_EQ(expectedWithZeros.data(), bufferDst, 0, 8); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 1, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 1, 1)); } // This tests that storeOp clear resets resource state to uninitialized. @@ -1178,8 +1179,8 @@ 1u, EXPECT_TEXTURE_EQ(expectedWithZeros.data(), renderTexture, {0, 0}, {kSize, kSize})); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(renderTexture.Get(), 0, 1, 0, 1)); } // This tests storeOp Clear on depth and stencil textures. @@ -1232,8 +1233,8 @@ // Expect texture subresource initialized to be false since storeop is clear, sets // subresource as uninitialized - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, - 1, 0, 1)); + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, + 1, 0, 1)); } // Now we put the depth stencil texture back into renderpass, it should be cleared by loadop @@ -1257,8 +1258,8 @@ // Expect texture subresource initialized to be false since storeop is clear, sets // subresource as uninitialized - EXPECT_EQ(false, dawn_native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, - 1, 0, 1)); + EXPECT_EQ(false, dawn::native::IsTextureSubresourceInitialized(depthStencilTexture.Get(), 0, + 1, 0, 1)); } } @@ -1335,7 +1336,7 @@ {mipSize, mipSize}, 1)); // Expect the whole texture to be initialized - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 2, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 2, 0, 1)); } // Test that if one layer of a texture is initialized and another is uninitialized, lazy clearing @@ -1419,7 +1420,7 @@ 0u, EXPECT_TEXTURE_EQ(expectedWithTwos.data(), sampleTexture, {0, 0, 1}, {kSize, kSize})); // Expect the whole texture to be initialized - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 1, 0, 2)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(sampleTexture.Get(), 0, 1, 0, 2)); } // This is a regression test for crbug.com/dawn/451 where the lazy texture @@ -1461,7 +1462,7 @@ } // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); } // In this test WriteTexture fully overwrites a texture @@ -1490,7 +1491,7 @@ &textureDataLayout, ©Size)); // Expect texture initialized to be true - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kSize, kSize}); } @@ -1524,7 +1525,7 @@ &textureDataLayout, ©Size)); // Expect texture initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1)); std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); // first half filled with 100, by the data @@ -1565,8 +1566,8 @@ &textureDataLayout, ©Size)); // Expect texture subresource initialized to be true - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer, - kCopyLayerCount)); + EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer, + kCopyLayerCount)); for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) { EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0, layer}, {kSize, kSize}); @@ -1606,8 +1607,8 @@ &textureDataLayout, ©Size)); // Expect texture subresource initialized to be true - EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, - kBaseArrayLayer, kCopyLayerCount)); + EXPECT_EQ(true, dawn::native::IsTextureSubresourceInitialized( + texture.Get(), 0, 1, kBaseArrayLayer, kCopyLayerCount)); std::vector<RGBA8> expectedZeros((kSize / 2) * kSize, {0, 0, 0, 0}); for (uint32_t layer = kBaseArrayLayer; layer < kBaseArrayLayer + kCopyLayerCount; ++layer) { @@ -1648,7 +1649,7 @@ &textureDataLayout, ©Size)); // Expect texture initialized to be true - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1)); + EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1)); EXPECT_TEXTURE_EQ(data.data(), texture, {0, 0}, {kMipSize, kMipSize}, kMipLevel); } @@ -1687,7 +1688,7 @@ // Expect texture initialized to be true EXPECT_EQ(true, - dawn_native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1)); + dawn::native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1)); std::vector<RGBA8> expectedZeros((kMipSize / 2) * kMipSize, {0, 0, 0, 0}); // first half filled with 100, by the data @@ -1823,8 +1824,8 @@ {0x00, 0x20, 0x08, 0xFF}); EXPECT_TEXTURE_EQ(expected.data(), renderPass.color, {0, 0}, {nonPaddedCopyExtent.width, nonPaddedCopyExtent.height}); - EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel, - 1, baseArrayLayer, 1)); + EXPECT_TRUE(dawn::native::IsTextureSubresourceInitialized(bcTexture.Get(), viewMipmapLevel, + 1, baseArrayLayer, 1)); // If we only copied to half the texture, check the other half is initialized to black if (halfCopyTest) {
diff --git a/src/tests/end2end/VideoViewsTests_gbm.cpp b/src/tests/end2end/VideoViewsTests_gbm.cpp index 946eb84..a2540e9 100644 --- a/src/tests/end2end/VideoViewsTests_gbm.cpp +++ b/src/tests/end2end/VideoViewsTests_gbm.cpp
@@ -158,7 +158,7 @@ internalDesc.internalUsage = wgpu::TextureUsage::CopySrc; textureDesc.nextInChain = &internalDesc; - dawn_native::vulkan::ExternalImageDescriptorDmaBuf descriptor = {}; + dawn::native::vulkan::ExternalImageDescriptorDmaBuf descriptor = {}; descriptor.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(&textureDesc); descriptor.isInitialized = true; @@ -169,16 +169,16 @@ descriptor.waitFDs = {}; return std::make_unique<PlatformTextureGbm>( - wgpu::Texture::Acquire(dawn_native::vulkan::WrapVulkanImage(mWGPUDevice, &descriptor)), + wgpu::Texture::Acquire(dawn::native::vulkan::WrapVulkanImage(mWGPUDevice, &descriptor)), gbmBo); } void DestroyVideoTextureForTest( std::unique_ptr<VideoViewsTestBackend::PlatformTexture>&& platformTexture) override { // Exports the signal and ignores it. - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(platformTexture->wgpuTexture.Get(), - VK_IMAGE_LAYOUT_GENERAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(platformTexture->wgpuTexture.Get(), + VK_IMAGE_LAYOUT_GENERAL, &exportInfo); for (int fd : exportInfo.semaphoreHandles) { ASSERT_NE(fd, -1); close(fd);
diff --git a/src/tests/end2end/VideoViewsTests_win.cpp b/src/tests/end2end/VideoViewsTests_win.cpp index 18b63a0..1d38e8f 100644 --- a/src/tests/end2end/VideoViewsTests_win.cpp +++ b/src/tests/end2end/VideoViewsTests_win.cpp
@@ -43,7 +43,7 @@ mWGPUDevice = device; // Create the D3D11 device/contexts that will be used in subsequent tests - ComPtr<ID3D12Device> d3d12Device = dawn_native::d3d12::GetD3D12Device(device); + ComPtr<ID3D12Device> d3d12Device = dawn::native::d3d12::GetD3D12Device(device); const LUID adapterLuid = d3d12Device->GetAdapterLuid(); @@ -144,7 +144,7 @@ hr = d3d11Texture.As(&dxgiKeyedMutex); ASSERT(hr == S_OK); - using dawn_native::d3d12::kDXGIKeyedMutexAcquireReleaseKey; + using dawn::native::d3d12::kDXGIKeyedMutexAcquireReleaseKey; hr = dxgiKeyedMutex->AcquireSync(kDXGIKeyedMutexAcquireReleaseKey, INFINITE); ASSERT(hr == S_OK); @@ -153,18 +153,18 @@ // Open the DX11 texture in Dawn from the shared handle and return it as a WebGPU // texture. - dawn_native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; + dawn::native::d3d12::ExternalImageDescriptorDXGISharedHandle externalImageDesc; externalImageDesc.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(&textureDesc); externalImageDesc.sharedHandle = sharedHandle; - std::unique_ptr<dawn_native::d3d12::ExternalImageDXGI> externalImage = - dawn_native::d3d12::ExternalImageDXGI::Create(mWGPUDevice, &externalImageDesc); + std::unique_ptr<dawn::native::d3d12::ExternalImageDXGI> externalImage = + dawn::native::d3d12::ExternalImageDXGI::Create(mWGPUDevice, &externalImageDesc); // Handle is no longer needed once resources are created. ::CloseHandle(sharedHandle); - dawn_native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; + dawn::native::d3d12::ExternalImageAccessDescriptorDXGIKeyedMutex externalAccessDesc; externalAccessDesc.isInitialized = true; externalAccessDesc.usage = static_cast<WGPUTextureUsageFlags>(textureDesc.usage);
diff --git a/src/tests/end2end/WindowSurfaceTests.cpp b/src/tests/end2end/WindowSurfaceTests.cpp index c6b5481..d8160b6 100644 --- a/src/tests/end2end/WindowSurfaceTests.cpp +++ b/src/tests/end2end/WindowSurfaceTests.cpp
@@ -50,7 +50,7 @@ }); DAWN_TEST_UNSUPPORTED_IF(!glfwInit()); - dawnProcSetProcs(&dawn_native::GetProcs()); + dawnProcSetProcs(&dawn::native::GetProcs()); mInstance = wgpu::CreateInstance(); }
diff --git a/src/tests/unittests/AsyncTaskTests.cpp b/src/tests/unittests/AsyncTaskTests.cpp index 0593d4c..2eb0b05 100644 --- a/src/tests/unittests/AsyncTaskTests.cpp +++ b/src/tests/unittests/AsyncTaskTests.cpp
@@ -13,7 +13,7 @@ // limitations under the License. // // AsyncTaskTests: -// Simple tests for dawn_native::AsyncTask and dawn_native::AsnycTaskManager. +// Simple tests for dawn::native::AsyncTask and dawn::native::AsnycTaskManager. #include <gtest/gtest.h> @@ -67,13 +67,13 @@ dawn::platform::Platform platform; std::unique_ptr<dawn::platform::WorkerTaskPool> pool = platform.CreateWorkerTaskPool(); - dawn_native::AsyncTaskManager taskManager(pool.get()); + dawn::native::AsyncTaskManager taskManager(pool.get()); ConcurrentTaskResultQueue taskResultQueue; constexpr size_t kTaskCount = 4u; std::set<uint32_t> idset; for (uint32_t i = 0; i < kTaskCount; ++i) { - dawn_native::AsyncTask asyncTask([&taskResultQueue, i] { DoTask(&taskResultQueue, i); }); + dawn::native::AsyncTask asyncTask([&taskResultQueue, i] { DoTask(&taskResultQueue, i); }); taskManager.PostTask(std::move(asyncTask)); idset.insert(i); }
diff --git a/src/tests/unittests/BuddyAllocatorTests.cpp b/src/tests/unittests/BuddyAllocatorTests.cpp index 5d46630..7e4c282 100644 --- a/src/tests/unittests/BuddyAllocatorTests.cpp +++ b/src/tests/unittests/BuddyAllocatorTests.cpp
@@ -15,7 +15,7 @@ #include <gtest/gtest.h> #include "dawn_native/BuddyAllocator.h" -using namespace dawn_native; +using namespace dawn::native; constexpr uint64_t BuddyAllocator::kInvalidOffset;
diff --git a/src/tests/unittests/BuddyMemoryAllocatorTests.cpp b/src/tests/unittests/BuddyMemoryAllocatorTests.cpp index 3876ad8..0bc198f 100644 --- a/src/tests/unittests/BuddyMemoryAllocatorTests.cpp +++ b/src/tests/unittests/BuddyMemoryAllocatorTests.cpp
@@ -21,7 +21,7 @@ #include <set> #include <vector> -using namespace dawn_native; +using namespace dawn::native; class DummyResourceHeapAllocator : public ResourceHeapAllocator { public:
diff --git a/src/tests/unittests/ChainUtilsTests.cpp b/src/tests/unittests/ChainUtilsTests.cpp index 2d43729..aa4c274 100644 --- a/src/tests/unittests/ChainUtilsTests.cpp +++ b/src/tests/unittests/ChainUtilsTests.cpp
@@ -19,21 +19,21 @@ // Checks that we cannot find any structs in an empty chain TEST(ChainUtilsTests, FindEmptyChain) { - const dawn_native::PrimitiveDepthClampingState* info = nullptr; - dawn_native::FindInChain(nullptr, &info); + const dawn::native::PrimitiveDepthClampingState* info = nullptr; + dawn::native::FindInChain(nullptr, &info); ASSERT_EQ(nullptr, info); } // Checks that searching a chain for a present struct returns that struct TEST(ChainUtilsTests, FindPresentInChain) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; - const dawn_native::PrimitiveDepthClampingState* info1 = nullptr; - const dawn_native::ShaderModuleSPIRVDescriptor* info2 = nullptr; - dawn_native::FindInChain(&chain1, &info1); - dawn_native::FindInChain(&chain1, &info2); + const dawn::native::PrimitiveDepthClampingState* info1 = nullptr; + const dawn::native::ShaderModuleSPIRVDescriptor* info2 = nullptr; + dawn::native::FindInChain(&chain1, &info1); + dawn::native::FindInChain(&chain1, &info2); ASSERT_NE(nullptr, info1); ASSERT_NE(nullptr, info2); @@ -41,40 +41,41 @@ // Checks that searching a chain for a struct that doesn't exist returns a nullptr TEST(ChainUtilsTests, FindMissingInChain) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; - const dawn_native::SurfaceDescriptorFromMetalLayer* info = nullptr; - dawn_native::FindInChain(&chain1, &info); + const dawn::native::SurfaceDescriptorFromMetalLayer* info = nullptr; + dawn::native::FindInChain(&chain1, &info); ASSERT_EQ(nullptr, info); } // Checks that validation rejects chains with duplicate STypes TEST(ChainUtilsTests, ValidateDuplicateSTypes) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; - dawn_native::PrimitiveDepthClampingState chain3; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::PrimitiveDepthClampingState chain3; chain1.nextInChain = &chain2; chain2.nextInChain = &chain3; - dawn_native::MaybeError result = dawn_native::ValidateSTypes(&chain1, {}); + dawn::native::MaybeError result = dawn::native::ValidateSTypes(&chain1, {}); ASSERT_TRUE(result.IsError()); result.AcquireError(); } // Checks that validation rejects chains that contain unspecified STypes TEST(ChainUtilsTests, ValidateUnspecifiedSTypes) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; - dawn_native::ShaderModuleWGSLDescriptor chain3; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::ShaderModuleWGSLDescriptor chain3; chain1.nextInChain = &chain2; chain2.nextInChain = &chain3; - dawn_native::MaybeError result = dawn_native::ValidateSTypes(&chain1, { - {wgpu::SType::PrimitiveDepthClampingState}, - {wgpu::SType::ShaderModuleSPIRVDescriptor}, - }); + dawn::native::MaybeError result = + dawn::native::ValidateSTypes(&chain1, { + {wgpu::SType::PrimitiveDepthClampingState}, + {wgpu::SType::ShaderModuleSPIRVDescriptor}, + }); ASSERT_TRUE(result.IsError()); result.AcquireError(); } @@ -82,13 +83,14 @@ // Checks that validation rejects chains that contain multiple STypes from the same oneof // constraint. TEST(ChainUtilsTests, ValidateOneOfFailure) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; - dawn_native::ShaderModuleWGSLDescriptor chain3; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::ShaderModuleWGSLDescriptor chain3; chain1.nextInChain = &chain2; chain2.nextInChain = &chain3; - dawn_native::MaybeError result = dawn_native::ValidateSTypes(&chain1, + dawn::native::MaybeError result = dawn::native::ValidateSTypes( + &chain1, {{wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor}}); ASSERT_TRUE(result.IsError()); result.AcquireError(); @@ -96,86 +98,89 @@ // Checks that validation accepts chains that match the constraints. TEST(ChainUtilsTests, ValidateSuccess) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; - dawn_native::MaybeError result = dawn_native::ValidateSTypes(&chain1, { - {wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor}, - {wgpu::SType::PrimitiveDepthClampingState}, - {wgpu::SType::SurfaceDescriptorFromMetalLayer}, - }); + dawn::native::MaybeError result = dawn::native::ValidateSTypes( + &chain1, + { + {wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor}, + {wgpu::SType::PrimitiveDepthClampingState}, + {wgpu::SType::SurfaceDescriptorFromMetalLayer}, + }); ASSERT_TRUE(result.IsSuccess()); } // Checks that validation always passes on empty chains. TEST(ChainUtilsTests, ValidateEmptyChain) { - dawn_native::MaybeError result = dawn_native::ValidateSTypes(nullptr, { - {wgpu::SType::ShaderModuleSPIRVDescriptor}, - {wgpu::SType::PrimitiveDepthClampingState}, - }); + dawn::native::MaybeError result = + dawn::native::ValidateSTypes(nullptr, { + {wgpu::SType::ShaderModuleSPIRVDescriptor}, + {wgpu::SType::PrimitiveDepthClampingState}, + }); ASSERT_TRUE(result.IsSuccess()); - result = dawn_native::ValidateSTypes(nullptr, {}); + result = dawn::native::ValidateSTypes(nullptr, {}); ASSERT_TRUE(result.IsSuccess()); } // Checks that singleton validation always passes on empty chains. TEST(ChainUtilsTests, ValidateSingleEmptyChain) { - dawn_native::MaybeError result = dawn_native::ValidateSingleSType(nullptr, - wgpu::SType::ShaderModuleSPIRVDescriptor); + dawn::native::MaybeError result = + dawn::native::ValidateSingleSType(nullptr, wgpu::SType::ShaderModuleSPIRVDescriptor); ASSERT_TRUE(result.IsSuccess()); - result = dawn_native::ValidateSingleSType(nullptr, - wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::PrimitiveDepthClampingState); + result = dawn::native::ValidateSingleSType(nullptr, wgpu::SType::ShaderModuleSPIRVDescriptor, + wgpu::SType::PrimitiveDepthClampingState); ASSERT_TRUE(result.IsSuccess()); } // Checks that singleton validation always fails on chains with multiple children. TEST(ChainUtilsTests, ValidateSingleMultiChain) { - dawn_native::PrimitiveDepthClampingState chain1; - dawn_native::ShaderModuleSPIRVDescriptor chain2; + dawn::native::PrimitiveDepthClampingState chain1; + dawn::native::ShaderModuleSPIRVDescriptor chain2; chain1.nextInChain = &chain2; - dawn_native::MaybeError result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::PrimitiveDepthClampingState); + dawn::native::MaybeError result = + dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClampingState); ASSERT_TRUE(result.IsError()); result.AcquireError(); - result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::PrimitiveDepthClampingState, wgpu::SType::ShaderModuleSPIRVDescriptor); + result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::PrimitiveDepthClampingState, + wgpu::SType::ShaderModuleSPIRVDescriptor); ASSERT_TRUE(result.IsError()); result.AcquireError(); } // Checks that singleton validation passes when the oneof constraint is met. TEST(ChainUtilsTests, ValidateSingleSatisfied) { - dawn_native::ShaderModuleWGSLDescriptor chain1; + dawn::native::ShaderModuleWGSLDescriptor chain1; - dawn_native::MaybeError result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::ShaderModuleWGSLDescriptor); + dawn::native::MaybeError result = + dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleWGSLDescriptor); ASSERT_TRUE(result.IsSuccess()); - result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor); + result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleSPIRVDescriptor, + wgpu::SType::ShaderModuleWGSLDescriptor); ASSERT_TRUE(result.IsSuccess()); - result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::ShaderModuleWGSLDescriptor, wgpu::SType::ShaderModuleSPIRVDescriptor); + result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleWGSLDescriptor, + wgpu::SType::ShaderModuleSPIRVDescriptor); ASSERT_TRUE(result.IsSuccess()); } // Checks that singleton validation passes when the oneof constraint is not met. TEST(ChainUtilsTests, ValidateSingleUnsatisfied) { - dawn_native::PrimitiveDepthClampingState chain1; + dawn::native::PrimitiveDepthClampingState chain1; - dawn_native::MaybeError result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::ShaderModuleWGSLDescriptor); + dawn::native::MaybeError result = + dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleWGSLDescriptor); ASSERT_TRUE(result.IsError()); result.AcquireError(); - result = dawn_native::ValidateSingleSType(&chain1, - wgpu::SType::ShaderModuleSPIRVDescriptor, wgpu::SType::ShaderModuleWGSLDescriptor); + result = dawn::native::ValidateSingleSType(&chain1, wgpu::SType::ShaderModuleSPIRVDescriptor, + wgpu::SType::ShaderModuleWGSLDescriptor); ASSERT_TRUE(result.IsError()); result.AcquireError(); }
diff --git a/src/tests/unittests/CommandAllocatorTests.cpp b/src/tests/unittests/CommandAllocatorTests.cpp index 5d1ca9d..70bfc51 100644 --- a/src/tests/unittests/CommandAllocatorTests.cpp +++ b/src/tests/unittests/CommandAllocatorTests.cpp
@@ -18,7 +18,7 @@ #include <limits> -using namespace dawn_native; +using namespace dawn::native; // Definition of the command types used in the tests enum class CommandType {
diff --git a/src/tests/unittests/ConcurrentCacheTests.cpp b/src/tests/unittests/ConcurrentCacheTests.cpp index 957e4dd..b733397 100644 --- a/src/tests/unittests/ConcurrentCacheTests.cpp +++ b/src/tests/unittests/ConcurrentCacheTests.cpp
@@ -55,7 +55,7 @@ protected: dawn::platform::Platform mPlatform; std::unique_ptr<dawn::platform::WorkerTaskPool> mPool; - dawn_native::AsyncTaskManager mTaskManager; + dawn::native::AsyncTaskManager mTaskManager; ConcurrentCache<SimpleCachedObject> mCache; }; @@ -69,10 +69,10 @@ std::pair<SimpleCachedObject*, bool> anotherInsertOutput = {}; ConcurrentCache<SimpleCachedObject>* cachePtr = &mCache; - dawn_native::AsyncTask asyncTask1([&insertOutput, cachePtr, &cachedObject] { + dawn::native::AsyncTask asyncTask1([&insertOutput, cachePtr, &cachedObject] { insertOutput = cachePtr->Insert(&cachedObject); }); - dawn_native::AsyncTask asyncTask2([&anotherInsertOutput, cachePtr, &anotherCachedObject] { + dawn::native::AsyncTask asyncTask2([&anotherInsertOutput, cachePtr, &anotherCachedObject] { anotherInsertOutput = cachePtr->Insert(&anotherCachedObject); }); mTaskManager.PostTask(std::move(asyncTask1)); @@ -91,12 +91,12 @@ std::pair<SimpleCachedObject*, bool> insertOutput = {}; ConcurrentCache<SimpleCachedObject>* cachePtr = &mCache; - dawn_native::AsyncTask insertTask([&insertOutput, cachePtr, &cachedObject] { + dawn::native::AsyncTask insertTask([&insertOutput, cachePtr, &cachedObject] { insertOutput = cachePtr->Insert(&cachedObject); }); size_t erasedObjectCount = 0; - dawn_native::AsyncTask eraseTask([&erasedObjectCount, cachePtr, &cachedObject] { + dawn::native::AsyncTask eraseTask([&erasedObjectCount, cachePtr, &cachedObject] { while (cachePtr->Find(&cachedObject) == nullptr) { utils::USleep(100); }
diff --git a/src/tests/unittests/EnumMaskIteratorTests.cpp b/src/tests/unittests/EnumMaskIteratorTests.cpp index d5e0bb5..59b008f 100644 --- a/src/tests/unittests/EnumMaskIteratorTests.cpp +++ b/src/tests/unittests/EnumMaskIteratorTests.cpp
@@ -16,7 +16,7 @@ #include "gtest/gtest.h" -namespace dawn_native { +namespace dawn::native { enum class TestAspect : uint8_t { Color = 1, @@ -29,18 +29,18 @@ static constexpr unsigned value = 3; }; -} // namespace dawn_native +} // namespace dawn::native namespace dawn { template <> - struct IsDawnBitmask<dawn_native::TestAspect> { + struct IsDawnBitmask<dawn::native::TestAspect> { static constexpr bool enable = true; }; } // namespace dawn -namespace dawn_native { +namespace dawn::native { static_assert(EnumBitmaskSize<TestAspect>::value == 3, ""); @@ -69,4 +69,4 @@ } } -} // namespace dawn_native +} // namespace dawn::native
diff --git a/src/tests/unittests/ErrorTests.cpp b/src/tests/unittests/ErrorTests.cpp index ff7b7fe..bd1bf8c 100644 --- a/src/tests/unittests/ErrorTests.cpp +++ b/src/tests/unittests/ErrorTests.cpp
@@ -17,7 +17,7 @@ #include "dawn_native/Error.h" #include "dawn_native/ErrorData.h" -using namespace dawn_native; +using namespace dawn::native; namespace {
diff --git a/src/tests/unittests/FeatureTests.cpp b/src/tests/unittests/FeatureTests.cpp index 4e1e797..d7844ff 100644 --- a/src/tests/unittests/FeatureTests.cpp +++ b/src/tests/unittests/FeatureTests.cpp
@@ -22,24 +22,24 @@ public: FeatureTests() : testing::Test(), - mInstanceBase(dawn_native::InstanceBase::Create()), + mInstanceBase(dawn::native::InstanceBase::Create()), mAdapterBase(mInstanceBase.Get()) { } std::vector<wgpu::FeatureName> GetAllFeatureNames() { std::vector<wgpu::FeatureName> allFeatureNames(kTotalFeaturesCount); for (size_t i = 0; i < kTotalFeaturesCount; ++i) { - allFeatureNames[i] = FeatureEnumToAPIFeature(static_cast<dawn_native::Feature>(i)); + allFeatureNames[i] = FeatureEnumToAPIFeature(static_cast<dawn::native::Feature>(i)); } return allFeatureNames; } static constexpr size_t kTotalFeaturesCount = - static_cast<size_t>(dawn_native::Feature::EnumCount); + static_cast<size_t>(dawn::native::Feature::EnumCount); protected: - Ref<dawn_native::InstanceBase> mInstanceBase; - dawn_native::null::Adapter mAdapterBase; + Ref<dawn::native::InstanceBase> mInstanceBase; + dawn::native::null::Adapter mAdapterBase; }; // Test the creation of a device will fail if the requested feature is not supported on the @@ -47,13 +47,13 @@ TEST_F(FeatureTests, AdapterWithRequiredFeatureDisabled) { const std::vector<wgpu::FeatureName> kAllFeatureNames = GetAllFeatureNames(); for (size_t i = 0; i < kTotalFeaturesCount; ++i) { - dawn_native::Feature notSupportedFeature = static_cast<dawn_native::Feature>(i); + dawn::native::Feature notSupportedFeature = static_cast<dawn::native::Feature>(i); std::vector<wgpu::FeatureName> featureNamesWithoutOne = kAllFeatureNames; featureNamesWithoutOne.erase(featureNamesWithoutOne.begin() + i); mAdapterBase.SetSupportedFeatures(featureNamesWithoutOne); - dawn_native::Adapter adapterWithoutFeature(&mAdapterBase); + dawn::native::Adapter adapterWithoutFeature(&mAdapterBase); wgpu::DeviceDescriptor deviceDescriptor; wgpu::FeatureName featureName = FeatureEnumToAPIFeature(notSupportedFeature); @@ -68,16 +68,16 @@ // Test Device.GetEnabledFeatures() can return the names of the enabled features correctly. TEST_F(FeatureTests, GetEnabledFeatures) { - dawn_native::Adapter adapter(&mAdapterBase); + dawn::native::Adapter adapter(&mAdapterBase); for (size_t i = 0; i < kTotalFeaturesCount; ++i) { - dawn_native::Feature feature = static_cast<dawn_native::Feature>(i); + dawn::native::Feature feature = static_cast<dawn::native::Feature>(i); wgpu::FeatureName featureName = FeatureEnumToAPIFeature(feature); wgpu::DeviceDescriptor deviceDescriptor; deviceDescriptor.requiredFeatures = &featureName; deviceDescriptor.requiredFeaturesCount = 1; - dawn_native::DeviceBase* deviceBase = dawn_native::FromAPI( + dawn::native::DeviceBase* deviceBase = dawn::native::FromAPI( adapter.CreateDevice(reinterpret_cast<const WGPUDeviceDescriptor*>(&deviceDescriptor))); ASSERT_EQ(1u, deviceBase->APIEnumerateFeatures(nullptr));
diff --git a/src/tests/unittests/GetProcAddressTests.cpp b/src/tests/unittests/GetProcAddressTests.cpp index 1305dbc..abf65d3 100644 --- a/src/tests/unittests/GetProcAddressTests.cpp +++ b/src/tests/unittests/GetProcAddressTests.cpp
@@ -51,7 +51,7 @@ public: GetProcAddressTests() : testing::TestWithParam<DawnFlavor>(), - mNativeInstance(dawn_native::InstanceBase::Create()), + mNativeInstance(dawn::native::InstanceBase::Create()), mNativeAdapter(mNativeInstance.Get()) { } @@ -60,7 +60,7 @@ case DawnFlavor::Native: { mDevice = wgpu::Device::Acquire( reinterpret_cast<WGPUDevice>(mNativeAdapter.APICreateDevice())); - mProcs = dawn_native::GetProcs(); + mProcs = dawn::native::GetProcs(); break; } @@ -90,8 +90,8 @@ } protected: - Ref<dawn_native::InstanceBase> mNativeInstance; - dawn_native::null::Adapter mNativeAdapter; + Ref<dawn::native::InstanceBase> mNativeInstance; + dawn::native::null::Adapter mNativeAdapter; std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf; std::unique_ptr<dawn::wire::WireClient> mWireClient; @@ -155,7 +155,7 @@ testing::PrintToStringParamName()); TEST(GetProcAddressInternalTests, CheckDawnNativeProcMapOrder) { - std::vector<const char*> names = dawn_native::GetProcMapNamesForTesting(); + std::vector<const char*> names = dawn::native::GetProcMapNamesForTesting(); for (size_t i = 1; i < names.size(); i++) { ASSERT_LT(std::string(names[i - 1]), std::string(names[i])); }
diff --git a/src/tests/unittests/LimitsTests.cpp b/src/tests/unittests/LimitsTests.cpp index e931855..88ac356 100644 --- a/src/tests/unittests/LimitsTests.cpp +++ b/src/tests/unittests/LimitsTests.cpp
@@ -18,10 +18,10 @@ // Test |GetDefaultLimits| returns the default. TEST(Limits, GetDefaultLimits) { - dawn_native::Limits limits = {}; + dawn::native::Limits limits = {}; EXPECT_NE(limits.maxBindGroups, 4u); - dawn_native::GetDefaultLimits(&limits); + dawn::native::GetDefaultLimits(&limits); EXPECT_EQ(limits.maxBindGroups, 4u); } @@ -29,11 +29,11 @@ // Test |ReifyDefaultLimits| populates the default if // values are undefined. TEST(Limits, ReifyDefaultLimits_PopulatesDefault) { - dawn_native::Limits limits; + dawn::native::Limits limits; limits.maxComputeWorkgroupStorageSize = wgpu::kLimitU32Undefined; limits.maxStorageBufferBindingSize = wgpu::kLimitU64Undefined; - dawn_native::Limits reified = dawn_native::ReifyDefaultLimits(limits); + dawn::native::Limits reified = dawn::native::ReifyDefaultLimits(limits); EXPECT_EQ(reified.maxComputeWorkgroupStorageSize, 16352u); EXPECT_EQ(reified.maxStorageBufferBindingSize, 134217728ul); } @@ -41,11 +41,11 @@ // Test |ReifyDefaultLimits| clamps to the default if // values are worse than the default. TEST(Limits, ReifyDefaultLimits_Clamps) { - dawn_native::Limits limits; + dawn::native::Limits limits; limits.maxStorageBuffersPerShaderStage = 4; limits.minUniformBufferOffsetAlignment = 512; - dawn_native::Limits reified = dawn_native::ReifyDefaultLimits(limits); + dawn::native::Limits reified = dawn::native::ReifyDefaultLimits(limits); EXPECT_EQ(reified.maxStorageBuffersPerShaderStage, 8u); EXPECT_EQ(reified.minUniformBufferOffsetAlignment, 256u); } @@ -54,19 +54,19 @@ // than supported. TEST(Limits, ValidateLimits) { // Start with the default for supported. - dawn_native::Limits defaults; - dawn_native::GetDefaultLimits(&defaults); + dawn::native::Limits defaults; + dawn::native::GetDefaultLimits(&defaults); // Test supported == required is valid. { - dawn_native::Limits required = defaults; + dawn::native::Limits required = defaults; EXPECT_TRUE(ValidateLimits(defaults, required).IsSuccess()); } // Test supported == required is valid, when they are not default. { - dawn_native::Limits supported = defaults; - dawn_native::Limits required = defaults; + dawn::native::Limits supported = defaults; + dawn::native::Limits required = defaults; supported.maxBindGroups += 1; required.maxBindGroups += 1; EXPECT_TRUE(ValidateLimits(supported, required).IsSuccess()); @@ -74,38 +74,38 @@ // Test that default-initialized (all undefined) is valid. { - dawn_native::Limits required = {}; + dawn::native::Limits required = {}; EXPECT_TRUE(ValidateLimits(defaults, required).IsSuccess()); } // Test that better than max is invalid. { - dawn_native::Limits required = {}; + dawn::native::Limits required = {}; required.maxTextureDimension3D = defaults.maxTextureDimension3D + 1; - dawn_native::MaybeError err = ValidateLimits(defaults, required); + dawn::native::MaybeError err = ValidateLimits(defaults, required); EXPECT_TRUE(err.IsError()); err.AcquireError(); } // Test that worse than max is valid. { - dawn_native::Limits required = {}; + dawn::native::Limits required = {}; required.maxComputeWorkgroupSizeX = defaults.maxComputeWorkgroupSizeX - 1; EXPECT_TRUE(ValidateLimits(defaults, required).IsSuccess()); } // Test that better than min is invalid. { - dawn_native::Limits required = {}; + dawn::native::Limits required = {}; required.minUniformBufferOffsetAlignment = defaults.minUniformBufferOffsetAlignment / 2; - dawn_native::MaybeError err = ValidateLimits(defaults, required); + dawn::native::MaybeError err = ValidateLimits(defaults, required); EXPECT_TRUE(err.IsError()); err.AcquireError(); } // Test that worse than min is valid. { - dawn_native::Limits required = {}; + dawn::native::Limits required = {}; required.minStorageBufferOffsetAlignment = defaults.minStorageBufferOffsetAlignment * 2; EXPECT_TRUE(ValidateLimits(defaults, required).IsSuccess()); } @@ -113,38 +113,38 @@ // Test that |ApplyLimitTiers| degrades limits to the next best tier. TEST(Limits, ApplyLimitTiers) { - auto SetLimitsStorageBufferBindingSizeTier2 = [](dawn_native::Limits* limits) { + auto SetLimitsStorageBufferBindingSizeTier2 = [](dawn::native::Limits* limits) { limits->maxStorageBufferBindingSize = 1073741824; }; - dawn_native::Limits limitsStorageBufferBindingSizeTier2; - dawn_native::GetDefaultLimits(&limitsStorageBufferBindingSizeTier2); + dawn::native::Limits limitsStorageBufferBindingSizeTier2; + dawn::native::GetDefaultLimits(&limitsStorageBufferBindingSizeTier2); SetLimitsStorageBufferBindingSizeTier2(&limitsStorageBufferBindingSizeTier2); - auto SetLimitsStorageBufferBindingSizeTier3 = [](dawn_native::Limits* limits) { + auto SetLimitsStorageBufferBindingSizeTier3 = [](dawn::native::Limits* limits) { limits->maxStorageBufferBindingSize = 2147483647; }; - dawn_native::Limits limitsStorageBufferBindingSizeTier3; - dawn_native::GetDefaultLimits(&limitsStorageBufferBindingSizeTier3); + dawn::native::Limits limitsStorageBufferBindingSizeTier3; + dawn::native::GetDefaultLimits(&limitsStorageBufferBindingSizeTier3); SetLimitsStorageBufferBindingSizeTier3(&limitsStorageBufferBindingSizeTier3); - auto SetLimitsComputeWorkgroupStorageSizeTier1 = [](dawn_native::Limits* limits) { + auto SetLimitsComputeWorkgroupStorageSizeTier1 = [](dawn::native::Limits* limits) { limits->maxComputeWorkgroupStorageSize = 16352; }; - dawn_native::Limits limitsComputeWorkgroupStorageSizeTier1; - dawn_native::GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier1); + dawn::native::Limits limitsComputeWorkgroupStorageSizeTier1; + dawn::native::GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier1); SetLimitsComputeWorkgroupStorageSizeTier1(&limitsComputeWorkgroupStorageSizeTier1); - auto SetLimitsComputeWorkgroupStorageSizeTier3 = [](dawn_native::Limits* limits) { + auto SetLimitsComputeWorkgroupStorageSizeTier3 = [](dawn::native::Limits* limits) { limits->maxComputeWorkgroupStorageSize = 65536; }; - dawn_native::Limits limitsComputeWorkgroupStorageSizeTier3; - dawn_native::GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier3); + dawn::native::Limits limitsComputeWorkgroupStorageSizeTier3; + dawn::native::GetDefaultLimits(&limitsComputeWorkgroupStorageSizeTier3); SetLimitsComputeWorkgroupStorageSizeTier3(&limitsComputeWorkgroupStorageSizeTier3); // Test that applying tiers to limits that are exactly // equal to a tier returns the same values. { - dawn_native::Limits limits = limitsStorageBufferBindingSizeTier2; + dawn::native::Limits limits = limitsStorageBufferBindingSizeTier2; EXPECT_EQ(ApplyLimitTiers(limits), limits); limits = limitsStorageBufferBindingSizeTier3; @@ -153,7 +153,7 @@ // Test all limits slightly worse than tier 3. { - dawn_native::Limits limits = limitsStorageBufferBindingSizeTier3; + dawn::native::Limits limits = limitsStorageBufferBindingSizeTier3; limits.maxStorageBufferBindingSize -= 1; EXPECT_EQ(ApplyLimitTiers(limits), limitsStorageBufferBindingSizeTier2); } @@ -161,28 +161,28 @@ // Test that limits may match one tier exactly and be degraded in another tier. // Degrading to one tier does not affect the other tier. { - dawn_native::Limits limits = limitsComputeWorkgroupStorageSizeTier3; + dawn::native::Limits limits = limitsComputeWorkgroupStorageSizeTier3; // Set tier 3 and change one limit to be insufficent. SetLimitsStorageBufferBindingSizeTier3(&limits); limits.maxStorageBufferBindingSize -= 1; - dawn_native::Limits tiered = ApplyLimitTiers(limits); + dawn::native::Limits tiered = ApplyLimitTiers(limits); // Check that |tiered| has the limits of memorySize tier 2 - dawn_native::Limits tieredWithMemorySizeTier2 = tiered; + dawn::native::Limits tieredWithMemorySizeTier2 = tiered; SetLimitsStorageBufferBindingSizeTier2(&tieredWithMemorySizeTier2); EXPECT_EQ(tiered, tieredWithMemorySizeTier2); // Check that |tiered| has the limits of bindingSpace tier 3 - dawn_native::Limits tieredWithBindingSpaceTier3 = tiered; + dawn::native::Limits tieredWithBindingSpaceTier3 = tiered; SetLimitsComputeWorkgroupStorageSizeTier3(&tieredWithBindingSpaceTier3); EXPECT_EQ(tiered, tieredWithBindingSpaceTier3); } // Test that limits may be simultaneously degraded in two tiers independently. { - dawn_native::Limits limits; - dawn_native::GetDefaultLimits(&limits); + dawn::native::Limits limits; + dawn::native::GetDefaultLimits(&limits); SetLimitsComputeWorkgroupStorageSizeTier3(&limits); SetLimitsStorageBufferBindingSizeTier3(&limits); limits.maxComputeWorkgroupStorageSize = @@ -190,9 +190,9 @@ limits.maxStorageBufferBindingSize = limitsStorageBufferBindingSizeTier2.maxStorageBufferBindingSize + 1; - dawn_native::Limits tiered = ApplyLimitTiers(limits); + dawn::native::Limits tiered = ApplyLimitTiers(limits); - dawn_native::Limits expected = tiered; + dawn::native::Limits expected = tiered; SetLimitsComputeWorkgroupStorageSizeTier1(&expected); SetLimitsStorageBufferBindingSizeTier2(&expected); EXPECT_EQ(tiered, expected);
diff --git a/src/tests/unittests/PerStageTests.cpp b/src/tests/unittests/PerStageTests.cpp index dcecd83..736bb76 100644 --- a/src/tests/unittests/PerStageTests.cpp +++ b/src/tests/unittests/PerStageTests.cpp
@@ -16,7 +16,7 @@ #include "dawn_native/PerStage.h" -using namespace dawn_native; +using namespace dawn::native; // Tests for StageBit TEST(PerStage, StageBit) {
diff --git a/src/tests/unittests/PerThreadProcTests.cpp b/src/tests/unittests/PerThreadProcTests.cpp index 6151a6c..47b2934 100644 --- a/src/tests/unittests/PerThreadProcTests.cpp +++ b/src/tests/unittests/PerThreadProcTests.cpp
@@ -25,14 +25,14 @@ class PerThreadProcTests : public testing::Test { public: PerThreadProcTests() - : mNativeInstance(dawn_native::InstanceBase::Create()), + : mNativeInstance(dawn::native::InstanceBase::Create()), mNativeAdapter(mNativeInstance.Get()) { } ~PerThreadProcTests() override = default; protected: - Ref<dawn_native::InstanceBase> mNativeInstance; - dawn_native::null::Adapter mNativeAdapter; + Ref<dawn::native::InstanceBase> mNativeInstance; + dawn::native::null::Adapter mNativeAdapter; }; // Test that procs can be set per thread. This test overrides deviceCreateBuffer with a dummy proc @@ -63,7 +63,7 @@ wgpu::Device::Acquire(reinterpret_cast<WGPUDevice>(mNativeAdapter.APICreateDevice())); std::thread threadA([&]() { - DawnProcTable procs = dawn_native::GetProcs(); + DawnProcTable procs = dawn::native::GetProcs(); procs.deviceCreateBuffer = [](WGPUDevice device, WGPUBufferDescriptor const* descriptor) -> WGPUBuffer { EXPECT_EQ(std::this_thread::get_id(), threadIdA); @@ -84,7 +84,7 @@ }); std::thread threadB([&]() { - DawnProcTable procs = dawn_native::GetProcs(); + DawnProcTable procs = dawn::native::GetProcs(); procs.deviceCreateBuffer = [](WGPUDevice device, WGPUBufferDescriptor const* bufferDesc) -> WGPUBuffer { EXPECT_EQ(std::this_thread::get_id(), threadIdB);
diff --git a/src/tests/unittests/RingBufferAllocatorTests.cpp b/src/tests/unittests/RingBufferAllocatorTests.cpp index aa14e7c..3787ba3 100644 --- a/src/tests/unittests/RingBufferAllocatorTests.cpp +++ b/src/tests/unittests/RingBufferAllocatorTests.cpp
@@ -16,7 +16,7 @@ #include "dawn_native/RingBufferAllocator.h" -using namespace dawn_native; +using namespace dawn::native; constexpr uint64_t RingBufferAllocator::kInvalidOffset;
diff --git a/src/tests/unittests/SubresourceStorageTests.cpp b/src/tests/unittests/SubresourceStorageTests.cpp index b9b4fc3..f1e28b3 100644 --- a/src/tests/unittests/SubresourceStorageTests.cpp +++ b/src/tests/unittests/SubresourceStorageTests.cpp
@@ -18,7 +18,7 @@ #include "common/Log.h" -using namespace dawn_native; +using namespace dawn::native; // A fake class that replicates the behavior of SubresourceStorage but without any compression and // is used to compare the results of operations on SubresourceStorage against the "ground truth" of
diff --git a/src/tests/unittests/ToBackendTests.cpp b/src/tests/unittests/ToBackendTests.cpp index 01bbc17..7651350 100644 --- a/src/tests/unittests/ToBackendTests.cpp +++ b/src/tests/unittests/ToBackendTests.cpp
@@ -20,11 +20,11 @@ #include <type_traits> // Make our own Base - Backend object pair, reusing the AdapterBase name -namespace dawn_native { +namespace dawn::native { class AdapterBase : public RefCounted {}; -} // namespace dawn_native +} // namespace dawn::native -using namespace dawn_native; +using namespace dawn::native; class MyAdapter : public AdapterBase {};
diff --git a/src/tests/unittests/d3d12/CopySplitTests.cpp b/src/tests/unittests/d3d12/CopySplitTests.cpp index f8feafe..0e265a2 100644 --- a/src/tests/unittests/d3d12/CopySplitTests.cpp +++ b/src/tests/unittests/d3d12/CopySplitTests.cpp
@@ -23,7 +23,7 @@ #include "dawn_native/d3d12/d3d12_platform.h" #include "utils/TestUtils.h" -using namespace dawn_native::d3d12; +using namespace dawn::native::d3d12; namespace {
diff --git a/src/tests/unittests/native/CommandBufferEncodingTests.cpp b/src/tests/unittests/native/CommandBufferEncodingTests.cpp index c1ca2d9..6515067 100644 --- a/src/tests/unittests/native/CommandBufferEncodingTests.cpp +++ b/src/tests/unittests/native/CommandBufferEncodingTests.cpp
@@ -21,11 +21,11 @@ class CommandBufferEncodingTests : public DawnNativeTest { protected: - void ExpectCommands(dawn_native::CommandIterator* commands, - std::vector<std::pair<dawn_native::Command, - std::function<void(dawn_native::CommandIterator*)>>> + void ExpectCommands(dawn::native::CommandIterator* commands, + std::vector<std::pair<dawn::native::Command, + std::function<void(dawn::native::CommandIterator*)>>> expectedCommands) { - dawn_native::Command commandId; + dawn::native::Command commandId; for (uint32_t commandIndex = 0; commands->NextCommandId(&commandId); ++commandIndex) { ASSERT_LT(commandIndex, expectedCommands.size()) << "Unexpected command"; ASSERT_EQ(commandId, expectedCommands[commandIndex].first) @@ -38,7 +38,7 @@ // Indirect dispatch validation changes the bind groups in the middle // of a pass. Test that bindings are restored after the validation runs. TEST_F(CommandBufferEncodingTests, ComputePassEncoderIndirectDispatchStateRestoration) { - using namespace dawn_native; + using namespace dawn::native; wgpu::BindGroupLayout staticLayout = utils::MakeBindGroupLayout(device, {{ @@ -274,7 +274,7 @@ // and does not leak state changes that occured between a snapshot and the // state restoration. TEST_F(CommandBufferEncodingTests, StateNotLeakedAfterRestore) { - using namespace dawn_native; + using namespace dawn::native; wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
diff --git a/src/tests/unittests/native/DestroyObjectTests.cpp b/src/tests/unittests/native/DestroyObjectTests.cpp index 99acf28..bff4820 100644 --- a/src/tests/unittests/native/DestroyObjectTests.cpp +++ b/src/tests/unittests/native/DestroyObjectTests.cpp
@@ -32,7 +32,7 @@ #include "tests/DawnNativeTest.h" #include "utils/ComboRenderPipelineDescriptor.h" -namespace dawn_native { namespace { +namespace dawn::native { namespace { using ::testing::_; using ::testing::ByMove; @@ -754,4 +754,4 @@ EXPECT_FALSE(textureView->IsAlive()); } -}} // namespace dawn_native:: +}} // namespace dawn::native::
diff --git a/src/tests/unittests/native/DeviceCreationTests.cpp b/src/tests/unittests/native/DeviceCreationTests.cpp index 6402286..1a8ddb6 100644 --- a/src/tests/unittests/native/DeviceCreationTests.cpp +++ b/src/tests/unittests/native/DeviceCreationTests.cpp
@@ -27,11 +27,11 @@ class DeviceCreationTest : public testing::Test { protected: void SetUp() override { - dawnProcSetProcs(&dawn_native::GetProcs()); + dawnProcSetProcs(&dawn::native::GetProcs()); - instance = std::make_unique<dawn_native::Instance>(); + instance = std::make_unique<dawn::native::Instance>(); instance->DiscoverDefaultAdapters(); - for (dawn_native::Adapter& nativeAdapter : instance->GetAdapters()) { + for (dawn::native::Adapter& nativeAdapter : instance->GetAdapters()) { wgpu::AdapterProperties properties; nativeAdapter.GetProperties(&properties); @@ -49,7 +49,7 @@ dawnProcSetProcs(nullptr); } - std::unique_ptr<dawn_native::Instance> instance; + std::unique_ptr<dawn::native::Instance> instance; wgpu::Adapter adapter; }; @@ -79,7 +79,7 @@ wgpu::Device device = adapter.CreateDevice(&desc); EXPECT_NE(device, nullptr); - auto toggles = dawn_native::GetTogglesUsed(device.Get()); + auto toggles = dawn::native::GetTogglesUsed(device.Get()); EXPECT_THAT(toggles, testing::Contains(testing::StrEq(toggle))); }
diff --git a/src/tests/unittests/native/mocks/BindGroupLayoutMock.h b/src/tests/unittests/native/mocks/BindGroupLayoutMock.h index 56df374..841e5c8 100644 --- a/src/tests/unittests/native/mocks/BindGroupLayoutMock.h +++ b/src/tests/unittests/native/mocks/BindGroupLayoutMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class BindGroupLayoutMock final : public BindGroupLayoutBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_BINDGROUPLAYOUT_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/BindGroupMock.h b/src/tests/unittests/native/mocks/BindGroupMock.h index bc5e234..6faec4e 100644 --- a/src/tests/unittests/native/mocks/BindGroupMock.h +++ b/src/tests/unittests/native/mocks/BindGroupMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class BindGroupMock : public BindGroupBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_BINDGROUP_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/BufferMock.h b/src/tests/unittests/native/mocks/BufferMock.h index 4b66854..9b69e2a 100644 --- a/src/tests/unittests/native/mocks/BufferMock.h +++ b/src/tests/unittests/native/mocks/BufferMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class BufferMock : public BufferBase { public: @@ -44,6 +44,6 @@ MOCK_METHOD(bool, IsCPUWritableAtCreation, (), (const, override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_BINDGROUP_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/CommandBufferMock.h b/src/tests/unittests/native/mocks/CommandBufferMock.h index 88caa23..7b0ee08 100644 --- a/src/tests/unittests/native/mocks/CommandBufferMock.h +++ b/src/tests/unittests/native/mocks/CommandBufferMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class CommandBufferMock : public CommandBufferBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_COMMANDBUFFER_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/ComputePipelineMock.h b/src/tests/unittests/native/mocks/ComputePipelineMock.h index 84b6278..c6208d8 100644 --- a/src/tests/unittests/native/mocks/ComputePipelineMock.h +++ b/src/tests/unittests/native/mocks/ComputePipelineMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class ComputePipelineMock : public ComputePipelineBase { public: @@ -36,6 +36,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_COMPUTEPIPELINE_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/DeviceMock.h b/src/tests/unittests/native/mocks/DeviceMock.h index 97df57f..4e673f3 100644 --- a/src/tests/unittests/native/mocks/DeviceMock.h +++ b/src/tests/unittests/native/mocks/DeviceMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class DeviceMock : public DeviceBase { public: @@ -112,6 +112,6 @@ MOCK_METHOD(MaybeError, WaitForIdleForDestruction, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_DEVICE_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/ExternalTextureMock.h b/src/tests/unittests/native/mocks/ExternalTextureMock.h index 57c0c9f..3e3ba2c 100644 --- a/src/tests/unittests/native/mocks/ExternalTextureMock.h +++ b/src/tests/unittests/native/mocks/ExternalTextureMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class ExternalTextureMock : public ExternalTextureBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_EXTERNALTEXTURE_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/PipelineLayoutMock.h b/src/tests/unittests/native/mocks/PipelineLayoutMock.h index c35d5ed..5201f3b 100644 --- a/src/tests/unittests/native/mocks/PipelineLayoutMock.h +++ b/src/tests/unittests/native/mocks/PipelineLayoutMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class PipelineLayoutMock : public PipelineLayoutBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_PIPELINELAYOUT_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/QuerySetMock.h b/src/tests/unittests/native/mocks/QuerySetMock.h index 1554fff..138b143 100644 --- a/src/tests/unittests/native/mocks/QuerySetMock.h +++ b/src/tests/unittests/native/mocks/QuerySetMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class QuerySetMock : public QuerySetBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_QUERYSET_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/RenderPipelineMock.h b/src/tests/unittests/native/mocks/RenderPipelineMock.h index 12701c3..f573dcd 100644 --- a/src/tests/unittests/native/mocks/RenderPipelineMock.h +++ b/src/tests/unittests/native/mocks/RenderPipelineMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class RenderPipelineMock : public RenderPipelineBase { public: @@ -36,6 +36,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_RENDERPIPELINE_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/SamplerMock.h b/src/tests/unittests/native/mocks/SamplerMock.h index 56df161..4103398 100644 --- a/src/tests/unittests/native/mocks/SamplerMock.h +++ b/src/tests/unittests/native/mocks/SamplerMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class SamplerMock : public SamplerBase { public: @@ -34,6 +34,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_SAMPLER_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/ShaderModuleMock.cpp b/src/tests/unittests/native/mocks/ShaderModuleMock.cpp index 9b5ab09..4c7da22 100644 --- a/src/tests/unittests/native/mocks/ShaderModuleMock.cpp +++ b/src/tests/unittests/native/mocks/ShaderModuleMock.cpp
@@ -14,7 +14,7 @@ #include "ShaderModuleMock.h" -namespace dawn_native { +namespace dawn::native { ShaderModuleMock::ShaderModuleMock(DeviceBase* device) : ShaderModuleBase(device) { ON_CALL(*this, DestroyImpl).WillByDefault([this]() { @@ -37,4 +37,4 @@ return AcquireRef(mock); } -} // namespace dawn_native +} // namespace dawn::native
diff --git a/src/tests/unittests/native/mocks/ShaderModuleMock.h b/src/tests/unittests/native/mocks/ShaderModuleMock.h index 0b3e650..349377a 100644 --- a/src/tests/unittests/native/mocks/ShaderModuleMock.h +++ b/src/tests/unittests/native/mocks/ShaderModuleMock.h
@@ -23,7 +23,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class ShaderModuleMock : public ShaderModuleBase { public: @@ -36,6 +36,6 @@ static ResultOrError<Ref<ShaderModuleMock>> Create(DeviceBase* device, const char* source); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_SHADERMODULE_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/SwapChainMock.h b/src/tests/unittests/native/mocks/SwapChainMock.h index 233da73..4619c57 100644 --- a/src/tests/unittests/native/mocks/SwapChainMock.h +++ b/src/tests/unittests/native/mocks/SwapChainMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class SwapChainMock : public SwapChainBase { public: @@ -41,6 +41,6 @@ MOCK_METHOD(void, APIPresent, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_SWAPCHAIN_MOCK_H_
diff --git a/src/tests/unittests/native/mocks/TextureMock.h b/src/tests/unittests/native/mocks/TextureMock.h index 95e53be..181bd55 100644 --- a/src/tests/unittests/native/mocks/TextureMock.h +++ b/src/tests/unittests/native/mocks/TextureMock.h
@@ -20,7 +20,7 @@ #include <gmock/gmock.h> -namespace dawn_native { +namespace dawn::native { class TextureMock : public TextureBase { public: @@ -44,6 +44,6 @@ MOCK_METHOD(void, DestroyImpl, (), (override)); }; -} // namespace dawn_native +} // namespace dawn::native #endif // TESTS_UNITTESTS_NATIVE_MOCKS_TEXTURE_MOCK_H_
diff --git a/src/tests/unittests/validation/CommandBufferValidationTests.cpp b/src/tests/unittests/validation/CommandBufferValidationTests.cpp index 7ec37af..e6e2818 100644 --- a/src/tests/unittests/validation/CommandBufferValidationTests.cpp +++ b/src/tests/unittests/validation/CommandBufferValidationTests.cpp
@@ -318,7 +318,7 @@ wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); pass.EndPass(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); } @@ -327,13 +327,13 @@ wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); pass.EndPass(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); } // Destroyed encoder should allow encoding, and emit error on finish. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); pass.EndPass(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); @@ -342,7 +342,7 @@ // Destroyed encoder should allow encoding and shouldn't emit an error if never finished. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); pass.EndPass(); } @@ -353,21 +353,21 @@ wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&dummyRenderPass); pass.EndPass(); encoder.Finish(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); } // Destroying an encoder twice should not emit any errors. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - dawn_native::FromAPI(encoder.Get())->Destroy(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); } // Destroying an encoder twice and then calling finish should fail. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); - dawn_native::FromAPI(encoder.Get())->Destroy(); - dawn_native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); + dawn::native::FromAPI(encoder.Get())->Destroy(); ASSERT_DEVICE_ERROR(encoder.Finish(), HasSubstr("Destroyed encoder cannot be finished.")); } }
diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp index 62ccab9..625f29e 100644 --- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp +++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
@@ -234,50 +234,50 @@ }; // Textures not used default to non-filtering - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, unusedTextureFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, unusedTextureFragmentModule).Get(), filteringBGL.Get())); // Textures used with textureLoad default to non-filtering - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, textureLoadFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, textureLoadFragmentModule).Get(), filteringBGL.Get())); // Textures used with textureLoad on both stages default to non-filtering - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureLoadVertexModule, textureLoadFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureLoadVertexModule, textureLoadFragmentModule).Get(), filteringBGL.Get())); // Textures used with textureSample default to filtering - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, textureSampleFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(emptyVertexModule, textureSampleFragmentModule).Get(), filteringBGL.Get())); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureSampleVertexModule, unusedTextureFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureSampleVertexModule, unusedTextureFragmentModule).Get(), filteringBGL.Get())); // Textures used with both textureLoad and textureSample default to filtering - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureLoadVertexModule, textureSampleFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureLoadVertexModule, textureSampleFragmentModule).Get(), filteringBGL.Get())); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureSampleVertexModule, textureLoadFragmentModule).Get(), nonFilteringBGL.Get())); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( BGLFromModules(textureSampleVertexModule, textureLoadFragmentModule).Get(), filteringBGL.Get())); } @@ -317,7 +317,7 @@ desc.entryCount = 1; desc.entries = &binding; - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -351,7 +351,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = ssbo.pos; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } { @@ -365,7 +365,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = uniforms.pos; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -380,7 +380,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = ssbo.pos; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -394,7 +394,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -406,7 +406,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -419,7 +419,7 @@ [[stage(fragment)]] fn main() { _ = mySampler; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } } @@ -447,7 +447,7 @@ [[stage(fragment)]] fn main() { _ = myExternalTexture; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -475,7 +475,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -487,7 +487,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -499,7 +499,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -511,7 +511,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -523,7 +523,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -535,7 +535,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } } @@ -563,7 +563,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -575,7 +575,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -587,7 +587,7 @@ [[stage(fragment)]] fn main() { textureDimensions(myTexture); })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } } @@ -620,7 +620,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = uniforms.pos; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -635,7 +635,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = uniforms.pos; })"); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } @@ -650,7 +650,7 @@ [[stage(fragment)]] fn main() { var pos : vec4<f32> = uniforms.pos; })"); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get())); } } @@ -762,7 +762,7 @@ descriptor.vertex.module = vsModule4; descriptor.cFragment.module = fsModule4; wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), bgl4.Get())); } @@ -771,7 +771,7 @@ descriptor.vertex.module = vsModule64; descriptor.cFragment.module = fsModule4; wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), bgl64.Get())); } @@ -780,7 +780,7 @@ descriptor.vertex.module = vsModule4; descriptor.cFragment.module = fsModule64; wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), bgl64.Get())); } } @@ -834,7 +834,7 @@ wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); binding.visibility = wgpu::ShaderStage::Vertex; - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get())); } @@ -845,7 +845,7 @@ wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); binding.visibility = wgpu::ShaderStage::Fragment; - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get())); } @@ -856,7 +856,7 @@ wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); binding.visibility = wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Vertex; - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), device.CreateBindGroupLayout(&desc).Get())); } } @@ -1005,13 +1005,13 @@ wgpu::BindGroupLayout emptyBindGroupLayout = device.CreateBindGroupLayout(&desc); - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(0).Get(), emptyBindGroupLayout.Get())); // Used - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(1).Get(), emptyBindGroupLayout.Get())); // Not Used. - EXPECT_FALSE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_FALSE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(2).Get(), emptyBindGroupLayout.Get())); // Used. - EXPECT_TRUE(dawn_native::BindGroupLayoutBindingsEqualForTesting( + EXPECT_TRUE(dawn::native::BindGroupLayoutBindingsEqualForTesting( pipeline.GetBindGroupLayout(3).Get(), emptyBindGroupLayout.Get())); // Not used }
diff --git a/src/tests/unittests/validation/LabelTests.cpp b/src/tests/unittests/validation/LabelTests.cpp index f8fd3b6..f05d0e1 100644 --- a/src/tests/unittests/validation/LabelTests.cpp +++ b/src/tests/unittests/validation/LabelTests.cpp
@@ -33,7 +33,7 @@ // The label should be empty if one was not set. { wgpu::BindGroup bindGroup = device.CreateBindGroup(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroup.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroup.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -41,7 +41,7 @@ { wgpu::BindGroup bindGroup = device.CreateBindGroup(&descriptor); bindGroup.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroup.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroup.Get()); ASSERT_EQ(label, readbackLabel); } @@ -49,7 +49,7 @@ { descriptor.label = label.c_str(); wgpu::BindGroup bindGroup = device.CreateBindGroup(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroup.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroup.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -65,7 +65,7 @@ // The label should be empty if one was not set. { wgpu::BindGroupLayout bindGroupLayout = device.CreateBindGroupLayout(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroupLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroupLayout.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -73,7 +73,7 @@ { wgpu::BindGroupLayout bindGroupLayout = device.CreateBindGroupLayout(&descriptor); bindGroupLayout.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroupLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroupLayout.Get()); ASSERT_EQ(label, readbackLabel); } @@ -81,7 +81,7 @@ { descriptor.label = label.c_str(); wgpu::BindGroupLayout bindGroupLayout = device.CreateBindGroupLayout(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(bindGroupLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(bindGroupLayout.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -96,7 +96,7 @@ // The label should be empty if one was not set. { wgpu::Buffer buffer = device.CreateBuffer(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(buffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(buffer.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -104,7 +104,7 @@ { wgpu::Buffer buffer = device.CreateBuffer(&descriptor); buffer.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(buffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(buffer.Get()); ASSERT_EQ(label, readbackLabel); } @@ -112,7 +112,7 @@ { descriptor.label = label.c_str(); wgpu::Buffer buffer = device.CreateBuffer(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(buffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(buffer.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -126,7 +126,7 @@ { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandBuffer commandBuffer = encoder.Finish(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(commandBuffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(commandBuffer.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -135,7 +135,7 @@ wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandBuffer commandBuffer = encoder.Finish(&descriptor); commandBuffer.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(commandBuffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(commandBuffer.Get()); ASSERT_EQ(label, readbackLabel); } @@ -144,7 +144,7 @@ descriptor.label = label.c_str(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandBuffer commandBuffer = encoder.Finish(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(commandBuffer.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(commandBuffer.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -157,7 +157,7 @@ // The label should be empty if one was not set. { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -165,7 +165,7 @@ { wgpu::CommandEncoder encoder = device.CreateCommandEncoder(&descriptor); encoder.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); } @@ -173,7 +173,7 @@ { descriptor.label = label.c_str(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -188,7 +188,7 @@ // The label should be empty if one was not set. { wgpu::ComputePassEncoder encoder = commandEncoder.BeginComputePass(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_TRUE(readbackLabel.empty()); encoder.EndPass(); } @@ -197,7 +197,7 @@ { wgpu::ComputePassEncoder encoder = commandEncoder.BeginComputePass(&descriptor); encoder.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); encoder.EndPass(); } @@ -206,7 +206,7 @@ { descriptor.label = label.c_str(); wgpu::ComputePassEncoder encoder = commandEncoder.BeginComputePass(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); encoder.EndPass(); } @@ -234,7 +234,7 @@ // The label should be empty if one was not set. { wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(externalTexture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(externalTexture.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -242,7 +242,7 @@ { wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&descriptor); externalTexture.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(externalTexture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(externalTexture.Get()); ASSERT_EQ(label, readbackLabel); } @@ -250,7 +250,7 @@ { descriptor.label = label.c_str(); wgpu::ExternalTexture externalTexture = device.CreateExternalTexture(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(externalTexture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(externalTexture.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -267,7 +267,7 @@ // The label should be empty if one was not set. { wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipelineLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipelineLayout.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -275,7 +275,7 @@ { wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor); pipelineLayout.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipelineLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipelineLayout.Get()); ASSERT_EQ(label, readbackLabel); } @@ -283,7 +283,7 @@ { descriptor.label = label.c_str(); wgpu::PipelineLayout pipelineLayout = device.CreatePipelineLayout(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipelineLayout.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipelineLayout.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -298,7 +298,7 @@ // The label should be empty if one was not set. { wgpu::QuerySet querySet = device.CreateQuerySet(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(querySet.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(querySet.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -306,7 +306,7 @@ { wgpu::QuerySet querySet = device.CreateQuerySet(&descriptor); querySet.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(querySet.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(querySet.Get()); ASSERT_EQ(label, readbackLabel); } @@ -314,7 +314,7 @@ { descriptor.label = label.c_str(); wgpu::QuerySet querySet = device.CreateQuerySet(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(querySet.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(querySet.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -330,7 +330,7 @@ // The label should be empty if one was not set. { wgpu::RenderBundleEncoder encoder = device.CreateRenderBundleEncoder(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -338,7 +338,7 @@ { wgpu::RenderBundleEncoder encoder = device.CreateRenderBundleEncoder(&descriptor); encoder.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); } @@ -346,7 +346,7 @@ { descriptor.label = label.c_str(); wgpu::RenderBundleEncoder encoder = device.CreateRenderBundleEncoder(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -367,7 +367,7 @@ // The label should be empty if one was not set. { wgpu::RenderPassEncoder encoder = commandEncoder.BeginRenderPass(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_TRUE(readbackLabel.empty()); encoder.EndPass(); } @@ -376,7 +376,7 @@ { wgpu::RenderPassEncoder encoder = commandEncoder.BeginRenderPass(&descriptor); encoder.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); encoder.EndPass(); } @@ -385,7 +385,7 @@ { descriptor.label = label.c_str(); wgpu::RenderPassEncoder encoder = commandEncoder.BeginRenderPass(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(encoder.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(encoder.Get()); ASSERT_EQ(label, readbackLabel); encoder.EndPass(); } @@ -399,7 +399,7 @@ // The label should be empty if one was not set. { wgpu::Sampler sampler = device.CreateSampler(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(sampler.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(sampler.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -407,7 +407,7 @@ { wgpu::Sampler sampler = device.CreateSampler(&descriptor); sampler.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(sampler.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(sampler.Get()); ASSERT_EQ(label, readbackLabel); } @@ -415,7 +415,7 @@ { descriptor.label = label.c_str(); wgpu::Sampler sampler = device.CreateSampler(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(sampler.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(sampler.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -436,7 +436,7 @@ // The label should be empty if one was not set. { wgpu::Texture texture = device.CreateTexture(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(texture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(texture.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -444,7 +444,7 @@ { wgpu::Texture texture = device.CreateTexture(&descriptor); texture.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(texture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(texture.Get()); ASSERT_EQ(label, readbackLabel); } @@ -452,7 +452,7 @@ { descriptor.label = label.c_str(); wgpu::Texture texture = device.CreateTexture(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(texture.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(texture.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -475,7 +475,7 @@ // The label should be empty if one was not set. { wgpu::TextureView textureView = texture.CreateView(); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(textureView.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(textureView.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -483,7 +483,7 @@ { wgpu::TextureView textureView = texture.CreateView(); textureView.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(textureView.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(textureView.Get()); ASSERT_EQ(label, readbackLabel); } @@ -492,7 +492,7 @@ wgpu::TextureViewDescriptor viewDescriptor; viewDescriptor.label = label.c_str(); wgpu::TextureView textureView = texture.CreateView(&viewDescriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(textureView.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(textureView.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -518,7 +518,7 @@ // The label should be empty if one was not set. { wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -526,7 +526,7 @@ { wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); pipeline.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_EQ(label, readbackLabel); } @@ -534,7 +534,7 @@ { descriptor.label = label.c_str(); wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -555,7 +555,7 @@ // The label should be empty if one was not set. { wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -563,7 +563,7 @@ { wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); pipeline.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_EQ(label, readbackLabel); } @@ -571,7 +571,7 @@ { descriptor.label = label.c_str(); wgpu::ComputePipeline pipeline = device.CreateComputePipeline(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(pipeline.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(pipeline.Get()); ASSERT_EQ(label, readbackLabel); } } @@ -592,7 +592,7 @@ // The label should be empty if one was not set. { wgpu::ShaderModule shaderModule = device.CreateShaderModule(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(shaderModule.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(shaderModule.Get()); ASSERT_TRUE(readbackLabel.empty()); } @@ -600,7 +600,7 @@ { wgpu::ShaderModule shaderModule = device.CreateShaderModule(&descriptor); shaderModule.SetLabel(label.c_str()); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(shaderModule.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(shaderModule.Get()); ASSERT_EQ(label, readbackLabel); } @@ -608,7 +608,7 @@ { descriptor.label = label.c_str(); wgpu::ShaderModule shaderModule = device.CreateShaderModule(&descriptor); - std::string readbackLabel = dawn_native::GetObjectLabelForTesting(shaderModule.Get()); + std::string readbackLabel = dawn::native::GetObjectLabelForTesting(shaderModule.Get()); ASSERT_EQ(label, readbackLabel); } } \ No newline at end of file
diff --git a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp index 4ff0edb..e0da854 100644 --- a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp
@@ -158,7 +158,7 @@ // Tests that shader module compilation messages can be queried. TEST_F(ShaderModuleValidationTest, GetCompilationMessages) { - // This test works assuming ShaderModule is backed by a dawn_native::ShaderModuleBase, which + // This test works assuming ShaderModule is backed by a dawn::native::ShaderModuleBase, which // is not the case on the wire. DAWN_SKIP_TEST_IF(UsesWire()); @@ -167,8 +167,8 @@ return vec4<f32>(0.0, 1.0, 0.0, 1.0); })"); - dawn_native::ShaderModuleBase* shaderModuleBase = dawn_native::FromAPI(shaderModule.Get()); - dawn_native::OwnedCompilationMessages* messages = shaderModuleBase->GetCompilationMessages(); + dawn::native::ShaderModuleBase* shaderModuleBase = dawn::native::FromAPI(shaderModule.Get()); + dawn::native::OwnedCompilationMessages* messages = shaderModuleBase->GetCompilationMessages(); messages->ClearMessages(); messages->AddMessageForTesting("Info Message"); messages->AddMessageForTesting("Warning Message", wgpu::CompilationMessageType::Warning);
diff --git a/src/tests/unittests/validation/ToggleValidationTests.cpp b/src/tests/unittests/validation/ToggleValidationTests.cpp index 9a8b22a..4e32af7 100644 --- a/src/tests/unittests/validation/ToggleValidationTests.cpp +++ b/src/tests/unittests/validation/ToggleValidationTests.cpp
@@ -18,12 +18,12 @@ class ToggleValidationTest : public ValidationTest {}; - // Tests querying the detail of a toggle from dawn_native::InstanceBase works correctly. + // Tests querying the detail of a toggle from dawn::native::InstanceBase works correctly. TEST_F(ToggleValidationTest, QueryToggleInfo) { // Query with a valid toggle name { const char* kValidToggleName = "emulate_store_and_msaa_resolve"; - const dawn_native::ToggleInfo* toggleInfo = instance->GetToggleInfo(kValidToggleName); + const dawn::native::ToggleInfo* toggleInfo = instance->GetToggleInfo(kValidToggleName); ASSERT_NE(nullptr, toggleInfo); ASSERT_NE(nullptr, toggleInfo->name); ASSERT_NE(nullptr, toggleInfo->description); @@ -33,7 +33,8 @@ // Query with an invalid toggle name { const char* kInvalidToggleName = "!@#$%^&*"; - const dawn_native::ToggleInfo* toggleInfo = instance->GetToggleInfo(kInvalidToggleName); + const dawn::native::ToggleInfo* toggleInfo = + instance->GetToggleInfo(kInvalidToggleName); ASSERT_EQ(nullptr, toggleInfo); } } @@ -50,7 +51,7 @@ togglesDesc.forceEnabledTogglesCount = 1; WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector<const char*> toggleNames = dawn_native::GetTogglesUsed(deviceWithToggle); + std::vector<const char*> toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); bool validToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kValidToggleName) == 0) { @@ -70,7 +71,7 @@ togglesDesc.forceEnabledTogglesCount = 1; WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector<const char*> toggleNames = dawn_native::GetTogglesUsed(deviceWithToggle); + std::vector<const char*> toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); bool InvalidToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kInvalidToggleName) == 0) { @@ -90,7 +91,7 @@ togglesDesc.forceEnabledTogglesCount = 1; WGPUDevice deviceWithToggle = adapter.CreateDevice(&descriptor); - std::vector<const char*> toggleNames = dawn_native::GetTogglesUsed(deviceWithToggle); + std::vector<const char*> toggleNames = dawn::native::GetTogglesUsed(deviceWithToggle); bool validToggleExists = false; for (const char* toggle : toggleNames) { if (strcmp(toggle, kValidToggleName) == 0) {
diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index f7bb69b..4bbe6f2 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp
@@ -83,10 +83,10 @@ } void ValidationTest::SetUp() { - instance = std::make_unique<dawn_native::Instance>(); + instance = std::make_unique<dawn::native::Instance>(); instance->DiscoverDefaultAdapters(); - std::vector<dawn_native::Adapter> adapters = instance->GetAdapters(); + std::vector<dawn::native::Adapter> adapters = instance->GetAdapters(); // Validation tests run against the null backend, find the corresponding adapter bool foundNullAdapter = false; @@ -125,7 +125,7 @@ if (device) { EXPECT_EQ(mLastWarningCount, - dawn_native::GetDeprecationWarningCountForTesting(backendDevice)); + dawn::native::GetDeprecationWarningCountForTesting(backendDevice)); } } @@ -180,7 +180,7 @@ } bool ValidationTest::HasToggleEnabled(const char* toggle) const { - auto toggles = dawn_native::GetTogglesUsed(backendDevice); + auto toggles = dawn::native::GetTogglesUsed(backendDevice); return std::find_if(toggles.begin(), toggles.end(), [toggle](const char* name) { return strcmp(toggle, name) == 0; }) != toggles.end(); @@ -189,7 +189,7 @@ wgpu::SupportedLimits ValidationTest::GetSupportedLimits() { WGPUSupportedLimits supportedLimits; supportedLimits.nextInChain = nullptr; - dawn_native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); + dawn::native::GetProcs().deviceGetLimits(backendDevice, &supportedLimits); return *reinterpret_cast<wgpu::SupportedLimits*>(&supportedLimits); }
diff --git a/src/tests/unittests/validation/ValidationTest.h b/src/tests/unittests/validation/ValidationTest.h index 4550b42..8a8e9f6 100644 --- a/src/tests/unittests/validation/ValidationTest.h +++ b/src/tests/unittests/validation/ValidationTest.h
@@ -72,16 +72,16 @@ } \ } while (0) -#define EXPECT_DEPRECATION_WARNINGS(statement, n) \ - do { \ - FlushWire(); \ - size_t warningsBefore = dawn_native::GetDeprecationWarningCountForTesting(backendDevice); \ - EXPECT_EQ(mLastWarningCount, warningsBefore); \ - statement; \ - FlushWire(); \ - size_t warningsAfter = dawn_native::GetDeprecationWarningCountForTesting(backendDevice); \ - EXPECT_EQ(warningsAfter, warningsBefore + n); \ - mLastWarningCount = warningsAfter; \ +#define EXPECT_DEPRECATION_WARNINGS(statement, n) \ + do { \ + FlushWire(); \ + size_t warningsBefore = dawn::native::GetDeprecationWarningCountForTesting(backendDevice); \ + EXPECT_EQ(mLastWarningCount, warningsBefore); \ + statement; \ + FlushWire(); \ + size_t warningsAfter = dawn::native::GetDeprecationWarningCountForTesting(backendDevice); \ + EXPECT_EQ(warningsAfter, warningsBefore + n); \ + mLastWarningCount = warningsAfter; \ } while (0) #define EXPECT_DEPRECATION_WARNING(statement) EXPECT_DEPRECATION_WARNINGS(statement, 1) @@ -135,8 +135,8 @@ protected: virtual WGPUDevice CreateTestDevice(); - std::unique_ptr<dawn_native::Instance> instance; - dawn_native::Adapter adapter; + std::unique_ptr<dawn::native::Instance> instance; + dawn::native::Adapter adapter; wgpu::Device device; WGPUDevice backendDevice;
diff --git a/src/tests/white_box/BufferAllocatedSizeTests.cpp b/src/tests/white_box/BufferAllocatedSizeTests.cpp index 15c1437..e100dc7 100644 --- a/src/tests/white_box/BufferAllocatedSizeTests.cpp +++ b/src/tests/white_box/BufferAllocatedSizeTests.cpp
@@ -53,7 +53,7 @@ { const uint32_t bufferSize = kMinBufferSize; wgpu::Buffer buffer = CreateBuffer(wgpu::BufferUsage::Uniform, bufferSize); - EXPECT_EQ(dawn_native::GetAllocatedSizeForTesting(buffer.Get()), + EXPECT_EQ(dawn::native::GetAllocatedSizeForTesting(buffer.Get()), Align(bufferSize, requiredBufferAlignment)); } @@ -63,7 +63,7 @@ const uint32_t bufferSize = std::max(1u + requiredBufferAlignment, kMinBufferSize); wgpu::Buffer buffer = CreateBuffer(wgpu::BufferUsage::Uniform | wgpu::BufferUsage::Storage, bufferSize); - EXPECT_EQ(dawn_native::GetAllocatedSizeForTesting(buffer.Get()), + EXPECT_EQ(dawn::native::GetAllocatedSizeForTesting(buffer.Get()), Align(bufferSize, requiredBufferAlignment)); } @@ -72,7 +72,7 @@ const uint32_t bufferSize = kMinBufferSize; wgpu::Buffer buffer = CreateBuffer(wgpu::BufferUsage::Uniform | wgpu::BufferUsage::Storage, bufferSize); - EXPECT_EQ(dawn_native::GetAllocatedSizeForTesting(buffer.Get()), + EXPECT_EQ(dawn::native::GetAllocatedSizeForTesting(buffer.Get()), Align(bufferSize, requiredBufferAlignment)); } }
diff --git a/src/tests/white_box/D3D12DescriptorHeapTests.cpp b/src/tests/white_box/D3D12DescriptorHeapTests.cpp index 14bf526..3ea6ab8 100644 --- a/src/tests/white_box/D3D12DescriptorHeapTests.cpp +++ b/src/tests/white_box/D3D12DescriptorHeapTests.cpp
@@ -30,7 +30,7 @@ // should be updated if the internals of Tick() change. constexpr uint32_t kFrameDepth = 2; -using namespace dawn_native::d3d12; +using namespace dawn::native::d3d12; class D3D12DescriptorHeapTests : public DawnTest { protected: @@ -108,7 +108,7 @@ } CPUDescriptorHeapAllocation AllocateCPUDescriptors() { - dawn_native::ResultOrError<CPUDescriptorHeapAllocation> result = + dawn::native::ResultOrError<CPUDescriptorHeapAllocation> result = mAllocator.AllocateCPUDescriptors(); return (result.IsSuccess()) ? result.AcquireSuccess() : CPUDescriptorHeapAllocation{}; } @@ -124,7 +124,7 @@ // Verify the shader visible view heaps switch over within a single submit. TEST_P(D3D12DescriptorHeapTests, SwitchOverViewHeap) { DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); utils::ComboRenderPipelineDescriptor renderPipelineDescriptor; @@ -224,7 +224,7 @@ TEST_P(D3D12DescriptorHeapTests, PoolHeapsInMultipleSubmits) { // Use small heaps to count only pool-allocated switches. DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); ShaderVisibleDescriptorAllocator* allocator = mD3DDevice->GetSamplerShaderVisibleDescriptorAllocator(); @@ -265,7 +265,7 @@ TEST_P(D3D12DescriptorHeapTests, PoolHeapsInPendingSubmit) { // Use small heaps to count only pool-allocated switches. DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); constexpr uint32_t kNumOfSwitches = 5; @@ -297,7 +297,7 @@ TEST_P(D3D12DescriptorHeapTests, PoolHeapsInPendingAndMultipleSubmits) { // Use small heaps to count only pool-allocated switches. DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); constexpr uint32_t kNumOfSwitches = 5; @@ -435,7 +435,7 @@ // the result is the arithmetic sum of the sequence after the framebuffer is blended by // accumulation. By checking for this sum, we ensure each bindgroup was encoded correctly. DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); utils::BasicRenderPass renderPass = MakeRenderPass(kRTSize, kRTSize, wgpu::TextureFormat::R16Float); @@ -509,7 +509,7 @@ // descriptors. TEST_P(D3D12DescriptorHeapTests, EncodeUBOOverflowMultipleSubmit) { DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); // TODO(crbug.com/dawn/742): Test output is wrong with D3D12 + WARP. DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsWARP()); @@ -597,7 +597,7 @@ // in the heap. TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOOverflow) { DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); @@ -658,7 +658,7 @@ // first descriptor at the same offset in the heap. TEST_P(D3D12DescriptorHeapTests, EncodeReuseUBOMultipleSubmits) { DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize); @@ -738,7 +738,7 @@ // Shader-visible heaps should switch out |kNumOfViewHeaps| times. TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) { DAWN_TEST_UNSUPPORTED_IF(!mD3DDevice->IsToggleEnabled( - dawn_native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); + dawn::native::Toggle::UseD3D12SmallShaderVisibleHeapForTesting)); // Create a solid filled texture. wgpu::TextureDescriptor descriptor;
diff --git a/src/tests/white_box/D3D12ResidencyTests.cpp b/src/tests/white_box/D3D12ResidencyTests.cpp index 6622db1..f8812e3 100644 --- a/src/tests/white_box/D3D12ResidencyTests.cpp +++ b/src/tests/white_box/D3D12ResidencyTests.cpp
@@ -41,8 +41,8 @@ DAWN_TEST_UNSUPPORTED_IF(UsesWire()); // Restrict Dawn's budget to create an artificial budget. - dawn_native::d3d12::Device* d3dDevice = - dawn_native::d3d12::ToBackend(dawn_native::FromAPI((device.Get()))); + dawn::native::d3d12::Device* d3dDevice = + dawn::native::d3d12::ToBackend(dawn::native::FromAPI((device.Get()))); d3dDevice->GetResidencyManager()->RestrictBudgetForTesting(kRestrictedBudgetSize); // Initialize a source buffer on the GPU to serve as a source to quickly copy data to other @@ -92,20 +92,20 @@ class D3D12ResourceResidencyTests : public D3D12ResidencyTestBase { protected: bool CheckAllocationMethod(wgpu::Buffer buffer, - dawn_native::AllocationMethod allocationMethod) const { - dawn_native::d3d12::Buffer* d3dBuffer = - dawn_native::d3d12::ToBackend(dawn_native::FromAPI((buffer.Get()))); + dawn::native::AllocationMethod allocationMethod) const { + dawn::native::d3d12::Buffer* d3dBuffer = + dawn::native::d3d12::ToBackend(dawn::native::FromAPI((buffer.Get()))); return d3dBuffer->CheckAllocationMethodForTesting(allocationMethod); } bool CheckIfBufferIsResident(wgpu::Buffer buffer) const { - dawn_native::d3d12::Buffer* d3dBuffer = - dawn_native::d3d12::ToBackend(dawn_native::FromAPI((buffer.Get()))); + dawn::native::d3d12::Buffer* d3dBuffer = + dawn::native::d3d12::ToBackend(dawn::native::FromAPI((buffer.Get()))); return d3dBuffer->CheckIsResidentForTesting(); } bool IsUMA() const { - return dawn_native::d3d12::ToBackend(dawn_native::FromAPI(device.Get())) + return dawn::native::d3d12::ToBackend(dawn::native::FromAPI(device.Get())) ->GetDeviceInfo() .isUMA; } @@ -128,7 +128,7 @@ for (uint32_t i = 0; i < bufferSet1.size(); i++) { EXPECT_TRUE(CheckIfBufferIsResident(bufferSet1[i])); EXPECT_TRUE( - CheckAllocationMethod(bufferSet1[i], dawn_native::AllocationMethod::kSubAllocated)); + CheckAllocationMethod(bufferSet1[i], dawn::native::AllocationMethod::kSubAllocated)); } // Create enough directly-allocated buffers to use the entire budget. @@ -166,7 +166,7 @@ // allocated internally. for (uint32_t i = 0; i < bufferSet1.size(); i++) { EXPECT_TRUE(CheckIfBufferIsResident(bufferSet1[i])); - EXPECT_TRUE(CheckAllocationMethod(bufferSet1[i], dawn_native::AllocationMethod::kDirect)); + EXPECT_TRUE(CheckAllocationMethod(bufferSet1[i], dawn::native::AllocationMethod::kDirect)); } // Create enough directly-allocated buffers to use the entire budget. @@ -317,14 +317,14 @@ TEST_P(D3D12ResourceResidencyTests, SetExternalReservation) { // Set an external reservation of 20% the budget. We should succesfully reserve the amount we // request. - uint64_t amountReserved = dawn_native::d3d12::SetExternalMemoryReservation( - device.Get(), kRestrictedBudgetSize * .2, dawn_native::d3d12::MemorySegment::Local); + uint64_t amountReserved = dawn::native::d3d12::SetExternalMemoryReservation( + device.Get(), kRestrictedBudgetSize * .2, dawn::native::d3d12::MemorySegment::Local); EXPECT_EQ(amountReserved, kRestrictedBudgetSize * .2); // If we're on a non-UMA device, we should also check the NON_LOCAL memory segment. if (!IsUMA()) { - amountReserved = dawn_native::d3d12::SetExternalMemoryReservation( - device.Get(), kRestrictedBudgetSize * .2, dawn_native::d3d12::MemorySegment::NonLocal); + amountReserved = dawn::native::d3d12::SetExternalMemoryReservation( + device.Get(), kRestrictedBudgetSize * .2, dawn::native::d3d12::MemorySegment::NonLocal); EXPECT_EQ(amountReserved, kRestrictedBudgetSize * .2); } } @@ -368,14 +368,14 @@ wgpu::Sampler sampler = device.CreateSampler(); - dawn_native::d3d12::Device* d3dDevice = - dawn_native::d3d12::ToBackend(dawn_native::FromAPI(device.Get())); + dawn::native::d3d12::Device* d3dDevice = + dawn::native::d3d12::ToBackend(dawn::native::FromAPI(device.Get())); - dawn_native::d3d12::ShaderVisibleDescriptorAllocator* allocator = + dawn::native::d3d12::ShaderVisibleDescriptorAllocator* allocator = d3dDevice->GetViewShaderVisibleDescriptorAllocator(); const uint64_t heapSize = allocator->GetShaderVisibleHeapSizeForTesting(); - const dawn_native::d3d12::HeapVersionID heapSerial = + const dawn::native::d3d12::HeapVersionID heapSerial = allocator->GetShaderVisibleHeapSerialForTesting(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); @@ -402,7 +402,7 @@ // Check the heap serial to ensure the heap has switched. EXPECT_EQ(allocator->GetShaderVisibleHeapSerialForTesting(), - heapSerial + dawn_native::d3d12::HeapVersionID(1)); + heapSerial + dawn::native::d3d12::HeapVersionID(1)); // Check that currrently bound ShaderVisibleHeap is locked resident. EXPECT_TRUE(allocator->IsShaderVisibleHeapLockedResidentForTesting());
diff --git a/src/tests/white_box/D3D12ResourceHeapTests.cpp b/src/tests/white_box/D3D12ResourceHeapTests.cpp index 8f1155b..f68c12f 100644 --- a/src/tests/white_box/D3D12ResourceHeapTests.cpp +++ b/src/tests/white_box/D3D12ResourceHeapTests.cpp
@@ -17,7 +17,7 @@ #include "dawn_native/d3d12/BufferD3D12.h" #include "dawn_native/d3d12/TextureD3D12.h" -using namespace dawn_native::d3d12; +using namespace dawn::native::d3d12; class D3D12ResourceHeapTests : public DawnTest { protected:
diff --git a/src/tests/white_box/EGLImageWrappingTests.cpp b/src/tests/white_box/EGLImageWrappingTests.cpp index 7d7d71c..7fb5fa6 100644 --- a/src/tests/white_box/EGLImageWrappingTests.cpp +++ b/src/tests/white_box/EGLImageWrappingTests.cpp
@@ -127,9 +127,9 @@ GLenum type, void* data, size_t size) { - dawn_native::opengl::Device* openglDevice = - dawn_native::opengl::ToBackend(dawn_native::FromAPI(device.Get())); - const dawn_native::opengl::OpenGLFunctions& gl = openglDevice->gl; + dawn::native::opengl::Device* openglDevice = + dawn::native::opengl::ToBackend(dawn::native::FromAPI(device.Get())); + const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->gl; GLuint tex; gl.GenTextures(1, &tex); gl.BindTexture(GL_TEXTURE_2D, tex); @@ -144,10 +144,10 @@ return ScopedEGLImage(egl.DestroyImage, gl.DeleteTextures, dpy, eglImage, tex); } wgpu::Texture WrapEGLImage(const wgpu::TextureDescriptor* descriptor, EGLImage eglImage) { - dawn_native::opengl::ExternalImageDescriptorEGLImage externDesc; + dawn::native::opengl::ExternalImageDescriptorEGLImage externDesc; externDesc.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(descriptor); externDesc.image = eglImage; - WGPUTexture texture = dawn_native::opengl::WrapExternalEGLImage(device.Get(), &externDesc); + WGPUTexture texture = dawn::native::opengl::WrapExternalEGLImage(device.Get(), &externDesc); return wgpu::Texture::Acquire(texture); } EGLFunctions egl; @@ -299,9 +299,9 @@ GLenum glType, void* data, size_t dataSize) { - dawn_native::opengl::Device* openglDevice = - dawn_native::opengl::ToBackend(dawn_native::FromAPI(device.Get())); - const dawn_native::opengl::OpenGLFunctions& gl = openglDevice->gl; + dawn::native::opengl::Device* openglDevice = + dawn::native::opengl::ToBackend(dawn::native::FromAPI(device.Get())); + const dawn::native::opengl::OpenGLFunctions& gl = openglDevice->gl; // Get a texture view for the eglImage wgpu::TextureDescriptor textureDescriptor;
diff --git a/src/tests/white_box/InternalResourceUsageTests.cpp b/src/tests/white_box/InternalResourceUsageTests.cpp index a260fe5..db61b9c 100644 --- a/src/tests/white_box/InternalResourceUsageTests.cpp +++ b/src/tests/white_box/InternalResourceUsageTests.cpp
@@ -32,9 +32,9 @@ TEST_P(InternalResourceUsageTests, InternalBufferUsage) { DAWN_TEST_UNSUPPORTED_IF(HasToggleEnabled("skip_validation")); - ASSERT_DEVICE_ERROR(CreateBuffer(dawn_native::kReadOnlyStorageBuffer)); + ASSERT_DEVICE_ERROR(CreateBuffer(dawn::native::kReadOnlyStorageBuffer)); - ASSERT_DEVICE_ERROR(CreateBuffer(dawn_native::kInternalStorageBuffer)); + ASSERT_DEVICE_ERROR(CreateBuffer(dawn::native::kInternalStorageBuffer)); } DAWN_INSTANTIATE_TEST(InternalResourceUsageTests, NullBackend()); @@ -48,7 +48,7 @@ wgpu::BindGroupLayoutEntry bglEntry; bglEntry.binding = 0; - bglEntry.buffer.type = dawn_native::kInternalStorageBufferBinding; + bglEntry.buffer.type = dawn::native::kInternalStorageBufferBinding; bglEntry.visibility = wgpu::ShaderStage::Compute; wgpu::BindGroupLayoutDescriptor bglDesc;
diff --git a/src/tests/white_box/InternalStorageBufferBindingTests.cpp b/src/tests/white_box/InternalStorageBufferBindingTests.cpp index 8ee4f1a..745278a 100644 --- a/src/tests/white_box/InternalStorageBufferBindingTests.cpp +++ b/src/tests/white_box/InternalStorageBufferBindingTests.cpp
@@ -44,22 +44,22 @@ )"); // Create binding group layout with internal storage buffer binding type - dawn_native::BindGroupLayoutEntry bglEntry; + dawn::native::BindGroupLayoutEntry bglEntry; bglEntry.binding = 0; - bglEntry.buffer.type = dawn_native::kInternalStorageBufferBinding; + bglEntry.buffer.type = dawn::native::kInternalStorageBufferBinding; bglEntry.visibility = wgpu::ShaderStage::Compute; - dawn_native::BindGroupLayoutDescriptor bglDesc; + dawn::native::BindGroupLayoutDescriptor bglDesc; bglDesc.entryCount = 1; bglDesc.entries = &bglEntry; - dawn_native::DeviceBase* nativeDevice = dawn_native::FromAPI(device.Get()); + dawn::native::DeviceBase* nativeDevice = dawn::native::FromAPI(device.Get()); - Ref<dawn_native::BindGroupLayoutBase> bglRef = + Ref<dawn::native::BindGroupLayoutBase> bglRef = nativeDevice->CreateBindGroupLayout(&bglDesc, true).AcquireSuccess(); wgpu::BindGroupLayout bgl = - wgpu::BindGroupLayout::Acquire(dawn_native::ToAPI(bglRef.Detach())); + wgpu::BindGroupLayout::Acquire(dawn::native::ToAPI(bglRef.Detach())); // Create pipeline layout wgpu::PipelineLayoutDescriptor plDesc;
diff --git a/src/tests/white_box/MetalAutoreleasePoolTests.mm b/src/tests/white_box/MetalAutoreleasePoolTests.mm index 1202307..3a741d5 100644 --- a/src/tests/white_box/MetalAutoreleasePoolTests.mm +++ b/src/tests/white_box/MetalAutoreleasePoolTests.mm
@@ -16,7 +16,7 @@ #include "dawn_native/metal/DeviceMTL.h" -using namespace dawn_native::metal; +using namespace dawn::native::metal; class MetalAutoreleasePoolTests : public DawnTest { private:
diff --git a/src/tests/white_box/QueryInternalShaderTests.cpp b/src/tests/white_box/QueryInternalShaderTests.cpp index 58d6a37..5217998 100644 --- a/src/tests/white_box/QueryInternalShaderTests.cpp +++ b/src/tests/white_box/QueryInternalShaderTests.cpp
@@ -25,11 +25,11 @@ wgpu::Buffer timestamps, wgpu::Buffer availability, wgpu::Buffer params) { - ASSERT_TRUE(dawn_native::EncodeConvertTimestampsToNanoseconds( - dawn_native::FromAPI(encoder.Get()), dawn_native::FromAPI(timestamps.Get()), - dawn_native::FromAPI(availability.Get()), - dawn_native::FromAPI(params.Get())) - .IsSuccess()); + ASSERT_TRUE( + dawn::native::EncodeConvertTimestampsToNanoseconds( + dawn::native::FromAPI(encoder.Get()), dawn::native::FromAPI(timestamps.Get()), + dawn::native::FromAPI(availability.Get()), dawn::native::FromAPI(params.Get())) + .IsSuccess()); } class InternalShaderExpectation : public detail::Expectation { @@ -147,7 +147,7 @@ kQueryCount * sizeof(uint32_t), wgpu::BufferUsage::Storage); // The params uniform buffer - dawn_native::TimestampParams params = {firstQuery, queryCount, destinationOffset, kPeriod}; + dawn::native::TimestampParams params = {firstQuery, queryCount, destinationOffset, kPeriod}; wgpu::Buffer paramsBuffer = utils::CreateBufferFromData(device, ¶ms, sizeof(params), wgpu::BufferUsage::Uniform);
diff --git a/src/tests/white_box/VulkanErrorInjectorTests.cpp b/src/tests/white_box/VulkanErrorInjectorTests.cpp index 2f3e33b..e442279 100644 --- a/src/tests/white_box/VulkanErrorInjectorTests.cpp +++ b/src/tests/white_box/VulkanErrorInjectorTests.cpp
@@ -29,11 +29,11 @@ DawnTest::SetUp(); DAWN_TEST_UNSUPPORTED_IF(UsesWire()); - mDeviceVk = dawn_native::vulkan::ToBackend(dawn_native::FromAPI(device.Get())); + mDeviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get())); } protected: - dawn_native::vulkan::Device* mDeviceVk; + dawn::native::vulkan::Device* mDeviceVk; }; } // anonymous namespace @@ -56,7 +56,7 @@ auto CreateTestBuffer = [&]() -> bool { VkBuffer buffer = VK_NULL_HANDLE; - dawn_native::MaybeError err = CheckVkSuccess( + dawn::native::MaybeError err = CheckVkSuccess( mDeviceVk->fn.CreateBuffer(mDeviceVk->GetVkDevice(), &createInfo, nullptr, &buffer), "vkCreateBuffer"); if (err.IsError()) { @@ -78,45 +78,45 @@ EXPECT_TRUE(CreateTestBuffer()); // The error injector call count should be empty - EXPECT_EQ(dawn_native::AcquireErrorInjectorCallCount(), 0u); + EXPECT_EQ(dawn::native::AcquireErrorInjectorCallCount(), 0u); } // Test error injection works. - dawn_native::EnableErrorInjector(); + dawn::native::EnableErrorInjector(); { EXPECT_TRUE(CreateTestBuffer()); EXPECT_TRUE(CreateTestBuffer()); // The error injector call count should be two. - EXPECT_EQ(dawn_native::AcquireErrorInjectorCallCount(), 2u); + EXPECT_EQ(dawn::native::AcquireErrorInjectorCallCount(), 2u); // Inject an error at index 0. The first should fail, the second succeed. { - dawn_native::InjectErrorAt(0u); + dawn::native::InjectErrorAt(0u); EXPECT_FALSE(CreateTestBuffer()); EXPECT_TRUE(CreateTestBuffer()); - dawn_native::ClearErrorInjector(); + dawn::native::ClearErrorInjector(); } // Inject an error at index 1. The second should fail, the first succeed. { - dawn_native::InjectErrorAt(1u); + dawn::native::InjectErrorAt(1u); EXPECT_TRUE(CreateTestBuffer()); EXPECT_FALSE(CreateTestBuffer()); - dawn_native::ClearErrorInjector(); + dawn::native::ClearErrorInjector(); } // Inject an error and then clear the injector. Calls should be successful. { - dawn_native::InjectErrorAt(0u); - dawn_native::DisableErrorInjector(); + dawn::native::InjectErrorAt(0u); + dawn::native::DisableErrorInjector(); EXPECT_TRUE(CreateTestBuffer()); EXPECT_TRUE(CreateTestBuffer()); - dawn_native::ClearErrorInjector(); + dawn::native::ClearErrorInjector(); } } }
diff --git a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp index c0afd94..709e0bc 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsDmaBuf.cpp
@@ -28,7 +28,7 @@ #include <fcntl.h> #include <gbm.h> -namespace dawn_native::vulkan { +namespace dawn::native::vulkan { namespace { @@ -44,7 +44,7 @@ DAWN_TEST_UNSUPPORTED_IF(UsesWire()); gbmDevice = CreateGbmDevice(); - deviceVk = dawn_native::vulkan::ToBackend(dawn_native::FromAPI(device.Get())); + deviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get())); defaultGbmBo = CreateGbmBo(1, 1, true /* linear */); defaultStride = gbm_bo_get_stride_for_plane(defaultGbmBo, 0); @@ -116,7 +116,7 @@ std::vector<int> waitFDs, bool isInitialized = true, bool expectValid = true) { - dawn_native::vulkan::ExternalImageDescriptorDmaBuf descriptor; + dawn::native::vulkan::ExternalImageDescriptorDmaBuf descriptor; return WrapVulkanImage(dawnDevice, textureDescriptor, memoryFd, stride, drmModifier, waitFDs, descriptor.releasedOldLayout, descriptor.releasedNewLayout, isInitialized, expectValid); @@ -132,7 +132,7 @@ VkImageLayout releasedNewLayout, bool isInitialized = true, bool expectValid = true) { - dawn_native::vulkan::ExternalImageDescriptorDmaBuf descriptor; + dawn::native::vulkan::ExternalImageDescriptorDmaBuf descriptor; descriptor.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(textureDescriptor); descriptor.isInitialized = isInitialized; @@ -144,7 +144,7 @@ descriptor.releasedNewLayout = releasedNewLayout; WGPUTexture texture = - dawn_native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor); + dawn::native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor); if (expectValid) { EXPECT_NE(texture, nullptr) << "Failed to wrap image, are external memory / " @@ -160,8 +160,9 @@ // We have to export the signal before destroying the wrapped texture else it's an // assertion failure void IgnoreSignalSemaphore(wgpu::Texture wrappedTexture) { - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_GENERAL, &exportInfo); for (int handle : exportInfo.semaphoreHandles) { ASSERT_NE(handle, -1); close(handle); @@ -169,7 +170,7 @@ } protected: - dawn_native::vulkan::Device* deviceVk; + dawn::native::vulkan::Device* deviceVk; gbm_device* gbmDevice; wgpu::TextureDescriptor defaultDescriptor; gbm_bo* defaultGbmBo; @@ -267,8 +268,8 @@ ASSERT_NE(texture.Get(), nullptr); IgnoreSignalSemaphore(texture); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -280,8 +281,8 @@ wgpu::Texture texture = device.CreateTexture(&defaultDescriptor); ASSERT_NE(texture.Get(), nullptr); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -294,8 +295,8 @@ ASSERT_NE(texture.Get(), nullptr); texture.Destroy(); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -311,7 +312,7 @@ } // Create another device based on the original - backendAdapter = dawn_native::vulkan::ToBackend(deviceVk->GetAdapter()); + backendAdapter = dawn::native::vulkan::ToBackend(deviceVk->GetAdapter()); deviceDescriptor.nextInChain = &togglesDesc; togglesDesc.forceEnabledToggles = GetParam().forceEnabledWorkarounds.data(); togglesDesc.forceEnabledTogglesCount = GetParam().forceEnabledWorkarounds.size(); @@ -319,17 +320,17 @@ togglesDesc.forceDisabledTogglesCount = GetParam().forceDisabledWorkarounds.size(); secondDeviceVk = - dawn_native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); - secondDevice = wgpu::Device::Acquire(dawn_native::ToAPI(secondDeviceVk)); + dawn::native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); + secondDevice = wgpu::Device::Acquire(dawn::native::ToAPI(secondDeviceVk)); } protected: - dawn_native::vulkan::Adapter* backendAdapter; - dawn_native::DeviceDescriptor deviceDescriptor; - dawn_native::DawnTogglesDeviceDescriptor togglesDesc; + dawn::native::vulkan::Adapter* backendAdapter; + dawn::native::DeviceDescriptor deviceDescriptor; + dawn::native::DawnTogglesDeviceDescriptor togglesDesc; wgpu::Device secondDevice; - dawn_native::vulkan::Device* secondDeviceVk; + dawn::native::vulkan::Device* secondDeviceVk; // Clear a texture on a given device void ClearImage(wgpu::Device dawnDevice, @@ -382,9 +383,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on signalFd int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -410,9 +411,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on signalFd int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -440,9 +441,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on |signalFd| int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -481,9 +482,9 @@ // Clear |wrappedTexture| on |device| ClearImage(device, wrappedTexture, {5 / 255.0f, 6 / 255.0f, 7 / 255.0f, 8 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &exportInfo); // Import the image to |secondDevice|, making sure we wait on |signalFd| int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -502,10 +503,10 @@ secondDeviceWrappedTexture); // Re-import back into |device|, waiting on |secondDevice|'s signal - dawn_native::vulkan::ExternalImageExportInfoDmaBuf secondExportInfo; - dawn_native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - &secondExportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf secondExportInfo; + dawn::native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + &secondExportInfo); nextFd = gbm_bo_get_fd(defaultGbmBo); wgpu::Texture nextWrappedTexture = @@ -532,9 +533,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on |signalFd| int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -585,9 +586,9 @@ // Clear |wrappedTexture| on |device| ClearImage(device, wrappedTexture, {5 / 255.0f, 6 / 255.0f, 7 / 255.0f, 8 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |secondDevice|, making sure we wait on |signalFd| int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -616,10 +617,10 @@ secondDeviceQueue.Submit(1, &commands); // Re-import back into |device|, waiting on |secondDevice|'s signal - dawn_native::vulkan::ExternalImageExportInfoDmaBuf secondExportInfo; - dawn_native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - &secondExportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf secondExportInfo; + dawn::native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + &secondExportInfo); nextFd = gbm_bo_get_fd(defaultGbmBo); wgpu::Texture nextWrappedTexture = @@ -647,9 +648,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on |signalFd| int nextFd = gbm_bo_get_fd(defaultGbmBo); @@ -694,9 +695,9 @@ // device 1 = |device| // device 2 = |secondDevice| // Create device 3 - dawn_native::vulkan::Device* thirdDeviceVk = - dawn_native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); - wgpu::Device thirdDevice = wgpu::Device::Acquire(dawn_native::ToAPI(thirdDeviceVk)); + dawn::native::vulkan::Device* thirdDeviceVk = + dawn::native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); + wgpu::Device thirdDevice = wgpu::Device::Acquire(dawn::native::ToAPI(thirdDeviceVk)); // Make queue for device 2 and 3 wgpu::Queue secondDeviceQueue = secondDevice.GetQueue(); @@ -735,8 +736,8 @@ SimpleCopyTextureToTexture(thirdDevice, thirdDeviceQueue, wrappedTexADevice3, wrappedTexBDevice3); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfoTexBDevice3; - dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfoTexBDevice3; + dawn::native::vulkan::ExportVulkanImage( wrappedTexBDevice3.Get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfoTexBDevice3); IgnoreSignalSemaphore(wrappedTexADevice3); @@ -755,8 +756,8 @@ SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, wrappedTexBDevice2, wrappedTexCDevice2); - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfoTexCDevice2; - dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfoTexCDevice2; + dawn::native::vulkan::ExportVulkanImage( wrappedTexCDevice2.Get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfoTexCDevice2); IgnoreSignalSemaphore(wrappedTexBDevice2); @@ -845,9 +846,9 @@ wgpu::CommandBuffer commands = encoder.Finish(); secondDeviceQueue.Submit(1, &commands); } - dawn_native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoDmaBuf exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); int nextFd = gbm_bo_get_fd(gbmBo); // Import the image on |device| @@ -884,4 +885,4 @@ DAWN_INSTANTIATE_TEST(VulkanImageWrappingValidationTests, VulkanBackend()); DAWN_INSTANTIATE_TEST(VulkanImageWrappingUsageTests, VulkanBackend()); -} // namespace dawn_native::vulkan +} // namespace dawn::native::vulkan
diff --git a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp index c0923c9..cb045d5 100644 --- a/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp +++ b/src/tests/white_box/VulkanImageWrappingTestsOpaqueFD.cpp
@@ -25,7 +25,7 @@ #include "utils/SystemUtils.h" #include "utils/WGPUHelpers.h" -namespace dawn_native::vulkan { +namespace dawn::native::vulkan { namespace { @@ -40,11 +40,11 @@ DawnTest::SetUp(); DAWN_TEST_UNSUPPORTED_IF(UsesWire()); - deviceVk = dawn_native::vulkan::ToBackend(dawn_native::FromAPI(device.Get())); + deviceVk = dawn::native::vulkan::ToBackend(dawn::native::FromAPI(device.Get())); } // Creates a VkImage with external memory - ::VkResult CreateImage(dawn_native::vulkan::Device* deviceVk, + ::VkResult CreateImage(dawn::native::vulkan::Device* deviceVk, uint32_t width, uint32_t height, VkFormat format, @@ -79,7 +79,7 @@ } // Allocates memory for an image - ::VkResult AllocateMemory(dawn_native::vulkan::Device* deviceVk, + ::VkResult AllocateMemory(dawn::native::vulkan::Device* deviceVk, VkImage handle, VkDeviceMemory* allocation, VkDeviceSize* allocationSize, @@ -111,14 +111,14 @@ } // Binds memory to an image - ::VkResult BindMemory(dawn_native::vulkan::Device* deviceVk, + ::VkResult BindMemory(dawn::native::vulkan::Device* deviceVk, VkImage handle, VkDeviceMemory* memory) { return deviceVk->fn.BindImageMemory(deviceVk->GetVkDevice(), handle, *memory, 0); } // Extracts a file descriptor representing memory on a device - int GetMemoryFd(dawn_native::vulkan::Device* deviceVk, VkDeviceMemory memory) { + int GetMemoryFd(dawn::native::vulkan::Device* deviceVk, VkDeviceMemory memory) { VkMemoryGetFdInfoKHR getFdInfo; getFdInfo.sType = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR; getFdInfo.pNext = nullptr; @@ -133,7 +133,7 @@ } // Prepares and exports memory for an image on a given device - void CreateBindExportImage(dawn_native::vulkan::Device* deviceVk, + void CreateBindExportImage(dawn::native::vulkan::Device* deviceVk, uint32_t width, uint32_t height, VkFormat format, @@ -164,7 +164,7 @@ std::vector<int> waitFDs, bool isInitialized = true, bool expectValid = true) { - dawn_native::vulkan::ExternalImageDescriptorOpaqueFD descriptor; + dawn::native::vulkan::ExternalImageDescriptorOpaqueFD descriptor; return WrapVulkanImage(dawnDevice, textureDescriptor, memoryFd, allocationSize, memoryTypeIndex, waitFDs, descriptor.releasedOldLayout, descriptor.releasedNewLayout, isInitialized, expectValid); @@ -180,7 +180,7 @@ VkImageLayout releasedNewLayout, bool isInitialized = true, bool expectValid = true) { - dawn_native::vulkan::ExternalImageDescriptorOpaqueFD descriptor; + dawn::native::vulkan::ExternalImageDescriptorOpaqueFD descriptor; descriptor.cTextureDescriptor = reinterpret_cast<const WGPUTextureDescriptor*>(textureDescriptor); descriptor.isInitialized = isInitialized; @@ -192,7 +192,7 @@ descriptor.releasedNewLayout = releasedNewLayout; WGPUTexture texture = - dawn_native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor); + dawn::native::vulkan::WrapVulkanImage(dawnDevice.Get(), &descriptor); if (expectValid) { EXPECT_NE(texture, nullptr) << "Failed to wrap image, are external memory / " @@ -208,9 +208,9 @@ // We have to export the signal before destroying the wrapped texture else it's an // assertion failure void IgnoreSignalSemaphore(wgpu::Texture wrappedTexture) { - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD info; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_GENERAL, &info); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD info; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_GENERAL, &info); for (int handle : info.semaphoreHandles) { ASSERT_NE(handle, -1); close(handle); @@ -218,7 +218,7 @@ } protected: - dawn_native::vulkan::Device* deviceVk; + dawn::native::vulkan::Device* deviceVk; }; } // anonymous namespace @@ -344,8 +344,8 @@ ASSERT_NE(texture.Get(), nullptr); IgnoreSignalSemaphore(texture); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -355,8 +355,8 @@ wgpu::Texture texture = device.CreateTexture(&defaultDescriptor); ASSERT_NE(texture.Get(), nullptr); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -367,8 +367,8 @@ ASSERT_NE(texture.Get(), nullptr); texture.Destroy(); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - ASSERT_DEVICE_ERROR(bool success = dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + ASSERT_DEVICE_ERROR(bool success = dawn::native::vulkan::ExportVulkanImage( texture.Get(), VK_IMAGE_LAYOUT_GENERAL, &exportInfo)); ASSERT_FALSE(success); } @@ -382,7 +382,7 @@ DAWN_TEST_UNSUPPORTED_IF(UsesWire()); // Create another device based on the original - backendAdapter = dawn_native::vulkan::ToBackend(deviceVk->GetAdapter()); + backendAdapter = dawn::native::vulkan::ToBackend(deviceVk->GetAdapter()); deviceDescriptor.nextInChain = &togglesDesc; togglesDesc.forceEnabledToggles = GetParam().forceEnabledWorkarounds.data(); togglesDesc.forceEnabledTogglesCount = GetParam().forceEnabledWorkarounds.size(); @@ -390,8 +390,8 @@ togglesDesc.forceDisabledTogglesCount = GetParam().forceDisabledWorkarounds.size(); secondDeviceVk = - dawn_native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); - secondDevice = wgpu::Device::Acquire(dawn_native::ToAPI(secondDeviceVk)); + dawn::native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); + secondDevice = wgpu::Device::Acquire(dawn::native::ToAPI(secondDeviceVk)); CreateBindExportImage(deviceVk, 1, 1, VK_FORMAT_R8G8B8A8_UNORM, &defaultImage, &defaultAllocation, &defaultAllocationSize, @@ -418,11 +418,11 @@ protected: wgpu::Device secondDevice; - dawn_native::vulkan::Device* secondDeviceVk; + dawn::native::vulkan::Device* secondDeviceVk; - dawn_native::vulkan::Adapter* backendAdapter; - dawn_native::DeviceDescriptor deviceDescriptor; - dawn_native::DawnTogglesDeviceDescriptor togglesDesc; + dawn::native::vulkan::Adapter* backendAdapter; + dawn::native::DeviceDescriptor deviceDescriptor; + dawn::native::DawnTogglesDeviceDescriptor togglesDesc; wgpu::TextureDescriptor defaultDescriptor; VkImage defaultImage; @@ -488,9 +488,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on signalFd int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -517,9 +517,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on the semaphore int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -547,9 +547,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on the semaphore int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -587,9 +587,9 @@ // Clear |wrappedTexture| on |device| ClearImage(device, wrappedTexture, {5 / 255.0f, 6 / 255.0f, 7 / 255.0f, 8 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &exportInfo); // Import the image to |secondDevice|, making sure we wait on the semaphore int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -608,10 +608,10 @@ secondDeviceWrappedTexture); // Re-import back into |device|, waiting on |secondDevice|'s signal - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD secondExportInfo; - dawn_native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - &secondExportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD secondExportInfo; + dawn::native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + &secondExportInfo); memoryFd = GetMemoryFd(deviceVk, defaultAllocation); wgpu::Texture nextWrappedTexture = @@ -638,9 +638,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on the semaphore int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -691,9 +691,9 @@ // Clear |wrappedTexture| on |device| ClearImage(device, wrappedTexture, {5 / 255.0f, 6 / 255.0f, 7 / 255.0f, 8 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |secondDevice|, making sure we wait on |signalFd| int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -722,10 +722,10 @@ secondDeviceQueue.Submit(1, &commands); // Re-import back into |device|, waiting on |secondDevice|'s signal - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD secondExportInfo; - dawn_native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, - &secondExportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD secondExportInfo; + dawn::native::vulkan::ExportVulkanImage(secondDeviceWrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + &secondExportInfo); memoryFd = GetMemoryFd(deviceVk, defaultAllocation); wgpu::Texture nextWrappedTexture = @@ -753,9 +753,9 @@ // Clear |wrappedTexture| on |secondDevice| ClearImage(secondDevice, wrappedTexture, {1 / 255.0f, 2 / 255.0f, 3 / 255.0f, 4 / 255.0f}); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); // Import the image to |device|, making sure we wait on the semaphore int memoryFd = GetMemoryFd(deviceVk, defaultAllocation); @@ -800,9 +800,9 @@ // device 1 = |device| // device 2 = |secondDevice| // Create device 3 - dawn_native::vulkan::Device* thirdDeviceVk = - dawn_native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); - wgpu::Device thirdDevice = wgpu::Device::Acquire(dawn_native::ToAPI(thirdDeviceVk)); + dawn::native::vulkan::Device* thirdDeviceVk = + dawn::native::vulkan::ToBackend(backendAdapter->APICreateDevice(&deviceDescriptor)); + wgpu::Device thirdDevice = wgpu::Device::Acquire(dawn::native::ToAPI(thirdDeviceVk)); // Make queue for device 2 and 3 wgpu::Queue secondDeviceQueue = secondDevice.GetQueue(); @@ -850,8 +850,8 @@ SimpleCopyTextureToTexture(thirdDevice, thirdDeviceQueue, wrappedTexADevice3, wrappedTexBDevice3); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfoTexBDevice3; - dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfoTexBDevice3; + dawn::native::vulkan::ExportVulkanImage( wrappedTexBDevice3.Get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfoTexBDevice3); IgnoreSignalSemaphore(wrappedTexADevice3); @@ -871,8 +871,8 @@ SimpleCopyTextureToTexture(secondDevice, secondDeviceQueue, wrappedTexBDevice2, wrappedTexCDevice2); - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfoTexCDevice2; - dawn_native::vulkan::ExportVulkanImage( + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfoTexCDevice2; + dawn::native::vulkan::ExportVulkanImage( wrappedTexCDevice2.Get(), VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfoTexCDevice2); IgnoreSignalSemaphore(wrappedTexBDevice2); @@ -973,9 +973,9 @@ secondDeviceQueue.Submit(1, &commands); } - dawn_native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; - dawn_native::vulkan::ExportVulkanImage(wrappedTexture.Get(), - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); + dawn::native::vulkan::ExternalImageExportInfoOpaqueFD exportInfo; + dawn::native::vulkan::ExportVulkanImage(wrappedTexture.Get(), + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &exportInfo); int memoryFd = GetMemoryFd(secondDeviceVk, allocationA); @@ -1016,4 +1016,4 @@ DAWN_INSTANTIATE_TEST(VulkanImageWrappingValidationTests, VulkanBackend()); DAWN_INSTANTIATE_TEST(VulkanImageWrappingUsageTests, VulkanBackend()); -} // namespace dawn_native::vulkan +} // namespace dawn::native::vulkan