Commit Graph

81098 Commits

Author SHA1 Message Date
Matthias Clasen
d907c0a42e colorstate: Add cicp support
This adds machinery to create colorstate objects from cicp
tuples, as well as a function to return a cicp tuple for a
colorstate.

Still missing: a conversion shader for non-default colorstates.
2024-07-24 08:16:08 -06:00
Matthias Clasen
4255230e36 colorstate: Cosmetics
Document a private api.
2024-07-24 07:46:05 -06:00
Matthias Clasen
d8a0915ada colorstate: Slight reorg
Move the conversion functions out of the default section, since
we will reuse the conversion functions for cicp. No functional
changes.
2024-07-24 07:46:05 -06:00
Matthias Clasen
32b348776e memoryformat: Allow indirect conversions
If we don't have a direct conversion function between two
colorstates, go indirectly via rec2100-linear.
2024-07-24 07:46:05 -06:00
Matthias Clasen
bbe552d6a8 Add gdk_color_state_get_convert_from
Our conversion machinery supports converting from any color
state to any default color state or back. Direct conversion
between two non-default color states isn't guaranteed. For
converting *to* a cicp color state, we need this function.
2024-07-24 07:46:05 -06:00
Matthias Clasen
ebc4bb2363 wayland: Switch to v4 of the color management protocol 2024-07-23 23:37:00 -06:00
Matthias Clasen
23e4c788fa Merge branch 'dmabuf-formats-autoptr' into 'main'
gdkdmabufformats: Add autoptr definition

See merge request GNOME/gtk!7484
2024-07-23 19:48:01 +00:00
Jordan Petridis
4e0a64c46c Merge branch 'alatiera/vulkan-semaphore' into 'main'
gdkvulkancontext: set the VkSemaphore to VK_NULL_HANDLE

See merge request GNOME/gtk!7483
2024-07-23 18:05:23 +00:00
Marco Trevisan (Treviño)
e46e61643c gdkdmabufformats: Add autoptr definition 2024-07-23 19:55:47 +02:00
Jordan Petridis
cc5526e019
gdkvulkancontext: set the VkSemaphore to VK_NULL_HANDLE
Vulkan objects are integers on 32bit and it's failing when it's set to
just NULL.

```
../gdk/gdkvulkancontext.c:677:24: error: assignment to ‘VkSemaphore’ {aka ‘long long unsigned int’} from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
  677 |   priv->draw_semaphore = NULL;
```
2024-07-23 18:01:56 +02:00
Benjamin Otte
e6cafa890d Merge branch 'wip/otte/for-main' into 'main'
gpu: Use correct shader clip mode for glyph nodes

See merge request GNOME/gtk!7480
2024-07-23 08:51:35 +00:00
Benjamin Otte
293d2fd19f gpu: Use correct shader clip mode for glyph nodes
We were passing the wrong rect to the clip mode computation, resulting
in a rounded rect every time, even though it should pretty much always
be unclipped.

The visual results are unaffected, because the clip sent to the shader
was still correct.
2024-07-23 10:03:11 +02:00
Benjamin Otte
7bca467e01 Merge branch 'wip/otte/kill-descriptors' into 'main'
Redo descriptors/texture binding

Closes #6564, #6574, and #6654

See merge request GNOME/gtk!7473
2024-07-22 23:49:46 +00:00
Benjamin Otte
40e25218e2 gpu: Compile with AMD's compiler, too
Apparently AMD's GLSL compiler doesn't like our #if statements. Turn
them into simple #ifdefs and compute them in the preamble instead.
2024-07-22 19:40:24 +02:00
Benjamin Otte
9e27acb0a6 gpu: Allocate Vulkan descriptor pools dynamically
Instead of allocating one large descriptor pool and hoping we never run
out of descriptors, allocate small ones dynamically, so we know we never
run out.

Test incldued, though the test doesn't fail in CI, because llvmpipe
doesn't care about pool size limits. It does fail on my AMD though.

