Commit Graph

47994 Commits

Author SHA1 Message Date
Emmanuele Bassi
7493fa4277 gsk: Add GL profiler
We can use the GL_ARB_timer_query extension (available since OpenGL
3.2, and part of the OpenGL specification since version 3.3) to query
the time elapsed when drawing each frame. This allows us to gather
timing information on our use of the GPU.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
c940cc8002 gsk: Split surface upload from texture creation
We're going to need a method to create textures without a surface.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
7eba4b5af5 gsk: Enable depth testing
Use the appropriate depth testing function for transparent items.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1e4393ba7a gsk: Use consistent naming for blend fragment shader
This should make it immediately clear if we're doing something wrong.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
8b3e93b64f gsk: Fix pre-condition check
We warn if the node is marked as not mutable.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
962cb77026 gsk: Flip mutability on GskRenderNode.finalize
We use the public API when removing children nodes, so we need to mark
the node as mutable while we destroy it.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
abc543c792 gsk: Add specific debug type for shaders
So that we don't lose GskShaderBuilder debugging messages in the stream
of GskGLRenderer ones.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
8ea83eb998 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-08-09 17:31:55 +01:00
Emmanuele Bassi
32a3b4a43c 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-08-09 17:31:55 +01:00
Emmanuele Bassi
c071a2a818 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-08-09 17:31:55 +01:00
Emmanuele Bassi
c0f9ecbf4b 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-08-09 17:31:55 +01:00
Emmanuele Bassi
4484be9c7b 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-08-09 17:31:55 +01:00
Emmanuele Bassi
49661a7cf8 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-08-09 17:31:55 +01:00
Emmanuele Bassi
63d218e29c docs: Add more GSK documentation 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
5ffcdc0dde 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-08-09 17:31:55 +01:00
Emmanuele Bassi
713a1c5d1d 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-08-09 17:31:55 +01:00
Emmanuele Bassi
10e197c9c2 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-08-09 17:31:55 +01:00
Emmanuele Bassi
fee200187a gsk: Add debugging notes to ShaderBuilder
Print out the generated shader and the list of available uniforms and
attributes.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
d417b1c73e 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-08-09 17:31:55 +01:00
Emmanuele Bassi
b3d50a47a9 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-08-09 17:31:55 +01:00
Emmanuele Bassi
4611ced84d gsk: Add rendering debug mode for shaders
It's going to be useful to inject debugging data into the shaders used
by GSK.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
fbe43c4e5d gdk: Add more GDK_GL_ERROR error ids
We're going to use them in other locations.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1b85794ac3 build: Fix dependency on GDK for introspection scanner
Otherwise libtool may attempt to use the installed copy of GDK.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1f2b98ccf2 gsk: Use the node's blend mode in the GL renderer 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
f6fd57ea46 gsk: Store blend mode in the render node 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
3c07c2543d gsk: Make GskBlendMode enumeration public 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
71de0df96d gsk: Allow sampling between parent and child nodes 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
2148720651 gsk: Group render state attributes 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
9cce83cfc2 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-08-09 17:31:55 +01:00
Emmanuele Bassi
657bb588b7 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-08-09 17:31:55 +01:00
Emmanuele Bassi
6686b664cd gtk: Add a GskRenderer to GtkWindow
Each top-level should have its own GskRenderer, to be used when drawing
the render node tree.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
1ebafff76b 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-08-09 17:31:55 +01:00
Emmanuele Bassi
b09441cf91 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-08-09 17:31:55 +01:00
Emmanuele Bassi
ca97923bbd gsk: Add GskRenderer::clear_tree
We need a way to clear eventual caches inside GskRenderer subclasses if
the root node has changed.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
bc05963b9c gsk: Port GskGLRenderer to GLES
Use the appropriate API and shaders if the GdkGLContext was created for
OpenGL ES instead of OpenGL.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
498f8852a1 gsk: Use surface-to-texture utility function
Now that we have it.
2016-08-09 17:31:55 +01:00
Emmanuele Bassi
f15cb77d1c gsk: Rename shaders for OpenGL 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
979f059d62 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-08-09 17:31:55 +01:00
Emmanuele Bassi
c462f3ef2e build: Add GSK deps to GTK 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
49a061ce20 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-08-09 17:31:55 +01:00
Emmanuele Bassi
ebc6509421 gsk: Initial commit / build environment 2016-08-09 17:31:55 +01:00
Emmanuele Bassi
da2e612fa8 git.mk: Add config.rpath to the list of ignored files
This finally cleans up the `git status` output.
2016-08-09 17:21:04 +01:00
Emmanuele Bassi
2d2f8e3fa3 Remove config.rpath from EXTRA_DIST
The config.rpath script was added by running gettextize, but it's not
really needed, as config.rpath is generated by autotools and it's
included in the dist tarball automatically.

Upstream gettextize has been fixed so it does not happen any more:
http://savannah.gnu.org/bugs/index.php?48729
2016-08-09 17:19:48 +01:00
Marek Černocký
0be9adc5a3 Updated Czech translation 2016-08-09 12:19:03 +02:00
Dušan Kazik
1c9154b291 Updated Slovak translation 2016-08-08 07:38:30 +00:00
Matthias Clasen
a12ee84ec3 wayland: Link against librt
This is required for shm_open.

https://bugzilla.gnome.org/show_bug.cgi?id=769603
2016-08-07 16:11:55 -04:00
Matthias Clasen
5fefc7a714 headerbar: Fix size allocation
The GtkHeaderBar gadget implementation was subtly broken: it called
gtk_widget_set_allocation both in gtk_header_bar_size_allocate (with
the actual allocation) and in gtk_header_bar_allocate_contents (with
the content allocation of the main gadget). Dropping the second call
fixes the render node conversion for GtkHeaderBar.
2016-08-07 15:08:44 -04:00
Yosef Or Boczko
cb3fc956c5 Updated Hebrew translation 2016-08-07 16:05:42 +03:00
Yosef Or Boczko
6a2cba08c9 Updated Hebrew translation 2016-08-07 15:56:25 +03:00
Philip Withnall
7b40fdbc21 gdkwindow: Fix potential NULL pointer dereferences in event code
The event code could potentially dereference pointer_info if the
invariant that ENTER_NOTIFY and LEAVE_NOTIFY events are only emitted on
devices which have pointers is violated elsewhere.

Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760
2016-08-07 08:17:50 +01:00