mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Minor batching fixes and performance improvements
--HG-- branch : minor
This commit is contained in:
@@ -1094,13 +1094,17 @@ void Graphics::setScissor(const Rect &rect)
|
|||||||
|
|
||||||
void Graphics::setScissor()
|
void Graphics::setScissor()
|
||||||
{
|
{
|
||||||
flushStreamDraws();
|
if (states.back().scissor)
|
||||||
|
flushStreamDraws();
|
||||||
|
|
||||||
states.back().scissor = false;
|
states.back().scissor = false;
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::drawToStencilBuffer(StencilAction action, int value)
|
void Graphics::drawToStencilBuffer(StencilAction action, int value)
|
||||||
{
|
{
|
||||||
|
flushStreamDraws();
|
||||||
|
|
||||||
writingToStencil = true;
|
writingToStencil = true;
|
||||||
|
|
||||||
// Disable color writes but don't save the state for it.
|
// Disable color writes but don't save the state for it.
|
||||||
@@ -1158,6 +1162,10 @@ void Graphics::stopDrawToStencilBuffer()
|
|||||||
void Graphics::setStencilTest(CompareMode compare, int value)
|
void Graphics::setStencilTest(CompareMode compare, int value)
|
||||||
{
|
{
|
||||||
DisplayState &state = states.back();
|
DisplayState &state = states.back();
|
||||||
|
|
||||||
|
if (state.stencilCompare != compare || state.stencilTestValue != value)
|
||||||
|
flushStreamDraws();
|
||||||
|
|
||||||
state.stencilCompare = compare;
|
state.stencilCompare = compare;
|
||||||
state.stencilTestValue = value;
|
state.stencilTestValue = value;
|
||||||
|
|
||||||
@@ -1247,7 +1255,8 @@ void Graphics::setColorMask(ColorMask mask)
|
|||||||
|
|
||||||
void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
|
void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
|
||||||
{
|
{
|
||||||
flushStreamDraws();
|
if (mode != states.back().blendMode || alphamode != states.back().blendAlphaMode)
|
||||||
|
flushStreamDraws();
|
||||||
|
|
||||||
GLenum func = GL_FUNC_ADD;
|
GLenum func = GL_FUNC_ADD;
|
||||||
GLenum srcRGB = GL_ONE;
|
GLenum srcRGB = GL_ONE;
|
||||||
|
|||||||
Reference in New Issue
Block a user