gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 551 forks source link

Unimplemented path in Dx11 backend when constructing cube views of depth textures #3711

Closed Imberflur closed 3 years ago

Imberflur commented 3 years ago

Short info header:

PanicInfo: panicked at 'not implemented', D:\veloren\gfx\src\backend\dx11\src\device.rs:771:18

I believe this is similar to the issue that was fixed in dx12: https://github.com/gfx-rs/gfx/issues/3702

I'm currently attempting to mimic the patch used there.

Imberflur commented 3 years ago

with this diff

diff --git a/src/backend/dx11/src/device.rs b/src/backend/dx11/src/device.rs
index 9727b686..568b74bb 100644
--- a/src/backend/dx11/src/device.rs
+++ b/src/backend/dx11/src/device.rs
@@ -768,7 +768,13 @@ impl Device {
                     }
                 }
             }
-            _ => unimplemented!(),
+            image::ViewKind::D1 | image::ViewKind::D1Array | image::ViewKind::D3 | image::ViewKind::Cube | image::ViewKind::CubeArray => {
+                warn!(
+                    "3D and cube views are not supported for the image, kind: {:?}",
+                    info.kind
+                );
+                return Err(image::ViewCreationError::BadKind(info.view_kind));
+            },
         }

         let mut dsv = ptr::null_mut();

I get

WARN gfx_backend_dx11::device: 3D and cube views are not supported for the image, kind: D2(1024, 1024, 6, 1)
wgpu error: Validation Error

Caused by:
    In Texture::create_view
    not enough memory left

Without further investigation I'm not sure whether this is an unrelated error or due to the errors from view creation in the dx11 backend being handled differently than in the dx12 backend.