Rename Buffer/TextureCopyView to ImageCopyBuffer/Texture.

This is to follow the renames in the upstream WebGPU specification.
Typedef are left in places to make a smooth deprecation period.

Bug: dawn:22

Change-Id: I5134b897930c1fa883c49dd80d2665d6684ec022
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/43882
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Corentin Wallez 2021-03-04 18:13:45 +00:00 committed by Commit Bot service account
parent 2015b2f169
commit 80915849ce
45 changed files with 502 additions and 483 deletions

View File

@ -293,12 +293,8 @@
] ]
}, },
"buffer copy view": { "buffer copy view": {
"category": "structure", "category": "typedef",
"extensible": true, "type": "image copy buffer"
"members": [
{"name": "layout", "type": "texture data layout"},
{"name": "buffer", "type": "buffer"}
]
}, },
"buffer descriptor": { "buffer descriptor": {
"category": "structure", "category": "structure",
@ -417,24 +413,24 @@
{ {
"name": "copy buffer to texture", "name": "copy buffer to texture",
"args": [ "args": [
{"name": "source", "type": "buffer copy view", "annotation": "const*"}, {"name": "source", "type": "image copy buffer", "annotation": "const*"},
{"name": "destination", "type": "texture copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy texture", "annotation": "const*"},
{"name": "copy size", "type": "extent 3D", "annotation": "const*"} {"name": "copy size", "type": "extent 3D", "annotation": "const*"}
] ]
}, },
{ {
"name": "copy texture to buffer", "name": "copy texture to buffer",
"args": [ "args": [
{"name": "source", "type": "texture copy view", "annotation": "const*"}, {"name": "source", "type": "image copy texture", "annotation": "const*"},
{"name": "destination", "type": "buffer copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy buffer", "annotation": "const*"},
{"name": "copy size", "type": "extent 3D", "annotation": "const*"} {"name": "copy size", "type": "extent 3D", "annotation": "const*"}
] ]
}, },
{ {
"name": "copy texture to texture", "name": "copy texture to texture",
"args": [ "args": [
{"name": "source", "type": "texture copy view", "annotation": "const*"}, {"name": "source", "type": "image copy texture", "annotation": "const*"},
{"name": "destination", "type": "texture copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy texture", "annotation": "const*"},
{"name": "copy size", "type": "extent 3D", "annotation": "const*"} {"name": "copy size", "type": "extent 3D", "annotation": "const*"}
] ]
}, },
@ -929,6 +925,24 @@
{"value": 1, "name": "CW"} {"value": 1, "name": "CW"}
] ]
}, },
"image copy buffer": {
"category": "structure",
"extensible": true,
"members": [
{"name": "layout", "type": "texture data layout"},
{"name": "buffer", "type": "buffer"}
]
},
"image copy texture": {
"category": "structure",
"extensible": true,
"members": [
{"name": "texture", "type": "texture"},
{"name": "mip level", "type": "uint32_t", "default": "0"},
{"name": "origin", "type": "origin 3D"},
{"name": "aspect", "type": "texture aspect", "default": "all"}
]
},
"index format": { "index format": {
"category": "enum", "category": "enum",
"values": [ "values": [
@ -1146,7 +1160,7 @@
{ {
"name": "write texture", "name": "write texture",
"args": [ "args": [
{"name": "destination", "type": "texture copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy texture", "annotation": "const*"},
{"name": "data", "type": "void", "annotation": "const*", "length": "data size"}, {"name": "data", "type": "void", "annotation": "const*", "length": "data size"},
{"name": "data size", "type": "size_t"}, {"name": "data size", "type": "size_t"},
{"name": "data layout", "type": "texture data layout", "annotation": "const*"}, {"name": "data layout", "type": "texture data layout", "annotation": "const*"},
@ -1157,8 +1171,8 @@
"name": "copy texture for browser", "name": "copy texture for browser",
"extensible": true, "extensible": true,
"args": [ "args": [
{"name": "source", "type": "texture copy view", "annotation": "const*"}, {"name": "source", "type": "image copy texture", "annotation": "const*"},
{"name": "destination", "type": "texture copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy texture", "annotation": "const*"},
{"name": "copy size", "type": "extent 3D", "annotation": "const*"}, {"name": "copy size", "type": "extent 3D", "annotation": "const*"},
{"name": "options", "type": "copy texture for browser options", "annotation": "const*"} {"name": "options", "type": "copy texture for browser options", "annotation": "const*"}
] ]
@ -1757,14 +1771,8 @@
] ]
}, },
"texture copy view": { "texture copy view": {
"category": "structure", "category": "typedef",
"extensible": true, "type": "image copy texture"
"members": [
{"name": "texture", "type": "texture"},
{"name": "mip level", "type": "uint32_t", "default": "0"},
{"name": "origin", "type": "origin 3D"},
{"name": "aspect", "type": "texture aspect", "default": "all"}
]
}, },
"texture data layout": { "texture data layout": {
"category": "structure", "category": "structure",

View File

@ -75,7 +75,7 @@
], ],
"queue write texture internal": [ "queue write texture internal": [
{"name": "queue id", "type": "ObjectId" }, {"name": "queue id", "type": "ObjectId" },
{"name": "destination", "type": "texture copy view", "annotation": "const*"}, {"name": "destination", "type": "image copy texture", "annotation": "const*"},
{"name": "data", "type": "uint8_t", "annotation": "const*", "length": "data size"}, {"name": "data", "type": "uint8_t", "annotation": "const*", "length": "data size"},
{"name": "data size", "type": "uint64_t"}, {"name": "data size", "type": "uint64_t"},
{"name": "data layout", "type": "texture data layout", "annotation": "const*"}, {"name": "data layout", "type": "texture data layout", "annotation": "const*"},

View File

@ -72,12 +72,13 @@ void initTextures() {
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 4 * 1024); wgpu::ImageCopyBuffer imageCopyBuffer =
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); utils::CreateImageCopyBuffer(stagingBuffer, 0, 4 * 1024);
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1024, 1024, 1}; wgpu::Extent3D copySize = {1024, 1024, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy); queue.Submit(1, &copy);

View File

@ -77,9 +77,10 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(const TextureCopyView& src) { MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(
const ImageCopyTexture& src) {
Aspect aspectUsed; Aspect aspectUsed;
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByTextureCopyView(src)); DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByImageCopyTexture(src));
if (aspectUsed == Aspect::Depth) { if (aspectUsed == Aspect::Depth) {
switch (src.texture->GetFormat().format) { switch (src.texture->GetFormat().format) {
case wgpu::TextureFormat::Depth24Plus: case wgpu::TextureFormat::Depth24Plus:
@ -621,15 +622,15 @@ namespace dawn_native {
}); });
} }
void CommandEncoder::CopyBufferToTexture(const BufferCopyView* source, void CommandEncoder::CopyBufferToTexture(const ImageCopyBuffer* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize) { const Extent3D* copySize) {
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
if (GetDevice()->IsValidationEnabled()) { if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(ValidateBufferCopyView(GetDevice(), *source)); DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *source));
DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc)); DAWN_TRY(ValidateCanUseAs(source->buffer, wgpu::BufferUsage::CopySrc));
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *destination, *copySize)); DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst)); DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture)); DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(destination->texture));
@ -676,17 +677,17 @@ namespace dawn_native {
}); });
} }
void CommandEncoder::CopyTextureToBuffer(const TextureCopyView* source, void CommandEncoder::CopyTextureToBuffer(const ImageCopyTexture* source,
const BufferCopyView* destination, const ImageCopyBuffer* destination,
const Extent3D* copySize) { const Extent3D* copySize) {
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
if (GetDevice()->IsValidationEnabled()) { if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *source, *copySize)); DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc)); DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture)); DAWN_TRY(ValidateTextureSampleCountInBufferCopyCommands(source->texture));
DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source)); DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source));
DAWN_TRY(ValidateBufferCopyView(GetDevice(), *destination)); DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *destination));
DAWN_TRY(ValidateCanUseAs(destination->buffer, wgpu::BufferUsage::CopyDst)); DAWN_TRY(ValidateCanUseAs(destination->buffer, wgpu::BufferUsage::CopyDst));
// We validate texture copy range before validating linear texture data, // We validate texture copy range before validating linear texture data,
@ -730,16 +731,16 @@ namespace dawn_native {
}); });
} }
void CommandEncoder::CopyTextureToTexture(const TextureCopyView* source, void CommandEncoder::CopyTextureToTexture(const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize) { const Extent3D* copySize) {
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError { mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
if (GetDevice()->IsValidationEnabled()) { if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(GetDevice()->ValidateObject(source->texture)); DAWN_TRY(GetDevice()->ValidateObject(source->texture));
DAWN_TRY(GetDevice()->ValidateObject(destination->texture)); DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *source, *copySize)); DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *destination, *copySize)); DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
DAWN_TRY( DAWN_TRY(
ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize)); ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));

View File

@ -49,14 +49,14 @@ namespace dawn_native {
BufferBase* destination, BufferBase* destination,
uint64_t destinationOffset, uint64_t destinationOffset,
uint64_t size); uint64_t size);
void CopyBufferToTexture(const BufferCopyView* source, void CopyBufferToTexture(const ImageCopyBuffer* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize); const Extent3D* copySize);
void CopyTextureToBuffer(const TextureCopyView* source, void CopyTextureToBuffer(const ImageCopyTexture* source,
const BufferCopyView* destination, const ImageCopyBuffer* destination,
const Extent3D* copySize); const Extent3D* copySize);
void CopyTextureToTexture(const TextureCopyView* source, void CopyTextureToTexture(const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize); const Extent3D* copySize);
void InjectValidationError(const char* message); void InjectValidationError(const char* message);

View File

