Andrey Kozlovskiy
6b48fb767d
Fix a typo in gsk_border_node_diff
...
Typo was introduced in !3278 and results in an incorrect handling of different uniformity.
2021-03-17 15:38:01 +00:00
Kjell Ahlstedt
50beae7541
meson: Find libcairo-script-interpreter when cairo is a subproject
...
If cairo is a subproject, it's not necessarily installed when gtk
is built. In the build tree, libcairo-script-interpreter is not stored
in the same directory as other cairo libraries.
2021-03-16 11:47:28 +01:00
Benjamin Otte
1fd534ef1e
ngl: Remove duplicate check
...
We check the extents, so there's no need to check overlap before.
2021-03-15 01:30:34 +01:00
Matthias Clasen
28de2eecc9
ngl: Special-case css backgrounds
...
Recognize a common pattern: A rounded clip with
a color node, followed by a border node, with the
same outline. This is what CSS backgrounds frequently
produce, and we can render it more efficiently with
a combined shader.
2021-03-14 16:49:31 -04:00
Matthias Clasen
ed3f0012b1
ngl: Don't bother with uniform border nodes
...
Now that colors aren't uniforms anymore, we don't
win much by using the inset_shadow shader. The fragment
shaders of inset_shadow and border are identical. And
the regular border setup does nine-slicing.
2021-03-14 16:49:31 -04:00
Matthias Clasen
51074ca5df
ngl: Small shader improvements
...
Add a variant of gskSetOutputColor that saves a
few multiplications, and use it where possible.
2021-03-14 16:49:31 -04:00
Matthias Clasen
8aac574d63
ngl: Improve the coloring shader
...
Since we are now passing a float anyway, we can avoid
the branch in the fragment shader.
2021-03-14 16:49:31 -04:00
Matthias Clasen
c1f98d6837
ngl: Improve the gradient shaders
...
Use a define for MAX_COLOR_STOPS, and give the loop
a fixed limit.
2021-03-14 16:49:31 -04:00
Matthias Clasen
3f60c39de4
ngl: Rewrite gsk_ngl_render_job_visit_text_node
...
Make this more compact, and thus easier to read.
2021-03-14 16:49:31 -04:00
Matthias Clasen
4aa570ba88
ngl: Drop gsk_ngl_render_job_set_color
...
Colors are not state that we carry across draw ops,
so setting the color on the render job doesn't make
much sense. Instead, pass the color to the various
draw calls. Add a few new ones for that purpose.
Also, shorten the names of some by going from
'load_vertices_from_offscreen' to 'draw_offscreen'.
2021-03-14 16:49:31 -04:00
Matthias Clasen
233969e9e4
ngl: Refactor gsk_ngl_render_job_visit_border_node
...
With color sorting out of the picture, this can
be much simpler.
2021-03-14 16:49:31 -04:00
Matthias Clasen
19e3a6af5d
ngl: Consistently use gsk_scaled_premultiply
...
Its not going to make much of a difference, but we
can just as well be consistent.
2021-03-14 16:49:31 -04:00
Matthias Clasen
29501f5398
ngl: Fix up uniform enums
...
This got messed up when color was changed from
a uniform to an attribute in 06d5c8e72d
.
2021-03-14 16:49:31 -04:00
Emmanuel Gil Peyrot
064947356a
ngl: Fix the coloring shader on GLES 2.0
...
Integer varyings didn’t exist in GLSL ES 1.00, neither did the flat
attribute.
2021-03-13 22:00:54 +00:00
Matthias Clasen
42dfc21b2d
ngl: Fix up some debug printouts
2021-03-12 18:26:15 -05:00
Matthias Clasen
daed57c30e
Merge branch 'wip/chergert/fewer-uniforms' into 'master'
...
ngl: apply fewer uniforms
See merge request GNOME/gtk!3289
2021-03-12 22:55:00 +00:00
Matthias Clasen
ebe30d851b
ngl: Identify shaders
...
Add a comment with a name to each shader. That makes
identifying the shaders in apitrace much easier.
2021-03-12 15:35:40 -05:00
Christian Hergert
f97ce21e59
ngl: reintroduce comparison checks
...
This reduces how many changes we make when recording uniform state, which
increases the chances that the data offset will be the same when applying
uniforms.
2021-03-12 11:47:15 -08:00
Christian Hergert
0b7d8e19c3
ngl: add front cache to reduce uniform changes
...
Since we make full snapshots when recording uniform state of batches, we
need to perform some deduplication to avoid so many repeated uniform calls.
This uses a closed hashtable to determine if we are likely changing the
value to something new.
This does not currently compare values, it instead only compares that we
are going to point at a new offset into the uniform buffer. We could go
further if we compare upon updating values (we did that early on in the
prototype) so that offsets are less likely to be changed.
2021-03-12 11:22:59 -08:00
Matthias Clasen
6a30c6b01c
ngl: Make the coloring shader more versatile
...
When the color passed is transparent black, use
the color from the texture as source, instead of
as mask. This lets use use the coloring program
both for regular and color glyphs, avoiding
program changes in text with Emoji.
2021-03-12 13:19:37 -05:00
Matthias Clasen
06d5c8e72d
ngl: Set color as vertex attribute
...
Instead of using uniforms for color used in multiple
programs, pass it as vertex attributes. This will let
us batch more draw calls, since we don't have to change
uniforms so often. In particular, for syntax-highlighted
text.
2021-03-12 13:18:47 -05:00
Matthias Clasen
3252f1e301
gsk: Give ngl its own shader sources
...
We may want to change the interface between the
shaders and the renderer for ngl, and therefore,
sharing the shaders between gl and ngl will not
be practical, going forward.
2021-03-12 13:18:47 -05:00
Matthias Clasen
7450427757
gsktransform: Convert docs
2021-03-11 16:37:32 +00:00
Matthias Clasen
b836707979
gskroundedrect: Convert docs
2021-03-11 16:37:32 +00:00
Matthias Clasen
70f805cdfe
rendernode: Add property annotations
...
Connect properties, getters, and setters with annotations
2021-03-11 16:37:32 +00:00
Matthias Clasen
458bc5500c
gskrenderer: Add property annotations
...
Connect properties, getters, and setters with annotations
2021-03-11 16:37:32 +00:00
Matthias Clasen
22b375534e
glshader: Add property annotations
...
Connect properties, getters, and setters with annotations
2021-03-11 16:37:32 +00:00
Matthias Clasen
ca3120919f
docs: Improve gsk docs
...
Convert link formats, add summaries, and make
a few missing things show up in the docs.
2021-03-11 16:37:31 +00:00
Benjamin Otte
c696385130
Merge branch 'wip/otte/for-master' into 'master'
...
Wip/otte/for master
See merge request GNOME/gtk!3279
2021-03-09 19:11:09 +00:00
Matthias Clasen
124f60593b
nodeparser: Print debug message before child
...
This puts the message up top, where it can be seen,
and not at the other end of an endless tree of children.
Update tests to match.
2021-03-09 12:15:25 -05:00
Matthias Clasen
09af40faeb
ngl: Render simple borders simply
...
Use 4 color commands for uniform, rectilinear
borders. Most of our borders are rounded with
Adwaita, but there are still some of these.
2021-03-09 12:15:25 -05:00
Matthias Clasen
bf59ddd01d
gsk: Add gsk_border_node_get_uniform_color
...
Maintain this bit of information separately,
it will be useful in the next commit.
2021-03-09 12:15:25 -05:00
Benjamin Otte
fea67dea6a
vulkan: Improve rounded rect clipping
...
Handle the case where the inner rounded rect is fully contained
within the outer rounded rect.
2021-03-09 17:43:28 +01:00
Benjamin Otte
9f18c138d1
vulkan: Fix invalid read
...
Look at the right rect to compute circularness
2021-03-09 17:43:28 +01:00
Matthias Clasen
07ca46e92c
Merge branch 'ngl-clip-classification' into 'master'
...
Ngl clip classification
See merge request GNOME/gtk!3274
2021-03-08 20:20:50 +00:00
Matthias Clasen
57e354c297
glsl: Make rounded rect clipping cheaper
...
Add early acceptance checks for non-corner cases.
2021-03-08 14:41:48 -05:00
Matthias Clasen
5f664dbbbb
Revert "ngl: Remove a few redundant checks"
...
This reverts commit 4375f8e382
.
These were not redundant after all, as pointed out by Timm.
2021-03-08 08:10:35 -05:00
Matthias Clasen
46d1fc1c24
gsk: Use clip defines in shaders
...
Use the NO_CLIP and RECT_CLIP defines to make
simpler shaders for these cases.
Note: This does not work yet.
2021-03-07 20:30:45 -05:00
Matthias Clasen
2c05b758c7
ngl: Add infrastructure for clip-variants of shaders
...
Make ngl compile each shader three times.
Once with #define NO_CLIP 1
once with #define RECT_CLIP 1
and once as before.
2021-03-07 20:30:45 -05:00
Matthias Clasen
5788338a14
ngl: Classify clips
...
Maintain the 'fully contained' information in the clip
stack. This will let us pick simpler shaders in the future.
2021-03-07 20:30:45 -05:00
Matthias Clasen
c60a316e22
Move gtk_rounded_rect_scale_affine to the right place
...
This function should live with the rest of the
GskRoundedRect code in gskroundedrect.c.
2021-03-07 15:17:32 -05:00
Matthias Clasen
87b800c11d
Merge branch 'bilelmoussaoui/gi-annotations' into 'master'
...
g-i: add missing since annotations for 4.2
See merge request GNOME/gtk!3268
2021-03-07 19:46:59 +00:00
Bilal Elmoussaoui
6e903e13a5
g-i: add missing since annotations for 4.2
2021-03-07 19:50:32 +01:00
Matthias Clasen
d0dce4cfa1
ngl: Treat radial gradients like others
...
Handle colorstop overflow for radial gradients
the same way we do for linear and conic gradients.
2021-03-07 10:18:47 -05:00
Matthias Clasen
4375f8e382
ngl: Remove a few redundant checks
...
We bail early on invisible nodes. No need to
repeat that check in individual visit functions.
2021-03-07 10:18:47 -05:00
Matthias Clasen
6ab779cd06
roundedrect: Remove unclear language from the docs
...
The various intersection function for rounded rects are
precise. No need to add wordy disclaimers about the handling
of the corners.
2021-03-07 09:04:43 -05:00
Benjamin Otte
91932ada63
vulkan: Handle simple transforms in the clipping code
...
Requires pushing the GskTransform into the clipping code so that we
can actually look at its category.
2021-03-05 19:36:36 -05:00
Matthias Clasen
dbb264dfc9
vulkan: Add visible fallback rendering
...
Hook up the "Show fallback rendering" switch for Vulkan.
This brings home the sobering truth that the Vulkan renderer
is doing *all* fallback, since we switched from offset nodes
to transform nodes.
2021-03-05 18:42:04 -05:00
Christian Hergert
b368d3abde
ngl: remove unnecessary suffix array
...
We didn't end up using this in the final version, so we can just delete
it and avoid MSVC issues.
2021-03-03 13:03:24 -08:00
Matthias Clasen
96ac85038b
rendernode: Fix glyph serialization
...
We serializing to a string of ASCII, we need to
escape some chars, such as '\' and '"'.
Fixes : #3710
2021-03-02 11:32:29 -05:00