mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 21:17:45 +00:00
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>
This commit is contained in:
committed by
Commit Bot service account
parent
a5a6e4f5bb
commit
d87e676845
@@ -33,7 +33,7 @@ void init() {
|
||||
descriptor.nextInChain = nullptr;
|
||||
descriptor.label = nullptr;
|
||||
descriptor.implementation = GetSwapChainImplementation();
|
||||
swapchain = wgpuDeviceCreateSwapChain(device, &descriptor);
|
||||
swapchain = wgpuDeviceCreateSwapChain(device, nullptr, &descriptor);
|
||||
}
|
||||
swapChainFormat = static_cast<WGPUTextureFormat>(GetPreferredSwapChainTextureFormat());
|
||||
wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_OutputAttachment, 640, 480);
|
||||
|
||||
@@ -180,7 +180,7 @@ wgpu::TextureFormat GetPreferredSwapChainTextureFormat() {
|
||||
wgpu::SwapChain GetSwapChain(const wgpu::Device& device) {
|
||||
wgpu::SwapChainDescriptor swapChainDesc;
|
||||
swapChainDesc.implementation = GetSwapChainImplementation();
|
||||
return device.CreateSwapChain(&swapChainDesc);
|
||||
return device.CreateSwapChain(nullptr, &swapChainDesc);
|
||||
}
|
||||
|
||||
wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) {
|
||||
|
||||
Reference in New Issue
Block a user