@ -265,11 +265,11 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateBufferCopyView(DeviceBase const* device, MaybeError ValidateImageCopyBuffer(DeviceBase const* device,
const BufferCopyView& bufferCopyView) { const ImageCopyBuffer& imageCopyBuffer) {
DAWN_TRY(device->ValidateObject(bufferCopyView.buffer)); DAWN_TRY(device->ValidateObject(imageCopyBuffer.buffer));
if (bufferCopyView.layout.bytesPerRow != wgpu::kCopyStrideUndefined) { if (imageCopyBuffer.layout.bytesPerRow != wgpu::kCopyStrideUndefined) {
if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) { if (imageCopyBuffer.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) {
return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256"); return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256");
} }
} }
@ -277,8 +277,8 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateTextureCopyView(DeviceBase const* device, MaybeError ValidateImageCopyTexture(DeviceBase const* device,
const TextureCopyView& textureCopy, const ImageCopyTexture& textureCopy,
const Extent3D& copySize) { const Extent3D& copySize) {
const TextureBase* texture = textureCopy.texture; const TextureBase* texture = textureCopy.texture;
DAWN_TRY(device->ValidateObject(texture)); DAWN_TRY(device->ValidateObject(texture));
@ -305,7 +305,7 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateTextureCopyRange(const TextureCopyView& textureCopy, MaybeError ValidateTextureCopyRange(const ImageCopyTexture& textureCopy,
const Extent3D& copySize) { const Extent3D& copySize) {
// TODO(jiawei.shao@intel.com): add validations on the texture-to-texture copies within the // TODO(jiawei.shao@intel.com): add validations on the texture-to-texture copies within the
// same texture. // same texture.
@ -357,7 +357,7 @@ namespace dawn_native {
// Always returns a single aspect (color, stencil, depth, or ith plane for multi-planar // Always returns a single aspect (color, stencil, depth, or ith plane for multi-planar
// formats). // formats).
ResultOrError<Aspect> SingleAspectUsedByTextureCopyView(const TextureCopyView& view) { ResultOrError<Aspect> SingleAspectUsedByImageCopyTexture(const ImageCopyTexture& view) {
const Format& format = view.texture->GetFormat(); const Format& format = view.texture->GetFormat();
switch (view.aspect) { switch (view.aspect) {
case wgpu::TextureAspect::All: case wgpu::TextureAspect::All:
@ -382,9 +382,9 @@ namespace dawn_native {
} }
} }
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const TextureCopyView& dst) { MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst) {
Aspect aspectUsed; Aspect aspectUsed;
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByTextureCopyView(dst)); DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByImageCopyTexture(dst));
if (aspectUsed == Aspect::Depth) { if (aspectUsed == Aspect::Depth) {
return DAWN_VALIDATION_ERROR("Cannot copy into the depth aspect of a texture"); return DAWN_VALIDATION_ERROR("Cannot copy into the depth aspect of a texture");
} }
@ -392,8 +392,8 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError ValidateTextureToTextureCopyRestrictions(const TextureCopyView& src, MaybeError ValidateTextureToTextureCopyRestrictions(const ImageCopyTexture& src,
const TextureCopyView& dst, const ImageCopyTexture& dst,
const Extent3D& copySize) { const Extent3D& copySize) {
const uint32_t srcSamples = src.texture->GetSampleCount(); const uint32_t srcSamples = src.texture->GetSampleCount();
const uint32_t dstSamples = dst.texture->GetSampleCount(); const uint32_t dstSamples = dst.texture->GetSampleCount();

View File

@ -48,15 +48,15 @@ namespace dawn_native {
uint64_t byteSize, uint64_t byteSize,
const TexelBlockInfo& blockInfo, const TexelBlockInfo& blockInfo,
const Extent3D& copyExtent); const Extent3D& copyExtent);
MaybeError ValidateTextureCopyRange(const TextureCopyView& textureCopyView, MaybeError ValidateTextureCopyRange(const ImageCopyTexture& imageCopyTexture,
const Extent3D& copySize); const Extent3D& copySize);
ResultOrError<Aspect> SingleAspectUsedByTextureCopyView(const TextureCopyView& view); ResultOrError<Aspect> SingleAspectUsedByImageCopyTexture(const ImageCopyTexture& view);
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const TextureCopyView& dst); MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst);
MaybeError ValidateBufferCopyView(DeviceBase const* device, MaybeError ValidateImageCopyBuffer(DeviceBase const* device,
const BufferCopyView& bufferCopyView); const ImageCopyBuffer& imageCopyBuffer);
MaybeError ValidateTextureCopyView(DeviceBase const* device, MaybeError ValidateImageCopyTexture(DeviceBase const* device,
const TextureCopyView& textureCopyView, const ImageCopyTexture& imageCopyTexture,
const Extent3D& copySize); const Extent3D& copySize);
MaybeError ValidateRowsPerImage(const Format& format, MaybeError ValidateRowsPerImage(const Format& format,
@ -71,8 +71,8 @@ namespace dawn_native {
bool IsRangeOverlapped(uint32_t startA, uint32_t startB, uint32_t length); bool IsRangeOverlapped(uint32_t startA, uint32_t startB, uint32_t length);
MaybeError ValidateTextureToTextureCopyRestrictions(const TextureCopyView& src, MaybeError ValidateTextureToTextureCopyRestrictions(const ImageCopyTexture& src,
const TextureCopyView& dst, const ImageCopyTexture& dst,
const Extent3D& copySize); const Extent3D& copySize);
MaybeError ValidateCanUseAs(const TextureBase* texture, wgpu::TextureUsage usage); MaybeError ValidateCanUseAs(const TextureBase* texture, wgpu::TextureUsage usage);

View File

@ -170,15 +170,15 @@ namespace dawn_native {
} // anonymous namespace } // anonymous namespace
MaybeError ValidateCopyTextureForBrowser(DeviceBase* device, MaybeError ValidateCopyTextureForBrowser(DeviceBase* device,
const TextureCopyView* source, const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { const CopyTextureForBrowserOptions* options) {
DAWN_TRY(device->ValidateObject(source->texture)); DAWN_TRY(device->ValidateObject(source->texture));
DAWN_TRY(device->ValidateObject(destination->texture)); DAWN_TRY(device->ValidateObject(destination->texture));
DAWN_TRY(ValidateTextureCopyView(device, *source, *copySize)); DAWN_TRY(ValidateImageCopyTexture(device, *source, *copySize));
DAWN_TRY(ValidateTextureCopyView(device, *destination, *copySize)); DAWN_TRY(ValidateImageCopyTexture(device, *destination, *copySize));
DAWN_TRY(ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize)); DAWN_TRY(ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));
@ -208,8 +208,8 @@ namespace dawn_native {
} }
MaybeError DoCopyTextureForBrowser(DeviceBase* device, MaybeError DoCopyTextureForBrowser(DeviceBase* device,
const TextureCopyView* source, const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { const CopyTextureForBrowserOptions* options) {
// TODO(shaobo.yan@intel.com): In D3D12 and Vulkan, compatible texture format can directly // TODO(shaobo.yan@intel.com): In D3D12 and Vulkan, compatible texture format can directly

View File

@ -21,18 +21,18 @@
namespace dawn_native { namespace dawn_native {
class DeviceBase; class DeviceBase;
struct Extent3D; struct Extent3D;
struct TextureCopyView; struct ImageCopyTexture;
struct CopyTextureForBrowserOptions; struct CopyTextureForBrowserOptions;
MaybeError ValidateCopyTextureForBrowser(DeviceBase* device, MaybeError ValidateCopyTextureForBrowser(DeviceBase* device,
const TextureCopyView* source, const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options); const CopyTextureForBrowserOptions* options);
MaybeError DoCopyTextureForBrowser(DeviceBase* device, MaybeError DoCopyTextureForBrowser(DeviceBase* device,
const TextureCopyView* source, const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options); const CopyTextureForBrowserOptions* options);

View File

@ -291,7 +291,7 @@ namespace dawn_native {
buffer, bufferOffset, size); buffer, bufferOffset, size);
} }
void QueueBase::WriteTexture(const TextureCopyView* destination, void QueueBase::WriteTexture(const ImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
@ -300,7 +300,7 @@ namespace dawn_native {
WriteTextureInternal(destination, data, dataSize, dataLayout, writeSize)); WriteTextureInternal(destination, data, dataSize, dataLayout, writeSize));
} }
MaybeError QueueBase::WriteTextureInternal(const TextureCopyView* destination, MaybeError QueueBase::WriteTextureInternal(const ImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
@ -318,7 +318,7 @@ namespace dawn_native {
return WriteTextureImpl(*destination, data, layout, *writeSize); return WriteTextureImpl(*destination, data, layout, *writeSize);
} }
MaybeError QueueBase::WriteTextureImpl(const TextureCopyView& destination, MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
const void* data, const void* data,
const TextureDataLayout& dataLayout, const TextureDataLayout& dataLayout,
const Extent3D& writeSizePixel) { const Extent3D& writeSizePixel) {
@ -362,8 +362,8 @@ namespace dawn_native {
&textureCopy, writeSizePixel); &textureCopy, writeSizePixel);
} }
void QueueBase::CopyTextureForBrowser(const TextureCopyView* source, void QueueBase::CopyTextureForBrowser(const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { const CopyTextureForBrowserOptions* options) {
GetDevice()->ConsumedError( GetDevice()->ConsumedError(
@ -371,8 +371,8 @@ namespace dawn_native {
} }
MaybeError QueueBase::CopyTextureForBrowserInternal( MaybeError QueueBase::CopyTextureForBrowserInternal(
const TextureCopyView* source, const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options) { const CopyTextureForBrowserOptions* options) {
if (GetDevice()->IsValidationEnabled()) { if (GetDevice()->IsValidationEnabled()) {
@ -485,7 +485,7 @@ namespace dawn_native {
return {}; return {};
} }
MaybeError QueueBase::ValidateWriteTexture(const TextureCopyView* destination, MaybeError QueueBase::ValidateWriteTexture(const ImageCopyTexture* destination,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
const Extent3D* writeSize) const { const Extent3D* writeSize) const {
@ -493,7 +493,7 @@ namespace dawn_native {
DAWN_TRY(GetDevice()->ValidateObject(this)); DAWN_TRY(GetDevice()->ValidateObject(this));
DAWN_TRY(GetDevice()->ValidateObject(destination->texture)); DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *destination, *writeSize)); DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *writeSize));
if (dataLayout->offset > dataSize) { if (dataLayout->offset > dataSize) {
return DAWN_VALIDATION_ERROR("Queue::WriteTexture out of range"); return DAWN_VALIDATION_ERROR("Queue::WriteTexture out of range");

View File

@ -44,13 +44,13 @@ namespace dawn_native {
WGPUQueueWorkDoneCallback callback, WGPUQueueWorkDoneCallback callback,
void* userdata); void* userdata);
void WriteBuffer(BufferBase* buffer, uint64_t bufferOffset, const void* data, size_t size); void WriteBuffer(BufferBase* buffer, uint64_t bufferOffset, const void* data, size_t size);
void WriteTexture(const TextureCopyView* destination, void WriteTexture(const ImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
const Extent3D* writeSize); const Extent3D* writeSize);
void CopyTextureForBrowser(const TextureCopyView* source, void CopyTextureForBrowser(const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options); const CopyTextureForBrowserOptions* options);
@ -67,13 +67,13 @@ namespace dawn_native {
uint64_t bufferOffset, uint64_t bufferOffset,
const void* data, const void* data,
size_t size); size_t size);
MaybeError WriteTextureInternal(const TextureCopyView* destination, MaybeError WriteTextureInternal(const ImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
const Extent3D* writeSize); const Extent3D* writeSize);
MaybeError CopyTextureForBrowserInternal(const TextureCopyView* source, MaybeError CopyTextureForBrowserInternal(const ImageCopyTexture* source,
const TextureCopyView* destination, const ImageCopyTexture* destination,
const Extent3D* copySize, const Extent3D* copySize,
const CopyTextureForBrowserOptions* options); const CopyTextureForBrowserOptions* options);
@ -83,7 +83,7 @@ namespace dawn_native {
uint64_t bufferOffset, uint64_t bufferOffset,
const void* data, const void* data,
size_t size); size_t size);
virtual MaybeError WriteTextureImpl(const TextureCopyView& destination, virtual MaybeError WriteTextureImpl(const ImageCopyTexture& destination,
const void* data, const void* data,
const TextureDataLayout& dataLayout, const TextureDataLayout& dataLayout,
const Extent3D& writeSize); const Extent3D& writeSize);
@ -96,7 +96,7 @@ namespace dawn_native {
MaybeError ValidateWriteBuffer(const BufferBase* buffer, MaybeError ValidateWriteBuffer(const BufferBase* buffer,
uint64_t bufferOffset, uint64_t bufferOffset,
size_t size) const; size_t size) const;
MaybeError ValidateWriteTexture(const TextureCopyView* destination, MaybeError ValidateWriteTexture(const ImageCopyTexture* destination,
size_t dataSize, size_t dataSize,
const TextureDataLayout* dataLayout, const TextureDataLayout* dataLayout,
const Extent3D* writeSize) const; const Extent3D* writeSize) const;

View File

@ -52,7 +52,7 @@ namespace dawn_native { namespace opengl {
return {}; return {};
} }
MaybeError Queue::WriteTextureImpl(const TextureCopyView& destination, MaybeError Queue::WriteTextureImpl(const ImageCopyTexture& destination,
const void* data, const void* data,
const TextureDataLayout& dataLayout, const TextureDataLayout& dataLayout,
const Extent3D& writeSizePixel) { const Extent3D& writeSizePixel) {

View File

@ -31,7 +31,7 @@ namespace dawn_native { namespace opengl {
uint64_t bufferOffset, uint64_t bufferOffset,
const void* data, const void* data,
size_t size) override; size_t size) override;
MaybeError WriteTextureImpl(const TextureCopyView& destination, MaybeError WriteTextureImpl(const ImageCopyTexture& destination,
const void* data, const void* data,
const TextureDataLayout& dataLayout, const TextureDataLayout& dataLayout,
const Extent3D& writeSizePixel) override; const Extent3D& writeSizePixel) override;

View File

@ -90,7 +90,7 @@ namespace dawn_wire { namespace client {
client->SerializeCommand(cmd); client->SerializeCommand(cmd);
} }
void Queue::WriteTexture(const WGPUTextureCopyView* destination, void Queue::WriteTexture(const WGPUImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const WGPUTextureDataLayout* dataLayout, const WGPUTextureDataLayout* dataLayout,

View File

@ -37,7 +37,7 @@ namespace dawn_wire { namespace client {
void* userdata); void* userdata);
WGPUFence CreateFence(const WGPUFenceDescriptor* descriptor); WGPUFence CreateFence(const WGPUFenceDescriptor* descriptor);
void WriteBuffer(WGPUBuffer cBuffer, uint64_t bufferOffset, const void* data, size_t size); void WriteBuffer(WGPUBuffer cBuffer, uint64_t bufferOffset, const void* data, size_t size);
void WriteTexture(const WGPUTextureCopyView* destination, void WriteTexture(const WGPUImageCopyTexture* destination,
const void* data, const void* data,
size_t dataSize, size_t dataSize,
const WGPUTextureDataLayout* dataLayout, const WGPUTextureDataLayout* dataLayout,

View File

@ -97,7 +97,7 @@ namespace dawn_wire { namespace server {
} }
bool Server::DoQueueWriteTextureInternal(ObjectId queueId, bool Server::DoQueueWriteTextureInternal(ObjectId queueId,
const WGPUTextureCopyView* destination, const WGPUImageCopyTexture* destination,
const uint8_t* data, const uint8_t* data,
uint64_t dataSize, uint64_t dataSize,
const WGPUTextureDataLayout* dataLayout, const WGPUTextureDataLayout* dataLayout,

View File

@ -1036,14 +1036,14 @@ std::ostringstream& DawnTestBase::AddTextureExpectationImpl(const char* file,
// We need to enqueue the copy immediately because by the time we resolve the expectation, // We need to enqueue the copy immediately because by the time we resolve the expectation,
// the texture might have been modified. // the texture might have been modified.
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, level, {x, y, slice}, aspect); utils::CreateImageCopyTexture(texture, level, {x, y, slice}, aspect);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(readback.buffer, readback.offset, bytesPerRow, rowsPerImage); utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);

View File

@ -319,11 +319,11 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
{{0, buffer, 0, sizeof(transform)}, {1, sampler}, {2, textureView}}); {{0, buffer, 0, sizeof(transform)}, {1, sampler}, {2, textureView}});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, widthInBytes); utils::CreateImageCopyBuffer(stagingBuffer, 0, widthInBytes);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo); wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
pass.SetPipeline(pipeline); pass.SetPipeline(pipeline);
pass.SetBindGroup(0, bindGroup); pass.SetBindGroup(0, bindGroup);
@ -1181,16 +1181,16 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
wgpu::Buffer textureData = wgpu::Buffer textureData =
utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {value}); utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {value});
wgpu::BufferCopyView bufferCopyView = {}; wgpu::ImageCopyBuffer imageCopyBuffer = {};
bufferCopyView.buffer = textureData; imageCopyBuffer.buffer = textureData;
bufferCopyView.layout.bytesPerRow = 256; imageCopyBuffer.layout.bytesPerRow = 256;
wgpu::TextureCopyView textureCopyView = {}; wgpu::ImageCopyTexture imageCopyTexture = {};
textureCopyView.texture = texture; imageCopyTexture.texture = texture;
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
commandEncoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); commandEncoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
return texture; return texture;
}; };

View File

@ -126,19 +126,19 @@ class BufferZeroInitTest : public DawnTest {
wgpu::Texture texture = wgpu::Texture texture =
CreateAndInitializeTexture(spec.textureSize, kTextureFormat, kClearColor); CreateAndInitializeTexture(spec.textureSize, kTextureFormat, kClearColor);
const wgpu::TextureCopyView textureCopyView = const wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
const uint64_t bufferSize = spec.bufferOffset + spec.extraBytes + const uint64_t bufferSize = spec.bufferOffset + spec.extraBytes +
utils::RequiredBytesInCopy(spec.bytesPerRow, spec.rowsPerImage, utils::RequiredBytesInCopy(spec.bytesPerRow, spec.rowsPerImage,
spec.textureSize, kTextureFormat); spec.textureSize, kTextureFormat);
wgpu::Buffer buffer = wgpu::Buffer buffer =
CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst); CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst);
const wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( const wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, spec.bufferOffset, spec.bytesPerRow, spec.rowsPerImage); buffer, spec.bufferOffset, spec.bytesPerRow, spec.rowsPerImage);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &spec.textureSize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &spec.textureSize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
EXPECT_LAZY_CLEAR(spec.lazyClearCount, queue.Submit(1, &commandBuffer)); EXPECT_LAZY_CLEAR(spec.lazyClearCount, queue.Submit(1, &commandBuffer));
@ -871,8 +871,8 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint; constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
wgpu::Texture texture = CreateAndInitializeTexture(kTextureSize, kTextureFormat); wgpu::Texture texture = CreateAndInitializeTexture(kTextureSize, kTextureFormat);
const wgpu::TextureCopyView textureCopyView = const wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
const uint32_t rowsPerImage = kTextureSize.height; const uint32_t rowsPerImage = kTextureSize.height;
const uint32_t requiredBufferSizeForCopy = utils::RequiredBytesInCopy( const uint32_t requiredBufferSizeForCopy = utils::RequiredBytesInCopy(
@ -886,11 +886,11 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
constexpr uint64_t kOffset = 0; constexpr uint64_t kOffset = 0;
const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset; const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset;
wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage); wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage);
const wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( const wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height); buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &kTextureSize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &kTextureSize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer));
@ -904,11 +904,11 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
constexpr uint64_t kOffset = 8u; constexpr uint64_t kOffset = 8u;
const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset; const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset;
wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage); wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage);
const wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( const wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height); buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &kTextureSize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &kTextureSize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer));

View File

@ -96,15 +96,15 @@ class CompressedTextureBCFormatTest : public DawnTest {
// Copy texture data from a staging buffer to the destination texture. // Copy texture data from a staging buffer to the destination texture.
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(),
wgpu::BufferUsage::CopySrc); wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, copyConfig.bufferOffset, utils::CreateImageCopyBuffer(stagingBuffer, copyConfig.bufferOffset,
copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage); copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D); bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copyConfig.copyExtent3D); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyConfig.copyExtent3D);
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy); queue.Submit(1, &copy);
} }
@ -258,11 +258,11 @@ class CompressedTextureBCFormatTest : public DawnTest {
wgpu::Texture dstTexture, wgpu::Texture dstTexture,
CopyConfig srcConfig, CopyConfig srcConfig,
CopyConfig dstConfig) { CopyConfig dstConfig) {
wgpu::TextureCopyView textureCopyViewSrc = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTextureSrc = utils::CreateImageCopyTexture(
srcTexture, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D); srcTexture, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D);
wgpu::TextureCopyView textureCopyViewDst = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTextureDst = utils::CreateImageCopyTexture(
dstTexture, dstConfig.viewMipmapLevel, dstConfig.copyOrigin3D); dstTexture, dstConfig.viewMipmapLevel, dstConfig.copyOrigin3D);
encoder.CopyTextureToTexture(&textureCopyViewSrc, &textureCopyViewDst, encoder.CopyTextureToTexture(&imageCopyTextureSrc, &imageCopyTextureDst,
&dstConfig.copyExtent3D); &dstConfig.copyExtent3D);
} }
@ -629,7 +629,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyIntoSubresourceWithPhysicalSizeNotEqua
srcConfig.textureDescriptor.usage = srcConfig.textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst; wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
wgpu::Texture bcTextureSrc = CreateTextureWithCompressedData(srcConfig); wgpu::Texture bcTextureSrc = CreateTextureWithCompressedData(srcConfig);
wgpu::TextureCopyView textureCopyViewSrc = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTextureSrc = utils::CreateImageCopyTexture(
bcTextureSrc, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D); bcTextureSrc, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D);
// Create bcTexture and copy from the content in bcTextureSrc into it. // Create bcTexture and copy from the content in bcTextureSrc into it.
@ -1113,12 +1113,12 @@ TEST_P(CompressedTextureBCFormatTest, UnalignedDynamicUploader) {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(buffer, 0, 256); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(buffer, 0, 256);
wgpu::Extent3D copyExtent = {4, 4, 1}; wgpu::Extent3D copyExtent = {4, 4, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copyExtent); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copyExtent);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
} }
@ -1148,10 +1148,10 @@ class CompressedTextureWriteTextureTest : public CompressedTextureBCFormatTest {
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout( wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
copyConfig.bufferOffset, copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage); copyConfig.bufferOffset, copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D); bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D);
queue.WriteTexture(&textureCopyView, data.data(), data.size(), &textureDataLayout, queue.WriteTexture(&imageCopyTexture, data.data(), data.size(), &textureDataLayout,
&copyConfig.copyExtent3D); &copyConfig.copyExtent3D);
} }

