Window transparency support
kvark opened this issue · 2 comments
kvark commented
There is a bit of a portability problem: Vulkan/Mesa supports VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR
, while Metal supports VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR
.
We don't want to do an extra full-screen pass, and we don't control the pipelines of the user.
So perhaps we could request transparency and then get one of the modes back:
#[derive(Debug)]
pub struct SurfaceConfig {
...
transparent: bool,
}
enum AlphaMode {
Ignored,
PreMultiplied,
PostMultiplied,
}
struct SurfaceInfo {
format: TextureFormat,
alpha: AlphaMode,
}
fn resize(&self, config: SurfaceConfig) -> SurfaceInfo {...}
Then the user of the library can do the pre (or post) multiplication themselves in the shader.
jansol commented
Vulkan also has the concept of "passthrough" alpha, which basically signals that it will be taken care of out of band. I don't remember any implementations that actually report that as supported though.
kvark commented
heads up - I'm working on this