diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/svapp.cxx | 5 | ||||
-rw-r--r-- | vcl/source/app/svdata.cxx | 7 | ||||
-rw-r--r-- | vcl/source/gdi/bitmap3.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 43 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLContext.cxx | 311 | ||||
-rw-r--r-- | vcl/source/opengl/OpenGLHelper.cxx | 25 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 5 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/event.cxx | 11 | ||||
-rw-r--r-- | vcl/source/window/status.cxx | 7 |
10 files changed, 2 insertions, 424 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index f91375e77edd..032e141c34c1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1171,11 +1171,6 @@ OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize } else #endif -#if HAVE_FEATURE_OPENGL - if ( OpenGLWrapper::isVCLOpenGLEnabled() ) - appendDetails(u"", Localize(SV_APP_GL, bLocalize)); - else -#endif appendDetails(u"", Localize(SV_APP_DEFAULT, bLocalize)); #if (defined LINUX || defined _WIN32 || defined MACOSX || defined __FreeBSD__) diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx index 41f9f1bd7af4..ce91212e96c0 100644 --- a/vcl/source/app/svdata.cxx +++ b/vcl/source/app/svdata.cxx @@ -235,13 +235,6 @@ vcl::Window *ImplGetDefaultContextWindow() pSVData->mpDefaultWin = VclPtr<WorkWindow>::Create( nullptr, WB_DEFAULTWIN ); pSVData->mpDefaultWin->SetText( "VCL ImplGetDefaultWindow" ); - -#if HAVE_FEATURE_OPENGL - // Add a reference to the default context so it never gets deleted - rtl::Reference<OpenGLContext> pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext(); - if( pContext.is() ) - pContext->acquire(); -#endif } catch (const css::uno::Exception&) { diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index 3b0b1cd76bfb..28e599f3cbed 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -784,10 +784,6 @@ bool Bitmap::HasFastScale() if( SkiaHelper::isVCLSkiaEnabled() && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster) return true; #endif -#if HAVE_FEATURE_OPENGL - if( OpenGLHelper::isVCLOpenGLEnabled()) - return true; -#endif return false; } diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index eab208eb8689..e5fe48e851ab 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -20,14 +20,6 @@ #include <memory> #include <config_features.h> #include <sal/log.hxx> -#if HAVE_FEATURE_OPENGL -#include <opengl/gdiimpl.hxx> -#include <opengl/zone.hxx> -#include <desktop/exithelper.h> -#ifdef _WIN32 -#include <svsys.h> -#endif -#endif #include <PhysicalFontFace.hxx> #include <fontsubset.hxx> #include <salgdi.hxx> @@ -90,41 +82,6 @@ SalGraphics::~SalGraphics() COVERITY_NOEXCEPT_FALSE // can't call ReleaseFonts here, as the destructor just calls this classes SetFont (pure virtual)! } -#if HAVE_FEATURE_OPENGL - -namespace -{ - void disableOpenGLAndTerminateForRestart() - { - OpenGLZone::hardDisable(); -#ifdef _WIN32 - TerminateProcess(GetCurrentProcess(), EXITHELPER_NORMAL_RESTART); -#endif - } -} - -rtl::Reference<OpenGLContext> SalGraphics::GetOpenGLContext() const -{ - OpenGLSalGraphicsImpl *pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(GetImpl()); - if (pImpl) - { - // If we notice that OpenGL is broken the first time being called, it is not too late to call - // disableOpenGLAndTerminateForRestart(). The first time this will be called is from displaying - // the splash screen, so if OpenGL is broken, it is "early enough" for us to be able to disable - // OpenGL and terminate bluntly with EXITHELPER_NORMAL_RESTART, thus causing the wrapper process - // to restart us, then without using OpenGL. - static bool bFirstCall = true; - rtl::Reference<OpenGLContext> xRet(pImpl->GetOpenGLContext()); - if (!xRet.is() && bFirstCall) - disableOpenGLAndTerminateForRestart(); - bFirstCall = false; - return xRet; - } - return nullptr; -} - -#endif - bool SalGraphics::drawTransformedBitmap( const basegfx::B2DPoint& /* rNull */, const basegfx::B2DPoint& /* rX */, diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index c959dac4db55..aa2093af4b6f 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -22,19 +22,12 @@ #include <salgdi.hxx> #include <salinst.hxx> -#include <opengl/framebuffer.hxx> -#include <opengl/program.hxx> -#include <opengl/texture.hxx> #include <opengl/zone.hxx> -#include <opengl/RenderState.hxx> - #include <config_features.h> using namespace com::sun::star; -#define MAX_FRAMEBUFFER_COUNT 30 - static sal_Int64 nBufferSwapCounter = 0; GLWindow::~GLWindow() @@ -52,13 +45,6 @@ OpenGLContext::OpenGLContext(): mbInitialized(false), mnRefCount(0), mbRequestLegacyContext(false), - mbVCLOnly(false), - mnFramebufferCount(0), - mpCurrentFramebuffer(nullptr), - mpFirstFramebuffer(nullptr), - mpLastFramebuffer(nullptr), - mpCurrentProgram(nullptr), - mpRenderState(new RenderState), mpPrevContext(nullptr), mpNextContext(nullptr) { @@ -354,31 +340,6 @@ void OpenGLContext::reset() // reset the clip region maClipRegion.SetEmpty(); - mpRenderState.reset(new RenderState); - - // destroy all framebuffers - if( mpLastFramebuffer ) - { - OpenGLFramebuffer* pFramebuffer = mpLastFramebuffer; - - makeCurrent(); - while( pFramebuffer ) - { - OpenGLFramebuffer* pPrevFramebuffer = pFramebuffer->mpPrevFramebuffer; - delete pFramebuffer; - pFramebuffer = pPrevFramebuffer; - } - mnFramebufferCount = 0; - mpFirstFramebuffer = nullptr; - mpLastFramebuffer = nullptr; - } - - // destroy all programs - if( !maPrograms.empty() ) - { - makeCurrent(); - maPrograms.clear(); - } if( isCurrent() ) resetCurrent(); @@ -428,13 +389,6 @@ bool OpenGLContext::hasCurrent() void OpenGLContext::clearCurrent() { - ImplSVData* pSVData = ImplGetSVData(); - - // release all framebuffers from the old context so we can re-attach the - // texture in the new context - rtl::Reference<OpenGLContext> pCurrentCtx = pSVData->maGDIData.mpLastContext; - if( pCurrentCtx.is() && pCurrentCtx->isCurrent() ) - pCurrentCtx->ReleaseFramebuffers(); } void OpenGLContext::prepareForYield() @@ -467,46 +421,6 @@ void OpenGLContext::prepareForYield() assert (!hasCurrent()); } -rtl::Reference<OpenGLContext> OpenGLContext::getVCLContext(bool bMakeIfNecessary) -{ - ImplSVData* pSVData = ImplGetSVData(); - OpenGLContext *pContext = pSVData->maGDIData.mpLastContext; - while( pContext ) - { - // check if this context is usable - if( pContext->isInitialized() && pContext->isVCLOnly() ) - break; - pContext = pContext->mpPrevContext; - } - rtl::Reference<OpenGLContext> xContext; - vcl::Window* pDefWindow = !pContext && bMakeIfNecessary ? ImplGetDefaultWindow() : nullptr; - if (pDefWindow) - { - // create our magic fallback window context. -#if HAVE_FEATURE_OPENGL - xContext = pDefWindow->GetGraphics()->GetOpenGLContext(); - assert(xContext.is()); -#endif - } - else - xContext = pContext; - - if( xContext.is() ) - xContext->makeCurrent(); - - return xContext; -} - -/* - * We don't care what context we have, but we want one that is live, - * ie. not reset underneath us, and is setup for VCL usage - ideally - * not swapping context at all. - */ -void OpenGLContext::makeVCLCurrent() -{ - getVCLContext(); -} - void OpenGLContext::registerAsCurrent() { ImplSVData* pSVData = ImplGetSVData(); @@ -525,9 +439,6 @@ void OpenGLContext::registerAsCurrent() pSVData->maGDIData.mpLastContext->mpNextContext = this; pSVData->maGDIData.mpLastContext = this; } - - // sync the render state with the current context - mpRenderState->sync(); } void OpenGLContext::resetCurrent() @@ -584,226 +495,4 @@ const SystemChildWindow* OpenGLContext::getChildWindow() const return m_pChildWindow; } -void OpenGLContext::BindFramebuffer( OpenGLFramebuffer* pFramebuffer ) -{ - OpenGLZone aZone; - - if( pFramebuffer != mpCurrentFramebuffer ) - { - if( pFramebuffer ) - pFramebuffer->Bind(); - else - OpenGLFramebuffer::Unbind(); - mpCurrentFramebuffer = pFramebuffer; - } -} - -void OpenGLContext::AcquireDefaultFramebuffer() -{ - BindFramebuffer( nullptr ); -} - -OpenGLFramebuffer* OpenGLContext::AcquireFramebuffer( const OpenGLTexture& rTexture ) -{ - OpenGLZone aZone; - - OpenGLFramebuffer* pFramebuffer = nullptr; - OpenGLFramebuffer* pFreeFbo = nullptr; - OpenGLFramebuffer* pSameSizeFbo = nullptr; - - // check if there is already a framebuffer attached to that texture - pFramebuffer = mpLastFramebuffer; - while( pFramebuffer ) - { - if( pFramebuffer->IsAttached( rTexture ) ) - break; - if( !pFreeFbo && pFramebuffer->IsFree() ) - pFreeFbo = pFramebuffer; - if( !pSameSizeFbo && - pFramebuffer->GetWidth() == rTexture.GetWidth() && - pFramebuffer->GetHeight() == rTexture.GetHeight() ) - pSameSizeFbo = pFramebuffer; - pFramebuffer = pFramebuffer->mpPrevFramebuffer; - } - - // else use any framebuffer having the same size - if( !pFramebuffer && pSameSizeFbo ) - pFramebuffer = pSameSizeFbo; - - // else use the first free framebuffer - if( !pFramebuffer && pFreeFbo ) - pFramebuffer = pFreeFbo; - - // if there isn't any free one, create a new one if the limit isn't reached - if( !pFramebuffer && mnFramebufferCount < MAX_FRAMEBUFFER_COUNT ) - { - mnFramebufferCount++; - pFramebuffer = new OpenGLFramebuffer(); - if( mpLastFramebuffer ) - { - pFramebuffer->mpPrevFramebuffer = mpLastFramebuffer; - mpLastFramebuffer = pFramebuffer; - } - else - { - mpFirstFramebuffer = pFramebuffer; - mpLastFramebuffer = pFramebuffer; - } - } - - // last try, use any framebuffer - // TODO order the list of framebuffers as a LRU - if( !pFramebuffer ) - pFramebuffer = mpFirstFramebuffer; - - assert( pFramebuffer ); - BindFramebuffer( pFramebuffer ); - pFramebuffer->AttachTexture( rTexture ); - - state().viewport(tools::Rectangle(Point(), Size(rTexture.GetWidth(), rTexture.GetHeight()))); - - return pFramebuffer; -} - -// FIXME: this method is rather grim from a perf. perspective. -// We should instead (eventually) use pointers to associate the -// framebuffer and texture cleanly. -void OpenGLContext::UnbindTextureFromFramebuffers( GLuint nTexture ) -{ - OpenGLFramebuffer* pFramebuffer; - - // see if there is a framebuffer attached to that texture - pFramebuffer = mpLastFramebuffer; - while( pFramebuffer ) - { - if (pFramebuffer->IsAttached(nTexture)) - { - BindFramebuffer(pFramebuffer); - pFramebuffer->DetachTexture(); - } - pFramebuffer = pFramebuffer->mpPrevFramebuffer; - } - - // Lets just check that no other context has a framebuffer - // with this texture - that would be bad ... - assert( !IsTextureAttachedAnywhere( nTexture ) ); -} - -/// Method for debugging; check texture is not already attached. -bool OpenGLContext::IsTextureAttachedAnywhere( GLuint nTexture ) -{ - ImplSVData* pSVData = ImplGetSVData(); - for( auto *pCheck = pSVData->maGDIData.mpLastContext; pCheck; - pCheck = pCheck->mpPrevContext ) - { - for( auto pBuffer = pCheck->mpLastFramebuffer; pBuffer; - pBuffer = pBuffer->mpPrevFramebuffer ) - { - if( pBuffer->IsAttached( nTexture ) ) - return true; - } - } - return false; -} - -void OpenGLContext::ReleaseFramebuffer( OpenGLFramebuffer* pFramebuffer ) -{ - if( pFramebuffer ) - pFramebuffer->DetachTexture(); -} - -void OpenGLContext::ReleaseFramebuffer( const OpenGLTexture& rTexture ) -{ - OpenGLZone aZone; - - if (!rTexture) // no texture to release. - return; - - OpenGLFramebuffer* pFramebuffer = mpLastFramebuffer; - - while( pFramebuffer ) - { - if( pFramebuffer->IsAttached( rTexture ) ) - { - BindFramebuffer( pFramebuffer ); - pFramebuffer->DetachTexture(); - if (mpCurrentFramebuffer == pFramebuffer) - BindFramebuffer( nullptr ); - } - pFramebuffer = pFramebuffer->mpPrevFramebuffer; - } -} - -void OpenGLContext::ReleaseFramebuffers() -{ - OpenGLZone aZone; - - OpenGLFramebuffer* pFramebuffer = mpLastFramebuffer; - while( pFramebuffer ) - { - if (!pFramebuffer->IsFree()) - { - BindFramebuffer( pFramebuffer ); - pFramebuffer->DetachTexture(); - } - pFramebuffer = pFramebuffer->mpPrevFramebuffer; - } - BindFramebuffer( nullptr ); -} - -OpenGLProgram* OpenGLContext::GetProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble ) -{ - OpenGLZone aZone; - - // We cache the shader programs in a per-process run-time cache - // based on only the names and the preamble. We don't expect - // shader source files to change during the lifetime of a - // LibreOffice process. - OString aNameBasedKey = OUStringToOString(rVertexShader + "+" + rFragmentShader, RTL_TEXTENCODING_UTF8) + "+" + preamble; - if( !aNameBasedKey.isEmpty() ) - { - ProgramCollection::iterator it = maPrograms.find( aNameBasedKey ); - if( it != maPrograms.end() ) - return it->second.get(); - } - - // Binary shader programs are cached persistently (between - // LibreOffice process instances) based on a hash of their source - // code, as the source code can and will change between - // LibreOffice versions even if the shader names don't change. - OString aPersistentKey = OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, preamble ); - std::shared_ptr<OpenGLProgram> pProgram = std::make_shared<OpenGLProgram>(); - if( !pProgram->Load( rVertexShader, rFragmentShader, preamble, aPersistentKey ) ) - return nullptr; - - maPrograms.insert(std::make_pair(aNameBasedKey, pProgram)); - return pProgram.get(); -} - -OpenGLProgram* OpenGLContext::UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble ) -{ - OpenGLZone aZone; - - OpenGLProgram* pProgram = GetProgram( rVertexShader, rFragmentShader, preamble ); - - if (pProgram && pProgram == mpCurrentProgram) - { - VCL_GL_INFO("Context::UseProgram: Reusing existing program " << pProgram->Id()); - pProgram->Reuse(); - return pProgram; - } - - mpCurrentProgram = pProgram; - - if (!mpCurrentProgram) - { - SAL_WARN("vcl.opengl", "OpenGLContext::UseProgram: mpCurrentProgram is 0"); - return nullptr; - } - - mpCurrentProgram->Use(); - - return mpCurrentProgram; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index ef7729914f0d..fce2ac1afb11 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -884,26 +884,6 @@ const CrashWatchdogTimingsValues& OpenGLZone::getCrashWatchdogTimingsValues() return gWatchdogTimings.getWatchdogTimingsValues(eMode); } -OpenGLVCLContextZone::OpenGLVCLContextZone() -{ - OpenGLContext::makeVCLCurrent(); -} - -namespace -{ - bool bTempOpenGLDisabled = false; -} - -PreDefaultWinNoOpenGLZone::PreDefaultWinNoOpenGLZone() -{ - bTempOpenGLDisabled = true; -} - -PreDefaultWinNoOpenGLZone::~PreDefaultWinNoOpenGLZone() -{ - bTempOpenGLDisabled = false; -} - static void reapGlxTest() { // Reap the glxtest child, or it'll stay around as a zombie, @@ -938,11 +918,6 @@ bool OpenGLHelper::isVCLOpenGLEnabled() if (Application::IsBitmapRendering()) return false; - //tdf#106155, disable GL while loading certain bitmaps needed for the initial toplevel windows - //under raw X (kde) vclplug - if (bTempOpenGLDisabled) - return false; - if (bSet) { return bForceOpenGL || bEnable; diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index cd2ea0cfce6b..3e35ec8d8540 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -697,10 +697,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r return; } - // we need to make sure OpenGL never reaches this slow code path -#if HAVE_FEATURE_OPENGL - assert(!OpenGLHelper::isVCLOpenGLEnabled()); -#endif + // we need to make sure Skia never reaches this slow code path assert(!SkiaHelper::isVCLSkiaEnabled()); } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 48a04b3b122f..5677268ba0dd 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -871,14 +871,6 @@ void OutputDevice::DrawText( const Point& rStartPt, const OUString& rStr, if(mpFontInstance->mpConversion) pLayoutCache = nullptr; -#ifdef MACOSX - // FIXME: tdf#112990 - // Cache text layout crashes on mac with OpenGL enabled - // Force it to not use the cache - if(OpenGLHelper::isVCLOpenGLEnabled()) - pLayoutCache = nullptr; -#endif - std::unique_ptr<SalLayout> pSalLayout = ImplLayout(rStr, nIndex, nLen, rStartPt, 0, nullptr, eDefaultLayout, nullptr, pLayoutCache); if(pSalLayout) { diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx index 251cddaaf048..5b9c4bd4823e 100644 --- a/vcl/source/window/event.cxx +++ b/vcl/source/window/event.cxx @@ -516,17 +516,8 @@ void Window::ImplCallResize() { mpWindowImpl->mbCallResize = false; - // OpenGL has a charming feature of black clearing the whole window - // some legacy code eg. the app-menu has the beautiful feature of - // avoiding re-paints when width doesn't change => invalidate all. -#if HAVE_FEATURE_OPENGL - if( OpenGLWrapper::isVCLOpenGLEnabled() ) - Invalidate(); - // Normally we avoid blanking on re-size unless people might notice: - else -#endif - if( GetBackground().IsGradient() ) + if( GetBackground().IsGradient() ) Invalidate(); Resize(); diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index 953aa27b5071..55ddce975c24 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -721,13 +721,6 @@ void StatusBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle // Do offscreen only when we are not recording layout... bool bOffscreen = !rRenderContext.ImplIsRecordLayout(); - // tdf#94213 - un-necessary virtual-device in GL mode - // causes context switch & hence flicker during sizing. -#if HAVE_FEATURE_OPENGL - if( OpenGLWrapper::isVCLOpenGLEnabled() ) - bOffscreen = false; -#endif - if (!bOffscreen) rRenderContext.Erase(rRect); |