1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtOpenGL module of the Qt Toolkit. |
7 ** This file is part of the QtOpenGL module of the Qt Toolkit. |
8 ** |
8 ** |
342 const int maskOffset = (1<<14) - NoMaskShader; |
342 const int maskOffset = (1<<14) - NoMaskShader; |
343 const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; |
343 const int compositionOffset = (1 << 16) - MultiplyCompositionModeFragmentShader; |
344 */ |
344 */ |
345 |
345 |
346 QGLEngineSharedShaders(const QGLContext *context); |
346 QGLEngineSharedShaders(const QGLContext *context); |
|
347 ~QGLEngineSharedShaders(); |
347 |
348 |
348 QGLShaderProgram *simpleProgram() { return simpleShaderProg; } |
349 QGLShaderProgram *simpleProgram() { return simpleShaderProg; } |
349 QGLShaderProgram *blitProgram() { return blitShaderProg; } |
350 QGLShaderProgram *blitProgram() { return blitShaderProg; } |
350 // Compile the program if it's not already in the cache, return the item in the cache. |
351 // Compile the program if it's not already in the cache, return the item in the cache. |
351 QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog); |
352 QGLEngineShaderProg *findProgramInCache(const QGLEngineShaderProg &prog); |
452 }; |
453 }; |
453 |
454 |
454 // There are optimisations we can do, depending on the brush transform: |
455 // There are optimisations we can do, depending on the brush transform: |
455 // 1) May not have to apply perspective-correction |
456 // 1) May not have to apply perspective-correction |
456 // 2) Can use lower precision for matrix |
457 // 2) Can use lower precision for matrix |
457 void optimiseForBrushTransform(const QTransform &transform); |
458 void optimiseForBrushTransform(QTransform::TransformationType transformType); |
458 void setSrcPixelType(Qt::BrushStyle); |
459 void setSrcPixelType(Qt::BrushStyle); |
459 void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images |
460 void setSrcPixelType(PixelSrcType); // For non-brush sources, like pixmaps & images |
460 void setOpacityMode(OpacityMode); |
461 void setOpacityMode(OpacityMode); |
461 void setMaskType(MaskType); |
462 void setMaskType(MaskType); |
462 void setCompositionMode(QPainter::CompositionMode); |
463 void setCompositionMode(QPainter::CompositionMode); |
463 void setCustomStage(QGLCustomShaderStage* stage); |
464 void setCustomStage(QGLCustomShaderStage* stage); |
464 void removeCustomStage(); |
465 void removeCustomStage(); |
465 |
466 |
466 uint getUniformLocation(Uniform id); |
467 GLuint getUniformLocation(Uniform id); |
467 |
468 |
468 void setDirty(); // someone has manually changed the current shader program |
469 void setDirty(); // someone has manually changed the current shader program |
469 bool useCorrectShaderProg(); // returns true if the shader program needed to be changed |
470 bool useCorrectShaderProg(); // returns true if the shader program needed to be changed |
|
471 |
|
472 void useSimpleProgram(); |
|
473 void useBlitProgram(); |
470 |
474 |
471 QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen |
475 QGLShaderProgram* currentProgram(); // Returns pointer to the shader the manager has chosen |
472 QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers |
476 QGLShaderProgram* simpleProgram(); // Used to draw into e.g. stencil buffers |
473 QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer |
477 QGLShaderProgram* blitProgram(); // Used to blit a texture into the framebuffer |
474 |
478 |