Commit Graph

81190 Commits

Author SHA1 Message Date
Matthias Clasen
53d99f5521 Use the surface colorstate in begin_frame
begin_frame is the place where we make decisions about the format,
depth and colorstate for our rendering. Make these calls take the
surface color state into account.

In particular, if the surface colorstate is suitable for GL_SRGB,
and we don't need high depth, set things up for that.
2024-07-14 12:51:05 -04:00
Matthias Clasen
52d2975af3 surface: Add a color state
This will be set by the backend, and it will be used to set up
the draw context properly. For now, this is always SRGB.
2024-07-14 12:46:20 -04:00
Matthias Clasen
926a651f12 Merge branch 'more-color-states' into 'main'
More color states

See merge request GNOME/gtk!7445
2024-07-13 19:37:54 +00:00
Matthias Clasen
7aeab7a63f Add a debug flag for hdr rendering
Set GDK_DEBUG=hdr to force the use of rec2100 as compositing
colorstate.
2024-07-13 15:11:07 -04:00
Matthias Clasen
a2389b3169 Cosmetics
Shift debug flags around so we can put hdr next to linear.
2024-07-13 15:11:07 -04:00
Matthias Clasen
54e5cc296f colorstate: Add rec2100-pq and rec2100-linear
These are wide-gamut, HDR colorstates that we will need for HDR support.
2024-07-13 15:11:07 -04:00
Matthias Clasen
457fd68168 gpu: Make color conversion extensible
Change the glsl convert_color function to proceed in stages:
- first unpremultiply
- then linearize
- then transform linearly
- then delinearize
- then premultiply
All the steps are only taken if needed.
2024-07-13 15:09:12 -04:00
Matthias Clasen
2d69f35e0e colorstate: More details in the docs
Add links to srgb definitions and references.
2024-07-13 15:09:12 -04:00
Benjamin Otte
648c780e91 gpu: Respect colorstate for offscreens
We want to render in at least the minimum required depth of the used
colorstate.
2024-07-13 14:51:49 -04:00
Benjamin Otte
f36618f02a Merge branch 'fix-columnviewcolumn-visibility' into 'main'
columnview: check column visibility when measuring

See merge request GNOME/gtk!7452
2024-07-13 17:47:49 +00:00
Christian Hergert
8548a1dd7f columnview: check column visibility when measuring
We only want to measure visible columns so that they may consume the
maximum width available to the widget. This fixes a situation where hidden
columns would cause less-than the whole width to be allocated. Additionally
that fixes warnings where some widgets expect more horizontal space than
they would ultimately be allocated.
2024-07-13 10:12:41 -07:00
Matthias Clasen
5e1d58c41c Merge branch 'matthiasc/for-main' into 'main'
vulkan: Remove GDK_DEBUG=vulkan-validate

See merge request GNOME/gtk!7451
2024-07-13 13:19:54 +00:00
Benjamin Otte
a61d7f3864 vulkan: Remove GDK_DEBUG=vulkan-validate
The modern incantation to get validation layers enabled is via

VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation

Vulkan has a bunch of environment variables to toggle stuff, let's use
those instead of doing our own.
2024-07-13 08:52:28 -04:00
Benjamin Otte
c7fcaaf443 Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix color convert path to not crash

See merge request GNOME/gtk!7450
2024-07-13 10:41:38 +00:00
Benjamin Otte
6d263f8680 gpu: Add GSK_GPU_BLEND_NONE
Allows writing without blending. This is useful when copying/converting
textures.

In particular, we use it for colorspace conversions.
2024-07-13 10:56:47 +02:00
Benjamin Otte
d9ab6495ef gpu: Fix color convert path to not crash
The occlusion culling reorganization messed up this branch.

Make it work again.
2024-07-13 10:56:47 +02:00
Ekaterine Papava
ceac0ce9aa Update Georgian translation 2024-07-13 05:34:08 +00:00
Benjamin Otte
e975d6db17 Merge branch 'wip/otte/for-main' into 'main'
gpu: Remove unused macro

