Commit Graph

980 Commits

Author SHA1 Message Date
Timm Bäder
71512cf9ad gl renderer: Move geometry calculation further down
We don't need it above, so move it to where it belongs.
2018-12-02 13:25:43 +01:00
Timm Bäder
79cc8fb261 gl renderer: Apply offset with scale 2018-12-02 13:25:43 +01:00
Timm Bäder
2831dbb110 gl renderer: Refactor add_offscreen_ops
Use a graphene_rect_t for the node bounds instead of 4 floats.
This makes it simpler to pass the size in without the offset applied.
2018-12-02 13:25:43 +01:00
Timm Bäder
933acb3682 gl renderer: Add offscreen ops without offset applied
When doing color matrix nodes. This fixes color matrix node with scale =
2.
2018-12-02 13:25:43 +01:00
Timm Bäder
574ebafa46 gl renderer: Reset offset when rendering offscreen
We want to apply the offset to the rendered texture, not to the
offscreen-rendered content.
2018-12-02 13:25:43 +01:00
Timm Bäder
74dd05b45e gl renderer: add render ops for dumping the framebuffer
So offscreen rendering can be properly debugged.
2018-12-02 13:25:43 +01:00
Timm Bäder
3eb2cef421 gl renderer: Set the render region as initial clip
So we avoid creating render ops for things outside of it.
2018-12-02 13:25:43 +01:00
Timm Bäder
538491efa1 gl renderer: Fix only_translation check 2018-12-02 13:25:43 +01:00
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
Matthias Clasen
2bab983ecf gsk: Fix hexbox drawing for fallback rendering
pango does not currently export api for drawing hex boxes,
but by using pango_cairo_show_glyph_string, we can reuse its
implementation.
2018-01-05 18:55:23 -05:00
Timm Bäder
f729cbb760 gl renderer: Fix text color pre-multiplication 2018-01-04 12:20:27 +01:00
Rico Tzschichholz
543b21430b gsk: Add docs for gsk_texture_node_get_texture 2018-01-03 08:17:23 +01:00
Timm Bäder
fcc8d778b5 gl renderer: Avoid some code duplication 2018-01-02 08:10:06 +01:00
Timm Bäder
d1a08aa2a9 gl driver: Remove some type checks in a hot path 2018-01-02 08:10:06 +01:00
Timm Bäder
0e57d173b3 gl renderer: Remove an unnecessary block 2018-01-02 08:10:06 +01:00
Timm Bäder
f92cca5229 gl renderer: Fix release build 2017-12-29 08:59:47 +01:00
Timm Bäder
86a6131510 build: Rename a variable
Those aren't source headers...
2017-12-29 05:48:43 +01:00
Timm Bäder
6587864824 gl driver: Remove more unused API 2017-12-29 05:48:43 +01:00
Timm Bäder
e0436b3d59 gl renderer: Properly delete all shader programs 2017-12-29 05:48:43 +01:00
Timm Bäder
d2d18f74f8 gl driver: Remove gl-context property
No need for this to be a property.
2017-12-29 05:48:43 +01:00
Timm Bäder
1cbd4d229e gl driver: Remove dead warning code
_get_fbo never returns NULL.
2017-12-29 05:48:43 +01:00
Timm Bäder
c9656e2864 gl driver: Only support one fbo per texture 2017-12-29 05:48:43 +01:00
Timm Bäder
352590cf9f gl driver: Remove vao API
Unused.
2017-12-29 05:48:43 +01:00
Timm Bäder
825608af2a gl renderer: Remove unused parameter 2017-12-29 05:48:43 +01:00
Timm Bäder
4abbf929ad gl renderer: Remove some unused uniforms from shader 2017-12-29 05:48:42 +01:00
Timm Bäder
aeaab5557b gl renderer: Only draw what we have to 2017-12-29 05:48:42 +01:00
Timm Bäder
2bc10fa365 gl renderer: draw all outset shadows
Instead of falling back to cairo for most of them.
2017-12-29 05:48:40 +01:00
Timm Bäder
9f2674077a gl renderer: Properly flip texture in render_texture path
Just do this on the CPU instead.
2017-12-28 16:48:35 +01:00
Timm Bäder
a720a63fa3 gl renderer: Insert render target op in render_texture path 2017-12-28 16:48:35 +01:00
Timm Bäder
7a2d30323e gl renderer: try doing outset box shadows
Still fall back in cases we can't handle that way.
2017-12-21 19:12:33 +01:00
Timm Bäder
d211f42091 gl renderer: Remove unused vertex shader 2017-12-21 19:12:32 +01:00
Timm Bäder
f044b01549 gl renderer: Don't crash if the first op is an opacity one 2017-12-21 19:12:32 +01:00
Timm Bäder
490e15021c gl renderer: Force cross-fade nodes offscreen 2017-12-21 19:12:32 +01:00
Timm Bäder
48be2aed23 gl renderer: Use one function per op type to apply data 2017-12-21 19:12:32 +01:00
Timm Bäder
28499032da gl renderer: Don't leak gl resources 2017-12-21 19:12:32 +01:00
Timm Bäder
ee27b17a12 gl renderer: Fix indentation mishap 2017-12-21 19:12:32 +01:00
Timm Bäder
a83037c440 gl renderer: Implement cross fade nodes 2017-12-21 19:12:32 +01:00
Timm Bäder
bed03aa319 gl renderer: Fix linear gradient shader color calculation
This fixes both the wrong headerbar color and the broken border color in
of the circular button in the widget-factory.
2017-12-21 19:12:32 +01:00
Timm Bäder
eb221ff305 gl renderer: Only take glyph texture alpha into account
This way, we can use the very same coloring program to draw text shadows
of fonts with colored glyphs.
2017-12-21 19:12:32 +01:00
Timm Bäder
075e6ac266 gl renderer: Fix shadow nodes if the child is a container 2017-12-21 19:12:32 +01:00
Timm Bäder
18e7d777a2 gl renderer: Move declarations to the beginning of the block 2017-12-21 19:12:32 +01:00
Timm Bäder
e9be72a73e gl renderer: Fix use of uninitialized values 2017-12-21 19:12:32 +01:00
Timm Bäder
33457b4035 gl renderer: Ensure texture sizes arent 0
We already ceil() the given float texture sizes here, so if they are
valid, the result should definitely be > 0. Textures with size 0 can't
be properly used, especially not as render targets, where they will
trigger an assertion failure later in a glCheckFramebuffer call.
2017-12-21 19:12:32 +01:00
Timm Bäder
49c7cf36e4 gl renderer: Fix inset and outset shadows in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
b03f08960b gl renderer: Fix cairo node surface size in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
d9e135dcb5 gl renderer: Fix rounded clips in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
3411e648b4 gl renderer: Handle borders in hidpi better 2017-12-21 19:12:32 +01:00
Timm Bäder
64400e82b5 gl renderer: Default to 0px clip and border radius
Finally fix the division by 0 in the clip code.
2017-12-21 19:12:32 +01:00
Timm Bäder
703c4cf003 gl renderer: Ignore render ops before we have a valid program 2017-12-21 19:12:32 +01:00
Timm Bäder
2d3e87da46 gl renderer: Try to fix border rendering 2017-12-21 19:12:32 +01:00
Timm Bäder
a59f380d31 gl renderer: Use one function per node-type
So a profiler can actually tell me what's slow and not just point at
_add_render_ops in all cases.
2017-12-21 19:12:32 +01:00
Timm Bäder
ab53ee7377 gl renderer: Don't render opacity nodes offscreen
We already drag a u_alpha uniform around in every shader, so use that
one.
2017-12-21 19:12:32 +01:00
Timm Bäder
fd0b7caa7c gl renderer: Fix shadow shader
We need to take the alpha of the shadow color into account as well.
2017-12-21 19:12:32 +01:00
Timm Bäder
476450b93e gl renderer: Ignore shadow color matrix nodes...
... if the color matrix nodes don't touch the child alpha.
2017-12-21 19:12:32 +01:00
Timm Bäder
98ba28b5d7 gl renderer: Add a helper function
We'll use this for the common case of a color matrix node inside a
shadow node.
2017-12-21 19:12:32 +01:00
Timm Bäder
49785974cf gl renderer: Don't zero initialize render ops GArray 2017-12-21 19:12:32 +01:00
Timm Bäder
7cc868910b gl renderer: Avoid crashing tooltips 2017-12-21 19:12:31 +01:00
Timm Bäder
39a241b763 gl renderer: Sort border sides by color 2017-12-21 19:12:31 +01:00
Timm Bäder
c9af94f6db gl renderer: Keep track of border program state 2017-12-21 19:12:31 +01:00
Timm Bäder
f978bf057f gl renderer: Avoid using a new modelview for shadow nodes
We can just move the vertex data directly.
2017-12-21 19:12:31 +01:00
Timm Bäder
7ad8f211c6 gl renderer: Default to GL_LINEAR scaling filters 2017-12-21 19:12:31 +01:00
Timm Bäder
5cdd46e38e gl renderer: Remove superfluous modelview matrix changes 2017-12-21 19:12:31 +01:00
Timm Bäder
1fce25c7af gl renderer: Remove unused struct member 2017-12-21 19:12:31 +01:00
Timm Bäder
9479bb6bfc gl renderer: Keep track of color matrix op state 2017-12-21 19:12:31 +01:00
Timm Bäder
b33d85b594 gl renderer: Avoid consecutive opacity ops 2017-12-21 19:12:31 +01:00
Timm Bäder
a0e033b2cd gl renderer: Define debug structs inline 2017-12-21 19:12:31 +01:00
Timm Bäder
5d0c279351 gl renderer: Add more detailed render op output 2017-12-21 19:12:31 +01:00
Timm Bäder
7831d9a463 gl renderer: Only draw blurred shadow nodes once 2017-12-21 19:12:31 +01:00
Timm Bäder
7dc6a46cff gl renderer: Remove consecutive clip ops 2017-12-21 19:12:31 +01:00
Timm Bäder
bb69d64a0f gl renderer: Rename a macro 2017-12-21 19:12:31 +01:00
Timm Bäder
8463040ad1 gl renderer: Fix debugging output 2017-12-21 19:12:31 +01:00
Timm Bäder
3b7cfd068b gl renderer: Implement simple border nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
8089cde977 gl renderer: Don't render unblurred text shadows to a texture
We can do the same thing by simply drawing the text in the given shadow
color.
2017-12-21 19:12:31 +01:00
Timm Bäder
d5a759652f gl renderer: Split out text rendering function
We'll use that for text shadow nodes
2017-12-21 19:12:31 +01:00
Timm Bäder
e95b356465 gl renderer: Implement simple shadow nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
c524ac7bb5 gl renderer: Split out a utility function 2017-12-21 19:12:31 +01:00
Timm Bäder
8c9e203458 gl renderer: Fix inset shadow offset calculation 2017-12-21 19:12:31 +01:00
Timm Bäder
47c4bf5be0 gl renderer: Implement unblurred outset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
5c7838e168 gl renderer: Rework program creation
Make sure all uniform names have to match between the shader names and
the _location integers we save in every Program struct.
2017-12-21 19:12:31 +01:00
Timm Bäder
388157b995 gl renderer: Implement unblurred inset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
6a1a70c677 gl renderer: Implement blur nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
ff1cacb54a gl renderer: Remove some unused members 2017-12-21 19:12:31 +01:00
Timm Bäder
19700fccb2 gl renderer: Keep track of current program color value 2017-12-21 19:12:31 +01:00
Timm Bäder
2865ab84a9 gl renderer: Don't draw texture nodes to a framebuffer
We don't need to create a texture from a texture node. We can simply use
its texture instead and draw it however we want.
2017-12-21 19:12:31 +01:00
Timm Bäder
e3264d5fd3 gl renderer: Implement color matrix nodes again 2017-12-21 19:12:31 +01:00
Timm Bäder
cb9c4e362c gl render ops: Rename a member 2017-12-21 19:12:31 +01:00
Timm Bäder
b56a7afd19 gl renderer: Factor out a helper function for offscreen drawing 2017-12-21 19:12:30 +01:00
Timm Bäder
95051e13c3 gl ops: Remove dead code
This is already checked further up in that function
2017-12-21 19:12:30 +01:00
Timm Bäder
832920c6ba gl renderer: Optimize text drawing
Text nodes will almost always end up using the exact same texture and
the same program. So, in that case we can simply add vertex data for all
the characters we need to draw and use just one draw call.
2017-12-21 19:12:30 +01:00
Timm Bäder
fa564e1f93 gl renderer: Remove unused VAO 2017-12-21 19:12:30 +01:00
Timm Bäder
d5eeb9d6f0 gl renderer: Stop collecting VAOs in clear_tree
We don't use that part of the gl driver anymore.
2017-12-21 19:12:30 +01:00
Timm Bäder
6606c1f682 gl renderer: Only check for color glyphs once per text node
It does not depend on the glyph, so no need to do it once for every
glyph.
2017-12-21 19:12:30 +01:00
Timm Bäder
5615fd26c2 gl renderer: Implement cairo nodes again 2017-12-21 19:12:30 +01:00
Timm Bäder
a1d3e77347 gl renderer: Move render ops into separate file 2017-12-21 19:12:30 +01:00
Timm Bäder
823369f275 gsk: Move all gskgl* files into gl/ 2017-12-21 19:12:30 +01:00
Timm Bäder
358c139a43 gl renderer: Rework once more
Last time, I swear.
2017-12-21 19:12:30 +01:00
Timm Bäder
dd1a9745db gl renderer: Don't initialize modelview matrix twice 2017-12-21 19:12:30 +01:00
Timm Bäder
59a7584386 gl renderer: Group render node types by render item creation 2017-12-21 19:12:30 +01:00
Timm Bäder
f4304336ea gl renderer: Don't pass MVP to shaders
We already pass both modelview and projection matrix individually.
2017-12-21 19:12:30 +01:00
Timm Bäder
4cf2a482ea gl: Add glyph cache
Based on the one used by the vulkan renderer
2017-12-21 19:12:30 +01:00
Timm Bäder
3e23f6c22b gl renderer: Remove unused member 2017-12-21 19:12:30 +01:00
Timm Bäder
9b400134d5 gl renderer: Remove unused shaders 2017-12-21 19:12:30 +01:00
Timm Bäder
33aa61ef2c gl renderer: Save clip in every node 2017-12-21 19:12:30 +01:00
Timm Bäder
1f5fd4d564 gl renderer: Don't create framebuffer for texture opacity children
Slowly a pattern emerges...
2017-12-21 19:12:30 +01:00
Timm Bäder
24e69bb877 gl renderer: Implement rounded clip nodes
mostly a proof of concept
2017-12-21 19:12:30 +01:00
Timm Bäder
cd730ccff5 gl renderer: save on some frame buffers
If the child of a color matrix node is a texture, we can directly use
that instead of drawing it to a texture first and then using that
texture.
2017-12-21 19:12:30 +01:00
Timm Bäder
1d1c6a98ce GskGLDriver: Add profiler
Count the newly created textures, the reused ones and the uploads from
cairo surfaces per frame.
2017-12-21 19:12:30 +01:00
Timm Bäder
ddb77d6c9b GskGLDriver: Use float for texture size in create_texture
Render nodes can end up with bounds < 1 since they are floats, and the
implicit cast to int ends up creating a texture with 0 width or height.
Use ceil() instead in create_texture so we don't have to do that on the
caller side everywhere.
2017-12-21 18:25:52 +01:00
Timm Bäder
4aa3f51016 test-render-nodes: Add color matrix test 2017-12-21 18:25:52 +01:00
Timm Bäder
6bce14bee2 Rework the GL renderer 2017-12-21 18:25:52 +01:00
Timm Bäder
5fa5008ee9 gl renderer: Remove some unused code 2017-12-21 18:25:52 +01:00
Timm Bäder
fe7db31663 gl driver: Make some members const 2017-12-21 18:25:52 +01:00
Timm Bäder
b488329104 GskRenderer: Remove viewport property 2017-12-21 18:25:52 +01:00
Georges Basile Stavracas Neto
8993a51893 vulkan: Destroy buffer before releasing associate memory
Exact same issue as the previous commit.
2017-12-13 23:14:58 -02:00
Georges Basile Stavracas Neto
147a455171 vulkan: Destroy image before releasing associate memory
VkImage contains a reference to the VkDeviceMemory and, because
the current code frees the VkDeviceMemory before destroying the
VkImage that references it, a warning is triggered by the validation
layers.

