Honor the surface's alphaMode on the Vulkan swapchain - #69
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
f9aa24c to
787a066
Compare
|
👋 Thanks for your contribution! Your PR has been imported to Gerrit. |
|
Latest revision failed to import to Gerrit (our code review tool), due to the merge conflict. Could you update the PR? |
ae99542 to
ba69bf7
Compare
|
Import worked! I think some of the comments on Gerrit still need to be addressed though. |
ChooseConfig hardcoded VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR outside of Android, so a surface configured with a transparent alphaMode was composited as opaque. Convert the WebGPU enum directly: Surface.cpp has already resolved Auto and validated the mode against the capabilities PhysicalDeviceVk reports. Add a transparent-window mode (T) to ManualSurfaceTest so the alpha modes can be checked against the desktop.
2ee4c4e to
07e6602
Compare
SwapChainVk::ChooseConfighardcodedVK_COMPOSITE_ALPHA_OPAQUE_BIT_KHRoutside of Android, so a surface configured with a transparentalphaModewas validated and then composited as opaque even though the adapter advertised the mode as supported.The Vulkan enum is now converted directly from the WebGPU one.
Autoand unsupported modes are already resolved and validated inSurface.cppagainst the capabilitiesPhysicalDeviceVkreports, so the Android-only fallback loop is gone and the remaining condition is aDAWN_CHECK. This is not an Android regression:PhysicalDeviceVklists the modes in the same order the old loop preferred them (OPAQUE, PRE, POST, INHERIT) andSurface.cppresolvesAutotoalphaModes[0], soAutoreproduces the previous behaviour exactly.ManualSurfaceTestgains aTkey that creates a window withGLFW_TRANSPARENT_FRAMEBUFFER, and on such a window the clear-cycle render mode cycles a premultiplied alpha, so cycling alpha modes withAhas a visible effect against the desktop.The D3D side has been split into a separate PR as requested: https://github.com/d3x0r/dawn/tree/d3d-alphamode-composition