View File

@ -149,11 +149,11 @@ class CopyTests_T2B : public CopyTests {
// Initialize the source texture // Initialize the source texture
std::vector<RGBA8> textureArrayData = GetExpectedTextureDataRGBA8(copyLayout); std::vector<RGBA8> textureArrayData = GetExpectedTextureDataRGBA8(copyLayout);
{ {
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, textureSpec.copyLevel, {0, 0, 0}); utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, {0, 0, 0});
wgpu::TextureDataLayout textureDataLayout = wgpu::TextureDataLayout textureDataLayout =
utils::CreateTextureDataLayout(0, copyLayout.bytesPerRow, copyLayout.rowsPerImage); utils::CreateTextureDataLayout(0, copyLayout.bytesPerRow, copyLayout.rowsPerImage);
queue.WriteTexture(&textureCopyView, textureArrayData.data(), copyLayout.byteLength, queue.WriteTexture(&imageCopyTexture, textureArrayData.data(), copyLayout.byteLength,
&textureDataLayout, &copyLayout.mipSize); &textureDataLayout, &copyLayout.mipSize);
} }
@ -169,11 +169,11 @@ class CopyTests_T2B : public CopyTests {
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc); wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
{ {
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
texture, textureSpec.copyLevel, textureSpec.copyOrigin); texture, textureSpec.copyLevel, textureSpec.copyOrigin);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage); buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage);
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
} }
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
@ -260,11 +260,11 @@ class CopyTests_B2T : public CopyTests {
const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth; const uint32_t maxArrayLayer = textureSpec.copyOrigin.z + copySize.depth;
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView( wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage); buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, textureSpec.copyLevel, textureSpec.copyOrigin); utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, textureSpec.copyOrigin);
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
@ -339,11 +339,11 @@ class CopyTests_T2T : public CopyTests {
// Initialize the source texture // Initialize the source texture
const std::vector<uint8_t> srcTextureCopyData = GetExpectedTextureData(srcDataCopyLayout); const std::vector<uint8_t> srcTextureCopyData = GetExpectedTextureData(srcDataCopyLayout);
{ {
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
srcTexture, srcSpec.copyLevel, {0, 0, srcSpec.copyOrigin.z}); srcTexture, srcSpec.copyLevel, {0, 0, srcSpec.copyOrigin.z});
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout( wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
0, srcDataCopyLayout.bytesPerRow, srcDataCopyLayout.rowsPerImage); 0, srcDataCopyLayout.bytesPerRow, srcDataCopyLayout.rowsPerImage);
queue.WriteTexture(&textureCopyView, srcTextureCopyData.data(), queue.WriteTexture(&imageCopyTexture, srcTextureCopyData.data(),
srcDataCopyLayout.byteLength, &textureDataLayout, srcDataCopyLayout.byteLength, &textureDataLayout,
&srcDataCopyLayout.mipSize); &srcDataCopyLayout.mipSize);
} }
@ -351,11 +351,11 @@ class CopyTests_T2T : public CopyTests {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
// Perform the texture to texture copy // Perform the texture to texture copy
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, srcSpec.copyLevel, srcSpec.copyOrigin); utils::CreateImageCopyTexture(srcTexture, srcSpec.copyLevel, srcSpec.copyOrigin);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, dstSpec.copyLevel, dstSpec.copyOrigin); utils::CreateImageCopyTexture(dstTexture, dstSpec.copyLevel, dstSpec.copyOrigin);
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &copySize); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
// Copy the data from the srcSpec.copyOrigin.z-th layer to (srcSpec.copyOrigin.z + // Copy the data from the srcSpec.copyOrigin.z-th layer to (srcSpec.copyOrigin.z +
// copySize.depth)-th layer of dstTexture to outputBuffer // copySize.depth)-th layer of dstTexture to outputBuffer
@ -367,9 +367,9 @@ class CopyTests_T2T : public CopyTests {
outputBufferDescriptor.size = dstDataCopyLayout.byteLength; outputBufferDescriptor.size = dstDataCopyLayout.byteLength;
outputBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; outputBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer outputBuffer = device.CreateBuffer(&outputBufferDescriptor); wgpu::Buffer outputBuffer = device.CreateBuffer(&outputBufferDescriptor);
wgpu::BufferCopyView outputBufferCopyView = utils::CreateBufferCopyView( wgpu::ImageCopyBuffer outputImageCopyBuffer = utils::CreateImageCopyBuffer(
outputBuffer, 0, dstDataCopyLayout.bytesPerRow, dstDataCopyLayout.rowsPerImage); outputBuffer, 0, dstDataCopyLayout.bytesPerRow, dstDataCopyLayout.rowsPerImage);
encoder.CopyTextureToBuffer(&dstTextureCopyView, &outputBufferCopyView, &copySize); encoder.CopyTextureToBuffer(&dstImageCopyTexture, &outputImageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
@ -1597,12 +1597,12 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(buffer, kBufferCopyOffset, kTextureBytesPerRowAlignment); utils::CreateImageCopyBuffer(buffer, kBufferCopyOffset, kTextureBytesPerRowAlignment);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = textureDescriptor.size; wgpu::Extent3D copySize = textureDescriptor.size;
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);

View File

@ -145,29 +145,29 @@ class CopyTextureForBrowserTests : public DawnTest {
srcSpec.level); srcSpec.level);
const std::vector<RGBA8> textureArrayCopyData = GetSourceTextureData(copyLayout); const std::vector<RGBA8> textureArrayCopyData = GetSourceTextureData(copyLayout);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(srcTexture, srcSpec.level, {0, 0, srcSpec.copyOrigin.z}); utils::CreateImageCopyTexture(srcTexture, srcSpec.level, {0, 0, srcSpec.copyOrigin.z});
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
textureDataLayout.offset = 0; textureDataLayout.offset = 0;
textureDataLayout.bytesPerRow = copyLayout.bytesPerRow; textureDataLayout.bytesPerRow = copyLayout.bytesPerRow;
textureDataLayout.rowsPerImage = copyLayout.rowsPerImage; textureDataLayout.rowsPerImage = copyLayout.rowsPerImage;
device.GetQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(), device.GetQueue().WriteTexture(&imageCopyTexture, textureArrayCopyData.data(),
textureArrayCopyData.size() * sizeof(RGBA8), textureArrayCopyData.size() * sizeof(RGBA8),
&textureDataLayout, &copyLayout.mipSize); &textureDataLayout, &copyLayout.mipSize);
// Perform the texture to texture copy // Perform the texture to texture copy
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, srcSpec.level, srcSpec.copyOrigin); utils::CreateImageCopyTexture(srcTexture, srcSpec.level, srcSpec.copyOrigin);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, dstSpec.level, dstSpec.copyOrigin); utils::CreateImageCopyTexture(dstTexture, dstSpec.level, dstSpec.copyOrigin);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
device.GetQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView, &copySize, device.GetQueue().CopyTextureForBrowser(&srcImageCopyTexture, &dstImageCopyTexture,
&options); &copySize, &options);
// Update uniform buffer based on test config // Update uniform buffer based on test config
uint32_t uniformBufferData[] = { uint32_t uniformBufferData[] = {

View File

@ -282,8 +282,8 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase {
protected: protected:
// Submits a 1x1x1 copy from source to destination // Submits a 1x1x1 copy from source to destination
void SimpleCopyTextureToTexture(wgpu::Texture source, wgpu::Texture destination) { void SimpleCopyTextureToTexture(wgpu::Texture source, wgpu::Texture destination) {
wgpu::TextureCopyView copySrc = utils::CreateTextureCopyView(source, 0, {0, 0, 0}); wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(source, 0, {0, 0, 0});
wgpu::TextureCopyView copyDst = utils::CreateTextureCopyView(destination, 0, {0, 0, 0}); wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};

View File

@ -180,16 +180,16 @@ DAWN_INSTANTIATE_TEST(DeprecationTests,
OpenGLESBackend(), OpenGLESBackend(),
VulkanBackend()); VulkanBackend());
class BufferCopyViewDeprecationTests : public DeprecationTests { class ImageCopyBufferDeprecationTests : public DeprecationTests {
protected: protected:
wgpu::TextureCopyView MakeTextureCopyView() { wgpu::ImageCopyTexture MakeImageCopyTexture() {
wgpu::TextureDescriptor desc = {}; wgpu::TextureDescriptor desc = {};
desc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst; desc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
desc.dimension = wgpu::TextureDimension::e2D; desc.dimension = wgpu::TextureDimension::e2D;
desc.size = {1, 1, 2}; desc.size = {1, 1, 2};
desc.format = wgpu::TextureFormat::RGBA8Unorm; desc.format = wgpu::TextureFormat::RGBA8Unorm;
wgpu::TextureCopyView copy; wgpu::ImageCopyTexture copy;
copy.texture = device.CreateTexture(&desc); copy.texture = device.CreateTexture(&desc);
copy.origin = {0, 0, 1}; copy.origin = {0, 0, 1};
return copy; return copy;

View File

@ -173,8 +173,10 @@ class DepthStencilCopyTests : public DawnTest {
// Perform a T2T copy of all aspects // Perform a T2T copy of all aspects
{ {
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder(); wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
wgpu::TextureCopyView srcView = utils::CreateTextureCopyView(src, mipLevel, {0, 0, 0}); wgpu::ImageCopyTexture srcView =
wgpu::TextureCopyView dstView = utils::CreateTextureCopyView(dst, mipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(src, mipLevel, {0, 0, 0});
wgpu::ImageCopyTexture dstView =
utils::CreateImageCopyTexture(dst, mipLevel, {0, 0, 0});
wgpu::Extent3D copySize = {width >> mipLevel, height >> mipLevel, 1}; wgpu::Extent3D copySize = {width >> mipLevel, height >> mipLevel, 1};
commandEncoder.CopyTextureToTexture(&srcView, &dstView, &copySize); commandEncoder.CopyTextureToTexture(&srcView, &dstView, &copySize);
@ -229,10 +231,10 @@ class DepthStencilCopyTests : public DawnTest {
} }
uploadBuffer.Unmap(); uploadBuffer.Unmap();
wgpu::BufferCopyView bufferCopy = wgpu::ImageCopyBuffer bufferCopy =
utils::CreateBufferCopyView(uploadBuffer, 0, bytesPerRow, height); utils::CreateImageCopyBuffer(uploadBuffer, 0, bytesPerRow, height);
wgpu::TextureCopyView textureCopy = wgpu::ImageCopyTexture textureCopy =
utils::CreateTextureCopyView(depthDataTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All); utils::CreateImageCopyTexture(depthDataTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size); commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
// Pipeline for a full screen quad. // Pipeline for a full screen quad.
@ -636,11 +638,11 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
wgpu::TextureDataLayout stencilDataLayout = {}; wgpu::TextureDataLayout stencilDataLayout = {};
stencilDataLayout.bytesPerRow = kWidth * sizeof(uint8_t); stencilDataLayout.bytesPerRow = kWidth * sizeof(uint8_t);
wgpu::TextureCopyView stencilDataCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture stencilDataCopyTexture = utils::CreateImageCopyTexture(
depthStencilTexture, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly); depthStencilTexture, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly);
wgpu::Extent3D writeSize = {kWidth, kHeight, 1}; wgpu::Extent3D writeSize = {kWidth, kHeight, 1};
queue.WriteTexture(&stencilDataCopyView, stencilData.data(), queue.WriteTexture(&stencilDataCopyTexture, stencilData.data(),
stencilData.size() * sizeof(uint8_t), &stencilDataLayout, &writeSize); stencilData.size() * sizeof(uint8_t), &stencilDataLayout, &writeSize);
// Decrement the stencil value in a render pass to ensure the data is visible to the pipeline. // Decrement the stencil value in a render pass to ensure the data is visible to the pipeline.

View File

@ -242,12 +242,12 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst; wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
wgpu::Texture tex = device.CreateTexture(&texDesc); wgpu::Texture tex = device.CreateTexture(&texDesc);
wgpu::TextureCopyView copyView; wgpu::ImageCopyTexture copyDst;
copyView.texture = tex; copyDst.texture = tex;
wgpu::TextureDataLayout layout; wgpu::TextureDataLayout layout;
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
uint32_t kOne = 1; uint32_t kOne = 1;
queue.WriteTexture(&copyView, &kOne, sizeof(kOne), &layout, &copySize); queue.WriteTexture(&copyDst, &kOne, sizeof(kOne), &layout, &copySize);
// Create a pipeline that loads the texture from both the sampled and storage paths. // Create a pipeline that loads the texture from both the sampled and storage paths.
wgpu::ComputePipelineDescriptor pipelineDesc; wgpu::ComputePipelineDescriptor pipelineDesc;

View File

@ -138,12 +138,12 @@ TEST_P(NonzeroTextureCreationTests, NonrenderableTextureFormat) {
wgpu::Buffer bufferDst = utils::CreateBufferFromData( wgpu::Buffer bufferDst = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, kSize * 4); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, kSize * 4);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
@ -176,12 +176,12 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableTextureClearWithMultiArrayLayer
wgpu::Buffer bufferDst = utils::CreateBufferFromData( wgpu::Buffer bufferDst = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, kSize * 4); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, kSize * 4);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 1}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 1});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);

View File

@ -277,10 +277,10 @@ class QueueWriteTextureTests : public DawnTest {
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout( wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
dataSpec.offset, dataSpec.bytesPerRow, dataSpec.rowsPerImage); dataSpec.offset, dataSpec.bytesPerRow, dataSpec.rowsPerImage);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, textureSpec.level, textureSpec.copyOrigin); utils::CreateImageCopyTexture(texture, textureSpec.level, textureSpec.copyOrigin);
queue.WriteTexture(&textureCopyView, data.data(), dataSpec.size, &textureDataLayout, queue.WriteTexture(&imageCopyTexture, data.data(), dataSpec.size, &textureDataLayout,
&copySize); &copySize);
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat); const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat);

View File

@ -126,10 +126,11 @@ class RenderPassLoadOpTests : public DawnTest {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture =
wgpu::BufferCopyView bufferCopyView = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
utils::CreateBufferCopyView(buffer, 0, kTextureBytesPerRowAlignment); wgpu::ImageCopyBuffer imageCopyBuffer =
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &kTextureSize); utils::CreateImageCopyBuffer(buffer, 0, kTextureBytesPerRowAlignment);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &kTextureSize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);

