gtk4.git
2 years agovulkan: Free storage buffer when disposing render object
Benjamin Otte [Mon, 17 Jul 2023 19:03:13 +0000 (21:03 +0200)]
vulkan: Free storage buffer when disposing render object

This caused a lot of leaked memory on the GPU when rendering textures.
(Read: inside node-editor)

2 years agovulkan: Fix leaks with pipeline cache
Benjamin Otte [Mon, 17 Jul 2023 19:02:33 +0000 (21:02 +0200)]
vulkan: Fix leaks with pipeline cache

In particular, we were leaking the actual cache and then created a new
one.

2 years agobuild: Move the glslc check into the top meson file
Benjamin Otte [Wed, 19 Jul 2023 13:36:55 +0000 (15:36 +0200)]
build: Move the glslc check into the top meson file

Put it with the other Vulkan checks, so it's easy to find.

2 years agovulkan: Remove the pre-compiled shaders
Benjamin Otte [Wed, 19 Jul 2023 12:15:57 +0000 (14:15 +0200)]
vulkan: Remove the pre-compiled shaders

Instead, build-depnd on glslc to build them.

glslc is available in all important distros for a while:
  Fedora >= 28
  Ubuntu >= 23.04
  Debian >= 12
  Arch
  Opensuse >= 15.2
  msys2
are the ones I checked.

So we can depend on it and avoid having to deal with keeping spirv files
up-to-date in all commits.

It's also 700kB of data, and not updating it helps.

2 years agoci: Include glslc for Vulkan builds
Benjamin Otte [Wed, 19 Jul 2023 12:55:07 +0000 (14:55 +0200)]
ci: Include glslc for Vulkan builds

2 years agoMerge branch 'wip/otte/vulkan-for-main' into 'main'
Benjamin Otte [Sun, 16 Jul 2023 12:22:35 +0000 (12:22 +0000)]
Merge branch 'wip/otte/vulkan-for-main' into 'main'

vulkan: Make RenderOps into proper structs

See merge request GNOME/gtk!6188

2 years agovulkan: Rebuild the shaders
Benjamin Otte [Sun, 16 Jul 2023 11:52:15 +0000 (13:52 +0200)]
vulkan: Rebuild the shaders

Just to be sure I didn't forget rebuilding some shader at some point.

2 years agovulkan: Redo barriers
Benjamin Otte [Sat, 15 Jul 2023 20:19:20 +0000 (22:19 +0200)]
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.

2 years agovulkan: Track the current pipeline stage of images
Benjamin Otte [Sat, 15 Jul 2023 14:38:03 +0000 (16:38 +0200)]
vulkan: Track the current pipeline stage of images

This way, we can in theory properly transition images because we know
which stage to transition from.

IN practice this is happening in future commits.

2 years agovulkan: Handle images in the ShaderOp
Benjamin Otte [Sat, 15 Jul 2023 11:28:08 +0000 (13:28 +0200)]
vulkan: Handle images in the ShaderOp

This looks more convoluted in this commit, but future commits will
hopefully make up for it.

2 years agovulkan: Make clip type an enum
Benjamin Otte [Sat, 15 Jul 2023 10:47:35 +0000 (12:47 +0200)]
vulkan: Make clip type an enum

and add gsk_vulkan_shader_op_alloc() that sets it properly.

2 years agovulkan: Introduce GskVulkanShaderOp
Benjamin Otte [Sat, 15 Jul 2023 09:39:18 +0000 (11:39 +0200)]
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.

2 years agovulkan: Remove GskVulkanUploader
Benjamin Otte [Sat, 15 Jul 2023 00:05:24 +0000 (02:05 +0200)]
vulkan: Remove GskVulkanUploader

... and all the remaining functions still using it.

It's all unused and has been replaced by upload and download ops.

With this change, all GPU operations now go via GskVulkanOp.command()
and no more side channels exist.

2 years agovulkan: Add GskVulkanDownloadOp
Benjamin Otte [Fri, 14 Jul 2023 21:22:35 +0000 (23:22 +0200)]
vulkan: Add GskVulkanDownloadOp

This op queues a download of an image. The image will only be available
once the commands finished executing, so it requires waiting for the
render to finish, which makes the API a bit awkward.

