Commit Graph

66447 Commits

Author SHA1 Message Date
Matthias Clasen
00c6340777 gsk: Add some more shader docs
Do a pass over the docs and address minor inconsistencies,
cosmetics and formatting differences.

Mention GSK_DEBUG=shaders.
2020-09-29 14:44:31 -04:00
Matthias Clasen
687ed74d46 Merge branch 'snapshot-stack-optimize' into 'master'
Minor optimizations to GtkSnapshot state stack

See merge request GNOME/gtk!2641
2020-09-29 18:44:07 +00:00
Emmanuele Bassi
97276a5cd4 Remove gtk-doc stanzas from private GtkBuildable API
Various functions were moved to the private GtkBuildable header by
commit 2715b3ec31, but the functions still
have gtk-doc stanzas.
2020-09-29 19:39:34 +01:00
Alexander Larsson
796e6ee306 snapshot: Preallocate and don't memset the state stack
Most of the time the snapshot is less than 16 levels deep (did some testing
in gtk-demo), so lets pre-allocate 16 levels of state stack to avoid the
extra allocation most of the time.
2020-09-29 16:03:06 +02:00
Alexander Larsson
18b8b499de gdkarray: Add support for GDK_ARRAY_NO_MEMSET
If all your callers already initialize the array element as needed,
then we don't need to memset it to zero first.

This is pretty useful for the snapshot state stack, because due
to the per-node-type data area the elements on the stack are
quite large, but often a lot of it is not used.
2020-09-29 16:02:59 +02:00
Alexander Larsson
8a0dd452d2 gdkarray: Inline splice and reserve
This inlines the splice and reserver GdkArray calls. These are
typically only called from the gdk_array_(append/set_size) functions
anyway, and inlining the caller means we can constant propagate the
constant arguments in those calls. Its hard to get exact numbers, but
in fishbowl i noticed a significant decrease in the time spent in
the array code when pushing and poping states.
2020-09-29 15:57:33 +02:00
Matthias Clasen
4cfa9ee19f Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2639
2020-09-29 12:57:36 +00:00
Matthias Clasen
719c44a610 Merge branch 'glshader-track-uniform-state' into 'master'
gl: Track the current uniform state for custom programs

See merge request GNOME/gtk!2638
2020-09-29 12:49:22 +00:00
Matthias Clasen
4a2c817690 docs: Document various entry ::activate signals 2020-09-29 07:04:07 -04:00
Matthias Clasen
aac9414117 statusbar: Remove a misleading doc comment 2020-09-29 07:04:07 -04:00
Matthias Clasen
c897daf797 snapshot: Document radial gradient apis 2020-09-29 07:04:07 -04:00
Matthias Clasen
f1299410bf docs: Fix a typo 2020-09-29 07:04:07 -04:00
Matthias Clasen
165768b6ad wayland: Match header and doc arguments
gtk-doc doesn't take this lightly.
2020-09-29 07:04:07 -04:00
Matthias Clasen
07c338b487 gsk: Document radial gradient api 2020-09-29 07:04:07 -04:00
Matthias Clasen
3af249c046 Silence a compiler warning
These variables are not used anymore since
commit 11e4a46967.
2020-09-29 07:04:07 -04:00
Matthias Clasen
91c3edba35 NEWS: Updates 2020-09-29 07:04:07 -04:00
Alexander Larsson
51ab56d33a gl: Track the current uniform state for custom programs
This allows us to avoid updating uniforms if that is not necessary. This
in turn allows us to sometimes reuse the same draw op by just extending the
vertex array size we draw rather than doing a separate glDraw call.

For example, in the fishbowl demo, all the icons added at the same
time will have the same time and size, so we emit single draw calls
with 100s of triangles instead of 100s of draw calls with 2 triangles.
2020-09-29 11:52:39 +02:00
Alexander Larsson
2e5caa68bc Merge branch 'glshader-node' into 'master'
Add support for GLShader nodes

