Rename Buffer/TextureCopyView to ImageCopyBuffer/Texture.

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

Bug: dawn:22

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

View File

@@ -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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);

View File

@@ -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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
commandEncoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
return texture;
};

View File

@@ -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));

View File

@@ -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, &copyConfig.copyExtent3D);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyConfig.copyExtent3D);
wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy);
}
@@ -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, &copyExtent);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copyExtent);
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,
&copyConfig.copyExtent3D);
}

View File

@@ -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, &copyLayout.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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
}
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, &copySize);
wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(texture, textureSpec.copyLevel, textureSpec.copyOrigin);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
wgpu::ImageCopyTexture srcImageCopyTexture =
utils::CreateImageCopyTexture(srcTexture, srcSpec.copyLevel, srcSpec.copyOrigin);
wgpu::ImageCopyTexture dstImageCopyTexture =
utils::CreateImageCopyTexture(dstTexture, dstSpec.copyLevel, dstSpec.copyOrigin);
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
// 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, &copySize);
encoder.CopyTextureToBuffer(&dstImageCopyTexture, &outputImageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commandBuffer = encoder.Finish();
queue.Submit(1, &commandBuffer);

View File

@@ -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, &copyLayout.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, &copySize,
&options);
device.GetQueue().CopyTextureForBrowser(&srcImageCopyTexture, &dstImageCopyTexture,
&copySize, &options);
// Update uniform buffer based on test config
uint32_t uniformBufferData[] = {

View File

@@ -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};

View File

@@ -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;

View File

@@ -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, &copySize);
@@ -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.

View File

@@ -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(&copyView, &kOne, sizeof(kOne), &layout, &copySize);
queue.WriteTexture(&copyDst, &kOne, sizeof(kOne), &layout, &copySize);
// Create a pipeline that loads the texture from both the sampled and storage paths.
wgpu::ComputePipelineDescriptor pipelineDesc;

View File

@@ -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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
wgpu::CommandBuffer commands = encoder.Finish();
queue.Submit(1, &commands);

View File

@@ -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,
&copySize);
const uint32_t bytesPerTexel = utils::GetTexelBlockSizeInBytes(kTextureFormat);

View File

@@ -126,10 +126,11 @@ class RenderPassLoadOpTests : public DawnTest {
bufferDescriptor.usage = wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst;
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);

View File

@@ -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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
}
wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy);

View File

@@ -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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
wgpu::CommandBuffer copy = encoder.Finish();
queue.Submit(1, &copy);

View File

@@ -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, &copyExtent);
wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateImageCopyBuffer(uploadBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
wgpu::ImageCopyTexture imageCopyTexture;
imageCopyTexture.texture = outputTexture;
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyExtent);
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, &copyExtent);
wgpu::ImageCopyTexture imageCopyTexture =
utils::CreateImageCopyTexture(writeonlyStorageTexture, 0, {0, 0, 0});
wgpu::ImageCopyBuffer imageCopyBuffer =
utils::CreateImageCopyBuffer(resultBuffer, 0, kTextureBytesPerRowAlignment, kHeight);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copyExtent);
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);

View File

@@ -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);
}

View File

@@ -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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
}
}
wgpu::CommandBuffer copy = encoder.Finish();

View File

@@ -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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&imageCopyTexture, &imageCopyBuffer, &copySize);
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, &copySize));
EXPECT_LAZY_CLEAR(
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copySize));
EXPECT_LAZY_CLEAR(
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copySize));
EXPECT_LAZY_CLEAR(
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copySize));
EXPECT_LAZY_CLEAR(
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copySize));
EXPECT_LAZY_CLEAR(
0u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copySize));
EXPECT_LAZY_CLEAR(
1u, queue.WriteTexture(&imageCopyTexture, data.data(), data.size() * sizeof(RGBA8),
&textureDataLayout, &copySize));
// 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, &copyExtent3D);
encoder.CopyBufferToTexture(&imageCopyBuffer, &imageCopyTexture, &copyExtent3D);
wgpu::CommandBuffer copy = encoder.Finish();
EXPECT_LAZY_CLEAR(lazyClearCount, queue.Submit(1, &copy));
}
@@ -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, &copyExtent3D);
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copyExtent3D);
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, &copyExtent3D);
encoder.CopyTextureToTexture(&srcImageCopyTexture, &dstImageCopyTexture, &copyExtent3D);
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

View File

@@ -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;

View File

@@ -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});
}

View File

@@ -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));
}
}

View File

@@ -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

View File

@@ -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, &copySize);
encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyTextureToTexture(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyTextureToBuffer(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
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, &copySize);
encoder.CopyBufferToTexture(&copySrc, &copyDst, &copySize);
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

View File

@@ -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(&copyDesc);
{
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};

View File

@@ -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(&copyDesc);
{
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};