Commit Graph

81782 Commits

Author SHA1 Message Date
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
Benjamin Otte
eb7a42bc13 memoryformat: Parallelize generic path of gdk_memory_convert() 2024-09-06 15:47:34 -04:00
Benjamin Otte
ffe56fe6b3 memoryformat: Parallelize
Refactor code so that it uses g_parallel_task_run().
2024-09-06 15:47:34 -04:00
Benjamin Otte
d4ba57fcc3 gdk: Add gdk_parallel_task_run()
This is just the API. Users will come later.

I considered putting it into gdkmemoryformat.c because it's likely gonna
be the only user and this one function is so little code, but it didn't
fit at all.
So now it's a new file.
2024-09-06 15:47:34 -04:00
Benjamin Otte
a95c9ebc51 memoryformat: Split out a function
Allow querying the fast conversion functions outside of
gdk_memory_convert().
2024-09-06 15:47:34 -04:00
Benjamin Otte
9195c39756 build: Alphabetic order is hard 2024-09-06 15:47:34 -04:00
Juliano de Souza Camargo
866c83909c Update Brazilian Portuguese translation 2024-09-06 13:00:13 +00:00
Luca Bacci
4965b7b6fa Merge branch 'wgl-updates' into 'main'
WGL Updates

Closes #6975

See merge request GNOME/gtk!7692
2024-09-06 12:47:41 +00:00
Andika Triwidada
3a2b8f94ec Update Indonesian translation 2024-09-06 04:13:55 +00:00
Matthias Clasen
3a5933a519 Merge branch 'mcatanzaro/#6983' into 'main'
popover: fix critical on pop down

Closes #6983

See merge request GNOME/gtk!7691
2024-09-06 00:14:09 +00:00
Matthias Clasen
4c295dc49c popover: Avoid unnecessary work
If the popover isn't visible, no need to do any extra
'cascade' work. This also helps to avoid running into
trouble during finalization when the parents are already
gone.
2024-09-05 15:27:55 -04:00
Emin Tufan Çetin
03ebb41262 Update Turkish translation 2024-09-05 18:02:12 +00:00
Yaron Shahrabani
b0c3265561 Update Hebrew translation 2024-09-05 12:43:43 +00:00
Danial Behzadi
98943b28aa Update Persian translation 2024-09-05 12:16:59 +00:00
Vasil Pupkin
c354c5a63d Update Belarusian translation 2024-09-05 10:03:35 +00:00
Tim Sabsch
2f8cb9b2d0 Update German translation 2024-09-04 18:21:04 +00:00
Luca Bacci
7559a87e8a WGL: Detect MESA D3D12 driver and request GDI compatibility
This way we get a non-opaque framebuffer / render target

Fixes #6975

References:
  [1] https://gitlab.gnome.org/GNOME/gtk/-/issues/6975
  [2] https://gitlab.freedesktop.org/mesa/mesa/-/issues/11828
2024-09-04 20:02:44 +02:00
Luca Bacci
b2394691cc Inspector: Fix append_wgl_extension_row()
wglGetExtensionsStringARB takes an HDC argument even though it
checks extensions for the current context. This was done for future
extensibility. From [1]:

>    Should this function take an hdc? It seems like a good idea. At
>    some point MS may want to incorporate this into OpenGL32. If they
>    do this and and they want to support more than one ICD, then an HDC
>    would be needed.

Currently the HDC argument is unused, but still wglGetExtensionsStringARB()
is required to check if HDC is valid:

>    If <hdc> does not indicate a valid device context then the function
>    fails and the error ERROR_DC_NOT_FOUND is generated. If the function
>    fails, the return value is NULL. To get extended error information,
>    call GetLastError.

So wglGetExtensionsStringARB fails if we pass NULL. Here we can pass any
valid HDC, like for example the screen DC returned by GetDC(NULL), but
probably using wglGetCurrentDC() makes most sense.

Reference:
  [1] - https://registry.khronos.org/OpenGL/extensions/ARB/WGL_ARB_extensions_string.txt
2024-09-04 20:02:29 +02:00
Yuri Chornoivan
5a94004b59 Update Ukrainian translation 2024-09-04 16:46:15 +00:00
Michael Catanzaro
3bd609d77c popover: fix critical on pop down
It's expected that there may be no parent widget to grab focus.