Included is also a download_png_op() useful for debugging.

2 years agovulkan: Properly update image layouts
Benjamin Otte [Fri, 14 Jul 2023 21:05:19 +0000 (23:05 +0200)]
vulkan: Properly update image layouts

The render pass ops were not updating the image's layout to the final
layout when a render pass ends.

Fix that.

Also make the layouts explicit arguments to the render pass op.

2 years agovulkan: Simplify render API
Benjamin Otte [Fri, 14 Jul 2023 20:21:09 +0000 (22:21 +0200)]
vulkan: Simplify render API

Merge reset() and draw() into a single render() function.

Also clean up some naming on the way.

2 years agovulkan: Remove the VulkanOp.upload() vfunc
Benjamin Otte [Thu, 13 Jul 2023 19:12:36 +0000 (21:12 +0200)]
vulkan: Remove the VulkanOp.upload() vfunc

It's not used anymore.

2 years agovulkan: Add an UploadGlyphOp
Benjamin Otte [Fri, 14 Jul 2023 18:55:45 +0000 (20:55 +0200)]
vulkan: Add an UploadGlyphOp

Now all the uploads have their own op.

2 years agovulkan: Split out a function
Benjamin Otte [Fri, 14 Jul 2023 18:53:54 +0000 (20:53 +0200)]
vulkan: Split out a function

Split out the function that uploads using a buffer, so that it can be
used with an area to only update parts of the image.

That feature is not used yet, but will be in future commits.

2 years agovulkan: Remove unused functions
Benjamin Otte [Thu, 13 Jul 2023 19:21:46 +0000 (21:21 +0200)]
vulkan: Remove unused functions

2 years agovulkan: Merge the two upload ops
Benjamin Otte [Thu, 13 Jul 2023 18:56:57 +0000 (20:56 +0200)]
vulkan: Merge the two upload ops

Now they both use the same upload code.

2 years agovulkan: Merge te 2 upload ops
Benjamin Otte [Thu, 13 Jul 2023 17:48:50 +0000 (19:48 +0200)]
vulkan: Merge te 2 upload ops

They are about to share a ton of code, sothey should be in the same
source file.

This commit just does the copying, no functional changes.

2 years agovulkan: Fold functions into only caller
Benjamin Otte [Thu, 13 Jul 2023 12:30:16 +0000 (14:30 +0200)]
vulkan: Fold functions into only caller

Now that the VulkanOp does begin/end of render passes, there's no need
to have a renderpass function for it anymore.

2 years agotests: Reduce number of random fonts
Benjamin Otte [Thu, 13 Jul 2023 10:56:17 +0000 (12:56 +0200)]
tests: Reduce number of random fonts

We were clowing through all the Pango caches for no benefit.

It made the test generation stuck in fontconfig loops instead of
quickly generating tests.

So don't do that and limit the different fonts to some reasonable list
of options.

2 years agovulkan: Don't merge too many drawing commands
Benjamin Otte [Thu, 13 Jul 2023 10:30:29 +0000 (12:30 +0200)]
vulkan: Don't merge too many drawing commands

If a command takes too long to execute, Vulkan drivers will think they
are inflooping and abort what they were doing.

For the simple color shader with smallish nodes, this happens around
10M instances, as tested with the output of
  ./tests/rendernode-create-tests 10000000 colors.node

So just limit it to way lower, so that we barely never hit it, ut still
pick a big number so this optimization stays noticable.

2 years agovulkan: Simplify
Benjamin Otte [Thu, 13 Jul 2023 09:23:02 +0000 (11:23 +0200)]
vulkan: Simplify

The renderpassop always has a matching end op, so there is no need to
check for the end of operations and emit one manually.

2 years agovulkan: Merge function into only caller
Benjamin Otte [Thu, 13 Jul 2023 09:17:04 +0000 (11:17 +0200)]
vulkan: Merge function into only caller

The renderpass reshuffling means we can move a bunch of functions now.

This is one of them.

2 years agovulkan: Don't try that hard to use clear
Benjamin Otte [Wed, 12 Jul 2023 09:38:32 +0000 (11:38 +0200)]
vulkan: Don't try that hard to use clear

For small regions, the optimization doesn't matter that much, so we
don't need to do lots of work on the CPU.

In particular, this should catch icons and their backgrounds (32x32),
but I was generous in selecting the number.

Gets my discrete AMD on widget-factory back to the 1900fps it had before
this optimization while making the driver clock the GPU's shader at
1.7GHz instead of the 2.1GHz it used before.

2 years agovulkan: Try really hard to use clear
Benjamin Otte [Wed, 12 Jul 2023 09:04:25 +0000 (11:04 +0200)]
vulkan: Try really hard to use clear

Using clear avoids the shader engine (see last commit), so if we can get
pixels out of it, we should.

So we detect the overlap with the rounded corners of the clip region and
emit shaders for those, but then use Clear() for the rest.

With this in place, widget-factory on my integrated Intel TigerLake gets
a 60% performance boost.

2 years agovulkan: Add a clear op
Benjamin Otte [Wed, 12 Jul 2023 07:26:24 +0000 (09:26 +0200)]
vulkan: Add a clear op

The op emits a vkCmdClearAttachments() with a given color. That can be
used with color nodes that are pixel-aligned and opaque to significantly
speed up rendering when the window background is a solid color.

However, currently this fails a bit outside of fullscreen when rounded
clip rectangles are in use to draw rounded corners.

2 years agovulkan: Adapt a function
Benjamin Otte [Wed, 12 Jul 2023 07:21:07 +0000 (09:21 +0200)]
vulkan: Adapt a function

I want to use it for more operations when we can break those down to
operations on the pixels directly, and this function is what's needed
for that.

2 years agovulkan: Implement direct upload for the cairo op
Benjamin Otte [Tue, 11 Jul 2023 13:14:22 +0000 (15:14 +0200)]
vulkan: Implement direct upload for the cairo op

2 years agovulkan: Upload cairo images "directly"
Benjamin Otte [Tue, 11 Jul 2023 07:35:01 +0000 (09:35 +0200)]
vulkan: Upload cairo images "directly"

Instead of using the upload vfunc and going via the code in
GskVulkanImage, copy/paste the relevant code into the command() vfunc.

This is meant to achieve multiple things:
1. Get rid of GskVulkanUploader and its own command buffer and general
   non-integration with operations.
2. Get rid of GskVulkanOp:upload()
3. Get the upload/download code machinery for GskVulkanImage and put it
   with the actual operations.

The current code can't do direct upload/download, that will follow in a
future commit.

2 years agovulkan: Split out a function
Benjamin Otte [Tue, 11 Jul 2023 06:50:20 +0000 (08:50 +0200)]
vulkan: Split out a function

This is refactoring for future changes.

2 years agovulkan: Emit a renderpass op
Benjamin Otte [Mon, 10 Jul 2023 01:42:55 +0000 (03:42 +0200)]
vulkan: Emit a renderpass op

... instead of doing the equivalent things manually by creating a
RenderPass and calling the relevant functions.

Now all renderpass operations are indeed stored in ops.

Also reshuffle the command emission code, because we no longer need to
emit the ops for the base renderpass.

As a result we only submit a single command buffer containing all the
render passes instead of once per render pass.
We also bind vertex buffers and descriptor sets only once now at the
start instead of once per renderpass.

2 years agovulkan: Sort the ops
Benjamin Otte [Sun, 9 Jul 2023 21:45:20 +0000 (23:45 +0200)]
vulkan: Sort the ops

Use the OpClass.stage to order operations:

1. Put upload ops first
   This way we can ensure they are executed first.
2. Move subpasses for offscreens in front of the pass using them.

2 years agovulkan: Store a pointer to the first op
Benjamin Otte [Sun, 9 Jul 2023 21:44:52 +0000 (23:44 +0200)]
vulkan: Store a pointer to the first op

This is not yet useful, but will be soon.

2 years agovulkan: Indent verbose prints again
Benjamin Otte [Sun, 9 Jul 2023 21:44:02 +0000 (23:44 +0200)]
vulkan: Indent verbose prints again

This feature was lost when refactoring, restore it.

2 years agovulkan: Rename offscreenp to renderpassop
Benjamin Otte [Sun, 9 Jul 2023 20:33:54 +0000 (22:33 +0200)]
vulkan: Rename offscreenp to renderpassop

They should be used for all renderpasses, not just offscreens.

2 years agovulkan: Move the render ops to the Render
Benjamin Otte [Sun, 9 Jul 2023 18:28:12 +0000 (20:28 +0200)]
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.

2 years agovulkan: Batch together multiple draw calls
Benjamin Otte [Sun, 9 Jul 2023 14:50:19 +0000 (16:50 +0200)]
vulkan: Batch together multiple draw calls

If multiple instances of the same op appear in order, we can emit one
vkCmdDraw() for all of them together.

So do that.

2 years agovulkan: Unify some functions
Benjamin Otte [Sun, 9 Jul 2023 14:27:02 +0000 (16:27 +0200)]
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.

2 years agovulkan: Make Op->command() return the next op
Benjamin Otte [Sun, 9 Jul 2023 13:56:30 +0000 (15:56 +0200)]
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...

2 years agovulkan: Add a Stage enum
Benjamin Otte [Sun, 9 Jul 2023 13:40:48 +0000 (15:40 +0200)]
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.

2 years agovulkan: Bind descriptor sets early
Benjamin Otte [Sat, 8 Jul 2023 21:16:01 +0000 (23:16 +0200)]
vulkan: Bind descriptor sets early

Simplfies the code and doesn't change anything.

2 years agovulkan: Remove unused arguments from Op vfuncs
Benjamin Otte [Sat, 8 Jul 2023 19:28:56 +0000 (21:28 +0200)]
vulkan: Remove unused arguments from Op vfuncs

Makes code a lot simpler.

2 years agovulkan: Cache VkRenderPasses in render object
Benjamin Otte [Sat, 8 Jul 2023 18:40:48 +0000 (20:40 +0200)]
vulkan: Cache VkRenderPasses in render object

Instead of recreating the same renderpass object in every frame and for
every offscreen, just reuse it.

Technically, we can save this per-renderer or even per-display (it
should really be cached by VkDevice), but we have no infrastructure for
that.

2 years agovulkan: Rename function
Benjamin Otte [Sat, 8 Jul 2023 18:16:39 +0000 (20:16 +0200)]
vulkan: Rename function

The function name gsk_vulkan_render_get_pipeline() had been used for
GskVulkanPipeline. Since those are gone now, we can use that name for
VkPipelines.

2 years agovulkan: Cache framebuffer in image
Benjamin Otte [Sat, 8 Jul 2023 18:10:04 +0000 (20:10 +0200)]
vulkan: Cache framebuffer in image

Instead of recreating them every frame for every render pass, reuse the
same framebuffer.

2 years agovulkan: Put the vertex buffer into the render object
Benjamin Otte [Sat, 8 Jul 2023 07:04:12 +0000 (09:04 +0200)]
vulkan: Put the vertex buffer into the render object

Renderpasses get recreated every frame, but we keep render objects
around. So if we keep the vertex buffer in the render object, we can
also keep it around and just reuse it.

Also, we only need one buffer for all the render passes, which is
another bonus.

The initial buffer size is chosen at 128kB. Maximized Nautilus,
gnome-text-editor with an open file and widget-factory take ~100kB when
doing a full redraw. Other apps are between 30-50kB usually.

So I chose a value that is not too big, but catches ~90% of cases.

2 years agovulkan: Add an offscreen end op
Benjamin Otte [Fri, 7 Jul 2023 01:18:44 +0000 (03:18 +0200)]
vulkan: Add an offscreen end op

This is basically a fancy no-op for now, but reordering of ops will need
it to indicate end of offscreen commands.

2 years agovulkan: Don't intern strings
Benjamin Otte [Fri, 7 Jul 2023 00:38:22 +0000 (02:38 +0200)]
vulkan: Don't intern strings

Interning strings is slow, especially if we can instead do direct
pointer compares.

Also refactor the pipeline lookup code a bit to make use of the
refactored code.

2 years agovulkan: Add VulkanOp->next
Benjamin Otte [Thu, 6 Jul 2023 04:40:09 +0000 (06:40 +0200)]
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.

2 years agovulkan: Remove all the semaphores
Benjamin Otte [Wed, 5 Jul 2023 07:10:08 +0000 (09:10 +0200)]
vulkan: Remove all the semaphores

They aren't necessary with just one queue.

