Commit Graph

80769 Commits

Author SHA1 Message Date
Benjamin Otte
058252e895 vulkan: Can't blit to/from formats with a swizzle
Fixes grayscale images appearing red on some hardware.

Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11467
2024-07-08 10:51:37 +02:00
Benjamin Otte
c594de8302 vulkan: Code more defensively
Check for identity swizzle too, even though we don't use it.
2024-07-08 10:51:37 +02:00
Benjamin Otte
b0f8550b01 Merge branch 'wip/otte/for-main' into 'main'
gpu: Refactor parts of nodeprocessor

See merge request GNOME/gtk!7421
2024-07-07 14:01:55 +00:00
Benjamin Otte
ba05963729 gpu: Make get_node_as_image() always return premultiplied images
We wanted premultiplied images in all cases anyway, and moving that
requirement means we can also move the caching code for re-caching
textures into the texture specific code.
2024-07-07 14:39:07 +02:00
Benjamin Otte
f14f7e7df6 gpu: Add GSK_GPU_DISABLE=offscreen
This uses offscreens for every call to get_node_as_image().

This is useful both for benchmarking benefits of those implementations
as well as checking that the node-specific paths produce identical
results.
2024-07-07 14:39:07 +02:00
Benjamin Otte
daa97d4b79 gpu: Refactor functions
gsk_gpu_node_processor_ensure_image() was a weird amalgamation of stuff
withe weird required and disallowed flags.

Refactor it to make the two operations we actually do there more
explicit: Removing straight alpha and generating mipmaps.

This untangling is also desirable in the future when we also want to
handle colorstates here.
2024-07-07 14:39:07 +02:00
Benjamin Otte
4822b85cb0 gpu: Make gsk_gpu_node_processor_get_node_as_image() more restrictive
Always return premultiplied images.

2 fallback cases for clip and transform nodes did not require that. If
those cases turn out to be important, they can call
gsk_gpu_get_node_as_image() directly as that's the more flexible option.
2024-07-07 14:39:07 +02:00
Benjamin Otte
7f61d7ac8b gpu: Implement get_node_as_image() for subsurface nodes
Pass through to the child instead of offscreening.

I mainly implemented it for the assertion, because this might be a
sneaky way to introduce bugs without exhaustive checking that we don't
offload stuff that is offscreened.

No actual bugs that I'm aware of, so no tests.
Strictly defensive coding.
2024-07-07 14:39:04 +02:00
Benjamin Otte
010ca5feef gpu: Implement get_node_as_image() for debug nodes
Just pass through to the child instead of offscreening.
2024-07-07 12:54:05 +02:00
Benjamin Otte
31a907be35 gpu: Make sure textures used as image are mipmapped
When getting a texture as image, we were always returning the texture
unconditionally.

However, we want to mipmap textures when the scale factor is too large,
and this code path did not do that.

The same codepath on the GL renderer doesn't do that either, so the test
is disabled for it.
2024-07-07 12:54:05 +02:00
Benjamin Otte
ab37fed974 gpu: vfuncify get_node_as_image()
The switch statement was ugly.

Plus, the code should be close to the add_node() vfunc implementation,
so they can be modified together.

See future commits for an example where this matters.
2024-07-07 12:54:05 +02:00
Benjamin Otte
10a7650411 testsuite: Generate mask correctly
There's a corner case with width/height being exactly 25 pixels.
And of course I was hitting it with one of my tests.
2024-07-07 12:54:05 +02:00
Benjamin Otte
fc4c6525e6 Merge branch 'wip/otte/for-main' into 'main'
gpu: Remove the ubershader

See merge request GNOME/gtk!7419
2024-07-07 10:52:51 +00:00
Benjamin Otte
d7308f2d73 gsk: Rename GSK_DEBUG=glyphcache to GSK_DEBUG=cache
1. I mistype it all the time
2. It's shorter
3. We use it for all caching these days, not just glyphs.
2024-07-07 05:24:45 +02:00
Benjamin Otte
ead566b841 rendernode-tool: Hide window background when --undecorated
We want to only show the node, nothing else. So getting rid of as much
CSS as possible is good.
2024-07-07 05:19:32 +02:00
Benjamin Otte
ecc2e02453 rendernode-tool: Add a GtkWindowHandle
Make the whole window area draggable, like usually the titlebar.

