Commit Graph

822 Commits

Author SHA1 Message Date
Timm Bäder
5907ff694f gl renderer: Render non-trivial transforms to a texture
This way we can e.g. render rotated clips, borders, etc.
2018-11-29 08:50:18 +01:00
Timm Bäder
c0cf592336 gl renderer: Cache offscreen textures per node, not size 2018-11-29 08:50:16 +01:00
Timm Bäder
12378f0afa gl renderer: Expand matrix metadata extraction
Instead of getting the translation x/y everytime we use the modelview,
get it once, when extracting the metadata. Do the same with the scale.
And save if the matrix is "simple" at all, i.e. if it only consists of a
translation and/or scale. This will be helpful later when we start
drawing transformed nodes on textures.
2018-11-29 08:23:42 +01:00
Timm Bäder
5ea211bbb1 Revert "gldriver: Don't create surfaces to upload textures"
This reverts commit 6466e53bfc.

This breaks GtkGLArea.
2018-11-29 07:39:11 +01:00
Timm Bäder
ef751bc809 gl renderer: Use stack to keep track of modelview matrix
So we can avoid calculating metadata for matrices all the time.
2018-11-27 05:39:27 +01:00
Timm Bäder
6466e53bfc gldriver: Don't create surfaces to upload textures 2018-11-27 05:37:38 +01:00
Timm Bäder
5936d7f8f2 gl renderer: Properly retrieve matrix scale
So rotating offscreen nodes works.
2018-11-08 05:13:50 +01:00
Timm Bäder
d15df65a9d gl renderer: Save some matrix multiplications
We do this for every single node, which is a little costly, especially
since the common case for the modelview matrix these days is a simple
translation. So, check whether the new modelview matrix is only a
translation matrix and if so, don't do a full matrix multiplication per
node.
2018-10-11 12:27:56 +02:00
Christian Hergert
87d33470ed vulkan: fix warning from g_clear_pointer() changes 2018-07-28 10:54:14 -07:00
Timm Bäder
392b4d9ac5 gl renderer: Pull a few declarations into the closest scope 2018-07-17 17:33:47 +02:00
Timm Bäder
5386cf89f2 GskRoundedRect: Typo 2018-07-17 17:33:47 +02:00
Timm Bäder
b7d948af69 gl renderer: Use a GArray for the shadow cache
It's very small usually, in default Adwaita the only blurred outset
shadow we have is the one for the CSD'd toplevel window.
2018-07-17 17:33:46 +02:00
Elias Aebi
19873e549a gl: implement clipping for legacy contexts 2018-07-14 14:31:50 +02:00
Elias Aebi
05ca6bc189 gl: fix compilation errors for legacy context shaders 2018-07-14 14:24:21 +02:00
Benjamin Otte
3ce3867403 gl: Don't accidentally use ints for float variables
The int was floor()ing the x/y coordinates of glyphs, which could cause
significant repositioning of glyphs when text was scaled via the MVP.
2018-07-13 14:56:04 +02:00
Timm Bäder
3dd188fe7e gl renderer: Cache blurred outset shadow nodes
Since these are particularly expensive to render and we have a pretty
big one used in every client-side decorated window.
2018-07-08 21:50:59 +02:00
Timm Bäder
a0b8e32462 rendernodes: Fix unconditionally impossible diffs
Some of the _diff implementations did a whole bunch of work just to
throw it away afterwards and invalidate the entire union of the two
render nodes, most notably the two clip nodes. Fix this to only call
gsk_render_node_diff_impossible if the previous if-condition is FALSE
and not always.
2018-07-08 21:50:59 +02:00
Timm Bäder
50f76eb8cc GskRenderer: Add missing nullable annotation 2018-07-08 21:50:59 +02:00
Benjamin Otte
9fb3b84253 rendernode: Make offset nodes use floats
It's OpenGL stuff, use floats.
2018-07-04 15:05:37 +02:00
Timm Bäder
165dab8265 gl renderer: Ignore 0-sized fallback nodes 2018-06-26 21:41:29 +02:00
Matthias Clasen
8755d884f3 Remove a lot of Since annotations
4.0 will represent a clean epoch. We don't want to have
lots of noise in the docs about 2.x or 3.x.
2018-06-25 19:55:04 -04:00
Benjamin Otte
c48be6ef96 Revert "Add aligned allocator functions to GSK"
This reverts commit 8e74eb382f.

