Commit Graph

1368 Commits

Author SHA1 Message Date
Christian Hergert
a47c0065fb macos: enable GL renderer by default
Now that the attribute locations are fixed for the GL renderer, we can
enable it by default on macOS.

Fixes #3420
2020-12-04 13:41:31 -08:00
Christian Hergert
6883c2214b gl: specify attribute locations for vUv and aPosition
These positions are not guaranteed to be in a specific order when linked
into the final GPU program. They need to be specified so that our code
in gskglrenderer.c can use known positions for them to match up with
our GskQuadVertex.

This fixes the GL renderer on macOS's OpenGL shader compiler.

Fixes #3420
2020-12-04 13:33:34 -08:00
Benjamin Otte
2c1bd399d2 glrenderer: Implement a shader for conic gradients 2020-12-03 13:07:17 +01:00
Benjamin Otte
fac5fba0dc rendernode: Fix some wrong constants for conic gradients
copy/paste from other nodes left some wrong values in there and that
screwed things up quite a bit.
2020-12-03 13:07:17 +01:00
Benjamin Otte
c907ad83b0 glrenderer: Emit more useful error messages
Catch the error when it happens, so that we can emit a specific and more
helpful error message.

Also verify that all branches in the code now do indeed set a proper
GError when they fail, so that the final catch-all is no longer needed.
Instead, assert that the error is set so that we catch future code
additions early that do not set the GError.
2020-12-03 13:07:17 +01:00
Matthias Clasen
35d2cbefe6 Merge branch 'wip/otte/conic' into 'master'
Add support for conic gradients

See merge request GNOME/gtk!2911
2020-12-03 03:54:24 +00:00
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Benjamin Otte
71cb7c2063 rendernodeparser: Split out a function 2020-12-02 21:48:35 +01:00
Emmanuele Bassi
2fcd0e21bd Merge branch 'ebassi/for-master' into 'master'
Various documentation fixes

See merge request GNOME/gtk!2900
2020-12-02 13:40:25 +00:00
Christian Hergert
9e1dd15e31 macos: use Cairo renderer by default
Until the GL renderer is working on macOS OpenGL, we need to default
to the Cairo renderer.
2020-12-01 16:24:15 -08:00
Emmanuele Bassi
37f11ab77d docs: Annotate GskRenderer 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
8b898818c2 docs: Annotate the GL shader objects 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
0f62ab6c42 docs: Annotate all render node types 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
c524b72d13 docs: Annotate structure types used by GskRenderNodes 2020-12-01 15:51:52 +00:00
Timm Bäder
da514187f5 gl renderer: Make minimal rounded rects more minimal 2020-11-30 09:21:34 -05:00
Matthias Clasen
ec21d354b9 gsk: doc fixups 2020-11-30 09:21:24 -05:00
Christian Hergert
82b4c34eca gl: add some debugging information to DEBUG_OPS 2020-11-18 20:16:40 -08:00
Christian Hergert
eae5eaeb21 gl: use glFramebufferTexture2D to set framebuffer texture
When mapping a texture to the framebuffer, we can use the 2D
form instead of the cube mapping form.
2020-11-18 20:09:01 -08:00
Benjamin Otte
1c7daece7a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2855
2020-11-17 19:08:01 +00:00
Benjamin Otte
f2284ff40f rendernode: Rename all gsk_render_node_peek_*() functions
Those are getters, they should be gsk_render_node_get_*() functions.
2020-11-17 19:04:39 +01:00
Emmanuele Bassi
b76e514322 Merge branch 'ebassi/for-master' into 'master'
Introspection fixes

Closes #3281

See merge request GNOME/gtk!2852
2020-11-17 16:04:03 +00:00
Emmanuele Bassi
5a938ad83d Annotate the gsk_border_node_peek_widths() return value
We return a fixed sized C array of floats.
2020-11-17 13:48:07 +00:00
Matthias Clasen
9a29487e25 gsk: Fix a doc oversight 2020-11-17 07:34:52 -05: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
Matthias Clasen
2c9bf55eea Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2846
2020-11-17 01:07:34 +00:00
Christian Hergert
12a9164414 gsk: use glFrameBufferTexture2D and release texture
glFrameBufferTexture maps to all faces of a cube and that is not needed
here. Additionally, texture_id is not deleted after we use the additional
flipped texture, but should be.
2020-11-16 09:26:07 -08:00
Matthias Clasen
57c95937b1 gsk: Fix some docs oversights
These apis have been renamed a few times, and the docs
haven't kept up.
2020-11-16 07:44:41 -05:00
Christoph Reiter
afc73c38ce Always parse GTK/GDK/GSK_DEBUG env vars and make some entries available in non-debug mode
Currently GTK can be built with G_ENABLE_DEBUG which enables various debug code and parsing
of those env vars, or without, which instead of parsing them prints a warning if they are set.
While building with G_ENABLE_DEBUG isn't strictly needed it's the only way to make GTK_DEBUG=interactive work,
which is a nice thing to have always.

