mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Remove explicit support for systems that don't support rgba8 canvases.
This is just a very small number of really old OpenGL ES 2 drivers.
This commit is contained in:
@@ -2389,6 +2389,22 @@ const Graphics::Capabilities &Graphics::getCapabilities() const
|
||||
return capabilities;
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format) const
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PIXELFORMAT_NORMAL:
|
||||
if (isGammaCorrect())
|
||||
return PIXELFORMAT_RGBA8_UNORM_sRGB;
|
||||
else
|
||||
return PIXELFORMAT_RGBA8_UNORM;
|
||||
case PIXELFORMAT_HDR:
|
||||
return PIXELFORMAT_RGBA16_FLOAT;
|
||||
default:
|
||||
return format;
|
||||
}
|
||||
}
|
||||
|
||||
Graphics::Stats Graphics::getStats() const
|
||||
{
|
||||
Stats stats;
|
||||
|
||||
@@ -819,7 +819,7 @@ public:
|
||||
/**
|
||||
* Converts PIXELFORMAT_NORMAL and PIXELFORMAT_HDR into a real format.
|
||||
**/
|
||||
virtual PixelFormat getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const = 0;
|
||||
PixelFormat getSizedFormat(PixelFormat format) const;
|
||||
|
||||
/**
|
||||
* Gets whether the specified pixel format usage is supported.
|
||||
|
||||
@@ -235,7 +235,7 @@ Texture::Texture(Graphics *gfx, const Settings &settings, const Slices *slices)
|
||||
else
|
||||
readable = !renderTarget || !isPixelFormatDepthStencil(format);
|
||||
|
||||
format = gfx->getSizedFormat(format, renderTarget, readable);
|
||||
format = gfx->getSizedFormat(format);
|
||||
sRGB = isPixelFormatSRGB(format) || (isCompressed() && isGammaCorrect() && !settings.linear);
|
||||
|
||||
if (mipmapsMode == MIPMAPS_AUTO && isCompressed())
|
||||
|
||||
@@ -110,7 +110,6 @@ public:
|
||||
|
||||
void setWireframe(bool enable) override;
|
||||
|
||||
PixelFormat getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const override;
|
||||
bool isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB = false) override;
|
||||
Renderer getRenderer() const override;
|
||||
bool usesGLSLES() const override;
|
||||
|
||||
@@ -1864,28 +1864,9 @@ void Graphics::setWireframe(bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format, bool /*rendertarget*/, bool /*readable*/) const
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PIXELFORMAT_NORMAL:
|
||||
if (isGammaCorrect())
|
||||
return PIXELFORMAT_RGBA8_UNORM_sRGB;
|
||||
else
|
||||
return PIXELFORMAT_RGBA8_UNORM;
|
||||
case PIXELFORMAT_HDR:
|
||||
return PIXELFORMAT_RGBA16_FLOAT;
|
||||
default:
|
||||
return format;
|
||||
}
|
||||
}
|
||||
|
||||
bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB)
|
||||
{
|
||||
bool rendertarget = (usage & PIXELFORMATUSAGEFLAGS_RENDERTARGET) != 0;
|
||||
bool readable = (usage & PIXELFORMATUSAGEFLAGS_SAMPLE) != 0;
|
||||
|
||||
format = getSizedFormat(format, rendertarget, readable);
|
||||
format = getSizedFormat(format);
|
||||
|
||||
if (sRGB)
|
||||
format = getSRGBPixelFormat(format);
|
||||
@@ -1902,7 +1883,7 @@ bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRG
|
||||
|
||||
uint32 flags = PIXELFORMATUSAGEFLAGS_NONE;
|
||||
|
||||
if (isPixelFormatCompressed(format) && rendertarget)
|
||||
if (isPixelFormatCompressed(format) && (usage & rt) != 0)
|
||||
return false;
|
||||
|
||||
// https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
|
||||
|
||||
@@ -1734,31 +1734,6 @@ void Graphics::initCapabilities()
|
||||
}
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const
|
||||
{
|
||||
uint32 requiredflags = 0;
|
||||
if (rendertarget)
|
||||
requiredflags |= PIXELFORMATUSAGEFLAGS_RENDERTARGET;
|
||||
if (readable)
|
||||
requiredflags |= PIXELFORMATUSAGEFLAGS_SAMPLE;
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case PIXELFORMAT_NORMAL:
|
||||
if (isGammaCorrect())
|
||||
return PIXELFORMAT_RGBA8_UNORM_sRGB;
|
||||
else if ((OpenGL::getPixelFormatUsageFlags(PIXELFORMAT_RGBA8_UNORM) & requiredflags) != requiredflags)
|
||||
// 32-bit render targets don't have guaranteed support on GLES2.
|
||||
return PIXELFORMAT_RGBA4_UNORM;
|
||||
else
|
||||
return PIXELFORMAT_RGBA8_UNORM;
|
||||
case PIXELFORMAT_HDR:
|
||||
return PIXELFORMAT_RGBA16_FLOAT;
|
||||
default:
|
||||
return format;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Graphics::computePixelFormatUsage(PixelFormat format, bool readable)
|
||||
{
|
||||
uint32 usage = OpenGL::getPixelFormatUsageFlags(format);
|
||||
@@ -1844,11 +1819,9 @@ bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRG
|
||||
if (sRGB)
|
||||
format = getSRGBPixelFormat(format);
|
||||
|
||||
bool rendertarget = (usage & PIXELFORMATUSAGEFLAGS_RENDERTARGET) != 0;
|
||||
format = getSizedFormat(format);
|
||||
|
||||
bool readable = (usage & PIXELFORMATUSAGEFLAGS_SAMPLE) != 0;
|
||||
|
||||
format = getSizedFormat(format, rendertarget, readable);
|
||||
|
||||
return (usage & pixelFormatUsage[format][readable ? 1 : 0]) == usage;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,6 @@ public:
|
||||
|
||||
void setWireframe(bool enable) override;
|
||||
|
||||
PixelFormat getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const override;
|
||||
bool isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB = false) override;
|
||||
Renderer getRenderer() const override;
|
||||
bool usesGLSLES() const override;
|
||||
|
||||
@@ -1057,28 +1057,9 @@ void Graphics::setWireframe(bool enable)
|
||||
states.back().wireframe = enable;
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case PIXELFORMAT_NORMAL:
|
||||
if (isGammaCorrect())
|
||||
return PIXELFORMAT_RGBA8_UNORM_sRGB;
|
||||
else
|
||||
return PIXELFORMAT_RGBA8_UNORM;
|
||||
case PIXELFORMAT_HDR:
|
||||
return PIXELFORMAT_RGBA16_FLOAT;
|
||||
default:
|
||||
return format;
|
||||
}
|
||||
}
|
||||
|
||||
bool Graphics::isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB)
|
||||
{
|
||||
bool rendertarget = (usage & PIXELFORMATUSAGEFLAGS_RENDERTARGET) != 0;
|
||||
bool readable = (usage & PIXELFORMATUSAGEFLAGS_SAMPLE) != 0;
|
||||
|
||||
format = getSizedFormat(format, rendertarget, readable);
|
||||
format = getSizedFormat(format);
|
||||
|
||||
auto vulkanFormat = Vulkan::getTextureFormat(format, sRGB);
|
||||
|
||||
|
||||
@@ -297,7 +297,6 @@ public:
|
||||
void setBlendState(const BlendState &blend) override;
|
||||
void setPointSize(float size) override;
|
||||
void setWireframe(bool enable) override;
|
||||
PixelFormat getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const override;
|
||||
bool isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB) override;
|
||||
Renderer getRenderer() const override;
|
||||
bool usesGLSLES() const override;
|
||||
|
||||
Reference in New Issue
Block a user