aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/shaders
Commit message (Collapse)AuthorAgeFilesLines
* Android: Work around bug on Samsung Galaxy Tab 3 10.1Eskil Abrahamsen Blomfeldt2015-03-311-1/+4
| | | | | | | | | | | | | | | | After installing the Android 4.4.2 upgrade on Samsung Galaxy Tab 3 10.1, one of the vertex shaders in Qt Quick stopped compiling. The issue seems to be that this particular shader triggers a bug in the driver, and a simple work-around is to replace the ternary conditional operator with a simple if-statement. [ChangeLog][Android] Fixed a vertex shader compilation issue on certain OpenGL drivers. Change-Id: I2f878215a753a7e222c46c0f85a84b0bc81d523a Task-number: QTBUG-43515 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2015-01-161-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4debugging.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4functionobject_p.h src/qml/jsruntime/qv4qobjectwrapper.cpp src/quick/scenegraph/shaders/visualization.frag tests/auto/qml/qjsengine/tst_qjsengine.cpp Change-Id: I492e8546c278f80a300a2129e9a29d861e144a30
| * Fix the visualization of unmerged batch geometries without indexJocelyn Turcotte2014-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | indexData() is null for most QSGGeometryNodes subclasses in QtQuick, make sure that we draw using vertex array data in that case. The patch also increases the contrast of the line pattern, since it is almost invisible with brighter hue values, to make it easier to see which batches aren't merged. Change-Id: Ife7b26692ee318feb0810ee0e787289eb151ea8a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Clean up renderer visualization a bit.Gunnar Sletta2015-01-122-5/+5
|/ | | | | | | | | viewport was currently unused and adreno 305 was confused by the tweak.w > 0.0 when the input was 0.0f, so write it in a slightly more straightforward manner. Change-Id: I101ff71dcb04ca531e91cc5522876d71f368cdc8 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fix pixelgrid snapping of native text on retina displays.Gunnar Sletta2014-10-234-4/+8
| | | | | | | | | | | 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-114-6/+6
| | | | | | | | | | | 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>
* Use the correct precision specifier in visualizer GLSL.Gunnar Sletta2014-06-041-1/+1
| | | | | | | Task-number: QTBUG-39119 Change-Id: I0ec4909167f5694ce4229df8202c89742be21d0a Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Visualization modes for rendering.Gunnar Sletta2014-01-292-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two ways of setting this right now. One is to set it on startup using an environment varible. QSG_VISUALIZE= "batches" - Visualize batchtes in the renderer. Merged batches are drawn with solid color and Unmerged batches are drawn with a diagonal line pattern. Few unique colors means good batching. Unmerged batches are bad if they contain many individual nodes. "clip" - Visualize clipping as red areas on top of the scene. "overdraw" - Visualize all items in 3D to highlight overdraws. This mode can also be used to detect geometry outside the viewport to some extent. Opaque items are rendered with a green tint while translucent items are rendered with a red tint. The bounding box for the viewport is rendered in blue. Opaque content is easier for the scenegraph to process and it can also be faster to render on some hardware. "changes" - Changes in the scenegraph are visualized with a flashing overlay with a random color. Changes on a primitive is visualized with a solid color while changes in an ancestor, such as a matrix or opacity changes is visualized with a pattern. The second way to set the visualization mode is to set it at runtime through QString QQuickWindowPrivate::customRenderMode. This "API" is string based so it is not tied to the batch renderer and in theory can support other custom renderers. The visualized elements do not respect clipping and rendering order is arbitrary. Change-Id: I31efbe53fc905145bf48080ede3e36945cb60dcf Reviewed-by: Michael Brasser <michael.brasser@live.com>
* Set sampler precision in shifted distance field text shaderEskil Abrahamsen Blomfeldt2013-11-281-1/+1
| | | | | | | | | | | | The precision would default to lowp and we would attempt to call smoothstep(mediump, mediump, lowp) which was a non-existent overload on some drivers, thus causing a compiler failure. We can use mediump for the sampler, like in the regular distance field shader. Task-number: QTBUG-35122 Change-Id: Ib50325d48fe7e0d25559da97e7f53e5170f705a1 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Adapt Qt Quick 2 renderer to work with OpenGL Core ProfileSean Harmer2013-11-1334-4/+602
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Refactor shaders into seprate GLSL source filesSean Harmer2013-10-3132-0/+530
The default implementation of QSGShaderMaterial::vertexShader() and fragmentShader() now loads the GLSL source from a list of source files that can be specified via the setShaderSourceFile() or setShaderSourceFiles() functions. Multiple shader source files for each shader stage are supported. Each source file will be read in the order specified and concatenated together before being compiled. The other places where Qt Quick 2 loads shader source code have been adapted to use the new QSGShaderSourceBuilder, which is also used internally by QSGMaterial. This puts Qt Quick 2 into a better state ready to support OpenGL core profile and to load different shaders based upon OpenGL version, profile, GPU vendor, platform, etc. Change-Id: I1a66213c2ce788413168eb48c7bc5317e61988a2 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>