Restore the backend set viewport when popping the final render target
Summary: The backend is responsible for setting the viewport, the GLRenderTarget should save and restore the viewport actually set by the backend. Test Plan: Ran Blur effect which uses this method, under scaling the viewport "restored" differed from the one set by the backend. Reviewers: #plasma Subscribers: plasma-devel, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D4952
This commit is contained in:
parent
71600d0a02
commit
9cb666f469
2 changed files with 6 additions and 3 deletions
|
@ -1038,6 +1038,7 @@ QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*
|
|||
QSize GLRenderTarget::s_virtualScreenSize;
|
||||
QRect GLRenderTarget::s_virtualScreenGeometry;
|
||||
qreal GLRenderTarget::s_virtualScreenScale = 1.0;
|
||||
GLint GLRenderTarget::s_virtualScreenViewport[4];
|
||||
|
||||
void GLRenderTarget::initStatic()
|
||||
{
|
||||
|
@ -1074,6 +1075,9 @@ bool GLRenderTarget::blitSupported()
|
|||
|
||||
void GLRenderTarget::pushRenderTarget(GLRenderTarget* target)
|
||||
{
|
||||
if (s_renderTargets.isEmpty()) {
|
||||
glGetIntegerv(GL_VIEWPORT, s_virtualScreenViewport);
|
||||
}
|
||||
target->enable();
|
||||
s_renderTargets.push(target);
|
||||
}
|
||||
|
@ -1086,10 +1090,8 @@ GLRenderTarget* GLRenderTarget::popRenderTarget()
|
|||
if (!s_renderTargets.isEmpty()) {
|
||||
s_renderTargets.top()->enable();
|
||||
} else {
|
||||
glViewport (-s_virtualScreenGeometry.x(), s_virtualScreenGeometry.height() - s_virtualScreenSize.height() - s_virtualScreenGeometry.y(),
|
||||
s_virtualScreenSize.width(), s_virtualScreenSize.height());
|
||||
glViewport (s_virtualScreenViewport[0], s_virtualScreenViewport[1], s_virtualScreenViewport[2], s_virtualScreenViewport[3]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -534,6 +534,7 @@ private:
|
|||
static QSize s_virtualScreenSize;
|
||||
static QRect s_virtualScreenGeometry;
|
||||
static qreal s_virtualScreenScale;
|
||||
static GLint s_virtualScreenViewport[4];
|
||||
|
||||
GLTexture mTexture;
|
||||
bool mValid;
|
||||
|
|
Loading…
Reference in a new issue