mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Fix creating a linear rgba8 canvas when gamma correct rendering is on.
Fixes #1973
This commit is contained in:
@@ -168,7 +168,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
|
|||||||
, computeWrite(settings.computeWrite)
|
, computeWrite(settings.computeWrite)
|
||||||
, readable(true)
|
, readable(true)
|
||||||
, mipmapsMode(settings.mipmaps)
|
, mipmapsMode(settings.mipmaps)
|
||||||
, sRGB(isGammaCorrect() && !settings.linear)
|
, sRGB(false)
|
||||||
, width(settings.width)
|
, width(settings.width)
|
||||||
, height(settings.height)
|
, height(settings.height)
|
||||||
, depth(settings.type == TEXTURE_VOLUME ? settings.layers : 1)
|
, depth(settings.type == TEXTURE_VOLUME ? settings.layers : 1)
|
||||||
@@ -204,7 +204,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
|
|||||||
love::image::ImageDataBase *slice = slices->get(0, 0);
|
love::image::ImageDataBase *slice = slices->get(0, 0);
|
||||||
|
|
||||||
format = slice->getFormat();
|
format = slice->getFormat();
|
||||||
if (sRGB)
|
if (isGammaCorrect() && !settings.linear)
|
||||||
format = getSRGBPixelFormat(format);
|
format = getSRGBPixelFormat(format);
|
||||||
|
|
||||||
pixelWidth = slice->getWidth();
|
pixelWidth = slice->getWidth();
|
||||||
@@ -236,6 +236,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
|
|||||||
readable = !renderTarget || !isPixelFormatDepthStencil(format);
|
readable = !renderTarget || !isPixelFormatDepthStencil(format);
|
||||||
|
|
||||||
format = gfx->getSizedFormat(format, renderTarget, readable);
|
format = gfx->getSizedFormat(format, renderTarget, readable);
|
||||||
|
sRGB = isPixelFormatSRGB(format) || (isCompressed() && isGammaCorrect() && !settings.linear);
|
||||||
|
|
||||||
if (mipmapsMode == MIPMAPS_AUTO && isCompressed())
|
if (mipmapsMode == MIPMAPS_AUTO && isCompressed())
|
||||||
mipmapsMode = MIPMAPS_MANUAL;
|
mipmapsMode = MIPMAPS_MANUAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user