See merge request GNOME/gtk!7449
2024-07-13 01:25:35 +00:00
Benjamin Otte
d54b68b93c gpu: Convert values to float[4] from GdkRGBA
We need to make sure our clear values are in the right colorstate, not
in sRGB.

The occluision culling managed to sneak through the big transition for
that.
2024-07-13 02:07:15 +02:00
Benjamin Otte
761346ed5a gpu: Remove unused macro
This is a leftover from the pre-color-managed times
2024-07-13 02:07:15 +02:00
Matthias Clasen
6d71dd0025 Merge branch 'matthiasc/for-main' into 'main'
colorstate: Consistent naming

See merge request GNOME/gtk!7448
2024-07-12 23:58:28 +00:00
Matthias Clasen
d0e2d9e2f4 colorstate: Small reorg
Introduce a helper macro.
2024-07-12 18:15:28 -04:00
Matthias Clasen
b0effee9b3 colorstate: Add tests for conversions
Test roundtrip tests between color states.

For now, this just tests srgb<>srgb-linear.
2024-07-12 18:14:54 -04:00
Matthias Clasen
abb7e85260 colorstate: Consistent naming
Make the conversion functions use srgb_linear in their names, since
the name of the color state is srgb-linear.
2024-07-12 18:14:44 -04:00
Matthias Clasen
3ccd03e226 Updates 2024-07-12 16:55:49 -04:00
Benjamin Otte
2ae345aa8f Merge branch 'wip/otte/big-bigger-oom' into 'main'
Implement tiling for large textures

Closes #6324

See merge request GNOME/gtk!7447
2024-07-12 17:47:53 +00:00
Benjamin Otte
1c1b78aa1c gpu: Implement tiling for texture-scale nodes
This is actually the node Loupe is using, so having tiling work with it
is important.

Because of the previous commit, different filters are supported fine.

Fixes: #6324
2024-07-12 18:09:46 +02:00
Benjamin Otte
cdb2308ddd gpu: Add filter support to tiled images
This allows mipmapping if downscaled a lot, like we do for non-tiled
images.

A side effect is that due to the simpler caching for tiles, we can only
cache the mipmapped images in one colorstate. But we need to pick a
potentially non-default one, because we want to mipmap in a linear
colorstate.

So this is somewhat suboptimal. Patches with improvements accepted.
2024-07-12 17:31:36 +02:00
Benjamin Otte
c581f722bd gpu: Split out a function
We'll need mapping scaling filters to samplers elsewhere soon.
2024-07-12 17:31:36 +02:00
Benjamin Otte
340c98c6cd gpu: Split a function
Split drawing the tiles from setting up the offscreen for drawing the
tiles.
2024-07-12 17:31:36 +02:00
Benjamin Otte
39f5c5bf49 gpu: Implement tiling for texture nodes
Use the new cache feature to split oversized textures into tiles the
size given by the new device API.

Then number those tiles from left to right and top to bottom and use
that number as the tile id.
2024-07-12 17:31:36 +02:00
Benjamin Otte
392f6855ca gpu: Add gsk_gpu_device_get_tile_size()
This allows managing tiling of images. And I'd like this value to live
somewhere prominent instead of as a hardcoded number in the
nodeprocessor.
2024-07-12 17:31:36 +02:00
Benjamin Otte
1cae48ab93 gpu: Add a tile cache
Nobody is using it yet, but it's the API.

It's very simple and just allows adding tiles by an index. What that
index means is up to the caller.
2024-07-12 17:31:36 +02:00
Benjamin Otte
25f04f3c37 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Add DRM_FORMAT_INVALID to our formats

See merge request GNOME/gtk!7446
2024-07-12 15:29:40 +00:00
Benjamin Otte
d0f8ef09a0 gpu: Do a GC run after every tile of large images
When we draw large images, we absolutely do not want to keep memory that
we do not need. So do a GC run after every tile. That otentially slows
down things, but it also improves the chances of not running out of
memory.

