Cannot copy from depth texture to depth texture array even if entire texture is copied
EriKWDev opened this issue · 4 comments
Description
When I'm calling encoder.copy_texture_to_texture
from a depth texture to a texture2darray of depth texture I get validation error:
wgpu error: Validation Error
Caused by:
In CommandEncoder::copy_texture_to_texture
Copy error
The entire texture must be copied when copying from depth texture
even though the entire depth texture is being copied.
I happen to have differing sample_counts when I discovered this, but further testing keeps giving me the same error even if the textures have the same sample_count.
let multisampled_depth_texture = device.create_texture(&TextureDescriptor {
label: None,
size: Extent3d {
width: 512,
height: 512,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 4, // NOTE: Sample count > 1
dimension: TextureDimension::D2,
format: TextureFormat::Depth24Plus,
usage: TextureUsages::TEXTURE_BINDING
| TextureUsages::RENDER_ATTACHMENT
| TextureUsages::COPY_SRC,
view_formats: &[TextureFormat::Depth24Plus],
});
let non_multisampled_depth_2d_array = device.create_texture(&TextureDescriptor {
label: None,
size: Extent3d {
width: 512,
height: 512,
depth_or_array_layers: 10,
},
mip_level_count: 1,
sample_count: 1, // NOTE: This array has sample_count = 1
dimension: TextureDimension::D2,
format: TextureFormat::Depth24Plus,
usage: TextureUsages::TEXTURE_BINDING
| TextureUsages::RENDER_ATTACHMENT
| TextureUsages::COPY_DST,
view_formats: &[TextureFormat::Depth24Plus],
});
// .. LATER ..
encoder.copy_texture_to_texture(
multisampled_depth_texture.as_image_copy(),
ImageCopyTexture {
texture: &non_multisampled_depth_2d_array,
mip_level: 0,
origin: Origin3d {
x: 0,
y: 0,
z: array_index,
},
aspect: TextureAspect::All,
},
Extent3d {
width: multisampled_depth_texture.width(),
height: multisampled_depth_texture.height(),
depth_or_array_layers: 1,
},
);
Expected vs observed behavior
I would like to copy a depth texture with sample_count > 1 into the texture2d array of depth textures with sample_count = 1
I don't know whether this is an issue in the reported error, the validator or whether this is not permitted by the spec.
Platform
Os: Linux 6.1.0-20, Debian 12 bookworm
Backend: Vulkan
wgpu: 0.19.4
rust: 1.78
CPU: AMD Ryzen 7 1700X (16) @ 3.400GHz
GPU: AMD ATI Radeon RX 6600/6600 XT/6600M
Update: Multisampled or not has no effect, still same issue if both textures have multisample_count: 1