Commit Graph

822 Commits

Author SHA1 Message Date
Emmanuele Bassi
478fdaa632 Use atomic boxing instead of manual refcounting
Artisanal, homegrown, locally sourced, vegan reference counting has been
replaced by the appropriate API in GLib, which does small things like
saturation and type checking.
2019-04-29 02:25:18 +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
34fcfb154a gl renderer: Properly apply opacity in cross-fade shader 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
Benjamin Otte
9b6f822f15 rendernode: Fix border rendering
This fixed the reftest introduced in the previous commit.

I'm using a mesh gradient here instead of drawing 4 individual sides to
avoid artifacts when those sides overlap in rounded corners.
2019-04-19 03:39:57 +02:00
Benjamin Otte
3f9b8f25d8 vulkan: Add missing break statement 2019-04-15 14:38:23 +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
Benjamin Otte
8001c7d972 transform: Add gsk_transform_parse()
It uses the new CSS parser.
2019-04-12 19:34:29 +02:00
Benjamin Otte
96f9cbcabf cssimage: Make cross-fade() an array
The new spec at https://drafts.csswg.org/css-images-4/#cross-fade-function
allows infinite images to cross-fade and we want to, too.
2019-04-12 19:34:28 +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
Alexander Larsson
43778bef4d broadway: Add minor comment 2019-03-29 14:30:13 +01:00
Alexander Larsson
f1ba94843e broadway: Move gsk files to a subdirectory 2019-03-29 14:30:13 +01:00
Alexander Larsson
f932d35c95 broadway: Optimize color matrix + texture nodes to pre-colorized texture 2019-03-29 14:30:13 +01:00
Benjamin Otte
c04190e761 rendernode: Round pixel colors in color matrix drawing
Fixes symbolic-icon-translucent-color.ui reftest
2019-03-29 09:56:52 +01:00
Alexander Larsson
9212727f53 broadway: Use css transforms
This allows generic transforms nodes to work.
2019-03-27 19:27:16 +01:00
Alexander Larsson
fbefec52a5 Broadway: Add id for nodes and reuse old ones
When sending render nodes from the client to the daemon we add an id,
and whenever we're about to re-send the entire tree node we instead
send the old id. We track all the nodes for the previous frame
of the surface this way.

Having the id on the daemon side will allow us do to much better deltas.
2019-03-26 17:07:47 +01:00
Alexander Larsson
d59d8b5dd4 Disable accidental debug spew 2019-03-26 17:07:47 +01:00
Alexander Larsson
311aa01e01 broadway: Simplify fallback node cache
Since nodes are now cached we just store the fallback as a
texture in a hashtable indexed by the node. If its unused for
5 frames we drop it.
2019-03-26 17:07:47 +01:00
Alexander Larsson
890b759091 broadway: Send actual float32, not some hack 2019-03-26 17:07:47 +01:00
Alexander Larsson
b097f0a7d8 Broadway: Add node for debug nodes
This can be helpful when debugging broadway.
2019-03-26 17:07:47 +01:00
Alexander Larsson
1b5b1bfd0e broadway: Don't fall back for translation transform nodes
These are trivial anyway
2019-03-26 17:07:47 +01:00
Benjamin Otte
658588dfe7 renderer: Make gsk_renderer_is_realized() public
... and add a property for it.
2019-03-19 08:47:54 +01:00
Benjamin Otte
480d8aec06 renderer: Remove display property
Renderers don't need a display until they get realized. And once they
get realized, they can look up the display from the surface.
2019-03-19 08:47:54 +01:00
Bastien Nocera
884088f649 gsk: API docs fixes
gsk/gskenums.h:181: Error: Gsk: multiple "@GSK_TRANSFORM_CATEGORY_2D" parameters for identifier "GskTransformCategory":
 * @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
    ^
gsk/gsktransform.c:1342: Warning: Gsk: gsk_transform_to_2d: unknown parameter 'm' in documentation comment, should be 'self'
gsk/gsktransform.c:1368: Warning: Gsk: gsk_transform_to_2d: invalid return annotation
gsk/gsktransform.c:1461: Warning: Gsk: gsk_transform_to_translate: unknown parameter 'm' in documentation comment, should be 'self'
2019-03-07 16:29:28 +01:00
Benjamin Otte
18da852e15 rendernode: Add can_diff implementation for transform nodes
That one was missing and killing performance in the fishbowl.
2019-03-06 12:40:58 +01: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
3a3b325f8e transform: Add perspective()
This commit adds gsk_transform_perspective(), gtk_snapshot_perspective()
and support for perspective() in the CSS syntax.
2019-03-05 20:46:00 +01:00
Benjamin Otte
dbe58452d7 rendernode: Implement diffing of transform nodes
This reinstates diffing in the same way that it worked for offset nodes.

It would be possible to add diffing for affine transforms or even all
transforms, but I think this is unnecessary right now - and also quite
expensive to compute.
2019-03-04 23:41:51 +01:00
Benjamin Otte
a8bf5eee0f transform: Readd optimization
This is the optimization from bbd4e2f60d
2019-03-04 23:41:51 +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
1fecbd4241 transform: Store the category in the transform
... instead of computing it every time we need it.

This should be faster and we want to use it a lot more prominently.

Also, we have the struct memory available anyway.
2019-03-04 23:41:51 +01:00
Benjamin Otte
3545abc7a1 transform: Implement gsk_transform_invert()
And use it.

And test it.
2019-03-04 23:41:51 +01:00
Benjamin Otte
70b341139b transform: Remove gsk_transform_identity()
This used to be a good idea back when GskTransform was intended to be
used for transitions, but without it, it's not anymore.
2019-03-04 23:41:51 +01:00
Benjamin Otte
e737b42113 trasnform: Fix print statement
We were printing the wrong variable.
2019-03-04 23:15:24 +01:00
Benjamin Otte
cf00c36c85 transform: Split rotate() and rotate3d() class
This is mainly for accuracy: We can guarantee the math we do for 2D
rotations results in a 2D matrix.
2019-03-04 23:15:24 +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
791bf0c2eb transform: Remove API to poke internals
It is not interesting to users of GskTransform how it is made up
internally. Users should just use the gsk_transform_to_*() APIs.
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
Benjamin Otte
4916280883 transform: Add more API
In particular, add a per-category querying API for the matrix:
- gsk_transform_to_translate()
- gsk_transform_to_affine()
- gsk_transform_to_2d()
- gsk_transform_to_matrix()

This way, code can use the relevant one for the given category.
2019-03-04 23:15:06 +01:00
Benjamin Otte
0e1a50366a transform: Move to GSK
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Timm Bäder
dc282991c6 roundedrect: Add gsk_rounded_rect_to_string
Keep it private for now, but it's very useful when debugging.
2019-02-28 10:33:18 +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
bbd4e2f60d transformnode: Avoid matrix multiplication if we can
If the given matrix is explicitly of category IDENTITY, we don't need to
do anything, and in the 2D_TRANSLATE case, just offset the child bounds.
Those are the two most common cases.
2019-02-28 07:22:34 +01:00