Commit Graph

78740 Commits

Author SHA1 Message Date
Benjamin Otte
4cbd384e39 gpu: Have a get_node_as_pattern() function
... and use it to replace all the individual parts of code that get the
node as a pattern.
2024-01-07 07:22:50 +01:00
Benjamin Otte
12010a597b gpu: Add a texture pattern
Needs a lot of infrastructure for handling images, but we're handling
images now.
2024-01-07 07:22:50 +01:00
Benjamin Otte
720ac700b3 gpu: Move the pattern code into the nodeprocessor
We need the nodeprocessor infrastructure to create patterns, so keeping
it in a different source file would just cause header headaches.
2024-01-07 07:22:50 +01:00
Benjamin Otte
373a6ab9f1 gpu: Add a texture cache
... and use it when drawing textures.

We'll need it in other places later, but for now that's what we have.
2024-01-07 07:22:50 +01:00
Benjamin Otte
57c1c95e75 gpu: Make frames carry a timestamp
Frames now carry a timestamp for when they are used.

This is mainly intended to attach timestamps to cached items (textures
or glyphs), but it could in theory also be used when profiling.

We use wallclock time here, not server time, because it's cheaper and
because we're more intereseted in the local machine we're rendering on.
2024-01-07 07:22:50 +01:00
Benjamin Otte
ffc117564b gpu: Make patterns do opacity nodes
Of course, for now this only works for opacity nodes that contain color
nodes, but we're still building up to ore useful stuff here.
2024-01-07 07:22:50 +01:00
Benjamin Otte
ee3367697d gpu: Move pattern code into its own file
Now we can extend the pattern creation easily - and we can add new
patterns quickly later.

Plus, we need to keep this file in sync with pattern.glsl and it's neat
when those 2 files reference only each other.
2024-01-07 07:22:50 +01:00
Benjamin Otte
c6e19f0384 gpu: Add float array to shaders and add an ubershader
... and use it for a naive color node implementation using both
so I can test it actually works.
2024-01-07 07:22:50 +01:00
Benjamin Otte
9df265acdc gpu: Clip fallback nodes to current clip
Avoids uploading parts of the node that aren't visible.
2024-01-07 07:22:49 +01:00
Benjamin Otte
461d9b4052 gpu: Set scissor rect before clearing
The render area that restricts clearing on Vulkan needs to be respected
by the GL renderer, too.
2024-01-07 07:22:49 +01:00
Benjamin Otte
0ed45c5f40 gpu: Move global syncing out
This is necessary so that fallback code can properly sync itself,
instead of just add_node().

