mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
WebGPU error handling 2: CommandEncoder for samples and end2end tests
CommandEncoder is the replacement for CommandBufferBuilder. This commit adds the dawn.json definition for it and an initial implementation that wraps CommandBufferBuilder. This is done so that the code can be ported to CommandEncoder gradually, otherwise the commit would be too big and would risk many merge conflicts. This converts all samples and end2end tests to use CommandEncoder. BUG=dawn:8 Change-Id: If4ce86e6fb39ba4e0c2af6328d40e63be17d18c1 Reviewed-on: https://dawn-review.googlesource.com/c/4741 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
7be2a71f2b
commit
e1f0d4e639
@@ -74,11 +74,11 @@ void initTextures() {
|
||||
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
|
||||
dawn::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0});
|
||||
dawn::Extent3D copySize = {1024, 1024, 1};
|
||||
dawn::CommandBuffer copy =
|
||||
device.CreateCommandBufferBuilder()
|
||||
.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size)
|
||||
.GetResult();
|
||||
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
|
||||
dawn::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ void frame() {
|
||||
GetNextRenderPassDescriptor(device, swapchain, depthStencilView, &backbuffer, &renderPass);
|
||||
|
||||
static const uint32_t vertexBufferOffsets[1] = {0};
|
||||
dawn::CommandBufferBuilder builder = device.CreateCommandBufferBuilder();
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
{
|
||||
dawn::RenderPassEncoder pass = builder.BeginRenderPass(renderPass);
|
||||
dawn::RenderPassEncoder pass = encoder.BeginRenderPass(renderPass);
|
||||
pass.SetPipeline(pipeline);
|
||||
pass.SetBindGroup(0, bindGroup);
|
||||
pass.SetVertexBuffers(0, 1, &vertexBuffer, vertexBufferOffsets);
|
||||
@@ -176,7 +176,7 @@ void frame() {
|
||||
pass.EndPass();
|
||||
}
|
||||
|
||||
dawn::CommandBuffer commands = builder.GetResult();
|
||||
dawn::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
swapchain.Present(backbuffer);
|
||||
DoFlush();
|
||||
|
||||
Reference in New Issue
Block a user