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
Expose alpha_mode, support non-opaque mode on metal and vk backends #2836
Conversation
@cwfitzgerald, is something preventing this PR from being completed (besides the merge conflicts)? This particular change has been under discussion for quite a while now in #687 |
No, just my highly split attention. I'll take a look soon. Thank you for reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code generally looks good - one comment. We should also add a function to query what modes are actually available and enforce that the user only uses an available mode (similar to how we do present modes now).
I had the opportunity to test this patch atop |
@jinleili , do you intend to continue work on this PR? |
Yes, I still want to get it done. |
Is it acceptable to simply match the WebGPU Spec and provide only normal |
c792438
to
9640557
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like @jinleili has implemented all of @cwfitzgerald's requested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need a way to query which transparency modes are supported and validation that the requested mode is supported.
@cwfitzgerald Added |
Since So, use |
@cwfitzgerald , these changes are now ok to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff - sorry for the delay on merging!
Great work @jinleili |
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
#687
Description
To get a transparent background
Canvas
, there are different cases on the user side:winit
, have to setwindow_builder.with_transparent(true)
;SurfaceView
on Android, the only way to set SurfaceView background color to transparent is:create_surface_from_core_animation_layer
on metal to create surface, have to ensure that the background color of the layer is nil or clearColorKnown issues:
web-sys
documentation states thatGpuCanvasAlphaMode
is supported, but it is not possible to configure this feature in.toml
. nor to call thealpha_mode()
Dawn
and it is hard codedswapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE
:https://dawn.googlesource.com/dawn/+/24239fcc4786bc231eacc065eaa49fd484546984/src/dawn/native/d3d12/SwapChainD3D12.cpp#243
Testing
Tested on macOS(metal, vulkan-portability, angle), iOS, Nexus 5x(Android 8.1, vk and gl backends).