View File

@ -121,12 +121,12 @@ class SamplerFilterAnisotropicTest : public DawnTest {
std::vector<RGBA8> data(rowPixels * texHeight, color); std::vector<RGBA8> data(rowPixels * texHeight, color);
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc); device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureBytesPerRowAlignment); utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, level, {0, 0, 0}); utils::CreateImageCopyTexture(texture, level, {0, 0, 0});
wgpu::Extent3D copySize = {texWidth, texHeight, 1}; wgpu::Extent3D copySize = {texWidth, texHeight, 1};
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
} }
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy); queue.Submit(1, &copy);

View File

@ -108,12 +108,13 @@ class SamplerTest : public DawnTest {
wgpu::Buffer stagingBuffer = wgpu::Buffer stagingBuffer =
utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc); utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, 256);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {2, 2, 1}; wgpu::Extent3D copySize = {2, 2, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy); queue.Submit(1, &copy);

View File

@ -448,11 +448,11 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount}; const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount};
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(uploadBuffer, 0, kTextureBytesPerRowAlignment, kHeight); utils::CreateImageCopyBuffer(uploadBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
wgpu::TextureCopyView textureCopyView; wgpu::ImageCopyTexture imageCopyTexture;
textureCopyView.texture = outputTexture; imageCopyTexture.texture = outputTexture;
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copyExtent); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyExtent);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
@ -622,11 +622,11 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount}; const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount};
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(writeonlyStorageTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(writeonlyStorageTexture, 0, {0, 0, 0});
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(resultBuffer, 0, kTextureBytesPerRowAlignment, kHeight); utils::CreateImageCopyBuffer(resultBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copyExtent); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copyExtent);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer); queue.Submit(1, &commandBuffer);
@ -1032,12 +1032,12 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView textureCopyView; wgpu::ImageCopyTexture imageCopyTexture;
textureCopyView.texture = storageTexture1; imageCopyTexture.texture = storageTexture1;
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(resultBuffer, 0, 256, 1); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(resultBuffer, 0, 256, 1);
wgpu::Extent3D extent3D = {1, 1, 1}; wgpu::Extent3D extent3D = {1, 1, 1};
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
@ -1106,12 +1106,12 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView textureCopyView; wgpu::ImageCopyTexture imageCopyTexture;
textureCopyView.texture = storageTexture1; imageCopyTexture.texture = storageTexture1;
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(resultBuffer, 0, 256, 1); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(resultBuffer, 0, 256, 1);
wgpu::Extent3D extent3D = {1, 1, 1}; wgpu::Extent3D extent3D = {1, 1, 1};
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);

