gtk4.git
2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Fri, 9 Jun 2023 00:47:26 +0000 (00:47 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

testsuite: Set GIO_USE_VFS=local everywhere

See merge request GNOME/gtk!6076

2 years agoMerge branch 'print-subdir' into 'main'
Matthias Clasen [Fri, 9 Jun 2023 00:32:45 +0000 (00:32 +0000)]
Merge branch 'print-subdir' into 'main'

Move printing code to its own directory

See merge request GNOME/gtk!6067

2 years agotestsuite: Set GIO_USE_VFS=local everywhere
Benjamin Otte [Fri, 9 Jun 2023 00:26:18 +0000 (02:26 +0200)]
testsuite: Set GIO_USE_VFS=local everywhere

And do so centrally, not randomly in individual tests.

(Hopefully) fixes spurious test failures in CI.

Related: #5867

2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Thu, 8 Jun 2023 23:54:07 +0000 (23:54 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

testsuite: Make memorytexture tests random

See merge request GNOME/gtk!6075

2 years agoprint: Reimplement collate preview
Matthias Clasen [Thu, 8 Jun 2023 04:24:38 +0000 (00:24 -0400)]
print: Reimplement collate preview

Redo this with widgets instead of cairo drawing.
The new private widget is called GtkPageThumbnail.

2 years agoprint: Drop some private api use
Matthias Clasen [Thu, 8 Jun 2023 04:02:05 +0000 (00:02 -0400)]
print: Drop some private api use

2 years agoMove resources too
Matthias Clasen [Thu, 8 Jun 2023 03:47:34 +0000 (23:47 -0400)]
Move resources too

2 years agotestsuite: Don't always loop in memorytexture tests
Benjamin Otte [Thu, 8 Jun 2023 23:09:52 +0000 (01:09 +0200)]
testsuite: Don't always loop in memorytexture tests

When running the tests, only run the random (and potentially large) size
download test once instead of 10 times.

There's no real benefit in doing that, both because it's unlikely to
fail only in the 2nd or 9th run and because the sizes are picked
randomly.

This also speeds up the test massively as the download test was
dominating the runtime.

2 years agotestsuite: Make memorytexture tests random
Benjamin Otte [Thu, 8 Jun 2023 23:04:27 +0000 (01:04 +0200)]
testsuite: Make memorytexture tests random

Instead of picking a few numbers in advance and running them through the
test gauntlet every time, pick the random numbers at runtime.

This both increases the test coverage in that it ultimately tests more
combinations across many runs and it reduces the runtime of individual
runs because every tun only runs the download tests twice (with 1px and
the random size) instead of 5 times.

And that speedup benefits the CI, where the asan runs would cause this
test to timeout sometimes.

2 years agoMerge branch 'wip/otte/for-vulkan' into 'main'
Benjamin Otte [Thu, 8 Jun 2023 21:57:07 +0000 (21:57 +0000)]
Merge branch 'wip/otte/for-vulkan' into 'main'

vulkan: Fancy gradients

See merge request GNOME/gtk!6073

2 years agovulkan: Antialiasing for linear gradients
Benjamin Otte [Thu, 8 Jun 2023 19:42:18 +0000 (21:42 +0200)]
vulkan: Antialiasing for linear gradients

Shaders are complicated now...

2 years agotestsuite: Add a test for repeating gradients
Benjamin Otte [Thu, 8 Jun 2023 10:52:33 +0000 (12:52 +0200)]
testsuite: Add a test for repeating gradients

Make sure scaling the image also scales the color stop lookup.

2 years agovulkan: Make gradient shader use buffers
Benjamin Otte [Thu, 8 Jun 2023 10:03:48 +0000 (12:03 +0200)]
vulkan: Make gradient shader use buffers

This allows putting any number of color stops into the buffer, so
fallbacks with too many stops are no longer necessary.

2 years agovulkan: Add support for storage buffers
Benjamin Otte [Thu, 25 May 2023 20:21:23 +0000 (22:21 +0200)]
vulkan: Add support for storage buffers

And add a default storage buffer that is used for per-frame temporary
data.

So far nothing is using this code, this is just infrastructure.

2 years agovulkan: Switch GLSL version to 450
Benjamin Otte [Thu, 8 Jun 2023 09:00:18 +0000 (11:00 +0200)]
vulkan: Switch GLSL version to 450

We need more modern features soon.

2 years agovulkan: Only update descriptor sets with contents
Benjamin Otte [Thu, 8 Jun 2023 04:55:40 +0000 (06:55 +0200)]
vulkan: Only update descriptor sets with contents

If one of the descriptor sets doesn't have any items, don't include it
in the sets passed to vkUpdateDescriptorSets().

This has no effect right now, because we either have both images and
samplers or neither, but it will become relevant once we also support
buffers.

2 years agoprint: Some more include cleanup
Matthias Clasen [Wed, 7 Jun 2023 19:35:12 +0000 (15:35 -0400)]
print: Some more include cleanup

2 years agoUpdate POTFILES.in
Matthias Clasen [Wed, 7 Jun 2023 18:41:46 +0000 (14:41 -0400)]
Update POTFILES.in

The moving the printing sources needs to
be reflected here.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Wed, 7 Jun 2023 15:11:29 +0000 (15:11 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

Fix a compiler warning

See merge request GNOME/gtk!6070

2 years agoci: Mark asan as must-pass
Matthias Clasen [Wed, 7 Jun 2023 14:54:48 +0000 (10:54 -0400)]
ci: Mark asan as must-pass

The asan test run seems to pass pretty
reliably now, so lets keep it that way.

2 years agoFix a compiler warning
Matthias Clasen [Wed, 7 Jun 2023 11:41:30 +0000 (07:41 -0400)]
Fix a compiler warning

Compilers these days are very picky about
their NULLs.

2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Wed, 7 Jun 2023 14:21:32 +0000 (14:21 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

gtk-demo: Remove random numbers

See merge request GNOME/gtk!6069

2 years agogtk-demo: make the sidebar request proper width
Benjamin Otte [Wed, 7 Jun 2023 13:55:59 +0000 (15:55 +0200)]
gtk-demo: make the sidebar request proper width

- 25 chars sounds about right for the texts we use
- don't use min width so we allow shrinking the widget (large text or
  small mobile devices)
- ellipsize the text instead of clipping it.

2 years agogtk-demo: Remove random numbers
Benjamin Otte [Wed, 7 Jun 2023 13:54:53 +0000 (15:54 +0200)]
gtk-demo: Remove random numbers

There were 3 different random numbers set to determine the sidebar width
and all of them were wrong. Remove them.

Instead, propagate the natural width of the listitems.

2 years agoFix a compiler warning
Matthias Clasen [Wed, 7 Jun 2023 11:41:30 +0000 (07:41 -0400)]
Fix a compiler warning

Compilers these days are very picky about
their NULLs.

2 years agoMake introspection build
Matthias Clasen [Wed, 7 Jun 2023 11:27:03 +0000 (07:27 -0400)]
Make introspection build

2 years agoprint: Maintain compatibility
Matthias Clasen [Wed, 7 Jun 2023 04:29:39 +0000 (00:29 -0400)]
print: Maintain compatibility

gtkunixprint.h is a public header, that needs
to keep being installed in the same location.

2 years agoprint: Start sorting apart includes
Matthias Clasen [Wed, 7 Jun 2023 03:35:07 +0000 (23:35 -0400)]
print: Start sorting apart includes

Use gtk/gtk.h in the print sources, so that it
becomes apparent where we are using private apis.

2 years agoprint: Move all the remaining sources
Matthias Clasen [Wed, 7 Jun 2023 03:14:39 +0000 (23:14 -0400)]
print: Move all the remaining sources

Move the unix- and Windows-specific print
sources to the gtk/print subdirectory.

2 years agoprint: Move frontend sources
Matthias Clasen [Wed, 7 Jun 2023 02:52:12 +0000 (22:52 -0400)]
print: Move frontend sources

Move the cross-platform printing sources
to the gtk/print subdirectory.

2 years agoprint: Install headers in a subdir
Matthias Clasen [Wed, 7 Jun 2023 02:45:02 +0000 (22:45 -0400)]
print: Install headers in a subdir

This is a first step towards isolating the printing
code within gtk.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Wed, 7 Jun 2023 03:14:17 +0000 (03:14 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

Drop gtkunixprint-autocleanups.h

See merge request GNOME/gtk!6066

2 years agoprint: Rename private headers
Matthias Clasen [Wed, 7 Jun 2023 02:26:38 +0000 (22:26 -0400)]
print: Rename private headers

Rename private print-related headers to follow our
naming conventions:
gtkprintutils.h -> gtkprintutilsprivate.h
gtkprinteroption.h -> gtkprinteroptionprivate.h
gtkprinteroptionset.h => gtkprinteroptionsetprivate.h
gtkprinteroptionwidget.h -> gtkprinteroptionwidgetprivate.h

2 years agoDrop gtkunixprint-autocleanups.h
Matthias Clasen [Wed, 7 Jun 2023 02:18:12 +0000 (22:18 -0400)]
Drop gtkunixprint-autocleanups.h

Move these definitions where they belong
and git rid of an auxiliary header we don't
need anymore.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Tue, 6 Jun 2023 11:17:32 +0000 (11:17 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

ci: More asan test runs

See merge request GNOME/gtk!6064

2 years agoMerge branch 'wip/otte/fix-glx' into 'main'
Marco Trevisan [Tue, 6 Jun 2023 10:56:55 +0000 (10:56 +0000)]
Merge branch 'wip/otte/fix-glx' into 'main'

glx: Ignore all errors

See merge request GNOME/gtk!6065

2 years agoglx: Fake an X request to make GLX hack work
Benjamin Otte [Tue, 6 Jun 2023 03:13:39 +0000 (05:13 +0200)]
glx: Fake an X request to make GLX hack work

Sometimes, GLX can decide to use the previous request serial when faking
XErrors via __glXSendError() (look through the Mesa sources to enjoy).
This can cause the error trap we just installed to not feel responsible
for the error. And that makes GDK decide to immediately abort the
application.
That is not what we or GLX want.

So we use a no-op X Request to bump the request number so that when GLX
does its shenanigans, it uses a serial that our error trap will catch.

Fixes a crash in mutter's CI which apparently manages to drive GLX
without an X server.

2 years agoglx: Move error trap even further out
Benjamin Otte [Tue, 6 Jun 2023 02:57:12 +0000 (04:57 +0200)]
glx: Move error trap even further out

This way we only create one error trap for all attempts to create a
context instead of up to 3.

2 years agoglx: Ignore all errors
Benjamin Otte [Mon, 5 Jun 2023 17:12:29 +0000 (19:12 +0200)]
glx: Ignore all errors

In error cases, glXCreateContextAttribsARB() will always return NULL so
it is enough to run the loop until the first non-NULL context is
returned.

And at that point, we can just look at the return value and ignore all
errors.

2 years agoci: Build less for asan
Matthias Clasen [Tue, 6 Jun 2023 02:05:16 +0000 (22:05 -0400)]
ci: Build less for asan

The asan build is all about running the tests
with asan, so lets not waste time building
demos and examples.

2 years agoci: More asan test runs
Matthias Clasen [Tue, 6 Jun 2023 01:47:36 +0000 (21:47 -0400)]
ci: More asan test runs

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Tue, 6 Jun 2023 01:37:47 +0000 (01:37 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

Revert "ci: More verbose output from asan"

See merge request GNOME/gtk!6063

2 years agoci: Disable headless tests under asan
Matthias Clasen [Tue, 6 Jun 2023 01:15:31 +0000 (21:15 -0400)]
ci: Disable headless tests under asan

Our use of LD_PRELOAD for these tests does not
sit right with asan, so just skip them in this
case.

2 years agoci: Tweak asan options
Matthias Clasen [Tue, 6 Jun 2023 01:09:51 +0000 (21:09 -0400)]
ci: Tweak asan options

Allow the allocator to return NULL, so our
g_try_malloc tests don't fail.

2 years agoci: Turn off LeakSanitizer
Matthias Clasen [Tue, 6 Jun 2023 00:56:00 +0000 (20:56 -0400)]
ci: Turn off LeakSanitizer

When it is enabled, almost every report from asan is
"LeakSanitizer has encountered a fatal error."
So try without.

2 years agoci: Reenable asan builds
Matthias Clasen [Mon, 5 Jun 2023 20:21:24 +0000 (16:21 -0400)]
ci: Reenable asan builds

This is an attempts to catch sporadic ci failures.

2 years agowayland: Free seat globals in dispose
Matthias Clasen [Mon, 5 Jun 2023 22:05:27 +0000 (18:05 -0400)]
wayland: Free seat globals in dispose

This matches what we do for the display globals.

2 years agogdk: Dispose seats when a display is closed
Matthias Clasen [Mon, 5 Jun 2023 22:04:12 +0000 (18:04 -0400)]
gdk: Dispose seats when a display is closed

We dispose the display itself. It does not make
sense to hold onto seat resources beyond that point.

2 years agowayland: Don't leak all globals
Matthias Clasen [Mon, 5 Jun 2023 21:18:10 +0000 (17:18 -0400)]
wayland: Don't leak all globals

2 years agowayland: Drop an unused field
Matthias Clasen [Mon, 5 Jun 2023 21:17:48 +0000 (17:17 -0400)]
wayland: Drop an unused field

Nobody is using the wl_input_device field.

2 years agoRevert "ci: More verbose output from asan"
Matthias Clasen [Mon, 5 Jun 2023 18:52:15 +0000 (14:52 -0400)]
Revert "ci: More verbose output from asan"

This reverts commit 4f65c121b701c839552b89991d009c48d8636480.

2 years agoPost-release version bump
Matthias Clasen [Mon, 5 Jun 2023 11:39:28 +0000 (07:39 -0400)]
Post-release version bump

2 years ago4.11.3
Matthias Clasen [Mon, 5 Jun 2023 11:26:41 +0000 (07:26 -0400)]
4.11.3

2 years agoMerge branch 'search-entry-allocation' into 'main'
Matthias Clasen [Mon, 5 Jun 2023 10:17:46 +0000 (10:17 +0000)]
Merge branch 'search-entry-allocation' into 'main'

text: Make the placeholder non-intrusive

See merge request GNOME/gtk!6060

2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Mon, 5 Jun 2023 04:07:27 +0000 (04:07 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

testsuite: Adapt color-matrix testcase

See merge request GNOME/gtk!6018

2 years agostringsorter: Handle NULL strings
Benjamin Otte [Sat, 27 May 2023 17:05:32 +0000 (19:05 +0200)]
stringsorter: Handle NULL strings

NULL is a valid string GValue, so we need to handle it.
The utf8 normalizing and collating functions do not, so we better catch
it early.

2 years agotestsuite: Make clipped-repeat test work universally
Benjamin Otte [Sun, 21 May 2023 03:40:26 +0000 (05:40 +0200)]
testsuite: Make clipped-repeat test work universally

Cover the rounded corners so that they cause no visible difference in
the end result.

2 years agorendernode: Scale repeat offscreens properly
Benjamin Otte [Mon, 5 Jun 2023 03:29:41 +0000 (05:29 +0200)]
rendernode: Scale repeat offscreens properly

Respect the matrix in use at time of encountering a repeat node so that
the offscreen uses roughly the same device pixel density as the target.

Fixes the handling of the clipped-repeat test.

2 years agorendernode: Use cairo_set_device_offset()
Benjamin Otte [Sun, 21 May 2023 03:03:49 +0000 (05:03 +0200)]
rendernode: Use cairo_set_device_offset()

Simplifies the code.

2 years agotestsuite: Adapt color-matrix testcase
Benjamin Otte [Sun, 21 May 2023 02:48:46 +0000 (04:48 +0200)]
testsuite: Adapt color-matrix testcase

Make it use an alpha value that is well defined, ie 0.4 instead of 0.5.

0.4 * 255 = 102
0.5 * 255 = 127.5

This avoids rounding issues where some math may cause the resulting
alpha value to be 127, and some other math ends up with 128.

2 years agotestsuite: fix memleak
Benjamin Otte [Sun, 4 Jun 2023 18:15:24 +0000 (20:15 +0200)]
testsuite: fix memleak

Also use the actual diff command we found instead of searching for it
again.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Mon, 5 Jun 2023 03:03:01 +0000 (03:03 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

gl: Free all tracked buffers

See merge request GNOME/gtk!6061

2 years agogl: Free all tracked buffers
Matthias Clasen [Mon, 5 Jun 2023 02:17:56 +0000 (22:17 -0400)]
gl: Free all tracked buffers

This was overlooked when the number of tracked
buffers was bumped from 2 to 4 in 46e3454eb7730e4.

2 years agosearchentry: Improve size allocation
Matthias Clasen [Mon, 5 Jun 2023 01:44:37 +0000 (21:44 -0400)]
searchentry: Improve size allocation

We want to always reserve space for the clear icon,
but let the text widget use that space when the icon
isn't shown. A plain box layout can't do that, so
do our own size allocation.

2 years agotext: Make the placeholder non-intrusive
Matthias Clasen [Mon, 5 Jun 2023 01:45:59 +0000 (21:45 -0400)]
text: Make the placeholder non-intrusive

We never want to let the placeholder cause
the widget to grow, so set its max-width-chars
to a small value to make it ellipsize.

2 years agoMerge branch 'wip/otte/vulkan' into 'main'
Benjamin Otte [Sun, 4 Jun 2023 18:21:21 +0000 (18:21 +0000)]
Merge branch 'wip/otte/vulkan' into 'main'

Vulkan hacking going overboard

See merge request GNOME/gtk!5992

2 years agovulkan: Create multiple render objects
Benjamin Otte [Wed, 24 May 2023 14:55:18 +0000 (16:55 +0200)]
vulkan: Create multiple render objects

Sometimes the GPU is still busy when the next frame starts (like when
no-vsync benchmarking), so we need to keep all those resources alone and
create new ones.
That's what the render object is for, so we just create another one.

However, when we create too many, we'll starve the CPU. So we'll limit
it. Currently, that limit is at 4, but I've never reached it (I've also
not starved the GPU yet), so that number may want to be set lower/higher
in the future.

Note that this is different from the number of outstanding buffers, as
those are not busy on the GPU but on the compositor, and as such a
buffer may have not finished rendering but have been returend from the
compositor (very busy GPU) or have finished rendering but not been
returned from the compositor (very idle GPU).

2 years agovulkan: Stop differentiating rounded from cicular corners
Benjamin Otte [Tue, 23 May 2023 21:47:55 +0000 (23:47 +0200)]
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.

2 years agovulkan: Cleanup: Initialize constants at the top
Benjamin Otte [Tue, 23 May 2023 03:32:35 +0000 (05:32 +0200)]
vulkan: Cleanup: Initialize constants at the top

2 years agovulkan: Add support for texture-scale nodes
Benjamin Otte [Tue, 23 May 2023 03:26:08 +0000 (05:26 +0200)]
vulkan: Add support for texture-scale nodes

2 years agovulkan: Split textures and samplers
Benjamin Otte [Tue, 23 May 2023 03:08:13 +0000 (05:08 +0200)]
vulkan: Split textures and samplers

The idea here is that we can do more complex combinations and use that
to support texture-scale nodes or use fancy texture formats (suc as
YUV).

I'm not sure this is actually necessary, but for now it gives more
flexibility.

2 years agovulkan: Add a hackish way to handle empty children
Benjamin Otte [Mon, 22 May 2023 02:21:02 +0000 (04:21 +0200)]
vulkan: Add a hackish way to handle empty children

For blend and crossfade nodes, one of the children may exist and
influence the rendering, while the other does not.

Previously, we would skip the node, which would cause the required
rendering to not happen. We now send a valid texture id for the
invalid offscreen, thereby actually rendering the required parts.

Fixes the blend-invisible-child compare test

Current state for compare tests:
Ok:                 397
Expected Fail:      0
Fail:               26
Unexpected Pass:    0
Skipped:            2
Timeout:            0

2 years agovulkan: Convert blend shader
Benjamin Otte [Sun, 21 May 2023 02:42:02 +0000 (04:42 +0200)]
vulkan: Convert blend shader

Same work as crossfade shader pretty much.

2 years agovulkan: Update the cross-fade shader
Benjamin Otte [Sat, 20 May 2023 23:28:36 +0000 (01:28 +0200)]
vulkan: Update the cross-fade shader

This also fixes it rendering weird things when the bounds of start and
end node don't match.

2 years agovulkan: Implement bindless texture rendering
Benjamin Otte [Sat, 20 May 2023 00:56:02 +0000 (02:56 +0200)]
vulkan: Implement bindless texture rendering

Instead of having a descriptor set per operation, we just have one
descriptor set and bind all our images into it.

Then the shaders get to use an index into the large texture array
instead.

Getting this to work - because it's a Vulkan extension that needs to be
manually enabled, even though it's officially part of Vulkan 1.2 - is
insane.

2 years agovulkan: Clip using scissors
Benjamin Otte [Fri, 19 May 2023 03:35:18 +0000 (05:35 +0200)]
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.

2 years agovulkan: Make scissoring an explicit operation
Benjamin Otte [Fri, 19 May 2023 01:08:43 +0000 (03:08 +0200)]
vulkan: Make scissoring an explicit operation

The idea is to use it for clip nodes when they are integer-aligned.

To do that, we need to track the scissor rect in the parse state, so we
do that, too.

Also move the viewport offset out of the projection matrix, as it is
part of the transform between clip and scissor, so it needs to live in
the offset.

2 years agovulkan: Remove unneeded struct member
Benjamin Otte [Thu, 18 May 2023 21:35:59 +0000 (23:35 +0200)]
vulkan: Remove unneeded struct member

We can use gsk_vulkan_pipeline_get_vertex_stride() whenever we need that
value.

2 years agovulkan: Bind vertex buffers only once
Benjamin Otte [Thu, 18 May 2023 21:34:27 +0000 (23:34 +0200)]
vulkan: Bind vertex buffers only once

We can index into the same buffer from every pipeline due to the aligned
buffer writes (see previous commit).

So we do that.

2 years agovulkan: Align vertex data
Benjamin Otte [Thu, 18 May 2023 21:22:25 +0000 (23:22 +0200)]
vulkan: Align vertex data

We align the data to a multiple of vertex stride, that way we use more
memory, but we could compute an offset into the vertex buffer without
changing the offset.

2 years agovulkan: Set offsets when counting
Benjamin Otte [Thu, 18 May 2023 21:10:16 +0000 (23:10 +0200)]
vulkan: Set offsets when counting

We can set the vertex offset while counting the data, this gets rid of
the need of passing all the counting machinery into the actual data
collection code.

2 years agovulkan: Simplify switch statement
Benjamin Otte [Thu, 18 May 2023 20:55:15 +0000 (22:55 +0200)]
vulkan: Simplify switch statement

All branches do the same thing now, so pull them all into the same
branch.

2 years agovulkan: Simplify collect_vertex_data()
Benjamin Otte [Thu, 18 May 2023 20:52:17 +0000 (22:52 +0200)]
vulkan: Simplify collect_vertex_data()

We don't have any size arguments to it, so don't use them.

2 years agovulkan: Remove a function from pipeline impls
Benjamin Otte [Thu, 18 May 2023 19:56:20 +0000 (21:56 +0200)]
vulkan: Remove a function from pipeline impls

That function is available already in the structs we feed to Vulkan.

Store it from there and reuse it.

2 years agovulkan: Don't draw fully clipped nodes
Benjamin Otte [Thu, 18 May 2023 01:03:10 +0000 (03:03 +0200)]
vulkan: Don't draw fully clipped nodes

... if they are container nodes. Other nodes will get culled by the
vertex shader.

2 years agovulkan: Add optimization for transforms
Benjamin Otte [Wed, 17 May 2023 23:18:38 +0000 (01:18 +0200)]
vulkan: Add optimization for transforms

When attempting a complex transform, check if the clip can be ignored
and do that if possible.

That way we don't cause fallbacks when transforming the clip is too
complex.

2 years agovulkan: Don't crash with overly large nodes
Benjamin Otte [Sun, 4 Jun 2023 17:16:04 +0000 (19:16 +0200)]
vulkan: Don't crash with overly large nodes

... when these nodes are used as children of a complex transform nodes
and we lose the clip.

2 years agovulkan: Update texture shader to do AA
Benjamin Otte [Mon, 15 May 2023 00:25:41 +0000 (02:25 +0200)]
vulkan: Update texture shader to do AA

2 years agovulkan: Split generic code off
Benjamin Otte [Mon, 15 May 2023 00:24:50 +0000 (02:24 +0200)]
vulkan: Split generic code off

No need to duplicate code in shaders when it can be shared.

2 years agovulkan: Use rounded rect APIs to improve clips
Benjamin Otte [Sun, 14 May 2023 23:56:10 +0000 (01:56 +0200)]
vulkan: Use rounded rect APIs to improve clips

There are a bunch of intersection APIs available these days.
Let's use them.

2 years agogsk: Add (private) gsk_rounded_rect_intersection()
Benjamin Otte [Sun, 14 May 2023 21:13:23 +0000 (23:13 +0200)]
gsk: Add (private) gsk_rounded_rect_intersection()

The idea is that for a rectangle intersection, each corner of the
result is either entirely part of one original rectangle or it is
an intersection point.

By detecting those 2 cases and treating them differently, we can
simplify the code to compare rounded rectangles.

2 years agovulkan: Set the initial clip rect
Benjamin Otte [Sun, 14 May 2023 02:15:06 +0000 (04:15 +0200)]
vulkan: Set the initial clip rect

Instead of rendering unclipped, set the clip region to the extents of
the current clip region.

2 years agovulkan: Only draw one rect
Benjamin Otte [Sun, 14 May 2023 02:12:14 +0000 (04:12 +0200)]
vulkan: Only draw one rect

Instead of emitting the render commands once per rectangle of the clip
region, just emit them once with the region's extents.

This is generally faster because it emits fewer commands to the GPU,
even though it may touch significantly more pixels.

For a proper method, we'd need to record the commands per clip rectangle
instead of emitting all of them all the time.

2 years agovulkan: Use CLAMP_TO_EDGE in sampler
Benjamin Otte [Sat, 13 May 2023 04:02:51 +0000 (06:02 +0200)]
vulkan: Use CLAMP_TO_EDGE in sampler

We don't want to clamp to the border, that causes fade-outs at the
edges.

2 years agovulkan: Rewrite AA shaders to respect scale
Benjamin Otte [Sat, 13 May 2023 01:14:16 +0000 (03:14 +0200)]
vulkan: Rewrite AA shaders to respect scale

The border and color shaders - the ones that do AA - now multiply their
coordinates by the scale factor, which gives them better rounding
capabilities.

This in particular improves the case where they are used in fractional
scaling situations, where the scale is defined at the root element.

2 years agovulkan: Don't allocate no descriptor sets
Benjamin Otte [Fri, 12 May 2023 20:19:37 +0000 (22:19 +0200)]
vulkan: Don't allocate no descriptor sets

If we don't need them, exit early.

Shuts up the validation layers when running simple denos without
textures.

2 years agovulkan: Only use a single pipeline layout
Benjamin Otte [Fri, 12 May 2023 18:49:31 +0000 (20:49 +0200)]
vulkan: Only use a single pipeline layout

There's no need to use 3 different ones when they are compatible.

2 years agovulkan: Don't cull vertices
Benjamin Otte [Fri, 12 May 2023 16:17:44 +0000 (18:17 +0200)]
vulkan: Don't cull vertices

We end up with the backside, when we scale(-1) and we still want it to
be visible, just flipped.

2 years agovulkan: Use scale factor for offscreens and fallbacks
Benjamin Otte [Fri, 12 May 2023 13:23:02 +0000 (15:23 +0200)]
vulkan: Use scale factor for offscreens and fallbacks

Previously, we just used the defaultscale factor, but now that we're
having it available in push constants, we can read it back for creating
offscreens and rendering fallbacks.

So do that.

2 years agovulkan: Split scale from matrix
Benjamin Otte [Fri, 12 May 2023 03:15:28 +0000 (05:15 +0200)]
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.