Commit Graph

1376 Commits

Author SHA1 Message Date
Benjamin Otte
3078b180fe Replace "gdouble" with "double" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Christian Hergert
9dbf99d91a macos: prototype new GDK backend for macOS
This is fairly substantial rewrite of the GDK backend for quartz and
renamed to macOS to allow for a greenfield implementation.

Many things have come across from the quartz implementation fairly
intact such as the eventloop integration design and discovery of
event windows from the NSEvent.

However much has been changed to fit in with the new GDK design and
how removal of child GdkWindow have been completely eliminated.
Furthermore, the new GdkPopup allows for regular NSWindow to be used
to provide popovers unlike the previous implementation.

The object design more closely follows the ideal for a GDK backend.

Views have been broken out into subclasses so that we can support
multiple GSK renderer paths such as GL and Cairo (and Metal in the
future). However mixed mode GL and Cairo will not be supported. Currently
only the Cairo renderer has been implemented.

A new frame clock implementation using CVDisplayLink provides more
accurate information about when to draw drawing the next frame. Some
testing will need to be done here to understand the power implications
of this.

This implementation has also gained edge snapping for CSD windows. Some
work was also done to ensure that CSD windows have opaque regions
registered with the display server.

     ** This is still very much a work-in-progress **

Some outstanding work that needs to be done:

 - Finish a GL context for macOS and alternate NSView for GL rendering
   (possibly using speciailized CALayer for OpenGL).
 - Input rework to ensure that we don't loose remapping of keys that was
   dropped from GDK during GTK 4 development.
 - Make sure input methods continue to work.
 - Drag-n-Drop is still very much a work in progress
 - High resolution input scrolling needs various work in GDK to land
   first before we can plumb that to NSEvent.
 - gtk/ has a number of things based on GDK_WINDOWING_QUARTZ that need
   to be updated to use the macOS backend.

But this is good enough to start playing with and breaking things which
is what I'd like to see.
2020-07-21 14:45:12 -07:00
Matthias Clasen
5df1356295 gsk: Remove an unused debug flag
GSK_DEBUG_DIFF was not used anywhere, so remove it.
2020-07-20 07:03:08 -04:00
Timm Bäder
37d7ab88dc gl renderer: Avoid 9-slicing things that can't be
The outline needs to be large enough so changing the size of the outline
does not affect the resulting blurred texture.

Fixes #2776
2020-07-17 05:49:11 +02:00
Timm Bäder
6cde64072d gl renderer: Remove outdated comment 2020-07-17 05:49:11 +02:00
Timm Bäder
6a60b0f591 gl renderer: Try to intersect rounded clips more often 2020-07-17 05:49:11 +02:00
Timm Bäder
339d9f05e4 gl renderer: Remove unused flag 2020-07-17 05:49:11 +02:00
Timm Bäder
34008e6aab gl renderer: Ignore rounded clip that only increase the clip
This fixes the widget factory rendering too much.

In the widget-factory, we generally have a pretty small update area (two
spinners and a progressbar). We take the extents of that as a update
area and inital clip.

However, the first clip node we see is from the toplevel window, which
essentially increases the clip again to almost the entire window.

Fix that by ignoring such cases.
2020-07-17 05:49:11 +02:00
Matthias Clasen
13b37b0ba4 gsk: Fix a transform leak
This was found by running our testsuite under asan.
2020-07-08 17:44:08 -04:00
Matthias Clasen
43b9fc6981 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2162
2020-07-01 01:35:56 +00:00
Matthias Clasen
93a51f77c4 gsk: Better help for GSK_DEBUG
Reuse the newly introduced gdk_parse_debug_var for
GSK_DEBUG.
2020-06-28 13:42:02 -04:00
Timm Bäder
4800dd3f95 rendernode: Trivial whitespace change 2020-06-27 11:22:54 +02:00
Timm Bäder
21f9148155 gl renderer: Fix cross-fade nodes with invisible end child
Only loading the vertex data doesn't draw anything.
2020-06-27 10:51:06 +02:00
Timm Bäder
d4f0593b37 gl renderer: Handle 0/1 progress in crossfade nodes 2020-06-27 10:51:06 +02:00
Timm Bäder
da85815399 transform: Fix docs to use "transform" instead of "matrix" 2020-06-19 05:26:25 +02:00
Timm Bäder
5dde4c0a39 transform: Fix equal() docs
This has nothing to do with matrices.
2020-06-19 05:26:25 +02:00
Timm Bäder
0c1cfbbad1 transform: Compare 3d points directly 2020-06-19 05:26:24 +02:00
Timm Bäder
a974c83423 gsktransform: Make next == NULL case explicit
This is handled with the is_identity() check as well but this way it's
much more obvious what's happening
2020-06-19 05:26:24 +02:00
Yuri Chornoivan
c0cf839729 Fix minor typos 2020-06-18 10:47:16 +03:00
Matthias Clasen
3d7c1f8950 gsk: Documentation fixups
Document a few missing symbols.
2020-06-05 20:19:45 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Timm Bäder
d5bf3c2cd1 gl renderer: Improve clipping code
don't render a clip to a texture if the new clip does not intersect with
any of the corners of the currently rounded clip.

