OpenGL rendering debug
Renders same geometry with polygon mode lines and the shader colorizes the fragments. Enabled with environment variable KWIN_GL_DEBUG=1
This commit is contained in:
parent
56ce39def8
commit
6cc19ebc7d
2 changed files with 21 additions and 7 deletions
|
@ -179,6 +179,8 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
|
||||||
qWarning() << "NO VSYNC! glXGetVideoSync(&uint) isn't 0 but" << glXGetVideoSync( &sync );
|
qWarning() << "NO VSYNC! glXGetVideoSync(&uint) isn't 0 but" << glXGetVideoSync( &sync );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug = qstrcmp( qgetenv( "KWIN_GL_DEBUG" ), "1" ) == 0;
|
||||||
|
|
||||||
// scene shader setup
|
// scene shader setup
|
||||||
GLPlatform::instance()->detect();
|
GLPlatform::instance()->detect();
|
||||||
if( GLPlatform::instance()->supports( GLSL ) )
|
if( GLPlatform::instance()->supports( GLSL ) )
|
||||||
|
@ -189,7 +191,7 @@ SceneOpenGL::SceneOpenGL( Workspace* ws )
|
||||||
m_sceneShader->bind();
|
m_sceneShader->bind();
|
||||||
m_sceneShader->setUniform( "sample", 0 );
|
m_sceneShader->setUniform( "sample", 0 );
|
||||||
m_sceneShader->setUniform( "displaySize", QVector2D(displayWidth(), displayHeight()));
|
m_sceneShader->setUniform( "displaySize", QVector2D(displayWidth(), displayHeight()));
|
||||||
m_sceneShader->setUniform( "debug", 1 );
|
m_sceneShader->setUniform( "debug", debug ? 1 : 0 );
|
||||||
m_sceneShader->bindAttributeLocation( 0, "vertex" );
|
m_sceneShader->bindAttributeLocation( 0, "vertex" );
|
||||||
m_sceneShader->bindAttributeLocation( 1, "texCoord" );
|
m_sceneShader->bindAttributeLocation( 1, "texCoord" );
|
||||||
m_sceneShader->unbind();
|
m_sceneShader->unbind();
|
||||||
|
@ -1598,22 +1600,27 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
texture.bind();
|
|
||||||
texture.enableUnnormalizedTexCoords();
|
|
||||||
|
|
||||||
// paint the content
|
// paint the content
|
||||||
if ( !(mask & PAINT_DECORATION_ONLY) )
|
if ( !(mask & PAINT_DECORATION_ONLY) )
|
||||||
{
|
{
|
||||||
prepareStates( Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader );
|
|
||||||
if( !vertexBuffer )
|
if( !vertexBuffer )
|
||||||
vertexBuffer = new GLVertexBuffer( GLVertexBuffer::Stream );
|
vertexBuffer = new GLVertexBuffer( GLVertexBuffer::Stream );
|
||||||
vertexBuffer->setUseShader( sceneShader );
|
vertexBuffer->setUseShader( sceneShader );
|
||||||
|
texture.bind();
|
||||||
|
texture.enableUnnormalizedTexCoords();
|
||||||
|
prepareStates( Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader );
|
||||||
renderQuads( mask, region, data.quads.select( WindowQuadContents ));
|
renderQuads( mask, region, data.quads.select( WindowQuadContents ));
|
||||||
restoreStates( Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader );
|
restoreStates( Content, data.opacity * data.contents_opacity, data.brightness, data.saturation, data.shader );
|
||||||
}
|
|
||||||
|
|
||||||
texture.disableUnnormalizedTexCoords();
|
texture.disableUnnormalizedTexCoords();
|
||||||
texture.unbind();
|
texture.unbind();
|
||||||
|
if( static_cast<SceneOpenGL*>(scene)->debug )
|
||||||
|
{
|
||||||
|
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||||
|
renderQuads( mask, region, data.quads.select( WindowQuadContents ));
|
||||||
|
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( sceneShader )
|
if( sceneShader )
|
||||||
{
|
{
|
||||||
data.shader->unbind();
|
data.shader->unbind();
|
||||||
|
@ -1678,6 +1685,12 @@ void SceneOpenGL::Window::paintDecoration( const QPixmap* decoration, TextureTyp
|
||||||
SceneOpenGL::Window::decorationVertices->render( region, GL_TRIANGLES );
|
SceneOpenGL::Window::decorationVertices->render( region, GL_TRIANGLES );
|
||||||
restoreStates( decorationType, data.opacity * data.decoration_opacity, data.brightness, data.saturation, data.shader );
|
restoreStates( decorationType, data.opacity * data.decoration_opacity, data.brightness, data.saturation, data.shader );
|
||||||
decorationTexture->unbind();
|
decorationTexture->unbind();
|
||||||
|
if( static_cast<SceneOpenGL*>(scene)->debug )
|
||||||
|
{
|
||||||
|
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
|
||||||
|
SceneOpenGL::Window::decorationVertices->render( region, GL_TRIANGLES );
|
||||||
|
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneOpenGL::Window::makeDecorationArrays( const WindowQuadList& quads, const QRect& rect ) const
|
void SceneOpenGL::Window::makeDecorationArrays( const WindowQuadList& quads, const QRect& rect ) const
|
||||||
|
|
|
@ -98,6 +98,7 @@ class SceneOpenGL
|
||||||
bool init_ok;
|
bool init_ok;
|
||||||
bool selfCheckDone;
|
bool selfCheckDone;
|
||||||
GLShader* m_sceneShader;
|
GLShader* m_sceneShader;
|
||||||
|
bool debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SceneOpenGL::Texture
|
class SceneOpenGL::Texture
|
||||||
|
|
Loading…
Reference in a new issue