This code is not necessary. It worked around a bug in graphene where
graphene was requiring stricter alignment than glib allocators could
guarantee.
2018-06-19 20:00:53 +02:00
Benjamin Otte
0b1f0984f5 Revert "Use aligned allocators for GtkSnapshot"
This reverts commit c02bc22cc5.

This code is not necessary.
The bug causing this problem ws prsent in the graphene library.
2018-06-19 19:52:52 +02:00
Timm Bäder
7f8106f2a9 gl renderer: call glViewport directly 2018-06-16 10:09:12 +02:00
Matthias Clasen
4f632296a5 Merge branch 'lrn/gtk4warnings' into 'master'
Fix a lot of warnings in GTK4

See merge request GNOME/gtk!188
2018-06-10 23:14:42 +00:00
Руслан Ижбулатов
10b2f6540a Fix wrong format strings in various places 2018-06-10 21:20:59 +00:00
Руслан Ижбулатов
c02bc22cc5 Use aligned allocators for GtkSnapshot
Any data that is later fed to graphene must be
allocated with proper alignment, if graphene
uses SSE2 or GCC vector instructions.

This adds custom array code (a streamlined copy
of GArray with all unnecessary bells and whistles removed),
which is then used for the state_stack instead of GArray.

There's also a runtime check for the size of GtkSnapshotState
itself being a multiple of 16. If that is not so, any array
elements past the 0th element will lose alignment.
There are probably struct attributes that can
make GtkSnapshotState always have size that is a multiple
of 16, but we'll burn that bridge if we cross it.
2018-06-10 20:35:54 +00:00
Руслан Ижбулатов
a394a86151 Use aligned allocators for GskRenderNode
Any data that is later fed to graphene must be
allocated with proper alignment, if graphene
uses SSE2 or GCC vector instructions.
2018-06-09 14:05:49 +00:00
Руслан Ижбулатов
8e74eb382f Add aligned allocator functions to GSK
The code is mostly stolen from graphene.
Allocators support any alignment, but their implementation
only calls system aligned allocator functions if malloc()
is not aligned to 16-byte boundaries. If it is aligned,
the implementation just calls malloc() regardless of which
alignment is requested by the caller.

This can be fixed by saving the result of meson malloc()
alignment check and adding a few conditions to the implementation,
but right now GSK and GTK only need 16-byte alignment either way.
2018-06-09 14:01:03 +00:00
Timm Bäder
4ab3aada3f gl renderer: use w axis vector from graphene
Instead of initializing our own one every time.
2018-06-04 21:58:44 +02:00
Timm Bäder
719b2b0525 gl renderer: Remove an outdated comment 2018-05-27 17:51:51 +02:00
Timm Bäder
251913c80e gl renderer: Use offsets for more node types 2018-05-27 16:20:55 +02:00
Timm Bäder
c8aa5b8b4e gl renderer: Add helper for printing a render node tree 2018-05-19 10:18:50 +02:00
Benjamin Otte
69644993f6 gsk: Improve GSK_RENDERER behavior
1. Include the broadway renderer (so we can test it properly fails on
   Wayland or X11)
2. List all potential renderers, print useful information when Vulkan
   is not compiled in instea dof omitting it
3. Improve docs
2018-05-07 16:45:32 +02:00
Timm Bäder
31e0aaf6b0 gl renderer: Remove ops debug message
Without a node name, this doesn't make much sense anymore.
2018-05-02 19:48:34 +02:00
Timm Bäder
d506799e72 gl renderer: Ignore nodes outside of the clip
Pretty sure this will bite me later but for now we avoid rendering nodes
that we are not going to see anyway.
2018-05-01 15:13:11 +02:00
Timm Bäder
3a5a9d9233 gl renderer: Use simple offset for selected offset node children 2018-05-01 15:13:11 +02:00
Alexander Larsson
8c5d31d11d broadway: Handle offset nodes 2018-04-24 23:24:55 +02:00
Alexander Larsson
b554f4be20 broadway: Handle cairo nodes of type recording surface 2018-04-24 23:24:55 +02:00
Alexander Larsson
a329de63ea broadway: Add and use GdkBroadwayDrawContext 2018-04-24 23:24:55 +02:00
Benjamin Otte
a865621519 gdk: Move begin/end_frame() functions
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.

