Commit Graph

192 Commits

Author SHA1 Message Date
Matthias Clasen
5064a8eac0 gsk: Improve test coverage 2022-07-15 16:41:05 -04:00
Benjamin Otte
0410125f20 nodeparser: Fix parsing of color-matrix node
Negative offsets in the color matrix were inverted because it used the
rect parser.
2022-05-18 21:16:33 +02:00
Sebastian Keller
1c733857b3 testsuite: Add unaligned-offscreen test
Tests whether text rendered to an offscreen node unaligned with the
pixel grid introduces blurriness.
2022-04-04 23:48:58 +02:00
Benjamin Otte
b28c3ef3d9 renderers: Handle large viewports
When large viewports are passed to gsk_renderer_render_texture(), don't
fail (or even return NULL).

Instead, draw multiple tiles and assemble them into a memory texture.

Tests added to the testsuite for this.
2022-02-26 20:35:44 +01:00
Timm Bäder
fd6b3ef5a0 gl: Linear gradients don't support 3d transforms
Add another helper similar to the one for transforms, but that only
works on 2d transforms.

Fixes #4501
2021-12-12 12:57:44 +01:00
Matthias Clasen
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Matthias Clasen
41b810da7f Add gsk_transform_to_2d_components
This function decomposes a general 2D transform
into skew, scale, rotation and translation.

Tests included.
2021-09-18 02:06:51 -04:00
Matthias Clasen
5742483422 Add more transform tests
Test gsk_transform_to_2d.
2021-09-17 22:37:08 -04:00
Matthias Clasen
8c34dd58c0 gsk: Add a test for transform_bounds 2021-09-17 07:43:07 -04:00
Matthias Clasen
5b82cf1145 rendernodeparser: Use gdk_texture_save_to_png_bytes
Avoid cairo, and use our own api for saving png data.

Update affected test output.
2021-09-17 00:25:22 +02:00
Benjamin Otte
62954a0338 ngl Fix bottom-right border render failure
The wrong index was used for offsetting the bottom border rect.

Test included.
2021-09-16 23:59:37 +02:00
Benjamin Otte
625b5ce91a testsuite: Port compare_render() to use textures 2021-09-16 23:59:37 +02:00
Benjamin Otte
46bb160923 testuite: Add opacity-overdraw test
Tests that overdrawing of content inside an opacity node happens before
the opacity is applied.

This is broken in the GL renderer and causes the opacity.ui reftest to
fail.
2021-09-16 23:59:37 +02:00
Matthias Clasen
4439ff0c12 testsuite: Stop running tests for the gl renderer
It does not exist anymore.
2021-09-14 16:12:55 -04:00
Matthias Clasen
ffab67ac70 testsuite: Call g_test_init in test binaries
Without it, we mess out on G_DEBUG=fatal-warnings,
so our ci does not alert us that we run a bunch of
tests which spit out warnings.
2021-09-14 16:12:55 -04:00
Matthias Clasen
155a4fac5c Add vectorized half-float conversion
We can't make the -4 versions inline, since
we use ifuncs for them, so make vectorized
versions.

Test included.
2021-09-10 22:17:31 -04:00
Matthias Clasen
ea31ae31c1 tests: Remove an outdated comment
It refers to a file that no longer exists.
2021-08-22 12:29:59 -04:00
Matthias Clasen
8390363abe testsuite: Avoid negative scales with gl renderer
The fix in 1c90bb522e was only for the ngl renderer,
so don't use the test with the gl renderer, until it is
fixed as well.
2021-07-16 07:11:20 -04:00
Benjamin Otte
834d3749c6 testsuite: Add test for crasher
Test for the crasher in !4096
2021-07-15 23:43:28 +02:00
Matthias Clasen
fab82a7c25 tests: Add some fp16 tests 2021-07-13 09:03:49 -04:00
Matthias Clasen
809299f9e4 Add some more transform tests
Test that gsk_transform_to_affine works.
2021-05-13 19:37:16 -04:00
Matthias Clasen
4d1075a082 testsuite: Reduce the use of g_assert
Stop using g_assert() in the gsk tests.
2021-04-12 21:22:46 -04:00
Matthias Clasen
efb5e793a4 nodeparser: Change the serialization
Arrange things so that non-child parameters
are always printed before the children. This
greatly helps with readability, which really
suffers when there's hundreds of lines of indented
children between the node start and its parameters.

