Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4242#include "qglengineshadermanager_p.h"
    4343#include "qglengineshadersource_p.h"
     44#include "qpaintengineex_opengl2_p.h"
    4445
    4546#if defined(QT_DEBUG)
     
    9798        code[UntransformedPositionVertexShader] = qglslUntransformedPositionVertexShader;
    9899        code[PositionOnlyVertexShader] = qglslPositionOnlyVertexShader;
     100        code[ComplexGeometryPositionOnlyVertexShader] = qglslComplexGeometryPositionOnlyVertexShader;
    99101        code[PositionWithPatternBrushVertexShader] = qglslPositionWithPatternBrushVertexShader;
    100102        code[PositionWithLinearGradientBrushVertexShader] = qglslPositionWithLinearGradientBrushVertexShader;
     
    248250
    249251// The address returned here will only be valid until next time this function is called.
     252// The program is return bound.
    250253QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog)
    251254{
     
    255258            // Move the program to the top of the list as a poor-man's cache algo
    256259            cachedPrograms.move(i, 0);
     260            cachedProg->program->bind();
    257261            return cachedProg;
    258262        }
     
    330334        if (newProg->useOpacityAttribute)
    331335            newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR);
    332         if (newProg->usePmvMatrix) {
     336        if (newProg->usePmvMatrixAttribute) {
    333337            newProg->program->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR);
    334338            newProg->program->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR);
     
    355359            break;
    356360        }
     361
     362        newProg->program->bind();
     363
     364        if (newProg->maskFragShader != QGLEngineSharedShaders::NoMaskFragmentShader) {
     365            GLuint location = newProg->program->uniformLocation("maskTexture");
     366            newProg->program->setUniformValue(location, QT_MASK_TEXTURE_UNIT);
     367        }
     368
    357369        if (cachedPrograms.count() > 30) {
    358370            // The cache is full, so delete the last 5 programs in the list.
     
    404416    : ctx(context),
    405417      shaderProgNeedsChanging(true),
     418      complexGeometry(false),
    406419      srcPixelType(Qt::NoBrush),
    407420      opacityMode(NoOpacity),
     
    445458        "invertedTextureSize",
    446459        "brushTransform",
    447         "brushTexture"
     460        "brushTexture",
     461        "matrix"
    448462    };
    449463
     
    753767    requiredProgram.useTextureCoords = texCoords;
    754768    requiredProgram.useOpacityAttribute = (opacityMode == AttributeOpacity);
    755     requiredProgram.usePmvMatrix = true;
     769    if (complexGeometry && srcPixelType == Qt::SolidPattern) {
     770        requiredProgram.positionVertexShader = QGLEngineSharedShaders::ComplexGeometryPositionOnlyVertexShader;
     771        requiredProgram.usePmvMatrixAttribute = false;
     772    } else {
     773        requiredProgram.usePmvMatrixAttribute = true;
     774
     775        // Force complexGeometry off, since we currently don't support that mode for
     776        // non-solid brushes
     777        complexGeometry = false;
     778    }
    756779
    757780    // At this point, requiredProgram is fully populated so try to find the program in the cache
    758781    currentShaderProg = sharedShaders->findProgramInCache(requiredProgram);
    759782
    760     if (currentShaderProg) {
    761         currentShaderProg->program->bind();
    762         if (useCustomSrc)
    763             customSrcStage->setUniforms(currentShaderProg->program);
     783    if (currentShaderProg && useCustomSrc) {
     784        customSrcStage->setUniforms(currentShaderProg->program);
    764785    }
    765786
Note: See TracChangeset for help on using the changeset viewer.