As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
2018-04-24 23:16:58 +02:00
Benjamin Otte
48fc18c37b gdk: Get rid of GdkDrawingContext
All information is kept in GdkDrawContext these days, so use that one.
2018-04-24 23:16:58 +02:00
Benjamin Otte
c6ae0ff2d1 gdk: Get rid of gdk_drawing_context_get_clip()
Use the identical gdk_draw_context_get_frame_region() instead.
2018-04-24 23:16:58 +02:00
Benjamin Otte
4d481ecb95 gsk: Refactor damage computation for GL renderer
Previously, we got the damage, then computed the changed area, then
started a frame with that changed area.

But starting a frame computes the damage for us.

So now we start a frame, then get the damage area from that, then
compute the change area.
2018-04-24 23:16:58 +02:00
Benjamin Otte
a83487a0c4 cairocontext: Move a function
A function of GdkDrawingContext is only used when drawing with Cairo, so
move it to GdkCairoContext.
2018-04-24 23:16:12 +02:00
Benjamin Otte
f396786051 gdk: Add GdkCairoContext
This does nothing but disallow passing NULL to gdk_surface_begin_paint()
and instead require this context.

The ultimate goal is to split out Cairo drawing into its own source file
so it doesn't clutter up the generic rendering path.
2018-04-24 23:16:12 +02:00
Benjamin Otte
b49dccb86d rendernode: Remove gsk_render_node_set_name()
And of course, gsk_render_node_get_name() is gone, too.
The replacement is of course debug nodes.

As a side effect, GskRenderNode is now *really* immutable.
2018-04-24 04:06:58 +02:00
Benjamin Otte
49f9d2108d gsk: Add GskDebugNode 2018-04-24 04:06:58 +02:00
Timm Bäder
4f3c7cd48a gsk: Make gsk_text_node_new_with_bounds private
We pulled out the bounds calculation for performance reasons, but the
caller can't know how to properly compute them. Inside gtk+, we can do
that but it's not good enough for public API.
2018-04-21 11:20:15 +02:00
Timm Bäder
d74be1fcf0 gl renderer: Rename texture_id parameter to fbo_id
So this makes sense again.
2018-04-21 10:13:16 +02:00
Timm Bäder
29f38056a9 gl renderer: Fix fallback node scaling 2018-04-21 10:06:57 +02:00
Timm Bäder
4336c6412a gl renderer: Remove unused viewport member 2018-04-15 17:12:01 +02:00
Timm Bäder
0a0c909e14 GskRenderer: Plug a memory leak 2018-04-14 12:50:17 +02:00
Timm Bäder
add82735bb gl renderer: Don't use texture ids in glBindFramebuffer calls 2018-04-14 11:47:02 +02:00
Timm Bäder
fdfdada362 gl renderer: Increase GArray size by 2 up front
Since we know we will add two elements anyway.
2018-04-14 11:47:02 +02:00
Timm Bäder
5e81761ad0 gl renderer: Slightly change ops_offset behavior
Add the given delta to the current one instead of replacing it.
2018-04-11 19:14:54 +02:00
Timm Bäder
0336825537 gl renderer: Don't draw all rounded clip nodes to a texture
We only need to do that if the rounde clip node intersects with the
outer one.
2018-04-11 19:14:54 +02:00
Timm Bäder
d7af16c8e4 gl renderer: Render everyhing according to MV scale
And not the surface's scale factor. This way the magnifier works.
2018-04-11 15:31:22 +02:00
Timm Bäder
cc66b50dcd gl renderer: Remove unused field 2018-04-11 15:31:22 +02:00
Benjamin Otte
1792f3b21e rendernode: Add missing return
Don't to extra work when not needed.
2018-04-05 18:40:54 +02:00
Benjamin Otte
200bbe8fda diff: Allow aborting a diff
When the max cost for finding a path gets to high, the diff can now be
aborted.

