Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,10 @@ impl crate::Adapter for super::Adapter {
} else {
vec![wgt::PresentMode::Fifo] //TODO
},
composite_alpha_modes: vec![wgt::CompositeAlphaMode::Opaque], //TODO
composite_alpha_modes: vec![
wgt::CompositeAlphaMode::Opaque,
wgt::CompositeAlphaMode::PreMultiplied,
], //TODO
Comment on lines +1235 to +1238
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is right - without telling this to the runtime at all we can't know if these modes are actually supported. I'm not sure how this works with the various platforms, but I don't think we can just change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It look like premultipliedAlpha is set to true by default https://registry.khronos.org/webgl/specs/latest/1.0/#5.2 and we do not seem to change it

maximum_frame_latency: 2..=2, //TODO, unused currently
current_extent: None,
usage: wgt::TextureUses::COLOR_TARGET,
Expand Down
5 changes: 4 additions & 1 deletion wgpu/src/backend/webgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3735,7 +3735,10 @@ impl dispatch::SurfaceInterface for WebSurface {
formats,
// Doesn't really have meaning on the web.
present_modes: vec![wgt::PresentMode::Fifo],
alpha_modes: vec![wgt::CompositeAlphaMode::Opaque],
alpha_modes: vec![
wgt::CompositeAlphaMode::Opaque,
wgt::CompositeAlphaMode::PreMultiplied,
],
// Statically set to RENDER_ATTACHMENT for now. See https://gpuweb.github.io/gpuweb/#dom-gpucanvasconfiguration-usage
usages: wgt::TextureUsages::RENDER_ATTACHMENT,
}
Expand Down