A fun side note about that test is that the GL renderer handles it best
in normal operationbecause it caches offscreens per node and we draw the
same node repeatedly.
But, the replay test expands them to duplicated unique nodes, and then
the GL renderer runs out of command queue length, so I had to disable
the test on it.
2024-07-22 19:40:24 +02:00
Benjamin Otte
67b9fb43d0 gpu: Completely revamp YCbCr handling
There is now a GskGpuYcbcr struct that maintains all the Vulkan
machinery related to YCbCrConversions.
It's a GskGpuCached, so it will make itself go away when it is no longer
used, ie a video stopped playing.
2024-07-22 19:40:24 +02:00
Benjamin Otte
762b981dfe gpu: Make the device queryable from the cache
That's needed in cached subclasses during destruction, when they want to
destroy system resources.
2024-07-22 19:40:24 +02:00
Benjamin Otte
5e027ae5d9 gpu: Allow creating GskGpuCached objects externally
Export the GskGpuCached and GskGpuCachedClass objects in the header, and
make gsk_gpu_cached_new() available.
2024-07-22 19:40:24 +02:00
Benjamin Otte
7dd3680d7d gpu: Refactor code a bit
Turn the 2 ways to construct cached items into 2 constructors.

Useful for next commit.
2024-07-22 19:40:24 +02:00
Benjamin Otte
14a7b4b4b4 vulkan: Remove unused features
Now that we don't use the fancy features anymore, we don't need to
enable them.
And that also means we don't need an env var to disable it for testing.
2024-07-22 19:40:24 +02:00
Benjamin Otte
f5096fd11a vulkan: No need for different shaders anymore
Now that we don't do fancy texture stuff anymore, we don't need fancy
shaders either, so we can just compile against Vulkan 1.0 again.

And that means we need no fallback shaders for Vulkan 1.0 anymore.
2024-07-22 19:40:24 +02:00
Benjamin Otte
9c5ac13301 gpu: Remove now unused variables
No need to track them anymore.
2024-07-22 19:40:24 +02:00
Benjamin Otte
ecc33d6e62 gpu: Add the same cache as the GL shader uses
This avoids unnecessary rebinds of textures.

I can't really measure a performance change with it though.
2024-07-22 19:40:24 +02:00
Benjamin Otte
03c34021af gpu: Completely revamp descriptor set handling
Instead of trying to cram all descriptors into one large array and only
binding it at the start, we now keep 1 descriptor set per image+sampler
combo and just rebind it every time we switch textures.

This is the very dumb solution that essentially maps to what GL does,
but the performance impact is negligible compared to the complicated
dance we were attempting before.
2024-07-22 19:40:24 +02:00
Benjamin Otte
1b2156493b gpu: Remove descriptors
They are no longer a thing with the new way we manage textures.
2024-07-22 19:40:24 +02:00
Benjamin Otte
7b76170f46 gpu: Flip the big switch
Rewrite all shaders to use 2 predefined samplers called GSK_TEXTURE0 and
GSK_TEXTURE1 instead of wrapper functions.

On GL and Vulkan compat mode, these map directly to samplers.
On Vulkan proper, they map to 2 indices into the texture array, like
before.

From now on, the old nvidia GPUs - ie the 3xx drivers - should start
working again.

Fixes: #6564
Fixes: #6574
Fixes: #6654
2024-07-22 19:40:14 +02:00
Benjamin Otte
8109e8e3b6 gpu: Add GskGpuShaderFlags
This is just blowing up GskGpuShaderClip to hold more information so
that we don't need even more specialization constants.
2024-07-22 18:37:07 +02:00
Benjamin Otte
163278af0d gpu: Add infrastructure to write texture vertex data
This allows GskGpuFrame implementations to store data per vertex
attribute.

This is just the plumbing, no actual implementation is done in this
commit.
2024-07-22 18:37:07 +02:00
Benjamin Otte
677b6c1a81 gpu: Force new descriptors every time
This guarantees that the images get ID 0 and 1 (on GL), which is going
to be quite important for the next steps.