View File

@ -235,9 +235,9 @@ class TextureFormatTest : public DawnTest {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
{ {
wgpu::BufferCopyView bufferView = utils::CreateBufferCopyView(uploadBuffer, 0, 256); wgpu::ImageCopyBuffer bufferView = utils::CreateImageCopyBuffer(uploadBuffer, 0, 256);
wgpu::TextureCopyView textureView = wgpu::ImageCopyTexture textureView =
utils::CreateTextureCopyView(sampleTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(sampleTexture, 0, {0, 0, 0});
wgpu::Extent3D extent{width, 1, 1}; wgpu::Extent3D extent{width, 1, 1};
encoder.CopyBufferToTexture(&bufferView, &textureView, &extent); encoder.CopyBufferToTexture(&bufferView, &textureView, &extent);
} }
@ -250,9 +250,9 @@ class TextureFormatTest : public DawnTest {
renderPass.EndPass(); renderPass.EndPass();
{ {
wgpu::BufferCopyView bufferView = utils::CreateBufferCopyView(readbackBuffer, 0, 256); wgpu::ImageCopyBuffer bufferView = utils::CreateImageCopyBuffer(readbackBuffer, 0, 256);
wgpu::TextureCopyView textureView = wgpu::ImageCopyTexture textureView =
utils::CreateTextureCopyView(renderTarget, 0, {0, 0, 0}); utils::CreateImageCopyTexture(renderTarget, 0, {0, 0, 0});
wgpu::Extent3D extent{width, 1, 1}; wgpu::Extent3D extent{width, 1, 1};
encoder.CopyTextureToBuffer(&textureView, &bufferView, &extent); encoder.CopyTextureToBuffer(&textureView, &bufferView, &extent);
} }

View File

@ -147,12 +147,12 @@ class TextureViewSamplingTest : public DawnTest {
std::vector<RGBA8> data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue)); std::vector<RGBA8> data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue));
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc); device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureBytesPerRowAlignment); utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(mTexture, level, {0, 0, layer}); utils::CreateImageCopyTexture(mTexture, level, {0, 0, layer});
wgpu::Extent3D copySize = {texWidth, texHeight, 1}; wgpu::Extent3D copySize = {texWidth, texHeight, 1};
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
} }
} }
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();

View File