This is not critical, since we release both resources at the same
place. But the warning triggered by the validation layers sums up
adding 1 MB per second of extra debug logging, making the debugging
process much more painful.

This commit simply swaps the destruction order, and destroys the
VkImage first, then the now unused VkDeviceMemory.
2017-12-13 22:49:16 -02:00
Benjamin Otte
52b1cd40d1 gsk: Remove gsk_render_node_set_scaling_filters()
This is a leftover from the very early rendernode that we forgot to delete.

This can be seen by the fact that it is settable on an immutable object.
2017-12-03 21:57:21 +01:00
Benjamin Otte
9048d40bc2 vulkan: Fix mask shader to premultiply color
The inColor wasn't premultiplied, so the resulting colors were wrong
with translucent borders.
2017-12-02 16:21:58 +01:00
Benjamin Otte
abc8d61730 vulkan: Fix border shader to premultiply color
The inColor wasn't premultiplied, so the resulting colors were wrong
with translucent borders.
2017-12-02 16:21:58 +01:00
Timm Bäder
34e233e1c3 GskVulkanGlyphCache: Remove unused struct member 2017-12-01 07:30:25 +01:00
Alexander Larsson
521b09cc96 broadway: Send diffs of node trees
Reusing pre-created nodes is a lot faster both in terms of
dom modifications and of transfer sizes.
2017-11-30 21:57:42 +01:00
Matthias Clasen
9b582db492 gsk: Quiet a compiler warning
We insist on handling all cases in a switch, nowadays.
2017-11-24 08:51:22 -05:00
Alexander Larsson
820f999f14 broadway: Disable fallback spew by default 2017-11-23 10:48:29 +01:00
Alexander Larsson
12d3cd8f29 broadway: Handle cairo nodes
This means we can directly upload these as textures, rather than
create a new surface and draw it into that. We still have to upload,
but there isn't a lot we can do about this as for these nodes
we generally redraw everything each time.
2017-11-23 10:48:29 +01:00
Alexander Larsson
4d1eca0d57 broadway: Handle texture gsd nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
b74959a605 broadway: Add clip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
7a180f554d broadway: Don't log cache hits 2017-11-23 10:48:29 +01:00
Alexander Larsson
0d4a26f148 broadway: Cache color translated textures
These happen a lot due to the recolored symbolics
2017-11-23 10:48:29 +01:00
Alexander Larsson
9e5a22bbe5 broadway: Add opacity node 2017-11-23 10:48:29 +01:00
Alexander Larsson
9b1f6acc2b broadway: Add shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
cbbbf49043 broadway: Add node cache for text 2017-11-23 10:48:29 +01:00
Alexander Larsson
278370c8e5 broadway: Add linear gradient node 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7ff6dbb66 broadway: Add RoundedClip node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0083c084e4 broadway: Add inset shadow 2017-11-23 10:48:29 +01:00
Alexander Larsson
35ceb8e626 broadway: Add outset shadow node 2017-11-23 10:48:29 +01:00
Alexander Larsson
cf03229a99 broadway: Add border node 2017-11-23 10:48:29 +01:00
Alexander Larsson
0b38ab339e broadway: Add color nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
f7d8ee041b broadway: Initial version of using actual render nodes 2017-11-23 10:48:29 +01:00
Alexander Larsson
23845a57a9 broadway: Add GskBroadwayRenderer
This is a custom renderer for broadway windows, although at the
moment it doesn't really do anything other than the old cairo
fallbacks.
2017-11-23 10:46:47 +01:00
Emmanuele Bassi
481b5d1b89 Partially revert GskTexture → GdkTexture rename
Excessive use of sed when moving GskTexture to GDK; the GskTextureNode
should still live under the GSK namespace.
2017-11-04 15:06:00 +00:00
Benjamin Otte
bd287ba3cf renderer: Assert having been unrealized in dispose
We cannot unrealize a renderer in the dispose function, because that
would cause this chain to happen:
  gsk_gl_renderer_dispose
  gsk_renderer_dispose
  gsk_renderer_unrealize
  gsk_gl_renderer_unrealize
