Commit Graph

20 Commits

Author SHA1 Message Date
Benjamin Otte
d30a9e7fa9 gsk: Add gskrectprivate.h
Add a bunch of inline functions for graphene_rectangle_t.

We use those quite extensively in tight loops so making them as fast as
possible via inlining has massive benefits.

The current render-heavy benchmark I am playing (th paris-30k in node-editor)
went from 49fps to 85fps on my AMD.
2023-07-22 01:33:44 +02:00
Benjamin Otte
a8ff291a12 vulkan: Make clip type an enum
and add gsk_vulkan_shader_op_alloc() that sets it properly.
2023-07-16 13:16:43 +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
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
82ba8c848b vulkan: Handle empty rects in intersects_rect()
Apart from the none case, this was already handled, so we just check if
the rect is empty now.
2023-06-11 03:15:08 +02:00
Benjamin Otte
f1b1aacc34 vulkan: Stop differentiating rounded from cicular corners
Our shaders can handle both, so don'ttry to tell them apart anymore.

Removes a lot of unnecessary fallbacks.
2023-06-04 19:42:01 +02:00
Benjamin Otte
b791aa0301 vulkan: Clip using scissors
If we have a rectangular clip without transforms, we can use
scissoring. This works particularly well because it allows intersecting
rounded rectangles with regular rectangles in all cases:
Use the scissor rect for the rectangle and the normal clipping code for
the rounded rectangle.
2023-06-04 19:42:01 +02:00
Benjamin Otte
0fee26252c vulkan: Don't draw fully clipped nodes
... if they are container nodes. Other nodes will get culled by the
vertex shader.
2023-06-04 19:42:01 +02:00
Benjamin Otte
6d8c8199d9 vulkan: Use rounded rect APIs to improve clips
There are a bunch of intersection APIs available these days.
Let's use them.
2023-06-04 19:42:01 +02:00
Benjamin Otte
7f5504bea4 vulkan: Set the initial clip rect
Instead of rendering unclipped, set the clip region to the extents of
the current clip region.
2023-06-04 19:42:01 +02:00
Benjamin Otte
a09580b9ef vulkan: Split scale from matrix
Now, the scale is no longer part of the matrix. This allows shaders to
transform points by the scale which increases accuracy for antialiasing.
2023-06-04 19:42:01 +02:00
Benjamin Otte
b02e054592 vulkan: Add offset to the Vulkan clip checks
This was forgotten when tracking the offset was added, so code was
actually selecting the wrong shaders.
2023-06-04 19:42:01 +02:00
Benjamin Otte
b9bd7124c0 vulkan: Fix typo in clipping code 2023-05-16 18:53:27 +02:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Benjamin Otte
fea67dea6a vulkan: Improve rounded rect clipping
Handle the case where the inner rounded rect is fully contained
within the outer rounded rect.
2021-03-09 17:43:28 +01:00
Benjamin Otte
9f18c138d1 vulkan: Fix invalid read
Look at the right rect to compute circularness
2021-03-09 17:43:28 +01:00
Benjamin Otte
91932ada63 vulkan: Handle simple transforms in the clipping code
Requires pushing the GskTransform into the clipping code so that we
can actually look at its category.
2021-03-05 19:36:36 -05:00
Benjamin Otte
3f9b8f25d8 vulkan: Add missing break statement 2019-04-15 14:38:23 +02:00
Matthias Clasen
3771c95c72 gsk: Move Vulkan sources to a subdirectory
Following what was already done for GL.
2018-01-06 09:36:55 -05:00