vcl/opengl/gdiimpl.cxx | 8 ++++++++ vcl/opengl/texture.cxx | 20 +++++++++++++++++--- vcl/opengl/x11/gdiimpl.cxx | 2 ++ vcl/source/opengl/OpenGLContext.cxx | 8 ++++++++ vcl/source/opengl/OpenGLHelper.cxx | 9 +++++++++ 5 files changed, 44 insertions(+), 3 deletions(-)
New commits: commit e7f2088c9a194ccc8f888d393032316948f6981b Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Nov 14 15:43:44 2014 +0100 opengl: Add many more CHECK_GL_ERROR()'s before returning from functions. Change-Id: I63c147acf9a4013008b0f6d76867186f04ee57d5 diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 09e80f8..dab78f3 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -120,6 +120,7 @@ void OpenGLSalGraphicsImpl::PostDraw() glDisable( GL_SCISSOR_TEST ); if( mbUseStencil ) glDisable( GL_STENCIL_TEST ); + CHECK_GL_ERROR(); } @@ -144,6 +145,8 @@ void OpenGLSalGraphicsImpl::ImplSetClipBit( const vcl::Region& rClip, GLuint nMa glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); glStencilMask( 0x00 ); glDisable( GL_STENCIL_TEST ); + + CHECK_GL_ERROR(); } bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip ) @@ -174,6 +177,7 @@ bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip ) ImplSetClipBit( rClip, 0x01 ); } + CHECK_GL_ERROR(); return true; } @@ -301,6 +305,7 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture() glViewport( 0, 0, GetWidth(), GetHeight() ); DrawTexture( maOffscreenTex, aPosAry ); + CHECK_GL_ERROR(); return true; } @@ -679,6 +684,8 @@ void OpenGLSalGraphicsImpl::DrawAlphaTexture( OpenGLTexture& rTexture, const Sal glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); DrawTexture( rTexture, rPosAry, bInverted ); glDisable( GL_BLEND ); + + CHECK_GL_ERROR(); } void OpenGLSalGraphicsImpl::DrawTextureWithMask( OpenGLTexture& rTexture, OpenGLTexture& rMask, const SalTwoRect& pPosAry ) @@ -831,6 +838,7 @@ void OpenGLSalGraphicsImpl::DrawAxialGradient( const Gradient& rGradient, const glDisableVertexAttribArray( GL_ATTRIB_TEX ); glUseProgram( 0 ); + CHECK_GL_ERROR(); } diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 005fb66..5c2f3c1 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -40,6 +40,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate ) if( bAllocate ) glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL ); glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } // texture with content retrieved from FBO @@ -59,6 +61,7 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight ) glCopyTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nX, nY, nWidth, nHeight, 0 ); CHECK_GL_ERROR(); glBindTexture( GL_TEXTURE_2D, 0 ); + CHECK_GL_ERROR(); } @@ -80,6 +83,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnWidth, mnHeight, 0, nFormat, nType, pData ); glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } ImplOpenGLTexture::~ImplOpenGLTexture() @@ -87,6 +92,8 @@ ImplOpenGLTexture::~ImplOpenGLTexture() SAL_INFO( "vcl.opengl", "~OpenGLTexture " << mnTexture ); if( mnTexture != 0 ) glDeleteTextures( 1, &mnTexture ); + + CHECK_GL_ERROR(); } OpenGLTexture::OpenGLTexture() : @@ -198,18 +205,24 @@ void OpenGLTexture::SetFilter( GLenum nFilter ) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nFilter ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nFilter ); } + + CHECK_GL_ERROR(); } void OpenGLTexture::Bind() { if( mpImpl ) glBindTexture( GL_TEXTURE_2D, mpImpl->mnTexture ); + + CHECK_GL_ERROR(); } void OpenGLTexture::Unbind() { if( mpImpl ) glBindTexture( GL_TEXTURE_2D, 0 ); + + CHECK_GL_ERROR(); } bool OpenGLTexture::Draw() @@ -243,6 +256,7 @@ bool OpenGLTexture::Draw() glDisableVertexAttribArray( 1 ); glBindTexture( GL_TEXTURE_2D, 0 ); + CHECK_GL_ERROR(); return true; } @@ -269,12 +283,12 @@ void OpenGLTexture::Read( GLenum nFormat, GLenum nType, sal_uInt8* pData ) GLuint nFramebufferId; glGenFramebuffers( 1, &nFramebufferId ); glBindFramebuffer( GL_FRAMEBUFFER, nFramebufferId ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, Id(), 0 ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glReadPixels( maRect.Left(), mpImpl->mnHeight - maRect.Top(), GetWidth(), GetHeight(), nFormat, nType, pData ); - CHECK_GL_ERROR(); + CHECK_GL_ERROR(); glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glDeleteFramebuffers( 1, &nFramebufferId ); diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index 3a2cfdf..71a04f3 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -112,6 +112,7 @@ bool X11OpenGLSalGraphicsImpl::FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, XFreeGC( pDisplay, aGC ); XDestroyImage( pImage ); + CHECK_GL_ERROR(); return true; } @@ -159,6 +160,7 @@ bool X11OpenGLSalGraphicsImpl::RenderPixmapToScreen( X11Pixmap* pPixmap, int nX, PostDraw(); + CHECK_GL_ERROR(); return true; } diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index ab7e34d..cbf2bf2 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -78,6 +78,8 @@ OpenGLContext::~OpenGLContext() glXDestroyGLXPixmap(m_aGLWin.dpy, m_aGLWin.glPix); } #endif + + CHECK_GL_ERROR(); } void OpenGLContext::requestLegacyContext() @@ -160,6 +162,8 @@ int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPf { return -1; } + + CHECK_GL_ERROR(); return 0; } @@ -198,6 +202,8 @@ bool WGLisExtensionSupported(const char *extension) if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' ')) return 1; // Match } + + CHECK_GL_ERROR(); } bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, @@ -293,6 +299,7 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, ReleaseDC(hWnd, glWin.hDC); DestroyWindow(hWnd); + CHECK_GL_ERROR(); return bArbMultisampleSupported; } #endif @@ -448,6 +455,7 @@ GLXFBConfig* getFBConfigForPixmap(Display* dpy, int& nBestFBC, bool bUseDoubleBu } } + CHECK_GL_ERROR(); return pFBC; } diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index a6073c4..bbcaefd 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -144,6 +144,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,const OUString return 0; } + CHECK_GL_ERROR(); return ProgramID; } @@ -184,6 +185,8 @@ void OpenGLHelper::renderToFile(long nWidth, long nHeight, const OUString& rFile } catch (...) { SAL_WARN("vcl.opengl", "Error writing png to " << rFileName); } + + CHECK_GL_ERROR(); } BitmapEx OpenGLHelper::ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight) @@ -326,6 +329,8 @@ void OpenGLHelper::createFramebuffer(long nWidth, long nHeight, GLuint& nFramebu } glBindRenderbuffer(GL_RENDERBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); + + CHECK_GL_ERROR(); } float OpenGLHelper::getGLVersion() @@ -340,6 +345,8 @@ float OpenGLHelper::getGLVersion() fVersion += (aVersion[2] - '0')/10.0; } } + + CHECK_GL_ERROR(); return fVersion; } @@ -396,6 +403,7 @@ bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rV rVI = *pVI; XFree( pVI ); + CHECK_GL_ERROR(); return true; } @@ -446,6 +454,7 @@ GLXFBConfig OpenGLHelper::GetPixmapFBConfig( Display* pDisplay, bool& bInverted return 0; } + CHECK_GL_ERROR(); return aFbConfigs[i]; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits