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

@@ -68,11 +68,15 @@ void initTextures() {
data[i] = static_cast<uint8_t>(i % 253);
}
dawn::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), static_cast<uint32_t>(data.size()), dawn::BufferUsageBit::TransferSrc);
dawn::CommandBuffer copy = device.CreateCommandBufferBuilder()
.CopyBufferToTexture(stagingBuffer, 0, 0, texture, 0, 0, 0, 1024, 1024, 1, 0, 0)
.GetResult();
dawn::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 0, 0);
dawn::TextureCopyView textureCopyView =
utils::CreateTextureCopyView(texture, 0, 0, {0, 0, 0}, dawn::TextureAspect::Color);
dawn::Extent3D copySize = {1024, 1024, 1};
dawn::CommandBuffer copy =
device.CreateCommandBufferBuilder()
.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize)
.GetResult();
queue.Submit(1, &copy);
}