See merge request GNOME/gtk!2594
2020-09-29 08:30:48 +00: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
Alexander Larsson
e76cb3e1e4 gtk-demo: Add a shader paintable to the fishbowl
This gets around 500 instances at 60fps on my system.
2020-09-29 09:51:16 +02:00
Alexander Larsson
8bcb031418 gtk-demo: Add GskGLShaderNode demo
Add adds a demo showing off GskGLShaderNode in various ways.

It has a transistion widget, using some examples from
gl-transitions.com, with child widgets being both images, a GL area
and real widgets (that let you edit the transition shaders
themselves.

It also has a fancy fire effect on hove on the buttons.
2020-09-29 09:51:16 +02:00
Alexander Larsson
4d697283ae Support GLShaderNode in backends
For vulkan/broadway this just means to ignore it, but for the gl
backend we support (with up to 4 texture inputs, which is similar to
what shadertoy does, so should be widely supported).
2020-09-29 09:51:16 +02:00
Alexander Larsson
950cc41e15 GtkSnapshot: Add gtk_snapshot_push_glshader() 2020-09-29 09:51:16 +02:00
Alexander Larsson
7ea755e206 Add GskGLShaderNode and GskGLShader
A GskGLShader is an abstraction of a GLSL fragment shader that
can produce pixel values given inputs:
 * N (currently max 4) textures
 * Current arguments for the shader uniform
Uniform types are: float,(u)int,bool,vec234)
There is also a builder for the uniform arguments which are
passed around as immutable GBytes in the built form.

A GskGLShaderNode is a render node that renders a GskGLShader inside a
specified rectangular bounds. It renders its child nodes as textures
and passes those as texture arguments to the shader. You also pass it
a uniform arguments object.
2020-09-29 09:51:16 +02:00
Matthias Clasen
6e9b58b6f0 gsk: Add more shader debug spew
Print out the full assembled shader sources when
GSK_DEBUG=shaders is given. This is very verbose,
but may be useful to see what we actually pass
to the compiler.
2020-09-29 09:51:16 +02:00
Alexander Larsson
645fc6a9a5 GtkWindow: Create renderer before realizing child widgets
This way the child widgets can rely on the renderer (for example what
type it is) to decide details about how they render (such as if they
should use OpenGL shaders).
2020-09-29 09:51:16 +02:00
Matthias Clasen
a91b6b4786 css: Move the last parser api to the new header
This lets us use it from the render node parser
in gsk.
2020-09-29 09:51:16 +02:00
Alexander Larsson
16cdb33c6c shadertoy demo: Fix GLSL on GLES
I was getting "assignment to varying fragColor" errors
2020-09-29 09:51:16 +02:00
Alexander Larsson
bacb3affb3 gl: Add some namespacing to the preamble symbols
This adds a gsk prefix to the stuff in the preamble, as we want to
avoid it conflicting with things in the main shader. Especially once
we start allow some customization of shaders.
2020-09-29 09:51:16 +02:00
Alexander Larsson
9460d0131f gl backend: Add line numbers to source in glsl compilation errors
Almost always the source is created by combining various sources, which
means the line numbers in the error messages are hard to use. Adding
the line numbers to the source in the error message helps with this.
2020-09-29 09:51:16 +02:00
Alexander Larsson
7edcd1748c gl: Properly report error if shader linking fails
In gsk_gl_shader_builder_create_program(), if linking fails we
need to return -1 to indicate error, rather than the old deleted
program id.
2020-09-29 09:51:16 +02:00
Alexander Larsson
6887d0ce24 glrenderer: Move ProgramState into Program
There is no real reason to have this on the side indexed via the
index, as it is stored next to each other anyway. Plus, storing them
together lets use use `Program` structures not in the array.
2020-09-29 09:51:10 +02:00
Matthias Clasen
e29c586b7c Merge branch 'arnaudb/menubutton-direction' into 'master'
Make GtkMenuButton::direction more useful.

Closes #2811

See merge request GNOME/gtk!2636
2020-09-29 01:55:24 +00:00
Matthias Clasen
4f8a211c51 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3202

