Commit Graph

445 Commits

Author SHA1 Message Date
Benjamin Otte
b28c3ef3d9 renderers: Handle large viewports
When large viewports are passed to gsk_renderer_render_texture(), don't
fail (or even return NULL).

Instead, draw multiple tiles and assemble them into a memory texture.

Tests added to the testsuite for this.
2022-02-26 20:35:44 +01:00
Christian Hergert
08d0575ed0 gsk/gl: avoid clearing opaque regions
If the rendering operation is over an opaque region, we can potentially
avoid clearing a large section of the framebuffer destination. Some cases
you do want to clear, such as when clearing the whole contents as some
drivers have fast paths for that to avoid bringing data back into the
framebuffer.
2022-02-21 23:43:17 -08:00
Benjamin Otte
2b2fd23815 Merge branch 'wip/otte/center-center-center' into 'master'
Add a bunch of reftests and fix their failures

Closes #4285

See merge request GNOME/gtk!4085
2021-10-22 16:35:41 +00:00
Benjamin Otte
b912e84df7 gl: Call make_current() before doing any GL work
But don't call it too early, we only want to call it once we have
prepared the target.

This way, we guarantee that a GL context is always available and that it
is bound to the correct target.
2021-10-22 17:51:40 +02:00
Benjamin Otte
cb03fe8f31 gsk: Allow gsk_renderer_realize (renderer, NULL, NULL)
That way, we can use renderers without surfaces.
2021-10-20 21:49:32 +02:00
Matthias Clasen
b7eb1d3310 gsk: provide an ngl renderer
Provide a minimal renderer implementation that fails
in realize. This avoids reusing the same type, which
might give bindings trouble.
2021-10-07 16:46:29 -04:00
Matthias Clasen
7a1644bc97 Maintain abi
Keep gsk_ngl_renderer_new and gsk_ngl_renderer_get_type,
since they were part of the abi in 4.2, and in an
installed header.

Fixes: #4318
2021-10-07 13:05:53 -04:00
Matthias Clasen
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Matthias Clasen
e9e373913e gsk: Drop the gl renderer
ngl supports all the same platforms as gl
now, and has seen more improvements in the
last cycle.
2021-08-20 22:58:30 -04:00
Matthias Clasen
2d266d107b gsk: Clean up docs syntax
Replace leftover gtk-doc syntax (#Type) with backquotes.
2021-05-22 17:25:26 -04:00
Alexander Mikhaylenko
ae7f380396 gsk: Fix shader gresource paths
They were never updated after having been moved.
2021-04-19 20:01:33 +05:00
Matthias Clasen
9d3aa2cfce gsk: Avoid compiler warnings without assertions
Disabling assertions was provoking some unused variable
warnings from the compiler. Avoid these.
2021-04-12 21:22:46 -04:00
Matthias Clasen
ee63b84b6a gsk: Rename resource paths
Make the shaders of the gl renderer live under
/org/gtk/libgsk/gl. This is purely cosmetic.
2021-04-03 08:10:58 -04:00
Matthias Clasen
dff2aa20ff gl: Fixed clipped offscreen rendering
When we are rendering a texture node to an offscreen,
and we have a clip, we must force the offscreen rendering.
Otherwise, the code will notice: Hey, it already is a texture
node, so no need to render it to a texture again. But when
clipping is involved, that is exactly what we want to do.

Testcase included.

Fixes: #3651
2021-02-09 22:43:15 -05:00
Timm Bäder
79f273348d gl renderer: Fix viewport computation when rendering offscreen
Fixes #3615
2021-01-29 10:37:48 +01:00
Fabio Lagalla
a1dd6521e8 gskglrenderer: Remove switch fallthrough comments 2021-01-27 12:52:11 +01:00
Fabio Lagalla
0088f840fe gskrendernode: Cache angle in conic gradients 2021-01-27 12:44:10 +01:00
Fabio Lagalla
04000f28e7 gskglrenderer: First class support of repeating-radial-gradient 2021-01-27 12:44:10 +01:00
Fabio Lagalla
976a05f6eb gskglrenderer: First class support of repeating-linear-gradient 2021-01-27 12:44:10 +01:00
Fabio Lagalla
b15902bf44 gskglrenderer: Optimize conic-gradient shader 2021-01-27 12:44:10 +01:00
Fabio Lagalla
5ac7529771 gskglrenderer: Optimize radial-gradient shader 2021-01-27 12:44:10 +01:00
Fabio Lagalla
bbf68c0d9d gskglrenderer: Optimize linear-gradient shader 2021-01-27 12:44:10 +01:00
Timm Bäder
d9f6b268d3 gl renderer: Use rect_contains_rect() copy
And this way the contains_rect() inside
rounded_inner_rect_contains_rect() goes from 3.3% to 0.79% in the
fishbowl when rendering the levelbars.
2021-01-17 04:39:26 +01:00
Timm Bäder
4d7a01562e gl renderer: Don't reset offset when drawing offscreen 2021-01-17 04:39:26 +01:00
Timm Bäder
650eed7f72 gl renderer: Properly y-flip non-offscreen children of rounded clips 2021-01-17 04:39:26 +01:00
Timm Bäder
e1cf0cff26 gl renderer: Proper state tracking for color matrix ops 2020-12-21 10:26:03 +01:00
Timm Bäder
634fa772c9 gl renderer: Add missing debug output for repeat ops 2020-12-21 10:26:03 +01:00
Timm Bäder
cde43541d0 gl renderer: Unify new clip/viewport rects in blur_texture() 2020-12-21 10:26:03 +01:00
Matthias Clasen
d5143a1bf0 Revert "gl renderer: Render too big textures to the clipped area"
This reverts commit 7f6608cbed.
2020-12-19 11:43:56 -05:00
Matthias Clasen
12611fa142 Revert "gl renderer: Take a out graphene_rect in blur_node()"
This reverts commit 7eece7e769.
2020-12-19 11:43:43 -05:00
Timm Bäder
7eece7e769 gl renderer: Take a out graphene_rect in blur_node() 2020-12-16 09:13:12 +01:00
Timm Bäder
7f6608cbed gl renderer: Render too big textures to the clipped area 2020-12-16 08:26:46 +01:00
Timm Bäder
f816a8fb82 gl renderer: Unify viewport setting in add_offscreen_ops()
We use the same rect here a few times.
2020-12-16 08:26:46 +01:00
Timm Bäder
33ed42d985 gl renderer: Remove RESET_OPACITY flag
We always need to do that (and always passed the flag to
add_offscreen_ops() anyway).
2020-12-06 20:03:35 +01:00
Timm Bäder
1ee4f6138b gl renderer: Reset opacity when rendering blend node children
We render those on a texture, so we need to reset the opacity because
that will be applied when rendering the resulting texture.
2020-12-06 20:01:36 +01:00
Timm Bäder
7b61ef9e0f gl renderer: Initialize rounded rect early 2020-12-06 19:57:48 +01:00
Timm Bäder
b46d077b3a gl renderer: Fix rendering clipped blurred inset shadow nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
e32331d002 gl renderer: Ignore crossfades between equal texture nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
05928608ec gl renderer: Use scale_x and scale_y everywhere
Try to handle two different values for scale in horizontal and vertical
direction better.

Fixes #3431
2020-12-06 19:18:05 +01:00
Benjamin Otte
2c1bd399d2 glrenderer: Implement a shader for conic gradients 2020-12-03 13:07:17 +01:00
Benjamin Otte
c907ad83b0 glrenderer: Emit more useful error messages
Catch the error when it happens, so that we can emit a specific and more
helpful error message.

Also verify that all branches in the code now do indeed set a proper
GError when they fail, so that the final catch-all is no longer needed.
Instead, assert that the error is set so that we catch future code
additions early that do not set the GError.
2020-12-03 13:07:17 +01:00
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Timm Bäder
da514187f5 gl renderer: Make minimal rounded rects more minimal 2020-11-30 09:21:34 -05:00
Christian Hergert
82b4c34eca gl: add some debugging information to DEBUG_OPS 2020-11-18 20:16:40 -08:00
Christian Hergert
eae5eaeb21 gl: use glFramebufferTexture2D to set framebuffer texture
When mapping a texture to the framebuffer, we can use the 2D
form instead of the cube mapping form.
2020-11-18 20:09:01 -08:00
Benjamin Otte
1c7daece7a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2855
2020-11-17 19:08:01 +00:00
Benjamin Otte
f2284ff40f rendernode: Rename all gsk_render_node_peek_*() functions
Those are getters, they should be gsk_render_node_get_*() functions.
2020-11-17 19:04:39 +01:00
Christian Hergert
12a9164414 gsk: use glFrameBufferTexture2D and release texture
glFrameBufferTexture maps to all faces of a cube and that is not needed
here. Additionally, texture_id is not deleted after we use the additional
flipped texture, but should be.
2020-11-16 09:26:07 -08:00
Timm Bäder
82ca65956f gl renderer: Make debugging code shorter 2020-11-02 14:55:14 -05:00
Timm Bäder
c8c2106f3e gl renderer: Refactor vertex data loading code 2020-11-02 14:55:14 -05:00