Because render nodes have a fallback method (by just marking the whole
bounds of the nodes as different), we use this to improve performance
of diffs.

This brings fishbowl (which is basically a container node with N images
that change every frame) back to close to previous performance.
2018-04-05 14:56:38 +02:00
Benjamin Otte
4b72ea33ac diff: Introduce GskDiffSettings
We can put lots of settings there to allow tuning the diff algorithm
used.
2018-04-05 14:56:38 +02:00
Benjamin Otte
0f184d3270 vulkan: Always render clip extents
Now that we have the full render nodes available, there is not much
benefit in fine-grained control over multiple rectangles.
In particular, it's causing pain with complex regions.

There might be a benefit in clipping to the region's rectangles in cases
like widget-factory where the whole diff is made up of the 2 rectangles
of spinner and the pulsing progress bar, but it needs a good heuristic
for where this is useful.
2018-04-05 14:56:38 +02:00
Benjamin Otte
925cbeaadf renderer: Track the previous node
... and diff the previous node with the current one to determine the
clip region.

This doubles the work necessary to track clip regions, but the following
commits will clean that up.
2018-04-05 14:56:38 +02:00
Benjamin Otte
7c313c7b25 gsk: move begin/end_frame vfuncs into the renderers 2018-04-05 14:56:38 +02:00
Benjamin Otte
d0873c7dec gsk: Fold gsk_renderer_begin_draw_frame() into renderer
It doesn't need to be exported anymore.

As a side effect, the inspector no longer has any information about the
render region, so remove the code that was taking care of that.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a6079b9b7b gsk: Implement gsk_render_node_diff()
This includes a copy of the diff(1) algorithm used by git diff by Davide
Libenzi.

It's used for the common case ofcontainer nodes having only very few
changes for the few nodes of child widgets that changed (like a button
lighting up when hilighted or a spinning spinner).
2018-04-05 14:56:38 +02:00
Benjamin Otte
271820b677 rendernode: Add gsk_render_node_diff()
... and gsk_render_node_can_diff(). Those are vfuncs to compute a region
containing all the pixels that differ between the two nodes.

This is just the plumbing that chains into node classes. No node
implements it yet.
2018-04-05 14:56:38 +02:00
Rico Tzschichholz
f2937f8c45 Fix some g-i annotation warnings 2018-04-01 09:15:08 +02:00
Timm Bäder
0f28f0ee39 GskRenderer: Remove outdated documentation comment
All render node trees are immutable
2018-03-31 14:45:03 +02:00
Timm Bäder
08296b8aee gl renderer: Don't highlight cairo nodes as fallback 2018-03-31 14:45:01 +02:00
Timm Bäder
809fdaa3e4 shaderbuilder: Insert newlines directly after defines
Instead of doing that in the loop in the last interation, we can just do
it after the loop.
2018-03-30 23:15:04 +02:00
Timm Bäder
f6330846c9 gl renderer: Remover unused mask uniform 2018-03-30 23:15:04 +02:00
Timm Bäder
badada9cf8 shader builder: Remove unused members 2018-03-30 23:15:04 +02:00
Timm Bäder
be3a42b7b1 shader builder: Reuse GString for shader code 2018-03-30 23:15:04 +02:00
Benjamin Otte
4fc072925c gsk: Remove gsk_renderer_create_cairo_surface()
It's not used anymore.
2018-03-29 05:02:15 +02:00
Benjamin Otte
69101a11b5 renderer: Get rid of unused member variable 2018-03-29 05:02:15 +02:00
Chun-wei Fan
dfb06e1c7a gsk/gl: Include cairo.h consistently
Follow the other sources that include cairo.h, by just doing #include
<cairo.h>, not <cairo/cairo.h>.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 22:05:17 +08:00
Timm Bäder
cc0a69e101 gl renderer: Fix some crashes
When the first op is a modelview or projection change.
2018-03-27 18:20:52 +02:00
Timm Bäder
b26e584e29 gl renderer: Rename everything called window to surface 2018-03-26 21:13:52 +02:00
Benjamin Otte
353ad30b12 rendernode: Fix serializing
Adding the offset node broke serialization in 2 ways:

1. We store the enum value in the node, so make sure to not change it
   for existing values
2. The offset node was missing in the deserialization lookup table
2018-03-26 19:43:06 +02:00
Benjamin Otte
ce743f28a1 rendernode: Add an offset node
This is a special case of the transform node that does a 2D translation.

The implementation in the Vulkan and GL renderers is crude and just does
the same as the transform node.

Nothing uses that node yet.
2018-03-26 18:16:36 +02:00
Timm Bäder
433517fdc9 gl renderer: Skip all 0-sized nodes
These will cause problems later on.
2018-03-25 11:47:57 +02:00
Timm Bäder
7240178988 gl renderer: Remove cairo node special case 2018-03-25 11:47:57 +02:00
Benjamin Otte
e84c6acc4f rendernode: Remove renderer argument
It's not needed to create Cairo nodes anymore.
2018-03-24 21:57:20 +01:00
Benjamin Otte
df600669a2 rendernode: Create Cairo surfaces as recording surfaces
This way, we can postpone the actual rendeing of the node until the
renderer. This allows the renderer to choose the right scale to
render at, so it can decide to use 2x scale for hidpi on its own.

Last but not least, it makes all nodes independent of the context they
are created in, because they do not need to know at snapshot time what
they will ultimately be rendered into.
2018-03-24 21:57:20 +01:00
Benjamin Otte
f680d5d130 vulkan: Remove special case for Cairo surfaces
This is in preparation for the next commits which switch Cairo nodes to
recording surfaces.
2018-03-24 21:57:20 +01:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Alexander Larsson
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
0124740fa0 gl renderer: Support large textures
By tiling them.
2018-03-20 09:40:10 +01:00
Timm Bäder
4240119d64 gl renderer: add basic code to support texture tiling 2018-03-20 09:40:10 +01:00
Timm Bäder
a9fec38680 rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:40:10 +01:00
Timm Bäder
22780044ec rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:37:59 +01:00
Timm Bäder
9e9db8607b Revert "gl renderer: Limit texture node size to clip"
This reverts commit 0234e8e2c9.

This broke partially clipped-away nodes when they are being transformed,
e.g. by a rotation
2018-03-20 09:37:59 +01:00
Timm Bäder
8ef2b10f70 gldriver: Name driver instances 'self' 2018-03-20 09:37:59 +01:00
Benjamin Otte
d54ca3c74f gdk: Add GDK_MEMORY_DEFAULT
This is the default memory format.

I added it because it is way better than including a private header and
using GDK_MEMORY_CAIRO_FORMAT_ARGB32.
2018-03-18 05:57:07 +01:00
Benjamin Otte
ee8e42f19b gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:57:07 +01:00
Timm Bäder
ba52be36c2 gl renderer: Set border program outline state 2018-03-15 18:17:57 +01:00
Timm Bäder
eaf899061a gl renderer: Remove shadow program
Drawing shadows is the same task as drawing text in our case and these
two shaders have been the same thing for quite a while.
2018-03-15 18:12:00 +01:00
Timm Bäder
0a7880110e gl renderer: Fix clipped borders
Stop abusing the clip rect for borders.
2018-03-15 18:11:57 +01:00
Timm Bäder
a475e6671c shaderbuilder: Remove unused API 2018-03-15 16:30:48 +01:00
Timm Bäder
e35132054e gl: Move shaderbuilder into gl/ subdirectory
It only handles OpenGL shaders.
2018-03-15 15:06:46 +01:00
Timm Bäder
ebfadae568 gl renderer: Draw offscreen nodes in device pixels
We need to draw them upscaled, of course. This fixes button hover (or,
more generally, crossfade nodes) in hidpi setups.
2018-03-15 13:52:07 +01:00
Timm Bäder
3a5630358f gl renderer: Fix rounded clips in hidpi 2018-03-15 11:01:53 +01:00
Timm Bäder
04fadc508b GskGLDriver: Use g_assert_cmphex for GL constants 2018-03-15 09:25:42 +01:00
Timm Bäder
d417595a05 gl renderer: Draw rounded clip child to a texture
And then clip the texture using the current (maybe also rounded) clip.
This way, the result is correct. We don't necessarily have to do the
offscreen drawing in any case, but got the safe route for now.
2018-03-14 17:28:41 +01:00
Timm Bäder
90c8619f42 gl renderer: Properly draw gl textures from a different context
Temporarily switch to the texture's gl context, download the texture and
create a new one in our context for it.
2018-03-14 17:28:41 +01:00
Benjamin Otte
160e6ad6f6 gdk: Split out GL texture
Put GdkGLTexture into its own file and rename the API to
gdk_gl_texture_foo() instead of gdk_texture_foo_for_gl().