@ -157,14 +157,14 @@ TEST_P(TextureZeroInitTest, CopyMultipleTextureArrayLayersToBufferSource) {
{kSize, kSize, kArrayLayers}, kColorFormat); {kSize, kSize, kArrayLayers}, kColorFormat);
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
const wgpu::BufferCopyView bufferCopyView = const wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(buffer, 0, bytesPerRow, kSize); utils::CreateImageCopyBuffer(buffer, 0, bytesPerRow, kSize);
const wgpu::TextureCopyView textureCopyView = const wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
const wgpu::Extent3D copySize = {kSize, kSize, kArrayLayers}; const wgpu::Extent3D copySize = {kSize, kSize, kArrayLayers};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commandBuffer = encoder.Finish(); wgpu::CommandBuffer commandBuffer = encoder.Finish();
// Expect texture to be lazy initialized. // Expect texture to be lazy initialized.
@ -279,13 +279,13 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * sizeof(uint32_t)); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * sizeof(uint32_t));
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
@ -310,13 +310,13 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * sizeof(uint16_t)); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * sizeof(uint16_t));
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize / 2, kSize, 1}; wgpu::Extent3D copySize = {kSize / 2, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -344,14 +344,14 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureMultipleArrayLayers) {
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
const wgpu::BufferCopyView bufferCopyView = const wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize, kSize); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize, kSize);
const wgpu::TextureCopyView textureCopyView = const wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer}); utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
const wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount}; const wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// The copy overwrites the whole subresources so we don't need to do lazy initialization on // The copy overwrites the whole subresources so we don't need to do lazy initialization on
@ -374,8 +374,8 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
1, 1, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc, kColorFormat); 1, 1, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc, kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor); wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
wgpu::TextureDescriptor dstDescriptor = wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1, CreateTextureDescriptor(1, 1,
@ -384,13 +384,13 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
kColorFormat); kColorFormat);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor); wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &copySize); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -418,19 +418,19 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 100); std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 100);
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands); queue.Submit(1, &commands);
} }
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
wgpu::TextureDescriptor dstDescriptor = wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1, CreateTextureDescriptor(1, 1,
@ -439,12 +439,12 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
kColorFormat); kColorFormat);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor); wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize / 2, kSize, 1}; wgpu::Extent3D copySize = {kSize / 2, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &copySize); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -1028,12 +1028,12 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClear) {
wgpu::Buffer bufferDst = utils::CreateBufferFromData( wgpu::Buffer bufferDst = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, bytesPerRow); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, bytesPerRow);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -1063,12 +1063,12 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearUnalignedSize) {
std::vector<uint8_t> data(bufferSize, 100); std::vector<uint8_t> data(bufferSize, 100);
wgpu::Buffer bufferDst = utils::CreateBufferFromData( wgpu::Buffer bufferDst = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, bytesPerRow); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, bytesPerRow);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1}; wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -1096,13 +1096,13 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearWithMultiArrayLayers) {
wgpu::Buffer bufferDst = utils::CreateBufferFromData( wgpu::Buffer bufferDst = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(bufferDst, 0, kSize * kFormatBlockByteSize); utils::CreateImageCopyBuffer(bufferDst, 0, kSize * kFormatBlockByteSize);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 1}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 1});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -1131,12 +1131,12 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 1); std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 1);
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// Expect 0 lazy clears because the texture will be completely copied to // Expect 0 lazy clears because the texture will be completely copied to
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
@ -1276,13 +1276,13 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
std::vector<uint8_t> data(kFormatBlockByteSize * mipSize * mipSize, 2); std::vector<uint8_t> data(kFormatBlockByteSize * mipSize * mipSize, 2);
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, mipSize * kFormatBlockByteSize); utils::CreateImageCopyBuffer(stagingBuffer, 0, mipSize * kFormatBlockByteSize);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(sampleTexture, 1, {0, 0, 0}); utils::CreateImageCopyTexture(sampleTexture, 1, {0, 0, 0});
wgpu::Extent3D copySize = {mipSize, mipSize, 1}; wgpu::Extent3D copySize = {mipSize, mipSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// Expect 0 lazy clears because the texture subresource will be completely copied to // Expect 0 lazy clears because the texture subresource will be completely copied to
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
@ -1353,13 +1353,13 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 2); std::vector<uint8_t> data(kFormatBlockByteSize * kSize * kSize, 2);
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData( wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc); device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize); utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(sampleTexture, 0, {0, 0, 1}); utils::CreateImageCopyTexture(sampleTexture, 0, {0, 0, 1});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copySize); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// Expect 0 lazy clears because the texture subresource will be completely copied to // Expect 0 lazy clears because the texture subresource will be completely copied to
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
@ -1441,12 +1441,14 @@ TEST_P(TextureZeroInitTest, CopyTextureToBufferNonRenderableUnaligned) {
wgpu::Buffer buffer = utils::CreateBufferFromData(device, initialBufferData.data(), wgpu::Buffer buffer = utils::CreateBufferFromData(device, initialBufferData.data(),
bufferSize, wgpu::BufferUsage::CopyDst); bufferSize, wgpu::BufferUsage::CopyDst);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture =
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(buffer, 0, bytesPerRow); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateImageCopyBuffer(buffer, 0, bytesPerRow);
wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1}; wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &copySize); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
@ -1462,7 +1464,7 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) {
1, 1, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc, kColorFormat); 1, 1, wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc, kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor); wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize, kSize, 1}; wgpu::Extent3D copySize = {kSize, kSize, 1};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1477,8 +1479,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) {
{100, 100, 100, 100}); {100, 100, 100, 100});
// The write overwrites the whole texture so we don't need to do lazy initialization. // The write overwrites the whole texture so we don't need to do lazy initialization.
EXPECT_LAZY_CLEAR(0u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture initialized to be true // Expect texture initialized to be true
@ -1496,7 +1498,7 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) {
kColorFormat); kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor); wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {kSize / 2, kSize, 1}; wgpu::Extent3D copySize = {kSize / 2, kSize, 1};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1510,8 +1512,8 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) {
sizeof(RGBA8), sizeof(RGBA8),
{100, 100, 100, 100}); {100, 100, 100, 100});
EXPECT_LAZY_CLEAR(1u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture initialized to be true // Expect texture initialized to be true
@ -1534,8 +1536,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
constexpr uint32_t kBaseArrayLayer = 2u; constexpr uint32_t kBaseArrayLayer = 2u;
constexpr uint32_t kCopyLayerCount = 3u; constexpr uint32_t kCopyLayerCount = 3u;
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer}); utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount}; wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1551,8 +1553,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
// The write overwrites the whole subresources so we don't need to do lazy initialization on // The write overwrites the whole subresources so we don't need to do lazy initialization on
// them. // them.
EXPECT_LAZY_CLEAR(0u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture subresource initialized to be true // Expect texture subresource initialized to be true
@ -1576,8 +1578,8 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
constexpr uint32_t kBaseArrayLayer = 2u; constexpr uint32_t kBaseArrayLayer = 2u;
constexpr uint32_t kCopyLayerCount = 3u; constexpr uint32_t kCopyLayerCount = 3u;
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer}); utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
wgpu::Extent3D copySize = {kSize / 2, kSize, kCopyLayerCount}; wgpu::Extent3D copySize = {kSize / 2, kSize, kCopyLayerCount};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1591,8 +1593,8 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
sizeof(RGBA8), sizeof(RGBA8),
{100, 100, 100, 100}); {100, 100, 100, 100});
EXPECT_LAZY_CLEAR(1u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture subresource initialized to be true // Expect texture subresource initialized to be true
@ -1618,8 +1620,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
constexpr uint32_t kMipLevel = 2; constexpr uint32_t kMipLevel = 2;
constexpr uint32_t kMipSize = kSize >> kMipLevel; constexpr uint32_t kMipSize = kSize >> kMipLevel;
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, kMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(texture, kMipLevel, {0, 0, 0});
wgpu::Extent3D copySize = {kMipSize, kMipSize, 1}; wgpu::Extent3D copySize = {kMipSize, kMipSize, 1};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1634,8 +1636,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
{100, 100, 100, 100}); {100, 100, 100, 100});
// The write overwrites the whole texture so we don't need to do lazy initialization. // The write overwrites the whole texture so we don't need to do lazy initialization.
EXPECT_LAZY_CLEAR(0u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture initialized to be true // Expect texture initialized to be true
@ -1656,8 +1658,8 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
constexpr uint32_t kMipLevel = 2; constexpr uint32_t kMipLevel = 2;
constexpr uint32_t kMipSize = kSize >> kMipLevel; constexpr uint32_t kMipSize = kSize >> kMipLevel;
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, kMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(texture, kMipLevel, {0, 0, 0});
wgpu::Extent3D copySize = {kMipSize / 2, kMipSize, 1}; wgpu::Extent3D copySize = {kMipSize / 2, kMipSize, 1};
wgpu::TextureDataLayout textureDataLayout; wgpu::TextureDataLayout textureDataLayout;
@ -1671,8 +1673,8 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
sizeof(RGBA8), sizeof(RGBA8),
{100, 100, 100, 100}); {100, 100, 100, 100});
EXPECT_LAZY_CLEAR(1u, EXPECT_LAZY_CLEAR(
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8), 1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize)); &textureDataLayout, &copySize));
// Expect texture initialized to be true // Expect texture initialized to be true
@ -1740,14 +1742,14 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
// Copy texture data from a staging buffer to the destination texture. // Copy texture data from a staging buffer to the destination texture.
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(), wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(),
wgpu::BufferUsage::CopySrc); wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(stagingBuffer, 0, copyBytesPerRow, copyHeightInBlock); utils::CreateImageCopyBuffer(stagingBuffer, 0, copyBytesPerRow, copyHeightInBlock);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView( wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
bcCompressedTexture, viewMipmapLevel, {0, 0, baseArrayLayer}); bcCompressedTexture, viewMipmapLevel, {0, 0, baseArrayLayer});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &copyExtent3D); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyExtent3D);
wgpu::CommandBuffer copy = encoder.Finish(); wgpu::CommandBuffer copy = encoder.Finish();
EXPECT_LAZY_CLEAR(lazyClearCount, queue.Submit(1, &copy)); EXPECT_LAZY_CLEAR(lazyClearCount, queue.Submit(1, &copy));
} }
@ -1975,8 +1977,8 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D, InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D,
kViewMipLevel, 0, 0u); kViewMipLevel, 0, 0u);
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, kViewMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
// create dstTexture that we will copy to // create dstTexture that we will copy to
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor( wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
@ -1985,11 +1987,11 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
utils::kBCFormats[0]); utils::kBCFormats[0]);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor); wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, kViewMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(dstTexture, kViewMipLevel, {0, 0, 0});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &copyExtent3D); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copyExtent3D);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// the dstTexture does not need to be lazy cleared since it's fully copied to // the dstTexture does not need to be lazy cleared since it's fully copied to
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands)); EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
@ -2022,8 +2024,8 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D, InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D,
kViewMipLevel, 0, 1u); kViewMipLevel, 0, 1u);
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, kViewMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
// create dstTexture that we will copy to // create dstTexture that we will copy to
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor( wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
@ -2032,11 +2034,11 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
utils::kBCFormats[0]); utils::kBCFormats[0]);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor); wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, kViewMipLevel, {0, 0, 0}); utils::CreateImageCopyTexture(dstTexture, kViewMipLevel, {0, 0, 0});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &copyExtent3D); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copyExtent3D);
wgpu::CommandBuffer commands = encoder.Finish(); wgpu::CommandBuffer commands = encoder.Finish();
// expect 1 lazy clear count since the dstTexture needs to be lazy cleared when we only copy to // expect 1 lazy clear count since the dstTexture needs to be lazy cleared when we only copy to
// half texture // half texture

View File

