Add the webgpu.h swapchain creation path
This commit changes wgpu::Device::CreateSwapChain to take an additional
wgpu::Surface argument. Passing nullptr is enough to stay on the
previous swapchain implementation, until the new one is ready.
In order to support both the "old" implementation-based swapchains and
the "new" surface-based swapchains. SwapChainBase is now split into
three abstract classes:
- SwapChainBase that has a virtual method for each of the
wgpu::SwapChain methods.
- OldSwapChainBase that corresponds to the implementation-based
swapchains.
- NewSwapChainBase that will contain the surface-based swapchain
implementation and will eventually just be renamed to SwapChainBase.
The interaction of the surface-based swapchains with the Surface objects
aren't implemented yet, neither are the swapchain methods. Only creation
works.
Validation tests for surface-based swapchain creation are added in the
end2end test target because they need to create OS windows.
Bug: dawn:269
Change-Id: I7e07d6c666479867b9a16d7b1b8c181d5dbd69a0
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15281
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 7bae973..7bf9726 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -818,8 +818,6 @@
"src/dawn_wire/client/ClientMemoryTransferService_mock.h",
"src/dawn_wire/server/ServerMemoryTransferService_mock.cpp",
"src/dawn_wire/server/ServerMemoryTransferService_mock.h",
- ]
- sources += [
"src/tests/unittests/BitSetIteratorTests.cpp",
"src/tests/unittests/BuddyAllocatorTests.cpp",
"src/tests/unittests/BuddyMemoryAllocatorTests.cpp",
@@ -950,6 +948,12 @@
"src/tests/end2end/ViewportTests.cpp",
]
+ # Validation tests that need OS windows live in end2end tests.
+ sources += [
+ "src/tests/unittests/validation/ValidationTest.cpp",
+ "src/tests/unittests/validation/ValidationTest.h",
+ ]
+
libs = []
if (dawn_enable_d3d12) {
@@ -970,7 +974,10 @@
}
if (supports_glfw_for_windowing) {
- sources += [ "src/tests/end2end/WindowSurfaceTests.cpp" ]
+ sources += [
+ "src/tests/end2end/SwapChainValidationTests.cpp",
+ "src/tests/end2end/WindowSurfaceTests.cpp",
+ ]
deps += [ ":dawn_glfw" ]
}
}