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

Fix depth stencil attachment downcast for WebGPU #3670

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

grovesNL
Copy link
Collaborator

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Fixes #3663 (maybe?)

Description
Untested but I believe we should be using as_ref() here instead

Testing
Untested

@mockersf
Copy link
Contributor

seems to fix it for me 👍 (as in, I have other issues so still nothing renders, but at least not that error anymore)

@maxammann
Copy link
Contributor

works!

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@cwfitzgerald
Copy link
Member

Why does this work though?

@cwfitzgerald cwfitzgerald enabled auto-merge (squash) April 12, 2023 16:33
@cwfitzgerald cwfitzgerald merged commit ee175f9 into gfx-rs:trunk Apr 12, 2023
@grovesNL grovesNL deleted the dsa-ref branch April 12, 2023 16:54
@grovesNL
Copy link
Collaborator Author

@cwfitzgerald this is the subtle downcasting issue I mentioned on my other PR.

In this case data is basically Box<dyn Any>, but Box itself implements Any. This means we can easily break it if you accidentally use &Box<dyn Any> instead of &dyn Any, so we need something like as_ref() here to produce the correct type.

We could probably build some of this into our own downcast_ref wrapper. Ideally I'd like stronger guarantees on Data itself somehow, so we can verify that Any is carrying the correct type for the backend. Maybe we can wait to see how this looks after we make the Arc changes though.

maxammann added a commit to maxammann/maplibre-rs that referenced this pull request Apr 12, 2023
maxammann added a commit to maplibre/maplibre-rs that referenced this pull request Apr 12, 2023
nyurik pushed a commit to nyurik/maplibre-rs that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGPU: Failed to read the 'depthStencilAttachment' property from 'GPURenderPassDescriptor'
4 participants