Commit Graph

20 Commits

Author SHA1 Message Date
Benjamin Otte
3313fd4e2b vulkan: Turn debug messages into warnings
Vulkan errors are quire critical, so we want to see them.

Our code is good enough to handle all non-critical errors.
2024-08-08 04:41:16 +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
9c5ac13301 gpu: Remove now unused variables
No need to track them anymore.
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
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
6c5ae48a05 gpu: Pass color states as specialization constant
This adds a GdkColorStates that encodes 2 of the default GdkColorStates
and wether their values are premultiplied or not.

Neither do the shaders do anything with this information yet, nor do the
shaders do anything with it yet, this is just the plumbing.
2024-07-11 14:57:20 +02:00
Benjamin Otte
d21467e2e8 gdk: Remove all VulkanContext API
All API for GdkVulkanContext gets removed here. It was experimental and
it's not a good API. So get rid of it.
2024-01-07 14:47:22 +01:00
Benjamin Otte
d900407a18 gpu: Introduce the concept of "variation"
A variation is a #define/specialization constant that every shader can
use to specialize itself as it sees fit.

This commit adds the infrastrcture, future commits will add
implementations.
2024-01-07 07:22:53 +01:00
Benjamin Otte
5cf3c70db0 gpu: Make blend modes configurable
For now, we only have OVER and ADD blend modes. This commit doesn't use
ADD, it just sets up all the machinery and refactors things.
2024-01-07 07:22:52 +01:00
Benjamin Otte
ae2020aca2 gpu: Make descriptor-indexing optional
Do extra work if it's not available.
2024-01-07 07:22:51 +01:00
Benjamin Otte
98c88780bc gpu: Set max samplers/buffers based on features
If we run older code, we don't have enough samplers and buffers
available. So make sure to reflect that.
2024-01-07 07:22:51 +01:00
Benjamin Otte
47a13e601f gpu: Make PipelineLayout objects do more things
Let the objects track the number of samplers or buffers needed.

This is a required step for making Vulkan work with less featureful
(read: mobile) implementations.
2024-01-07 07:22:51 +01:00
Benjamin Otte
a2368803fa gpu: Add dmabuf import for Vulkan
This now uses all the previously added features to allow displaying YUV
images.

Also add a utility function that turns an image into a toggle ref for a
texture. This makes sure that reffing the image also refs the texture
and that ensures that textures stay alive as long as the image is in
use.
2024-01-07 07:22:51 +01:00
Benjamin Otte
d2229e2aed gpu: Add GskVulkanPipelineLayout
This allows having different layouts sothat we can support immutable
samplers, whcih are required for multiplane and YUV formats.

We don't use them yet.
2024-01-07 07:22:51 +01:00
Benjamin Otte
9eac147426 gpu: Add a cache for YcbcrConversions
We index them only by VkFormat for now because we don't have another
differentiator.

It's unused so far.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1b1abba313 gpu: Add an "external" allocator to Vulkan
The allocator is supposed to be used with externally allocated vkMemory
objects that are meant to be freed normally - in particular dmabufs.
2024-01-07 07:22:51 +01:00
Benjamin Otte
223d1343de gpu: Add GdkDisplay::vulkan_features
use it to collect the optional features we are interested in and turn
them on only if available.

For now we add the dmabuf features, but we don't use them yet.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1a85d569e3 gpu: Add ability to run shaders
This heaves over an inital chunk of code from the Vulkan renderer to
execute shaders.

The only shader that exists for now is a shader that draws a single
texture.
We use that to replace the blit op we were doing before.
2024-01-07 07:22:49 +01:00
Benjamin Otte
9ddae8aebc gpu: Add outline of new GPU renderer
For now, it just renders using cairo, uploads the result to the GPU,
blits it onto the framebuffer and then is happy.

But it can do that using Vulkan and using GL (no idea which version).

The most important thing still missing is shaders.

It also has a bunch of copy/paste from the Vulkan renderer that isn't
used yet.
But I didn't want to rip it out and then try to copy it back later
2024-01-07 07:22:49 +01:00