-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
premultiplied backbuffer for UWP/SwapchainPanel #2837
premultiplied backbuffer for UWP/SwapchainPanel #2837
Conversation
Just to understand this feature, it's something like transparent window? |
More or less, yes. But more specifically for swapchainpanel/dx11. |
Yeah, I just don't like features for single renderer. I want to try to add for at least one more, that way better terminology/naming is decided. For example this premultiplied sounds 1:1 with some D3D11 swapchain flag/feature. Where |
Also you would have to add For example if you follow HDR10 support, it has both defined as:
|
I can do it for DX11 and 12. |
Sure. Rename And add And I'll add support to GL, VK. |
I did the change for GL instead of D3D12. I don't know enough the D3D12 API to do it properly. |
src/dxgi.cpp
Outdated
@@ -309,6 +309,9 @@ namespace bgfx | |||
|
|||
_caps.supported |= hdr10 ? BGFX_CAPS_HDR10 : 0; | |||
|
|||
#if BX_PLATFORM_WINRT | |||
_caps.supported |= BGFX_CAPS_TRANSPARENT_BACKBUFFER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preferred form is (reduces ifdefery):
_caps.supported |= BX_ENABLED(BX_PLATFORM_WINRT) ? BGFX_CAPS_TRANSPARENT_BACKBUFFER : 0;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Yeah two platforms is good enough, I'll add elsewhere. |
* premultiplied backbuffer for UWP/SwapchainPanel * init flag * caps and feedback/opengl premul * reduced #ifdef form * removed ifdef
Short story:
Add a new reset flag that will premultiply the back buffer RGB values for D3D11 / UWP / SwapchainPanel just before presentation.
Long Story:
For one of our partner, we want a transparent swapchainpanel on top of react-native components. Basically, use the alpha channel of the backbuffer for opacity when the SWP is ontop of other controls. It's not possible to change the composition mode of the SWP as it is on other platforms (for Android and iOS, it's simply an opacity flag). There is one compositing mode that is useless for us. When creating the SWP, it's possible to set it has having premultiplied alpha. Straight alpha is only available for CoreWindows (not our case). So, I've added a fullscreen pass using clearquad infos that multiplies the backbuffer RGB values by the alpha and keeps the alpha unchanged. And the SWP alpha flag is changed to premultiplied.