kwin: Don't query GL_VIEWPORT in pushRenderTarget()

Assume that the default framebuffer has the same dimensions as the screen.

By not quering the dimensions of the viewport we don't risk serialization
in drivers that use threaded dispatch.
This commit is contained in:
Fredrik Höglund 2013-06-24 20:39:32 +02:00
parent 7124f5190b
commit 6562fcc665
2 changed files with 4 additions and 10 deletions

View file

@ -987,7 +987,6 @@ void ShaderManager::resetShader(ShaderType type)
bool GLRenderTarget::sSupported = false;
bool GLRenderTarget::s_blitSupported = false;
QStack<GLRenderTarget*> GLRenderTarget::s_renderTargets = QStack<GLRenderTarget*>();
QSize GLRenderTarget::s_oldViewport;
void GLRenderTarget::initStatic()
{
@ -1012,12 +1011,6 @@ bool GLRenderTarget::blitSupported()
void GLRenderTarget::pushRenderTarget(GLRenderTarget* target)
{
if (s_renderTargets.isEmpty()) {
GLint params[4];
glGetIntegerv(GL_VIEWPORT, params);
s_oldViewport = QSize(params[2], params[3]);
}
target->enable();
s_renderTargets.push(target);
}
@ -1026,11 +1019,13 @@ GLRenderTarget* GLRenderTarget::popRenderTarget()
{
GLRenderTarget* ret = s_renderTargets.pop();
ret->disable();
if (!s_renderTargets.isEmpty()) {
s_renderTargets.top()->enable();
} else if (!s_oldViewport.isEmpty()) {
glViewport (0, 0, s_oldViewport.width(), s_oldViewport.height());
} else {
glViewport (0, 0, displayWidth(), displayHeight());
}
return ret;
}

View file

@ -580,7 +580,6 @@ private:
static bool sSupported;
static bool s_blitSupported;
static QStack<GLRenderTarget*> s_renderTargets;
static QSize s_oldViewport;
GLTexture mTexture;
bool mValid;