Fixes a bunch of glitches when fallbacks would be used.
2024-01-07 07:22:49 +01:00
Benjamin Otte
73ac2d0a1c gpu: Add a flip_y argument to shader execution
Because GL flips its shit sometimes (ie when it's the framebuffer),
pass the height of the target as the flip variable, so commands
that need to operate on the pixels can flip the y axis around this value.
2024-01-07 07:22:49 +01:00
Benjamin Otte
57ab670991 gpu: Add handling for (rounded) clip node(s)
This is again mostly a copy of the Vulkan renderer.

It's a bit awkward codewise with the new invalidation framework,
because we need to cache the previous values individually now,
but it's a lot more finegrained, and we don't emit globals multiple
times when clips are nested.
2024-01-07 07:22:49 +01:00
Benjamin Otte
e2b5e0d17d gpu: Add scissor operation
Nothing is using it yet (we don't do clipping) apart from initializing
the scissor rect at startup.
2024-01-07 07:22:49 +01:00
Benjamin Otte
77e05a4240 gpu: Add support for transform nodes
This essentially copies the Vulkan renderer machinery, but adapts it to
the new handling with pending globals.
2024-01-07 07:22:49 +01:00
Benjamin Otte
97c5bb284b gpu: Document the coordinate systems we use 2024-01-07 07:22:49 +01:00
Benjamin Otte
286b473f55 gpu: Add gsk_gpu_image_get_projection_matrix()
... and use it to initialize the "proper" projection matrix to use in
shaders.

The resulting viewport will go from top left (0,0) to bottom right
(width, height) and the z clipping plane will go from -10000 to 10000.
2024-01-07 07:22:49 +01:00
Benjamin Otte
1152c93778 gpu: Handle container nodes
Now everything is slower because we upload every other node
individually!
2024-01-07 07:22:49 +01:00
Benjamin Otte
1a85d569e3 gpu: Add ability to run shaders
This heaves over an inital chunk of code from the Vulkan renderer to
execute shaders.

The only shader that exists for now is a shader that draws a single
texture.
We use that to replace the blit op we were doing before.
2024-01-07 07:22:49 +01:00
Benjamin Otte
bd114ab1a8 inspector: Learn about new renderers 2024-01-07 07:22:49 +01:00
Benjamin Otte
7a1f764910 gsk: Add new renderers to the GSK_RENDERER env var
Use:
  "ngl" for the new GL renderer
  "vulkan" for the new Vulkan renderer
2024-01-07 07:22:49 +01:00
Benjamin Otte
10f934f782 node-editor: Add the new renderer(s) 2024-01-07 07:22:49 +01:00
Benjamin Otte
97c60b84c8 gl: Undeprecate the NGL renderer for now
It's used for the new GPU renderer.
2024-01-07 07:22:49 +01:00
Benjamin Otte
bf89431464 gpu: Use gdk_draw_context_empty_frame() when appropriate
It's a new function, so make use of it.
2024-01-07 07:22:49 +01:00
Benjamin Otte
9ddae8aebc gpu: Add outline of new GPU renderer
For now, it just renders using cairo, uploads the result to the GPU,
blits it onto the framebuffer and then is happy.

But it can do that using Vulkan and using GL (no idea which version).

The most important thing still missing is shaders.

It also has a bunch of copy/paste from the Vulkan renderer that isn't
used yet.
But I didn't want to rip it out and then try to copy it back later
2024-01-07 07:22:49 +01:00
Benjamin Otte
e3c70645f9 vulkan: Turn Vulkan instances into init/ref/unref
This is not yet used.
2024-01-07 07:22:49 +01:00
Benjamin Otte
1e54e838e0 vulkan: Remove GskVulkanRenderer
We want to introduce a new one next.

Technically, this breaks API, because gsk_vulkan_renderer_new() is going
away, but practically, we're gonna bring it back once we introduce that
renderer in a few commits.
2024-01-07 07:22:49 +01:00
Benjamin Otte
40854f2ae9 gsk: Add header guard to missing header 2024-01-07 07:22:49 +01:00
Matthias Clasen
6bc7ec3d4d Merge branch 'fix-docs-links' into 'main'
docs: Fix: gdk->gtk links

See merge request GNOME/gtk!6711
2024-01-05 20:10:33 +00:00
Matthias Clasen
bda6530fea docs: Fix: gsk->gtk links
gi-docgen can only generate links for dependencies, so we have
to manually expand to a relative url here.
2024-01-05 14:57:16 -05:00
Matthias Clasen
6227592dfa docs: Fix: gdk->gtk and gdk->gsk links
gi-docgen can only generate links for dependencies, so we have
to manually expand to a relative url here.

fixup
2024-01-05 14:57:07 -05:00
Matthias Clasen
bc066de998 Merge branch 'wip/chergert/fix-6308' into 'main'
texthistory: fix potential NULL dereference

Closes #6308

See merge request GNOME/gtk!6709
2024-01-05 16:43:19 +00:00
Benjamin Otte
68980a5e3b Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add a test for a recent mipmap generation bug

See merge request GNOME/gtk!6710
2024-01-05 07:28:19 +00:00
Benjamin Otte
f200e8b132 reftests: Add a testcase for GtkGLArea::allowed-apis
See code comments for how it uses GL commands that should fail with GLES.

Related: !6520
2024-01-05 07:30:38 +01:00
Benjamin Otte
dde2d9b545 gl: Don't initialize texture storage in wrong format
We're calling glTexImage2D() right after with the correct format.

So add the special format "0" to avoid intializing the texture memory.
2024-01-05 07:20:32 +01:00
Benjamin Otte
ac64948efd testsuite: Add a test for a recent mipmap generation bug
Tests the fix in ab1fba6fdc.

Related: #6298
Related: !6704
2024-01-05 07:20:32 +01:00
Christian Hergert
dfe2141227 texthistory: fix potential NULL dereference
Fixes #6308
2024-01-04 09:40:04 -08:00
Emmanuele Bassi
1e1c973d71 Merge branch 'ebassi/doc-link-fixes' into 'main'
docs: Use second level headings for sections

See merge request GNOME/gtk!6708
2024-01-04 14:48:38 +00:00
Emmanuele Bassi
b69898228d docs: Use second level headings for sections
The first level heading should be reserved for the class description.
2024-01-04 13:48:29 +00:00
Emmanuele Bassi
9c71469c67 docs: Fix link to GtkLabel.set_mnemonic_widget() 2024-01-04 13:48:06 +00:00
Emmanuele Bassi
a8b1c90303 docs: Fix link to GtkSnapshot.restore() 2024-01-04 13:47:29 +00:00
Matthias Clasen
69ffaab09f Merge branch 'reduce-shortcuts-searchentry-width' into 'main'
shortcutswindow: Reduce default width of search entry

See merge request GNOME/gtk!6707
2024-01-04 13:42:18 +00:00
Mohammed Sadiq
9730d44252 shortcutswindow: Reduce default width of search entry
Reduce the default width of search entry so that it fits on smaller
screens (ie, screens having 360px or less width).  Also, set max width
to the old value of 40, so that the search entry will have the same
old size if window width permits.

This commit won't make any difference on larger screens.
2024-01-04 18:51:42 +05:30
Matthias Clasen
f99e725391 Merge branch 'fix-dropdown-checkmark' into 'main'
dropdown: Fix initial checkmark

Closes #6305

See merge request GNOME/gtk!6705
2024-01-04 03:22:25 +00:00
Matthias Clasen
8e4a42a214 dropdown: Fix initial checkmark
When the ::bind signal is emitted, the list item may not be added
to the list view yet, so we can't consult the widget hierarchy at
that point to decide whether to show or hide the icon. List for
notify::root instead.

Fixes: #6305
2024-01-03 14:58:49 -05:00
Matthias Clasen
603de8361c Merge branch 'mipmap-fixes' into 'main'
Mipmap handling fixes

Closes #6298

See merge request GNOME/gtk!6704
2024-01-03 18:06:23 +00:00
Matthias Clasen
51fd7cf35a Merge branch 'wip/otte/for-main' into 'main'
testsuite: Replace g_random_*() with g_test_rand_*()

See merge request GNOME/gtk!6703
2024-01-03 17:50:29 +00:00
Matthias Clasen
ab1fba6fdc gl: When loading a texture, really create a mipmap
If we need a mipmap, and we find an existing texture that can't
mipmap, we need to recreate it.
2024-01-03 12:26:13 -05:00
Matthias Clasen
cfa53de9af gl: Check if texture has a mipmap
When reusing an exiting texture, check if it has a mipmap, in case
we need one.
2024-01-03 12:22:28 -05:00
Matthias Clasen
3ebbcc981a Annotate gtk_ordering_from_cmpfunc as skip
We do extra work here to make the introspection scanner pick up
the docs for the static inline function, but that doesn't make the
function actually work in language bindings, so mark it as skip.

Fixes: #6298
2024-01-03 11:43:37 -05:00