1
0
mirror of https://github.com/microsoft/DirectXTex synced 2024-11-21 12:00:06 +00:00

Fix handling of SRGB_IN and SRGB_OUT for GPU BC7 compressor (#326)

This commit is contained in:
Chuck Walbourn 2023-03-10 15:19:09 -08:00 committed by GitHub
parent 0f77045482
commit b4719fa58c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,9 +154,14 @@ namespace
assert(srcImage.pixels && destImage.pixels);
const DXGI_FORMAT format = gpubc->GetSourceFormat();
DXGI_FORMAT tformat = gpubc->GetSourceFormat();
if (compress & TEX_COMPRESS_SRGB_OUT)
{
tformat = MakeSRGB(tformat);
}
const DXGI_FORMAT sformat = (compress & TEX_COMPRESS_SRGB_IN) ? MakeSRGB(srcImage.format) : srcImage.format;
if (srcImage.format == format)
if (sformat == tformat)
{
// Input is already in our required source format
return gpubc->Compress(srcImage, destImage);
@ -169,7 +174,7 @@ namespace
auto const srgb = GetSRGBFlags(compress);
switch (format)
switch (tformat)
{
case DXGI_FORMAT_R8G8B8A8_UNORM:
hr = ConvertToRGBA32(srcImage, image, false, srgb);