From 73be2aab75a80a12f85658adab8774b572a24acd Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 19 Feb 2018 12:33:57 +0100 Subject: Add support for advanced blend equations to our OpenGL QPainter Mesa and NVidia have been supporting these extensions several years now. It also means we can get rid of the dead unused code we had for advanced compositions. Change-Id: I6a2fcda13490abd977eb4cc3d8b34f186d05ca25 Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopenglshaderprogram.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/gui/opengl/qopenglshaderprogram.cpp') diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 1fe30f7e0ec..46963f0dbf7 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -497,6 +497,13 @@ static const char redefineHighp[] = "#endif\n"; #endif +// Boiler-plate header to have the layout attributes available we need later +static const char blendEquationAdvancedHeader[] = + "#ifdef GL_KHR_blend_equation_advanced\n" + "#extension GL_ARB_fragment_coord_conventions : enable\n" + "#extension GL_KHR_blend_equation_advanced : enable\n" + "#endif\n"; + struct QVersionDirectivePosition { Q_DECL_CONSTEXPR QVersionDirectivePosition(int position = 0, int line = -1) @@ -637,6 +644,10 @@ bool QOpenGLShader::compileSourceCode(const char *source) } } } + if (d->shaderType == Fragment) { + sourceChunks.append(blendEquationAdvancedHeader); + sourceChunkLengths.append(GLint(sizeof(blendEquationAdvancedHeader) - 1)); + } // The precision qualifiers are useful on OpenGL/ES systems, // but usually not present on desktop systems. -- cgit v1.2.3