Skip to content
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

Fix sRGB backbuffers on the SDL_GPU and D3D11 backends #240

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kg
Copy link
Contributor

@kg kg commented Mar 12, 2025

sRGB textures and render targets work but when you request a sRGB backbuffer, you don't get one right now.

On SDL_GPU we aren't flowing the sRGB flag through.

On D3D11, we changed to flip model which doesn't allow sRGB backbuffers, you have to set the colorspace on the swapchain instead.

@kg kg force-pushed the srgbswapchain branch from c95f743 to 4e78ac1 Compare March 12, 2025 09:52
@kg kg changed the title Fix sRGB backbuffers on the SDL_GPU backend Fix sRGB backbuffers on the SDL_GPU and D3D11 backends Mar 12, 2025
Copy link
Member

@flibitijibibo flibitijibibo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny thing and one slightly less tiny but still pretty small thing - otherwise lgtm

@@ -2699,6 +2706,10 @@ static void D3D11_INTERNAL_CreateSwapChain(
{
colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709;
}
else if (sRGB)
{
colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the else cover this?

swapchainDesc.BufferDesc.Format = XNAToD3D_TextureFormat[FNA3D_SURFACEFORMAT_COLOR];
}
else
swapchainDesc.BufferDesc.Format = XNAToD3D_TextureFormat[backBufferFormat];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
swapchainDesc.BufferDesc.Format = XNAToD3D_TextureFormat[backBufferFormat];
{
swapchainDesc.BufferDesc.Format = XNAToD3D_TextureFormat[backBufferFormat];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants