Commit Graph

77247 Commits

Author SHA1 Message Date
Khalid Abu Shawarib
216a368f22 gtk/calendar: Avoid emision of day-selected signal from nav buttons 2023-07-21 03:38:58 +00:00
Matthias Clasen
fd4da47125 gdk: Drop unnecessary conditionals
We require GLib 2.76 now.
2023-07-20 15:18:13 -04:00
Matthias Clasen
411e0c5fbd tools: Use #pragma once
We are trying to be consistent about this.
2023-07-20 15:18:13 -04:00
Matthias Clasen
e523d3a50e tools: Drop unnecessary conditionals
We require GLib 2.76 now.
2023-07-20 15:18:13 -04:00
Matthias Clasen
99d6a15049 Merge branch 'gtk-fix-issue-4990' into 'main'
Add check for large compose files

Closes #4990

See merge request GNOME/gtk!6195
2023-07-20 17:39:06 +00:00
Matthias Clasen
7fb6c04e99 Make the new compose table test work
This just copies what we do already for other
tests that check parser failures.
2023-07-20 11:48:13 -04:00
Benjamin Otte
08fd9e1f2e Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Various smallish things

See merge request GNOME/gtk!6193
2023-07-19 19:51:57 +00:00
Benjamin Otte
dd641867a2 vulkan: Be more careful with supported images
Now that we can upload all these fancy formats, we need to make sure
that we actually can.
2023-07-19 21:30:35 +02:00
Benjamin Otte
2cbe89de7d memoryformat: fast-path copies of the same format
Basically, memcpy() asap if possible.

This happens a lot in Vulkan, where we gdk_memory_conert() image
data from memory textures straight into the VulkanBuffer.

And usually we support the format.
2023-07-19 21:30:35 +02:00
Benjamin Otte
4d9e7d30b0 vulkan: Add premultiply step to texture upload
When a GdkMemoryFormat is not supported natively and there's
postprocessing required, add a way to mark a VulkanImage as such via the
new postprocess flags.

Also allow texting such iamges only with new_for_upload() and detect
when that is the case and then run a postprocessing step that converts
that image to a suitable format.
This is done with a new "convert" shader/op.

This now supports all formats natively, no conversions happen on the CPU
anymore (unless the GPU is old).
2023-07-19 21:30:35 +02:00
Benjamin Otte
65224f4533 vulkan: Change fallback formats
Always fall back to a format that isn't swizzled.

That way it can be used as a target format for rendering.
2023-07-19 21:30:35 +02:00
Benjamin Otte
cd84f5a56e vulkan: Split renderpass op into 2
Add an explicit begin() and an end() op. For now, this looks like
overkill, but it allows doing renderpasses with custom ops that are not
meant to render a rendernode.

Examples for this are pre/postprocessing passes or 2-pass blur.
2023-07-19 21:30:35 +02:00
Benjamin Otte
4311d17cb1 vulkan: Don't store the renderpass
It's only used when parsing.
2023-07-19 21:30:35 +02:00
Benjamin Otte
11a0646281 vulkan: Pass rectangles where no regions are used
The API was using regions because it always had. But all the code ever
did was get the extents of the region.

So simplify everything by using rectangles everywhere.
2023-07-19 21:30:35 +02:00
Benjamin Otte
492507af11 vulkan: Stop keeping the context around
These days, we can query it with gsk_vulkan_render_get_context().

Makes quite a few functions require one less argument.
And it also makes the GskVulkanRenderPass empty. Gotta figure out what
to do with it.
2023-07-19 21:30:35 +02:00
Benjamin Otte
67a3929583 vulkan: Remove unused stuff fom renderpass
... and move it to the one place where it is used.
2023-07-19 21:30:35 +02:00
Benjamin Otte
413d3819cf 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)
2023-07-19 21:30:35 +02:00
Benjamin Otte
0f289fddf7 vulkan: Fix leaks with pipeline cache
In particular, we were leaking the actual cache and then created a new
one.
2023-07-19 21:30:35 +02:00
Benjamin Otte
92038d6b7f build: Move the glslc check into the top meson file
Put it with the other Vulkan checks, so it's easy to find.
2023-07-19 21:30:35 +02:00
Benjamin Otte
6e27579d1f 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.
2023-07-19 21:30:35 +02:00
Benjamin Otte
390a104ddd ci: Include glslc for Vulkan builds 2023-07-19 21:30:29 +02:00
Luca Bacci
31727a4ec5 Add test for large compose file
See #4990
2023-07-19 17:49:05 +02:00
Luca Bacci
add197bcf7 Add check for large compose files
Fixes #4990
2023-07-19 17:47:22 +02:00
Daniel Boles
e73c4fe133 Merge branch 'dboles/theme-no-backdrop-list-view-text' into 'main'
theme: Don't dim text in backdropped list/listview

See merge request GNOME/gtk!6175
2023-07-19 13:02:28 +00:00
Benjamin Otte
2e6b7b5b78 Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Make RenderOps into proper structs

See merge request GNOME/gtk!6188
2023-07-16 12:22:35 +00:00
Benjamin Otte
90e933a6aa vulkan: Rebuild the shaders
Just to be sure I didn't forget rebuilding some shader at some point.
2023-07-16 13:52:15 +02:00
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
fee497f9e1 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ef4930723b vulkan: Handle images in the ShaderOp
This looks more convoluted in this commit, but future commits will
hopefully make up for it.
2023-07-16 13:16:43 +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
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
ca69fd2b7a 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
db2029d931 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
6f2fd001a0 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
3327a6ba08 vulkan: Simplify render API
Merge reset() and draw() into a single render() function.

Also clean up some naming on the way.
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
93db1cc89e vulkan: Add an UploadGlyphOp
Now all the uploads have their own op.
2023-07-16 13:16:43 +02:00
Benjamin Otte
68b337d457 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
0d5e54986a vulkan: Remove unused functions 2023-07-16 13:16:43 +02:00
Benjamin Otte
822641c161 vulkan: Merge the two upload ops
Now they both use the same upload code.
2023-07-16 13:16:43 +02:00
Benjamin Otte
385ab74922 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
fcf65c7caa 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ece4e59e99 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
6eea08ff99 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
372dcba9c9 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
af817a3362 vulkan: Merge function into only caller
The renderpass reshuffling means we can move a bunch of functions now.

This is one of them.
2023-07-16 13:16:43 +02:00
Benjamin Otte
0edd7547c1 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.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ce042f7ba1 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.
2023-07-16 13:16:41 +02:00
Benjamin Otte
bb2cd7225e 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.
2023-07-16 13:16:15 +02:00
Benjamin Otte
5e1fd56345 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.
2023-07-16 12:13:00 +02:00