Skip to content

Commit

Permalink
Fix creating a linear rgba8 canvas when gamma correct rendering is on.
Browse files Browse the repository at this point in the history
Fixes #1973
  • Loading branch information
slime73 committed Oct 14, 2023
1 parent 0b0bef3 commit 3865868
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/graphics/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
, computeWrite(settings.computeWrite)
, readable(true)
, mipmapsMode(settings.mipmaps)
, sRGB(isGammaCorrect() && !settings.linear)
, sRGB(false)
, width(settings.width)
, height(settings.height)
, depth(settings.type == TEXTURE_VOLUME ? settings.layers : 1)
Expand Down Expand Up @@ -204,7 +204,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
love::image::ImageDataBase *slice = slices->get(0, 0);

format = slice->getFormat();
if (sRGB)
if (isGammaCorrect() && !settings.linear)
format = getSRGBPixelFormat(format);

pixelWidth = slice->getWidth();
Expand Down Expand Up @@ -236,6 +236,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
readable = !renderTarget || !isPixelFormatDepthStencil(format);

format = gfx->getSizedFormat(format, renderTarget, readable);
sRGB = isPixelFormatSRGB(format) || (isCompressed() && isGammaCorrect() && !settings.linear);

if (mipmapsMode == MIPMAPS_AUTO && isCompressed())
mipmapsMode = MIPMAPS_MANUAL;
Expand Down

0 comments on commit 3865868

Please sign in to comment.