wgpu
wgpu copied to clipboard
DX12 doesn't respect alpha for the window
If you take the triangle example and set the alpha to be 0.5, when using Vulkan on both linux and Windows, the window is partially transparent (as expected).
When running on Windows with DX12 the alpha value has no effect.
Example demonstrating what I set for the color/alpha: https://github.com/wez/wezterm/blob/altwin/window/examples/wgpu.rs#L156-L160 https://github.com/wez/wezterm/blob/altwin/window/examples/shader.wgsl#L12
This is with wgpu=0.8
Highly related to https://github.com/gfx-rs/wgpu/issues/687 It's unexpected that the current behavior is different.
In the same vein, Metal on macOS doesn't respect alpha unless you call this each time you recreate the swap chain:
let layer: id = msg_send![h.ns_view as id, layer];
let () = msg_send![layer, setOpaque: NO];
We do call this every time the swapchain is configured in gfx-backend-metal.
I see; it seems like having more of https://wgpu.rs/doc/gfx_hal/window/struct.SwapchainConfig.html exposed via https://wgpu.rs/doc/wgpu/struct.SwapChainDescriptor.html might help to manage this "more better", but not necessarily "correctly" on its own :)
You need use DComp to get any transparency working with windows I believe. Take a look at https://docs.rs/wgpu/latest/x86_64-pc-windows-msvc/wgpu/struct.Instance.html#method.create_surface_from_visual