Matthias Clasen
58d57e1087
gl: Drop buffer_size
...
No need to maintain buffer_size separately.
It is always vertices->len * sizeof (GskQuadVertex).
2019-10-15 19:44:26 -04:00
Matthias Clasen
571068af12
Drop OP_CHANGE_VAO
...
Instead, we accumulate vertices in a separate
array, which simplifies various things and lets
us avoid the extra copying step for the vao.
2019-10-15 19:44:26 -04:00
Christian Hergert
a00d12c62a
prototype OpBuffer helper for building op buffer
2019-10-15 19:44:26 -04:00
Timm Bäder
5ea21f7910
gl renderer: Fix an out of bounds read
...
Fixes #2200
2019-10-15 07:13:14 +02:00
Matthias Clasen
7bff3abe8e
glyph cache: Fix handling of big glyphs
...
We were putting big glyphs in the cache, in their
own texture, but forgetting to mark the texture
as permanent, so it could be reused, leading to
occasional misrendering. Fix this by marking these
textures as permanent, and explicitly freeing them
when the cache entry gets old.
2019-10-12 18:53:22 -04:00
Matthias Clasen
61db797f29
gl: Simplify glyph cache lookup
...
Make this function more similar to the icon
cache equivalent, and simplify it a bit. We
don't use the boolean return, and we don't need
to look at the age of entry when marking it
used.
2019-10-12 01:35:13 -04:00
Matthias Clasen
8839e10d44
gl: Do less work to maintain caches
...
Remember which atlases were removed, and only
check those when looking for icons or glyphs
to remove. For most frames, we don't have to
check at all since no atlases were removed.
2019-10-11 20:42:24 -04:00
Timm Bäder
4f5a9be465
gl renderer: Get blur node child only once
2019-10-11 22:31:33 +02:00
Timm Bäder
6a4c778791
gl renderer: Shorten function
2019-10-11 22:31:33 +02:00
Timm Bäder
1caa95b814
gl renderer: Avoid copying a rect
2019-10-11 22:31:33 +02:00
Matthias Clasen
cf44ba7847
gl: Avoid stray use of doubles
...
Everything else in this code is floats,
so stick to that and avoid unnecessary
precision.
2019-10-11 16:16:09 -04:00
Matthias Clasen
30433d7659
Cosmetics
2019-10-11 16:16:09 -04:00
Matthias Clasen
849b950763
gl: glyph cache tweaks
...
Reduce the cost of lookups by storing
the hash value directly.
2019-10-11 16:15:15 -04:00
Matthias Clasen
e296c6a356
gsk: Store color bit info in text nodes
...
Keep the 'has color glyphs' info in text nodes,
instead of determining it over and over in both
the vulkan and gl backends.
2019-10-11 16:15:14 -04:00
Timm Bäder
136400e8a2
gl renderer: Remove unused modelview matrix
2019-10-11 16:56:24 +02:00
Timm Bäder
90199534e0
gl renderer: Don't copy outset shadow node outline
2019-10-11 16:38:58 +02:00
Timm Bäder
f7c64b4ebb
gl renderer: Don't copy colors into render ops
2019-10-11 15:06:51 +02: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
9b1e0dd4a3
gl renderer: Cosmetics
2019-10-11 09:32:24 +02:00
Timm Bäder
a29826bb71
gl renderer: Only add outset shadow center piece if dx/dy != 0
2019-10-11 08:46:33 +02:00
Christian Hergert
528297f5e5
gl: avoid copying RenderOp to GArray
...
Instead of copying the (rather large) RenderOp to the GArray, we can
simply set the fields directly in the allocated space for the struct.
In most cases, there wont be any allocations to make as the array size
is kept in tact across frame renderings.
2019-10-09 15:41:53 -07:00
Christian Hergert
e32c992886
gl: avoid copying GskGLCachedGlyph in lookup
...
This saves a minor amount of CPU time by avoiding the copy of structure
on each lookup (which is short-lived).
2019-10-09 14:37:08 -07:00
Christian Hergert
c9ca60c201
gl: short-circuit on NULL program
...
The NULL check is a more inclusive check than each of the individual
op->op checks.
2019-10-09 11:51:32 -07:00
Timm Bäder
329f7c1c40
gl renderer: Remove rounded rect intersection code
...
Caused correctness issues.
Fixes #1917
2019-10-09 16:57:22 +02:00
Timm Bäder
e838ea3bc8
gl renderer: Fix scaled fallback node drawing
2019-10-09 16:57:22 +02:00
Christian Hergert
47ef5af778
gl: remove stray +
2019-10-08 10:58:29 -07:00
Timm Bäder
e05b87c8d0
gl renderer: Fix rounded rect intersection
2019-09-25 17:51:52 +02:00
Timm Bäder
c9241e83dd
gl renderer: Remove unused matrix
2019-09-09 17:36:25 +02:00
Timm Bäder
2914c360a9
gl renderer: Implement a subset of repeat nodes
2019-08-11 09:05:31 +02:00
Matthias Clasen
d276d2629a
gl: Glyph cache fixes
...
Pass the full location to the glyph cache lookup,
and use the same rounding as cairo does. This makes
the output much closer to the cairo renderer.
2019-07-31 00:03:13 -04:00
Matthias Clasen
5dd8801ee5
gl: implement subpixel positioning
...
Pass the glyph position into the glyph caching functions,
not just the glyph index. This allows us to cache different
images for different subpixel positions.
2019-07-28 16:42:52 -04:00
Timm Bäder
2c38b71ca5
glyph cache: Upload large glyphs in lookup () directly
...
Instead of relying on a texture id of 0, which can happen for other
reasons, e.g. when the glyph is being scaled too small.
Fixes part of #2046
2019-07-28 12:00:15 +02:00
Timm Bäder
731613d70b
gl renderer: Remove leftover modelview matrix
...
We use a GskTransform there nowadays.
2019-07-21 12:45:10 +02:00
Timm Bäder
27ddd39d69
gl renderer: Pull out code from a loop
...
Does not not actually depend on anything done inside the loop.
2019-07-21 08:39:25 +02:00
Timm Bäder
5910a28aa5
gl renderer: Replace a redundant function call
...
We're already getting the radius from the node above.
2019-07-19 18:14:50 +02:00
Timm Bäder
b9b5072668
gl renderer: Fix opacity nodes with overlapping child nodes
2019-07-14 10:08:04 +02:00
Timm Bäder
b062594ae6
gl renderer: Properly clean up program state transforms
2019-07-07 07:24:00 +02:00
Timm Bäder
99c01607f1
gl renderer: Remove some dead code
2019-06-29 08:53:36 +02:00
Timm Bäder
071748592d
gl renderer: Don't upload GL textures into the icon cache
2019-06-29 07:15:43 +02:00
Matthias Clasen
e961943508
Fix a refcounting mishap
...
We were missing a ref, causing caches to go missing
when a window is opened twice.
2019-06-05 02:49:07 +00:00
Timm Bäder
ecb353f4af
Consider all offscreen drawings for the icon cache
2019-06-04 23:00:02 +00:00
Matthias Clasen
259bbdcb09
Share glyph and icon caches
...
Use the same texture atlases to back both
the glyph and icon caches, and unify their
sizes and management. Store big glyphs
in separate textures, so all atlases have
the same size. Tweak some of the eviction
parameters.
We share the caches across all GL contexts
on a display, unless the GSK_NO_SHARED_CACHES
env var is set.
2019-06-04 23:00:02 +00:00
Matthias Clasen
7293fd517e
glyph cache: Stop storing driver and render
...
This is the first step towards sharing glyph
caches across renderers.
2019-06-04 23:00:02 +00:00
Timm Bäder
cf4ff56ca5
gl renderer: Add & use icon cache
...
Upload small icons all to the same texture atlas.
2019-06-04 23:00:01 +00:00
Timm Bäder
a51b694314
gl renderer: Remove homegrown transform_bounds code
...
GskTransform can do this for us now.
2019-06-02 11:43:06 +02:00
Timm Bäder
f999572e8f
gl renderer: Use GskTransform in render ops builder
...
for the modelview matrix. We need this later.
2019-06-02 10:12:09 +02:00
Timm Bäder
f1996783ec
gl renderer: Fix rounded rect intersection code
...
Test case attached.
Fixes #1920
2019-06-02 08:31:44 +02:00
Timm Bäder
78ee4c0677
gl renderer: Properly flip scaled fallback nodes
...
Fixes cairo nodes in hidpi setups
2019-05-30 09:12:45 +02:00
Timm Bäder
fb86fd900e
gl renderer: Make creating render targets easier
2019-05-23 18:42:00 +02:00
Timm Bäder
fcfc2ca518
gl renderer: Render recording surface untransformed
...
Cairo can't handle the y flip apparently.
Fixes #1906
2019-05-21 08:38:11 +02:00
Benjamin Otte
a1d08b4b52
rendernode: Take a graphene_point_t for the offset
...
... instead of 2 floats.
2019-05-21 06:43:59 +02:00
Benjamin Otte
6c473d5ff7
glrenderer: Handle NULL debug messages
2019-05-21 06:43:59 +02:00
Timm Bäder
aa922f0779
gl renderer: Pass correct matrix category when rendering offscreen
...
We can't just pretend we have an identity matrix when we are actually
scaling. This fixes the node editor sometimes not drawing things when
rendering to a texture. We were mistakenly discaring render nodes
because the bounds transformation was wrong.
2019-05-20 12:10:12 +02:00
Timm Bäder
7e502d0752
gl renderer: Delete render_texture framebuffer
2019-05-20 11:08:50 +02:00
Timm Bäder
5aa531674e
gl renderer: Really fix gl debugging code
...
Properly label an object and make sure we have the right gl context even
after a gdk_gl_context_end_frame call.
2019-05-20 08:47:41 +02:00
Timm Bäder
63267a2f70
gl renderer: Render fallback nodes upside down
...
We stuff both gl-drawn and cairo-drawn textures into the same cache, so
we can't really assume that we need to draw any of them flipped or not.
Fix this by drawing fallback stuff upside down and then using
upside-down vertex data for everything.
Fixes #1897
2019-05-18 13:47:59 +02:00
Timm Bäder
a9fb528a60
gl renderer: Remove an outdated comment
2019-05-18 13:47:59 +02:00
Timm Bäder
ccb9877534
gl renderer: Skip invisible shadows
2019-05-18 13:47:59 +02:00
Timm Bäder
dc7bf31b6e
gl renderer: Remove useless ops_offset calls
...
We add the shadow offset manually.
2019-05-18 13:47:59 +02:00
Benjamin Otte
777beb0d0a
glrenderer: Ensure current context for debug stuff
2019-05-08 19:47:40 +02:00
Matthias Clasen
b09a0958a0
gsk: Add tracing to the gl renderer
...
Emit the equivalent of the cpu-time counter in the inspector.
2019-05-07 09:37:59 -07:00
Timm Bäder
e847c030bd
gl renderer: Fix blur nodes with radius 0
2019-05-07 17:21:16 +02:00
Timm Bäder
d5d48af7f7
gl renderer: Reset opacity when offscreen-rendering crossfade nodes
...
A pattern emerges...
2019-05-05 07:18:39 +02:00
Benjamin Otte
6594ccf716
gsk: Export gsk_gl_renderer_new()
2019-05-05 07:18:39 +02:00
Alexander Larsson
484e330e4a
Merge branch 'wip/baedert/fix-gl-debug' into 'master'
...
Fix GL debugging
See merge request GNOME/gtk!778
2019-04-29 11:42:04 +00:00
Timm Bäder
c848b9014b
gl renderer: Add simple blend node implementation
2019-04-28 07:58:31 +02:00
Timm Bäder
931b0b3752
gl renderer: Move texture labeling below initialization
...
Apparently genTextures and friends only "reserves names", initializing
them will actually create them. Using glObjectLabel on textures before
initializing them will throw a GL_INVALID_VALUE error.
2019-04-27 10:44:37 +02:00
Timm Bäder
1a7c280ebb
gl renderer: bind the texture framebuffer before rendering
...
When rendering to a texture, collecting the render ops might bind a
different framebuffer, so bind the one we want again before doing the
actual rendering.
2019-04-26 18:05:32 +02:00
Alexander Larsson
32edf29c0a
GskGLRenderer: Add debug groups
...
This adds debug groups in various places, including the debug
nodes if those are in use. This makes the traces in tools like
renderdoc much easier to read.
2019-04-25 11:36:21 +02:00
Alexander Larsson
4f7171885f
GskGLRenderer: Label various gl objects
...
This means the names are more useful in tools like renderdoc.
2019-04-25 11:35:00 +02:00
Timm Bäder
e13d242320
gl renderer: Keep op builder around
...
GL keeps the unoform state per-program, but not per-frame. So, we can't
pretend that this works for us. Keep the RenderOpBuilder around for the
entire lifetime of the renderer instead.
2019-04-24 17:55:14 +02:00
Timm Bäder
91bbe6ef95
gl renderer: Sync gpu and cpu default alpha value
...
Otherwise we might end up not passing the new value to the GPU.
2019-04-24 13:29:45 +02:00
Timm Bäder
cc878ec00f
gl renderer: begin/end_frame around do_render
...
This fixes rendering to a texture on intel hardware. The glClear calls
would throw a GL_FRAMEBUFFER_INCOMPLETE error here, because the
gsk_gl_driver_begin_frame() call in do_render() reset the framebuffer
object in use.
2019-04-23 17:09:14 +02:00
Timm Bäder
3569348f9c
gl renderer: Declare color matrix child separately
...
Otherwise I'm doing this all the time when debugging.
2019-04-13 06:00:02 +02:00
Timm Bäder
0245ac2106
gl renderer: Apply transform only for final texture drawing
...
We don't want the new transform while drawing things on a texture.
Instead, only apply the new transform matrix when adding the final
texture drawing ops.
This fixes the stack cube rotation transition to at least look somewhat
better.
2019-03-31 06:16:16 +02:00
Timm Bäder
b2089b89cc
gl renderer: Add debug code to dump framebuffer
...
This way we can specify it on specific add_offscreen_ops callsites.
2019-03-31 06:14:41 +02:00
Timm Bäder
9105de9170
gl renderer: Cache rendered fallback nodes
2019-03-06 06:31:25 +01:00
Benjamin Otte
bd113aa85c
transform: Redo querying API
...
Make the API expect a tranform of the proper category instead of
doing the check ourselves and returning TRUE/FALSE.
The benefit is that the mai use case is switch (transform->category)
statements and in those we know the category and don't need to check
TRUE/FALSE.
Using the wrong matrix will now cause a g_warning().
2019-03-04 23:41:51 +01:00
Benjamin Otte
3cc84d2860
transform: Make category public API
...
Also rename it from GskMatrixCategory to GskTransformCategory.
2019-03-04 23:15:24 +01:00
Benjamin Otte
3a3c2d14ab
rendernode: Make the transform node take a GskTransform
...
This is an attempt to push GskTransform deeper into the stack.
2019-03-04 23:15:07 +01:00
Timm Bäder
416a4cf5ea
gl renderer: Ignore nodes with nan bounds
...
This can happen for certain transform nodes. The transform node's
child's bounds are fine, but the transform node bounds are all nan.
Just ignore those bounds since we can't meaningfully render them anyway.
2019-02-28 07:22:34 +01:00
Timm Bäder
5577e30ad4
gl renderer: Add more nodes that support transforms
2019-02-28 07:22:34 +01:00
Timm Bäder
e836c575ce
gl renderer: Remove GskRoundedRect initializaion
2019-02-25 08:46:27 +01:00
Timm Bäder
47fb1ec4c4
gl renderer: Partially implement rounded rect intersection
...
Some rounded rect intersections can actually be done and even expressed
as a single rounded rectangle.
2019-02-25 08:46:27 +01:00
Timm Bäder
f0624266dc
gl renderer: Add debug function to dump render node
2019-02-25 08:46:27 +01:00
Timm Bäder
58c2bea959
gl renderer: Stop determining the matrix category ourselves
...
Use the category we get from transform nodes and add ops_ API to supply
one when we set a graphene_matrix_t directly.
2019-02-25 08:37:06 +01:00
Timm Bäder
f9041230c6
gl renderer: Round size up when rendering to a texture
...
Both the clip we use and the viewport we set should contain the entire
texture size and not potentially clip the last pixel.
2019-02-23 04:50:25 +01:00
Timm Bäder
da0bd697b8
gl renderer: Use the matrix node category
2019-02-22 19:08:43 +01:00
Benjamin Otte
6a4bf2b993
gsk: Remove offset nodes
...
They were a neat idea while they lasted. But now, it's time for
categorized transform nodes, where matrices with
GSK_MATRIX_CATEGORY_2D_TRANSLATE are the exact replacement.
Renderers have not been adapted for this purpose, so they (continue to)
run slow paths.
2019-02-21 19:47:28 +01:00
Benjamin Otte
359bc7695c
build: Reintroduce warning flags from autotools
...
Some of the flags got lost in the meson transition or were demoted from
error flags to warning flags.
This commit reintroduces them.
It also includes fixes for the code that had warnings with those flags.
The big one being -Wshadow.
2019-01-22 04:33:12 +01:00
Timm Bäder
8e0cbc1c3d
gl renderer: Support (not) resetting the opacity for offscreen nodes
...
We usually want to do that, but it's wrong for e.g. crossfade nodes.
2019-01-18 19:43:54 +01:00
Timm Bäder
59bf76dce1
gl renderer: Force blur shadow node children offscreen
...
This broke the overlay blur demoe when resizing the window to a size
that would completely move the image below a button, causing the
GtkSnapshot code to remove the clip node below the blur node.
2019-01-13 08:41:37 +01:00
Timm Bäder
d55fc8b7b1
gl renderer: Dont't try to draw glyphs at scale 0
...
Fixes #1475
2019-01-10 17:14:48 +01:00
Timm Bäder
fb7d033953
gl renderer: Remove debug code
2019-01-10 16:49:19 +01:00
Timm Bäder
cfa440bbae
gl renderer: Fix hidpi transform nodes
2019-01-10 16:49:19 +01:00
Timm Bäder
b0a8b7da63
gl renderer: Only compile the vertex shader once
...
All our programs use the same vertex shader, so don't compile it over
and over again. This improves startup times by at least 0.001%, I swear.
2019-01-10 16:49:19 +01:00
Timm Bäder
b2ff6e91cd
gl renderer: Don't forget the offset when rendering blur nodes
2019-01-10 16:49:19 +01:00
Timm Bäder
1d3aa9207c
gl renderer: Add a clip stack
...
So we can check that the currently set clip is the first one and now
intersect with it. This first clip is always the entire viewport or the
entire render_area and we don't want to end up drawing things to a
texture because of it.
2018-12-31 12:44:02 +01:00
Timm Bäder
3ce45508e1
gl renderer: Track border width state separately
2018-12-07 16:36:10 +01:00
Timm Bäder
4b3a94f382
gl renderer: Fix remaining TODO about offset nodes
...
All of the nodes should now support offsets.
2018-12-04 06:30:47 +01:00
Timm Bäder
d67dacedba
gl renderer: transform nodes: offset
2018-12-04 06:30:47 +01:00
Timm Bäder
e1feb1b712
gl renderer: Clip nodes: offset
2018-12-04 06:30:47 +01:00
Timm Bäder
e8670c89ae
gl renderer: Linear gradients: offset
2018-12-04 06:30:47 +01:00
Timm Bäder
b4f918904c
gl renderer: Outset shadow nodes: offset
2018-12-04 06:30:47 +01:00
Timm Bäder
aead150ce2
gl renderer: Care about offset when rendering border nodes
2018-12-04 06:30:47 +01:00
Timm Bäder
fd47e57e4b
gl renderer: care about offset when rendering shadow nodes
2018-12-04 06:30:47 +01:00
Timm Bäder
2b95a5daee
gl renderer: Remove blend shader
...
It's unused.
2018-12-02 16:04:40 +01:00
Timm Bäder
0681c5d5bc
gl renderer: Reset opacity when rendering to a texture
...
The opacity will already be applied when rendering the final texture.
2018-12-02 16:03:08 +01:00
Timm Bäder
b19926c079
gl renderer: Add function to draw debug rectangle
2018-12-02 14:31:57 +01:00
Timm Bäder
ad759307f8
gl renderer: Add more node types to print_render_node_tree
...
debugging ++
2018-12-02 13:39:55 +01:00
Timm Bäder
58a4ae94e9
gl renderer: Use ops_transform_bounds_modelview in more places
2018-12-02 13:25:43 +01:00
Timm Bäder
9df9087a13
gl renderer: Add NodeSample
...
As a quick way of checking what a particular sample of nodes (e.g. all
offset node children) are made up of.
2018-12-02 13:25:43 +01:00
Timm Bäder
71512cf9ad
gl renderer: Move geometry calculation further down
...
We don't need it above, so move it to where it belongs.
2018-12-02 13:25:43 +01:00
Timm Bäder
2831dbb110
gl renderer: Refactor add_offscreen_ops
...
Use a graphene_rect_t for the node bounds instead of 4 floats.
This makes it simpler to pass the size in without the offset applied.
2018-12-02 13:25:43 +01:00
Timm Bäder
933acb3682
gl renderer: Add offscreen ops without offset applied
...
When doing color matrix nodes. This fixes color matrix node with scale =
2.
2018-12-02 13:25:43 +01:00
Timm Bäder
574ebafa46
gl renderer: Reset offset when rendering offscreen
...
We want to apply the offset to the rendered texture, not to the
offscreen-rendered content.
2018-12-02 13:25:43 +01:00
Timm Bäder
74dd05b45e
gl renderer: add render ops for dumping the framebuffer
...
So offscreen rendering can be properly debugged.
2018-12-02 13:25:43 +01:00
Timm Bäder
3eb2cef421
gl renderer: Set the render region as initial clip
...
So we avoid creating render ops for things outside of it.
2018-12-02 13:25:43 +01:00
Timm Bäder
5907ff694f
gl renderer: Render non-trivial transforms to a texture
...
This way we can e.g. render rotated clips, borders, etc.
2018-11-29 08:50:18 +01:00
Timm Bäder
c0cf592336
gl renderer: Cache offscreen textures per node, not size
2018-11-29 08:50:16 +01:00
Timm Bäder
ef751bc809
gl renderer: Use stack to keep track of modelview matrix
...
So we can avoid calculating metadata for matrices all the time.
2018-11-27 05:39:27 +01:00
Timm Bäder
d15df65a9d
gl renderer: Save some matrix multiplications
...
We do this for every single node, which is a little costly, especially
since the common case for the modelview matrix these days is a simple
translation. So, check whether the new modelview matrix is only a
translation matrix and if so, don't do a full matrix multiplication per
node.
2018-10-11 12:27:56 +02:00
Timm Bäder
392b4d9ac5
gl renderer: Pull a few declarations into the closest scope
2018-07-17 17:33:47 +02:00
Benjamin Otte
3ce3867403
gl: Don't accidentally use ints for float variables
...
The int was floor()ing the x/y coordinates of glyphs, which could cause
significant repositioning of glyphs when text was scaled via the MVP.
2018-07-13 14:56:04 +02:00
Timm Bäder
3dd188fe7e
gl renderer: Cache blurred outset shadow nodes
...
Since these are particularly expensive to render and we have a pretty
big one used in every client-side decorated window.
2018-07-08 21:50:59 +02:00
Timm Bäder
165dab8265
gl renderer: Ignore 0-sized fallback nodes
2018-06-26 21:41:29 +02:00
Timm Bäder
7f8106f2a9
gl renderer: call glViewport directly
2018-06-16 10:09:12 +02:00
Timm Bäder
4ab3aada3f
gl renderer: use w axis vector from graphene
...
Instead of initializing our own one every time.
2018-06-04 21:58:44 +02:00
Timm Bäder
719b2b0525
gl renderer: Remove an outdated comment
2018-05-27 17:51:51 +02:00
Timm Bäder
251913c80e
gl renderer: Use offsets for more node types
2018-05-27 16:20:55 +02:00
Timm Bäder
c8aa5b8b4e
gl renderer: Add helper for printing a render node tree
2018-05-19 10:18:50 +02:00
Timm Bäder
31e0aaf6b0
gl renderer: Remove ops debug message
...
Without a node name, this doesn't make much sense anymore.
2018-05-02 19:48:34 +02:00
Timm Bäder
d506799e72
gl renderer: Ignore nodes outside of the clip
...
Pretty sure this will bite me later but for now we avoid rendering nodes
that we are not going to see anyway.
2018-05-01 15:13:11 +02:00
Timm Bäder
3a5a9d9233
gl renderer: Use simple offset for selected offset node children
2018-05-01 15:13:11 +02:00
Benjamin Otte
a865621519
gdk: Move begin/end_frame() functions
...
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.
As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
2018-04-24 23:16:58 +02:00
Benjamin Otte
48fc18c37b
gdk: Get rid of GdkDrawingContext
...
All information is kept in GdkDrawContext these days, so use that one.
2018-04-24 23:16:58 +02:00
Benjamin Otte
c6ae0ff2d1
gdk: Get rid of gdk_drawing_context_get_clip()
...
Use the identical gdk_draw_context_get_frame_region() instead.
2018-04-24 23:16:58 +02:00
Benjamin Otte
4d481ecb95
gsk: Refactor damage computation for GL renderer
...
Previously, we got the damage, then computed the changed area, then
started a frame with that changed area.
But starting a frame computes the damage for us.
So now we start a frame, then get the damage area from that, then
compute the change area.
2018-04-24 23:16:58 +02:00
Benjamin Otte
49f9d2108d
gsk: Add GskDebugNode
2018-04-24 04:06:58 +02:00
Timm Bäder
d74be1fcf0
gl renderer: Rename texture_id parameter to fbo_id
...
So this makes sense again.
2018-04-21 10:13:16 +02:00
Timm Bäder
29f38056a9
gl renderer: Fix fallback node scaling
2018-04-21 10:06:57 +02:00
Timm Bäder
4336c6412a
gl renderer: Remove unused viewport member
2018-04-15 17:12:01 +02:00
Timm Bäder
add82735bb
gl renderer: Don't use texture ids in glBindFramebuffer calls
2018-04-14 11:47:02 +02:00
Timm Bäder
5e81761ad0
gl renderer: Slightly change ops_offset behavior
...
Add the given delta to the current one instead of replacing it.
2018-04-11 19:14:54 +02:00
Timm Bäder
0336825537
gl renderer: Don't draw all rounded clip nodes to a texture
...
We only need to do that if the rounde clip node intersects with the
outer one.
2018-04-11 19:14:54 +02:00
Timm Bäder
d7af16c8e4
gl renderer: Render everyhing according to MV scale
...
And not the surface's scale factor. This way the magnifier works.
2018-04-11 15:31:22 +02:00
Timm Bäder
cc66b50dcd
gl renderer: Remove unused field
2018-04-11 15:31:22 +02:00
Benjamin Otte
7c313c7b25
gsk: move begin/end_frame vfuncs into the renderers
2018-04-05 14:56:38 +02:00
Timm Bäder
08296b8aee
gl renderer: Don't highlight cairo nodes as fallback
2018-03-31 14:45:01 +02:00
Timm Bäder
f6330846c9
gl renderer: Remover unused mask uniform
2018-03-30 23:15:04 +02:00
Timm Bäder
b26e584e29
gl renderer: Rename everything called window to surface
2018-03-26 21:13:52 +02:00
Benjamin Otte
ce743f28a1
rendernode: Add an offset node
...
This is a special case of the transform node that does a 2D translation.
The implementation in the Vulkan and GL renderers is crude and just does
the same as the transform node.
Nothing uses that node yet.
2018-03-26 18:16:36 +02:00
Timm Bäder
433517fdc9
gl renderer: Skip all 0-sized nodes
...
These will cause problems later on.
2018-03-25 11:47:57 +02:00
Timm Bäder
7240178988
gl renderer: Remove cairo node special case
2018-03-25 11:47:57 +02:00
Alexander Larsson
695d141f32
Merge branch 'rename-window-to-surface' into 'master'
...
Rename window to surface
See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Alexander Larsson
9a7e721181
GdkSurface: Rename various functions and variables
...
This is an automatic rename of various things related
to the window->surface rename.
Public symbols changed by this is:
GDK_MODE_WINDOW
gdk_device_get_window_at_position
gdk_device_get_window_at_position_double
gdk_device_get_last_event_window
gdk_display_get_monitor_at_window
gdk_drag_context_get_source_window
gdk_drag_context_get_dest_window
gdk_drag_context_get_drag_window
gdk_draw_context_get_window
gdk_drawing_context_get_window
gdk_gl_context_get_window
gdk_synthesize_window_state
gdk_surface_get_window_type
gdk_x11_display_set_window_scale
gsk_renderer_new_for_window
gsk_renderer_get_window
gtk_text_view_buffer_to_window_coords
gtk_tree_view_convert_widget_to_bin_window_coords
gtk_tree_view_convert_tree_to_bin_window_coords
The commands that generated this are:
git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface
(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type
git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface
git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d
GdkWindow -> GdkSurface initial type rename
...
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge
This is an automatic conversion using the below commands:
git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass
git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo
git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"
git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
0124740fa0
gl renderer: Support large textures
...
By tiling them.
2018-03-20 09:40:10 +01:00
Timm Bäder
4240119d64
gl renderer: add basic code to support texture tiling
2018-03-20 09:40:10 +01:00
Timm Bäder
9e9db8607b
Revert "gl renderer: Limit texture node size to clip"
...
This reverts commit 0234e8e2c9
.
This broke partially clipped-away nodes when they are being transformed,
e.g. by a rotation
2018-03-20 09:37:59 +01:00
Timm Bäder
eaf899061a
gl renderer: Remove shadow program
...
Drawing shadows is the same task as drawing text in our case and these
two shaders have been the same thing for quite a while.
2018-03-15 18:12:00 +01:00
Timm Bäder
0a7880110e
gl renderer: Fix clipped borders
...
Stop abusing the clip rect for borders.
2018-03-15 18:11:57 +01:00
Timm Bäder
ebfadae568
gl renderer: Draw offscreen nodes in device pixels
...
We need to draw them upscaled, of course. This fixes button hover (or,
more generally, crossfade nodes) in hidpi setups.
2018-03-15 13:52:07 +01:00
Timm Bäder
3a5630358f
gl renderer: Fix rounded clips in hidpi
2018-03-15 11:01:53 +01:00
Timm Bäder
d417595a05
gl renderer: Draw rounded clip child to a texture
...
And then clip the texture using the current (maybe also rounded) clip.
This way, the result is correct. We don't necessarily have to do the
offscreen drawing in any case, but got the safe route for now.
2018-03-14 17:28:41 +01:00
Timm Bäder
90c8619f42
gl renderer: Properly draw gl textures from a different context
...
Temporarily switch to the texture's gl context, download the texture and
create a new one in our context for it.
2018-03-14 17:28:41 +01:00
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
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
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
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
e0436b3d59
gl renderer: Properly delete all shader programs
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
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
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
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
9479bb6bfc
gl renderer: Keep track of color matrix op state
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
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
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