Use automatic batching for love.graphics.print/printf.

This doesn’t actually improve performance at all in most cases, but it does remove some OpenGL-specific code from the Font files, and reduces the amount of duplicated rendering code. This makes it slightly easier to add support for Core Profile OpenGL 3.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-12-29 00:25:14 -04:00
parent 52b7b0f80d
commit 4a3889ae48
8 changed files with 116 additions and 113 deletions
+16 -1
View File
@@ -53,6 +53,13 @@ void gammaCorrectColor(Colorf &c)
}
}
Colorf gammaCorrectColor(const Colorf &c)
{
Colorf r = c;
gammaCorrectColor(r);
return r;
}
void unGammaCorrectColor(Colorf &c)
{
if (isGammaCorrect())
@@ -63,6 +70,13 @@ void unGammaCorrectColor(Colorf &c)
}
}
Colorf unGammaCorrectColor(const Colorf &c)
{
Colorf r = c;
unGammaCorrectColor(r);
return r;
}
love::Type Graphics::type("graphics", &Module::type);
Graphics::Graphics()
@@ -92,7 +106,7 @@ Graphics::StreamVertexData Graphics::requestStreamDraw(const StreamDrawRequest &
if (req.primitiveMode != state.primitiveMode
|| req.formats[0] != state.formats[0] || req.formats[1] != state.formats[1]
|| ((req.indexMode != TriangleIndexMode::NONE) != (state.indexCount > 0))
|| req.texture != state.texture)
|| req.texture != state.texture || req.textureHandle != state.textureHandle)
{
shouldflush = true;
}
@@ -156,6 +170,7 @@ Graphics::StreamVertexData Graphics::requestStreamDraw(const StreamDrawRequest &
state.formats[0] = req.formats[0];
state.formats[1] = req.formats[1];
state.texture = req.texture;
state.textureHandle = req.textureHandle;
}
if (shouldresize)