Update all affected tests.
2021-04-02 20:38:32 -04:00
Matthias Clasen
f2edf40e48 node test: Improve --generate
This is a pet peeve of mine: When we call
g_test_init() before handling --generate,
the random seed spew pollutes the output.
Highly annoying. I've fixes many test binaries
over the years, but more keep popping up.
2021-04-02 20:35:39 -04:00
Matthias Clasen
5cb5bdc4eb testsuite: Sort gsk compare tests
Easier to find things that way.
2021-04-01 20:07:13 -04:00
Matthias Clasen
08913deba5 Add some more gsk tests
The css-background test contains a node pattern that
is optimized in the ngl renderer.
2021-04-01 20:06:40 -04:00
Matthias Clasen
b5df1299ec gsk: Add another test
Compare clipped repeat nodes. Must skip cairo here
since it blurred the child by scaling after rendering.

Also skip the gl renderer, since it hasn't been fixed
for this yet. ngl passes this test.
2021-03-31 16:49:31 -04:00
Matthias Clasen
6f62107656 testsuite: Rename next to ngl
Use specific names for renderers in the gsk tests.
Otherwise the tests may use the wrong renderer, or
the same renderer twice.
2021-03-31 14:59:43 -04:00
Matthias Clasen
146069058f Add some tests for node diffing
Nothing deep yet, but more can be added.
2021-03-28 10:45:40 -04:00
Matthias Clasen
124f60593b nodeparser: Print debug message before child
This puts the message up top, where it can be seen,
and not at the other end of an endless tree of children.

Update tests to match.
2021-03-09 12:15:25 -05:00
Matthias Clasen
5d30569575 Add some more rounded rect tests 2021-03-07 21:28:19 -05:00
Christian Hergert
2a38cecd33 gsk: add OpenGL based GskNglRenderer
The primary goal here was to cleanup the current GL renderer to make
maintenance easier going forward. Furthermore, it tracks state to allow
us to implement more advanced renderer features going forward.

Reordering

This renderer will reorder batches by render target to reduce the number
of times render targets are changed.

In the future, we could also reorder by program within the render target
if we can determine that vertices do not overlap.

Uniform Snapshots

To allow for reordering of batches all uniforms need to be tracked for
the programs. This allows us to create the full uniform state when the
batch has been moved into a new position.

Some care was taken as it can be performance sensitive.

Attachment Snapshots

Similar to uniform snapshots, we need to know all of the texture
attachments so that we can rebind them when necessary.

Render Jobs

To help isolate the process of creating GL commands from the renderer
abstraction a render job abstraction was added. This could be extended
in the future if we decided to do tiling.

Command Queue

Render jobs create batches using the command queue. The command queue
will snapshot uniform and attachment state so that it can reorder
batches right before executing them.

Currently, the only reordering done is to ensure that we only visit
each render target once. We could extend this by tracking vertices,
attachments, and others.

This code currently uses an inline array helper to reduce overhead
from GArray which was showing up on profiles. It could be changed to
use GdkArray without too much work, but had roughly double the
instructions. Cycle counts have not yet been determined.

GLSL Programs

This was simplified to use XMACROS so that we can just extend one file
(gskglprograms.defs) instead of multiple places. The programs are added
as fields in the driver for easy access.

Driver

The driver manages textures, render targets, access to atlases,
programs, and more. There is one driver per display, by using the
shared GL context.

Some work could be done here to batch uploads so that we make fewer
calls to upload when sending icon theme data to the GPU. We'd need
to keep a copy of the atlas data for such purposes.
2021-02-23 14:41:52 -08:00
Simon McVittie
1c6cf7a3b6 reftests: Share reftest-compare.[ch] between GSK and GTK tests
The only non-whitespace difference is that the copy in GSK does not
set the symbol's visibility.

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-02-15 09:22:41 +00:00
Matthias Clasen
dff2aa20ff gl: Fixed clipped offscreen rendering
When we are rendering a texture node to an offscreen,
and we have a clip, we must force the offscreen rendering.
Otherwise, the code will notice: Hey, it already is a texture
node, so no need to render it to a texture again. But when
clipping is involved, that is exactly what we want to do.