This enables parsing of those env vars in any case and allows specific values being marked as also
available when not built with G_ENABLE_DEBUG (interactive for example). If not built with G_ENABLE_DEBUG
then all unavailable values will be marked as such in the help output and a note is added that
GTK needs to be built with G_ENABLE_DEBUG to use them, which should help discoverability.
2020-11-15 11:34:54 +01:00
Emmanuel Gil Peyrot
08193ecf1c gl renderer: Generate queries only on desktop GL
On desktop GL, GL 1.5 or GL_ARB_occlusion_query is required to get the
glGenQueries() etc. symbols.  This isn’t the case on GLES, where they
are provided by GL_EXT_occlusion_query_boolean, and more importantly
have never been made core.

This patch allows gtk4-demo to start when GDK_DEBUG=gl-gles is set, on
my Mali 400 MP running the Lima driver from Mesa.
2020-11-07 21:49:42 +01:00
Timm Bäder
82ca65956f gl renderer: Make debugging code shorter 2020-11-02 14:55:14 -05:00
Timm Bäder
c8c2106f3e gl renderer: Refactor vertex data loading code 2020-11-02 14:55:14 -05:00
Timm Bäder
8178dfb85a gl renderer: Use the load_vertex_data* functions more often 2020-11-02 14:55:14 -05:00
Timm Bäder
50e78198a8 gl renderer: More load_vertex_data* usage 2020-11-02 14:55:14 -05:00
Timm Bäder
ee04cbcfa8 gl renderer: Reword a comment 2020-11-02 14:55:14 -05:00
Timm Bäder
fc312f7ffe gl renderer: Remove an outdated comment 2020-11-02 14:55:14 -05:00
Timm Bäder
e6e964c3f3 gl renderer: Refactor rendering shadow nodes
Also use load_vertex_data_with_region here.
2020-11-02 14:55:14 -05:00
Timm Bäder
df5e796d99 gl renderer: Refactor blurred shadow drawing code
We already have various load_vertex_data* code, so try to reuse that
here.
2020-11-02 14:55:14 -05:00
Timm Bäder
d3239c953d gl renderer: Nine-slice unblurred outset shadows
See #3284
2020-11-02 14:55:13 -05:00
Matthias Clasen
7db58d5f8d gsk: Don't compile unused code
The NodeSample and GskGLImage code is not used,
so don't compile it.
2020-10-30 23:36:39 -04:00
Matthias Clasen
03fec389f4 docs: Add details for gsk_renderer_new_for_surface
Mention the GSK_RENDERER variable here.
2020-10-29 18:21:44 -04:00
Christian Hergert
a3fd46c516 glsl: tweak pre-processor to support Apple GLSL compiler
The Apple GLSL compiler cannot deal with empty pre-processor blocks such as

  #if GSK_GLES
  #elif GSK_LEGACY
2020-10-29 10:57:02 -07:00
Timm Bäder
9109dee072 gl renderer: Don't use blur node bounds
The blur node bounds are different/larger than the ones we use. This
made the textures get stretched to the blur node bounds.

Fixes #3282
2020-10-22 17:46:34 +02:00
Timm Bäder
b6a843a05b gl renderer: Fix two scale_x/y mixups 2020-10-22 17:46:34 +02:00
Sophie Herold
cd0bef9390 Add some missing nullable return annotations 2020-10-17 15:32:36 +02:00
Timm Bäder
07fb33c033 gl renderer: Fix private function name
It's a GskGLRenderer, not a GskGLRender
2020-10-14 15:06:12 -04:00
Timm Bäder
1fe7043be4 gl renderer: Add more scale_x/scale_y code
We really need all of this to be aware of both dimensions of course...
2020-10-14 15:06:12 -04:00
Timm Bäder
0e6014f2f6 gl renderer: Remove two unused uniforms 2020-10-14 15:06:12 -04:00
Timm Bäder
0a4d442849 gl renderer: return empty texture for too small blurred nodes 2020-10-14 15:06:12 -04:00
Timm Bäder
5f9fa13c65 gl renderer: Use op builder to render flipped texture
Otherwise, we don't know about the uniform state
2020-10-14 15:06:12 -04:00
Timm Bäder
161b171004 gl renderer: Remove unused parameter 2020-10-14 15:06:12 -04:00