diff options
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 14 | ||||
-rw-r--r-- | src/opengl/util/fragmentprograms_p.h | 208 | ||||
-rw-r--r-- | src/opengl/util/pattern_brush.glsl | 2 |
3 files changed, 132 insertions, 92 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index fc1695d..1a586d3 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -1222,7 +1222,7 @@ inline void QOpenGLPaintEnginePrivate::setGradientOps(const QBrush &brush, const fragment_brush = FRAGMENT_PROGRAM_BRUSH_CONICAL; else if (current_style == Qt::SolidPattern) fragment_brush = FRAGMENT_PROGRAM_BRUSH_SOLID; - else if (current_style == Qt::TexturePattern) + else if (current_style == Qt::TexturePattern && !brush.texture().isQBitmap()) fragment_brush = FRAGMENT_PROGRAM_BRUSH_TEXTURE; else fragment_brush = FRAGMENT_PROGRAM_BRUSH_PATTERN; @@ -4311,6 +4311,16 @@ void QOpenGLPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QR void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &offset) { Q_D(QOpenGLPaintEngine); + if (pm.depth() == 1) { + QPixmap tpx(pm.size()); + tpx.fill(Qt::transparent); + QPainter p(&tpx); + p.setPen(d->cpen); + p.drawPixmap(0, 0, pm); + p.end(); + drawTiledPixmap(r, tpx, offset); + return; + } QImage scaled; const int sz = d->max_texture_size; @@ -5207,7 +5217,7 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * device->context()->d_func()->bindTexture(cbrush.textureImage(), GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); else - device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, true), + device->context()->d_func()->bindTexture(qt_imageForBrush(current_style, false), GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 89cd182..9154c6e 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -5927,11 +5927,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[7];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[2], 2D;\n" + "ADD R1.x, -R1, c[10];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R0, c[4].y;\n" "MUL R3.xyz, R1.w, R2;\n" @@ -5967,11 +5968,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MAD R0.xyz, fragment.position.x, c[1], R0;\n" "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" - "MUL R0.zw, R0.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "MUL R0.xy, R0, R0.z;\n" + "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[2], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[8];\n" "MUL R2.xyz, R1, R2.x;\n" @@ -5991,7 +5993,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN = "!!ARBfp1.0\n" - "PARAM c[8] = { program.local[0..7] };\n" + "PARAM c[9] = { program.local[0..7],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6002,11 +6005,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" - "MUL R0.xy, fragment.position, c[5];\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.z, -R0.x, c[8].x;\n" "ADD R3.xy, fragment.position, c[6];\n" + "MUL R1, fragment.color.primary, R0.z;\n" + "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2, R1, R0;\n" "MAD R2, -R1, R0, R2;\n" "MUL R3.xy, R3, c[4];\n" @@ -6020,7 +6024,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6033,23 +6037,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].y;\n" + "ADD R2.w, -R0, c[8].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" + "MUL R2.xyz, R2, c[8].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MUL R3.xyz, R1, R0;\n" "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" + "ADD R2.x, -R1.w, c[8];\n" + "MAD R3.xyz, R3, c[8].y, R4;\n" "MAD R3.xyz, R0, R2.x, R3;\n" "MAD R1.xyz, R0, R2.x, R1;\n" - "MUL R2.xyz, R0, c[8].x;\n" + "MUL R2.xyz, R0, c[8].y;\n" "ADD R1.xyz, R1, -R3;\n" "SGE R2.xyz, R2, R0.w;\n" "MAD R2.xyz, R2, R1, R3;\n" @@ -6077,10 +6082,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" @@ -6113,10 +6119,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R2.xyz, R1, R0.w;\n" @@ -6152,6 +6159,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[8].y;\n" "RCP R0.x, R0.x;\n" @@ -6201,7 +6209,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[2], 2D;\n" + "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R1.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" @@ -6238,7 +6247,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6251,21 +6260,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[2], 2D;\n" + "ADD R0.x, -R0, c[8];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[5].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[8].y;\n" + "ADD R2.w, -R0, c[8].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[8].x;\n" + "MUL R2.xyz, R2, c[8].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R3.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[8].y;\n" - "MAD R3.xyz, R3, c[8].x, R4;\n" - "MUL R1.xyz, R1, c[8].x;\n" + "ADD R2.w, -R1, c[8].x;\n" + "MAD R3.xyz, R3, c[8].y, R4;\n" + "MUL R1.xyz, R1, c[8].y;\n" "SGE R1.xyz, R1, R1.w;\n" "MAD R3.xyz, R0, R2.w, R3;\n" "MAD R2.xyz, R0, R2.w, R2;\n" @@ -6296,24 +6306,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[8].z;\n" - "RCP R2.w, R1.x;\n" + "MAX R1.w, R0, c[8].z;\n" + "RCP R2.w, R1.w;\n" "MUL R2.xyz, R0, R2.w;\n" "RSQ R1.w, R2.x;\n" - "RCP R3.x, R1.w;\n" - "RSQ R1.w, R2.y;\n" "MUL R5.xyz, -R2, c[8].w;\n" "MUL R1.xyz, fragment.position.y, c[2];\n" "MAD R1.xyz, fragment.position.x, c[1], R1;\n" "ADD R1.xyz, R1, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" - "RSQ R1.z, R2.z;\n" "MUL R1.xy, R1, c[0];\n" - "MAD R2.xyz, -R0, R2.w, c[8].x;\n" - "RCP R3.y, R1.w;\n" - "RCP R3.z, R1.z;\n" "TEX R1.x, R1, texture[2], 2D;\n" + "RSQ R1.z, R2.y;\n" + "RSQ R1.y, R2.z;\n" + "MAD R2.xyz, -R0, R2.w, c[8].x;\n" + "RCP R3.x, R1.w;\n" + "RCP R3.y, R1.z;\n" + "RCP R3.z, R1.y;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MAD R4.xyz, R0.w, R3, -R0;\n" "MAD R3.xyz, R1, c[8].y, -R1.w;\n" @@ -6351,7 +6362,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6361,16 +6372,17 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" + "ADD R1.x, -R1, c[8];\n" "TEX R0, R0, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.xyz, R1, R0;\n" "MUL R3.xyz, R1.w, R0;\n" "MUL R1.xyz, R1, R0.w;\n" "MIN R1.xyz, R1, R3;\n" - "MAD R2.xyz, -R1, c[8].x, R2;\n" + "MAD R2.xyz, -R1, c[8].y, R2;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" "ADD R1.xy, fragment.position, c[6];\n" @@ -6385,7 +6397,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION = "!!ARBfp1.0\n" "PARAM c[9] = { program.local[0..7],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6395,18 +6407,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R0.zw, R0.xyxy, c[0].xyxy;\n" - "TEX R1.x, R0.zwzw, texture[2], 2D;\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[2], 2D;\n" "MUL R0.xy, fragment.position, c[5];\n" "TEX R0, R0, texture[0], 2D;\n" + "ADD R1.x, -R1, c[8];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[8].x, R3;\n" - "ADD R2.w, -R0, c[8].y;\n" + "MAD R2.xyz, -R2, c[8].y, R3;\n" + "ADD R2.w, -R0, c[8].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" - "ADD R2.x, -R1.w, c[8].y;\n" + "ADD R2.x, -R1.w, c[8];\n" "MAD R2.xyz, R0, R2.x, R1;\n" "ADD R1.z, R1.w, R0.w;\n" "MAD R2.w, -R1, R0, R1.z;\n" @@ -6432,11 +6445,12 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, R0, c[0];\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" "MUL R0.zw, fragment.position.xyxy, c[6].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R2.xyz, R0, c[4].y;\n" - "TEX R1.x, R1, texture[1], 2D;\n" + "ADD R1.x, -R1, c[7];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R3.xyz, R1.w, R2;\n" "MUL R2.xyz, R1, c[4].x;\n" @@ -6466,10 +6480,11 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R0, c[3];\n" "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" - "MUL R1.xy, R0, c[0];\n" + "MUL R0.xy, R0, c[0];\n" + "TEX R1.x, R0, texture[1], 2D;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "TEX R1.x, R1, texture[1], 2D;\n" + "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "ADD R2.x, -R0.w, c[5];\n" "MUL R2.xyz, R1, R2.x;\n" @@ -6483,7 +6498,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_SCREEN_NOMASK = "!!ARBfp1.0\n" - "PARAM c[5] = { program.local[0..4] };\n" + "PARAM c[6] = { program.local[0..4],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6493,7 +6509,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6505,7 +6522,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_OVERLAY_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6517,23 +6534,24 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "ADD R2.w, -R0, c[5].y;\n" - "MUL R2.xyz, R2, c[5].x;\n" + "ADD R2.w, -R0, c[5].x;\n" + "MUL R2.xyz, R2, c[5].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R3.xyz, R1, R2.w;\n" "MUL R1.xyz, R1, R0;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R1.xyz, R1, c[5].x, R3;\n" + "ADD R2.w, -R1, c[5].x;\n" + "MAD R1.xyz, R1, c[5].y, R3;\n" "MAD R1.xyz, R0, R2.w, R1;\n" "MAD R2.xyz, R0, R2.w, R2;\n" - "MUL R0.xyz, R0, c[5].x;\n" + "MUL R0.xyz, R0, c[5].y;\n" "ADD R2.w, R1, R0;\n" "ADD R2.xyz, R2, -R1;\n" "SGE R0.xyz, R0, R0.w;\n" @@ -6556,7 +6574,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6586,7 +6605,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6617,6 +6637,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MAX R0.x, R1.w, c[5].y;\n" "RCP R0.x, R0.x;\n" @@ -6660,7 +6681,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" @@ -6691,7 +6713,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_HARDLIGHT_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6704,21 +6726,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R0.x, -R0, c[5];\n" "MUL R1, fragment.color.primary, R0.x;\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" - "ADD R2.w, -R0, c[5].y;\n" + "ADD R2.w, -R0, c[5].x;\n" "ADD R3.xyz, R1.w, -R1;\n" "ADD R2.xyz, R0.w, -R0;\n" "MUL R2.xyz, R2, R3;\n" - "MUL R2.xyz, R2, c[5].x;\n" + "MUL R2.xyz, R2, c[5].y;\n" "MAD R2.xyz, R1.w, R0.w, -R2;\n" "MAD R2.xyz, R1, R2.w, R2;\n" "MUL R4.xyz, R1, R2.w;\n" "MUL R3.xyz, R1, R0;\n" - "MUL R1.xyz, R1, c[5].x;\n" - "ADD R2.w, -R1, c[5].y;\n" - "MAD R3.xyz, R3, c[5].x, R4;\n" + "MUL R1.xyz, R1, c[5].y;\n" + "ADD R2.w, -R1, c[5].x;\n" + "MAD R3.xyz, R3, c[5].y, R4;\n" "MAD R3.xyz, R0, R2.w, R3;\n" "MAD R0.xyz, R0, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" @@ -6743,24 +6766,25 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "TEMP R6;\n" "MUL R0.xy, fragment.position, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "MAX R1.x, R0.w, c[5].z;\n" - "RCP R2.w, R1.x;\n" + "MAX R1.w, R0, c[5].z;\n" + "RCP R2.w, R1.w;\n" "MUL R2.xyz, R0, R2.w;\n" "RSQ R1.w, R2.x;\n" - "RCP R3.x, R1.w;\n" - "RSQ R1.w, R2.y;\n" "MUL R5.xyz, -R2, c[5].w;\n" "MUL R1.xyz, fragment.position.y, c[2];\n" "MAD R1.xyz, fragment.position.x, c[1], R1;\n" "ADD R1.xyz, R1, c[3];\n" "RCP R1.z, R1.z;\n" "MUL R1.xy, R1, R1.z;\n" - "RSQ R1.z, R2.z;\n" "MUL R1.xy, R1, c[0];\n" - "MAD R2.xyz, -R0, R2.w, c[5].x;\n" - "RCP R3.y, R1.w;\n" - "RCP R3.z, R1.z;\n" "TEX R1.x, R1, texture[1], 2D;\n" + "RSQ R1.z, R2.y;\n" + "RSQ R1.y, R2.z;\n" + "MAD R2.xyz, -R0, R2.w, c[5].x;\n" + "RCP R3.x, R1.w;\n" + "RCP R3.y, R1.z;\n" + "RCP R3.z, R1.y;\n" + "ADD R1.x, -R1, c[5];\n" "MUL R1, fragment.color.primary, R1.x;\n" "MAD R4.xyz, R0.w, R3, -R0;\n" "MAD R3.xyz, R1, c[5].y, -R1.w;\n" @@ -6792,7 +6816,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_DIFFERENCE_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6803,7 +6827,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" @@ -6812,7 +6837,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "ADD R0.xyz, R1, R0;\n" "MIN R2.xyz, R2, R3;\n" "ADD R1.x, R1.w, R0.w;\n" - "MAD result.color.xyz, -R2, c[5].x, R0;\n" + "MAD result.color.xyz, -R2, c[5].y, R0;\n" "MAD result.color.w, -R1, R0, R1.x;\n" "END\n" ; @@ -6820,7 +6845,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODES_EXCLUSION_NOMASK = "!!ARBfp1.0\n" "PARAM c[6] = { program.local[0..4],\n" - " { 2, 1 } };\n" + " { 1, 2 } };\n" "TEMP R0;\n" "TEMP R1;\n" "TEMP R2;\n" @@ -6831,18 +6856,19 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "RCP R0.z, R0.z;\n" "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" - "TEX R1.x, R0, texture[1], 2D;\n" + "TEX R0.x, R0, texture[1], 2D;\n" + "ADD R1.x, -R0, c[5];\n" "MUL R0.zw, fragment.position.xyxy, c[4].xyxy;\n" "TEX R0, R0.zwzw, texture[0], 2D;\n" "MUL R1, fragment.color.primary, R1.x;\n" "MUL R2.xyz, R1.w, R0;\n" "MAD R3.xyz, R1, R0.w, R2;\n" "MUL R2.xyz, R1, R0;\n" - "MAD R2.xyz, -R2, c[5].x, R3;\n" - "ADD R2.w, -R0, c[5].y;\n" + "MAD R2.xyz, -R2, c[5].y, R3;\n" + "ADD R2.w, -R0, c[5].x;\n" "MAD R1.xyz, R1, R2.w, R2;\n" "ADD R2.x, R1.w, R0.w;\n" - "ADD R2.y, -R1.w, c[5];\n" + "ADD R2.y, -R1.w, c[5].x;\n" "MAD result.color.xyz, R0, R2.y, R1;\n" "MAD result.color.w, -R1, R0, R2.x;\n" "END\n" @@ -6850,20 +6876,22 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_MASK = "!!ARBfp1.0\n" - "PARAM c[7] = { program.local[0..6] };\n" + "PARAM c[8] = { program.local[0..6],\n" + " { 1 } };\n" "TEMP R0;\n" "TEMP R1;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" - "ADD R1.xyz, R0, c[3];\n" - "RCP R0.z, R1.z;\n" - "MUL R0.zw, R1.xyxy, R0.z;\n" - "MUL R1.xy, R0.zwzw, c[0];\n" + "ADD R0.xyz, R0, c[3];\n" + "RCP R0.z, R0.z;\n" + "MUL R0.zw, R0.xyxy, R0.z;\n" + "MUL R0.zw, R0, c[0].xyxy;\n" + "TEX R1.x, R0.zwzw, texture[1], 2D;\n" "ADD R0.xy, fragment.position, c[5];\n" "MUL R0.xy, R0, c[4];\n" "TEX R0, R0, texture[0], 2D;\n" - "TEX R1.x, R1, texture[1], 2D;\n" "DP4 R1.y, R0, c[6];\n" + "ADD R1.x, -R1, c[7];\n" "MUL R0, fragment.color.primary, R1.x;\n" "MUL result.color, R0, R1.y;\n" "END\n" @@ -6871,7 +6899,8 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MODE_BLEND_MODE_NOMASK = "!!ARBfp1.0\n" - "PARAM c[4] = { program.local[0..3] };\n" + "PARAM c[5] = { program.local[0..3],\n" + " { 1 } };\n" "TEMP R0;\n" "MUL R0.xyz, fragment.position.y, c[2];\n" "MAD R0.xyz, fragment.position.x, c[1], R0;\n" @@ -6880,6 +6909,7 @@ static const char *FragmentProgram_FRAGMENT_PROGRAM_BRUSH_PATTERN_COMPOSITION_MO "MUL R0.xy, R0, R0.z;\n" "MUL R0.xy, R0, c[0];\n" "TEX R0.x, R0, texture[0], 2D;\n" + "ADD R0.x, -R0, c[4];\n" "MUL result.color, fragment.color.primary, R0.x;\n" "END\n" ; diff --git a/src/opengl/util/pattern_brush.glsl b/src/opengl/util/pattern_brush.glsl index ac139b2..31702b8 100644 --- a/src/opengl/util/pattern_brush.glsl +++ b/src/opengl/util/pattern_brush.glsl @@ -17,7 +17,7 @@ vec4 brush() coords *= inv_brush_texture_size; - float alpha = texture2D(brush_texture, coords).r; + float alpha = 1.0 - texture2D(brush_texture, coords).r; return gl_Color * alpha; } |