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:
parent
2015b2f169
commit
80915849ce
54
dawn.json
54
dawn.json
|
@ -293,12 +293,8 @@
|
|||
]
|
||||
},
|
||||
"buffer copy view": {
|
||||
"category": "structure",
|
||||
"extensible": true,
|
||||
"members": [
|
||||
{"name": "layout", "type": "texture data layout"},
|
||||
{"name": "buffer", "type": "buffer"}
|
||||
]
|
||||
"category": "typedef",
|
||||
"type": "image copy buffer"
|
||||
},
|
||||
"buffer descriptor": {
|
||||
"category": "structure",
|
||||
|
@ -417,24 +413,24 @@
|
|||
{
|
||||
"name": "copy buffer to texture",
|
||||
"args": [
|
||||
{"name": "source", "type": "buffer copy view", "annotation": "const*"},
|
||||
{"name": "destination", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "source", "type": "image copy buffer", "annotation": "const*"},
|
||||
{"name": "destination", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "copy size", "type": "extent 3D", "annotation": "const*"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "copy texture to buffer",
|
||||
"args": [
|
||||
{"name": "source", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "destination", "type": "buffer copy view", "annotation": "const*"},
|
||||
{"name": "source", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "destination", "type": "image copy buffer", "annotation": "const*"},
|
||||
{"name": "copy size", "type": "extent 3D", "annotation": "const*"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "copy texture to texture",
|
||||
"args": [
|
||||
{"name": "source", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "destination", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "source", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "destination", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "copy size", "type": "extent 3D", "annotation": "const*"}
|
||||
]
|
||||
},
|
||||
|
@ -929,6 +925,24 @@
|
|||
{"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": {
|
||||
"category": "enum",
|
||||
"values": [
|
||||
|
@ -1146,7 +1160,7 @@
|
|||
{
|
||||
"name": "write texture",
|
||||
"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 size", "type": "size_t"},
|
||||
{"name": "data layout", "type": "texture data layout", "annotation": "const*"},
|
||||
|
@ -1157,8 +1171,8 @@
|
|||
"name": "copy texture for browser",
|
||||
"extensible": true,
|
||||
"args": [
|
||||
{"name": "source", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "destination", "type": "texture copy view", "annotation": "const*"},
|
||||
{"name": "source", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "destination", "type": "image copy texture", "annotation": "const*"},
|
||||
{"name": "copy size", "type": "extent 3D", "annotation": "const*"},
|
||||
{"name": "options", "type": "copy texture for browser options", "annotation": "const*"}
|
||||
]
|
||||
|
@ -1757,14 +1771,8 @@
|
|||
]
|
||||
},
|
||||
"texture copy view": {
|
||||
"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"}
|
||||
]
|
||||
"category": "typedef",
|
||||
"type": "image copy texture"
|
||||
},
|
||||
"texture data layout": {
|
||||
"category": "structure",
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
],
|
||||
"queue write texture internal": [
|
||||
{"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 size", "type": "uint64_t"},
|
||||
{"name": "data layout", "type": "texture data layout", "annotation": "const*"},
|
||||
|
|
|
@ -72,12 +72,13 @@ void initTextures() {
|
|||
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 4 * 1024);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, 4 * 1024);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {1024, 1024, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
|
|
|
@ -77,9 +77,10 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(const TextureCopyView& src) {
|
||||
MaybeError ValidateTextureDepthStencilToBufferCopyRestrictions(
|
||||
const ImageCopyTexture& src) {
|
||||
Aspect aspectUsed;
|
||||
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByTextureCopyView(src));
|
||||
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByImageCopyTexture(src));
|
||||
if (aspectUsed == Aspect::Depth) {
|
||||
switch (src.texture->GetFormat().format) {
|
||||
case wgpu::TextureFormat::Depth24Plus:
|
||||
|
@ -621,15 +622,15 @@ namespace dawn_native {
|
|||
});
|
||||
}
|
||||
|
||||
void CommandEncoder::CopyBufferToTexture(const BufferCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void CommandEncoder::CopyBufferToTexture(const ImageCopyBuffer* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
if (GetDevice()->IsValidationEnabled()) {
|
||||
DAWN_TRY(ValidateBufferCopyView(GetDevice(), *source));
|
||||
DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *source));
|
||||
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(ValidateTextureSampleCountInBufferCopyCommands(destination->texture));
|
||||
|
||||
|
@ -676,17 +677,17 @@ namespace dawn_native {
|
|||
});
|
||||
}
|
||||
|
||||
void CommandEncoder::CopyTextureToBuffer(const TextureCopyView* source,
|
||||
const BufferCopyView* destination,
|
||||
void CommandEncoder::CopyTextureToBuffer(const ImageCopyTexture* source,
|
||||
const ImageCopyBuffer* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
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(ValidateTextureSampleCountInBufferCopyCommands(source->texture));
|
||||
DAWN_TRY(ValidateTextureDepthStencilToBufferCopyRestrictions(*source));
|
||||
|
||||
DAWN_TRY(ValidateBufferCopyView(GetDevice(), *destination));
|
||||
DAWN_TRY(ValidateImageCopyBuffer(GetDevice(), *destination));
|
||||
DAWN_TRY(ValidateCanUseAs(destination->buffer, wgpu::BufferUsage::CopyDst));
|
||||
|
||||
// We validate texture copy range before validating linear texture data,
|
||||
|
@ -730,16 +731,16 @@ namespace dawn_native {
|
|||
});
|
||||
}
|
||||
|
||||
void CommandEncoder::CopyTextureToTexture(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void CommandEncoder::CopyTextureToTexture(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize) {
|
||||
mEncodingContext.TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
|
||||
if (GetDevice()->IsValidationEnabled()) {
|
||||
DAWN_TRY(GetDevice()->ValidateObject(source->texture));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
||||
|
||||
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *source, *copySize));
|
||||
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *destination, *copySize));
|
||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *source, *copySize));
|
||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *copySize));
|
||||
|
||||
DAWN_TRY(
|
||||
ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));
|
||||
|
|
|
@ -49,14 +49,14 @@ namespace dawn_native {
|
|||
BufferBase* destination,
|
||||
uint64_t destinationOffset,
|
||||
uint64_t size);
|
||||
void CopyBufferToTexture(const BufferCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void CopyBufferToTexture(const ImageCopyBuffer* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize);
|
||||
void CopyTextureToBuffer(const TextureCopyView* source,
|
||||
const BufferCopyView* destination,
|
||||
void CopyTextureToBuffer(const ImageCopyTexture* source,
|
||||
const ImageCopyBuffer* destination,
|
||||
const Extent3D* copySize);
|
||||
void CopyTextureToTexture(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void CopyTextureToTexture(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize);
|
||||
|
||||
void InjectValidationError(const char* message);
|
||||
|
|
|
@ -265,11 +265,11 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateBufferCopyView(DeviceBase const* device,
|
||||
const BufferCopyView& bufferCopyView) {
|
||||
DAWN_TRY(device->ValidateObject(bufferCopyView.buffer));
|
||||
if (bufferCopyView.layout.bytesPerRow != wgpu::kCopyStrideUndefined) {
|
||||
if (bufferCopyView.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) {
|
||||
MaybeError ValidateImageCopyBuffer(DeviceBase const* device,
|
||||
const ImageCopyBuffer& imageCopyBuffer) {
|
||||
DAWN_TRY(device->ValidateObject(imageCopyBuffer.buffer));
|
||||
if (imageCopyBuffer.layout.bytesPerRow != wgpu::kCopyStrideUndefined) {
|
||||
if (imageCopyBuffer.layout.bytesPerRow % kTextureBytesPerRowAlignment != 0) {
|
||||
return DAWN_VALIDATION_ERROR("bytesPerRow must be a multiple of 256");
|
||||
}
|
||||
}
|
||||
|
@ -277,9 +277,9 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateTextureCopyView(DeviceBase const* device,
|
||||
const TextureCopyView& textureCopy,
|
||||
const Extent3D& copySize) {
|
||||
MaybeError ValidateImageCopyTexture(DeviceBase const* device,
|
||||
const ImageCopyTexture& textureCopy,
|
||||
const Extent3D& copySize) {
|
||||
const TextureBase* texture = textureCopy.texture;
|
||||
DAWN_TRY(device->ValidateObject(texture));
|
||||
if (textureCopy.mipLevel >= texture->GetNumMipLevels()) {
|
||||
|
@ -305,7 +305,7 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateTextureCopyRange(const TextureCopyView& textureCopy,
|
||||
MaybeError ValidateTextureCopyRange(const ImageCopyTexture& textureCopy,
|
||||
const Extent3D& copySize) {
|
||||
// TODO(jiawei.shao@intel.com): add validations on the texture-to-texture copies within the
|
||||
// same texture.
|
||||
|
@ -357,7 +357,7 @@ namespace dawn_native {
|
|||
|
||||
// Always returns a single aspect (color, stencil, depth, or ith plane for multi-planar
|
||||
// formats).
|
||||
ResultOrError<Aspect> SingleAspectUsedByTextureCopyView(const TextureCopyView& view) {
|
||||
ResultOrError<Aspect> SingleAspectUsedByImageCopyTexture(const ImageCopyTexture& view) {
|
||||
const Format& format = view.texture->GetFormat();
|
||||
switch (view.aspect) {
|
||||
case wgpu::TextureAspect::All:
|
||||
|
@ -382,9 +382,9 @@ namespace dawn_native {
|
|||
}
|
||||
}
|
||||
|
||||
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const TextureCopyView& dst) {
|
||||
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst) {
|
||||
Aspect aspectUsed;
|
||||
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByTextureCopyView(dst));
|
||||
DAWN_TRY_ASSIGN(aspectUsed, SingleAspectUsedByImageCopyTexture(dst));
|
||||
if (aspectUsed == Aspect::Depth) {
|
||||
return DAWN_VALIDATION_ERROR("Cannot copy into the depth aspect of a texture");
|
||||
}
|
||||
|
@ -392,8 +392,8 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError ValidateTextureToTextureCopyRestrictions(const TextureCopyView& src,
|
||||
const TextureCopyView& dst,
|
||||
MaybeError ValidateTextureToTextureCopyRestrictions(const ImageCopyTexture& src,
|
||||
const ImageCopyTexture& dst,
|
||||
const Extent3D& copySize) {
|
||||
const uint32_t srcSamples = src.texture->GetSampleCount();
|
||||
const uint32_t dstSamples = dst.texture->GetSampleCount();
|
||||
|
|
|
@ -48,16 +48,16 @@ namespace dawn_native {
|
|||
uint64_t byteSize,
|
||||
const TexelBlockInfo& blockInfo,
|
||||
const Extent3D& copyExtent);
|
||||
MaybeError ValidateTextureCopyRange(const TextureCopyView& textureCopyView,
|
||||
MaybeError ValidateTextureCopyRange(const ImageCopyTexture& imageCopyTexture,
|
||||
const Extent3D& copySize);
|
||||
ResultOrError<Aspect> SingleAspectUsedByTextureCopyView(const TextureCopyView& view);
|
||||
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const TextureCopyView& dst);
|
||||
ResultOrError<Aspect> SingleAspectUsedByImageCopyTexture(const ImageCopyTexture& view);
|
||||
MaybeError ValidateLinearToDepthStencilCopyRestrictions(const ImageCopyTexture& dst);
|
||||
|
||||
MaybeError ValidateBufferCopyView(DeviceBase const* device,
|
||||
const BufferCopyView& bufferCopyView);
|
||||
MaybeError ValidateTextureCopyView(DeviceBase const* device,
|
||||
const TextureCopyView& textureCopyView,
|
||||
const Extent3D& copySize);
|
||||
MaybeError ValidateImageCopyBuffer(DeviceBase const* device,
|
||||
const ImageCopyBuffer& imageCopyBuffer);
|
||||
MaybeError ValidateImageCopyTexture(DeviceBase const* device,
|
||||
const ImageCopyTexture& imageCopyTexture,
|
||||
const Extent3D& copySize);
|
||||
|
||||
MaybeError ValidateRowsPerImage(const Format& format,
|
||||
uint32_t rowsPerImage,
|
||||
|
@ -71,8 +71,8 @@ namespace dawn_native {
|
|||
|
||||
bool IsRangeOverlapped(uint32_t startA, uint32_t startB, uint32_t length);
|
||||
|
||||
MaybeError ValidateTextureToTextureCopyRestrictions(const TextureCopyView& src,
|
||||
const TextureCopyView& dst,
|
||||
MaybeError ValidateTextureToTextureCopyRestrictions(const ImageCopyTexture& src,
|
||||
const ImageCopyTexture& dst,
|
||||
const Extent3D& copySize);
|
||||
|
||||
MaybeError ValidateCanUseAs(const TextureBase* texture, wgpu::TextureUsage usage);
|
||||
|
|
|
@ -170,15 +170,15 @@ namespace dawn_native {
|
|||
} // anonymous namespace
|
||||
|
||||
MaybeError ValidateCopyTextureForBrowser(DeviceBase* device,
|
||||
const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options) {
|
||||
DAWN_TRY(device->ValidateObject(source->texture));
|
||||
DAWN_TRY(device->ValidateObject(destination->texture));
|
||||
|
||||
DAWN_TRY(ValidateTextureCopyView(device, *source, *copySize));
|
||||
DAWN_TRY(ValidateTextureCopyView(device, *destination, *copySize));
|
||||
DAWN_TRY(ValidateImageCopyTexture(device, *source, *copySize));
|
||||
DAWN_TRY(ValidateImageCopyTexture(device, *destination, *copySize));
|
||||
|
||||
DAWN_TRY(ValidateTextureToTextureCopyRestrictions(*source, *destination, *copySize));
|
||||
|
||||
|
@ -208,8 +208,8 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
MaybeError DoCopyTextureForBrowser(DeviceBase* device,
|
||||
const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options) {
|
||||
// TODO(shaobo.yan@intel.com): In D3D12 and Vulkan, compatible texture format can directly
|
||||
|
|
|
@ -21,18 +21,18 @@
|
|||
namespace dawn_native {
|
||||
class DeviceBase;
|
||||
struct Extent3D;
|
||||
struct TextureCopyView;
|
||||
struct ImageCopyTexture;
|
||||
struct CopyTextureForBrowserOptions;
|
||||
|
||||
MaybeError ValidateCopyTextureForBrowser(DeviceBase* device,
|
||||
const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options);
|
||||
|
||||
MaybeError DoCopyTextureForBrowser(DeviceBase* device,
|
||||
const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options);
|
||||
|
||||
|
|
|
@ -291,7 +291,7 @@ namespace dawn_native {
|
|||
buffer, bufferOffset, size);
|
||||
}
|
||||
|
||||
void QueueBase::WriteTexture(const TextureCopyView* destination,
|
||||
void QueueBase::WriteTexture(const ImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
|
@ -300,7 +300,7 @@ namespace dawn_native {
|
|||
WriteTextureInternal(destination, data, dataSize, dataLayout, writeSize));
|
||||
}
|
||||
|
||||
MaybeError QueueBase::WriteTextureInternal(const TextureCopyView* destination,
|
||||
MaybeError QueueBase::WriteTextureInternal(const ImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
|
@ -318,7 +318,7 @@ namespace dawn_native {
|
|||
return WriteTextureImpl(*destination, data, layout, *writeSize);
|
||||
}
|
||||
|
||||
MaybeError QueueBase::WriteTextureImpl(const TextureCopyView& destination,
|
||||
MaybeError QueueBase::WriteTextureImpl(const ImageCopyTexture& destination,
|
||||
const void* data,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D& writeSizePixel) {
|
||||
|
@ -362,8 +362,8 @@ namespace dawn_native {
|
|||
&textureCopy, writeSizePixel);
|
||||
}
|
||||
|
||||
void QueueBase::CopyTextureForBrowser(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void QueueBase::CopyTextureForBrowser(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options) {
|
||||
GetDevice()->ConsumedError(
|
||||
|
@ -371,8 +371,8 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
MaybeError QueueBase::CopyTextureForBrowserInternal(
|
||||
const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options) {
|
||||
if (GetDevice()->IsValidationEnabled()) {
|
||||
|
@ -485,7 +485,7 @@ namespace dawn_native {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError QueueBase::ValidateWriteTexture(const TextureCopyView* destination,
|
||||
MaybeError QueueBase::ValidateWriteTexture(const ImageCopyTexture* destination,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize) const {
|
||||
|
@ -493,7 +493,7 @@ namespace dawn_native {
|
|||
DAWN_TRY(GetDevice()->ValidateObject(this));
|
||||
DAWN_TRY(GetDevice()->ValidateObject(destination->texture));
|
||||
|
||||
DAWN_TRY(ValidateTextureCopyView(GetDevice(), *destination, *writeSize));
|
||||
DAWN_TRY(ValidateImageCopyTexture(GetDevice(), *destination, *writeSize));
|
||||
|
||||
if (dataLayout->offset > dataSize) {
|
||||
return DAWN_VALIDATION_ERROR("Queue::WriteTexture out of range");
|
||||
|
|
|
@ -44,13 +44,13 @@ namespace dawn_native {
|
|||
WGPUQueueWorkDoneCallback callback,
|
||||
void* userdata);
|
||||
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,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize);
|
||||
void CopyTextureForBrowser(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
void CopyTextureForBrowser(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options);
|
||||
|
||||
|
@ -67,13 +67,13 @@ namespace dawn_native {
|
|||
uint64_t bufferOffset,
|
||||
const void* data,
|
||||
size_t size);
|
||||
MaybeError WriteTextureInternal(const TextureCopyView* destination,
|
||||
MaybeError WriteTextureInternal(const ImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize);
|
||||
MaybeError CopyTextureForBrowserInternal(const TextureCopyView* source,
|
||||
const TextureCopyView* destination,
|
||||
MaybeError CopyTextureForBrowserInternal(const ImageCopyTexture* source,
|
||||
const ImageCopyTexture* destination,
|
||||
const Extent3D* copySize,
|
||||
const CopyTextureForBrowserOptions* options);
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace dawn_native {
|
|||
uint64_t bufferOffset,
|
||||
const void* data,
|
||||
size_t size);
|
||||
virtual MaybeError WriteTextureImpl(const TextureCopyView& destination,
|
||||
virtual MaybeError WriteTextureImpl(const ImageCopyTexture& destination,
|
||||
const void* data,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D& writeSize);
|
||||
|
@ -96,7 +96,7 @@ namespace dawn_native {
|
|||
MaybeError ValidateWriteBuffer(const BufferBase* buffer,
|
||||
uint64_t bufferOffset,
|
||||
size_t size) const;
|
||||
MaybeError ValidateWriteTexture(const TextureCopyView* destination,
|
||||
MaybeError ValidateWriteTexture(const ImageCopyTexture* destination,
|
||||
size_t dataSize,
|
||||
const TextureDataLayout* dataLayout,
|
||||
const Extent3D* writeSize) const;
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace dawn_native { namespace opengl {
|
|||
return {};
|
||||
}
|
||||
|
||||
MaybeError Queue::WriteTextureImpl(const TextureCopyView& destination,
|
||||
MaybeError Queue::WriteTextureImpl(const ImageCopyTexture& destination,
|
||||
const void* data,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D& writeSizePixel) {
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace dawn_native { namespace opengl {
|
|||
uint64_t bufferOffset,
|
||||
const void* data,
|
||||
size_t size) override;
|
||||
MaybeError WriteTextureImpl(const TextureCopyView& destination,
|
||||
MaybeError WriteTextureImpl(const ImageCopyTexture& destination,
|
||||
const void* data,
|
||||
const TextureDataLayout& dataLayout,
|
||||
const Extent3D& writeSizePixel) override;
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace dawn_wire { namespace client {
|
|||
client->SerializeCommand(cmd);
|
||||
}
|
||||
|
||||
void Queue::WriteTexture(const WGPUTextureCopyView* destination,
|
||||
void Queue::WriteTexture(const WGPUImageCopyTexture* destination,
|
||||
const void* data,
|
||||
size_t dataSize,
|
||||
const WGPUTextureDataLayout* dataLayout,
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace dawn_wire { namespace client {
|
|||
void* userdata);
|
||||
WGPUFence CreateFence(const WGPUFenceDescriptor* descriptor);
|
||||
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,
|
||||
size_t dataSize,
|
||||
const WGPUTextureDataLayout* dataLayout,
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace dawn_wire { namespace server {
|
|||
}
|
||||
|
||||
bool Server::DoQueueWriteTextureInternal(ObjectId queueId,
|
||||
const WGPUTextureCopyView* destination,
|
||||
const WGPUImageCopyTexture* destination,
|
||||
const uint8_t* data,
|
||||
uint64_t dataSize,
|
||||
const WGPUTextureDataLayout* dataLayout,
|
||||
|
|
|
@ -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,
|
||||
// the texture might have been modified.
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, level, {x, y, slice}, aspect);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, level, {x, y, slice}, aspect);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(readback.buffer, readback.offset, bytesPerRow, rowsPerImage);
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
|
|
@ -319,11 +319,11 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||
{{0, buffer, 0, sizeof(transform)}, {1, sampler}, {2, textureView}});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, widthInBytes);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, widthInBytes);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
pass.SetPipeline(pipeline);
|
||||
pass.SetBindGroup(0, bindGroup);
|
||||
|
@ -1181,16 +1181,16 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||
wgpu::Buffer textureData =
|
||||
utils::CreateBufferFromData(device, wgpu::BufferUsage::CopySrc, {value});
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView = {};
|
||||
bufferCopyView.buffer = textureData;
|
||||
bufferCopyView.layout.bytesPerRow = 256;
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = {};
|
||||
imageCopyBuffer.buffer = textureData;
|
||||
imageCopyBuffer.layout.bytesPerRow = 256;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = {};
|
||||
textureCopyView.texture = texture;
|
||||
wgpu::ImageCopyTexture imageCopyTexture = {};
|
||||
imageCopyTexture.texture = texture;
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
commandEncoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
commandEncoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
return texture;
|
||||
};
|
||||
|
||||
|
|
|
@ -126,19 +126,19 @@ class BufferZeroInitTest : public DawnTest {
|
|||
wgpu::Texture texture =
|
||||
CreateAndInitializeTexture(spec.textureSize, kTextureFormat, kClearColor);
|
||||
|
||||
const wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
const wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
|
||||
const uint64_t bufferSize = spec.bufferOffset + spec.extraBytes +
|
||||
utils::RequiredBytesInCopy(spec.bytesPerRow, spec.rowsPerImage,
|
||||
spec.textureSize, kTextureFormat);
|
||||
wgpu::Buffer buffer =
|
||||
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);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &spec.textureSize);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &spec.textureSize);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(spec.lazyClearCount, queue.Submit(1, &commandBuffer));
|
||||
|
||||
|
@ -871,8 +871,8 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
|
|||
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
|
||||
|
||||
wgpu::Texture texture = CreateAndInitializeTexture(kTextureSize, kTextureFormat);
|
||||
const wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
const wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
|
||||
const uint32_t rowsPerImage = kTextureSize.height;
|
||||
const uint32_t requiredBufferSizeForCopy = utils::RequiredBytesInCopy(
|
||||
|
@ -886,11 +886,11 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
|
|||
constexpr uint64_t kOffset = 0;
|
||||
const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset;
|
||||
wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage);
|
||||
const wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(
|
||||
const wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
|
||||
buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &kTextureSize);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &kTextureSize);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer));
|
||||
|
||||
|
@ -904,11 +904,11 @@ TEST_P(BufferZeroInitTest, CopyBufferToTexture) {
|
|||
constexpr uint64_t kOffset = 8u;
|
||||
const uint32_t totalBufferSize = requiredBufferSizeForCopy + kOffset;
|
||||
wgpu::Buffer buffer = CreateBuffer(totalBufferSize, kBufferUsage);
|
||||
const wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(
|
||||
const wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
|
||||
buffer, kOffset, kTextureBytesPerRowAlignment, kTextureSize.height);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &kTextureSize);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &kTextureSize);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commandBuffer));
|
||||
|
||||
|
|
|
@ -96,15 +96,15 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
// Copy texture data from a staging buffer to the destination texture.
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(),
|
||||
wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, copyConfig.bufferOffset,
|
||||
copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, copyConfig.bufferOffset,
|
||||
copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
|
||||
bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Config.copyExtent3D);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Config.copyExtent3D);
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
}
|
||||
|
@ -258,11 +258,11 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
wgpu::Texture dstTexture,
|
||||
CopyConfig srcConfig,
|
||||
CopyConfig dstConfig) {
|
||||
wgpu::TextureCopyView textureCopyViewSrc = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTextureSrc = utils::CreateImageCopyTexture(
|
||||
srcTexture, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D);
|
||||
wgpu::TextureCopyView textureCopyViewDst = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTextureDst = utils::CreateImageCopyTexture(
|
||||
dstTexture, dstConfig.viewMipmapLevel, dstConfig.copyOrigin3D);
|
||||
encoder.CopyTextureToTexture(&textureCopyViewSrc, &textureCopyViewDst,
|
||||
encoder.CopyTextureToTexture(&imageCopyTextureSrc, &imageCopyTextureDst,
|
||||
&dstConfig.copyExtent3D);
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ TEST_P(CompressedTextureBCFormatTest, CopyIntoSubresourceWithPhysicalSizeNotEqua
|
|||
srcConfig.textureDescriptor.usage =
|
||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||
wgpu::Texture bcTextureSrc = CreateTextureWithCompressedData(srcConfig);
|
||||
wgpu::TextureCopyView textureCopyViewSrc = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTextureSrc = utils::CreateImageCopyTexture(
|
||||
bcTextureSrc, srcConfig.viewMipmapLevel, srcConfig.copyOrigin3D);
|
||||
|
||||
// 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;
|
||||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(buffer, 0, 256);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(buffer, 0, 256);
|
||||
wgpu::Extent3D copyExtent = {4, 4, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Extent);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Extent);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
}
|
||||
|
@ -1148,10 +1148,10 @@ class CompressedTextureWriteTextureTest : public CompressedTextureBCFormatTest {
|
|||
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
|
||||
copyConfig.bufferOffset, copyConfig.bytesPerRowAlignment, copyConfig.rowsPerImage);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
|
||||
bcCompressedTexture, copyConfig.viewMipmapLevel, copyConfig.copyOrigin3D);
|
||||
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size(), &textureDataLayout,
|
||||
queue.WriteTexture(&imageCopyTexture, data.data(), data.size(), &textureDataLayout,
|
||||
©Config.copyExtent3D);
|
||||
}
|
||||
|
||||
|
|
|
@ -149,11 +149,11 @@ class CopyTests_T2B : public CopyTests {
|
|||
// Initialize the source texture
|
||||
std::vector<RGBA8> textureArrayData = GetExpectedTextureDataRGBA8(copyLayout);
|
||||
{
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, textureSpec.copyLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, {0, 0, 0});
|
||||
wgpu::TextureDataLayout textureDataLayout =
|
||||
utils::CreateTextureDataLayout(0, copyLayout.bytesPerRow, copyLayout.rowsPerImage);
|
||||
queue.WriteTexture(&textureCopyView, textureArrayData.data(), copyLayout.byteLength,
|
||||
queue.WriteTexture(&imageCopyTexture, textureArrayData.data(), copyLayout.byteLength,
|
||||
&textureDataLayout, ©Layout.mipSize);
|
||||
}
|
||||
|
||||
|
@ -169,11 +169,11 @@ class CopyTests_T2B : public CopyTests {
|
|||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
{
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
|
||||
texture, textureSpec.copyLevel, textureSpec.copyOrigin);
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(
|
||||
buffer, bufferSpec.offset, bufferSpec.bytesPerRow, bufferSpec.rowsPerImage);
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
}
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
@ -260,11 +260,11 @@ class CopyTests_B2T : public CopyTests {
|
|||
|
||||
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);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, textureSpec.copyLevel, textureSpec.copyOrigin);
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, textureSpec.copyOrigin);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
@ -339,11 +339,11 @@ class CopyTests_T2T : public CopyTests {
|
|||
// Initialize the source texture
|
||||
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});
|
||||
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
|
||||
0, srcDataCopyLayout.bytesPerRow, srcDataCopyLayout.rowsPerImage);
|
||||
queue.WriteTexture(&textureCopyView, srcTextureCopyData.data(),
|
||||
queue.WriteTexture(&imageCopyTexture, srcTextureCopyData.data(),
|
||||
srcDataCopyLayout.byteLength, &textureDataLayout,
|
||||
&srcDataCopyLayout.mipSize);
|
||||
}
|
||||
|
@ -351,11 +351,11 @@ class CopyTests_T2T : public CopyTests {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
// Perform the texture to texture copy
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, srcSpec.copyLevel, srcSpec.copyOrigin);
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, dstSpec.copyLevel, dstSpec.copyOrigin);
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, ©Size);
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, srcSpec.copyLevel, srcSpec.copyOrigin);
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, dstSpec.copyLevel, dstSpec.copyOrigin);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Size);
|
||||
|
||||
// Copy the data from the srcSpec.copyOrigin.z-th layer to (srcSpec.copyOrigin.z +
|
||||
// copySize.depth)-th layer of dstTexture to outputBuffer
|
||||
|
@ -367,9 +367,9 @@ class CopyTests_T2T : public CopyTests {
|
|||
outputBufferDescriptor.size = dstDataCopyLayout.byteLength;
|
||||
outputBufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer outputBuffer = device.CreateBuffer(&outputBufferDescriptor);
|
||||
wgpu::BufferCopyView outputBufferCopyView = utils::CreateBufferCopyView(
|
||||
wgpu::ImageCopyBuffer outputImageCopyBuffer = utils::CreateImageCopyBuffer(
|
||||
outputBuffer, 0, dstDataCopyLayout.bytesPerRow, dstDataCopyLayout.rowsPerImage);
|
||||
encoder.CopyTextureToBuffer(&dstTextureCopyView, &outputBufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&dstImageCopyTexture, &outputImageCopyBuffer, ©Size);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
@ -1597,12 +1597,12 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(buffer, kBufferCopyOffset, kTextureBytesPerRowAlignment);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(buffer, kBufferCopyOffset, kTextureBytesPerRowAlignment);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = textureDescriptor.size;
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
queue.Submit(1, &commandBuffer);
|
||||
|
||||
|
|
|
@ -145,29 +145,29 @@ class CopyTextureForBrowserTests : public DawnTest {
|
|||
srcSpec.level);
|
||||
|
||||
const std::vector<RGBA8> textureArrayCopyData = GetSourceTextureData(copyLayout);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, srcSpec.level, {0, 0, srcSpec.copyOrigin.z});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, srcSpec.level, {0, 0, srcSpec.copyOrigin.z});
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout;
|
||||
textureDataLayout.offset = 0;
|
||||
textureDataLayout.bytesPerRow = copyLayout.bytesPerRow;
|
||||
textureDataLayout.rowsPerImage = copyLayout.rowsPerImage;
|
||||
|
||||
device.GetQueue().WriteTexture(&textureCopyView, textureArrayCopyData.data(),
|
||||
device.GetQueue().WriteTexture(&imageCopyTexture, textureArrayCopyData.data(),
|
||||
textureArrayCopyData.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Layout.mipSize);
|
||||
|
||||
// Perform the texture to texture copy
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, srcSpec.level, srcSpec.copyOrigin);
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, dstSpec.level, dstSpec.copyOrigin);
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, srcSpec.level, srcSpec.copyOrigin);
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, dstSpec.level, dstSpec.copyOrigin);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
||||
device.GetQueue().CopyTextureForBrowser(&srcTextureCopyView, &dstTextureCopyView, ©Size,
|
||||
&options);
|
||||
device.GetQueue().CopyTextureForBrowser(&srcImageCopyTexture, &dstImageCopyTexture,
|
||||
©Size, &options);
|
||||
|
||||
// Update uniform buffer based on test config
|
||||
uint32_t uniformBufferData[] = {
|
||||
|
|
|
@ -282,8 +282,8 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase {
|
|||
protected:
|
||||
// Submits a 1x1x1 copy from source to destination
|
||||
void SimpleCopyTextureToTexture(wgpu::Texture source, wgpu::Texture destination) {
|
||||
wgpu::TextureCopyView copySrc = utils::CreateTextureCopyView(source, 0, {0, 0, 0});
|
||||
wgpu::TextureCopyView copyDst = utils::CreateTextureCopyView(destination, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(source, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
|
|
@ -180,16 +180,16 @@ DAWN_INSTANTIATE_TEST(DeprecationTests,
|
|||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
class BufferCopyViewDeprecationTests : public DeprecationTests {
|
||||
class ImageCopyBufferDeprecationTests : public DeprecationTests {
|
||||
protected:
|
||||
wgpu::TextureCopyView MakeTextureCopyView() {
|
||||
wgpu::ImageCopyTexture MakeImageCopyTexture() {
|
||||
wgpu::TextureDescriptor desc = {};
|
||||
desc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||
desc.dimension = wgpu::TextureDimension::e2D;
|
||||
desc.size = {1, 1, 2};
|
||||
desc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||
|
||||
wgpu::TextureCopyView copy;
|
||||
wgpu::ImageCopyTexture copy;
|
||||
copy.texture = device.CreateTexture(&desc);
|
||||
copy.origin = {0, 0, 1};
|
||||
return copy;
|
||||
|
|
|
@ -173,8 +173,10 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
// Perform a T2T copy of all aspects
|
||||
{
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
wgpu::TextureCopyView srcView = utils::CreateTextureCopyView(src, mipLevel, {0, 0, 0});
|
||||
wgpu::TextureCopyView dstView = utils::CreateTextureCopyView(dst, mipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcView =
|
||||
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};
|
||||
commandEncoder.CopyTextureToTexture(&srcView, &dstView, ©Size);
|
||||
|
||||
|
@ -229,10 +231,10 @@ class DepthStencilCopyTests : public DawnTest {
|
|||
}
|
||||
uploadBuffer.Unmap();
|
||||
|
||||
wgpu::BufferCopyView bufferCopy =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, bytesPerRow, height);
|
||||
wgpu::TextureCopyView textureCopy =
|
||||
utils::CreateTextureCopyView(depthDataTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
|
||||
wgpu::ImageCopyBuffer bufferCopy =
|
||||
utils::CreateImageCopyBuffer(uploadBuffer, 0, bytesPerRow, height);
|
||||
wgpu::ImageCopyTexture textureCopy =
|
||||
utils::CreateImageCopyTexture(depthDataTexture, 0, {0, 0, 0}, wgpu::TextureAspect::All);
|
||||
commandEncoder.CopyBufferToTexture(&bufferCopy, &textureCopy, &depthDataDesc.size);
|
||||
|
||||
// Pipeline for a full screen quad.
|
||||
|
@ -636,11 +638,11 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
|||
wgpu::TextureDataLayout stencilDataLayout = {};
|
||||
stencilDataLayout.bytesPerRow = kWidth * sizeof(uint8_t);
|
||||
|
||||
wgpu::TextureCopyView stencilDataCopyView = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture stencilDataCopyTexture = utils::CreateImageCopyTexture(
|
||||
depthStencilTexture, 0, {0, 0, 0}, wgpu::TextureAspect::StencilOnly);
|
||||
|
||||
wgpu::Extent3D writeSize = {kWidth, kHeight, 1};
|
||||
queue.WriteTexture(&stencilDataCopyView, stencilData.data(),
|
||||
queue.WriteTexture(&stencilDataCopyTexture, stencilData.data(),
|
||||
stencilData.size() * sizeof(uint8_t), &stencilDataLayout, &writeSize);
|
||||
|
||||
// Decrement the stencil value in a render pass to ensure the data is visible to the pipeline.
|
||||
|
|
|
@ -242,12 +242,12 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
|
|||
wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
|
||||
wgpu::Texture tex = device.CreateTexture(&texDesc);
|
||||
|
||||
wgpu::TextureCopyView copyView;
|
||||
copyView.texture = tex;
|
||||
wgpu::ImageCopyTexture copyDst;
|
||||
copyDst.texture = tex;
|
||||
wgpu::TextureDataLayout layout;
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
uint32_t kOne = 1;
|
||||
queue.WriteTexture(©View, &kOne, sizeof(kOne), &layout, ©Size);
|
||||
queue.WriteTexture(©Dst, &kOne, sizeof(kOne), &layout, ©Size);
|
||||
|
||||
// Create a pipeline that loads the texture from both the sampled and storage paths.
|
||||
wgpu::ComputePipelineDescriptor pipelineDesc;
|
||||
|
|
|
@ -138,12 +138,12 @@ TEST_P(NonzeroTextureCreationTests, NonrenderableTextureFormat) {
|
|||
wgpu::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, kSize * 4);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, kSize * 4);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
||||
|
@ -176,12 +176,12 @@ TEST_P(NonzeroTextureCreationTests, NonRenderableTextureClearWithMultiArrayLayer
|
|||
wgpu::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, kSize * 4);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 1});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, kSize * 4);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 1});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
||||
|
|
|
@ -277,10 +277,10 @@ class QueueWriteTextureTests : public DawnTest {
|
|||
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(
|
||||
dataSpec.offset, dataSpec.bytesPerRow, dataSpec.rowsPerImage);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, textureSpec.level, textureSpec.copyOrigin);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, textureSpec.level, textureSpec.copyOrigin);
|
||||
|
||||
queue.WriteTexture(&textureCopyView, data.data(), dataSpec.size, &textureDataLayout,
|
||||
queue.WriteTexture(&imageCopyTexture, data.data(), dataSpec.size, &textureDataLayout,
|
||||
©Size);
|
||||
|
||||
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat);
|
||||
|
|
|
@ -126,10 +126,11 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(buffer, 0, kTextureBytesPerRowAlignment);
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &kTextureSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(buffer, 0, kTextureBytesPerRowAlignment);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &kTextureSize);
|
||||
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
queue.Submit(1, &commandBuffer);
|
||||
|
|
|
@ -121,12 +121,12 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
|||
std::vector<RGBA8> data(rowPixels * texHeight, color);
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureBytesPerRowAlignment);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, level, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, level, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {texWidth, texHeight, 1};
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
}
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
|
|
|
@ -108,12 +108,13 @@ class SamplerTest : public DawnTest {
|
|||
|
||||
wgpu::Buffer stagingBuffer =
|
||||
utils::CreateBufferFromData(device, data, sizeof(data), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(stagingBuffer, 0, 256);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(stagingBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {2, 2, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
queue.Submit(1, ©);
|
||||
|
|
|
@ -448,11 +448,11 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount};
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(uploadBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
|
||||
wgpu::TextureCopyView textureCopyView;
|
||||
textureCopyView.texture = outputTexture;
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Extent);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(uploadBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
|
||||
wgpu::ImageCopyTexture imageCopyTexture;
|
||||
imageCopyTexture.texture = outputTexture;
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Extent);
|
||||
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
queue.Submit(1, &commandBuffer);
|
||||
|
@ -622,11 +622,11 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
const wgpu::Extent3D copyExtent = {kWidth, kHeight, arrayLayerCount};
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(writeonlyStorageTexture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(resultBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Extent);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(writeonlyStorageTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(resultBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Extent);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
queue.Submit(1, &commandBuffer);
|
||||
|
||||
|
@ -1032,12 +1032,12 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView;
|
||||
textureCopyView.texture = storageTexture1;
|
||||
wgpu::ImageCopyTexture imageCopyTexture;
|
||||
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};
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
@ -1106,12 +1106,12 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer resultBuffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView;
|
||||
textureCopyView.texture = storageTexture1;
|
||||
wgpu::ImageCopyTexture imageCopyTexture;
|
||||
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};
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
|
|
|
@ -235,9 +235,9 @@ class TextureFormatTest : public DawnTest {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
{
|
||||
wgpu::BufferCopyView bufferView = utils::CreateBufferCopyView(uploadBuffer, 0, 256);
|
||||
wgpu::TextureCopyView textureView =
|
||||
utils::CreateTextureCopyView(sampleTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer bufferView = utils::CreateImageCopyBuffer(uploadBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture textureView =
|
||||
utils::CreateImageCopyTexture(sampleTexture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D extent{width, 1, 1};
|
||||
encoder.CopyBufferToTexture(&bufferView, &textureView, &extent);
|
||||
}
|
||||
|
@ -250,9 +250,9 @@ class TextureFormatTest : public DawnTest {
|
|||
renderPass.EndPass();
|
||||
|
||||
{
|
||||
wgpu::BufferCopyView bufferView = utils::CreateBufferCopyView(readbackBuffer, 0, 256);
|
||||
wgpu::TextureCopyView textureView =
|
||||
utils::CreateTextureCopyView(renderTarget, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer bufferView = utils::CreateImageCopyBuffer(readbackBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture textureView =
|
||||
utils::CreateImageCopyTexture(renderTarget, 0, {0, 0, 0});
|
||||
wgpu::Extent3D extent{width, 1, 1};
|
||||
encoder.CopyTextureToBuffer(&textureView, &bufferView, &extent);
|
||||
}
|
||||
|
|
|
@ -147,12 +147,12 @@ class TextureViewSamplingTest : public DawnTest {
|
|||
std::vector<RGBA8> data(kPaddedTexWidth * texHeight, RGBA8(0, 0, 0, pixelValue));
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), data.size() * sizeof(RGBA8), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kTextureBytesPerRowAlignment);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(mTexture, level, {0, 0, layer});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kTextureBytesPerRowAlignment);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(mTexture, level, {0, 0, layer});
|
||||
wgpu::Extent3D copySize = {texWidth, texHeight, 1};
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
}
|
||||
}
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
|
|
|
@ -157,14 +157,14 @@ TEST_P(TextureZeroInitTest, CopyMultipleTextureArrayLayersToBufferSource) {
|
|||
{kSize, kSize, kArrayLayers}, kColorFormat);
|
||||
wgpu::Buffer buffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
const wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(buffer, 0, bytesPerRow, kSize);
|
||||
const wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
const wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(buffer, 0, bytesPerRow, kSize);
|
||||
const wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
const wgpu::Extent3D copySize = {kSize, kSize, kArrayLayers};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commandBuffer = encoder.Finish();
|
||||
|
||||
// Expect texture to be lazy initialized.
|
||||
|
@ -279,13 +279,13 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
|
|||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * sizeof(uint32_t));
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * sizeof(uint32_t));
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
||||
|
@ -310,13 +310,13 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
|
|||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * sizeof(uint16_t));
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * sizeof(uint16_t));
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize / 2, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
|
||||
|
||||
|
@ -344,14 +344,14 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureMultipleArrayLayers) {
|
|||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
const wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize, kSize);
|
||||
const wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
const wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize, kSize);
|
||||
const wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
const wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
|
||||
// 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);
|
||||
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::TextureDescriptor dstDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
|
@ -384,13 +384,13 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
|||
kColorFormat);
|
||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, ©Size);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
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);
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
queue.Submit(1, &commands);
|
||||
}
|
||||
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::TextureDescriptor dstDescriptor =
|
||||
CreateTextureDescriptor(1, 1,
|
||||
|
@ -439,12 +439,12 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
|||
kColorFormat);
|
||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize / 2, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, ©Size);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
|
||||
|
||||
|
@ -1028,12 +1028,12 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClear) {
|
|||
wgpu::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, bytesPerRow);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
|
||||
|
||||
|
@ -1063,12 +1063,12 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearUnalignedSize) {
|
|||
std::vector<uint8_t> data(bufferSize, 100);
|
||||
wgpu::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(bufferDst, 0, bytesPerRow);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = utils::CreateImageCopyBuffer(bufferDst, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(1u, queue.Submit(1, &commands));
|
||||
|
||||
|
@ -1096,13 +1096,13 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearWithMultiArrayLayers) {
|
|||
wgpu::Buffer bufferDst = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(bufferDst, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 1});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(bufferDst, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 1});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
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);
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
// Expect 0 lazy clears because the texture will be completely copied to
|
||||
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);
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, mipSize * kFormatBlockByteSize);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(sampleTexture, 1, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, mipSize * kFormatBlockByteSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(sampleTexture, 1, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {mipSize, mipSize, 1};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
// Expect 0 lazy clears because the texture subresource will be completely copied to
|
||||
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);
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(
|
||||
device, data.data(), static_cast<uint32_t>(data.size()), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(sampleTexture, 0, {0, 0, 1});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, kSize * kFormatBlockByteSize);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(sampleTexture, 0, {0, 0, 1});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, 1};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Size);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
// Expect 0 lazy clears because the texture subresource will be completely copied to
|
||||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
@ -1441,12 +1441,14 @@ TEST_P(TextureZeroInitTest, CopyTextureToBufferNonRenderableUnaligned) {
|
|||
wgpu::Buffer buffer = utils::CreateBufferFromData(device, initialBufferData.data(),
|
||||
bufferSize, wgpu::BufferUsage::CopyDst);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(texture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView bufferCopyView = utils::CreateBufferCopyView(buffer, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(buffer, 0, bytesPerRow);
|
||||
wgpu::Extent3D copySize = {kUnalignedSize, kUnalignedSize, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, ©Size);
|
||||
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
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);
|
||||
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::TextureDataLayout textureDataLayout;
|
||||
|
@ -1477,9 +1479,9 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) {
|
|||
{100, 100, 100, 100});
|
||||
|
||||
// The write overwrites the whole texture so we don't need to do lazy initialization.
|
||||
EXPECT_LAZY_CLEAR(0u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture initialized to be true
|
||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||
|
@ -1496,7 +1498,7 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) {
|
|||
kColorFormat);
|
||||
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::TextureDataLayout textureDataLayout;
|
||||
|
@ -1510,9 +1512,9 @@ TEST_P(TextureZeroInitTest, WriteTextureHalf) {
|
|||
sizeof(RGBA8),
|
||||
{100, 100, 100, 100});
|
||||
|
||||
EXPECT_LAZY_CLEAR(1u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture initialized to be true
|
||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, 0, 1));
|
||||
|
@ -1534,8 +1536,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
|
|||
constexpr uint32_t kBaseArrayLayer = 2u;
|
||||
constexpr uint32_t kCopyLayerCount = 3u;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
wgpu::Extent3D copySize = {kSize, kSize, kCopyLayerCount};
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout;
|
||||
|
@ -1551,9 +1553,9 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
|
|||
|
||||
// The write overwrites the whole subresources so we don't need to do lazy initialization on
|
||||
// them.
|
||||
EXPECT_LAZY_CLEAR(0u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture subresource initialized to be true
|
||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1, kBaseArrayLayer,
|
||||
|
@ -1576,8 +1578,8 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
|
|||
constexpr uint32_t kBaseArrayLayer = 2u;
|
||||
constexpr uint32_t kCopyLayerCount = 3u;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, kBaseArrayLayer});
|
||||
wgpu::Extent3D copySize = {kSize / 2, kSize, kCopyLayerCount};
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout;
|
||||
|
@ -1591,9 +1593,9 @@ TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
|
|||
sizeof(RGBA8),
|
||||
{100, 100, 100, 100});
|
||||
|
||||
EXPECT_LAZY_CLEAR(1u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture subresource initialized to be true
|
||||
EXPECT_EQ(true, dawn_native::IsTextureSubresourceInitialized(texture.Get(), 0, 1,
|
||||
|
@ -1618,8 +1620,8 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
|
|||
constexpr uint32_t kMipLevel = 2;
|
||||
constexpr uint32_t kMipSize = kSize >> kMipLevel;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, kMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, kMipLevel, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kMipSize, kMipSize, 1};
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout;
|
||||
|
@ -1634,9 +1636,9 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
|
|||
{100, 100, 100, 100});
|
||||
|
||||
// The write overwrites the whole texture so we don't need to do lazy initialization.
|
||||
EXPECT_LAZY_CLEAR(0u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture initialized to be true
|
||||
EXPECT_TRUE(dawn_native::IsTextureSubresourceInitialized(texture.Get(), kMipLevel, 1, 0, 1));
|
||||
|
@ -1656,8 +1658,8 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
|
|||
constexpr uint32_t kMipLevel = 2;
|
||||
constexpr uint32_t kMipSize = kSize >> kMipLevel;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, kMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, kMipLevel, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {kMipSize / 2, kMipSize, 1};
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout;
|
||||
|
@ -1671,9 +1673,9 @@ TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
|
|||
sizeof(RGBA8),
|
||||
{100, 100, 100, 100});
|
||||
|
||||
EXPECT_LAZY_CLEAR(1u,
|
||||
queue.WriteTexture(&textureCopyView, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
EXPECT_LAZY_CLEAR(
|
||||
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
|
||||
&textureDataLayout, ©Size));
|
||||
|
||||
// Expect texture initialized to be true
|
||||
EXPECT_EQ(true,
|
||||
|
@ -1740,14 +1742,14 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
|
|||
// Copy texture data from a staging buffer to the destination texture.
|
||||
wgpu::Buffer stagingBuffer = utils::CreateBufferFromData(device, data.data(), data.size(),
|
||||
wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(stagingBuffer, 0, copyBytesPerRow, copyHeightInBlock);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(stagingBuffer, 0, copyBytesPerRow, copyHeightInBlock);
|
||||
|
||||
wgpu::TextureCopyView textureCopyView = utils::CreateTextureCopyView(
|
||||
wgpu::ImageCopyTexture imageCopyTexture = utils::CreateImageCopyTexture(
|
||||
bcCompressedTexture, viewMipmapLevel, {0, 0, baseArrayLayer});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, ©Extent3D);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, ©Extent3D);
|
||||
wgpu::CommandBuffer copy = encoder.Finish();
|
||||
EXPECT_LAZY_CLEAR(lazyClearCount, queue.Submit(1, ©));
|
||||
}
|
||||
|
@ -1975,8 +1977,8 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
|
|||
InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D,
|
||||
kViewMipLevel, 0, 0u);
|
||||
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, kViewMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
|
||||
|
||||
// create dstTexture that we will copy to
|
||||
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
|
||||
|
@ -1985,11 +1987,11 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
|
|||
utils::kBCFormats[0]);
|
||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, kViewMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, kViewMipLevel, {0, 0, 0});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, ©Extent3D);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Extent3D);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
// the dstTexture does not need to be lazy cleared since it's fully copied to
|
||||
EXPECT_LAZY_CLEAR(0u, queue.Submit(1, &commands));
|
||||
|
@ -2022,8 +2024,8 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
|
|||
InitializeDataInCompressedTextureAndExpectLazyClear(srcTexture, srcDescriptor, copyExtent3D,
|
||||
kViewMipLevel, 0, 1u);
|
||||
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, kViewMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
|
||||
|
||||
// create dstTexture that we will copy to
|
||||
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
|
||||
|
@ -2032,11 +2034,11 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
|
|||
utils::kBCFormats[0]);
|
||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, kViewMipLevel, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, kViewMipLevel, {0, 0, 0});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, ©Extent3D);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, ©Extent3D);
|
||||
wgpu::CommandBuffer commands = encoder.Finish();
|
||||
// expect 1 lazy clear count since the dstTexture needs to be lazy cleared when we only copy to
|
||||
// half texture
|
||||
|
|
|
@ -96,10 +96,10 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
|
|||
|
||||
// Copy into the layer of the material array.
|
||||
{
|
||||
wgpu::TextureCopyView sourceView;
|
||||
wgpu::ImageCopyTexture sourceView;
|
||||
sourceView.texture = mUploadTexture;
|
||||
|
||||
wgpu::TextureCopyView destView;
|
||||
wgpu::ImageCopyTexture destView;
|
||||
destView.texture = mMaterials;
|
||||
destView.origin.z = layerUploaded;
|
||||
|
||||
|
|
|
@ -78,13 +78,13 @@ class CopyCommandTest : public ValidationTest {
|
|||
wgpu::Origin3D destOrigin,
|
||||
wgpu::Extent3D extent3D,
|
||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(srcBuffer, srcOffset, srcBytesPerRow, srcRowsPerImage);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destTexture, destLevel, destOrigin, aspect);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(srcBuffer, srcOffset, srcBytesPerRow, srcRowsPerImage);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(destTexture, destLevel, destOrigin, aspect);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &textureCopyView, &extent3D);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &extent3D);
|
||||
|
||||
ValidateExpectation(encoder, expectation);
|
||||
}
|
||||
|
@ -99,13 +99,13 @@ class CopyCommandTest : public ValidationTest {
|
|||
uint32_t destRowsPerImage,
|
||||
wgpu::Extent3D extent3D,
|
||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
|
||||
wgpu::BufferCopyView bufferCopyView =
|
||||
utils::CreateBufferCopyView(destBuffer, destOffset, destBytesPerRow, destRowsPerImage);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, srcLevel, srcOrigin, aspect);
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer =
|
||||
utils::CreateImageCopyBuffer(destBuffer, destOffset, destBytesPerRow, destRowsPerImage);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, srcLevel, srcOrigin, aspect);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &bufferCopyView, &extent3D);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &extent3D);
|
||||
|
||||
ValidateExpectation(encoder, expectation);
|
||||
}
|
||||
|
@ -119,13 +119,13 @@ class CopyCommandTest : public ValidationTest {
|
|||
wgpu::Origin3D dstOrigin,
|
||||
wgpu::Extent3D extent3D,
|
||||
wgpu::TextureAspect aspect = wgpu::TextureAspect::All) {
|
||||
wgpu::TextureCopyView srcTextureCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, srcLevel, srcOrigin, aspect);
|
||||
wgpu::TextureCopyView dstTextureCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, dstLevel, dstOrigin, aspect);
|
||||
wgpu::ImageCopyTexture srcImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(srcTexture, srcLevel, srcOrigin, aspect);
|
||||
wgpu::ImageCopyTexture dstImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(dstTexture, dstLevel, dstOrigin, aspect);
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcTextureCopyView, &dstTextureCopyView, &extent3D);
|
||||
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &extent3D);
|
||||
|
||||
ValidateExpectation(encoder, expectation);
|
||||
}
|
||||
|
@ -666,20 +666,20 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
|||
errorTextureDescriptor.size.depth = 0;
|
||||
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
||||
|
||||
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
||||
wgpu::TextureCopyView errorTextureCopyView =
|
||||
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
|
||||
wgpu::ImageCopyTexture errorImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(errorTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D extent3D = {0, 0, 0};
|
||||
|
||||
{
|
||||
wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
|
||||
wgpu::TextureUsage::CopyDst);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&errorBufferCopyView, &textureCopyView, &extent3D);
|
||||
encoder.CopyBufferToTexture(&errorImageCopyBuffer, &imageCopyTexture, &extent3D);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
|
@ -687,10 +687,10 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
|||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
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();
|
||||
encoder.CopyBufferToTexture(&bufferCopyView, &errorTextureCopyView, &extent3D);
|
||||
encoder.CopyBufferToTexture(&imageCopyBuffer, &errorImageCopyTexture, &extent3D);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
@ -1255,9 +1255,9 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
|||
errorTextureDescriptor.size.depth = 0;
|
||||
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture = device.CreateTexture(&errorTextureDescriptor));
|
||||
|
||||
wgpu::BufferCopyView errorBufferCopyView = utils::CreateBufferCopyView(errorBuffer, 0, 0, 0);
|
||||
wgpu::TextureCopyView errorTextureCopyView =
|
||||
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer errorImageCopyBuffer = utils::CreateImageCopyBuffer(errorBuffer, 0, 0, 0);
|
||||
wgpu::ImageCopyTexture errorImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(errorTexture, 0, {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);
|
||||
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();
|
||||
encoder.CopyTextureToBuffer(&errorTextureCopyView, &bufferCopyView, &extent3D);
|
||||
encoder.CopyTextureToBuffer(&errorImageCopyTexture, &imageCopyBuffer, &extent3D);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
{
|
||||
wgpu::Texture destination = Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
|
||||
wgpu::TextureUsage::CopyDst);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&textureCopyView, &errorBufferCopyView, &extent3D);
|
||||
encoder.CopyTextureToBuffer(&imageCopyTexture, &errorImageCopyBuffer, &extent3D);
|
||||
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},
|
||||
{16, 16, 1});
|
||||
|
||||
// Copy multiple slices (srcTextureCopyView.arrayLayer + copySize.depth ==
|
||||
// srcTextureCopyView.texture.arrayLayerCount)
|
||||
// Copy multiple slices (srcImageCopyTexture.arrayLayer + copySize.depth ==
|
||||
// srcImageCopyTexture.texture.arrayLayerCount)
|
||||
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 2}, destination, 0, {0, 0, 0},
|
||||
{16, 16, 2});
|
||||
|
||||
// Copy multiple slices (dstTextureCopyView.arrayLayer + copySize.depth ==
|
||||
// dstTextureCopyView.texture.arrayLayerCount)
|
||||
// Copy multiple slices (dstImageCopyTexture.arrayLayer + copySize.depth ==
|
||||
// dstImageCopyTexture.texture.arrayLayerCount)
|
||||
TestT2TCopy(utils::Expectation::Success, source, 0, {0, 0, 0}, destination, 0, {0, 0, 2},
|
||||
{16, 16, 2});
|
||||
}
|
||||
|
|
|
@ -63,10 +63,10 @@ namespace {
|
|||
textureDataLayout.bytesPerRow = dataBytesPerRow;
|
||||
textureDataLayout.rowsPerImage = dataRowsPerImage;
|
||||
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, texLevel, texOrigin, aspect);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
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,
|
||||
|
@ -361,8 +361,8 @@ namespace {
|
|||
errorTextureDescriptor.size.depth = 0;
|
||||
ASSERT_DEVICE_ERROR(wgpu::Texture errorTexture =
|
||||
device.CreateTexture(&errorTextureDescriptor));
|
||||
wgpu::TextureCopyView errorTextureCopyView =
|
||||
utils::CreateTextureCopyView(errorTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture errorImageCopyTexture =
|
||||
utils::CreateImageCopyTexture(errorTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D extent3D = {0, 0, 0};
|
||||
|
||||
|
@ -370,7 +370,7 @@ namespace {
|
|||
std::vector<uint8_t> data(4);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1286,8 +1286,8 @@ namespace {
|
|||
wgpu::TextureView view0 = texture0.CreateView();
|
||||
wgpu::TextureView view1 = texture1.CreateView();
|
||||
|
||||
wgpu::TextureCopyView srcView = utils::CreateTextureCopyView(texture0, 0, {0, 0, 0});
|
||||
wgpu::TextureCopyView dstView = utils::CreateTextureCopyView(texture1, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture srcView = utils::CreateImageCopyTexture(texture0, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture dstView = utils::CreateImageCopyTexture(texture1, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
// Use the texture as both copy dst and render attachment in render pass
|
||||
|
|
|
@ -123,14 +123,14 @@ namespace {
|
|||
wgpu::Texture dstTexture = CreateVideoTextureForTest(
|
||||
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::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
|
@ -142,26 +142,26 @@ namespace {
|
|||
wgpu::Texture dstTexture = CreateVideoTextureForTest(
|
||||
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
|
||||
|
||||
wgpu::TextureCopyView srcCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(
|
||||
srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
|
||||
wgpu::TextureCopyView dstCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
|
||||
wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(
|
||||
dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
srcCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
|
||||
copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0},
|
||||
wgpu::TextureAspect::Plane1Only);
|
||||
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
@ -176,14 +176,14 @@ namespace {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopyDst;
|
||||
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::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
|
@ -197,25 +197,25 @@ namespace {
|
|||
bufferDescriptor.usage = wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer dstBuffer = device.CreateBuffer(&bufferDescriptor);
|
||||
|
||||
wgpu::TextureCopyView srcCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(
|
||||
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::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
srcCopyView =
|
||||
utils::CreateTextureCopyView(srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
|
||||
copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0},
|
||||
wgpu::TextureAspect::Plane1Only);
|
||||
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyTextureToBuffer(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyTextureToBuffer(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
@ -230,14 +230,14 @@ namespace {
|
|||
wgpu::Texture dstTexture = CreateVideoTextureForTest(
|
||||
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::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
|
@ -251,25 +251,25 @@ namespace {
|
|||
wgpu::Texture dstTexture = CreateVideoTextureForTest(
|
||||
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::TextureAspect::Plane0Only);
|
||||
wgpu::ImageCopyTexture copyDst = utils::CreateImageCopyTexture(
|
||||
dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
|
||||
dstCopyView =
|
||||
utils::CreateTextureCopyView(dstTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane1Only);
|
||||
copyDst = utils::CreateImageCopyTexture(dstTexture, 0, {0, 0, 0},
|
||||
wgpu::TextureAspect::Plane1Only);
|
||||
|
||||
{
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
encoder.CopyBufferToTexture(&srcCopyView, &dstCopyView, ©Size);
|
||||
encoder.CopyBufferToTexture(©Src, ©Dst, ©Size);
|
||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||
}
|
||||
}
|
||||
|
@ -306,15 +306,16 @@ namespace {
|
|||
|
||||
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);
|
||||
wgpu::Extent3D writeSize = {1, 1, 1};
|
||||
|
||||
wgpu::Queue queue = device.GetQueue();
|
||||
|
||||
ASSERT_DEVICE_ERROR(queue.WriteTexture(&textureCopyView, dummyData.data(), dummyData.size(),
|
||||
&textureDataLayout, &writeSize));
|
||||
ASSERT_DEVICE_ERROR(queue.WriteTexture(&imageCopyTexture, dummyData.data(),
|
||||
dummyData.size(), &textureDataLayout, &writeSize));
|
||||
}
|
||||
|
||||
// Tests writing into a multi-planar format per plane fails.
|
||||
|
@ -323,16 +324,16 @@ namespace {
|
|||
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
|
||||
|
||||
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 12, 4);
|
||||
wgpu::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(texture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
wgpu::ImageCopyTexture imageCopyTexture =
|
||||
utils::CreateImageCopyTexture(texture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
|
||||
|
||||
std::vector<uint8_t> dummmyData(4, 0);
|
||||
wgpu::Extent3D writeSize = {1, 1, 1};
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
} // anonymous namespace
|
||||
|
|
|
@ -339,8 +339,9 @@ namespace dawn_native { namespace vulkan {
|
|||
wgpu::Queue dawnQueue,
|
||||
wgpu::Texture source,
|
||||
wgpu::Texture destination) {
|
||||
wgpu::TextureCopyView copySrc = utils::CreateTextureCopyView(source, 0, {0, 0, 0});
|
||||
wgpu::TextureCopyView copyDst = utils::CreateTextureCopyView(destination, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(source, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyTexture copyDst =
|
||||
utils::CreateImageCopyTexture(destination, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
@ -531,9 +532,9 @@ namespace dawn_native { namespace vulkan {
|
|||
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
// Copy |deviceWrappedTexture| into |copyDstBuffer|
|
||||
wgpu::TextureCopyView copySrc =
|
||||
utils::CreateTextureCopyView(deviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView copyDst = utils::CreateBufferCopyView(copyDstBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture copySrc =
|
||||
utils::CreateImageCopyTexture(deviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(copyDstBuffer, 0, 256);
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
@ -585,9 +586,9 @@ namespace dawn_native { namespace vulkan {
|
|||
utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201});
|
||||
|
||||
// Copy |copySrcBuffer| into |secondDeviceWrappedTexture|
|
||||
wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, 256);
|
||||
wgpu::TextureCopyView copyDst =
|
||||
utils::CreateTextureCopyView(secondDeviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(copySrcBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture copyDst =
|
||||
utils::CreateImageCopyTexture(secondDeviceWrappedTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
@ -816,10 +817,10 @@ namespace dawn_native { namespace vulkan {
|
|||
{
|
||||
wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData(
|
||||
secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView copySrc =
|
||||
utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow);
|
||||
wgpu::TextureCopyView copyDst =
|
||||
utils::CreateTextureCopyView(wrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copySrc =
|
||||
utils::CreateImageCopyBuffer(copySrcBuffer, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture copyDst =
|
||||
utils::CreateImageCopyTexture(wrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder();
|
||||
|
@ -843,10 +844,10 @@ namespace dawn_native { namespace vulkan {
|
|||
copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer copyDstBuffer = device.CreateBuffer(©Desc);
|
||||
{
|
||||
wgpu::TextureCopyView copySrc =
|
||||
utils::CreateTextureCopyView(nextWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView copyDst =
|
||||
utils::CreateBufferCopyView(copyDstBuffer, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture copySrc =
|
||||
utils::CreateImageCopyTexture(nextWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copyDst =
|
||||
utils::CreateImageCopyBuffer(copyDstBuffer, 0, bytesPerRow);
|
||||
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
|
||||
|
|
|
@ -455,12 +455,12 @@ namespace dawn_native { namespace vulkan {
|
|||
wgpu::Queue dawnQueue,
|
||||
wgpu::Texture source,
|
||||
wgpu::Texture destination) {
|
||||
wgpu::TextureCopyView copySrc;
|
||||
wgpu::ImageCopyTexture copySrc;
|
||||
copySrc.texture = source;
|
||||
copySrc.mipLevel = 0;
|
||||
copySrc.origin = {0, 0, 0};
|
||||
|
||||
wgpu::TextureCopyView copyDst;
|
||||
wgpu::ImageCopyTexture copyDst;
|
||||
copyDst.texture = destination;
|
||||
copyDst.mipLevel = 0;
|
||||
copyDst.origin = {0, 0, 0};
|
||||
|
@ -665,9 +665,9 @@ namespace dawn_native { namespace vulkan {
|
|||
wgpu::Buffer copyDstBuffer = device.CreateBuffer(&bufferDesc);
|
||||
|
||||
// Copy |deviceWrappedTexture| into |copyDstBuffer|
|
||||
wgpu::TextureCopyView copySrc =
|
||||
utils::CreateTextureCopyView(deviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView copyDst = utils::CreateBufferCopyView(copyDstBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture copySrc =
|
||||
utils::CreateImageCopyTexture(deviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copyDst = utils::CreateImageCopyBuffer(copyDstBuffer, 0, 256);
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
@ -721,9 +721,9 @@ namespace dawn_native { namespace vulkan {
|
|||
utils::CreateBufferFromData(secondDevice, wgpu::BufferUsage::CopySrc, {0x04030201});
|
||||
|
||||
// Copy |copySrcBuffer| into |secondDeviceWrappedTexture|
|
||||
wgpu::BufferCopyView copySrc = utils::CreateBufferCopyView(copySrcBuffer, 0, 256);
|
||||
wgpu::TextureCopyView copyDst =
|
||||
utils::CreateTextureCopyView(secondDeviceWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(copySrcBuffer, 0, 256);
|
||||
wgpu::ImageCopyTexture copyDst =
|
||||
utils::CreateImageCopyTexture(secondDeviceWrappedTexture, 0, {0, 0, 0});
|
||||
|
||||
wgpu::Extent3D copySize = {1, 1, 1};
|
||||
|
||||
|
@ -979,10 +979,10 @@ namespace dawn_native { namespace vulkan {
|
|||
{
|
||||
wgpu::Buffer copySrcBuffer = utils::CreateBufferFromData(
|
||||
secondDevice, data.data(), data.size(), wgpu::BufferUsage::CopySrc);
|
||||
wgpu::BufferCopyView copySrc =
|
||||
utils::CreateBufferCopyView(copySrcBuffer, 0, bytesPerRow);
|
||||
wgpu::TextureCopyView copyDst =
|
||||
utils::CreateTextureCopyView(wrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copySrc =
|
||||
utils::CreateImageCopyBuffer(copySrcBuffer, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture copyDst =
|
||||
utils::CreateImageCopyTexture(wrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
|
||||
wgpu::CommandEncoder encoder = secondDevice.CreateCommandEncoder();
|
||||
|
@ -1009,10 +1009,10 @@ namespace dawn_native { namespace vulkan {
|
|||
copyDesc.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
|
||||
wgpu::Buffer copyDstBuffer = device.CreateBuffer(©Desc);
|
||||
{
|
||||
wgpu::TextureCopyView copySrc =
|
||||
utils::CreateTextureCopyView(nextWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::BufferCopyView copyDst =
|
||||
utils::CreateBufferCopyView(copyDstBuffer, 0, bytesPerRow);
|
||||
wgpu::ImageCopyTexture copySrc =
|
||||
utils::CreateImageCopyTexture(nextWrappedTexture, 0, {0, 0, 0});
|
||||
wgpu::ImageCopyBuffer copyDst =
|
||||
utils::CreateImageCopyBuffer(copyDstBuffer, 0, bytesPerRow);
|
||||
|
||||
wgpu::Extent3D copySize = {width, height, 1};
|
||||
|
||||
|
|
|
@ -123,13 +123,14 @@ namespace utils {
|
|||
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc;
|
||||
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 =
|
||||
utils::CreateTextureDataLayout(0, wgpu::kCopyStrideUndefined);
|
||||
wgpu::Extent3D copyExtent = {1, 1, 1};
|
||||
|
||||
// WriteTexture with exactly 1 byte of data.
|
||||
device.GetQueue().WriteTexture(&textureCopyView, data.data(), 1, &textureDataLayout,
|
||||
device.GetQueue().WriteTexture(&imageCopyTexture, data.data(), 1, &textureDataLayout,
|
||||
©Extent);
|
||||
}
|
||||
} // namespace utils
|
||||
|
|
|
@ -268,28 +268,28 @@ namespace utils {
|
|||
return BasicRenderPass(width, height, color);
|
||||
}
|
||||
|
||||
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer,
|
||||
uint64_t offset,
|
||||
uint32_t bytesPerRow,
|
||||
uint32_t rowsPerImage) {
|
||||
wgpu::BufferCopyView bufferCopyView = {};
|
||||
bufferCopyView.buffer = buffer;
|
||||
bufferCopyView.layout = CreateTextureDataLayout(offset, bytesPerRow, rowsPerImage);
|
||||
wgpu::ImageCopyBuffer CreateImageCopyBuffer(wgpu::Buffer buffer,
|
||||
uint64_t offset,
|
||||
uint32_t bytesPerRow,
|
||||
uint32_t rowsPerImage) {
|
||||
wgpu::ImageCopyBuffer imageCopyBuffer = {};
|
||||
imageCopyBuffer.buffer = buffer;
|
||||
imageCopyBuffer.layout = CreateTextureDataLayout(offset, bytesPerRow, rowsPerImage);
|
||||
|
||||
return bufferCopyView;
|
||||
return imageCopyBuffer;
|
||||
}
|
||||
|
||||
wgpu::TextureCopyView CreateTextureCopyView(wgpu::Texture texture,
|
||||
uint32_t mipLevel,
|
||||
wgpu::Origin3D origin,
|
||||
wgpu::TextureAspect aspect) {
|
||||
wgpu::TextureCopyView textureCopyView;
|
||||
textureCopyView.texture = texture;
|
||||
textureCopyView.mipLevel = mipLevel;
|
||||
textureCopyView.origin = origin;
|
||||
textureCopyView.aspect = aspect;
|
||||
wgpu::ImageCopyTexture CreateImageCopyTexture(wgpu::Texture texture,
|
||||
uint32_t mipLevel,
|
||||
wgpu::Origin3D origin,
|
||||
wgpu::TextureAspect aspect) {
|
||||
wgpu::ImageCopyTexture imageCopyTexture;
|
||||
imageCopyTexture.texture = texture;
|
||||
imageCopyTexture.mipLevel = mipLevel;
|
||||
imageCopyTexture.origin = origin;
|
||||
imageCopyTexture.aspect = aspect;
|
||||
|
||||
return textureCopyView;
|
||||
return imageCopyTexture;
|
||||
}
|
||||
|
||||
wgpu::TextureDataLayout CreateTextureDataLayout(uint64_t offset,
|
||||
|
|
|
@ -50,11 +50,11 @@ namespace utils {
|
|||
return CreateBufferFromData(device, data.begin(), uint32_t(sizeof(T) * data.size()), usage);
|
||||
}
|
||||
|
||||
wgpu::BufferCopyView CreateBufferCopyView(wgpu::Buffer buffer,
|
||||
uint64_t offset,
|
||||
uint32_t bytesPerRow,
|
||||
uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
|
||||
wgpu::TextureCopyView CreateTextureCopyView(
|
||||
wgpu::ImageCopyBuffer CreateImageCopyBuffer(wgpu::Buffer buffer,
|
||||
uint64_t offset,
|
||||
uint32_t bytesPerRow,
|
||||
uint32_t rowsPerImage = wgpu::kCopyStrideUndefined);
|
||||
wgpu::ImageCopyTexture CreateImageCopyTexture(
|
||||
wgpu::Texture texture,
|
||||
uint32_t level,
|
||||
wgpu::Origin3D origin,
|
||||
|
|
Loading…
Reference in New Issue