I am currently learning Vulkan and have recently encountered a concept, alpha composition, which I am struggling to fully understand. When creating a swap chain, I can configure this option by setting the compositeAlpha member of VkSwapchainCreateInfoKHR.
I have reviewed the Khronos online documentation regarding this topic, but I still have some questions:
Is alpha composition in this context the same as what we implement in shader programs? If not, as I suspect it is a process handled by the window system, could you please explain the alpha composition process within a window system?
This is referring to the window composition engine provided by the OS. Vulkan provides the option for the OS to support rendering translucent Windows, based on the alpha component of the framebuffer.
NVidia doesn't appear to support this at all.[1][2] Windows has support for this in DirectX, but it doesn't appear to be supported by most Vulkan Drivers.[1][3][8][9] Intel Arc GPUs support an OS dependent function for Windows.[4] Intel & AMD support an OS dependent function for Linux.[5][6] AMD supports an OS dependent function and post multiply for MacOS.[7]
I'm not sure why none of the major GPU vendors have support for this in Vulkan on Windows, even though it is supported by DXGI. One thing I am noticing is that while it is supported by DXGI, it never appears to be exposed to the Device Driver Interface. ~~It's possible that DXGI passes the transparency info to Desktop Window Manager in the background, and Microsoft never documented functionality for that in the DWM API.
The functionality provided in DXGI for alpha compositing is only available to Windows' XAML UI tooling. It would make sense that that functionality is provided by Desktop Window Manager, and not the GPU.
Given the apparent lack of support on Windows, you're probably limited to using VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR
.