Here's the node for the image I managed to create after I applied this
patch:

repeat {
  bounds: 0 0 50000 50000;
  child: text {
    font: "Noto Color Emoji 10000px";
    glyphs: 661 0 0 0 color;
    offset: 0 10000;
    hint-style: none;
  }
}
2024-07-12 16:57:23 +02:00
Benjamin Otte
0516dca116 vulkan: Don't try to use nonexisting formats
Handle the error that new rgba format exists.
2024-07-12 16:56:23 +02:00
Benjamin Otte
ebc6a043c9 gpu: Cleanups 2024-07-12 16:56:23 +02:00
Benjamin Otte
8e2ae79875 gpu: Change function to (transfer full)
Functions should behave as I expect, and I just spent an hour debugging
a refcount issue because I assumed our image creation functions return
refrences. Which is a very sane assumption.
2024-07-12 16:55:59 +02:00
Benjamin Otte
27ac764653 gpu: Don't multiply by 1/x, divide by x
This is less error-prone with floating point math, even though it is
somewhat slower.
2024-07-12 16:55:59 +02:00
Matthias Clasen
80df6e2b8d Merge branch 'matthiasc/for-main' into 'main'
wayland: Fix handling of the font-rendering setting

Closes #6855

See merge request GNOME/gtk!7443
2024-07-12 00:55:02 +00:00
Matthias Clasen
bfda8cf820 stylecontext: fix gtk_style_context_lookup_color
We need to ensure the value is computed.

Fixes: #6855
2024-07-11 19:58:55 -04:00
Matthias Clasen
cb91f96fd3 wayland: Fix handling of the font-rendering setting
The settings portal is reporting enums as string values, so
we need to translate this setting back to what we need.

Fixes

(gtk4-demo:18902): GLib-CRITICAL **: 19:06:14.783: g_variant_get_int32: assertion 'g_variant_is_of_type (value, G_VARIANT_TYPE_INT32)' failed

that could be seen in recent nightly flatpaks.
2024-07-11 19:06:50 -04:00
Matthias Clasen
549ec0aac8 Merge branch 'matthiasc/for-main' into 'main'
Small doc fixes

See merge request GNOME/gtk!7442
2024-07-11 21:15:10 +00:00
Matthias Clasen
5cea9f9e17 Small doc fixes
Pointed out be Emmanuele Bassi.
2024-07-11 16:56:10 -04:00
Benjamin Otte
a9cce55693 dmabuf: Add DRM_FORMAT_INVALID to our formats
That's gonna be necessary for the next commit.
2024-07-11 18:39:14 +02:00
Benjamin Otte
e1152c33c4 Merge branch 'wip/otte/linear-compositing' into 'main'
Linear compositing, take 2

See merge request GNOME/gtk!7391
2024-07-11 13:29:14 +00:00
Benjamin Otte
e40ad5faa5 gpu: Cache textures when doing copies
The texture and texture-scale node code is creating image copies
for mipmaps and to adapt to the compositing colorstate.

Those texture should be cached.
2024-07-11 14:57:20 +02:00
Benjamin Otte
dd393a4a0e gpu: Split out texture lookup function
It's unused in 3 function and has become somewhat unwieldy.
2024-07-11 14:57:20 +02:00
Benjamin Otte
881954dfca gpu: Rework texture caching
We want to cache textures in the compositing color state, not in their
original color state. However, the compositing color state may change
(think multimonitor setups).

So we additionally keep a cache per colorstate.

That means texture lookup is now a 3-step process:

1. Look up in the compositing colorstate's cache

2. Look up in the general cache

3. Upload
2024-07-11 14:57:20 +02:00
Benjamin Otte
cf12503fec gpu: Don't replace cache items
Instead, keep them. This is not useful yet, but will become so in the
next commits.
2024-07-11 14:57:20 +02:00