Commit Graph

48596 Commits

Author SHA1 Message Date
Emmanuele Bassi
46bb14e173 gsk: Add GskGLDriver
We can move the caching and management of textures, VAOs, and state of
the GL machinery into a single object, GskGLDriver.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
8555c6ba11 gsk: Use the right pointer to the parent RenderItem
We copy the local RenderItem into the render items array, so we need to
use the copy in the array in order to get the correct reference.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
dc3b240c20 Ensure that render nodes are translated
The clip rectangle may have non-zero offsets, so we need to ensure that
the GskRenderNode associated to the rendered area is translated by those
same offsets.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
d790054c2e gsk: Add fundamental type annotations for GskRenderNode
We need to annotate the GskRenderNode so that the introspection
machinery can find the functions for managing reference counting
and GValues.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
0fbf638999 gsk: Add 'blit' program
For the root node we do not need to use blending, as it does not have
any backdrop to blend into. We can use a simpler 'blit' program that
only takes the content of the source and fills the texture quad with
it.
2016-10-18 11:49:08 +01:00
Emmanuele Bassi
4cda720ab9 gsk: Consolidate program creation and storage
We should use ShaderBuilder to create and store programs for the GL
renderer. This allows us to simplify the creation of programs (by moving
the compilation phase into the ShaderBuilder::create_program() method),
and move towards the ability to create multiple programs and just keep a
reference to the program id.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
43974761bb docs: Add more GSK documentation 2016-10-18 11:49:07 +01:00
Emmanuele Bassi
a840c7f00c gsk: Add more modes to the blend shader
Use the compositing CSS spec at:

  https://www.w3.org/TR/compositing-1/#blending

For the implementation.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
9e3b0f5aa0 gsk: Don't store the uniform and attribute location twice
We should keep the ShaderBuilder around and use it to query the various
uniform and attribute locations when needed, instead of storing those
offsets into the Renderer instance, and copying them. This allows a bit
more flexibility, once we have more than one program built into the
renderer.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
12db9ee164 gsk: Add getter for program id in ShaderBuilder
Since we store it into the ShaderBuilder instance we should also allow
getting the program id.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
8bb0c9a226 gsk: Add debugging notes to ShaderBuilder
Print out the generated shader and the list of available uniforms and
attributes.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
28b490f14f gsk: Rework how GLSL shaders are built
The GL renderer should build the GLSL shaders using GskShaderBuilder.
This allows us to separate the common parts into separate files, and
assemble them as necessary, instead of shipping one big shader per type
of GL API (GL3, GL legacy, and GLES).
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
2ded2ad6b7 gsk: Add ShaderBuilder
GskShaderBuilder is an ancillary, private type that deals with the
internals of taking GLSL shaders from resources and building them,
with the additional feature of being able to compose shaders from a
common preamble, as well as adding conditional defines (useful for
enabling debugging code in the shaders themselves).
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
3d21c4afba gsk: Add rendering debug mode for shaders
It's going to be useful to inject debugging data into the shaders used
by GSK.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
0ce9815bd1 gdk: Add more GDK_GL_ERROR error ids
We're going to use them in other locations.
2016-10-18 11:49:07 +01:00
Emmanuele Bassi
1b1edcebd0 gsk: Use the node's blend mode in the GL renderer 2016-10-18 11:49:07 +01:00
Emmanuele Bassi
81e992e1ff gsk: Store blend mode in the render node 2016-10-18 11:49:07 +01:00
Emmanuele Bassi
bf09ce93c8 gsk: Make GskBlendMode enumeration public 2016-10-18 11:49:07 +01:00
Emmanuele Bassi
638297a22e gsk: Allow sampling between parent and child nodes 2016-10-18 11:49:07 +01:00
Emmanuele Bassi
7416aa762f gsk: Group render state attributes 2016-10-18 11:49:06 +01:00
Emmanuele Bassi
b8a92dfa0e gsk: Turn GskRenderNode into a pure GTypeInstance
Using GObject as the base type for a transient tree may prove to be too
intensive, especially when creating a lot of node instances. Since we
don't need properties or signals, and we don't need complex destruction
semantics, we can use GTypeInstance directly as the base type for
GskRenderNode.
2016-10-18 11:49:06 +01:00
Emmanuele Bassi
b997f4c575 gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-10-18 11:49:06 +01:00
Emmanuele Bassi
258af60c18 gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-10-18 11:49:06 +01:00
Emmanuele Bassi
074c77e7ac gsk: Rework GskRenderer and GskRenderNode semantics
This commit changes the way GskRenderer and GskRenderNode interact and
are meant to be used.

