summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp10
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h1
-rw-r--r--src/opengl/qglpixmapfilter.cpp9
-rw-r--r--src/opengl/qpaintengine_opengl.cpp5
4 files changed, 16 insertions, 9 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index ac25597..40b3641 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -266,10 +266,12 @@ QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineS
do {
QByteArray source;
- source.append(qShaderSnippets[prog.mainFragShader]);
- source.append(qShaderSnippets[prog.srcPixelFragShader]);
+ // Insert the custom stage before the srcPixel shader to work around an ATI driver bug
+ // where you cannot forward declare a function that takes a sampler as argument.
if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
source.append(prog.customStageSource);
+ source.append(qShaderSnippets[prog.mainFragShader]);
+ source.append(qShaderSnippets[prog.srcPixelFragShader]);
if (prog.compositionFragShader)
source.append(qShaderSnippets[prog.compositionFragShader]);
if (prog.maskFragShader)
@@ -777,8 +779,8 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
// doesn't use are disabled)
QGLContextPrivate* ctx_d = ctx->d_func();
ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
- ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg->useTextureCoords);
- ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg->useOpacityAttribute);
+ ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);
+ ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);
shaderProgNeedsChanging = false;
return true;
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 8dba951..a7ece0f 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -351,7 +351,6 @@ static const char* const qglslImageSrcFragmentShader = "\n\
static const char* const qglslCustomSrcFragmentShader = "\n\
varying highp vec2 textureCoords; \n\
uniform lowp sampler2D imageTexture; \n\
- lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \n\
lowp vec4 srcPixel() \n\
{ \n\
return customShader(imageTexture, textureCoords); \n\
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index d5a11d9..bfa5ef1 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -591,10 +591,11 @@ bool QGLPixmapDropShadowFilter::processGL(QPainter *painter, const QPointF &pos,
qt_blurImage(image, r * qreal(0.5), false, 1);
- GLuint texture = generateBlurTexture(image.size(), GL_ALPHA);
-
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_ALPHA,
- GL_UNSIGNED_BYTE, image.bits());
+ GLuint texture;
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, image.width(), image.height(),
+ 0, GL_ALPHA, GL_UNSIGNED_BYTE, image.bits());
info = new QGLBlurTextureInfo(image, texture, r);
}
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 08a50cb..28d37bc 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -1451,6 +1451,11 @@ bool QOpenGLPaintEngine::end()
d->device->endPaint();
qt_mask_texture_cache()->maintainCache();
+#if defined(Q_WS_X11)
+ // clear out the references we hold for textures bound with the
+ // texture_from_pixmap extension
+ ctx->d_func()->boundPixmaps.clear();
+#endif
return true;
}