mirror of https://github.com/libsdl-org/SDL.git
Clarify that INPUTTYPE_UNSPECIFIED is correct for RGB textures
This commit is contained in:
parent
92255d36d4
commit
86e393b523
|
|
@ -243,7 +243,7 @@ SDL_PixelFormat D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
|||
}
|
||||
}
|
||||
|
||||
static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 colorspace)
|
||||
static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 output_colorspace)
|
||||
{
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
|
|
@ -251,12 +251,12 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
|||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
}
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
case SDL_PIXELFORMAT_XRGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
|
||||
}
|
||||
return DXGI_FORMAT_B8G8R8X8_UNORM;
|
||||
|
|
@ -2124,6 +2124,7 @@ static void D3D11_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderC
|
|||
} else if (texture->colorspace == SDL_COLORSPACE_HDR10) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
// The sampler will convert from sRGB to linear on load if working in linear colorspace
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ static SDL_PixelFormat D3D12_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
|
|||
}
|
||||
}
|
||||
|
||||
static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 colorspace)
|
||||
static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 output_colorspace)
|
||||
{
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
|
|
@ -318,12 +318,12 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 color
|
|||
case SDL_PIXELFORMAT_XBGR2101010:
|
||||
return DXGI_FORMAT_R10G10B10A2_UNORM;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
|
||||
}
|
||||
return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
case SDL_PIXELFORMAT_XRGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB;
|
||||
}
|
||||
return DXGI_FORMAT_B8G8R8X8_UNORM;
|
||||
|
|
@ -2554,6 +2554,7 @@ static void D3D12_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderC
|
|||
} else if (texture->colorspace == SDL_COLORSPACE_HDR10) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
// The sampler will convert from sRGB to linear on load if working in linear colorspace
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ static VkDeviceSize VULKAN_GetBytesPerPixel(VkFormat vkFormat)
|
|||
}
|
||||
}
|
||||
|
||||
static VkFormat SDLPixelFormatToVkTextureFormat(Uint32 format, Uint32 colorspace)
|
||||
static VkFormat SDLPixelFormatToVkTextureFormat(Uint32 format, Uint32 output_colorspace)
|
||||
{
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
|
|
@ -435,7 +435,7 @@ static VkFormat SDLPixelFormatToVkTextureFormat(Uint32 format, Uint32 colorspace
|
|||
return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
|
||||
case SDL_PIXELFORMAT_ARGB8888:
|
||||
case SDL_PIXELFORMAT_XRGB8888:
|
||||
if (colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
if (output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) {
|
||||
return VK_FORMAT_B8G8R8A8_SRGB;
|
||||
}
|
||||
return VK_FORMAT_B8G8R8A8_UNORM;
|
||||
|
|
@ -3282,6 +3282,7 @@ static void VULKAN_SetupShaderConstants(SDL_Renderer *renderer, const SDL_Render
|
|||
SDL_COLORSPACETRANSFER(texture->colorspace) == SDL_TRANSFER_CHARACTERISTICS_PQ) {
|
||||
constants->input_type = INPUTTYPE_HDR10;
|
||||
} else {
|
||||
// The sampler will convert from sRGB to linear on load if working in linear colorspace
|
||||
constants->input_type = INPUTTYPE_UNSPECIFIED;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue