Commit Graph

145 Commits

Author SHA1 Message Date
Benjamin Otte
160e6ad6f6 gdk: Split out GL texture
Put GdkGLTexture into its own file and rename the API to
gdk_gl_texture_foo() instead of gdk_texture_foo_for_gl().

Apart from naming, no actual code changes.
2018-03-07 16:17:15 +01:00
Timm Bäder
0234e8e2c9 gl renderer: Limit texture node size to clip 2018-03-04 19:12:04 +01:00
Timm Bäder
da431b2a43 glglyphcache: Pass lookup key to g_hash_table_lookup directly 2018-03-04 19:12:04 +01:00
Timm Bäder
ad776cc57b gl renderer: Increase offscreen texture size
This fixes blurry checkbutton marks in hidpi setups, but breaks button
hover effects. That's another problem.
2018-02-16 18:00:06 +01:00
Timm Bäder
0a51f38963 gl renderer: Check the scale factor for every render
This way we pick up changes in the GdkWindow's scale_factor.
2018-02-06 09:19:40 +01:00
Timm Bäder
c739db0e29 gl renderer: Use a gl texture in render_texture
Get rid of the manual y flipping and cairo business. This keeps the gl
unit tests working at least.
2018-02-04 13:10:51 +01:00
Timm Bäder
4fa4b8525e gl renderer: Clear resources after render_texture
This makes multiple consecutive render_texture calls on the same
renderer work.
2018-02-03 13:24:55 +01:00
Timm Bäder
6e70079e63 gl renderer: Reset clip when drawing offscreen
Just like we reset the scissor test and the viewport, we also can't use
the current clip anymore in this case.
2018-01-27 12:13:37 +01:00
Timm Bäder
684624005a gl renderer: Fix hidpi cairo node rendering
We can't just unconditionally create a larger texture here, since the
incoming cairo surface might have a device scale that doesn't fit our
scale_factor. Instead, look up the surface device scale and use that.
2018-01-27 11:06:38 +01:00
Timm Bäder
1fb5d389db gl renderer: Make width/height relation more obvious
In add_offscreen_ops, we use the max_x/min_x values for the texture and
viewport width, and the max_y/min_y for the texture and viewport height.
2018-01-27 11:00:59 +01:00
Timm Bäder
e3557f681c gl renderer: Fix outset shadow outline transform
This fixes hidpi blurred outset shadows
2018-01-23 21:46:31 +01:00
Timm Bäder
8f4e0705dc gl renderer: Fix shadow node child offset
We shouldn't apply the shadow offset when drawing the child offscreen,
instead apply it afterwards when we draw it to the current render
target.
2018-01-19 15:00:22 +01:00
Timm Bäder
41a922928e gl renderer: Render GL textures upside down
These come from an FBO so we need to flip the texture coords on the y
axis, just like we do everywhere else.
2018-01-18 08:21:11 +01:00
Matthias Clasen
31fcf5b3a7 gsk: Handle GL textures
These textures already have a GL texture in them,
no need to create a new one.
2018-01-17 11:57:25 -05:00
Timm Bäder
4946810960 gl renderer: Render unblurred outset shadows differently
We don't need to draw anything to a texure for those.
2018-01-15 10:56:43 +01:00
Matthias Clasen
ba21a7764b gsk: Reorganize env vars
Get rid of GSK_RENDERING_MODE and add the flags to GSK_DEBUG,
following the same pattern we use in gdk now.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c56419818f gsk: make logging per-renderer
Add a setter for per-renderer debug flags, and use
them where possible. Some places don't have easy access
to a renderer, so this is not complete.
Also, use g_message instead of g_print throughout.
2018-01-14 17:05:04 -05:00
Timm Bäder
b9a05be2da gl renderer: Sprinkle some const around 2018-01-10 08:46:22 +01:00
Timm Bäder
f7ba3224b9 gl renderer: Bring back hexbox drawing 2018-01-08 17:44:37 +01:00
Timm Bäder
fcc8d778b5 gl renderer: Avoid some code duplication 2018-01-02 08:10:06 +01:00
Timm Bäder
d1a08aa2a9 gl driver: Remove some type checks in a hot path 2018-01-02 08:10:06 +01:00
Timm Bäder
0e57d173b3 gl renderer: Remove an unnecessary block 2018-01-02 08:10:06 +01:00
Timm Bäder
f92cca5229 gl renderer: Fix release build 2017-12-29 08:59:47 +01:00
Timm Bäder
6587864824 gl driver: Remove more unused API 2017-12-29 05:48:43 +01:00
Timm Bäder
e0436b3d59 gl renderer: Properly delete all shader programs 2017-12-29 05:48:43 +01:00
Timm Bäder
d2d18f74f8 gl driver: Remove gl-context property
No need for this to be a property.
2017-12-29 05:48:43 +01:00
Timm Bäder
1cbd4d229e gl driver: Remove dead warning code
_get_fbo never returns NULL.
2017-12-29 05:48:43 +01:00
Timm Bäder
c9656e2864 gl driver: Only support one fbo per texture 2017-12-29 05:48:43 +01:00
Timm Bäder
352590cf9f gl driver: Remove vao API
Unused.
2017-12-29 05:48:43 +01:00
Timm Bäder
825608af2a gl renderer: Remove unused parameter 2017-12-29 05:48:43 +01:00
Timm Bäder
aeaab5557b gl renderer: Only draw what we have to 2017-12-29 05:48:42 +01:00
Timm Bäder
2bc10fa365 gl renderer: draw all outset shadows
Instead of falling back to cairo for most of them.
2017-12-29 05:48:40 +01:00
Timm Bäder
9f2674077a gl renderer: Properly flip texture in render_texture path
Just do this on the CPU instead.
2017-12-28 16:48:35 +01:00
Timm Bäder
a720a63fa3 gl renderer: Insert render target op in render_texture path 2017-12-28 16:48:35 +01:00
Timm Bäder
7a2d30323e gl renderer: try doing outset box shadows
Still fall back in cases we can't handle that way.
2017-12-21 19:12:33 +01:00
Timm Bäder
f044b01549 gl renderer: Don't crash if the first op is an opacity one 2017-12-21 19:12:32 +01:00
Timm Bäder
490e15021c gl renderer: Force cross-fade nodes offscreen 2017-12-21 19:12:32 +01:00
Timm Bäder
48be2aed23 gl renderer: Use one function per op type to apply data 2017-12-21 19:12:32 +01:00
Timm Bäder
28499032da gl renderer: Don't leak gl resources 2017-12-21 19:12:32 +01:00
Timm Bäder
ee27b17a12 gl renderer: Fix indentation mishap 2017-12-21 19:12:32 +01:00
Timm Bäder
a83037c440 gl renderer: Implement cross fade nodes 2017-12-21 19:12:32 +01:00
Timm Bäder
075e6ac266 gl renderer: Fix shadow nodes if the child is a container 2017-12-21 19:12:32 +01:00
Timm Bäder
18e7d777a2 gl renderer: Move declarations to the beginning of the block 2017-12-21 19:12:32 +01:00
Timm Bäder
e9be72a73e gl renderer: Fix use of uninitialized values 2017-12-21 19:12:32 +01:00
Timm Bäder
33457b4035 gl renderer: Ensure texture sizes arent 0
We already ceil() the given float texture sizes here, so if they are
valid, the result should definitely be > 0. Textures with size 0 can't
be properly used, especially not as render targets, where they will
trigger an assertion failure later in a glCheckFramebuffer call.
2017-12-21 19:12:32 +01:00
Timm Bäder
49c7cf36e4 gl renderer: Fix inset and outset shadows in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
b03f08960b gl renderer: Fix cairo node surface size in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
d9e135dcb5 gl renderer: Fix rounded clips in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
3411e648b4 gl renderer: Handle borders in hidpi better 2017-12-21 19:12:32 +01:00
Timm Bäder
64400e82b5 gl renderer: Default to 0px clip and border radius
Finally fix the division by 0 in the clip code.
2017-12-21 19:12:32 +01:00
Timm Bäder
703c4cf003 gl renderer: Ignore render ops before we have a valid program 2017-12-21 19:12:32 +01:00
Timm Bäder
2d3e87da46 gl renderer: Try to fix border rendering 2017-12-21 19:12:32 +01:00
Timm Bäder
a59f380d31 gl renderer: Use one function per node-type
So a profiler can actually tell me what's slow and not just point at
_add_render_ops in all cases.
2017-12-21 19:12:32 +01:00
Timm Bäder
ab53ee7377 gl renderer: Don't render opacity nodes offscreen
We already drag a u_alpha uniform around in every shader, so use that
one.
2017-12-21 19:12:32 +01:00
Timm Bäder
476450b93e gl renderer: Ignore shadow color matrix nodes...
... if the color matrix nodes don't touch the child alpha.
2017-12-21 19:12:32 +01:00
Timm Bäder
98ba28b5d7 gl renderer: Add a helper function
We'll use this for the common case of a color matrix node inside a
shadow node.
2017-12-21 19:12:32 +01:00
Timm Bäder
49785974cf gl renderer: Don't zero initialize render ops GArray 2017-12-21 19:12:32 +01:00
Timm Bäder
7cc868910b gl renderer: Avoid crashing tooltips 2017-12-21 19:12:31 +01:00
Timm Bäder
39a241b763 gl renderer: Sort border sides by color 2017-12-21 19:12:31 +01:00
Timm Bäder
c9af94f6db gl renderer: Keep track of border program state 2017-12-21 19:12:31 +01:00
Timm Bäder
f978bf057f gl renderer: Avoid using a new modelview for shadow nodes
We can just move the vertex data directly.
2017-12-21 19:12:31 +01:00
Timm Bäder
7ad8f211c6 gl renderer: Default to GL_LINEAR scaling filters 2017-12-21 19:12:31 +01:00
Timm Bäder
5cdd46e38e gl renderer: Remove superfluous modelview matrix changes 2017-12-21 19:12:31 +01:00
Timm Bäder
1fce25c7af gl renderer: Remove unused struct member 2017-12-21 19:12:31 +01:00
Timm Bäder
9479bb6bfc gl renderer: Keep track of color matrix op state 2017-12-21 19:12:31 +01:00
Timm Bäder
b33d85b594 gl renderer: Avoid consecutive opacity ops 2017-12-21 19:12:31 +01:00
Timm Bäder
a0e033b2cd gl renderer: Define debug structs inline 2017-12-21 19:12:31 +01:00
Timm Bäder
5d0c279351 gl renderer: Add more detailed render op output 2017-12-21 19:12:31 +01:00
Timm Bäder
7831d9a463 gl renderer: Only draw blurred shadow nodes once 2017-12-21 19:12:31 +01:00
Timm Bäder
7dc6a46cff gl renderer: Remove consecutive clip ops 2017-12-21 19:12:31 +01:00
Timm Bäder
bb69d64a0f gl renderer: Rename a macro 2017-12-21 19:12:31 +01:00
Timm Bäder
8463040ad1 gl renderer: Fix debugging output 2017-12-21 19:12:31 +01:00
Timm Bäder
3b7cfd068b gl renderer: Implement simple border nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
8089cde977 gl renderer: Don't render unblurred text shadows to a texture
We can do the same thing by simply drawing the text in the given shadow
color.
2017-12-21 19:12:31 +01:00
Timm Bäder
d5a759652f gl renderer: Split out text rendering function
We'll use that for text shadow nodes
2017-12-21 19:12:31 +01:00
Timm Bäder
e95b356465 gl renderer: Implement simple shadow nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
c524ac7bb5 gl renderer: Split out a utility function 2017-12-21 19:12:31 +01:00
Timm Bäder
47c4bf5be0 gl renderer: Implement unblurred outset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
5c7838e168 gl renderer: Rework program creation
Make sure all uniform names have to match between the shader names and
the _location integers we save in every Program struct.
2017-12-21 19:12:31 +01:00
Timm Bäder
388157b995 gl renderer: Implement unblurred inset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
6a1a70c677 gl renderer: Implement blur nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
ff1cacb54a gl renderer: Remove some unused members 2017-12-21 19:12:31 +01:00
Timm Bäder
19700fccb2 gl renderer: Keep track of current program color value 2017-12-21 19:12:31 +01:00
Timm Bäder
2865ab84a9 gl renderer: Don't draw texture nodes to a framebuffer
We don't need to create a texture from a texture node. We can simply use
its texture instead and draw it however we want.
2017-12-21 19:12:31 +01:00
Timm Bäder
e3264d5fd3 gl renderer: Implement color matrix nodes again 2017-12-21 19:12:31 +01:00
Timm Bäder
cb9c4e362c gl render ops: Rename a member 2017-12-21 19:12:31 +01:00
Timm Bäder
b56a7afd19 gl renderer: Factor out a helper function for offscreen drawing 2017-12-21 19:12:30 +01:00
Timm Bäder
95051e13c3 gl ops: Remove dead code
This is already checked further up in that function
2017-12-21 19:12:30 +01:00
Timm Bäder
832920c6ba gl renderer: Optimize text drawing
Text nodes will almost always end up using the exact same texture and
the same program. So, in that case we can simply add vertex data for all
the characters we need to draw and use just one draw call.
2017-12-21 19:12:30 +01:00
Timm Bäder
fa564e1f93 gl renderer: Remove unused VAO 2017-12-21 19:12:30 +01:00
Timm Bäder
d5eeb9d6f0 gl renderer: Stop collecting VAOs in clear_tree
We don't use that part of the gl driver anymore.
2017-12-21 19:12:30 +01:00
Timm Bäder
6606c1f682 gl renderer: Only check for color glyphs once per text node
It does not depend on the glyph, so no need to do it once for every
glyph.
2017-12-21 19:12:30 +01:00
Timm Bäder
5615fd26c2 gl renderer: Implement cairo nodes again 2017-12-21 19:12:30 +01:00
Timm Bäder
a1d3e77347 gl renderer: Move render ops into separate file 2017-12-21 19:12:30 +01:00
Timm Bäder
823369f275 gsk: Move all gskgl* files into gl/ 2017-12-21 19:12:30 +01:00