So we would call into thje GL renderers unrealize when it has already
(partially) disposed itself and ause accesses to dead variables.
2017-11-04 15:22:25 +01:00
Benjamin Otte
ca3c23662c GskTexture => GdkTexture
We want this thing to replace GdkPixbuf, so it has to live in GDK.
2017-11-04 00:07:13 +01:00
Benjamin Otte
6b3d979196 gskgl: Deal with being rerealized 2017-11-01 15:48:00 +01:00
Matthias Clasen
ca7c148687 gsk: Apply scale factor for fallback rendering
This fixes blurry text and icons whenever we apply shadows
in a hidpi window. Shadow nodes are the last ones that we
still use fallback for, and this was causing us to render
the text blurry.
2017-10-28 14:38:49 -04:00
Matthias Clasen
439e1054c4 Triival cleanup
No need to go to the window, we store a copy of the scale factor
in the render pass object.
2017-10-28 14:38:21 -04:00
Matthias Clasen
a0bbd14325 gsk: Scale glyphs in the glyph cache
Pass a scale factor when caching glyphs or looking them
up in the cache. The glyphs in the cache are rendered
with subpixel precision determined by the scale. Update
all callers to pass a scale factor according to the window
scale. This lets us render crisp glyphs on hidpi systems.
2017-10-28 13:13:31 -04:00
Matthias Clasen
dc0570cc17 gsk: Drop the GskRenderer::scale-factor property
This is can always be obtained from the window that is already
associated with the renderer, no need to maintain a separate
property for it.
2017-10-28 11:49:39 -04:00
Matthias Clasen
ea91ab1d99 gsk: Make text nodes more compact
The copy of the PangoGlyphString we do here was showing up
in some profiles. To avoid it, allocate the PangoGlyphInfo array
as part of the node itself. Update all callers to deal with
the slight api change required for this.
2017-10-27 17:13:40 -04:00
Benjamin Otte
e1572e003a vulkan: No need to redefine gl_PerVertex
The compiler has those predefined, so use them.
2017-10-24 01:29:28 +02:00
Benjamin Otte
e4dbff6bfc vulkan: Delete unused shaders
These have been renamed to .frag/.vert, apparently the originals weren't
deleted.
2017-10-24 01:29:28 +02:00
Emmanuele Bassi
dd4c800542 Remove unnecessary const
We return a scalar value, so we don't need it to be constant.

https://bugzilla.gnome.org/show_bug.cgi?id=789351
2017-10-23 15:23:09 +01:00
Matthias Clasen
9e78fbaac4 Fix compiler warnings
I overlooked these when I recently did the render node api changes.
2017-10-21 15:17:36 +02:00