This is especially useful with --undecorated.
In that case we need to make the window non-resizable though, becuase
otherwise it can be accidentally maximized and whatnot.
2024-07-07 05:19:32 +02:00
Benjamin Otte
012c4b9425 gpu: Remove the ubershader
It didn't bring any noticable benefits and it isn't compatible with the
way we intend to do colorstate support.

And nobody seems to want to spend time on it, so let's get rid of it.

We can bring it back later if someone wants to work on it.
2024-07-07 05:19:32 +02:00
Benjamin Otte
be8fef9811 Merge branch 'wip/otte/for-main' into 'main'
rendernode-tool: Show the whole node

See merge request GNOME/gtk!7417
2024-07-05 19:46:39 +00:00
Scrambled 777
2938b48939 Update Hindi translation 2024-07-05 17:11:31 +00:00
Benjamin Otte
16c2e0a642 gl: Use GdkTextureDownloader
Cairo surfaces are so outdated.
2024-07-05 13:55:18 +02:00
Benjamin Otte
c43c0275e3 testsuite: Improve memorytexture printing code
* The variables are const. Keep them const when casting

* Print float16 values

* Print integer values as hex. This is better for detecting
  byteswapping, off by one, and such. Besides, we tend to use values
  that have the same 2 hex digits, so detecting corruption is also easy.
2024-07-05 13:16:56 +02:00
Benjamin Otte
df5d233155 testsuite: Print the right pixel
Typo made us pass the wrong values
2024-07-05 13:16:56 +02:00
Benjamin Otte
a8238c2251 testsuite: Make png file argument optional
Just default to the node file but with a .png extension.
2024-07-05 10:43:28 +02:00
Benjamin Otte
c12d1fe29c rendernode-tool: Show the whole node
When the node had negative coords, those were cut off.

Translate by the node's origin to avoid this.
2024-07-05 05:49:15 +02:00
Benjamin Otte
347cdc63f8 Merge branch 'wip/otte/deprecate-gl-shader' into 'main'
gsk: Deprecate GskGLShader and the rendernode

See merge request GNOME/gtk!7415
2024-07-04 22:04:57 +00:00
Benjamin Otte
32625381fa gsk: Deprecate GskGLShader and the rendernode
The new renderers don't support them due to the required complexity of
integrating them with Vulkan and the assumptions those nodes make about
the renderer (the GL renderer exports its internal APIs into the
GLShader).

There haven't been any complaints that I'm aware of since 4.14 was
released where the default renderer does not support the nodes, so usage
in public seems to be close to nonexistant.

The 2 uses I know of were workarounds about missing features in GTK that
have stopped since GTK now supports them:

1. GStreamer used in to do premultiplication when the old GL renderer
   did not do so in hardware but on the CPU.
2. Adwaita used it for masking before the mask node wa added in 4.10.
2024-07-04 21:28:06 +02:00
Emmanuele Bassi
e6d22fd8df Merge branch 'ebassi/docs-wiki-links' into 'main'
Drop references to the GNOME wiki from the docs

See merge request GNOME/gtk!7413
2024-07-04 12:23:18 +00:00
Ekaterine Papava
8e2de53c3f Update Georgian translation 2024-07-04 11:40:07 +00:00
Emmanuele Bassi
0057af3668 Drop references to the GNOME wiki from the docs
The GNOME wiki is getting decommissioned and archived:

  https://gitlab.gnome.org/Teams/Websites/General/-/issues/311

While the pages will still exist, it's better to direct people to
locations that are actively maintained.
2024-07-04 12:03:19 +01:00
Matthias Clasen
77cf390727 Merge branch 'nullable-widget' into 'main'
eventcontroller: mark get_widget as nullable

See merge request GNOME/gtk!7359
2024-07-04 09:45:42 +00:00
tszymanski
dcadf1422b eventcontroller: mark get_widget as nullable 2024-07-03 21:48:35 -07:00
Matthias Clasen
53ac80d6c8 Merge branch 'matthiasc/for-main' into 'main'
wayland: Add debug spew

See merge request GNOME/gtk!7412
2024-07-04 02:19:54 +00:00
Matthias Clasen
2e9fcdad6e wayland: Add debug spew
Trying to track down ci failures from cursor theme loading.
2024-07-03 21:42:57 -04:00
Benjamin Otte
0f55b3bc18 Merge branch 'wip/otte/for-main' into 'main'
gpu: Split out the cache

