Commit Graph

80862 Commits

Author SHA1 Message Date
Benjamin Otte
d8059ebdd2 gpu: "Implement" GL shader nodes
Instead of falling back to Cairo, draw the pink error rectangle
directly.
2024-07-11 13:34:36 +02:00
Benjamin Otte
1001445d3e testsuite: Add test for empty glshader node
Everyone should draw the error pink here, because that's what the
renderers not supporting it do, and it's also what the default shader
does.

So no matter if a renderer supports GL shaders or not, it should draw
the same pink.
2024-07-11 13:34:36 +02:00
Benjamin Otte
fff72cf322 dmabuf: Add gdk_dmabuf_close_fds()
... and use it inside GtkGLArea

I made thatfunction available outside of HAVE_DMABUF so I don't need to
wrap it in ifdefs.
2024-07-11 13:34:36 +02:00
Matthias Clasen
7c0c2a8085 Merge branch 'wip/otte/dihedral' into 'main'
gpu: Add support for "dihedral" transforms

See merge request GNOME/gtk!7436
2024-07-10 23:47:39 +00:00
Matthias Clasen
b5b58ced2a Add gdk_dihedral_get_name
And use it everywhere we want to print out debug spew about
dihedral transforms.
2024-07-10 22:11:13 +02:00
Matthias Clasen
8c988a7b07 Take all transforms into account
When determining which way is up for the offloaded texture, we
must take all transforms into account - the ones outside the
subsurface node, and the ones inside.
2024-07-10 22:11:13 +02:00
Matthias Clasen
e68f58940c offload: Add more debug spew
Print what transform we are passing to the compositor.
Helps for debugging transforms.
2024-07-10 22:11:13 +02:00
Benjamin Otte
4f2b639a24 gpu: We can handle 90 degree rotations quite easily 2024-07-10 22:06:24 +02:00
Benjamin Otte
3e01924ca3 gpu: Handle dihedral transforms in occlusion culling 2024-07-10 22:06:24 +02:00
Benjamin Otte
3841ae935c surface: Cleanup 2 nonexisting functions from header 2024-07-10 21:34:12 +02:00
Matthias Clasen
4d2884bde7 offload: Support dihedral transforms
When looking for the texture transform, allow dihedral transforms,
and pass them along when attaching to the subsurface.
2024-07-10 21:34:12 +02:00
Matthias Clasen
a4a7255216 subsurface: Fix a precondition
When checking that the texture fits the area, take the transform
into account.
2024-07-10 21:34:12 +02:00
Benjamin Otte
6065165060 Add gdk_dihedral_swaps_xy
This function determines if a dihedral transform swaps x and y.
2024-07-10 21:34:12 +02:00
Matthias Clasen
61c22d1c72 Add a test for dihedral transforms
This reveals that the multiplication and inverse aren't quite
right.
2024-07-10 21:34:12 +02:00
Benjamin Otte
efacf2ff09 testsuite: Add tests for dihedral transforms
Just to make sure stuff shows up in the right place.
2024-07-10 21:34:12 +02:00
Benjamin Otte
9272bf96f6 gpu: Handle affine transforms without touching matrix
By moving negative affines to be treated like dihedrals, because they
also need support of the modelview, we can free up the affine branch for
doing work without it.

Not a big win I guess, but it makes scaling more efficient.
2024-07-10 21:34:12 +02:00
Benjamin Otte
ae3efb2d2f gpu: Implement transform support for dihedral transforms
This allows handling them without ever needing to offscreen for losing
the clip, because the clip can always be transformed.

Also, all the optimizations keep working, like occlusion culling,
clears, and so on.

The main benefit of this work is the ability for offloading to now
handle dihedral transforms of the video buffer.

The other big advantage is that we can now start our rendering with a
dihedral transform from the compositor.
2024-07-10 21:34:12 +02:00
Benjamin Otte
b9ecae84f5 gpu: Shuffle some transform flags around
No need to check for negative numbers now that we can just use the
category that doesn't give us any.
2024-07-10 21:34:12 +02:00
Benjamin Otte
cd3286c71a gpu: Switch to GskFineTransformCategory
This is purely replacing the enums, no functional changes.
2024-07-10 21:34:12 +02:00
Benjamin Otte
83c2766e3f rendernode: Handle rotation transforms in opacity calculations
Tests included.
2024-07-10 21:34:12 +02:00
Benjamin Otte
5f719c8ea3 transform: Implement transform_point() for dihedrals
No longer using the default path and risking rounding issues.
2024-07-10 21:34:12 +02:00
Benjamin Otte
555f7d5404 transform: Implement transform_bounds() for dihedrals
No longer using the default path and risking rounding issues.
2024-07-10 21:34:12 +02:00
Benjamin Otte
3bcfc5539c transform: Add gsk_transform_to_dihedral()
I hate everything about this.

Is is xy or yx now?
Do I need to combine(a, b) or combine(b, a)?
2024-07-10 14:38:48 +02:00
Benjamin Otte
4cfcc7e521 wayland: Check that the enums match
They do, but better safe than sorry
2024-07-10 12:36:07 +02:00
Benjamin Otte
3221a8bdab gdk: Rename GdkTextureTransform to GdkDihedral
... and put it into its own header.

We want to use it in more places and the name and location are awkward.
2024-07-10 12:36:07 +02:00
Benjamin Otte
930f059f5e transform: Introduce GskFineTransformCategory
This category does a finer-grained categorization than
GskTransformCategory, but it is deliberatedly made to allow
easy backwards compatibility.

The reason for the categories is that they fit our renderers more
fine.

