mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
opengl: fix scissor state when switching between a canvas and the screen while a scissor is active.
Fixes #2112.
This commit is contained in:
@@ -789,7 +789,7 @@ void Graphics::setRenderTargetsInternal(const RenderTargets &rts, int pixelw, in
|
||||
// Re-apply the scissor if it was active, since the rectangle passed to
|
||||
// glScissor is affected by the viewport dimensions.
|
||||
if (state.scissor)
|
||||
setScissor(state.scissorRect);
|
||||
setScissor(state.scissorRect, !iswindow);
|
||||
|
||||
// Make sure the correct sRGB setting is used when drawing to the textures.
|
||||
if (GLAD_VERSION_1_0 || GLAD_EXT_sRGB_write_control)
|
||||
@@ -1324,7 +1324,7 @@ int Graphics::getBackbufferMSAA() const
|
||||
return internalBackbuffer.get() ? internalBackbuffer->getMSAA() : 0;
|
||||
}
|
||||
|
||||
void Graphics::setScissor(const Rect &rect)
|
||||
void Graphics::setScissor(const Rect &rect, bool rtActive)
|
||||
{
|
||||
flushBatchedDraws();
|
||||
|
||||
@@ -1342,12 +1342,17 @@ void Graphics::setScissor(const Rect &rect)
|
||||
glrect.h = (int) (rect.h * dpiscale);
|
||||
|
||||
// OpenGL's reversed y-coordinate is compensated for in OpenGL::setScissor.
|
||||
gl.setScissor(glrect, isRenderTargetActive());
|
||||
gl.setScissor(glrect, rtActive);
|
||||
|
||||
state.scissor = true;
|
||||
state.scissorRect = rect;
|
||||
}
|
||||
|
||||
void Graphics::setScissor(const Rect &rect)
|
||||
{
|
||||
setScissor(rect, isRenderTargetActive());
|
||||
}
|
||||
|
||||
void Graphics::setScissor()
|
||||
{
|
||||
if (states.back().scissor)
|
||||
|
||||
@@ -155,6 +155,8 @@ private:
|
||||
|
||||
void setDebug(bool enable);
|
||||
|
||||
void setScissor(const Rect &rect, bool rtActive);
|
||||
|
||||
uint32 computePixelFormatUsage(PixelFormat format, bool readable);
|
||||
|
||||
std::unordered_map<RenderTargets, GLuint, CachedFBOHasher> framebufferObjects;
|
||||
|
||||
Reference in New Issue
Block a user