Testcase included.

Fixes: #3651
2021-02-09 22:43:15 -05:00
Timm Bäder
79f273348d gl renderer: Fix viewport computation when rendering offscreen
Fixes #3615
2021-01-29 10:37:48 +01:00
Matthias Clasen
7e579bb59a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2997
2020-12-24 07:13:22 +00:00
Benjamin Otte
dee863dbb2 rendernode: Bail if matrix is invalid
Invalid matrices are okay in GSK (and GL), but not in Cairo.

Testcase included.
2020-12-24 06:38:45 +01:00
Matthias Clasen
aa95ae774f gsk: Fix serialization of glyphs
We were forgetting to put a space between two numbers
in some cases, confusing the parser.

Test included.

Fixes: #3496
2020-12-21 10:49:56 -05:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Matthias Clasen
121e61cf01 gsk: Avoid using gtk css types in public api
Using GtkCssSection in public headers here may be
ok from the C perspective, since it all ends up in
the same library anyway. But it causes circular
dependency problems for our gir files that are still
split by namespace.

To avoid this problem, copy the GtkCssLocation struct
struct as GskParseLocation, and pass take two of them
instead of a GtkCssSection in the error callback.

Update all users.

Fixes: #2454
2020-11-16 23:27:44 -05:00
Emmanuele Bassi
0af6630521 a11y: Consolidate accessibility environment variables
Use a single environment variable for everything:

 - select the ATContext implementation
 - select the test ATContext
 - disable ATContext entirely

We use the same pattern as GSK_RENDERER, GTK_DEBUG, etc.

The documentation needs to be updated to include the environment
variable.
2020-11-09 16:21:49 +00:00
Emmanuele Bassi
88113956a3 tests: Use the test ATContext for every test
Otherwise we're going to need a full desktop session in order to run the
test suite.
2020-10-12 16:19:32 +01:00
Emmanuele Bassi
4b60e7470a Use test AT context with installed tests
Otherwise we're going to need an AT-SPI service on the session, and the
accessibility bus.
2020-10-12 16:19:31 +01:00
Matthias Clasen
cef1cd19ff gsk: Avoid long lines in serialized nodes
When encoding big blobs of data in base64, insert newlines.
Base64 allows it, CSS allows it, so not need to make GtkTextView
struggle with multi-megabyte lines.

Update nodeparser tests to reflect this change.
2020-10-03 13:10:55 -04:00
Matthias Clasen
f6bd2f4d3f Add a test for gsk_gl_shader_compile
This is not super useful, but at least we can
test that we get an error message including the
shader text.
2020-10-01 23:45:05 -04:00
Matthias Clasen
4e55220d76 Add some shader tests
These are just basic api usage tests, no rendering.
They found the issues fixed in the preceding commits.
2020-09-29 09:51:16 +02:00
Matthias Clasen
3b6941b04b Add some tests for the axis-aligned check 2020-09-07 14:22:47 -04:00
Matthias Clasen
60e37d3368 Update gsk tests
Add a clip-coordinates-2d test that is similar
to clip-coordinates-3d, but actually uses a 2D
transform.
2020-09-04 13:19:01 -04:00
Matthias Clasen
d7c4f93c76 Merge branch 'wip/compute-size' into 'master'
Compute size via signal

See merge request GNOME/gtk!2325
2020-08-05 16:19:19 +00:00
Jonas Ådahl
2ff74eb667 gdk/toplevel: Negotiate surface size via a compute-size signal
GTK will not up front know how to correctly calculate a size, since it
will not be able to reliably predict the constraints that may exist
where it will be mapped.

Thus, to handle this, calculate the size of the toplevel by having GDK
emitting a signal called 'compute-size' that will contain information
needed for computing a toplevel window size.

This signal may be emitted at any time, e.g. during
gdk_toplevel_present(), or spontaneously if constraints change.

This also drops the max size from the toplevel layout, while moving the
min size from the toplevel layout struct to the struct passed via the
signal,

This needs changes to a test case where we make sure we process
GDK_CONFIGURE etc, which means we also needs to show the window and
process all pending events in the test-focus-chain test case.
2020-08-05 15:49:00 +02:00