Commit Graph

12047 Commits

Author SHA1 Message Date
Matthias Clasen
1ffd8eccee gdk: Enable unity builds
Instruct meson to compile all gsk sources in one pass. This lets
the compiler inline freely between our sources, and is much nicer
than moving functions into the headers as static inlines.
2024-09-09 10:00:05 -04:00
Matthias Clasen
157e60247f vulkan context: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
621bec6af3 toplevel: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
6c1e5b1fa4 texture: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
916108d2c6 surface: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
b499003385 seat: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
46b62aea09 paintable: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
58b711ed97 monitor: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
dbef8b02c3 memory texture builder: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
5553aa421a memory format: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
10587936b9 keys: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
410802b9af gl texture builder: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
b554b516aa gl texture: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
df7f5d083a gl context: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
7de829b4d7 frame clock idle: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
4819cd5155 frame clock: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
2fa94cb2c3 drop: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
12dc857cdf dmabuf texture builder: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
a039a85e44 draw context: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
09e368cffc drag: Prefix statics
This is a step towards enabling unity builds for gdk.
2024-09-09 10:00:05 -04:00
Matthias Clasen
b009d07cdc display manager: Prefix statics
This is a step towards unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
bdaae0b4e2 display: Prefix statics
This is a step towards unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
54acae8036 device: Prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
e0d7da80bf cursor: Prefix statics
This is a step towards unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
fcd9b7245e content serializer: Prefix statics
This is a step towards unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
e29b7d0b0d content provider: Prefix statics
This is a step towards unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
fc9df1308c content deserializer: Prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
1683ab3ca0 colorstate: Cosmetics 2024-09-09 10:00:05 -04:00
Matthias Clasen
56004fd998 clipboard: Prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
e4105228a1 file transfer portal: Prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
dc97b03e69 cicp params: Prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Matthias Clasen
836dcfb173 app launch context: prefix statics
This is a step towards enabling unity builds.
2024-09-09 10:00:05 -04:00
Benjamin Otte
9ba41ed6e8 Merge branch 'wip/otte/blur-and-blit' into 'main'
Fix blur for opaque textures

Closes #6980

See merge request GNOME/gtk!7697
2024-09-09 04:46:43 +00:00
Matthias Clasen
75fa51ef6d Cosmetics
Fix a typo
2024-09-08 19:35:53 -04:00
Benjamin Otte
5e4f692e63 tiff: Store RGBx images as 4 channels
Set the alpha channel to "undefined" in this case.

Gimp doesn't seem to like this when opening the image and insists to
doing something with it, that's a bit of a bummer.

But it allows GTK to load RGBx textures.
2024-09-09 01:25:03 +02:00
Benjamin Otte
ffae0010c4 vulkan: Set VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT
It seems Mesa doesn't support that yet, but having it doesn't hurt.

And it allows drivers to allocate less memory for the swapchains,
because we don't need all the 4 images we request in minImageCount.
But drivers tend to take that minimum image count as gospel, so we need
to use a higher number to not cause lag in corner cases.
2024-09-08 16:22:49 +02:00
Benjamin Otte
6c72a223f5 vulkan: Enable VK_EXT_swapchain_maintenance1 if available
This just adds the plumbing, usage will happen later.

For testing, GDK_VULKAN_DISABLE=swapchain-maintenance will turn it off.
2024-09-08 16:22:49 +02:00
Benjamin Otte
5a027594c3 vulkan: Add gdk_vulkan_context_has_feature()
A siimplification that will come in handy in the future.
2024-09-08 16:22:49 +02:00
Arjan Molenaar
ae0cf9ff54 Merge branch 'amolenaar/focus-im-popups' into 'main'
macos: Fix popup window and keyboard input

Closes #6950 and #5049

See merge request GNOME/gtk!7653
2024-09-08 12:54:24 +00:00
Maximiliano Sandoval
ba32140671
docs: Remove all org.gtk.Method annotations
Removed via regex and grep.
2024-09-07 09:51:32 +02:00
Maximiliano Sandoval
91d36dd410
docs: Remove all org.gtk.Property annotations
Removed via regex and grep.

The following were intentionally not removed:

- GtkImage:file: (attributes org.gtk.Property.set=gtk_image_set_from_file)
- GtkImage:resource: (attributes org.gtk.Property.set=gtk_image_set_from_resource)

As they have no getter and (setter PROP) without a (getter PROP) crash
gobject-introspection. This is fixed by
ad3118eb51.
2024-09-07 09:51:32 +02:00
Maximiliano Sandoval
4fd1e32752
docs: Use correct property gir annotations
The annotations should only be set when the name of the setter or getter
for a property "GtkClassName:prop-name" is not gtk_class_name_g(s)et_property_name.
2024-09-07 09:51:26 +02:00
Matthias Clasen
03b19d8861 docs: Recommend glycin for image loading
Best to send people elsewhere to avoid misunderstandings of our api.
2024-09-06 16:52:47 -04:00
Matthias Clasen
d3db28b3f4 memory format: Add profiler marks
Add profiler marks to our long-running threaded operations.
To avoid spamming profiles too much, only report runs that take
at least 0.5 ms.
2024-09-06 16:14:24 -04:00
Benjamin Otte
896ea5b753 memoryformat: Add linear/nearest choice for mipmaping
linear will average all the pixels for the lod, nearest will just pick
one (using the same method as OpenGL/Vulkan, picking bottom right
center).

This doesn't really make linear/nearest filtering work as it should
(because it's still a form of mipmaps), but it has 2 advantages:

1. it gets closer to the desired effect

2. it is a lot faster

Because only 1 pixel is chosen from the original image, instead of
averaging all pixels, a lot less memory needs to be accessed, and
because memory access is the bottleneck for large images, the speedup is
almost linear with the number of pixels not accessed.
And that means that even for lot level 3, aka 1/8th scale, only 1/64 of
the pixels need to be accessed, and everything is 50x faster.

Switching gtk4-demo --run=image_scaling to linear/nearest makes all the
lag go away for me, even with a 64k x 64k image.
2024-09-06 15:47:35 -04:00
Benjamin Otte
5498b077fd memoryformat: Parallelize gdk_memory_mipmap() 2024-09-06 15:47:34 -04:00
Benjamin Otte
534a9b6ba0 memoryformat: Add fast path for mipmap
We have fast conversion functions, use those directly instead of calling
into gdk_memory_convert().

This is useful because as mentioned before, the main optimization here
is RGB8 => RGBA8 and we have a fastpath for that.
2024-09-06 15:47:34 -04:00
Benjamin Otte
cea961f4f4 memoryformat: Take src_format and dest_format
Why do we need this? Because RGB images are provided in RGB format but
GPUs can't handle RGB, only RGBA, so we need to convert.

And we need to do that without allocating too much memory, because
allocating memory is slow. Which means in aprticular we need to do the
conversion after mipmapping, not before (like we were doing).
2024-09-06 15:47:34 -04:00
Benjamin Otte
848c6815d3 gpu: Allow uploading of mipmap levels when tiling
This allows uploading less memory but requires computing lod levels on
the CPU which is slow because it reads through all of the memory and so
far entirely not optimized.

However, it uses significantly less VRAM.

This is done by adding a gdk_memory_mipmap() function that does this
task.
The texture upload op now accepts a lod level and if that is >0 it uses
gdk_memory_mipmap() on the source texture.
2024-09-06 15:47:34 -04:00
Benjamin Otte
46559039f3 memoryformat: Parallelize gdk_memory_convert_color_state() 2024-09-06 15:47:34 -04:00