Fixes #2770
2020-05-24 15:59:05 +02:00
Timm Bäder
094788f1a3 gl renderer: Refactor render_clipped_child 2020-05-24 15:59:05 +02:00
Timm Bäder
23e68c0988 gl renderer: Cache whether clips is rectilinear 2020-05-24 15:59:05 +02:00
Timm Bäder
930d779eb3 gl renderer: don't pretend all transform nodes support being transformed
It doesn't work in the general case. The transform handling could use a
general overhaul though.

Fixes #2773
2020-05-22 21:29:10 +02:00
Timm Bäder
f3ca814f3d gl renderer: Fix some off-by-one and rounding errors in the shadow code
Take 24

Fixes #2759
2020-05-22 21:29:10 +02:00
Timm Bäder
1aa86d23f4 gl renderer: Fix blurred outset shadow slicing
Take 23.

Fixes #2759
2020-05-21 15:32:12 +02:00
Matthias Clasen
ec2aac5b61 gsk: Document blend modes
Add some information about blend modes, mostly taken
from the css compositing spec.

Fixes: #2739
2020-05-18 18:21:39 -04:00
Timm Bäder
01c0acb707 gl renderer: Apply scaled clip when rendering offscreen clipped child 2020-05-17 15:30:28 +02:00
Timm Bäder
007de568c9 gl renderer: Fix an uninitialized value 2020-05-17 08:07:11 +02:00
Matthias Clasen
a2a3aab94d Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #2601

See merge request GNOME/gtk!1918
2020-05-16 23:35:51 +00:00
Matthias Clasen
5851415fca broadway: Don't create overlarge images
Respect that cairo won't create image surfaces larger
than 32767 x 32767.

This makes the one reftest pass that specifically checks
this condition, treeview-crash-too-wide.
2020-05-16 11:27:21 -04:00
Timm Bäder
b2b2070415 Implement diff() for color matrix nodes
This way we don't redraw color matrix nodes all the time.
2020-05-16 08:22:55 +02:00
Timm Bäder
b9ed957af3 gl renderer: Fix nested rounded clip rendering
If the inner clip intersects with the corners of the outer clip, we
potentially need a texture. We should add more fine-grained checks for
this in the future though.

Test case included.
2020-05-13 08:07:55 +02:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Timm Bäder
52ae384bfd gl shaders: unify frag coord handling 2020-05-10 09:30:15 +02:00
Timm Bäder
b98ad549c2 gl renderer: Only destroy shader programs with ids > 0
We may return -1 as an error return value.
2020-05-10 09:30:15 +02:00
Matthias Clasen
d83df5a928 gsk: Fix a typo
We were checking x_offset twice, when we meant to check
x_offset and y_offset. Pointed out by Rafał Mikrut.

Fixes: #2726
2020-05-09 19:40:06 -04:00
Corentin Noël
7df572d308 gsk: Add GskTransform autocleanup definition 2020-05-08 09:14:55 +02:00
Matthias Clasen
79e1c66657 gsk: Don't autoinclude backend-specific headers
Don't install headers for code that we don't build.
And don't include those headers in gsk.h.

Just as we do in gdk, require applications to include
the backend-specific headers they need explicitly.

Update the one affected demo, gtk4-node-editor.
2020-04-24 21:40:30 -04:00
Matthias Clasen
c920796967 gsk: Fall back to cairo if compiling shaders fails
There was already some fallback in place here, but
in other places we were just asserting.
2020-04-17 13:42:33 -04:00
Emmanuele Bassi
20d0d6fae2 Revert "Do not install GSK headers for missing backends"
This reverts commit cd5cded430.

The headers are public, but the symbols availability is conditional on
the GTK build.
2020-04-11 15:41:47 +01:00
Emmanuele Bassi
3f0a830f3c Properly annotate the render node constructors
Now that the GskRenderNode subclasses are recognised as proper
sub-types, we can annotate the constructors with their type. The C API
remains the same.
2020-04-08 16:17:08 +01:00
Emmanuele Bassi
e0323fcdc2 Add get_type() functions for GskRenderNode subclasses
The introspection scanner tries to match a type name with a get_type()
function, in order to correctly identify a type as a class.

If the function is not available, we have two choices:

 - add some special case inside the introspection scanner, similar to
   how GParamSpec subclasses are handled in GObject
 - add a simple get_type() function

