Commit Graph

141 Commits

Author SHA1 Message Date
Benjamin Otte
2c1bd399d2 glrenderer: Implement a shader for conic gradients 2020-12-03 13:07:17 +01: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
0e6014f2f6 gl renderer: Remove two unused uniforms 2020-10-14 15:06:12 -04:00
Timm Bäder
44d1e81ae9 glsl: Add a comment 2020-10-14 15:06:12 -04:00
Timm Bäder
7222a0901d unblurred outset shadow shader: Use premultiply() 2020-10-14 15:06:12 -04:00
Timm Bäder
a0bb248bb3 gl renderer: Use premultiply() in inset shadow shader` 2020-10-14 15:06:12 -04:00
Timm Bäder
982ebf1b69 gradient shaders: Reduce out values as well
We only do 6 color stops here now. Also works around a driver bug.

Fixes #3196
2020-10-05 20:35:34 -04: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
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
Timm Bäder
fd728ea8bc gl renderer: Lower maximum gradient stop count
6 is still plenty according to my market research.

Should help with #2624
2020-09-24 19:08:22 +02:00
Timm Bäder
a770ab34c4 gl renderer: Consolidate color pre-multiplication
Add a common function that tells us what it does and replace all the
manual stuff with it.

Fixes #3170
2020-09-18 15:45:08 +02:00
Timm Bäder
b8e4240751 gl renderer: Add radial gradient shader 2020-09-18 15:39:07 +02:00
Timm Bäder
c1c2205018 gl renderer: Adjust gaussian blur sigma
To look more like what browsers do.
2020-08-29 16:46:28 +02:00
Timm Bäder
2bff84ca6c gl: Adjust blur radius_multiplier
2.0 Looks much closer to what my browser does.

Fixes #2777
2020-08-29 16:46:25 +02:00
Timm Bäder
72d4a83af8 gl renderer: Moar state tracking
Track what we really need to send for inset shadows, which are used
as a border replacement in many cases.

Fishbowl says I can draw around 200-300 more switches per frame like
this too.
2020-07-28 05:34:11 +02:00
Timm Bäder
52ae384bfd gl shaders: unify frag coord handling 2020-05-10 09:30:15 +02:00
Timm Bäder
962e38c5c9 gl renderer: Shorten shaders a bit 2020-01-24 06:08:39 +01:00
Timm Bäder
685288216f gl renderer: Move rect transformation to the vertex shader
No need to do this for every fragment.
2020-01-24 06:08:39 +01:00
Timm Bäder
c8fa1f19db gl renderer: Transform rounded rect on the GPU
Change the RoundedRect struct we use in our shaders so we can transform
it using (affine) matrices.
2020-01-24 06:08:39 +01:00
Timm Bäder
dc8dedce07 gl renderer: Draw outset shadows white
and only apply the actual shadow color when we draw them from the
texture. This way we can reuse the cached shadows during color
transitions.
2020-01-18 08:49:52 +01:00
Timm Bäder
74f18f71d3 gl renderer: Move work to the blur vertex shader 2020-01-07 17:27:17 +01:00
Timm Bäder
44ac2d5abb gl renderer: Pass linear gradient stops to shaders directly
No need to copy them into the render ops like this.
2020-01-07 17:27:16 +01:00
Timm Bäder
b8aa51d522 gl renderer: Move more work to the vertex shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
f79c807645 gl renderer: Don't invert offset value twice 2020-01-07 17:27:16 +01:00
Timm Bäder
d0d2ad9f5b gl renderer: Remove unused variable from shader 2020-01-07 17:27:16 +01:00
Timm Bäder
0b8298038a gl renderer: Move color computation to vertex shader 2020-01-07 17:27:16 +01:00
Timm Bäder
6ef0bb8bea gl renderer: Move final color computation to vertex shader
.. of the coloring program, which is used all the time for text.
2020-01-07 17:27:16 +01:00
Timm Bäder
91472b2ecd gl renderer: Compute final color in vertex shader
This is a very often used shader. No need to to do this for every
fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
2079c898e7 gl renderer: Remove some unneeded calculations from shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
c79c18f39c gl renderer: Shuffle things around a bit 2020-01-07 17:27:16 +01:00
Timm Bäder
cef7f7f87d gl renderer: Move work to the gradient vertex shader
No need to do this stuff once per fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
fdce30d3f8 gl renderer: Add some in/out compat glue to the shaders
so we can use _IN_ and _OUT_ and get the right things for
desktop/es/legacy GL.
2020-01-07 17:27:16 +01:00
Timm Bäder
1243174e53 gl renderer: Make RoundedRect work in gles
Which can't return struct types containing arrays. So let's revert to
the previous version but still send the rect along as a vec4[3];
2020-01-07 17:27:15 +01:00
Timm Bäder
cc909b160f gl renderer: Rewrite shader builder
Use a unified approach to write both vertex and fragment shader in the
same file.
2020-01-07 17:27:15 +01:00
Timm Bäder
49845795d9 gl renderer: Rewort passing rounded rects to shaders 2020-01-07 17:27:15 +01:00
Timm Bäder
ab04c74ec9 gl renderer: Don't copy border outline corner sizes around
We already offset + scale the outline and its corners, just pass those
directly to the shader.
2020-01-07 17:27:15 +01:00
Timm Bäder
d3852ca33a gl renderer: Remove some unused uniforms 2020-01-07 17:27:15 +01:00
Timm Bäder
56b456ff21 gl renderer: Remove unused uniform from inset shadow shader 2019-12-03 08:40:35 +01:00
Timm Bäder
8ca46169b1 gl renderer: Blur shader improvements
Use a two-pass blur shader, fix a few other things and unify the
blurring of blur nodes and blurred outset shadow nodes.

Related to #1283
2019-12-03 08:40:34 +01:00
Timm Bäder
1c2661ed12 gl renderer: Fix repeat node shader once again 2019-11-26 09:09:25 +01:00
Timm Bäder
604f44da11 gl renderer: Fix repeat nodes that don't repeat
Fixes #2234
2019-11-19 10:31:21 +01:00
Timm Bäder
2977e91aed gl renderer: Grow unblurred outset shadow outline on the gpu 2019-10-11 10:16:39 +02:00
Timm Bäder
0b999c73d1 gl renderer: Fix glsl rounded rect shrinking
Previous code would add rounded corners to a rect with all 0 corners
when growing.
2019-10-11 10:15:58 +02:00
Timm Bäder
2914c360a9 gl renderer: Implement a subset of repeat nodes 2019-08-11 09:05:31 +02:00
Elias Aebi
a357995484 glsl: don't use switch statements 2019-07-31 18:48:54 +02:00
Elias Aebi
1e6120e776 glsl: use float literals 2019-07-06 14:42:08 +02:00
Timm Bäder
a2518493a2 gl renderer: Fix color matrix shader
We *just* computed a un-premultiplied color, maybe we should also use
it.
2019-05-18 13:47:59 +02:00
Timm Bäder
4869013a8d gl renderer: Fix coloring shader
We *just* pre-multiplied u_color but then didn't use its rgb values.
This fixes backdrop scale marks in Adwaita to not be white.
2019-05-06 17:58:55 +02:00
Timm Bäder
3e2107846d gl renderer: Fix blend shader 2019-05-06 17:34:48 +02:00
Timm Bäder
c848b9014b gl renderer: Add simple blend node implementation 2019-04-28 07:58:31 +02:00