Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/gl2paintengineex/qglengineshadermanager.cpp

    r561 r651  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 20 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    185185    simpleShaderProg->addShader(fragShader);
    186186    simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
     187
     188
     189
    187190    simpleShaderProg->link();
    188191    if (!simpleShaderProg->isLinked()) {
     
    217220    }
    218221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
    219239}
    220240
     
    308328        if (newProg->useOpacityAttribute)
    309329            newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
     330
     331
     332
     333
     334
    310335
    311336        newProg->program->link();
     
    394419}
    395420
    396 GLuint QGLEngineShaderManager::getUniformLocation(const Uniform id)
     421GLuint QGLEngineShaderManager::getUniformLocation(Uniform id)
    397422{
    398423    if (!currentShaderProg)
     
    408433        "globalOpacity",
    409434        "depth",
    410         "pmvMatrix",
    411435        "maskTexture",
    412436        "fragmentColor",
     
    429453
    430454
    431 void QGLEngineShaderManager::optimiseForBrushTransform(const QTransform::TransformationType transformType)
     455void QGLEngineShaderManager::optimiseForBrushTransform(QTransform::TransformationType transformType)
    432456{
    433457    Q_UNUSED(transformType); // Currently ignored
     
    506530        return currentShaderProg->program;
    507531    else
    508         return simpleProgram();
     532        return sharedShaders->simpleProgram();
     533}
     534
     535void QGLEngineShaderManager::useSimpleProgram()
     536{
     537    sharedShaders->simpleProgram()->bind();
     538    QGLContextPrivate* ctx_d = ctx->d_func();
     539    ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
     540    ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, false);
     541    ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
     542    shaderProgNeedsChanging = true;
     543}
     544
     545void QGLEngineShaderManager::useBlitProgram()
     546{
     547    sharedShaders->blitProgram()->bind();
     548    QGLContextPrivate* ctx_d = ctx->d_func();
     549    ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
     550    ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, true);
     551    ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, false);
     552    shaderProgNeedsChanging = true;
    509553}
    510554
     
    707751    requiredProgram.useTextureCoords = texCoords;
    708752    requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
     753
    709754
    710755    // At this point, requiredProgram is fully populated so try to find the program in the cache
     
    717762    }
    718763
     764
     765
     766
     767
     768
     769
     770
    719771    shaderProgNeedsChanging = false;
    720772    return true;
Note: See TracChangeset for help on using the changeset viewer.