gtk2/testsuite/gsk/meson.build
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

233 lines
5.7 KiB
Meson

testexecdir = join_paths(installed_test_bindir, 'gsk')
testdatadir = join_paths(installed_test_datadir, 'gsk')
compare_render = executable(
'compare-render',
['compare-render.c', '../reftests/reftest-compare.c'],
dependencies: libgtk_dep,
c_args: common_cflags,
install: get_option('install-tests'),
install_dir: testexecdir
)
node_parser = executable(
'node-parser',
['node-parser.c'],
dependencies: libgtk_dep,
c_args: common_cflags,
install: get_option('install-tests'),
install_dir: testexecdir
)
compare_render_tests = [
'blend-normal',
'blend-difference',
'clip-coordinates-2d',
'clip-coordinates-3d',
'clipped_rounded_clip',
'color-blur0',
'color-matrix-identity',
'cross-fade-in-opacity',
'empty-blend',
'empty-blur',
'empty-border',
'empty-cairo',
'empty-clip',
'empty-color',
'empty-color-matrix',
'empty-container',
'empty-cross-fade',
'empty-debug',
'empty-inset-shadow',
# this test fails for some of the backends
# 'empty-linear-gradient',
'empty-opacity',
'empty-outset-shadow',
'empty-repeat',
'empty-rounded-clip',
'empty-shadow',
'empty-texture',
'empty-transform',
'invalid-transform',
'opacity_clip',
'outset_shadow_offset_both',
'outset_shadow_offset_x',
'outset_shadow_offset_y',
'outset_shadow_rounded_top',
'outset_shadow_simple',
'scaled-cairo',
'shadow-in-opacity',
'texture-url',
'color-matrix-identity',
'clip-nested1',
'scale-up-down',
'opacity-overlapping-children',
'repeat',
'repeat-texture',
'repeat-no-repeat',
'repeat-negative-coords',
'inset-shadow-multiple',
'borders-rotated',
'blend-invisible-child',
'transform-in-transform',
'transform-in-transform-in-transform',
'nested-rounded-clips',
'clip-in-rounded-clip1',
'clip-in-rounded-clip2',
'clip-in-rounded-clip3',
'rounded-clip-in-clip-3d', # not really 3d, but cairo fails it
'issue-3615'
]
# these are too sensitive to differences in the renderers
# to run in ci, but still useful to keep around
informative_render_tests = [
'big-glyph',
'empty-text',
'huge-glyph',
]
renderers = [
# name exclude term
[ 'opengl', '' ],
[ 'next', '' ],
[ 'broadway', '-3d' ],
[ 'cairo', '-3d' ],
]
foreach renderer : renderers
foreach test : compare_render_tests
if ((renderer[1] == '' or not test.contains(renderer[1])) and
(renderer[0] != 'broadway' or broadway_enabled))
test(renderer[0] + ' ' + test, compare_render,
args: [
'--output', join_paths(meson.current_build_dir(), 'compare', renderer[0]),
join_paths(meson.current_source_dir(), 'compare', test + '.node'),
join_paths(meson.current_source_dir(), 'compare', test + '.png'),
],
env: [
'GSK_RENDERER=' + renderer[0],
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: [ 'gsk', 'gsk-compare', 'gsk-' + renderer[0], 'gsk-compare-' + renderer[0] ],
)
endif
endforeach
endforeach
node_parser_tests = [
'blend.node',
'border.node',
'color.node',
'crash1.errors',
'crash1.node',
'crash1.ref.node',
'crash2.errors',
'crash2.node',
'crash2.ref.node',
'crash3.node',
'crash3.ref.node',
'crash4.errors',
'crash4.node',
'crash4.ref.node',
'debug.node',
'empty-blend.node',
'empty-blend.ref.node',
'empty-blur.node',
'empty-blur.ref.node',
'empty-border.node',
'empty-border.ref.node',
'empty-cairo.node',
'empty-cairo.ref.node',
'empty-clip.node',
'empty-clip.ref.node',
'empty-color.node',
'empty-color.ref.node',
'empty-color-matrix.node',
'empty-color-matrix.ref.node',
'empty-container.node',
'empty-container.ref.node',
'empty-cross-fade.node',
'empty-cross-fade.ref.node',
'empty-debug.node',
'empty-debug.ref.node',
'empty-inset-shadow.node',
'empty-inset-shadow.ref.node',
'empty-linear-gradient.node',
'empty-linear-gradient.ref.node',
'empty-opacity.node',
'empty-opacity.ref.node',
'empty-outset-shadow.node',
'empty-outset-shadow.ref.node',
'empty-repeat.node',
'empty-repeat.ref.node',
'empty-rounded-clip.node',
'empty-rounded-clip.ref.node',
'empty-shadow.node',
'empty-shadow.ref.node',
'empty-text.node',
'empty-text.ref.node',
'empty-texture.node',
'empty-texture.ref.node',
'empty-transform.node',
'empty-transform.ref.node',
'rounded-rect.node',
'shadow.node',
'testswitch.node',
'widgetfactory.node',
]
foreach test : node_parser_tests
if test.endswith('.node') and not test.endswith('.ref.node')
test('parser ' + test, node_parser,
args: [
join_paths(meson.current_source_dir(), 'nodeparser', test)
],
env: [
'GSK_RENDERER=opengl',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endif
endforeach
tests = [
['rounded-rect'],
['transform'],
['shader'],
]
test_cargs = []
foreach t : tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
test_extra_cargs = t.get(2, [])
test_extra_ldflags = t.get(3, [])
test_exe = executable(test_name, test_srcs,
c_args : test_cargs + test_extra_cargs + common_cflags,
link_args : test_extra_ldflags,
dependencies : libgtk_dep,
install: get_option('install-tests'),
install_dir: testexecdir,
)
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'GSK_RENDERER=cairo',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endforeach