2 years agovulkan: Remove unused stuff from render object
Benjamin Otte [Wed, 5 Jul 2023 05:16:58 +0000 (07:16 +0200)]
vulkan: Remove unused stuff from render object

Neither cleanup images nor multiple renderpasses are used anymore since
both of those are now handled inside the render ops.

2 years agovulkan: Pass the node when setting up
Benjamin Otte [Wed, 5 Jul 2023 05:06:17 +0000 (07:06 +0200)]
vulkan: Pass the node when setting up

Remove the function to add a node from both the GskVulkanRender and the
GskVulkanRenderPass.

That means they are both now meant to draw exactly one node.

2 years agovulkan: Add infrastructure for printing ops
Benjamin Otte [Wed, 5 Jul 2023 04:32:52 +0000 (06:32 +0200)]
vulkan: Add infrastructure for printing ops

... and add a GSK_DEBUG=verbose setting making use of it.

2 years agovulkan: Repurpose mask shader
Benjamin Otte [Mon, 3 Jul 2023 23:55:17 +0000 (01:55 +0200)]
vulkan: Repurpose mask shader

Use if for mask nodes to do the generic source image + mask image
operation with the 4 available mask modes.

2 years agovulkan: Remove op.get_pipeline()
Benjamin Otte [Mon, 3 Jul 2023 14:14:57 +0000 (16:14 +0200)]
vulkan: Remove op.get_pipeline()

It's unused now that GskVulkanPipeline is gone.

2 years agovulkan: Remove GskVulkanPipeline
Benjamin Otte [Mon, 3 Jul 2023 13:49:36 +0000 (15:49 +0200)]
vulkan: Remove GskVulkanPipeline

Pipelines are handled differently now.

2 years agovulkan: Add gskvulkanprivate.h
Benjamin Otte [Mon, 3 Jul 2023 13:57:30 +0000 (15:57 +0200)]
vulkan: Add gskvulkanprivate.h

It's the new place for all the common stuff.

Because the old place is about to go away.

2 years agovulkan: Turn push constants into an op
Benjamin Otte [Mon, 3 Jul 2023 13:47:53 +0000 (15:47 +0200)]
vulkan: Turn push constants into an op

This removes the last remaining original op from the gskvulkanrenderpass.c,
so that file got some cleanup, too.

2 years agovulkan: Make glyphs use new node ops
Benjamin Otte [Mon, 3 Jul 2023 07:15:04 +0000 (09:15 +0200)]
vulkan: Make glyphs use new node ops

This is a rudimentary - but working - port.
Glyph uploads are still using the old machinery, a bunch of functions
still exist that probably aren't necessary anymore and each glyph emits
its own node.

This will need to be improved in further commits.

2 years agovulkan: Add a glyph shader
Benjamin Otte [Mon, 3 Jul 2023 05:53:22 +0000 (07:53 +0200)]
vulkan: Add a glyph shader

This shader is an updated version of the mask shader, but I want to use
the mask name for the mask node and that's a different functionality.

Also, add an operation for it and partially implement the mask node
using it, so we can test that this shader works.

Replacing the shader used for text rendering is the next step.

2 years agovulkan: Remove hacky function arguments
Benjamin Otte [Mon, 3 Jul 2023 01:23:17 +0000 (03:23 +0200)]
vulkan: Remove hacky function arguments

They're unused now that we removed the old render ops.

2 years agovulkan: Port linear gradient to new ops
Benjamin Otte [Mon, 3 Jul 2023 01:15:59 +0000 (03:15 +0200)]
vulkan: Port linear gradient to new ops

This was the last user of GskVulkanOpRender, so delete that one, too.

2 years agovulkan: Make border shader use new ops
Benjamin Otte [Sun, 2 Jul 2023 22:56:31 +0000 (00:56 +0200)]
vulkan: Make border shader use new ops

2 years agovulkan: Add a blur op and use it
Benjamin Otte [Sun, 2 Jul 2023 04:30:10 +0000 (06:30 +0200)]
vulkan: Add a blur op and use it

This removes the last old user of offscreens, so those functions are now
gone, too.

2 years agovulkan: Port inset and outset shadow to new ops
Benjamin Otte [Sun, 2 Jul 2023 03:09:24 +0000 (05:09 +0200)]
vulkan: Port inset and outset shadow to new ops