See merge request GNOME/gtk!7411
2024-07-03 19:51:10 +00:00
Benjamin Otte
9c249fefc3 gpu: Improve periodic cache debug message
I was watching the log in my terminal and nothing happened.
And I wasn't sure if that was because nothing was printed or because the
same thing was printed every few seconds.

Fix that by printing a timestamp, so that in a few seconds something
else will be printed.
2024-07-03 20:36:56 +02:00
Benjamin Otte
eae7ee6c25 gpu: Track atlas differently
Previously we tracked the dead pixels, but that meant we didn't know the
alive pixels (because there's also unused pixels never accounted for).
And we would free the current atlas randomly due to that.

Now we track if any pixels are alive, and if so, we never gc the current
atlas.
2024-07-03 20:36:56 +02:00
Benjamin Otte
bf7f302ff5 gpu: gc atlas, too
After 60s, we gc the atlas, too. This ensures that after that time, we
free all cache resources, so if an application gets moved to the
background, it will no longer use GPU resources. (Well, at least the
cache won't.)
2024-07-03 19:55:18 +02:00
Benjamin Otte
0d6981bd54 gpu: Make the cache track if it's empty
Only if a non-stale item is in the cache do we consider the cache not
empty.

Once the cache is empty, the device frees it and stops running the
periodic GC.
2024-07-03 19:55:18 +02:00
Benjamin Otte
148d7bcc25 gpu: Don't remove gc timeout unless cache is empty
If the cache isn't empty, we want to rerun the GC.
2024-07-03 19:55:18 +02:00
Benjamin Otte
71161b6352 gpu: Split cache and device
This is for 3 reasons:

1. Separation of concerns
   The device is meant to manage the Vulkan/GL device and check stuff
   like image sizes.
   Caching is not part of that.

2. Refcounting
   Images etc want to reference the device, but the cache wants to
   reference images. If the cache is the device, that's a refcycle.

3. Flexibility
   It's now easier to implement >1 cache, say one per depth or one per
   color state.
2024-07-03 19:55:15 +02:00
Benjamin Otte
dd33a2f280 rendernode: Make sure depth variable has enough bits
This will be relevant when we add new values to it.
2024-07-03 19:55:15 +02:00
Emmanuele Bassi
9d48d684a5 Merge branch 'ebassi/closure-fixes' into 'main'
Use the appropriate annotations for callback closures

See merge request GNOME/gtk!7410
2024-07-03 17:34:48 +00:00
Matthias Clasen
eb252d33a9 Merge branch 'expander-non-child' into 'main'
expander: Don't leave dangling a11y relations

See merge request GNOME/gtk!7409
2024-07-03 17:24:44 +00:00
Emmanuele Bassi
40bdf7e0d4 Use the appropriate annotation for callbacks
All the callback-related annotations must go on the callback parameter:

- scope type
- closure arg-name
- destroy arg-name
2024-07-03 18:04:27 +01:00
Matthias Clasen
6aba047ace expander: Don't leave dangling a11y relations
If we unparent the widget, we should sever a11y relations too.
Otherwise, an a11y implementation might follow them and be surprised
to find a parentless widget (and not in a good way).

Updated tests to not check the relation on an unexpanded expander.
2024-07-03 12:55:15 -04:00
Emmanuele Bassi
554045de6e Use the appropriate annotations for a callback closure
The (closure) annotation with an parameter is meant to be used on the
callback argument, and point to the user data argument.
2024-07-03 17:21:04 +01:00
Emmanuele Bassi
fa42081556 Use the appropriate annotations for callback closures
The unary (closure) annotation is for function pointer types; function
arguments that represent the user data to be passed to the callback are
annotated on the callback argument itself, with (closure arg-name).
2024-07-03 16:57:47 +01:00
Artur S0
54d0bcab71 Update Russian translation 2024-07-03 11:35:15 +00:00
Benjamin Otte
3539128d42 memoryformat: Split out a function
It's used in many places and attaching a name to what it does is useful.
2024-07-03 04:16:56 +02:00
Matthias Clasen
372c68a1c9 Merge branch 'matthiasc/for-main' into 'main'
gsk: Avoid a crash

See merge request GNOME/gtk!7408
2024-07-02 20:19:47 +00:00