Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported features were requested: DEPTH24PLUS_STENCIL8 #8295

Closed
crumblingstatue opened this issue Oct 15, 2022 · 9 comments · Fixed by #8297
Closed

unsupported features were requested: DEPTH24PLUS_STENCIL8 #8295

crumblingstatue opened this issue Oct 15, 2022 · 9 comments · Fixed by #8297
Labels
A-desktop Area: Desktop Application bug Something isn't working render-wgpu Issues relating to the wgpu renderer

Comments

@crumblingstatue
Copy link
Contributor

crumblingstatue commented Oct 15, 2022

Describe the bug

Both the vulkan and gl backends error on startup with the following message:

[2022-10-15T07:40:03Z ERROR wgpu::backend::direct] Error in Adapter::request_device: unsupported features were requested: DEPTH24PLUS_STENCIL8
Error: Couldn't create wgpu rendering backend

GPU: RX 580, Mesa 22.2.1
Ruffle version: Ruffle 0.1.0-nightly (178bf4f 2022-10-14)

Expected behavior

The application should initialize the graphics backend correctly.

Affected platform

Desktop app

Operating system

Arch Linux

@crumblingstatue crumblingstatue added the bug Something isn't working label Oct 15, 2022
@n0samu n0samu added A-desktop Area: Desktop Application render-wgpu Issues relating to the wgpu renderer labels Oct 15, 2022
@n0samu
Copy link
Member

n0samu commented Oct 15, 2022

I was about to report this too. It seems like the wgpu upgrade in #8226 completely broke the Vulkan renderer. (It's not working for me on Windows 10, either.) The DX12 renderer continues to work fine, and reverting that commit and rebuilding Ruffle fixes the problem. CC @relrelb

@crumblingstatue
Copy link
Contributor Author

https://github.com/ruffle-rs/ruffle/pull/8226/files#diff-d2d6e71ebcd52c28fa4e4c89c8249dfe5b9deb974415e86181856aef3331eb76L622

I wonder if this change was intentional, and if so, what the reason for it is.

@n0samu
Copy link
Member

n0samu commented Oct 15, 2022

Oh wow that's definitely more changes than just a version bump. Yeah, I wonder what the reason for that is too. Let me see what happens if I just remove the DEPTH24PLUS_STENCIL8 feature...

@crumblingstatue
Copy link
Contributor Author

crumblingstatue commented Oct 15, 2022

If I remove the feature, I get

[2022-10-15T08:01:27Z ERROR wgpu::backend::direct] Handling wgpu errors as fatal by default
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
    Texture format Depth24PlusStencil8 can't be used due to missing features.
    Features DEPTH24PLUS_STENCIL8 are required but not enabled on the device

@n0samu
Copy link
Member

n0samu commented Oct 15, 2022

Same here. It looks to me like this change was done assuming that this particular feature would always be available, even though it isn't.

@crumblingstatue
Copy link
Contributor Author

Looks like to me that wgpu 0.14 broke TextureFormat::Depth24PlusStencil8, as it seems to have been used even before the wgpu version bump, and it worked fine(?).

@crumblingstatue
Copy link
Contributor Author

Well... I found a workaround that works on my system, which is to use Depth32FloatStencil8, and the accompanying feature.

@crumblingstatue
Copy link
Contributor Author

git diff of workaround

diff --git a/render/wgpu/src/backend.rs b/render/wgpu/src/backend.rs
index e9d6587cb..c847be8fa 100644
--- a/render/wgpu/src/backend.rs
+++ b/render/wgpu/src/backend.rs
@@ -591,7 +591,7 @@ async fn request_device(
         .request_device(
             &wgpu::DeviceDescriptor {
                 label: None,
-                features: wgpu::Features::DEPTH24PLUS_STENCIL8,
+                features: wgpu::Features::DEPTH32FLOAT_STENCIL8,
                 limits,
             },
             trace_path,
diff --git a/render/wgpu/src/pipelines.rs b/render/wgpu/src/pipelines.rs
index 1dfab0519..040d965f4 100644
--- a/render/wgpu/src/pipelines.rs
+++ b/render/wgpu/src/pipelines.rs
@@ -232,7 +232,7 @@ fn create_shape_pipeline(
             shader,
             &pipeline_layout,
             Some(wgpu::DepthStencilState {
-                format: wgpu::TextureFormat::Depth24PlusStencil8,
+                format: wgpu::TextureFormat::Depth32FloatStencil8,
                 depth_write_enabled: false,
                 depth_compare: wgpu::CompareFunction::Always,
                 stencil: wgpu::StencilState {
diff --git a/render/wgpu/src/surface.rs b/render/wgpu/src/surface.rs
index 2d78fff67..6af6685d5 100644
--- a/render/wgpu/src/surface.rs
+++ b/render/wgpu/src/surface.rs
@@ -64,7 +64,7 @@ impl DepthTexture {
             mip_level_count: 1,
             sample_count: msaa_sample_count,
             dimension: wgpu::TextureDimension::D2,
-            format: wgpu::TextureFormat::Depth24PlusStencil8,
+            format: wgpu::TextureFormat::Depth32FloatStencil8,
             usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
         });
 

@n0samu
Copy link
Member

n0samu commented Oct 15, 2022

Thanks! That works for me too.

relrelb added a commit to relrelb/ruffle that referenced this issue Oct 15, 2022
Credit to @crumblingstatue.

Per `wgpu` documentation, the latter has wider support than the former.

Fixes ruffle-rs#8295, ruffle-rs#8296.
relrelb added a commit that referenced this issue Oct 15, 2022
Credit to @crumblingstatue.

Per `wgpu` documentation, the latter has wider support than the former.

Fixes #8295, #8296.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-desktop Area: Desktop Application bug Something isn't working render-wgpu Issues relating to the wgpu renderer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants