Commit Graph

234 Commits

Author SHA1 Message Date
Timm Bäder
63267a2f70 gl renderer: Render fallback nodes upside down
We stuff both gl-drawn and cairo-drawn textures into the same cache, so
we can't really assume that we need to draw any of them flipped or not.
Fix this by drawing fallback stuff upside down and then using
upside-down vertex data for everything.

Fixes #1897
2019-05-18 13:47:59 +02:00
Timm Bäder
a9fb528a60 gl renderer: Remove an outdated comment 2019-05-18 13:47:59 +02:00
Timm Bäder
ccb9877534 gl renderer: Skip invisible shadows 2019-05-18 13:47:59 +02:00
Timm Bäder
dc7bf31b6e gl renderer: Remove useless ops_offset calls
We add the shadow offset manually.
2019-05-18 13:47:59 +02:00
Benjamin Otte
777beb0d0a glrenderer: Ensure current context for debug stuff 2019-05-08 19:47:40 +02:00
Matthias Clasen
b09a0958a0 gsk: Add tracing to the gl renderer
Emit the equivalent of the cpu-time counter in the inspector.
2019-05-07 09:37:59 -07:00
Timm Bäder
e847c030bd gl renderer: Fix blur nodes with radius 0 2019-05-07 17:21:16 +02:00
Timm Bäder
d5d48af7f7 gl renderer: Reset opacity when offscreen-rendering crossfade nodes
A pattern emerges...
2019-05-05 07:18:39 +02:00
Benjamin Otte
6594ccf716 gsk: Export gsk_gl_renderer_new() 2019-05-05 07:18:39 +02:00
Alexander Larsson
484e330e4a Merge branch 'wip/baedert/fix-gl-debug' into 'master'
Fix GL debugging

See merge request GNOME/gtk!778
2019-04-29 11:42:04 +00:00
Timm Bäder
c848b9014b gl renderer: Add simple blend node implementation 2019-04-28 07:58:31 +02:00
Timm Bäder
931b0b3752 gl renderer: Move texture labeling below initialization
Apparently genTextures and friends only "reserves names", initializing
them will actually create them. Using glObjectLabel on textures before
initializing them will throw a GL_INVALID_VALUE error.
2019-04-27 10:44:37 +02:00
Timm Bäder
1a7c280ebb gl renderer: bind the texture framebuffer before rendering
When rendering to a texture, collecting the render ops might bind a
different framebuffer, so bind the one we want again before doing the
actual rendering.
2019-04-26 18:05:32 +02:00
Alexander Larsson
32edf29c0a GskGLRenderer: Add debug groups
This adds debug groups in various places, including the debug
nodes if those are in use. This makes the traces in tools like
renderdoc much easier to read.
2019-04-25 11:36:21 +02:00
Alexander Larsson
4f7171885f GskGLRenderer: Label various gl objects
This means the names are more useful in tools like renderdoc.
2019-04-25 11:35:00 +02:00
Timm Bäder
e13d242320 gl renderer: Keep op builder around
GL keeps the unoform state per-program, but not per-frame. So, we can't
pretend that this works for us. Keep the RenderOpBuilder around for the
entire lifetime of the renderer instead.
2019-04-24 17:55:14 +02:00
Timm Bäder
91bbe6ef95 gl renderer: Sync gpu and cpu default alpha value
Otherwise we might end up not passing the new value to the GPU.
2019-04-24 13:29:45 +02:00
Timm Bäder
cc878ec00f gl renderer: begin/end_frame around do_render
This fixes rendering to a texture on intel hardware. The glClear calls
would throw a GL_FRAMEBUFFER_INCOMPLETE error here, because the
gsk_gl_driver_begin_frame() call in do_render() reset the framebuffer
object in use.
2019-04-23 17:09:14 +02:00
Timm Bäder
3569348f9c gl renderer: Declare color matrix child separately
Otherwise I'm doing this all the time when debugging.
2019-04-13 06:00:02 +02:00
Timm Bäder
0245ac2106 gl renderer: Apply transform only for final texture drawing
We don't want the new transform while drawing things on a texture.
Instead, only apply the new transform matrix when adding the final
texture drawing ops.

This fixes the stack cube rotation transition to at least look somewhat
better.
2019-03-31 06:16:16 +02:00
Timm Bäder
b2089b89cc gl renderer: Add debug code to dump framebuffer
This way we can specify it on specific add_offscreen_ops callsites.
2019-03-31 06:14:41 +02:00
Timm Bäder
9105de9170 gl renderer: Cache rendered fallback nodes 2019-03-06 06:31:25 +01:00
Timm Bäder
eeed55d45c gl renderer: Mark pointer textures as used
Otherwise we remove them, causing additional texture uploads.
2019-03-06 06:31:25 +01:00
Benjamin Otte
bd113aa85c transform: Redo querying API
Make the API expect a tranform of the proper category instead of
doing the check ourselves and returning TRUE/FALSE.

The benefit is that the mai use case is switch (transform->category)
statements and in those we know the category and don't need to check
TRUE/FALSE.

Using the wrong matrix will now cause a g_warning().
2019-03-04 23:41:51 +01:00
Benjamin Otte
3cc84d2860 transform: Make category public API
Also rename it from GskMatrixCategory to GskTransformCategory.
2019-03-04 23:15:24 +01:00
Benjamin Otte
3a3c2d14ab rendernode: Make the transform node take a GskTransform
This is an attempt to push GskTransform deeper into the stack.
2019-03-04 23:15:07 +01:00
Timm Bäder
7931ab5f33 gl renderer: Change shadow cache eviction strategy
Since we can do partial redraws, dropping every shadow that's been
unused for one frame happens too fast. This is also a problem when a
shadow gets drawn on a texture for a few frames.
2019-02-28 10:33:18 +01:00
Timm Bäder
416a4cf5ea gl renderer: Ignore nodes with nan bounds
This can happen for certain transform nodes. The transform node's
child's bounds are fine, but the transform node bounds are all nan.
Just ignore those bounds since we can't meaningfully render them anyway.
2019-02-28 07:22:34 +01:00
Timm Bäder
5577e30ad4 gl renderer: Add more nodes that support transforms 2019-02-28 07:22:34 +01:00
Timm Bäder
e836c575ce gl renderer: Remove GskRoundedRect initializaion 2019-02-25 08:46:27 +01:00
Timm Bäder
47fb1ec4c4 gl renderer: Partially implement rounded rect intersection
Some rounded rect intersections can actually be done and even expressed
as a single rounded rectangle.
2019-02-25 08:46:27 +01:00
Timm Bäder
f0624266dc gl renderer: Add debug function to dump render node 2019-02-25 08:46:27 +01:00
Timm Bäder
58c2bea959 gl renderer: Stop determining the matrix category ourselves
Use the category we get from transform nodes and add ops_ API to supply
one when we set a graphene_matrix_t directly.
2019-02-25 08:37:06 +01:00
Timm Bäder
f9041230c6 gl renderer: Round size up when rendering to a texture
Both the clip we use and the viewport we set should contain the entire
texture size and not potentially clip the last pixel.
2019-02-23 04:50:25 +01:00
Timm Bäder
da0bd697b8 gl renderer: Use the matrix node category 2019-02-22 19:08:43 +01:00
Benjamin Otte
6a4bf2b993 gsk: Remove offset nodes
They were a neat idea while they lasted. But now, it's time for
categorized transform nodes, where matrices with
GSK_MATRIX_CATEGORY_2D_TRANSLATE are the exact replacement.

Renderers have not been adapted for this purpose, so they (continue to)
run slow paths.
2019-02-21 19:47:28 +01:00
Timm Bäder
a872c41f79 glglyphcache: Fix dropping caches unnecessarily
The first set of glyphs is created with a timestamp of 1. Later we
subtract the glyph timestamp from the cache timestamp, meaning we end up
with numbers ending in 9, e.g. 59. Now unfortunately !(60 <= 59), so we
do not end up incrasing the old_pixels count of the cache. Later we then
call lookup() and DEcrease the old_pixels count, which makes the
unsigned int wrap and cause a huge old_pixels value, which causes us to
drop the cache.
2019-02-10 10:31:27 +01:00
Timm Bäder
ea554580c7 glglyphcache: Remove surface member from dirty glyph
We don't use it after we've rendered to it, just its size and data.
2019-02-10 10:31:27 +01:00
Benjamin Otte
359bc7695c build: Reintroduce warning flags from autotools
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.

It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
2019-01-22 04:33:12 +01:00
Timm Bäder
8e0cbc1c3d gl renderer: Support (not) resetting the opacity for offscreen nodes
We usually want to do that, but it's wrong for e.g. crossfade nodes.
2019-01-18 19:43:54 +01:00
Timm Bäder
e14fe222e8 gl renderer: Don't add clip ops if the clip didn't change 2019-01-18 19:40:49 +01:00
Timm Bäder
59bf76dce1 gl renderer: Force blur shadow node children offscreen
This broke the overlay blur demoe when resizing the window to a size
that would completely move the image below a button, causing the
GtkSnapshot code to remove the clip node below the blur node.
2019-01-13 08:41:37 +01:00
Timm Bäder
d55fc8b7b1 gl renderer: Dont't try to draw glyphs at scale 0
Fixes #1475
2019-01-10 17:14:48 +01:00
Timm Bäder
e72d0a9118 gl glyphcache: Only support one dirty glyph per atlas 2019-01-10 16:49:19 +01:00
Timm Bäder
fb7d033953 gl renderer: Remove debug code 2019-01-10 16:49:19 +01:00
Timm Bäder
cfa440bbae gl renderer: Fix hidpi transform nodes 2019-01-10 16:49:19 +01:00
Timm Bäder
b0a8b7da63 gl renderer: Only compile the vertex shader once
All our programs use the same vertex shader, so don't compile it over
and over again. This improves startup times by at least 0.001%, I swear.
2019-01-10 16:49:19 +01:00
Timm Bäder
b2ff6e91cd gl renderer: Don't forget the offset when rendering blur nodes 2019-01-10 16:49:19 +01:00
Timm Bäder
1d3aa9207c gl renderer: Add a clip stack
So we can check that the currently set clip is the first one and now
intersect with it. This first clip is always the entire viewport or the
entire render_area and we don't want to end up drawing things to a
texture because of it.
2018-12-31 12:44:02 +01:00
Timm Bäder
3ce45508e1 gl renderer: Track border width state separately 2018-12-07 16:36:10 +01:00