aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders/styledtext_core.vert
Commit message (Collapse)AuthorAgeFilesLines
* Fix pixelgrid snapping of native text on retina displays.Gunnar Sletta2014-10-231-1/+2
| | | | | | | | | | | Change 63e6c9ada82dc8f16e705cef5f89292784b7ace4 introduced snapping to the pixel grid in the vertex shader for native text, but this code was broken on retina displays because it assumed integer only positions. Fix it by including the retina scale factor into the rounding. Task-number: QTBUG-38702 Change-Id: I84492b02d64f263c9fe030790e04cf79b0dc4e2f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Snap native glyphs to pixel grid in vertex shader.Gunnar Sletta2014-09-111-2/+2
| | | | | | | | | | | The implementation relied on the full matrix, but did not set the RequiresFullMatrix flag. Setting the flag would have serious negative performance impact as it prevents batching, so we solve it in the vertex shader instead. Task-number: QTBUG-38702 Change-Id: I0c245ea9e18b0b29dd9e3073a2648a7f4e061685 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Adapt Qt Quick 2 renderer to work with OpenGL Core ProfileSean Harmer2013-11-131-0/+18
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>