@ -96,10 +96,10 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
// Copy into the layer of the material array. // Copy into the layer of the material array.
{ {
wgpu::TextureCopyView sourceView; wgpu::ImageCopyTexture sourceView;
sourceView.texture = mUploadTexture; sourceView.texture = mUploadTexture;
wgpu::TextureCopyView destView; wgpu::ImageCopyTexture destView;
destView.texture = mMaterials; destView.texture = mMaterials;
destView.origin.z = layerUploaded; destView.origin.z = layerUploaded;

View File

@ -78,13 +78,13 @@ class CopyCommandTest : public ValidationTest {
wgpu::Origin3D destOrigin, wgpu::Origin3D destOrigin,
wgpu::Extent3D extent3D, wgpu::Extent3D extent3D,
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) { wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(srcBuffer, srcOffset, srcBytesPerRow, srcRowsPerImage); utils::CreateImageCopyBuffer(srcBuffer, srcOffset, srcBytesPerRow, srcRowsPerImage);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(destTexture, destLevel, destOrigin, aspect); utils::CreateImageCopyTexture(destTexture, destLevel, destOrigin, aspect);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &extent3D); encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent3D);
ValidateExpectation(encoder, expectation); ValidateExpectation(encoder, expectation);
} }
@ -99,13 +99,13 @@ class CopyCommandTest : public ValidationTest {
uint32_t destRowsPerImage, uint32_t destRowsPerImage,
wgpu::Extent3D extent3D, wgpu::Extent3D extent3D,
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) { wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
wgpu::BufferCopyView bufferCopyView = wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateBufferCopyView(destBuffer, destOffset, destBytesPerRow, destRowsPerImage); utils::CreateImageCopyBuffer(destBuffer, destOffset, destBytesPerRow, destRowsPerImage);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(srcTexture, srcLevel, srcOrigin, aspect); utils::CreateImageCopyTexture(srcTexture, srcLevel, srcOrigin, aspect);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D); encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
ValidateExpectation(encoder, expectation); ValidateExpectation(encoder, expectation);
} }
@ -119,13 +119,13 @@ class CopyCommandTest : public ValidationTest {
wgpu::Origin3D dstOrigin, wgpu::Origin3D dstOrigin,
wgpu::Extent3D extent3D, wgpu::Extent3D extent3D,
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) { wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
wgpu::TextureCopyView srcTextureCopyView = wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateTextureCopyView(srcTexture, srcLevel, srcOrigin, aspect); utils::CreateImageCopyTexture(srcTexture, srcLevel, srcOrigin, aspect);
wgpu::TextureCopyView dstTextureCopyView = wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateTextureCopyView(dstTexture, dstLevel, dstOrigin, aspect); utils::CreateImageCopyTexture(dstTexture, dstLevel, dstOrigin, aspect);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &extent3D); encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &extent3D);
ValidateExpectation(encoder, expectation); ValidateExpectation(encoder, expectation);
} }
@ -666,20 +666,20 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
errorTextureDescriptor.size.depth = 0; errorTextureDescriptor.size.depth = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor)); ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0); wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
wgpu::TextureCopyView errorTextureCopyView = wgpu::ImageCopyTexture errorImageCopyTexture =
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(errorTexture, 0, {0, 0, 0});
wgpu::Extent3D extent3D = {0, 0, 0}; wgpu::Extent3D extent3D = {0, 0, 0};
{ {
wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst); wgpu::TextureUsage::CopyDst);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(destination, 0, {0, 0, 0}); utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&errorBufferCopyView, &textureCopyView, &extent3D); encoder.CopyBufferToTexture(&errorImageCopyBuffer, &imageCopyTexture, &extent3D);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
@ -687,10 +687,10 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
wgpu::Buffer source = CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc); wgpu::Buffer source = CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(source, 0, 0, 0);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&bufferCopyView, &errorTextureCopyView, &extent3D); encoder.CopyBufferToTexture(&imageCopyBuffer, &errorImageCopyTexture, &extent3D);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
} }
@ -1255,9 +1255,9 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
errorTextureDescriptor.size.depth = 0; errorTextureDescriptor.size.depth = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor)); ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0); wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
wgpu::TextureCopyView errorTextureCopyView = wgpu::ImageCopyTexture errorImageCopyTexture =
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(errorTexture, 0, {0, 0, 0});
wgpu::Extent3D extent3D = {0, 0, 0}; wgpu::Extent3D extent3D = {0, 0, 0};
@ -1265,21 +1265,21 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1); uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
wgpu::Buffer source = CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc); wgpu::Buffer source = CreateBuffer(bufferSize, wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(source, 0, 0, 0); wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(source, 0, 0, 0);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&errorTextureCopyView, &bufferCopyView, &extent3D); encoder.CopyTextureToBuffer(&errorImageCopyTexture, &imageCopyBuffer, &extent3D);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
{ {
wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst); wgpu::TextureUsage::CopyDst);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(destination, 0, {0, 0, 0}); utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&textureCopyView, &errorBufferCopyView, &extent3D); encoder.CopyTextureToBuffer(&imageCopyTexture, &errorImageCopyBuffer, &extent3D);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
} }
@ -1533,13 +1533,13 @@ TEST_F(CopyCommandTest_T2T, Success) {
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 1}, destination, 0, {0, 0, 1}, TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 1}, destination, 0, {0, 0, 1},
{16, 16, 1}); {16, 16, 1});
// Copy multiple slices (srcTextureCopyView.arrayLayer + copySize.depth == // Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depth ==
// srcTextureCopyView.texture.arrayLayerCount) // srcImageCopyTexture.texture.arrayLayerCount)
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 2}, destination, 0, {0, 0, 0}, TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 2}, destination, 0, {0, 0, 0},
{16, 16, 2}); {16, 16, 2});
// Copy multiple slices (dstTextureCopyView.arrayLayer + copySize.depth == // Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depth ==
// dstTextureCopyView.texture.arrayLayerCount) // dstImageCopyTexture.texture.arrayLayerCount)
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, {0, 0, 2}, TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, {0, 0, 2},
{16, 16, 2}); {16, 16, 2});
} }

View File

@ -63,10 +63,10 @@ namespace {
textureDataLayout.bytesPerRow = dataBytesPerRow; textureDataLayout.bytesPerRow = dataBytesPerRow;
textureDataLayout.rowsPerImage = dataRowsPerImage; textureDataLayout.rowsPerImage = dataRowsPerImage;
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, texLevel, texOrigin, aspect); utils::CreateImageCopyTexture(texture, texLevel, texOrigin, aspect);
queue.WriteTexture(&textureCopyView, data.data(), dataSize, &textureDataLayout, &size); queue.WriteTexture(&imageCopyTexture, data.data(), dataSize, &textureDataLayout, &size);
} }
void TestWriteTextureExactDataSize(uint32_t bytesPerRow, void TestWriteTextureExactDataSize(uint32_t bytesPerRow,
@ -361,8 +361,8 @@ namespace {
errorTextureDescriptor.size.depth = 0; errorTextureDescriptor.size.depth = 0;
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture =
device.CreateTexture(&errorTextureDescriptor)); device.CreateTexture(&errorTextureDescriptor));
wgpu::TextureCopyView errorTextureCopyView = wgpu::ImageCopyTexture errorImageCopyTexture =
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(errorTexture, 0, {0, 0, 0});
wgpu::Extent3D extent3D = {0, 0, 0}; wgpu::Extent3D extent3D = {0, 0, 0};
@ -370,7 +370,7 @@ namespace {
std::vector<uint8_t> data(4); std::vector<uint8_t> data(4);
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 0, 0); wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 0, 0);
ASSERT_DEVICE_ERROR(queue.WriteTexture(&errorTextureCopyView, data.data(), 4, ASSERT_DEVICE_ERROR(queue.WriteTexture(&errorImageCopyTexture, data.data(), 4,
&textureDataLayout, &extent3D)); &textureDataLayout, &extent3D));
} }
} }

View File

@ -1286,8 +1286,8 @@ namespace {
wgpu::TextureView view0 = texture0.CreateView(); wgpu::TextureView view0 = texture0.CreateView();
wgpu::TextureView view1 = texture1.CreateView(); wgpu::TextureView view1 = texture1.CreateView();
wgpu::TextureCopyView srcView = utils::CreateTextureCopyView(texture0, 0, {0, 0, 0}); wgpu::ImageCopyTexture srcView = utils::CreateImageCopyTexture(texture0, 0, {0, 0, 0});
wgpu::TextureCopyView dstView = utils::CreateTextureCopyView(texture1, 0, {0, 0, 0}); wgpu::ImageCopyTexture dstView = utils::CreateImageCopyTexture(texture1, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
// Use the texture as both copy dst and render attachment in render pass // Use the texture as both copy dst and render attachment in render pass

View File

@ -123,14 +123,14 @@ namespace {
wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled); wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureCopyView srcCopyView = utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}); wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
wgpu::TextureCopyView dstCopyView = utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}); wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
@ -142,26 +142,26 @@ namespace {
wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled); wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureCopyView srcCopyView = wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only); srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
wgpu::TextureCopyView dstCopyView = wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only); dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
srcCopyView = copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0},
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only); wgpu::TextureAspect::Plane1Only);
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
} }
@ -176,14 +176,14 @@ namespace {
bufferDescriptor.usage = wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopyDst;
wgpu::Buffer dstBuffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer dstBuffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView srcCopyView = utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}); wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
wgpu::BufferCopyView dstCopyView = utils::CreateBufferCopyView(dstBuffer, 0, 4); wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(dstBuffer, 0, 4);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
@ -197,25 +197,25 @@ namespace {
bufferDescriptor.usage = wgpu::BufferUsage::CopyDst; bufferDescriptor.usage = wgpu::BufferUsage::CopyDst;
wgpu::Buffer dstBuffer = device.CreateBuffer(&bufferDescriptor); wgpu::Buffer dstBuffer = device.CreateBuffer(&bufferDescriptor);
wgpu::TextureCopyView srcCopyView = wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only); srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
wgpu::BufferCopyView dstCopyView = utils::CreateBufferCopyView(dstBuffer, 0, 4); wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(dstBuffer, 0, 4);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
srcCopyView = copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0},
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only); wgpu::TextureAspect::Plane1Only);
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, &copySize); encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
} }
@ -230,14 +230,14 @@ namespace {
wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled); wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::BufferCopyView srcCopyView = utils::CreateBufferCopyView(srcBuffer, 0, 12, 4); wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(srcBuffer, 0, 12, 4);
wgpu::TextureCopyView dstCopyView = utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}); wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
@ -251,25 +251,25 @@ namespace {
wgpu::Texture dstTexture = CreateVideoTextureForTest( wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled); wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::BufferCopyView srcCopyView = utils::CreateBufferCopyView(srcBuffer, 0, 12, 4); wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(srcBuffer, 0, 12, 4);
wgpu::TextureCopyView dstCopyView = wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only); dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
dstCopyView = copyDst = utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0},
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only); wgpu::TextureAspect::Plane1Only);
{ {
wgpu::CommandEncoder encoder = device.CreateCommandEncoder(); wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, &copySize); encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
ASSERT_DEVICE_ERROR(encoder.Finish()); ASSERT_DEVICE_ERROR(encoder.Finish());
} }
} }
@ -306,15 +306,16 @@ namespace {
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 4, 4); wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 4, 4);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
std::vector<uint8_t> dummyData(4, 0); std::vector<uint8_t> dummyData(4, 0);
wgpu::Extent3D writeSize = {1, 1, 1}; wgpu::Extent3D writeSize = {1, 1, 1};
wgpu::Queue queue = device.GetQueue(); wgpu::Queue queue = device.GetQueue();
ASSERT_DEVICE_ERROR(queue.WriteTexture(&textureCopyView, dummyData.data(), dummyData.size(), ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, dummyData.data(),
&textureDataLayout, &writeSize)); dummyData.size(), &textureDataLayout, &writeSize));
} }
// Tests writing into a multi-planar format per plane fails. // Tests writing into a multi-planar format per plane fails.
@ -323,15 +324,15 @@ namespace {
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled); wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 12, 4); wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 12, 4);
wgpu::TextureCopyView textureCopyView = wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateTextureCopyView(texture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only); utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
std::vector<uint8_t> dummmyData(4, 0); std::vector<uint8_t> dummmyData(4, 0);
wgpu::Extent3D writeSize = {1, 1, 1}; wgpu::Extent3D writeSize = {1, 1, 1};
wgpu::Queue queue = device.GetQueue(); wgpu::Queue queue = device.GetQueue();
ASSERT_DEVICE_ERROR(queue.WriteTexture(&textureCopyView, dummmyData.data(), ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, dummmyData.data(),
dummmyData.size(), &textureDataLayout, &writeSize)); dummmyData.size(), &textureDataLayout, &writeSize));
} }