2 years agovulkan: Port blend mode to new ops
Benjamin Otte [Sat, 1 Jul 2023 04:14:48 +0000 (06:14 +0200)]
vulkan: Port blend mode to new ops

2 years agovulkan: Add cross-fade op
Benjamin Otte [Thu, 29 Jun 2023 19:44:40 +0000 (21:44 +0200)]
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.

2 years agovulkan: Factor out call to opacity op
Benjamin Otte [Thu, 29 Jun 2023 19:43:26 +0000 (21:43 +0200)]
vulkan: Factor out call to opacity op

I want to reuse it for crossfades (see next commit).

2 years agovulkan: Convert color op to new method
Benjamin Otte [Thu, 29 Jun 2023 04:58:55 +0000 (06:58 +0200)]
vulkan: Convert color op to new method

This is a straightforward and simple port.

2 years agovulkan: Create pipeline differently for ops
Benjamin Otte [Thu, 29 Jun 2023 04:36:17 +0000 (06:36 +0200)]
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.

2 years agoRevert "vulkan: Always render clip extents"
Benjamin Otte [Wed, 28 Jun 2023 23:56:41 +0000 (01:56 +0200)]
Revert "vulkan: Always render clip extents"

This reverts commit 0f184d3270cfac522a05ae06d28cc2f1e32c0e6d.

The renderer is good enough to make use of the clip region.

Or rather: If it isn't, the renderpass should take care of that, not the
render object.

2 years agovulkan: Combine textures and samplers again
Benjamin Otte [Wed, 28 Jun 2023 18:50:43 +0000 (20:50 +0200)]
vulkan: Combine textures and samplers again

This reverts most of commit f420c143e0d8947a433704969bab02aea47d82f5
again because it turns out GPUs like combined images and samplers.

But: The one thing we don't revert is allowing the C code to select any
combination of sampler and image:
gsk_vulkan_render_get_image_descriptor() now takes a 2nd argument
specifying the sampler.

This allows the same flexibility as before, we just combine things
early.

This change was inspired by
https://developer.nvidia.com/blog/vulkan-dos-donts/

2 years agovulkan: Store shaders in the display
Benjamin Otte [Wed, 28 Jun 2023 03:43:53 +0000 (05:43 +0200)]
vulkan: Store shaders in the display

Have a resource path => vkShaderModule hash table instead of doing fancy
custom objects.

A benefit is that shader modules are now shared between all renderers
and pipelines.

2 years agovulkan: Initialize ops differently
Benjamin Otte [Wed, 28 Jun 2023 02:30:35 +0000 (04:30 +0200)]
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().

2 years agovulkan: Use VkPipeline instead of GskVulkanPipeline
Benjamin Otte [Mon, 26 Jun 2023 21:26:19 +0000 (23:26 +0200)]
vulkan: Use VkPipeline instead of GskVulkanPipeline

This is in preparation for getting rid of GskVulkanPipelines.

2 years agovulkan: Use new ops for repeat nodes
Benjamin Otte [Mon, 26 Jun 2023 01:47:25 +0000 (03:47 +0200)]
vulkan: Use new ops for repeat nodes

The new code always uses an offscreen, even for children that are
exactly fitting texture nodes.
I would have had to write more code and didn't consider it worth it,
especially because it would have required complicating the
get_as_image() function.

This was the last node using the texture pipeline.

2 years agovulkan: Implement fallback using new nodes
Benjamin Otte [Sun, 25 Jun 2023 23:40:45 +0000 (01:40 +0200)]
vulkan: Implement fallback using new nodes

With Cairo upload and texture nodes being available, we can do that now.

2 years agovulkan: Pass bounds to texture op
Benjamin Otte [Sun, 25 Jun 2023 23:39:32 +0000 (01:39 +0200)]
vulkan: Pass bounds to texture op

This way the node can do the normalization (and maybe stop doing it
in the future).

2 years agovulkan: Add a Cairo upload node
Benjamin Otte [Sun, 25 Jun 2023 23:38:50 +0000 (01:38 +0200)]
vulkan: Add a Cairo upload node

... and use it for cairo nodes.

