Vulkan and transparent windows

血红的双手。 提交于 2019-12-13 15:21:20

问题


I'm currently adapting my personal engine to Vulkan and I want to reimplement transparent windows, which I already had with OpenGL.

I thought that all I need to do is to select the correct color format ( with alpha channel ) and to set the compositeAlpha property of VkSwapchainCreateInfoKHRto VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR.

However clearing the window with a full transparent color doesn't provide the expected results. It's fully opaque.

Of course my window system, which didn't change since I had OpenGL, supports it and when I just disable the rendering I also can't click through at the supposed position of the window, this tells me that it's there.

Are there any other required changes to make this work?

Some infos

The image format is VK_FORMAT_B8G8R8A8_UNORM and I oriented the vulkan setup as found in Sascha Willems examples.


回答1:


That capability (as most others) have to be queried before usage about whether it is supported. Otherwise it is invalid to use it.

This particular feature is queried by vkGetPhysicalDeviceSurfaceCapabilitiesKHR as pSurfaceCapabilities->supportedCompositeAlpha. It is a bitfield/flag-set, so more than one mode or none can be supported.

I think the result/feature support may be influenced by the VkSurface. That is, how the platform window was created. Or maybe the driver maker simply did not implement it yet (despite that feature being supportable).

Since it worked for you before in OGL, the later is more likely. But couldn't hurt to play with the platform window creation parameters...



来源:https://stackoverflow.com/questions/38281796/vulkan-and-transparent-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!