The latter is the simplest approach, and we don't need to change that
much, since we still register all render nodes at once.
2020-04-08 16:07:04 +01:00
Emmanuele Bassi
cd5cded430 Do not install GSK headers for missing backends
Broadway and Vulkan renderers are optional; if GTK hasn't been built
with their GSK renderers, we should not install their headers.
2020-04-08 15:41:21 +01:00
Emmanuele Bassi
d701a89281 Turn GskRenderNode into a derivable type
Language bindings—especially ones based on introspection—cannot deal
with custom type hiearchies. Luckily for us, GType has a derivable type
with low overhead: GTypeInstance.

By turning GskRenderNode into a GTypeInstance, and creating derived
types for each class of node, we can provide an introspectable API to
our non-C API consumers, with no functional change to the C API itself.
2020-04-08 15:40:15 +01:00
Nirbheek Chauhan
777435c470 meson: Reduce useless relinking on reconfigure
When we reconfigure, `configure_file()` is called again, and
`*.gresource.xml` files are regenerated, which causes many (all?)
binaries to be relinked. Now we only write those out if the contents
actually changed (or if the output didn't already exist).

This is exactly what Meson already does with `configure_file()` when
`command:` is not used.

While we're at it, also do the same for `gen-c-array.py` and
`gentypefuncs.py` for completeness. Now even if the input to those
changes, re-building of those custom targets may not result in
relinking if the outputted C files have the same contents.
2020-04-03 18:41:55 +05:30
Matthias Clasen
68e1c8d3e9 gsk: Don't unconditionally spew to stdout 2020-03-20 10:43:25 -04:00
Alexander Larsson
086a577fd1 broadway: Handle browser hidpi scale factor 2020-03-13 14:59:37 +01:00
Benjamin Otte
e356d59a92 build: Add -Wnull-dereference
Sprinkle various g_assert() around the code where gcc cannot figure out
on its own that a variable is not NULL and too much refactoring would be
needed to make it do that.

Also fix usage of g_assert_nonnull(x) to use g_assert(x) because the
first is not marked as G_GNUC_NORETURN because of course GTester
supports not aborting on aborts.
2020-03-05 08:14:37 +01:00
Benjamin Otte
7597f6b594 transform: Don't crash for gsk_transform_transform (id, id)
See attached tests
2020-02-21 18:30:13 +01:00
Benjamin Otte
b50093d044 transform: Make sure the identity transform is equal to NULL 2020-02-21 18:25:05 +01:00
Benjamin Otte
41ef6e9fa5 transform: Add optimization for common case
Transforming identity by an other transform does not mean we need to
painstakingly apply the individual steps of other to construct a new
transform, it means we can just return other.

Or in math terms:
  I * B = B
so just return B.
2020-02-21 18:19:16 +01:00
David Hogan
0969d06925 Fix detection of OpenGL 3.3 core GL_ARB_timer_query.
Some systems (notably macOS) will not allow enumeration of an extension that has been promoted to core OpenGL for context in use. This change assumes that GL_ARB_timer_query is available on OpenGL 3.3+.

I could not find definitive information on whether GL_ARB_debug_output or GL_KHR_debug have been added to core. Other extensions in use were addressed by https://gitlab.gnome.org/GNOME/gtk/merge_requests/1422 .
2020-02-14 05:41:01 +11:00
Matthias Clasen
a66ed7c461 gsk: Fix the compiler warning differently 2020-02-13 10:42:21 -05:00
Benjamin Otte
8f6cab6560 cairoblur: Get rid of gdk_cairo_get_clip_rectangle() call
It's about to be removed.
2020-02-13 07:36:38 +01:00
Benjamin Otte
6203cecf97 gsk: Clip shadow node before push_group()
We want to be sure to push a group that's as small as possible, so we
clip to the child's bounds, because that's the smallest we can go.
2020-02-13 07:36:38 +01:00
Benjamin Otte
6f9f18009c gsk: Add a utility function for rectangles
... and use it.
2020-02-13 07:36:38 +01:00
Benjamin Otte
67610b1242 cairoblur: Move the check for early exit
That means we only have one place where we check all kinds of early
exits.
2020-02-13 07:36:38 +01:00
Benjamin Otte
f0993fc881 rendernode: Avoid rounding errors
Compute the pattern matrix directly instead of transforming the cairo_t.

This ensures that when node_size / texture_size is some obscure floating
point value, we don't get rounding issues from scaling by it once we
draw the texture_size rectangle.

I have no actual failure where this comes in handy, but I had written
the code anyway, so decided to keep it.
2020-02-13 07:36:38 +01:00
Benjamin Otte
77d7c713d4 roundedrect: Fix inlining of graphene functions
graphene treats equality for contains() operations as always matching,
so do the same thing.

This is because unlike integer math, floating point cannot do the "as
close as possible to the point, but not reaching it" operation that
integer does by just subtracting 1.
2020-02-13 07:36:38 +01:00
Benjamin Otte
b0369fc300 roundedrect: Fix gsk_rounded_rect_intersects_rect()
The previous code would return FALSE for
  gsk_rounded_rect_intersects_rect (&rounded, &rounded.bounds);
if rounded was indeed rounded.
2020-02-13 07:36:38 +01:00
Matthias Clasen
fb84fe7065 Fix flickery hover
Commit 47c44644b1 was a bit overzealous in fixing
compiler warnings. We still need to call collect_textures,
even if we don't need the number that it returns.
2020-02-12 22:45:24 -05:00
Timm Bäder
52c46e5c24 rendernode: Don't clip when _draw()ing 2020-02-12 16:54:49 +01:00
Timm Bäder
b12a6be9d9 rendernode: draw() only in node bounds
We currently disable when draw()ing nodes using the cairo fallback path,
which means we can't just use cairo_paint(). Use a proper rectangle
instead.

Fixes #2431
2020-02-12 16:54:46 +01:00
Alexander Larsson
2890cd849f profiler: Add _end_mark() version of _add_mark()
These don't take a duration, instead they call g_get_monotonic_time() to
and subtract the start time for it.

Almost all our calls are like this, and this makes the callsites clearer
and avoids inlining the clock call into the call site.
2020-02-12 11:25:34 +01:00
Alexander Larsson
01d5ad2056 profiler: Make profiler-is-running a macro
When we use if (GDK_PROFILER_IS_RUNNING) this means we get an
inlined if (FALSE) when the compiler support is not compiled in, which
gets rid of all the related code completely.

We also expand to  G_UNLIKELY(gdk_profiler_is_running ()) in the supported
case which might cause somewhat better code generation.
2020-02-12 11:05:01 +01:00
Alexander Larsson
cc643df88b Convert all profiler times from nsec to usec
usec is the scale of the monotonic timer which is where we get almost
all the times from. The only actual source of nsec is the opengl
GPU time (but who knows what the actual resulution of that is).

Changing this to usec allows us to get rid of " * 1000" in a *lot* of
places all over the codebase, which are ugly and confusing.
2020-02-12 10:44:17 +01:00
Emmanuele Bassi
042a5736fa Merge branch 'share-gl-programs' into 'master'
GskGLRenderer: Share programs between different renderers in same display

See merge request GNOME/gtk!1413
2020-02-11 16:30:16 +00:00
Matthias Clasen
720e48ec51 Merge branch 'handle-max-texture-size' into 'master'
gl: Don't require too large texture for offsreen ops

See merge request GNOME/gtk!1411
2020-02-11 16:23:02 +00:00
Matthias Clasen
9d0393d8e6 Merge branch 'fix-angle-normalization' into 'master'
gsk: Fix angle normalization

See merge request GNOME/gtk!1409
2020-02-11 16:17:14 +00:00
Alexander Larsson
7b0b3d9547 GskGLRenderer: Share programs between different renderers in same display
This is similar to how we share texture atlases. Some added complexity
in that the program state also needed to be shared, so it had to move to
the shared Programs object.

With this change realization of additional GskRenderers when opening
popups went from ~60msec to ~35 msec on average.
2020-02-11 16:58:45 +01:00
Emmanuele Bassi
0df542e494 Declare global counters only in debug builds 2020-02-11 14:47:22 +00:00
Emmanuele Bassi
47c44644b1 Silence compiler warnings in non-debug builds 2020-02-11 14:47:22 +00:00
Alexander Larsson
1f0438e7fe gsk: Fix angle normalization
I was getting assertions that normalize_angle() failed the
result < 260 check. Doing some research on this it turns out
to be a precision issue. If the incomming angle is very slightly
below zero, then adding 360 to it may end up with exactly 360.

I simplified the code a bit to avoid division and rounding, because in
practice most angles will be "just outside" the 0-360 degree anyway.
And i also added a workaround for the "result is 360" case by just
setting it to 0.
2020-02-11 13:51:06 +01:00
Alexander Larsson
8fdb710c0f gl: Don't require too large texture for offsreen ops
When rendering ops to an offscreen texture we take max-texture-size
in consideration and modify the scale we use such that the required
texture does not exceed the limit.

This means some rendering will be blocky/fuzzy, but that is better
than it being clipped.
2020-02-11 13:50:35 +01:00
Matthias Clasen
0e15032635 gsk: Small documentation additions 2020-02-08 19:36:25 -05:00
Timm Bäder
8388791f87 GskTransform: Remove useless fmod check
All angles are in the [0; 360[ range
2020-02-07 13:16:32 -05:00
Timm Bäder
cbb05a3eab GskTransform: add assertions to make normalize_angle() intentions clear
360deg should be expressed as 0deg and no angle should ever be
negative.
2020-02-07 13:16:32 -05:00
Timm Bäder
75ef8d8a50 GskRoundedRect: Inline graphene_rect_contains_rect
Brings gsk_rounded_rect_contains_rect down from 0.54% to 0.14% when
rendering rounded backgrounds.
2020-02-07 13:16:32 -05:00
Benjamin Otte
7e8d8218b9 Revert "Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()"
We're not in the business of adding Cairo APIs. That's Cairo's job.

Also, we don't need this API anywhere like the original commit claimed,
so there's no need to make it available in any way.

This reverts commit afa6cc2369.
2020-02-04 16:43:59 +01:00
Alexander Larsson
afa6cc2369 Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()
This is useful in some parts of the icon theme APIs.
2020-01-29 19:06:16 +01:00
Timm Bäder
05b9a99661 gsk: Remove some unused defines
These are from the GVariant days of render nodes.
2020-01-26 18:21:07 +01:00
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Timm Bäder
f62535affc gl renderer: Avoid some work when rendering border nodes 2020-01-26 18:21:07 +01:00
Matthias Clasen
a297129685 Add a profiler mark around renderer realization
This takes time that is worth calling out.
2020-01-25 01:28:24 -05:00
Timm Bäder
f80a341b4f gl renderer: handle cross-fade nodes with invisible children 2020-01-24 06:19:16 +01:00
Timm Bäder
77f8245c0c gl renderer: Handle blur nodes with invisible children 2020-01-24 06:19:16 +01:00
Timm Bäder
8afdbd6ee3 gl renderer: Make render_rounded_clip_node clearer 2020-01-24 06:19:16 +01:00
Timm Bäder
ab0869ecbc gl renderer: Add builder offset correctly for non-affine modelviews 2020-01-24 06:19:16 +01:00
Timm Bäder
cff8304133 GskTransform: Add gsk_transform_transform_point()
Equivalent of gsk_transform_transform_bounds() and
graphene_matrix_transform_point() respectively.
2020-01-24 06:19:12 +01:00
Timm Bäder
962e38c5c9 gl renderer: Shorten shaders a bit 2020-01-24 06:08:39 +01:00
Timm Bäder
685288216f gl renderer: Move rect transformation to the vertex shader
No need to do this for every fragment.
2020-01-24 06:08:39 +01:00
Timm Bäder
c8fa1f19db gl renderer: Transform rounded rect on the GPU
Change the RoundedRect struct we use in our shaders so we can transform
it using (affine) matrices.
2020-01-24 06:08:39 +01:00
Matthias Clasen
1565f597c8 gl: Disambiguate profiler marks
"render" was used for both GL and widgets. Oops.
2020-01-22 16:37:48 -05:00
Timm Bäder
433c8307b2 gl renderer: Pull a local variable in the closest scope 2020-01-18 08:49:52 +01:00
Timm Bäder
dc8dedce07 gl renderer: Draw outset shadows white
and only apply the actual shadow color when we draw them from the
texture. This way we can reuse the cached shadows during color
transitions.
2020-01-18 08:49:52 +01:00
Timm Bäder
3091679ffa gl renderer: Render simple border nodes in a simple way
Roughly 80% of the border nodes are just one color and have the same
width on all sides, so we can draw them by uploading just one rect and
not four.
2020-01-18 08:49:52 +01:00
Timm Bäder
afa991752c gl renderer: Look at shadow color in the outset shadow cache
It would probably be better to not do this and always render the outline
in plain white, then later recolor it but do this for no, just for
correctness.
2020-01-18 08:49:51 +01:00
Chun-wei Fan
a9b1d4a389 build: Check for sincosf()
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.
2020-01-08 17:15:29 +08:00
Timm Bäder
ea810f176b gl renderer: Handle repeat nodes with invisible children
We can handle this pretty easily by normally drawing the other
(visible) child node, if any.
2020-01-07 17:27:19 +01:00
Timm Bäder
7669e6e42e transform: Properly compare scale transforms
If the epsilon we use there is too much, we can run into rendering
errors because the GPU will use the actual scale value.
2020-01-07 17:27:19 +01:00
Timm Bäder
6ba6f361be gltextureatlas: Packing must succeed here 2020-01-07 17:27:18 +01:00
Timm Bäder
7a27122dab transform: Scale+translate bounds directyl
Make these two code paths look the same.
2020-01-07 17:27:18 +01:00
Timm Bäder
ca4ae81170 transform: Compare class before ->next 2020-01-07 17:27:18 +01:00
Timm Bäder
76795ffba9 gl renderer: Sprinkle some const around 2020-01-07 17:27:18 +01:00
Timm Bäder
eebe67cf0a gl renderer: Add util to load vertex data with texture region 2020-01-07 17:27:18 +01:00
Timm Bäder
b9726901a5 gl renderer: Fix inverted dy in inset shadows 2020-01-07 17:27:17 +01:00
Timm Bäder
8b1af398a0 gl renderer: Avoid another manual rounded rect transform
We have transform_rect() for this now.
2020-01-07 17:27:17 +01:00
Timm Bäder
b8d1c3ab55 gl renderer: Don't force repeat node child offscreen 2020-01-07 17:27:17 +01:00
Timm Bäder
054d69aaf9 gl renderer: Fix a misleading comment 2020-01-07 17:27:17 +01:00
Timm Bäder
1dea6d4fc7 gl renderer: Speed up bounds transformation
We started saving the scale of the current modelview directly in the
RenderOpBuilder, so we don't need to poke the modelview stack anymore.
2020-01-07 17:27:17 +01:00
Timm Bäder
022d19a4c6 gl renderer: Add debug code for color nodes 2020-01-07 17:27:17 +01:00
Timm Bäder
ef7276c398 gl renderer: Trivial variable reordering 2020-01-07 17:27:17 +01:00
Timm Bäder
0a8ca49b5e gl renderer: transform border outline like everything else 2020-01-07 17:27:17 +01:00
Timm Bäder
74f18f71d3 gl renderer: Move work to the blur vertex shader 2020-01-07 17:27:17 +01:00
Timm Bäder
c0d4a6fc81 gl renderer: Avoid copying a matrix 2020-01-07 17:27:17 +01:00
Timm Bäder
766d4dff76 GskTransform: Compute sin/deg of 90deg rotations manually
Otherwise we might end up with inaccuracies, e.g. when
gsk_transform_transform_bounds()'ing bounds.
2020-01-07 17:27:17 +01:00
Timm Bäder
e62f135c6a GskTransform: Normalize angles
Make sure all angles are in the [0..365) range
2020-01-07 17:27:17 +01:00
Timm Bäder
587bc82c37 gl renderer: Print debug node message 2020-01-07 17:27:17 +01:00
Timm Bäder
750dc8dbe2 gl driver: Inline function into only caller 2020-01-07 17:27:17 +01:00
Timm Bäder
cb2f523994 rendernodes: Use floats for everything 2020-01-07 17:27:16 +01:00
Timm Bäder
db91b6dc61 gl renderer: Load vertex data directly into vertices GArray 2020-01-07 17:27:16 +01:00
Timm Bäder
44ac2d5abb gl renderer: Pass linear gradient stops to shaders directly
No need to copy them into the render ops like this.
2020-01-07 17:27:16 +01:00
Timm Bäder
d7df56b6cb gsk: Make GskColorStop.offset a float
Doesn't make sense for this to be double if everything else is float.
Also makes it possible to 'easily' pass this to the GPU.
2020-01-07 17:27:16 +01:00
Timm Bäder
b8aa51d522 gl renderer: Move more work to the vertex shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
f79c807645 gl renderer: Don't invert offset value twice 2020-01-07 17:27:16 +01:00
Timm Bäder
d0d2ad9f5b gl renderer: Remove unused variable from shader 2020-01-07 17:27:16 +01:00
Timm Bäder
0b8298038a gl renderer: Move color computation to vertex shader 2020-01-07 17:27:16 +01:00
Timm Bäder
6ef0bb8bea gl renderer: Move final color computation to vertex shader
.. of the coloring program, which is used all the time for text.
2020-01-07 17:27:16 +01:00
Timm Bäder
91472b2ecd gl renderer: Compute final color in vertex shader
This is a very often used shader. No need to to do this for every
fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
73f2167fe4 gl renderer: Avoid an invalid read
We need to copy the color here, since the program state can live across
frame boundaries.
2020-01-07 17:27:16 +01:00
Timm Bäder
2079c898e7 gl renderer: Remove some unneeded calculations from shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
c79c18f39c gl renderer: Shuffle things around a bit 2020-01-07 17:27:16 +01:00
Timm Bäder
cef7f7f87d gl renderer: Move work to the gradient vertex shader
No need to do this stuff once per fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
fdce30d3f8 gl renderer: Add some in/out compat glue to the shaders
so we can use _IN_ and _OUT_ and get the right things for
desktop/es/legacy GL.
2020-01-07 17:27:16 +01:00
Timm Bäder
f07397f4dd gl renderer: Upload GL_RGBA texture data in GLES
Colored icons are still broken this way, but at least they show up and
text works.
2020-01-07 17:27:16 +01:00
Timm Bäder
f1751f514c gltextureatlas: Use more correct debug name for texture
These aren't all glyph atlases anymore.
2020-01-07 17:27:16 +01:00
Timm Bäder
8dd7f5aefe gl renderer: Mark beginning of frame if DEBUG_OPS is set 2020-01-07 17:27:16 +01:00
Timm Bäder
398f49ad31 gl renderer: Trivial declaration reorder 2020-01-07 17:27:16 +01:00
Timm Bäder
3d260a950e gl renderer: Remove a few outdated comments 2020-01-07 17:27:16 +01:00
Timm Bäder
f31667f437 gl renderer: Remove unused translation handling 2020-01-07 17:27:15 +01:00
Timm Bäder
219493c818 gl renderer: Don't copy matrix/offset of color matrix nodes into ops 2020-01-07 17:27:15 +01:00
Timm Bäder
06f63764fb gl renderer: Initialize alpha uniform to 1.0
This makes gl-legacy work and gl-gles work except for text and icons.
2020-01-07 17:27:15 +01:00
Timm Bäder
1243174e53 gl renderer: Make RoundedRect work in gles
Which can't return struct types containing arrays. So let's revert to
the previous version but still send the rect along as a vec4[3];
2020-01-07 17:27:15 +01:00
Timm Bäder
cc909b160f gl renderer: Rewrite shader builder
Use a unified approach to write both vertex and fragment shader in the
same file.
2020-01-07 17:27:15 +01:00
Timm Bäder
d12dde07c3 gl renderer: Fix program uniform updating code
This breaks the initial uniform value, but we will fix that in a later
commit in a different way.
2020-01-07 17:27:15 +01:00
Timm Bäder
5191b6fccd gl renderer: Only send clip corners if we need to
We change the clip bounds a lot more ofthen than the clip corners and
they are already split up in the shader, so only send the corners if we
need to.
2020-01-07 17:27:15 +01:00
Timm Bäder
2e6e6c1779 gl renderer: Fix color comparison 2020-01-07 17:27:15 +01:00
Timm Bäder
a29b8fbef4 gl renderer: Shorten debug output impl
This will leak a string but WHATEVER.
2020-01-07 17:27:15 +01:00
Timm Bäder
5b072e716c gl renderer: Fix debug color output 2020-01-07 17:27:15 +01:00
Timm Bäder
49845795d9 gl renderer: Rewort passing rounded rects to shaders 2020-01-07 17:27:15 +01:00
Timm Bäder
ab04c74ec9 gl renderer: Don't copy border outline corner sizes around
We already offset + scale the outline and its corners, just pass those
directly to the shader.
2020-01-07 17:27:15 +01:00
Timm Bäder
4744bb9099 gl renderer: stop copying current color around
Just use a pointer now.
2020-01-07 17:27:15 +01:00
Timm Bäder
91522dda63 gl renderer: remove a memory leak 2020-01-07 17:27:15 +01:00
Timm Bäder
f85448ffbf gl renderer: Split blurring a node into its own function 2020-01-07 17:27:15 +01:00
Timm Bäder
d3852ca33a gl renderer: Remove some unused uniforms 2020-01-07 17:27:15 +01:00
Timm Bäder
9d9a730659 gl renderer: Drop a dead if statement
We already handle this earlier.
2020-01-07 17:27:15 +01:00
Timm Bäder
d868b23c76 gl renderer: Implement blurred inset shadow nodes
And with this...

Fixes #1101
2019-12-03 08:40:35 +01:00
Timm Bäder
56b456ff21 gl renderer: Remove unused uniform from inset shadow shader 2019-12-03 08:40:35 +01:00
Timm Bäder
b91913d10d opbuffer: Remove unused op member 2019-12-03 08:40:35 +01:00
Timm Bäder
1854f3f49c gl renderer: Cache current scale in RenderOpBuilder
We call ops_get_scale a lot, so this should be better. It will also make
a later x/y split for the scaling easier.
2019-12-03 08:40:34 +01:00
Timm Bäder
ca66e9788c gl renderer: Save one level of indentation 2019-12-03 08:40:34 +01:00
Timm Bäder
fb5dc73841 gl renderer: Implement blurred shadow nodes 2019-12-03 08:40:34 +01:00
Timm Bäder
8d61d9f627 gl renderer: Take a TextureRegion in blur_texture
So we can refer to textures on a texture atlas.
2019-12-03 08:40:34 +01:00
Timm Bäder
22b6085c32 gl renderer: Scale blur radius
We scale the texture size, so as a consequence we have to scale the blur
radius.
2019-12-03 08:40:34 +01:00
Timm Bäder
2deb1a05a0 gl renderer: Add some often needed debug code 2019-12-03 08:40:34 +01:00
Timm Bäder
8ca46169b1 gl renderer: Blur shader improvements
Use a two-pass blur shader, fix a few other things and unify the
blurring of blur nodes and blurred outset shadow nodes.

Related to #1283
2019-12-03 08:40:34 +01:00
Timm Bäder
982890515d gl renderer: Don't use g_assert() for code that should always run
g_assert can be compiled out.
2019-11-27 16:56:47 +01:00
Timm Bäder
1817025f46 gl renderer: Don't save repeat nodes to disk
This is just debuggin code someone forgot.
2019-11-27 16:47:14 +01:00
Emmanuele Bassi
def700739d Use a single compilation symbol
We use a compilation symbol in our build to allow the inclusion of
specific headers while building GTK, to avoid the need to include only
the global header.

Each namespace has its own compilation symbol because we used to have
different libraries, and strict symbol visibility between libraries;
now that we have a single library, and we can use private symbols across
namespaces while building GTK, we should have a single compilation
symbol, and simplify the build rules.
2019-11-27 13:33:43 +00:00
Timm Bäder
8f6de1f955 gl renderer: Load flipped-y offscreen vertex data directly
Instead of loading the unflipped version first and then flipping it.
Don't do it in add_render_ops either but only in the function actually
adding the render ops for the nodes, since those frequently have
early-out conditions that don't need the vertex data at all.
2019-11-26 09:09:25 +01:00
Timm Bäder
1c2661ed12 gl renderer: Fix repeat node shader once again 2019-11-26 09:09:25 +01:00
Timm Bäder
91f7ac2d58 gl renderer: Care more about 0×0 offscreen nodes
These never result in a rendering of course, but we must make sure not
to create a 0×0 texture for them, since that will cause problems later
on.
2019-11-26 09:09:25 +01:00
Timm Bäder
053360df85 gl renderer: Remove unused function 2019-11-19 11:06:08 +01:00
Timm Bäder
600ce68210 gl renderer: Add a short cut for repeat nodes that don't repeat
These happen and we don't even need to draw the child to a texture.
2019-11-19 10:45:02 +01:00
Timm Bäder
604f44da11 gl renderer: Fix repeat nodes that don't repeat
Fixes #2234
2019-11-19 10:31:21 +01:00
Timm Bäder
ecc40cf115 rendernodeparser: Only report a GError* if we have one 2019-11-19 09:37:26 +01:00
Timm Bäder
3d7817154c rendernodeparser: Handle resolving NULL urls 2019-11-19 09:37:03 +01:00
Matthias Clasen
8ccf2a722a gsk: Stop using deprecated pango api
Shape engines are not used anymore.
2019-11-01 13:01:54 -04:00
Matthias Clasen
d4c97ea2b4 gl: Use the fallback debug flag
This debug flag was unused; use it to enable
fallback highlighting at runtime.
2019-10-30 22:31:47 -04:00
Matthias Clasen
5b508ea94a Revert "gl: Speed up icon cache lookups"
This reverts commit dd5ee87b5b.
2019-10-22 07:16:41 -04:00
Matthias Clasen
472d8eebbe gl: Avoid pointless iteration 2019-10-22 07:16:41 -04:00
Matthias Clasen
dd316c8051 gl: Add some comments 2019-10-22 07:16:41 -04:00
Matthias Clasen
1038bc781a Revert "Cache glyph textures in render nodes"
This reverts commit c5af463843.
2019-10-22 07:16:41 -04:00
Matthias Clasen
d3431f569c Revert "inspector: Fix node recording"
This reverts commit ba7649b388.
2019-10-22 01:32:51 -04:00
Matthias Clasen
ba7649b388 inspector: Fix node recording
When attaching renderer-specific data, we need to
make sure that we key it off the renderer that is
in use, and cope with the absence of render data.

This fixes recording nodes in the inspector.
2019-10-18 09:33:45 -05:00
Matthias Clasen
fdbb925654 gl: Remove an unimplemented profiler counter 2019-10-17 07:59:34 -05:00
Matthias Clasen
aeabe3c40e gl: Add debug spew to texture atlas 2019-10-17 07:59:34 -05:00
Matthias Clasen
222b6c2b58 glyph cache: Go back to memcmp
Be careful to avoid padding data, and only
compare the relevant parts, leaving out the
hash key.
2019-10-17 07:59:34 -05:00
Matthias Clasen
5ab5ff7677 Cosmetics 2019-10-17 07:59:34 -05:00
Matthias Clasen
6c92b824f3 Merge branch 'wip/chergert/opbuffer' into 'master'
Add OpBuffer helper for building op buffer

See merge request GNOME/gtk!1131
2019-10-17 11:37:07 +00:00
Matthias Clasen
d777300d4e Fix a crash with glyph caching
We need to treat atlas-less cached glyphs like
atlases, when it comes to invalidating text node
render data.
2019-10-15 22:52:28 -04:00
Matthias Clasen
173bb2e1e8 gsk: Fix uninitialized memory
This was causing crashes in some circumstances.
2019-10-15 20:54:24 -04:00
Matthias Clasen
dd5ee87b5b gl: Speed up icon cache lookups
Use gdk_texture_set_render_data to avoid
hash table lookups when we can.
2019-10-15 19:44:26 -04:00
Matthias Clasen
e34d1b8a26 gl: Slightly rework the icon cache api
Return a pointer to the IconData struct. This is
closer to the glyph cache api, and will allow us
to add similar shortcuts. For now, just store
texture coords in the form we need, avoiding
converting them over and over.
2019-10-15 19:44:26 -04:00
Matthias Clasen
c5af463843 Cache glyph textures in render nodes
This is a quick implementation that avoids many
glyph cache lookups. We keep an array of direct
pointers in the text render node, and throw those
cached pointers away whenever any atlases have
been dropped (since that may invalidate the cached
glyphs).
2019-10-15 19:44:26 -04:00
Matthias Clasen
49748c9c23 Some more vertex data reshuffling
In some cases, the vertex data is just a trivial
modification of the default data, so do that instead
of recalculating it.
2019-10-15 19:44:26 -04:00