2 years agovulkan: Port opacity to new ops
Benjamin Otte [Sun, 25 Jun 2023 22:29:13 +0000 (00:29 +0200)]
vulkan: Port opacity to new ops

2 years agovulkan: Add offscreen and color-matrix op
Benjamin Otte [Sun, 25 Jun 2023 21:04:43 +0000 (23:04 +0200)]
vulkan: Add offscreen and color-matrix op

.. and use them for color-matrix operations.

2 years agovulkan: Split out a function
Benjamin Otte [Sun, 25 Jun 2023 20:48:02 +0000 (22:48 +0200)]
vulkan: Split out a function

We'll need it elsewhere soon.

2 years agovulkan: Add an argument to vfunc
Benjamin Otte [Sun, 25 Jun 2023 20:16:37 +0000 (22:16 +0200)]
vulkan: Add an argument to vfunc

We need this in the future.

2 years agovulkan: Remove nonexisting function from header
Benjamin Otte [Sun, 25 Jun 2023 15:32:58 +0000 (17:32 +0200)]
vulkan: Remove nonexisting function from header

2 years agovulkan: Split out a function
Benjamin Otte [Sun, 25 Jun 2023 03:02:48 +0000 (05:02 +0200)]
vulkan: Split out a function

Making that function externally usable allows having render passes
managed externally.

Also remove a nonexisting function from the header.

2 years agovulkan: Use new ops for TextureScale nodes
Benjamin Otte [Sun, 25 Jun 2023 03:25:01 +0000 (05:25 +0200)]
vulkan: Use new ops for TextureScale nodes

2 years agovulkan: Add new renderops for texture rendering
Benjamin Otte [Sat, 24 Jun 2023 22:56:13 +0000 (00:56 +0200)]
vulkan: Add new renderops for texture rendering

Adds 2 ops:

- Upload
  Creates a new Vulkan image and uploads data into it

- Texture
  Draws a given image

These 2 ops are then used for GskTextureNodes.

2 years agovulkan: Split texture caching code
Benjamin Otte [Sat, 24 Jun 2023 22:54:10 +0000 (00:54 +0200)]
vulkan: Split texture caching code

Instead of having one function that gets the image for the texture and
uploads it if it doesn't exist yet, make it 2 functions:

One to get the texture if it exists.
One to assign an uploaded image to the texture.

This way, we can potentially do the upload ourselves.

2 years agovulkan: Actually run the op_finish()
Benjamin Otte [Sat, 24 Jun 2023 20:29:47 +0000 (22:29 +0200)]
vulkan: Actually run the op_finish()

It's a no-op for all current ops, so it isn't really necessary. But
that's about to change.

2 years agovulkan: Pass context, not uploader
Benjamin Otte [Sat, 24 Jun 2023 20:23:04 +0000 (22:23 +0200)]
vulkan: Pass context, not uploader

We don't need the uploader when creating the image, only when uploading.

2 years agovulkan: Create the first real VulkanOp
Benjamin Otte [Sat, 24 Jun 2023 02:49:39 +0000 (04:49 +0200)]
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.

2 years agovulkan: Allocate render ops differently
Benjamin Otte [Sat, 24 Jun 2023 02:09:56 +0000 (04:09 +0200)]
vulkan: Allocate render ops differently

Allocate the memory up front instead of passing the Op into it.

This way, we can split ops into their own source file and use
init/finish style to use them.

2 years agovulkan: Invent a new abstraction
Benjamin Otte [Sat, 24 Jun 2023 02:00:02 +0000 (04:00 +0200)]
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.

2 years agovulkan: Use the actual RenderOp type
Benjamin Otte [Fri, 23 Jun 2023 03:08:17 +0000 (05:08 +0200)]
vulkan: Use the actual RenderOp type

... instead of the generic one.

This is again preparation for future changes.

2 years agovulkan: Use a byte array for render ops
Benjamin Otte [Fri, 23 Jun 2023 02:40:05 +0000 (04:40 +0200)]
vulkan: Use a byte array for render ops

This allows allocating only as much memory as is needed for each op.

We don't do that yet, this is still preparation.

2 years agovulkan: Split out a function
Benjamin Otte [Fri, 23 Jun 2023 02:22:49 +0000 (04:22 +0200)]
vulkan: Split out a function

This is preparation for future changes.