Change Copy Operation Interfaces to Match WebGPU IDL

Cosmetic changes to copyBufferToTexture and copyTextureToBuffer to
match WebGPU IDL. Introduces BufferCopyView, TextureCopyView,
TextureAspect, and Origin3D types.

Bug: dawn:17
Change-Id: Ic0e7f472a9dc1353d3fc3839ff02f348bb6067e8
Reviewed-on: https://dawn-review.googlesource.com/c/2520
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Brandon Jones
2018-11-28 17:54:13 +00:00
committed by Commit Bot service account
parent e06d57d338
commit ac71e34d4a
13 changed files with 396 additions and 378 deletions

View File

@@ -433,9 +433,14 @@ namespace {
}
dawn::Buffer staging = utils::CreateBufferFromData(device, data, rowPitch * iImage.height, dawn::BufferUsageBit::TransferSrc);
dawn::BufferCopyView bufferCopyView =
utils::CreateBufferCopyView(staging, 0, rowPitch, 0);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(oTexture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
dawn::Extent3D copySize = {iImage.width, iImage.height, 1};
auto cmdbuf = device.CreateCommandBufferBuilder()
.CopyBufferToTexture(staging, 0, rowPitch, oTexture, 0, 0, 0, iImage.width, iImage.height, 1, 0, 0)
.GetResult();
.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize)
.GetResult();
queue.Submit(1, &cmdbuf);
textures[iTextureID] = oTexture.CreateDefaultTextureView();