aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/items.pri
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2013-11-06 13:07:58 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-13 23:42:13 +0100
commit3afffa47feabc80e1bc20ffd2143a722a1c360a2 (patch)
tree1e8d5e367aefae0d25c67a1c5e82eeeb357203a6 /src/quick/items/items.pri
parent376844cc6f312d2ab8cf3191ec3e5535bfa850e0 (diff)
Adapt Qt Quick 2 renderer to work with OpenGL Core Profile
The basic approach is to have the batched renderer create and bind a vertex array object if it detects we are using an OpenGL Core profile context. The VAO is bound for the duration of the QQ2 renderer's work cycle and unbound at the end so as to not interfere with any other VAO's a user may wish to use. All shaders have been copied and ported to be compliant with the GLSL 150 core specification which is the minimum for a Core profile context (OpenGL 3.2 Core). We are not using any newer features as yet so this will work anywhere we can get a Core profile context. The QSGShaderSourceBuilder class has been extended to resolve any requests for shaders to the same basefilename with "_core" appended prior to any file extension. This could be extended in the future to allow version, or GPU or platform specific shaders. The QSGShaderSourceBuilder has also been extended to allow it to insert #define definitions in the prologue of a shader. Any such definition is inserted: * After the last #extension directive (if any are found) * Otherwise after the #version directive (if found) * Otherwise at the start of the shader source This is required by the custom particle shaders which make extensive use of such #defines. In addition the mechanism used by the distance field glyph cache to extend the cache with new glyphs has been modified to work (and work more efficiently) when using a Core profile context. Rather than using a shader program and a buffer filling quad to blit the old texture into the new cache texture, we instead use the technique of framebuffer blitting. The existing fallback implementation using glTexSubImage2D() is still available if needed. The DECLARATIVE_EXAMPLE_MAIN macro has been extended to allow easy testing of any of the QtDeclarative examples with a core profile context. Just run the example with QT_QUICK_CORE_PROFILE=1 ./text for e.g. The only ones that may not work out of the box are those that provide GLSL shader source e.g. the customparticles or shader effect examples. These work fine if the shader source is adapted to GLSL 150 core. In the future it may be a good idea to expose some context property to QML that the user can use to determine what shader source variation to provide to Qt Quick. Along these lines it would also be very nice to allow the provision of shader source to ShaderEffect or CustomParticle from a separate source file just as we now do within Qt Quick. Task-number: QTBUG-32050 Change-Id: Ia6e9f06dbb8508af9ae03c6b60fb418b4cc9e41f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/quick/items/items.pri')
-rw-r--r--src/quick/items/items.pri8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index d0ebbcfcdb..3996512f9d 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -145,7 +145,13 @@ OTHER_FILES += \
$$PWD/shaders/shadereffect.vert \
$$PWD/shaders/shadereffect.frag \
$$PWD/shaders/shadereffectfallback.vert \
- $$PWD/shaders/shadereffectfallback.frag
+ $$PWD/shaders/shadereffectfallback.frag \
+ $$PWD/shaders/sprite_core.vert \
+ $$PWD/shaders/sprite_core.frag \
+ $$PWD/shaders/shadereffect_core.vert \
+ $$PWD/shaders/shadereffect_core.frag \
+ $$PWD/shaders/shadereffectfallback_core.vert \
+ $$PWD/shaders/shadereffectfallback_core.frag
RESOURCES += \
$$PWD/items.qrc