Just for funsies, here's fps numbers on my desktop for this change:
NGL     1500 => 1400
Vulkan  2650 => 2250
2024-07-22 18:37:07 +02:00
Benjamin Otte
1331a10e88 gpu: Remove buffer handling
We don't use buffers atm, and if we want to bring them back later, we
can just look at reverting this commit.

And it's in the way while refactoring.
2024-07-22 18:37:07 +02:00
Benjamin Otte
dc9f0869b1 gpu: Pass used images to shader ops
This by itself is just more work refcounting all those images, but
there's actually a goal here, that will become visible in future
commits.

But this is split out for correctness and benchmarking purposes (the
overhead from refcounting seems to be negligible on my computer).
2024-07-22 18:37:07 +02:00
Benjamin Otte
ea6253c1df gpu: Add a member in ShaderOpClass for number of textures
This just puts the number from the header into a strcut where it can be
accessed.
2024-07-22 18:37:07 +02:00
Benjamin Otte
b481fd854f gpu: Encode number of textures use in every shader
Just define GSK_N_TEXTURES in every glsl file, extract that #define in
the python parser and emit a static const uint variable
"{shader_name}_n_textures" in the generated header.
2024-07-22 18:37:07 +02:00
Benjamin Otte
68baa93460 gpu: Use GskGpuShaderImage for blur ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
52db54e803 gpu: Use GskGpuShaderImage for crossfade ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
71e412e8f8 gpu: Use GskGpuShaderImage for convert ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
9644fc2e8f gpu: Use GskGpuShaderImage for mask ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
0795d86df7 gpu: Use GskGpuShaderImage for colormatrix ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
21988ea700 gpu: Use GskGpuShaderImage for blendmode ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
23081d2bc4 gpu: Use GskGpuShaderImage for texture ops 2024-07-22 18:37:07 +02:00
Benjamin Otte
b1e441d18a gpu: Introduce GskGpuShaderImage
It's a struct collecting all relevant info for a texture passed to a
shader.

The ultimate goal is to get rid of the descriptors and let ops
manage them on thir own.
2024-07-22 18:37:07 +02:00
Benjamin Otte
a118cbb3ff Merge branch 'wip/otte/for-main' into 'main'
gpu: Move code around

See merge request GNOME/gtk!7477
2024-07-22 16:30:45 +00:00
Benjamin Otte
4639b3bc4c gpu: Make cache keep track of time
If GskGpuCache has an idea of what time it is, cached items can use that
time to update their last-use time instead of having to carry it around
throught function calls everywhere.
2024-07-22 17:10:37 +02:00
Benjamin Otte
821eb92dfb gpu: Handle corner-case
Port an optimization of the GL renderer where it fast-paths crossfades
with progress <= 0 and >=1 - which should really never happen because
nobody should emit them in the first place, but oh well.
2024-07-22 17:10:37 +02:00
Benjamin Otte
0370043775 gpu: Add missing string
This made debug output kinda not so good.
2024-07-22 17:10:37 +02:00
Benjamin Otte
82bcc05ca1 gpu: Move code around
Move the atlas code to the top of the file, so that other code can use
it.

No functional changes.
2024-07-22 17:10:37 +02:00
Benjamin Otte
527852e1b8 Merge branch 'wip/otte/colorstates-are-as-fun-as-dmabufs' into 'main'
dmabuf: Make NULL the default colorstate in the builder

See merge request GNOME/gtk!7474
2024-07-22 13:09:56 +00:00
Benjamin Otte
2e1686091f dmabuf: Make NULL the default colorstate in the builder
YUV dmabufs are not sRGB.

So instead of making the dmabuf builder have sRGB as the default
colorstate, add a NULL default option that makes the builder choose
the colorstate based on fourcc when build() is called.

If that happens, we pick sRGB usually, but for YUV we pick narrow range
BT601, like we did in versions before colorstates.
2024-07-22 14:54:05 +02:00
Artur S0
5353e28dca Update Russian translation 2024-07-22 12:23:52 +00:00
Benjamin Otte
b58e89f380 Merge branch 'wip/otte/for-main' into 'main'
vulkan: dmabufs require ycbcr

See merge request GNOME/gtk!7476
2024-07-22 00:50:07 +00:00