Use mipLevel/arrayLayer for TextureCopyView

These are the names for the level/slice concept in WebGPU and this one
occurence was forgotten in the previous rename.

BUG=dawn:22

Change-Id: I0aef05e21b2291cf02712034c6ddc3ab62ecbc33
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8681
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2019-07-08 09:41:51 +00:00 committed by Commit Bot service account
parent a0491c9141
commit 3c3e2bc4d9
8 changed files with 95 additions and 87 deletions

View File

@ -1018,8 +1018,8 @@
"extensible": true, "extensible": true,
"members": [ "members": [
{"name": "texture", "type": "texture"}, {"name": "texture", "type": "texture"},
{"name": "level", "type": "uint32_t"}, {"name": "mip level", "type": "uint32_t"},
{"name": "slice", "type": "uint32_t"}, {"name": "array layer", "type": "uint32_t"},
{"name": "origin", "type": "origin 3D"} {"name": "origin", "type": "origin 3D"}
] ]
}, },

View File

@ -35,20 +35,18 @@ namespace dawn_native {
MaybeError ValidateCopySizeFitsInTexture(const TextureCopy& textureCopy, MaybeError ValidateCopySizeFitsInTexture(const TextureCopy& textureCopy,
const Extent3D& copySize) { const Extent3D& copySize) {
const TextureBase* texture = textureCopy.texture.Get(); const TextureBase* texture = textureCopy.texture.Get();
if (textureCopy.level >= texture->GetNumMipLevels()) { if (textureCopy.mipLevel >= texture->GetNumMipLevels()) {
return DAWN_VALIDATION_ERROR("Copy mip-level out of range"); return DAWN_VALIDATION_ERROR("Copy mipLevel out of range");
} }
if (textureCopy.slice >= texture->GetArrayLayers()) { if (textureCopy.arrayLayer >= texture->GetArrayLayers()) {
return DAWN_VALIDATION_ERROR("Copy array-layer out of range"); return DAWN_VALIDATION_ERROR("Copy arrayLayer out of range");
} }
Extent3D extent = texture->GetMipLevelPhysicalSize(textureCopy.mipLevel);
// All texture dimensions are in uint32_t so by doing checks in uint64_t we avoid // All texture dimensions are in uint32_t so by doing checks in uint64_t we avoid
// overflows. // overflows.
uint64_t level = textureCopy.level;
Extent3D extent = texture->GetMipLevelPhysicalSize(level);
if (uint64_t(textureCopy.origin.x) + uint64_t(copySize.width) > if (uint64_t(textureCopy.origin.x) + uint64_t(copySize.width) >
static_cast<uint64_t>(extent.width) || static_cast<uint64_t>(extent.width) ||
uint64_t(textureCopy.origin.y) + uint64_t(copySize.height) > uint64_t(textureCopy.origin.y) + uint64_t(copySize.height) >
@ -766,8 +764,8 @@ namespace dawn_native {
copy->destination.texture = destination->texture; copy->destination.texture = destination->texture;
copy->destination.origin = destination->origin; copy->destination.origin = destination->origin;
copy->copySize = *copySize; copy->copySize = *copySize;
copy->destination.level = destination->level; copy->destination.mipLevel = destination->mipLevel;
copy->destination.slice = destination->slice; copy->destination.arrayLayer = destination->arrayLayer;
if (source->rowPitch == 0) { if (source->rowPitch == 0) {
copy->source.rowPitch = copy->source.rowPitch =
ComputeDefaultRowPitch(destination->texture->GetFormat(), copySize->width); ComputeDefaultRowPitch(destination->texture->GetFormat(), copySize->width);
@ -801,8 +799,8 @@ namespace dawn_native {
copy->source.texture = source->texture; copy->source.texture = source->texture;
copy->source.origin = source->origin; copy->source.origin = source->origin;
copy->copySize = *copySize; copy->copySize = *copySize;
copy->source.level = source->level; copy->source.mipLevel = source->mipLevel;
copy->source.slice = source->slice; copy->source.arrayLayer = source->arrayLayer;
copy->destination.buffer = destination->buffer; copy->destination.buffer = destination->buffer;
copy->destination.offset = destination->offset; copy->destination.offset = destination->offset;
if (destination->rowPitch == 0) { if (destination->rowPitch == 0) {
@ -837,12 +835,12 @@ namespace dawn_native {
mAllocator.Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture); mAllocator.Allocate<CopyTextureToTextureCmd>(Command::CopyTextureToTexture);
copy->source.texture = source->texture; copy->source.texture = source->texture;
copy->source.origin = source->origin; copy->source.origin = source->origin;
copy->source.level = source->level; copy->source.mipLevel = source->mipLevel;
copy->source.slice = source->slice; copy->source.arrayLayer = source->arrayLayer;
copy->destination.texture = destination->texture; copy->destination.texture = destination->texture;
copy->destination.origin = destination->origin; copy->destination.origin = destination->origin;
copy->destination.level = destination->level; copy->destination.mipLevel = destination->mipLevel;
copy->destination.slice = destination->slice; copy->destination.arrayLayer = destination->arrayLayer;
copy->copySize = *copySize; copy->copySize = *copySize;
} }

View File

@ -100,8 +100,8 @@ namespace dawn_native {
struct TextureCopy { struct TextureCopy {
Ref<TextureBase> texture; Ref<TextureBase> texture;
uint32_t level; uint32_t mipLevel;
uint32_t slice; uint32_t arrayLayer;
Origin3D origin; // Texels Origin3D origin; // Texels
}; };

View File

@ -509,12 +509,13 @@ namespace dawn_native { namespace d3d12 {
Texture* texture = ToBackend(copy->destination.texture.Get()); Texture* texture = ToBackend(copy->destination.texture.Get());
if (IsCompleteSubresourceCopiedTo(texture, copy->copySize, if (IsCompleteSubresourceCopiedTo(texture, copy->copySize,
copy->destination.level)) { copy->destination.mipLevel)) {
texture->SetIsSubresourceContentInitialized(copy->destination.level, 1, texture->SetIsSubresourceContentInitialized(
copy->destination.slice, 1); copy->destination.mipLevel, 1, copy->destination.arrayLayer, 1);
} else { } else {
texture->EnsureSubresourceContentInitialized( texture->EnsureSubresourceContentInitialized(
commandList, copy->destination.level, 1, copy->destination.slice, 1); commandList, copy->destination.mipLevel, 1,
copy->destination.arrayLayer, 1);
} }
buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc); buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferSrc);
@ -525,8 +526,8 @@ namespace dawn_native { namespace d3d12 {
copy->source.offset, copy->source.rowPitch, copy->source.imageHeight); copy->source.offset, copy->source.rowPitch, copy->source.imageHeight);
D3D12_TEXTURE_COPY_LOCATION textureLocation = D3D12_TEXTURE_COPY_LOCATION textureLocation =
CreateTextureCopyLocationForTexture(*texture, copy->destination.level, CreateTextureCopyLocationForTexture(*texture, copy->destination.mipLevel,
copy->destination.slice); copy->destination.arrayLayer);
for (uint32_t i = 0; i < copySplit.count; ++i) { for (uint32_t i = 0; i < copySplit.count; ++i) {
auto& info = copySplit.copies[i]; auto& info = copySplit.copies[i];
@ -560,8 +561,8 @@ namespace dawn_native { namespace d3d12 {
Texture* texture = ToBackend(copy->source.texture.Get()); Texture* texture = ToBackend(copy->source.texture.Get());
Buffer* buffer = ToBackend(copy->destination.buffer.Get()); Buffer* buffer = ToBackend(copy->destination.buffer.Get());
texture->EnsureSubresourceContentInitialized(commandList, copy->source.level, 1, texture->EnsureSubresourceContentInitialized(commandList, copy->source.mipLevel,
copy->source.slice, 1); 1, copy->source.arrayLayer, 1);
texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc); texture->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc);
buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst); buffer->TransitionUsageNow(commandList, dawn::BufferUsageBit::TransferDst);
@ -572,8 +573,8 @@ namespace dawn_native { namespace d3d12 {
copy->destination.imageHeight); copy->destination.imageHeight);
D3D12_TEXTURE_COPY_LOCATION textureLocation = D3D12_TEXTURE_COPY_LOCATION textureLocation =
CreateTextureCopyLocationForTexture(*texture, copy->source.level, CreateTextureCopyLocationForTexture(*texture, copy->source.mipLevel,
copy->source.slice); copy->source.arrayLayer);
for (uint32_t i = 0; i < copySplit.count; ++i) { for (uint32_t i = 0; i < copySplit.count; ++i) {
auto& info = copySplit.copies[i]; auto& info = copySplit.copies[i];
@ -610,15 +611,16 @@ namespace dawn_native { namespace d3d12 {
Texture* source = ToBackend(copy->source.texture.Get()); Texture* source = ToBackend(copy->source.texture.Get());
Texture* destination = ToBackend(copy->destination.texture.Get()); Texture* destination = ToBackend(copy->destination.texture.Get());
source->EnsureSubresourceContentInitialized(commandList, copy->source.level, 1, source->EnsureSubresourceContentInitialized(commandList, copy->source.mipLevel,
copy->source.slice, 1); 1, copy->source.arrayLayer, 1);
if (IsCompleteSubresourceCopiedTo(destination, copy->copySize, if (IsCompleteSubresourceCopiedTo(destination, copy->copySize,
copy->destination.level)) { copy->destination.mipLevel)) {
destination->SetIsSubresourceContentInitialized(copy->destination.level, 1, destination->SetIsSubresourceContentInitialized(
copy->destination.slice, 1); copy->destination.mipLevel, 1, copy->destination.arrayLayer, 1);
} else { } else {
destination->EnsureSubresourceContentInitialized( destination->EnsureSubresourceContentInitialized(
commandList, copy->destination.level, 1, copy->destination.slice, 1); commandList, copy->destination.mipLevel, 1,
copy->destination.arrayLayer, 1);
} }
source->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc); source->TransitionUsageNow(commandList, dawn::TextureUsageBit::TransferSrc);
destination->TransitionUsageNow(commandList, destination->TransitionUsageNow(commandList,
@ -630,12 +632,13 @@ namespace dawn_native { namespace d3d12 {
source->GetD3D12Resource()); source->GetD3D12Resource());
} else { } else {
D3D12_TEXTURE_COPY_LOCATION srcLocation = D3D12_TEXTURE_COPY_LOCATION srcLocation =
CreateTextureCopyLocationForTexture(*source, copy->source.level, CreateTextureCopyLocationForTexture(*source, copy->source.mipLevel,
copy->source.slice); copy->source.arrayLayer);
D3D12_TEXTURE_COPY_LOCATION dstLocation = D3D12_TEXTURE_COPY_LOCATION dstLocation =
CreateTextureCopyLocationForTexture( CreateTextureCopyLocationForTexture(*destination,
*destination, copy->destination.level, copy->destination.slice); copy->destination.mipLevel,
copy->destination.arrayLayer);
D3D12_BOX sourceRegion; D3D12_BOX sourceRegion;
sourceRegion.left = copy->source.origin.x; sourceRegion.left = copy->source.origin.x;

View File

@ -409,8 +409,8 @@ namespace dawn_native { namespace metal {
sourceBytesPerImage:(src.rowPitch * src.imageHeight) sourceBytesPerImage:(src.rowPitch * src.imageHeight)
sourceSize:size sourceSize:size
toTexture:texture->GetMTLTexture() toTexture:texture->GetMTLTexture()
destinationSlice:dst.slice destinationSlice:dst.arrayLayer
destinationLevel:dst.level destinationLevel:dst.mipLevel
destinationOrigin:origin]; destinationOrigin:origin];
break; break;
} }
@ -426,8 +426,8 @@ namespace dawn_native { namespace metal {
sourceBytesPerImage:(src.rowPitch * src.imageHeight) sourceBytesPerImage:(src.rowPitch * src.imageHeight)
sourceSize:MTLSizeMake(size.width, size.height, size.depth - 1) sourceSize:MTLSizeMake(size.width, size.height, size.depth - 1)
toTexture:texture->GetMTLTexture() toTexture:texture->GetMTLTexture()
destinationSlice:dst.slice destinationSlice:dst.arrayLayer
destinationLevel:dst.level destinationLevel:dst.mipLevel
destinationOrigin:origin]; destinationOrigin:origin];
// Update offset to copy to the last image. // Update offset to copy to the last image.
@ -442,8 +442,8 @@ namespace dawn_native { namespace metal {
sourceBytesPerImage:(src.rowPitch * (src.imageHeight - 1)) sourceBytesPerImage:(src.rowPitch * (src.imageHeight - 1))
sourceSize:MTLSizeMake(size.width, size.height - 1, 1) sourceSize:MTLSizeMake(size.width, size.height - 1, 1)
toTexture:texture->GetMTLTexture() toTexture:texture->GetMTLTexture()
destinationSlice:dst.slice destinationSlice:dst.arrayLayer
destinationLevel:dst.level destinationLevel:dst.mipLevel
destinationOrigin:MTLOriginMake(origin.x, origin.y, destinationOrigin:MTLOriginMake(origin.x, origin.y,
origin.z + size.depth - 1)]; origin.z + size.depth - 1)];
@ -462,8 +462,8 @@ namespace dawn_native { namespace metal {
sourceBytesPerImage:lastRowDataSize sourceBytesPerImage:lastRowDataSize
sourceSize:MTLSizeMake(size.width, 1, 1) sourceSize:MTLSizeMake(size.width, 1, 1)
toTexture:texture->GetMTLTexture() toTexture:texture->GetMTLTexture()
destinationSlice:dst.slice destinationSlice:dst.arrayLayer
destinationLevel:dst.level destinationLevel:dst.mipLevel
destinationOrigin:MTLOriginMake(origin.x, origin.y + size.height - 1, destinationOrigin:MTLOriginMake(origin.x, origin.y + size.height - 1,
origin.z + size.depth - 1)]; origin.z + size.depth - 1)];
} break; } break;
@ -515,8 +515,8 @@ namespace dawn_native { namespace metal {
if (!needWorkaround) { if (!needWorkaround) {
[encoders.blit copyFromTexture:texture->GetMTLTexture() [encoders.blit copyFromTexture:texture->GetMTLTexture()
sourceSlice:src.slice sourceSlice:src.arrayLayer
sourceLevel:src.level sourceLevel:src.mipLevel
sourceOrigin:origin sourceOrigin:origin
sourceSize:size sourceSize:size
toBuffer:buffer->GetMTLBuffer() toBuffer:buffer->GetMTLBuffer()
@ -533,8 +533,8 @@ namespace dawn_native { namespace metal {
size.depth = copySize.depth - 1; size.depth = copySize.depth - 1;
[encoders.blit copyFromTexture:texture->GetMTLTexture() [encoders.blit copyFromTexture:texture->GetMTLTexture()
sourceSlice:src.slice sourceSlice:src.arrayLayer
sourceLevel:src.level sourceLevel:src.mipLevel
sourceOrigin:origin sourceOrigin:origin
sourceSize:MTLSizeMake(size.width, size.height, sourceSize:MTLSizeMake(size.width, size.height,
size.depth - 1) size.depth - 1)
@ -550,8 +550,8 @@ namespace dawn_native { namespace metal {
// Doing all the copy in last image except the last row. // Doing all the copy in last image except the last row.
if (size.height > 1) { if (size.height > 1) {
[encoders.blit copyFromTexture:texture->GetMTLTexture() [encoders.blit copyFromTexture:texture->GetMTLTexture()
sourceSlice:src.slice sourceSlice:src.arrayLayer
sourceLevel:src.level sourceLevel:src.mipLevel
sourceOrigin:MTLOriginMake(origin.x, origin.y, sourceOrigin:MTLOriginMake(origin.x, origin.y,
origin.z + size.depth - 1) origin.z + size.depth - 1)
sourceSize:MTLSizeMake(size.width, size.height - 1, 1) sourceSize:MTLSizeMake(size.width, size.height - 1, 1)
@ -570,8 +570,8 @@ namespace dawn_native { namespace metal {
[encoders.blit [encoders.blit
copyFromTexture:texture->GetMTLTexture() copyFromTexture:texture->GetMTLTexture()
sourceSlice:src.slice sourceSlice:src.arrayLayer
sourceLevel:src.level sourceLevel:src.mipLevel
sourceOrigin:MTLOriginMake(origin.x, origin.y + size.height - 1, sourceOrigin:MTLOriginMake(origin.x, origin.y + size.height - 1,
origin.z + size.depth - 1) origin.z + size.depth - 1)
sourceSize:MTLSizeMake(size.width, 1, 1) sourceSize:MTLSizeMake(size.width, 1, 1)
@ -605,13 +605,13 @@ namespace dawn_native { namespace metal {
encoders.EnsureBlit(commandBuffer); encoders.EnsureBlit(commandBuffer);
[encoders.blit copyFromTexture:srcTexture->GetMTLTexture() [encoders.blit copyFromTexture:srcTexture->GetMTLTexture()
sourceSlice:copy->source.slice sourceSlice:copy->source.arrayLayer
sourceLevel:copy->source.level sourceLevel:copy->source.mipLevel
sourceOrigin:srcOrigin sourceOrigin:srcOrigin
sourceSize:size sourceSize:size
toTexture:dstTexture->GetMTLTexture() toTexture:dstTexture->GetMTLTexture()
destinationSlice:copy->destination.slice destinationSlice:copy->destination.arrayLayer
destinationLevel:copy->destination.level destinationLevel:copy->destination.mipLevel
destinationOrigin:dstOrigin]; destinationOrigin:dstOrigin];
} break; } break;

View File

@ -393,10 +393,12 @@ namespace dawn_native { namespace opengl {
Texture* texture = ToBackend(dst.texture.Get()); Texture* texture = ToBackend(dst.texture.Get());
GLenum target = texture->GetGLTarget(); GLenum target = texture->GetGLTarget();
auto format = texture->GetGLFormat(); auto format = texture->GetGLFormat();
if (IsCompleteSubresourceCopiedTo(texture, copySize, dst.level)) { if (IsCompleteSubresourceCopiedTo(texture, copySize, dst.mipLevel)) {
texture->SetIsSubresourceContentInitialized(dst.level, 1, dst.slice, 1); texture->SetIsSubresourceContentInitialized(dst.mipLevel, 1, dst.arrayLayer,
1);
} else { } else {
texture->EnsureSubresourceContentInitialized(dst.level, 1, dst.slice, 1); texture->EnsureSubresourceContentInitialized(dst.mipLevel, 1,
dst.arrayLayer, 1);
} }
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->GetHandle()); gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->GetHandle());
@ -410,13 +412,14 @@ namespace dawn_native { namespace opengl {
case dawn::TextureDimension::e2D: case dawn::TextureDimension::e2D:
if (texture->GetArrayLayers() > 1) { if (texture->GetArrayLayers() > 1) {
gl.TexSubImage3D( gl.TexSubImage3D(
target, dst.level, dst.origin.x, dst.origin.y, dst.slice, target, dst.mipLevel, dst.origin.x, dst.origin.y,
copySize.width, copySize.height, 1, format.format, format.type, dst.arrayLayer, copySize.width, copySize.height, 1,
format.format, format.type,
reinterpret_cast<void*>(static_cast<uintptr_t>(src.offset))); reinterpret_cast<void*>(static_cast<uintptr_t>(src.offset)));
} else { } else {
gl.TexSubImage2D( gl.TexSubImage2D(
target, dst.level, dst.origin.x, dst.origin.y, copySize.width, target, dst.mipLevel, dst.origin.x, dst.origin.y,
copySize.height, format.format, format.type, copySize.width, copySize.height, format.format, format.type,
reinterpret_cast<void*>(static_cast<uintptr_t>(src.offset))); reinterpret_cast<void*>(static_cast<uintptr_t>(src.offset)));
} }
break; break;
@ -440,7 +443,8 @@ namespace dawn_native { namespace opengl {
auto format = texture->GetGLFormat(); auto format = texture->GetGLFormat();
GLenum target = texture->GetGLTarget(); GLenum target = texture->GetGLTarget();
texture->EnsureSubresourceContentInitialized(src.level, 1, src.slice, 1); texture->EnsureSubresourceContentInitialized(src.mipLevel, 1, src.arrayLayer,
1);
// The only way to move data from a texture to a buffer in GL is via // The only way to move data from a texture to a buffer in GL is via
// glReadPixels with a pack buffer. Create a temporary FBO for the copy. // glReadPixels with a pack buffer. Create a temporary FBO for the copy.
gl.BindTexture(target, texture->GetHandle()); gl.BindTexture(target, texture->GetHandle());
@ -453,11 +457,11 @@ namespace dawn_native { namespace opengl {
if (texture->GetArrayLayers() > 1) { if (texture->GetArrayLayers() > 1) {
gl.FramebufferTextureLayer( gl.FramebufferTextureLayer(
GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture->GetHandle(), GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture->GetHandle(),
src.level, src.slice); src.mipLevel, src.arrayLayer);
} else { } else {
gl.FramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, gl.FramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, texture->GetHandle(), GL_TEXTURE_2D, texture->GetHandle(),
src.level); src.mipLevel);
} }
break; break;
@ -488,16 +492,19 @@ namespace dawn_native { namespace opengl {
auto& copySize = copy->copySize; auto& copySize = copy->copySize;
Texture* srcTexture = ToBackend(src.texture.Get()); Texture* srcTexture = ToBackend(src.texture.Get());
Texture* dstTexture = ToBackend(dst.texture.Get()); Texture* dstTexture = ToBackend(dst.texture.Get());
srcTexture->EnsureSubresourceContentInitialized(src.level, 1, src.slice, 1); srcTexture->EnsureSubresourceContentInitialized(src.mipLevel, 1, src.arrayLayer,
if (IsCompleteSubresourceCopiedTo(dstTexture, copySize, dst.level)) { 1);
dstTexture->SetIsSubresourceContentInitialized(dst.level, 1, dst.slice, 1); if (IsCompleteSubresourceCopiedTo(dstTexture, copySize, dst.mipLevel)) {
dstTexture->SetIsSubresourceContentInitialized(dst.mipLevel, 1,
dst.arrayLayer, 1);
} else { } else {
dstTexture->EnsureSubresourceContentInitialized(dst.level, 1, dst.slice, 1); dstTexture->EnsureSubresourceContentInitialized(dst.mipLevel, 1,
dst.arrayLayer, 1);
} }
gl.CopyImageSubData(srcTexture->GetHandle(), srcTexture->GetGLTarget(), gl.CopyImageSubData(srcTexture->GetHandle(), srcTexture->GetGLTarget(),
src.level, src.origin.x, src.origin.y, src.slice, src.mipLevel, src.origin.x, src.origin.y, src.arrayLayer,
dstTexture->GetHandle(), dstTexture->GetGLTarget(), dstTexture->GetHandle(), dstTexture->GetGLTarget(),
dst.level, dst.origin.x, dst.origin.y, dst.slice, dst.mipLevel, dst.origin.x, dst.origin.y, dst.arrayLayer,
copySize.width, copySize.height, 1); copySize.width, copySize.height, 1);
} break; } break;

View File

@ -50,7 +50,7 @@ namespace dawn_native { namespace vulkan {
const Extent3D& copySize) { const Extent3D& copySize) {
Extent3D validTextureCopyExtent = copySize; Extent3D validTextureCopyExtent = copySize;
const TextureBase* texture = textureCopy.texture.Get(); const TextureBase* texture = textureCopy.texture.Get();
Extent3D virtualSizeAtLevel = texture->GetMipLevelVirtualSize(textureCopy.level); Extent3D virtualSizeAtLevel = texture->GetMipLevelVirtualSize(textureCopy.mipLevel);
if (textureCopy.origin.x + copySize.width > virtualSizeAtLevel.width) { if (textureCopy.origin.x + copySize.width > virtualSizeAtLevel.width) {
ASSERT(texture->GetFormat().isCompressed); ASSERT(texture->GetFormat().isCompressed);
validTextureCopyExtent.width = virtualSizeAtLevel.width - textureCopy.origin.x; validTextureCopyExtent.width = virtualSizeAtLevel.width - textureCopy.origin.x;
@ -78,8 +78,8 @@ namespace dawn_native { namespace vulkan {
region.bufferImageHeight = bufferCopy.imageHeight; region.bufferImageHeight = bufferCopy.imageHeight;
region.imageSubresource.aspectMask = texture->GetVkAspectMask(); region.imageSubresource.aspectMask = texture->GetVkAspectMask();
region.imageSubresource.mipLevel = textureCopy.level; region.imageSubresource.mipLevel = textureCopy.mipLevel;
region.imageSubresource.baseArrayLayer = textureCopy.slice; region.imageSubresource.baseArrayLayer = textureCopy.arrayLayer;
region.imageSubresource.layerCount = 1; region.imageSubresource.layerCount = 1;
region.imageOffset.x = textureCopy.origin.x; region.imageOffset.x = textureCopy.origin.x;
@ -103,8 +103,8 @@ namespace dawn_native { namespace vulkan {
VkImageCopy region; VkImageCopy region;
region.srcSubresource.aspectMask = srcTexture->GetVkAspectMask(); region.srcSubresource.aspectMask = srcTexture->GetVkAspectMask();
region.srcSubresource.mipLevel = srcCopy.level; region.srcSubresource.mipLevel = srcCopy.mipLevel;
region.srcSubresource.baseArrayLayer = srcCopy.slice; region.srcSubresource.baseArrayLayer = srcCopy.arrayLayer;
region.srcSubresource.layerCount = 1; region.srcSubresource.layerCount = 1;
region.srcOffset.x = srcCopy.origin.x; region.srcOffset.x = srcCopy.origin.x;
@ -112,8 +112,8 @@ namespace dawn_native { namespace vulkan {
region.srcOffset.z = srcCopy.origin.z; region.srcOffset.z = srcCopy.origin.z;
region.dstSubresource.aspectMask = dstTexture->GetVkAspectMask(); region.dstSubresource.aspectMask = dstTexture->GetVkAspectMask();
region.dstSubresource.mipLevel = dstCopy.level; region.dstSubresource.mipLevel = dstCopy.mipLevel;
region.dstSubresource.baseArrayLayer = dstCopy.slice; region.dstSubresource.baseArrayLayer = dstCopy.arrayLayer;
region.dstSubresource.layerCount = 1; region.dstSubresource.layerCount = 1;
region.dstOffset.x = dstCopy.origin.x; region.dstOffset.x = dstCopy.origin.x;

View File

@ -245,13 +245,13 @@ namespace utils {
} }
dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture, dawn::TextureCopyView CreateTextureCopyView(dawn::Texture texture,
uint32_t level, uint32_t mipLevel,
uint32_t slice, uint32_t arrayLayer,
dawn::Origin3D origin) { dawn::Origin3D origin) {
dawn::TextureCopyView textureCopyView; dawn::TextureCopyView textureCopyView;
textureCopyView.texture = texture; textureCopyView.texture = texture;
textureCopyView.level = level; textureCopyView.mipLevel = mipLevel;
textureCopyView.slice = slice; textureCopyView.arrayLayer = arrayLayer;
textureCopyView.origin = origin; textureCopyView.origin = origin;
return textureCopyView; return textureCopyView;