See merge request GNOME/gtk!2637
2020-09-29 01:53:02 +00:00
Matthias Clasen
30b7545fb5 Add a reftest for flipping transforms
Verify that a scale of -1 does in fact cause a
gradient to go the other direction.
2020-09-28 21:07:51 -04:00
Matthias Clasen
a799c86edb textbuffer: Elaborate docs
Explain a bit more what gtk_text_buffer_get_content_provider()
is for.

Fixes: #3202
2020-09-28 20:51:13 -04:00
Matthias Clasen
68bb532290 window: Don't get surfaces needlessly
There is a 1-1 correspondence between natives and
surfaces, so we can just compare the natives, no
need to get the surface for every single one.
2020-09-28 20:51:13 -04:00
Matthias Clasen
d2f0e3fa6b doc: Document some apis as widget implementor only
A better solution for this would be nice. For the
time being, just add a sentence to the docs.
2020-09-28 20:51:13 -04:00
Arnaud Bonatti
4684082232 Make GtkMenuButton::direction more useful.
This property was only used until now when
there was neither an icon nor a label set,
for arrow direction and popover placement.

Starting with Gtk4, a GtkMenuButton with a
label shows an arrow at the right (in LTR)
of the label. Allow disabling the arrow or
changing its direction using the direction
property, to have a way to restore a Gtk3-
like look or to improve popover placement.

Fixes #2811.
2020-09-29 02:26:13 +02:00
Matthias Clasen
5536a2ffe6 Merge branch 'wip/carlosg/for-master' into 'master'
gtkeventcontrollerscroll: Drop device type checks

Closes #3210

See merge request GNOME/gtk!2635
2020-09-28 22:03:36 +00:00
Carlos Garnacho
11e4a46967 gtkeventcontrollerscroll: Drop device type checks
Kinetic scrolling (and begin/end tracking) broke with commit cab1dcb696
since the pointing device used on X11 does not get as much GdkInputSource
granularity as the source device used to have in GTK3.

Actually this is kinda pointless, devices incapable of smooth scroll
should send discrete events, without those devices in the picture, we
want kinetic scroll to apply on every other device capable of smooth
scroll, so just do that.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3210
2020-09-28 23:35:36 +02:00
Yosef Or Boczko
01ddc181f9 Update Hebrew translation
(cherry picked from commit f6e3dfd73e)
2020-09-28 19:00:52 +00:00
Yosef Or Boczko
2b3c2962ab Update Hebrew translation
(cherry picked from commit 02d1d9714e)
2020-09-28 18:59:32 +00:00
Matthias Clasen
27b3bb59eb Merge branch 'another-attempt-to-fix-shadertoy' into 'master'
Flip GLArea textures

See merge request GNOME/gtk!2634
2020-09-28 16:16:51 +00:00
Matthias Clasen
ff61f35b77 Merge branch 'cloudproviders-ci' into 'master'
Cloudproviders ci

Closes #2480

See merge request GNOME/gtk!2632
2020-09-28 15:45:08 +00:00
Matthias Clasen
5206cfa837 Merge branch 'wip/otte/for-master' into 'master'
snapshot: Don't flip textures

See merge request GNOME/gtk!2633
2020-09-28 15:43:02 +00:00
Matthias Clasen
b711c12bbe glarea: Flip our texture
The texture that produce is upside-down, compared to what
GSK expects, so flip things around with a transform.

This fixes the shadertoy demo being upside-down after a
recent fix to avoid downloading and reuploading the texture.
2020-09-28 11:34:23 -04:00
Matthias Clasen
431f144f37 gsk: Normalize when transforming bounds
Bounds are assumed to be normalized, and transforms
with negative scales or 3d rotations can make us get
negative sizes.

Fix by Benjamin Otte.
2020-09-28 11:34:16 -04:00
Benjamin Otte
651c92c0ed snapshot: Don't flip textures
... or gradients or borders or shadows. Instead, ensure that affines
have non-negative scale factors. Otherwise add a transform node.

The only place where this check is not necessary is color nodes, but
special casing them seems not worth it.
2020-09-28 16:14:28 +02:00
Milo Casagrande
8487e82133 Update Italian translation 2020-09-28 07:41:47 +00:00