summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/sofficemain.cxx2
-rw-r--r--desktop/unx/source/start.c2
-rw-r--r--desktop/win32/source/officeloader/officeloader.cxx2
-rw-r--r--include/desktop/exithelper.h (renamed from desktop/source/inc/exithelper.h)6
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx109
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx9
7 files changed, 120 insertions, 12 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 3927840c44a2..958ca8ac1121 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -35,7 +35,6 @@
#include "lockfile.hxx"
#include "userinstall.hxx"
#include "desktopcontext.hxx"
-#include "exithelper.h"
#include "migration.hxx"
#include <svl/languageoptions.hxx>
@@ -78,6 +77,7 @@
#include <com/sun/star/frame/thePopupMenuControllerFactory.hpp>
#include <com/sun/star/office/Quickstart.hpp>
+#include <desktop/exithelper.h>
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/configuration.hxx>
diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx
index c94d5f146553..28296ee857f0 100644
--- a/desktop/source/app/sofficemain.cxx
+++ b/desktop/source/app/sofficemain.cxx
@@ -22,10 +22,10 @@
#include "desktopdllapi.h"
#include "app.hxx"
-#include "exithelper.h"
#include "cmdlineargs.hxx"
#include "cmdlinehelp.hxx"
+#include <desktop/exithelper.h>
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
#include <sal/log.hxx>
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index b072f0f01c25..8583f5bb5dec 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -25,6 +25,7 @@
#include <string.h>
#include <errno.h>
+#include <desktop/exithelper.h>
#include <osl/process.h>
#include <osl/thread.h>
#include <rtl/bootstrap.h>
@@ -34,7 +35,6 @@
#include <sal/main.h>
#include "args.h"
-#include "../../source/inc/exithelper.h"
#include "pagein.h"
#include "splashx.h"
diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx
index e782c90c94b0..81be53204c67 100644
--- a/desktop/win32/source/officeloader/officeloader.cxx
+++ b/desktop/win32/source/officeloader/officeloader.cxx
@@ -40,10 +40,10 @@
#include <stdlib.h>
#include <systools/win32/uwinapi.h>
+#include <desktop/exithelper.h>
#include <rtl/string.h>
#include <sal/macros.h>
-#include "../../../source/inc/exithelper.h"
#include "../loader.hxx"
#include <config_version.h>
diff --git a/desktop/source/inc/exithelper.h b/include/desktop/exithelper.h
index f92f1a867727..51175fa27816 100644
--- a/desktop/source/inc/exithelper.h
+++ b/include/desktop/exithelper.h
@@ -17,8 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_DESKTOP_SOURCE_INC_EXITHELPER_H
-#define INCLUDED_DESKTOP_SOURCE_INC_EXITHELPER_H
+#ifndef INCLUDED_DESKTOP_EXITHELPER_H
+#define INCLUDED_DESKTOP_EXITHELPER_H
enum EExitCodes {
/* e.g. used to force showing of the command line help */
@@ -33,6 +33,6 @@ enum EExitCodes {
EXITHELPER_NORMAL_RESTART = 81
};
-#endif // INCLUDED_DESKTOP_SOURCE_INC_EXITHELPER_H
+#endif // INCLUDED_DESKTOP_EXITHELPER_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 03d0a5d05811..1ce8ce8e5fca 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -9,6 +9,7 @@
#include <config_opengl.h>
+#include <desktop/exithelper.h>
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
#include <vcl/opengl/OpenGLWrapper.hxx>
@@ -839,6 +840,107 @@ bool OpenGLContext::ImplInit()
#elif defined( _WIN32 )
+namespace
+{
+
+bool tryShaders(const OUString& rVertexShader, const OUString& rFragmentShader, const OUString& rGeometryShader = "", const OString& rPreamble = "")
+{
+ GLint nId;
+
+ // Somewhat mysteriously, the OpenGLHelper::LoadShaders() API saves a compiled binary of the
+ // shader only if you give it the digest of the shaders. We have API to calculate the digest
+ // only of the combination of vertex and fragment (but not geometry) shader. So if we have a
+ // geometry shader, we should not save the binary.
+ if (rGeometryShader.isEmpty())
+ {
+ nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, rPreamble, OpenGLHelper::GetDigest( rVertexShader, rFragmentShader, rPreamble));
+ }
+ else
+ {
+ assert(rPreamble.isEmpty());
+ nId = OpenGLHelper::LoadShaders(rVertexShader, rFragmentShader, rGeometryShader);
+ }
+ if (!nId)
+ return false;
+ glDeleteProgram(nId);
+ return glGetError() == GL_NO_ERROR;
+}
+
+bool compiledShaderBinariesWork()
+{
+ static bool bBeenHere = false;
+ static bool bResult;
+
+ if (bBeenHere)
+ return bResult;
+
+ bBeenHere = true;
+
+ bResult =
+ (
+#if 0 // Only look at shaders used by vcl for now
+ // canvas
+ tryShaders("dummyVertexShader", "linearMultiColorGradientFragmentShader") &&
+ tryShaders("dummyVertexShader", "linearTwoColorGradientFragmentShader") &&
+ tryShaders("dummyVertexShader", "radialMultiColorGradientFragmentShader") &&
+ tryShaders("dummyVertexShader", "radialTwoColorGradientFragmentShader") &&
+ tryShaders("dummyVertexShader", "rectangularMultiColorGradientFragmentShader") &&
+ tryShaders("dummyVertexShader", "rectangularTwoColorGradientFragmentShader") &&
+ // chart2
+ (GLEW_VERSION_3_3 ?
+ (tryShaders("shape3DVertexShader", "shape3DFragmentShader") &&
+ tryShaders("shape3DVertexShaderBatchScroll", "shape3DFragmentShaderBatchScroll") &&
+ tryShaders("shape3DVertexShaderBatch", "shape3DFragmentShaderBatch") &&
+ tryShaders("textVertexShaderBatch", "textFragmentShaderBatch")) :
+ (tryShaders("shape3DVertexShaderV300", "shape3DFragmentShaderV300"))) &&
+ tryShaders("textVertexShader", "textFragmentShader") &&
+ tryShaders("screenTextVertexShader", "screenTextFragmentShader") &&
+ tryShaders("commonVertexShader", "commonFragmentShader") &&
+ tryShaders("pickingVertexShader", "pickingFragmentShader") &&
+ tryShaders("backgroundVertexShader", "backgroundFragmentShader") &&
+ tryShaders("symbolVertexShader", "symbolFragmentShader") &&
+ tryShaders("symbolVertexShader", "symbolFragmentShader") &&
+ // slideshow
+ tryShaders("reflectionVertexShader", "reflectionFragmentShader") &&
+ tryShaders("basicVertexShader", "basicFragmentShader") &&
+ tryShaders("vortexVertexShader", "vortexFragmentShader", "vortexGeometryShader") &&
+ tryShaders("basicVertexShader", "rippleFragmentShader") &&
+ tryShaders("glitterVertexShader", "glitterFragmentShader") &&
+ tryShaders("honeycombVertexShader", "honeycombFragmentShader", "honeycombGeometryShader") &&
+#endif
+ // vcl
+ tryShaders("combinedVertexShader", "combinedFragmentShader") &&
+ tryShaders("dumbVertexShader", "invert50FragmentShader") &&
+ tryShaders("combinedTextureVertexShader", "combinedTextureFragmentShader") &&
+ tryShaders("textureVertexShader", "areaScaleFragmentShader") &&
+ tryShaders("transformedTextureVertexShader", "maskedTextureFragmentShader") &&
+ tryShaders("transformedTextureVertexShader", "areaScaleFastFragmentShader") &&
+ tryShaders("transformedTextureVertexShader", "areaScaleFastFragmentShader", "", "#define MASKED") &&
+ tryShaders("transformedTextureVertexShader", "areaScaleFragmentShader") &&
+ tryShaders("transformedTextureVertexShader", "areaScaleFragmentShader", "", "#define MASKED") &&
+ tryShaders("transformedTextureVertexShader", "textureFragmentShader") &&
+ tryShaders("combinedTextureVertexShader", "combinedTextureFragmentShader") &&
+ tryShaders("combinedTextureVertexShader", "combinedTextureFragmentShader", "", "// flush shader\n") &&
+ tryShaders("textureVertexShader", "linearGradientFragmentShader") &&
+ tryShaders("textureVertexShader", "radialGradientFragmentShader") &&
+ tryShaders("textureVertexShader", "areaHashCRC64TFragmentShader") &&
+ tryShaders("textureVertexShader", "replaceColorFragmentShader") &&
+ tryShaders("textureVertexShader", "greyscaleFragmentShader") &&
+ tryShaders("textureVertexShader", "textureFragmentShader") &&
+ tryShaders("textureVertexShader", "convolutionFragmentShader") &&
+ tryShaders("textureVertexShader", "areaScaleFastFragmentShader"));
+
+ if (!bResult)
+ {
+ OpenGLZone::hardDisable();
+ TerminateProcess(GetCurrentProcess(), EXITHELPER_NORMAL_RESTART);
+ }
+
+ return bResult;
+}
+
+} // unnamed namespace
+
bool OpenGLContext::init(HDC hDC, HWND hWnd)
{
if (mbInitialized)
@@ -964,6 +1066,13 @@ bool OpenGLContext::ImplInit()
return false;
}
+ if (!compiledShaderBinariesWork())
+ {
+ wglMakeCurrent(NULL, NULL);
+ wglDeleteContext(hTempRC);
+ return false;
+ }
+
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hTempRC);
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 8418706c3784..5892a625300e 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -66,7 +66,6 @@ OString loadShader(const OUString& rFilename)
{
OUString aFileURL = getShaderFolder() + rFilename +".glsl";
osl::File aFile(aFileURL);
- SAL_INFO("vcl.opengl", "Reading " << aFileURL);
if(aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
{
sal_uInt64 nSize = 0;
@@ -76,11 +75,12 @@ OString loadShader(const OUString& rFilename)
aFile.read(content.get(), nSize, nBytesRead);
assert(nSize == nBytesRead);
content.get()[nBytesRead] = 0;
+ SAL_INFO("vcl.opengl", "Read " << nBytesRead << " bytes from " << aFileURL);
return OString(content.get());
}
else
{
- SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL);
+ SAL_WARN("vcl.opengl", "Could not open " << aFileURL);
}
return OString();
@@ -289,12 +289,12 @@ namespace
sal_uInt64 nBytesRead = 0;
aFile.read( rBinary.data(), nSize, nBytesRead );
assert( nSize == nBytesRead );
- SAL_INFO("vcl.opengl", "Loading file: '" << rBinaryFileName << "': success" );
+ VCL_GL_INFO("Loading file: '" << rBinaryFileName << "': success" );
return true;
}
else
{
- SAL_WARN("vcl.opengl", "Loading file: '" << rBinaryFileName << "': FAIL");
+ VCL_GL_INFO("Loading file: '" << rBinaryFileName << "': FAIL");
}
return false;
@@ -405,7 +405,6 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
OString aFileName =
createFileName(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, rDigest);
bBinaryResult = loadProgramBinary(ProgramID, aFileName);
- VCL_GL_INFO("Load binary shader from '" << aFileName << "'" << bBinaryResult);
CHECK_GL_ERROR();
}