Commit Graph

77058 Commits

Author SHA1 Message Date
Benjamin Otte
b2296a1918 vulkan: Port inset and outset shadow to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
594595d9cd vulkan: Port blend mode 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
a61fe61318 vulkan: Factor out call to opacity op
I want to reuse it for crossfades (see next commit).
2023-07-16 12:12:36 +02:00
Benjamin Otte
99085605a8 vulkan: Convert color op to new method
This is a straightforward and simple port.
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
b049990356 Revert "vulkan: Always render clip extents"
This reverts commit 0f184d3270.

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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8207c548cc vulkan: Combine textures and samplers again
This reverts most of commit f420c143e0
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/
2023-07-16 12:12:36 +02:00
Benjamin Otte
83960622e3 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.
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
8bacfad171 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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
53e7277584 vulkan: Implement fallback using new nodes
With Cairo upload and texture nodes being available, we can do that now.
2023-07-16 12:12:36 +02:00
Benjamin Otte
e43b7902be vulkan: Pass bounds to texture op
This way the node can do the normalization (and maybe stop doing it
in the future).
2023-07-16 12:12:36 +02:00
Benjamin Otte
f1d81bb7df vulkan: Add a Cairo upload node
... and use it for cairo nodes.
2023-07-16 12:12:36 +02:00
Benjamin Otte
84cf6de36d vulkan: Port opacity to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
aaa219497b vulkan: Add offscreen and color-matrix op
.. and use them for color-matrix operations.
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
b45a2025d9 vulkan: Remove nonexisting function from header 2023-07-16 12:12:36 +02:00
Benjamin Otte
0946b0b333 vulkan: Split out a function
Making that function externally usable allows having render passes
managed externally.

Also remove a nonexisting function from the header.
2023-07-16 12:12:36 +02:00
Benjamin Otte
1d9ad55c54 vulkan: Use new ops for TextureScale nodes 2023-07-16 12:12:36 +02:00
Benjamin Otte
94a64329c2 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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
ba502a5009 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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
e1d2477485 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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
2fef53b154 vulkan: Pass context, not uploader
We don't need the uploader when creating the image, only when uploading.
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
8d928ad340 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.
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
Benjamin Otte
df0dd296e9 vulkan: Use the actual RenderOp type
... instead of the generic one.

This is again preparation for future changes.
2023-07-16 12:12:36 +02:00
Benjamin Otte
34e13556b4 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.
2023-07-16 12:12:36 +02:00
Benjamin Otte
bdbb1398db vulkan: Split out a function
This is preparation for future changes.
2023-07-16 12:12:36 +02:00
Emmanuele Bassi
b00ca0d699 Merge branch 'dboles/EventControllerKeyModifiersDocs' into 'main'
EventControllerKey: doc fixes re Modifiers

See merge request GNOME/gtk!6186
2023-07-14 14:04:47 +00:00
Daniel Boles
8c4245da2f EventControllerKey: Remove redundant/unliked "See"
Saying "See [Thing]" is not very helpful without it being a link to
Thing, and we already get that for free as the "Type:" of the param.
2023-07-14 14:22:57 +01:00
Daniel Boles
7e7aa17484 EventControllerKey: Remove wrong signal arg, which
caused the resulting parameter to be called keyval, but it must be state
2023-07-14 14:22:25 +01:00
Ekaterine Papava
4e6a04152b Update Georgian translation 2023-07-14 11:48:35 +00:00
Emmanuele Bassi
fb56929791 Merge branch 'nielsdg/fix-sectionmodel-signal-doc' into 'main'
sectionmodel: Fix GIR comment for sections-changed

See merge request GNOME/gtk!6185
2023-07-13 23:40:03 +00:00
Niels De Graef
c9022ac2d5 sectionmodel: Fix GIR comment for sections-changed
Make sure to end the signal name with a colon so GIR recognizes the
signal. This should also fix the problem that the documentation for that
signal is currently missing in the rendered gi-docgen output.
2023-07-14 01:03:21 +02:00
Benjamin Otte
0b6392c0a8 Merge branch 'vulkan-resize-fix' into 'main'
vulkan: Wait for device to be idle before create/recreating swapchain

See merge request GNOME/gtk!6183
2023-07-13 13:19:29 +00:00
José Roberto de Souza
526c0404c2 vulkan: Wait for device to be idle before create/recreating swapchain
Wait for device to be idle because this function is also called in
window resizes.
And if we destroy old swapchain it also destroy the old VkImages,
those images could be in use by a vulkan render.

This fixes a issue reported in Mesa repository when running
GTK with Xe KMD.

Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9044
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2023-07-13 05:40:55 -07:00
Matthias Clasen
cdacfc5a21 Merge branch 'fix-validate-crash' into 'main'
buildertool: Exit orderly

Closes #5948

See merge request GNOME/gtk!6182
2023-07-12 20:11:46 +00:00
Matthias Clasen
ab809d1dc3 buildertool: Exit orderly
The validate command does need a display connection,
for better or worse. So exit in an orderly fashion
if we don't have one, instead of crashing.

Fixes: #5948
2023-07-12 15:49:11 -04:00
Benjamin Otte
6dd9048c6d Merge branch 'wip/otte/for-main' into 'main'
textbtree: Remove unnecessary check

See merge request GNOME/gtk!6179
2023-07-11 00:04:17 +00:00
Benjamin Otte
3523d56122 vulkan: Change the clip intersection check
Intersection with a roudned clip takes too long.

Instead, rename the function to may_intersect() to be clear about what
it does and then just intersect with the regular rectangle.
2023-07-11 01:39:25 +02:00
Benjamin Otte
5c601b673e vulkan: intersect rects also for CLIP_NONE
If we don't clip anything, we stil have bounds - either the framebuffer
size or (more likely) the scissor rect. And we don't want to draw
anything that is outside these bounds.

So clip in those cases, too.

Stops gtk4-demo --run=listbox from trying to render the whole listbox
instead of only the visible parts.
2023-07-10 06:32:01 +02:00
Benjamin Otte
465a34e6b0 rendernode: Implement proper GSK_IS_RENDERNODE()
Use G_TYPE_CHECK_INSTANCE_TYPE() instead of just checking for != NULL.
After all, this is a GTypeInstance.

Also fixes some gcc complaints when checking
  node == NULL || GSK_IS_RENDERNODE (node)
which gcc was convinced would be always true.
2023-07-10 06:32:01 +02:00
Benjamin Otte
aa82a400df textbtree: Remove unnecessary check
Since a93614409e we don't allocate the
stack anymore, so this NULL check is unnecessary now - and it's flagged
by compilers.
2023-07-10 06:32:01 +02:00
Matthias Clasen
1f3db35271 Merge branch 'dboles/image-notify-storage-type' into 'main'
Image—Notify when :storage-type changes from EMPTY

See merge request GNOME/gtk!6170
2023-07-07 01:15:56 +00:00
Emmanuele Bassi
18cce46ed2 Merge branch 'wip/corey/listitemleak' into 'main'
gtklistitemmanager: Stop leaking item

Closes #5940

See merge request GNOME/gtk!6171
2023-07-06 23:57:16 +00:00
Corey Berla
e78148bae5 gtklistitemmanager: Stop leaking item
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5940
2023-07-06 16:24:29 -07:00