- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 42 42 #include "qglengineshadermanager_p.h" 43 43 #include "qglengineshadersource_p.h" 44 #include "qpaintengineex_opengl2_p.h" 44 45 45 46 #if defined(QT_DEBUG) … … 97 98 code[UntransformedPositionVertexShader] = qglslUntransformedPositionVertexShader; 98 99 code[PositionOnlyVertexShader] = qglslPositionOnlyVertexShader; 100 code[ComplexGeometryPositionOnlyVertexShader] = qglslComplexGeometryPositionOnlyVertexShader; 99 101 code[PositionWithPatternBrushVertexShader] = qglslPositionWithPatternBrushVertexShader; 100 102 code[PositionWithLinearGradientBrushVertexShader] = qglslPositionWithLinearGradientBrushVertexShader; … … 248 250 249 251 // The address returned here will only be valid until next time this function is called. 252 // The program is return bound. 250 253 QGLEngineShaderProg *QGLEngineSharedShaders::findProgramInCache(const QGLEngineShaderProg &prog) 251 254 { … … 255 258 // Move the program to the top of the list as a poor-man's cache algo 256 259 cachedPrograms.move(i, 0); 260 cachedProg->program->bind(); 257 261 return cachedProg; 258 262 } … … 330 334 if (newProg->useOpacityAttribute) 331 335 newProg->program->bindAttributeLocation("opacityArray", QT_OPACITY_ATTR); 332 if (newProg->usePmvMatrix ) {336 if (newProg->usePmvMatrixAttribute) { 333 337 newProg->program->bindAttributeLocation("pmvMatrix1", QT_PMV_MATRIX_1_ATTR); 334 338 newProg->program->bindAttributeLocation("pmvMatrix2", QT_PMV_MATRIX_2_ATTR); … … 355 359 break; 356 360 } 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 357 369 if (cachedPrograms.count() > 30) { 358 370 // The cache is full, so delete the last 5 programs in the list. … … 404 416 : ctx(context), 405 417 shaderProgNeedsChanging(true), 418 complexGeometry(false), 406 419 srcPixelType(Qt::NoBrush), 407 420 opacityMode(NoOpacity), … … 445 458 "invertedTextureSize", 446 459 "brushTransform", 447 "brushTexture" 460 "brushTexture", 461 "matrix" 448 462 }; 449 463 … … 753 767 requiredProgram.useTextureCoords = texCoords; 754 768 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 } 756 779 757 780 // At this point, requiredProgram is fully populated so try to find the program in the cache 758 781 currentShaderProg = sharedShaders->findProgramInCache(requiredProgram); 759 782 760 if (currentShaderProg) { 761 currentShaderProg->program->bind(); 762 if (useCustomSrc) 763 customSrcStage->setUniforms(currentShaderProg->program); 783 if (currentShaderProg && useCustomSrc) { 784 customSrcStage->setUniforms(currentShaderProg->program); 764 785 } 765 786
Note:
See TracChangeset
for help on using the changeset viewer.