Apart from naming, no actual code changes.
2018-03-07 16:17:15 +01:00
Timm Bäder
2d50d9ebe6 rendernodes: Add gsk_text_node_new_with_bounds
An alternative GskTextNode constructor that does no text measuring. That
way, we can measure the text before and check if the node will be
outside of the current clip anyway.
2018-03-04 19:12:04 +01:00
Timm Bäder
ee8132a439 rendernodes: Add missing nullable annotation 2018-03-04 19:12:04 +01:00
Timm Bäder
0234e8e2c9 gl renderer: Limit texture node size to clip 2018-03-04 19:12:04 +01:00
Timm Bäder
da431b2a43 glglyphcache: Pass lookup key to g_hash_table_lookup directly 2018-03-04 19:12:04 +01:00
Timm Bäder
d2b5436462 gl: Make blur nodes with radius ∈ ]0; 1[
Otherwise, the radius here ends up being 0 and we don't draw anything at
all.
2018-02-27 14:22:08 +01:00
Timm Bäder
cac3e7705d gsk: Increase blur node bounds by blur radius
Otherwise, the resulting node will be too small and the result looks
clipped.
2018-02-27 14:12:25 +01:00
Benjamin Otte
710c39027b vulkan: Keep track of command buffers
Fixes a rather large memleak.
2018-02-17 08:04:43 +01:00
Timm Bäder
ad776cc57b gl renderer: Increase offscreen texture size
This fixes blurry checkbutton marks in hidpi setups, but breaks button
hover effects. That's another problem.
2018-02-16 18:00:06 +01:00
Timm Bäder
fab9449414 build: install gsk-autocleanup.h 2018-02-06 11:26:47 +01:00
Timm Bäder
0a51f38963 gl renderer: Check the scale factor for every render
This way we pick up changes in the GdkWindow's scale_factor.
2018-02-06 09:19:40 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
1772cfd4d8 gsk: Add autocleanup definitions
This may be useful for applications using render nodes.
2018-02-06 01:16:32 -05:00
Matthias Clasen
66a3b07183 Don't put gdk types into a gsk header
This is a leftover from when GskTexture was moved
to gdk.
2018-02-05 07:50:17 +01:00
Timm Bäder
5aaf752013 roundedrect: Fix coordinate mixup in contains_point
This together with the optimizations in GtkSnapshot was causing circular
buttons to become squared when partially scrolled out of view.
2018-02-04 14:56:41 +01:00
Timm Bäder
c739db0e29 gl renderer: Use a gl texture in render_texture
Get rid of the manual y flipping and cairo business. This keeps the gl
unit tests working at least.
2018-02-04 13:10:51 +01:00
Benjamin Otte
83a687f891 rendernode: Don't alloca() 8MB
This happens when deserializing testcases and it really confuses
valgrind into thinking we're longjmp()ing.

And deserializing rendernodes is slow anyway, so who cares about a few
more malloc()s.
2018-02-03 16:24:13 +01:00
Timm Bäder
4fa4b8525e gl renderer: Clear resources after render_texture
This makes multiple consecutive render_texture calls on the same
renderer work.
2018-02-03 13:24:55 +01:00
Timm Bäder
6e70079e63 gl renderer: Reset clip when drawing offscreen
Just like we reset the scissor test and the viewport, we also can't use
the current clip anymore in this case.
2018-01-27 12:13:37 +01:00
Timm Bäder
c1882fe44e GskRoundedRect: Fix GSK_ROUNDED_RECT_INIT macro
GskRoundedRect does not have a .rect member, it's 'bounds'. Also,
properly initialize all fields, i.e. all the corners.
2018-01-27 12:11:49 +01:00
Timm Bäder
684624005a gl renderer: Fix hidpi cairo node rendering
We can't just unconditionally create a larger texture here, since the
incoming cairo surface might have a device scale that doesn't fit our
scale_factor. Instead, look up the surface device scale and use that.
2018-01-27 11:06:38 +01:00
Timm Bäder
1fb5d389db gl renderer: Make width/height relation more obvious
In add_offscreen_ops, we use the max_x/min_x values for the texture and
viewport width, and the max_y/min_y for the texture and viewport height.
2018-01-27 11:00:59 +01:00
Timm Bäder
e3557f681c gl renderer: Fix outset shadow outline transform
This fixes hidpi blurred outset shadows
2018-01-23 21:46:31 +01:00
Timm Bäder
8f4e0705dc gl renderer: Fix shadow node child offset
We shouldn't apply the shadow offset when drawing the child offscreen,
instead apply it afterwards when we draw it to the current render
target.
2018-01-19 15:00:22 +01:00
Timm Bäder
41a922928e gl renderer: Render GL textures upside down
These come from an FBO so we need to flip the texture coords on the y
axis, just like we do everywhere else.
2018-01-18 08:21:11 +01:00
Timm Bäder
5e7b3030b9 rendernodeimpl: Fix a crash
We may get a NULL renderer here.
2018-01-17 21:57:20 +01:00
Matthias Clasen
31fcf5b3a7 gsk: Handle GL textures
These textures already have a GL texture in them,
no need to create a new one.
2018-01-17 11:57:25 -05:00
Timm Bäder
4946810960 gl renderer: Render unblurred outset shadows differently
We don't need to draw anything to a texure for those.
2018-01-15 10:56:43 +01:00
Timm Bäder
df35d00a1d gskcairoblur: Don't apply y_scale twice
A version of 29f36fed08 but for the blur
we use in gsk.
2018-01-15 10:56:43 +01:00
Matthias Clasen
2be16f36ed gsk: Add a setter for debug flags
We need to set the global flags, since these are picked
up initially by new renderers.
2018-01-14 17:05:04 -05:00
Matthias Clasen
ba21a7764b gsk: Reorganize env vars
Get rid of GSK_RENDERING_MODE and add the flags to GSK_DEBUG,
following the same pattern we use in gdk now.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c56419818f gsk: make logging per-renderer
Add a setter for per-renderer debug flags, and use
them where possible. Some places don't have easy access
to a renderer, so this is not complete.
Also, use g_message instead of g_print throughout.
2018-01-14 17:05:04 -05:00
Matthias Clasen
782c76c146 gsk: Drop unused debug flags
We are not logging anything for transforms or rendernodes atm.
2018-01-14 17:05:04 -05:00
Matthias Clasen
55585aec73 gsk: Clarify a debug message
We are printing a window type, not a display.
2018-01-14 17:05:04 -05:00
Timm Bäder
b9a05be2da gl renderer: Sprinkle some const around 2018-01-10 08:46:22 +01:00
Timm Bäder
bbf6e81c1f gl renderer: Fix shaders for gles
Remove uniform initializers, add casts to float, etc.
2018-01-08 19:23:06 +01:00
Timm Bäder
cd2a53851b gl: Fix copy&paste error in blur shader 2018-01-08 19:23:06 +01:00
Timm Bäder
f7ba3224b9 gl renderer: Bring back hexbox drawing 2018-01-08 17:44:37 +01:00
Timm Bäder
3176ae7e51 gl renderer: Use alpha uniform in inset shadow shader 2018-01-08 17:44:33 +01:00
Matthias Clasen
3771c95c72 gsk: Move Vulkan sources to a subdirectory
Following what was already done for GL.
2018-01-06 09:36:55 -05:00
Matthias Clasen
550f4bc854 gsk: Fix hexbox drawing for the Vulkan renderer
Just as in the cairo renderer, we can get this back
by using pango_cairo_show_glyph_string for populating
the cache.
2018-01-05 20:30:14 -05:00