View File

@ -339,8 +339,9 @@ namespace dawn_native { namespace vulkan {
wgpu::Queue dawnQueue, wgpu::Queue dawnQueue,
wgpu::Texture source, wgpu::Texture source,
wgpu::Texture destination) { wgpu::Texture destination) {
wgpu::TextureCopyView copySrc = utils::CreateTextureCopyView(source, 0, {0, 0, 0}); wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(source, 0, {0, 0, 0});
wgpu::TextureCopyView copyDst = utils::CreateTextureCopyView(destination, 0, {0, 0, 0}); wgpu::ImageCopyTexture copyDst =
utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
@ -531,9 +532,9 @@ namespace dawn_native { namespace vulkan {
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc); wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc);
// Copy |deviceWrappedTexture| into |copyDstBuffer| // Copy |deviceWrappedTexture| into |copyDstBuffer|
wgpu::TextureCopyView copySrc = wgpu::ImageCopyTexture copySrc =
utils::CreateTextureCopyView(deviceWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(deviceWrappedTexture, 0, {0, 0, 0});
wgpu::BufferCopyView copyDst = utils::CreateBufferCopyView(copyDstBuffer, 0, 256); wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(copyDstBuffer, 0, 256);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
@ -585,9 +586,9 @@ namespace dawn_native { namespace vulkan {
utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201}); utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201});
// Copy |copySrcBuffer| into |secondDeviceWrappedTexture| // Copy |copySrcBuffer| into |secondDeviceWrappedTexture|
wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, 256); wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(copySrcBuffer, 0, 256);
wgpu::TextureCopyView copyDst = wgpu::ImageCopyTexture copyDst =
utils::CreateTextureCopyView(secondDeviceWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(secondDeviceWrappedTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
@ -816,10 +817,10 @@ namespace dawn_native { namespace vulkan {
{ {
wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData( wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData(
secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc); secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView copySrc = wgpu::ImageCopyBuffer copySrc =
utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow); utils::CreateImageCopyBuffer(copySrcBuffer, 0, bytesPerRow);
wgpu::TextureCopyView copyDst = wgpu::ImageCopyTexture copyDst =
utils::CreateTextureCopyView(wrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(wrappedTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};
wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder(); wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder();
@ -843,10 +844,10 @@ namespace dawn_native { namespace vulkan {
copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&copyDesc); wgpu::Buffer copyDstBuffer = device.CreateBuffer(&copyDesc);
{ {
wgpu::TextureCopyView copySrc = wgpu::ImageCopyTexture copySrc =
utils::CreateTextureCopyView(nextWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(nextWrappedTexture, 0, {0, 0, 0});
wgpu::BufferCopyView copyDst = wgpu::ImageCopyBuffer copyDst =
utils::CreateBufferCopyView(copyDstBuffer, 0, bytesPerRow); utils::CreateImageCopyBuffer(copyDstBuffer, 0, bytesPerRow);
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};

View File

@ -455,12 +455,12 @@ namespace dawn_native { namespace vulkan {
wgpu::Queue dawnQueue, wgpu::Queue dawnQueue,
wgpu::Texture source, wgpu::Texture source,
wgpu::Texture destination) { wgpu::Texture destination) {
wgpu::TextureCopyView copySrc; wgpu::ImageCopyTexture copySrc;
copySrc.texture = source; copySrc.texture = source;
copySrc.mipLevel = 0; copySrc.mipLevel = 0;
copySrc.origin = {0, 0, 0}; copySrc.origin = {0, 0, 0};
wgpu::TextureCopyView copyDst; wgpu::ImageCopyTexture copyDst;
copyDst.texture = destination; copyDst.texture = destination;
copyDst.mipLevel = 0; copyDst.mipLevel = 0;
copyDst.origin = {0, 0, 0}; copyDst.origin = {0, 0, 0};
@ -665,9 +665,9 @@ namespace dawn_native { namespace vulkan {
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc); wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc);
// Copy |deviceWrappedTexture| into |copyDstBuffer| // Copy |deviceWrappedTexture| into |copyDstBuffer|
wgpu::TextureCopyView copySrc = wgpu::ImageCopyTexture copySrc =
utils::CreateTextureCopyView(deviceWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(deviceWrappedTexture, 0, {0, 0, 0});
wgpu::BufferCopyView copyDst = utils::CreateBufferCopyView(copyDstBuffer, 0, 256); wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(copyDstBuffer, 0, 256);
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
@ -721,9 +721,9 @@ namespace dawn_native { namespace vulkan {
utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201}); utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201});
// Copy |copySrcBuffer| into |secondDeviceWrappedTexture| // Copy |copySrcBuffer| into |secondDeviceWrappedTexture|
wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, 256); wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(copySrcBuffer, 0, 256);
wgpu::TextureCopyView copyDst = wgpu::ImageCopyTexture copyDst =
utils::CreateTextureCopyView(secondDeviceWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(secondDeviceWrappedTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {1, 1, 1}; wgpu::Extent3D copySize = {1, 1, 1};
@ -979,10 +979,10 @@ namespace dawn_native { namespace vulkan {
{ {
wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData( wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData(
secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc); secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc);
wgpu::BufferCopyView copySrc = wgpu::ImageCopyBuffer copySrc =
utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow); utils::CreateImageCopyBuffer(copySrcBuffer, 0, bytesPerRow);
wgpu::TextureCopyView copyDst = wgpu::ImageCopyTexture copyDst =
utils::CreateTextureCopyView(wrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(wrappedTexture, 0, {0, 0, 0});
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};
wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder(); wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder();
@ -1009,10 +1009,10 @@ namespace dawn_native { namespace vulkan {
copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst; copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&copyDesc); wgpu::Buffer copyDstBuffer = device.CreateBuffer(&copyDesc);
{ {
wgpu::TextureCopyView copySrc = wgpu::ImageCopyTexture copySrc =
utils::CreateTextureCopyView(nextWrappedTexture, 0, {0, 0, 0}); utils::CreateImageCopyTexture(nextWrappedTexture, 0, {0, 0, 0});
wgpu::BufferCopyView copyDst = wgpu::ImageCopyBuffer copyDst =
utils::CreateBufferCopyView(copyDstBuffer, 0, bytesPerRow); utils::CreateImageCopyBuffer(copyDstBuffer, 0, bytesPerRow);
wgpu::Extent3D copySize = {width, height, 1}; wgpu::Extent3D copySize = {width, height, 1};

View File

@ -123,13 +123,14 @@ namespace utils {
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc; descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor); wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0}); wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
wgpu::TextureDataLayout textureDataLayout = wgpu::TextureDataLayout textureDataLayout =
utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined); utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined);
wgpu::Extent3D copyExtent = {1, 1, 1}; wgpu::Extent3D copyExtent = {1, 1, 1};
// WriteTexture with exactly 1 byte of data. // WriteTexture with exactly 1 byte of data.
device.GetQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout, device.GetQueue().WriteTexture(&imageCopyTexture, data.data(), 1, &textureDataLayout,
&copyExtent); &copyExtent);
} }
} // namespace utils } // namespace utils

View File

@ -268,28 +268,28 @@ namespace utils {
return BasicRenderPass(width, height, color); return BasicRenderPass(width, height, color);
} }
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer, wgpu::ImageCopyBuffer CreateImageCopyBuffer(wgpu::Buffer buffer,
uint64_t offset, uint64_t offset,
uint32_t bytesPerRow, uint32_t bytesPerRow,
uint32_t rowsPerImage) { uint32_t rowsPerImage) {
wgpu::BufferCopyView bufferCopyView = {}; wgpu::ImageCopyBuffer imageCopyBuffer = {};
bufferCopyView.buffer = buffer; imageCopyBuffer.buffer = buffer;
bufferCopyView.layout = CreateTextureDataLayout(offset, bytesPerRow, rowsPerImage); imageCopyBuffer.layout = CreateTextureDataLayout(offset, bytesPerRow, rowsPerImage);
return bufferCopyView; return imageCopyBuffer;
} }
wgpu::TextureCopyView CreateTextureCopyView(wgpu::Texture texture, wgpu::ImageCopyTexture CreateImageCopyTexture(wgpu::Texture texture,
uint32_t mipLevel, uint32_t mipLevel,
wgpu::Origin3D origin, wgpu::Origin3D origin,
wgpu::TextureAspect aspect) { wgpu::TextureAspect aspect) {
wgpu::TextureCopyView textureCopyView; wgpu::ImageCopyTexture imageCopyTexture;
textureCopyView.texture = texture; imageCopyTexture.texture = texture;
textureCopyView.mipLevel = mipLevel; imageCopyTexture.mipLevel = mipLevel;
textureCopyView.origin = origin; imageCopyTexture.origin = origin;
textureCopyView.aspect = aspect; imageCopyTexture.aspect = aspect;
return textureCopyView; return imageCopyTexture;
} }
wgpu::TextureDataLayout CreateTextureDataLayout(uint64_t offset, wgpu::TextureDataLayout CreateTextureDataLayout(uint64_t offset,

View File

@ -50,11 +50,11 @@ namespace utils {
return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage); return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage);
} }
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer, wgpu::ImageCopyBuffer CreateImageCopyBuffer(wgpu::Buffer buffer,
uint64_t offset, uint64_t offset,
uint32_t bytesPerRow, uint32_t bytesPerRow,
uint32_t rowsPerImage = wgpu::kCopyStrideUndefined); uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
wgpu::TextureCopyView CreateTextureCopyView( wgpu::ImageCopyTexture CreateImageCopyTexture(
wgpu::Texture texture, wgpu::Texture texture,
uint32_t level, uint32_t level,
wgpu::Origin3D origin, wgpu::Origin3D origin,