Commit Graph

158 Commits

Author SHA1 Message Date
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
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
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
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
165dab8265 gl renderer: Ignore 0-sized fallback nodes 2018-06-26 21:41:29 +02:00
Timm Bäder
7f8106f2a9 gl renderer: call glViewport directly 2018-06-16 10:09:12 +02:00
Руслан Ижбулатов
10b2f6540a Fix wrong format strings in various places 2018-06-10 21:20:59 +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
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
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
49f9d2108d gsk: Add GskDebugNode 2018-04-24 04:06:58 +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
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
7c313c7b25 gsk: move begin/end_frame vfuncs into the renderers 2018-04-05 14:56:38 +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
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
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
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