This fixes 2299c02639.

Fixes #6983
2024-09-04 11:25:50 -05:00
Luca Bacci
84d2961a91 Inspector: Sync WGL extensions with GdkWin32GLContextWGL
Replace WGL_EXT_pixel_format with WGL_ARB_pixel_format and drop
WGL_ARB_MULTISAMPLE (unused).
2024-09-04 17:10:39 +02:00
Luca Bacci
3a9f26113f WGL: Fix attribs_remove_last() 2024-09-04 17:07:01 +02:00
Luca Bacci
6a240c36ac WGL: Swap core / compat in debug output 2024-09-04 17:04:58 +02:00
Luca Bacci
aaf4261969 WGL: Include renderer string in debug output 2024-09-04 17:03:54 +02:00
Luca Bacci
5dceb7f7d2 WGL: Make context current to get debug info
Otherwise we get NULL from glGetString()
2024-09-04 17:02:20 +02:00
Martin
3372b1a84b Update Slovenian translation 2024-09-04 14:26:58 +00:00
Luming Zh
75a4eca13a Update Chinese (China) translation 2024-09-04 13:21:40 +00:00
Jordi Mas i Hernandez
13f0ab881e Update Catalan translation 2024-09-04 12:40:06 +00:00
Fran Dieguez
d4b45526b2 Update Galician translation 2024-09-04 06:34:09 +00:00
Fran Dieguez
c06e1f4848 Update Galician translation 2024-09-04 06:11:36 +00:00
Matthias Clasen
6a4a52d110 Merge branch 'Enokilis-main-patch-44493' into 'main'
Typo in gtk/gtkcssprovider.c

See merge request GNOME/gtk!7688
2024-09-03 21:07:50 +00:00
Matthias Clasen
ed6f5b8755 Merge branch 'stroke-autoptr' into 'main'
gsk: Add autoptr cleanup function for GskStroke

See merge request GNOME/gtk!7690
2024-09-03 17:15:10 +00:00
Philip Withnall
e87b4dca71
gsk: Add autoptr cleanup function for GskStroke
It appeared to be missing, while other GSK types already have cleanup
functions defined.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-09-03 16:50:10 +01:00
Benjamin Otte
567c8b5ab3 Merge branch 'wip/smcv/debug-gsk-scaling-test' into 'main'
gsk/scaling test: Improve debuggability on failure

See merge request GNOME/gtk!7680
2024-09-03 15:30:32 +00:00
Benjamin Otte
7aeca0512c Merge branch 'wip/smcv/bug6977' into 'main'
scaling test: Fix intermittent failure with alpha = 0

Closes #6977

See merge request GNOME/gtk!7684
2024-09-03 15:27:20 +00:00
Matthias Clasen
5567934fc9 Merge branch 'wip/smcv/misc-realize' into 'main'
testsuite: If gsk_renderer_realize() fails, say why

See merge request GNOME/gtk!7686
2024-09-03 11:11:11 +00:00
Daniel Mustieles
63bece1fe7 Update Spanish translation 2024-09-03 09:25:56 +00:00
Simon McVittie
ad3c285fc6 scaling test: Show the input and expected average after each failed test
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:19:16 +01:00
Simon McVittie
47c461b25b testsuite: Show pixel format of texture pixels that differ
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +01:00
Simon McVittie
97f0aa7875 testsuite: Share memorytexture version of compare_textures()
Unlike the version in scaling.c, this one incorporates debugging code
to print the pixels that differ.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +01:00
Simon McVittie
8e54460a48 testsuite: Extract common code from gdk/memorytexture and gsk/scaling
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:05:32 +01:00
Simon McVittie
4c4d260199 scaling test: Avoid dividing zero by zero
If all four of the random colours have alpha channel exactly 0.0,
then the computed premultiplied average will also be zero.
Normalize the expected colour to (0,0,0,0) rather than (NaN,NaN,NaN,0).

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6977
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-09-03 10:03:58 +01:00
Jürgen Benvenuti
b18c6b5781 Update German translation 2024-09-03 05:06:47 +00:00
Enokilis
d76e241558 Fixed typo that prevented theme update in the GTK4 demo. 2024-09-03 02:34:49 +00:00