diff options
author | Gunnar Sletta <gunnar@sletta.org> | 2014-09-08 12:38:02 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar@sletta.org> | 2014-09-11 10:34:55 +0200 |
commit | 63e6c9ada82dc8f16e705cef5f89292784b7ace4 (patch) | |
tree | 044713caa88606fd41ca0f599ac857255b87ea1f /src/quick/scenegraph/shaders | |
parent | 046cce32d9f818809382fcbbff0cfa4adfe8d3f7 (diff) |
Snap native glyphs to pixel grid in vertex shader.
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>
Diffstat (limited to 'src/quick/scenegraph/shaders')
-rw-r--r-- | src/quick/scenegraph/shaders/styledtext.vert | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/shaders/styledtext_core.vert | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/shaders/textmask.vert | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/shaders/textmask_core.vert | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/quick/scenegraph/shaders/styledtext.vert b/src/quick/scenegraph/shaders/styledtext.vert index 3ad9497b65..14fefc2564 100644 --- a/src/quick/scenegraph/shaders/styledtext.vert +++ b/src/quick/scenegraph/shaders/styledtext.vert @@ -12,5 +12,5 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * vCoord; -}
\ No newline at end of file + gl_Position = matrix * floor(vCoord + 0.5); +} diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert index b7a3ecc667..65bdb66814 100644 --- a/src/quick/scenegraph/shaders/styledtext_core.vert +++ b/src/quick/scenegraph/shaders/styledtext_core.vert @@ -14,5 +14,5 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - gl_Position = matrix * vCoord; -}
\ No newline at end of file + gl_Position = matrix * round(vCoord); +} diff --git a/src/quick/scenegraph/shaders/textmask.vert b/src/quick/scenegraph/shaders/textmask.vert index 1f45e9cf71..dd8918839e 100644 --- a/src/quick/scenegraph/shaders/textmask.vert +++ b/src/quick/scenegraph/shaders/textmask.vert @@ -9,5 +9,5 @@ varying highp vec2 sampleCoord; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * vCoord; + gl_Position = matrix * floor(vCoord + 0.5); } diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert index 619248dccb..d145d33195 100644 --- a/src/quick/scenegraph/shaders/textmask_core.vert +++ b/src/quick/scenegraph/shaders/textmask_core.vert @@ -11,5 +11,5 @@ uniform vec2 textureScale; void main() { sampleCoord = tCoord * textureScale; - gl_Position = matrix * vCoord; + gl_Position = matrix * round(vCoord); } |