I found a post asking about the same question:
Vulkan and transparent windows
However, the person asking the question wasn’t checking whether VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR
was supported. I am checking this, and it definitely shows that it isn’t supported. When I call vkGetPhysicalDeviceSurfaceCapabilitiesKHR
and check if .supportedCompositeAlpha
has the VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR
bit set, it always returns false.
I am using API 1.3 with the latest Vulkan driver on Windows 10. I find it strange that it’s not supported, but someone in the other question suggested that it might have something to do with the way the window is created. I tried the following code:
hwnd_ = CreateWindowEx(
WS_EX_LAYERED,
name_.c_str(),
window_title.c_str(),
dwStyle, // | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
0,
0,
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top,
nullptr,
nullptr,
hinstance_,
nullptr);
if (!hwnd_) {
std::cerr << "Can't create a window" << std::endl;
return nullptr;
}
SetLayeredWindowAttributes(hwnd_, 0, 255, LWA_ALPHA); // for transparent surface
I am using WS_EX_LAYERED
and SetLayeredWindowAttributes
, which I understand are necessary to get a window with adjustable opacity. However, this makes no difference.
I wonder if this issue is controlled by the driver or related to the way the Windows window is created. Has anyone gotten it working? If so, could you share your code for the Windows window creation?