gfx-rs/gfx

Unimplemented path in Dx12 backend when constructing cube views of depth textures

Imberflur opened this issue · 0 comments

Description
Constructing a cube view of a depth buffer, e.g. for sampling for shadows appears to hit an unimplemented! in the dx12 backend of gfx-hal

panicked at 'not implemented', /root/.cargo/git/checkouts/gfx-e86e7f3ebdbc4218/2125c1d/src/backend/dx12/src/device.rs:786:17

Repro steps
Create a texture with:

        let point_shadow_tex = wgpu::TextureDescriptor {
            label: None,
            size: wgpu::Extent3d {
                width: diag_two_size / 4,
                height: diag_two_size / 4,
                depth_or_array_layers: 6,
            },
            mip_level_count: levels,
            sample_count: 1,
            dimension: wgpu::TextureDimension::D2,
            format: wgpu::TextureFormat::Depth24Plus,
            usage: wgpu::TextureUsage::SAMPLED | wgpu::TextureUsage::RENDER_ATTACHMENT,
        };

And create a view with:

        let point_shadow_view = wgpu::TextureViewDescriptor {
            label: None,
            format: Some(wgpu::TextureFormat::Depth24Plus),
            dimension: Some(wgpu::TextureViewDimension::Cube),
            aspect: wgpu::TextureAspect::DepthOnly,
            base_mip_level: 0,
            level_count: None,
            base_array_layer: 0,
            array_layer_count: None,
        };

Runnable example: TODO...
(if you want to spend a decent amount of time compiling you can checkout and build this branch on windows: https://gitlab.com/veloren/veloren/-/tree/imbris/wgpu-master-rebased, current last commit is 46282f996772c8691cd3ccea0fc74ce65380b703)

Expected vs observed behavior
Views construct the same as with the vulkan backend vs panic when using dx12

Extra materials

   8: core::panicking::panic
             at /rustc/44e3daf5eee8263dfc3a2509e78ddd1f6f783a0e\/library\core\src\panicking.rs:50:5
   9: gfx_backend_dx12::device::<impl gfx_backend_dx12::Device>::view_image_as_depth_stencil_impl
  10: gfx_backend_dx12::device::<impl gfx_hal::device::Device<gfx_backend_dx12::Backend> for gfx_backend_dx12::Device>::create_image_view
  11: wgpu_core::device::<impl wgpu_core::hub::Global<G>>::texture_create_view
  12: <wgpu::backend::direct::Context as wgpu::Context>::texture_create_view
  13: veloren_voxygen::render::texture::Texture::new_raw
  14: veloren_voxygen::render::renderer::Renderer::create_shadow_views
  15: veloren_voxygen::render::renderer::Renderer::new

Platform
Windows 10, Dx12 backend, wgpu-rs a7e03546c1584cefef5b926f923108ea2cd1c146