Commit Graph

22 Commits

Author SHA1 Message Date
Benjamin Otte
e7549f3359 vulkan: Redo barriers
We now store all the relevant state of the image inside the VulkanImage
struct, so we can delay barriers for as long as possible.

Whenever we want to use an image, we call the new
gsk_vulkan_image_transition() and it will add a barrier to the desired
state if one is necessary.
2023-07-16 13:16:43 +02:00
Benjamin Otte
f366ccc0b2 vulkan: Introduce GskVulkanShaderOp
It's the new base class for shaders now.

We're doing deep inheritance now, woohoo!

Also, port all the shader ops to it.
2023-07-16 13:16:43 +02:00
Benjamin Otte
4954e6962f vulkan: Remove the VulkanOp.upload() vfunc
It's not used anymore.
2023-07-16 13:16:43 +02:00
Benjamin Otte
2aba50efa0 vulkan: Move the render ops to the Render
This is a massive refactoring because it collects all the renderops
of all renderpasses into one long array in the Render object.

Lots of code in there is still flaky and needs cleanup. That will
follow in further commits.

Other than that it does work fine though.
2023-07-16 12:13:00 +02:00
Benjamin Otte
21d2372396 vulkan: Unify some functions
All the ops that just execute a shader do pretty much the same stuff, so
put it all in a single function that they all call.

It's basically faking a base class for them.
2023-07-16 12:13:00 +02:00
Benjamin Otte
c0b185bee9 vulkan: Make Op->command() return the next op
This way, ops can batch themselves.

They don't dothat yet, but you know where this is going...
2023-07-16 12:13:00 +02:00
Benjamin Otte
da4a4f6a25 vulkan: Add a Stage enum
It's declaring at which stage this command should run. So far nothing is
using it, but that will follow in future commits.
2023-07-16 12:13:00 +02:00
Benjamin Otte
a6b2bcbf24 vulkan: Remove unused arguments from Op vfuncs
Makes code a lot simpler.
2023-07-16 12:13:00 +02:00
Benjamin Otte
f35053b837 vulkan: Add VulkanOp->next
Set it after creating all the ops and then use it for iterating.

Note that we cannot set it while creating the ops because the array may
be realloc()ed into a different memory region which would invalidate all
the pointers.

It currently has no use, but that will come later.

Also put the typedefs into headers in gsk/vulkan, they have nthing to do
outside that directory.
2023-07-16 12:13:00 +02:00
Benjamin Otte
d86d4c5597 vulkan: Add infrastructure for printing ops
... and add a GSK_DEBUG=verbose setting making use of it.
2023-07-16 12:13:00 +02:00
Benjamin Otte
a621bd066b vulkan: Remove op.get_pipeline()
It's unused now that GskVulkanPipeline is gone.
2023-07-16 12:13:00 +02:00
Benjamin Otte
58c318a4dc vulkan: Add gskvulkanprivate.h
It's the new place for all the common stuff.

Because the old place is about to go away.
2023-07-16 12:13:00 +02:00
Benjamin Otte
efa4cae949 vulkan: Remove hacky function arguments
They're unused now that we removed the old render ops.
2023-07-16 12:12:36 +02:00
Benjamin Otte
b2296a1918 vulkan: Port inset and outset shadow to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
9ac36aeb42 vulkan: Add cross-fade op
The benefit here is that we can now properly cross-fade when one of
start/end is fully clipped out by just replacing it with an opacity op
for the other.

This was not possible with the old way we did things.
2023-07-16 12:12:36 +02:00
Benjamin Otte
9da1055575 vulkan: Create pipeline differently for ops
Instead of creating a pipeline GObject, just ask for the VkPipeline.

And instead of having the Op handle it, just let the renderpass look
up/create the relevant pipeline while creating commands so that it can
insert vkCmdBindPipeline calls as-needed.
2023-07-16 12:12:36 +02:00
Benjamin Otte
7cf7870254 vulkan: Initialize ops differently
Instead of creating the op manually, just pass in the renderpass and
have the op created from there.

This way ops aren't really initialized anymore, they are more appended
to the queue, so instead of foo_op_init() we can just call the function
foo_op().
2023-07-16 12:12:36 +02:00
Benjamin Otte
7763e883d6 vulkan: Use VkPipeline instead of GskVulkanPipeline
This is in preparation for getting rid of GskVulkanPipelines.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8515224921 vulkan: Split out a function
We'll need it elsewhere soon.
2023-07-16 12:12:36 +02:00
Benjamin Otte
f53da409e5 vulkan: Add an argument to vfunc
We need this in the future.
2023-07-16 12:12:36 +02:00
Benjamin Otte
742ef96748 vulkan: Create the first real VulkanOp
Split out the scissor op into its own implementation as a proof of
concept of how ops are meant to look when they are actually working.
2023-07-16 12:12:36 +02:00
Benjamin Otte
32e123fa67 vulkan: Invent a new abstraction
GskVulkanOp is meant to be a proper abstraction of operations
the Vulkan renderer will be doing.

For now it's an atrocious clunky piece of junk wedged into the
renderpass codebase.

It's so temporary that I didn't even adjust indentation of the code.
2023-07-16 12:12:36 +02:00