In particular, it allows implementing wl_output_transform support more
efficiently, thereby allowing rendering buffers the right way for
rotated phone screens or monitors.
2024-07-10 12:36:07 +02:00
Benjamin Otte
bd3e596243 Merge branch 'wip/otte/for-main' into 'main'
rect: There's no coverage witout overlap

Closes #6849

See merge request GNOME/gtk!7435
2024-07-09 23:39:51 +00:00
Benjamin Otte
9a6e61e510 rect: There's no coverage witout overlap
The rectangles need to touch/overlap in both directions, otherwise
there's no coverage that covers both rectangles.

Test included.

Fixes rendering glitches in various apps when redrawing.

Fixes: #6849
2024-07-10 00:28:33 +02:00
Matthias Clasen
56d2d65e25 Merge branch 'css-color-fixes' into 'main'
css: Resolve color coordinates properly

Closes #6833

See merge request GNOME/gtk!7430
2024-07-09 14:20:00 +00:00
Martin
ae08963acc Update Slovenian translation 2024-07-09 03:59:54 +00:00
Matthias Clasen
ed4f51436c Merge branch 'matthiasc/for-main' into 'main'
Add a missing include

Closes #6842

See merge request GNOME/gtk!7433
2024-07-09 03:04:25 +00:00
Matthias Clasen
7837354c6c Add a missing include
When building without Vulkan, we don't get this include for free.
So add it explicitly.

Fixes: #6842
2024-07-08 22:18:11 -04:00
Benjamin Otte
a203a28de0 Merge branch 'wip/otte/for-main' into 'main'
First set of occlusion culling fixes improvements

See merge request GNOME/gtk!7431
2024-07-08 21:51:46 +00:00
Benjamin Otte
5dc6f134c5 gpu: Make offscreening code use process()
... instead of init_draw(); add_node(); finish_node();

We hook into the infrastructure one step earlier and close to where the
default renderer_render() and renderer_render_texture() arrive in the
nodeprocessor.

Why is this relevant?
Because process() does occlusion culling.

TL;DR: offscreens do culling now
2024-07-08 23:22:55 +02:00
Benjamin Otte
6daeb7e504 gpu: Transition exported textures into GENERAL layout
We import them as general, so they should be exported like that.

This was a longstanding issue that I never got around to fixing and I'm
touching this code anyway atm.
See commit 3aa6c27c26 for more details.
2024-07-08 23:22:41 +02:00
Benjamin Otte
fcf59ad135 gpu: Allow NULL as clear color
NULL disables clearing. We only implement this for GL as in Vulkan we'd
need to create different renderpasses with different attachment
descriptions and that would require more plumbing.
2024-07-08 23:07:36 +02:00
Benjamin Otte
1dd905d976 gpu: Fix wrong rect check in occlusion fallback path
We need to check that the clip is inside the opaque region, not that the
opaque region is inside the clip.

Test included, using the only not that hits the fallback path with an
opaque region smaller than its bounds.
2024-07-08 23:07:36 +02:00
Benjamin Otte
155f7cdeec gpu: Chceck if a container node is opaque as fallback
Sometimes container nodes contain lots of overlapping opaque items. In
that case we can use the container node itself as the first node even
though none of the children cover the whole paint area.

The use case for this is a grid of cells like in a terminal where all
the cells are opaque and we want to avoid drawing the background behind
them.
2024-07-08 23:07:36 +02:00
Matthias Clasen
960967623a Add css value tests
Add some tests that check the details of calling compute() and
resolve() on number and color values.
2024-07-08 16:47:29 -04:00
Matthias Clasen
3c963f65a2 css: Short-circuit resolve like compute
This is the same idea: if the value doesn't contain currentcolor
(ie is already resolved), no need to resolve it again.
2024-07-08 16:09:35 -04:00
Matthias Clasen
168203ab0c css: Fix a font-weight parser test
0 is not a valid font weight.
2024-07-08 16:09:35 -04:00
Matthias Clasen
f2fff53169 testsuite fixes 2024-07-08 16:09:35 -04:00
Matthias Clasen
f74b8f715a css: Fix legacy relative colors
If the color was specified using the legacy rgb(), we must accept
values in the range [0, 255]. But when serializing it as
color(srgb...), we must scale those values to [0, 1].

Update the one affected test.
2024-07-08 16:09:35 -04:00
Matthias Clasen
aeac2b547f css: Fix confusion about computed numbers
As for colors: is_computed means that calling compute() won't change
the value. We need to make sure that after calling compute(), the
flag is set.
2024-07-08 16:09:35 -04:00
Matthias Clasen
827aa9ca05 css number value: More color coord fixes
Always use gtk_css_number_value_new_color_component to create
new color component values, and make that function simplify things
as far as possible.
2024-07-08 16:09:35 -04:00
Matthias Clasen
95c21acec1 css: For color, inherit the used value
When the color property is inherited, don't resolve the inherited
value to find the used value, just inherit the used value of the
parent style.

This is what browsers do, even though the spec says something else.

Update the currentcolor4 style test to reflect these changes.

Fixes: #6833
2024-07-08 14:53:00 -04:00
Matthias Clasen
4d035dce5d css: Fix confusion about computed colors
We were not handling the is_computed and contains_current_color
flags correctly when creating new color values. Set these flags
propertly. is_computed means: calling compute() won't change the
value. contains_current_color means what it says.
2024-07-08 14:53:00 -04:00
Matthias Clasen
7f6dce1c22 Add another css style test 2024-07-08 14:53:00 -04:00
Matthias Clasen
58568a36ce css: Handle relative colors properly 2024-07-08 14:53:00 -04:00
Matthias Clasen
9c2a2f01b7 css: Resolve color coordinates properly
We were not resolving currentcolor in color coordinates.

Implement resolve for number values to fix that.
2024-07-08 14:53:00 -04:00