mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 07:36:15 +00:00
Make the SwapChain interface match webgpu.h
This changes the methods of Dawn's SwapChain to match webgpu.h, namely Present() now doesn't take arguments, and GetNextTexture() is replaced with GetCurrentTextureView(). BUG=dawn:269 Change-Id: Ia0debefb170caf799c3310b1dad5535c4c5f59ca Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/13441 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
700cfe7664
commit
604072bc2e
@@ -261,7 +261,7 @@ void initSim() {
|
||||
}
|
||||
}
|
||||
|
||||
wgpu::CommandBuffer createCommandBuffer(const wgpu::Texture backbuffer, size_t i) {
|
||||
wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView, size_t i) {
|
||||
auto& bufferDst = particleBuffers[(i + 1) % 2];
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
@@ -274,7 +274,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::Texture backbuffer, size_t i
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({backbuffer.CreateView()}, depthStencilView);
|
||||
utils::ComboRenderPassDescriptor renderPass({backbufferView}, depthStencilView);
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
pass.SetVertexBuffer(0, bufferDst);
|
||||
@@ -300,11 +300,11 @@ void init() {
|
||||
}
|
||||
|
||||
void frame() {
|
||||
wgpu::Texture backbuffer = swapchain.GetNextTexture();
|
||||
wgpu::TextureView backbufferView = swapchain.GetCurrentTextureView();
|
||||
|
||||
wgpu::CommandBuffer commandBuffer = createCommandBuffer(backbuffer, pingpong);
|
||||
wgpu::CommandBuffer commandBuffer = createCommandBuffer(backbufferView, pingpong);
|
||||
queue.Submit(1, &commandBuffer);
|
||||
swapchain.Present(backbuffer);
|
||||
swapchain.Present();
|
||||
DoFlush();
|
||||
|
||||
pingpong = (pingpong + 1) % 2;
|
||||
|
||||
Reference in New Issue
Block a user