GskRenderNode should represent a transient tree of rendering nodes,
which are submitted to the GskRenderer at render time; this allows the
renderer to take ownership of the render tree. Once the toolkit and
application code have finished assembling it, the render tree ownership
is transferred to the renderer.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
d99f91f5fd gsk: Flush the GL render items cache
Whenever the render tree changes we want to drop the RenderItem arrays,
as each item contains a pointer to the GskRenderNode which becomes
dangling once the root node changed.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
635fd7026a gsk: Add GskRenderer::clear_tree
We need a way to clear eventual caches inside GskRenderer subclasses if
the root node has changed.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
9d3ca22b4c gsk: Port GskGLRenderer to GLES
Use the appropriate API and shaders if the GdkGLContext was created for
OpenGL ES instead of OpenGL.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
5909ce6897 gsk: Use surface-to-texture utility function
Now that we have it.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
eb9c0920ab gsk: Rename shaders for OpenGL 2016-10-18 11:29:34 +01:00
Emmanuele Bassi
b425cff689 gdk: Add utility for uploading Cairo surfaces to GL
The surface-to-GL upload logic has become more complicated with the
addition of the GLES code paths; it's more logical to have a public
utility function that can be called from GDK users, instead of copy
pasting the whole thing multiple times.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
0e2a87a4bc build: Add GSK deps to GTK 2016-10-18 11:29:34 +01:00
Emmanuele Bassi
7afdd3fdb5 Initial implementation of GSK rendering pipeline
GSK is conceptually split into two scene graphs:

 * a simple rendering tree of operations
 * a complex set of logical layers

The latter is built on the former, and adds convenience and high level
API for application developers.

The lower layer, though, is what gets transformed into the rendering
pipeline, as it's simple and thus can be transformed into appropriate
rendering commands with minimal state changes.

The lower layer is also suitable for reuse from more complex higher
layers, like the CSS machinery in GTK, without necessarily port those
layers to the GSK high level API.

This lower layer is based on GskRenderNode instances, which represent
the tree of rendering operations; and a GskRenderer instance, which
takes the render nodes and submits them (after potentially reordering
and transforming them to a more appropriate representation) to the
underlying graphic system.
2016-10-18 11:29:34 +01:00
Emmanuele Bassi
d519e4aafe gsk: Initial commit / build environment 2016-10-18 11:29:34 +01:00
Emmanuele Bassi
3fb413beea label: Avoid shadowing variables 2016-10-18 11:29:34 +01:00
Piotr Drąg
ba299d9ba4 Update POTFILES.in 2016-10-18 03:50:55 +02:00
Matthias Clasen
dfb45f4396 Add a test for cursor names
This tests both that all standard cusor yield a cursor, and that
unknown cursor names yield NULL.
2016-10-17 19:11:32 -04:00
Matthias Clasen
95c7de70c7 x11: Add the same message as the wayland backend has
This seems prudent, if we make noise about missing cursors
on Wayland, we should do the same on X11.
2016-10-17 19:11:32 -04:00
Matthias Clasen
a0140cad15 Reduce a warning to a message
The warning interferes with having a testcase to check this behavior,
so reduce this to a message.
2016-10-17 19:11:32 -04:00
Timm Bäder
4384628afb Remove GtkAction 2016-10-18 00:34:41 +02:00
Timm Bäder
ead36206a3 Remove GtkActionGroup 2016-10-18 00:34:41 +02:00
Timm Bäder
1bb3501ef7 Fix unittests 2016-10-18 00:34:41 +02:00
Timm Bäder
a864f4d474 widget: Not all toplevels are also containers 2016-10-18 00:34:41 +02:00
Timm Bäder
8245374f9c tests/testylecontext: Don't double-free widgetpath 2016-10-18 00:34:41 +02:00
Timm Bäder
f7d22fec7b Remove GtkRecentAction 2016-10-18 00:34:41 +02:00
Timm Bäder
d963ede668 Remove GtkUIManager 2016-10-18 00:34:41 +02:00
Timm Bäder
62b2949fa2 Remove GtkActivatable 2016-10-18 00:34:41 +02:00
Timm Bäder
a8a2588cab recentchooser: Stop implementing GtkActivatable 2016-10-18 00:34:41 +02:00
Timm Bäder
d0c087be37 recentchooserdefault: Stop implementing GtkActivatable 2016-10-18 00:34:40 +02:00
Timm Bäder
0c7d091651 toolitem: Stop implementing GtkActivatable 2016-10-18 00:34:40 +02:00
Timm Bäder
41f5d3b14c Remove GtkToggleAction 2016-10-18 00:34:40 +02:00