Commit Graph

6173 Commits

Author SHA1 Message Date
Marco Trevisan (Treviño)
c82ad2c129 mir, gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.
2015-02-12 03:34:05 +01:00
Marco Trevisan (Treviño)
ce31df3238 mir: Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.
2015-02-12 03:32:11 +01:00
Marco Trevisan (Treviño)
f9503ac189 mir, GL: Split GL context creation in two phases
Move egl_context initialization in gdk_gl_context_realize

 • gdk_window_create_gl_context() creates a GdkGLContext
 • gdk_gl_context_realize() creates the underlying resources

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-12 03:03:18 +01:00
Emmanuele Bassi
5666522ab3 gl: Fix the required version setter
We don't allow a version tuple to be lower than (3, 2), but we should
allow versions above that.

https://bugzilla.gnome.org/show_bug.cgi?id=744212
2015-02-10 10:16:53 +00:00
Chun-wei Fan
60195ab021 win32/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

This is a follow-up commit to commits cc45e82 (x11/gl: Ensure we use the
3.2 core profile) and 2d9081d (wayland/gl: Ensure we use the 3.2 core
profile), so that we do the same on GDK-Win32.  Update variable names and
comments so that the code is clearer to people, as we still need a
temporary legacy WGL context first before we can use
wglCreateContextAttribsARB() to create a WGL core (3.2+) context.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-10 16:21:29 +08:00
Emmanuele Bassi
03f5d5a5e4 gl: Put shaders in static storage
We are not changing the shader code.

The compiler will hopefully put them in the .rodata section.
2015-02-10 03:33:02 +00:00
Niels Nesse
50187ae86d gdkgl should use shader version 1.50
Using version 1.20 with a forward compatible 3.2 core context is incorrect
since OpenGL 3.2 deprecates shader version 1.20 (See section E.2). The latest
fglrx drivers will not compile these shaders.

https://bugzilla.gnome.org/show_bug.cgi?id=744203
2015-02-10 03:30:09 +00:00
Emmanuele Bassi
843475bd2e gl: Drop GdkGLContextClass.upload_texture()
It's unnecessary to allow per-backend overrides.
2015-02-09 19:10:31 +00:00
Emmanuele Bassi
2d35053d97 gl: Clean up the required version accessors
We can simplify the code, since we only have core GL profiles in GDK.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
4ad887f4bf docs: We do not support non-core GL profiles
No need to mention that some API only works on core GL profiles in the
GdkGLContext docs.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
601c49ef39 gl: Clean up pre-requisite checks for GdkGLContext setters
We don't support non-core profiles.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
2d9081d117 wayland/gl: Ensure we use the 3.2 core profile
Emit an error if the profile is different.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
cc45e828df x11/gl: Ensure we use the 3.2 core profile
Drop the dead code for the legacy profile, and return an error when
realizing if the profile is incorrect.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
1d3cc65e89 gl: Add more debugging notes
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
395125bcfb gl: Do not use the extension API for core GL
Since we are using a Core GL profile, we need to drop the
extension-based API.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
4b8b3b431b gl: Drop OpenGL legacy profile
We simply don't want to care about legacy OpenGL.

All supported platforms also have support for OpenGL ≥ 3.2; it would
complicate the internal code; and would force us to use legacy GL
contexts internally if the first context created by the user is a legacy
GL context, and disable creation of core-3.2 contexts after that.

We will need to fix all our code examples to use the Core 3.2 profile.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
6aaa6c337b gl: Move getters for context options to the public API
They can be useful for third party code as well.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Emmanuele Bassi
f7497daee9 Switch GDK_GL_PROFILE_DEFAULT to mean 3_2_CORE
Instead of LEGACY.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
4c091db6c2 win32/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:30 +00:00
Chun-wei Fan
ba56f11702 GDK-Win32: Split GL context creation in two phases
Like what is being done in the X11 and Wayland backends, create the
GdkWin32GLContext in 2 steps, where we only create the actual WGL context
in _gdk_win32_gl_context_realize().

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:28 +00:00
Emmanuele Bassi
42a895e85e wayland/gl: Use the GdkGLContext options
https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
3425f7fe5a x11/gl: Use the GdkGLContext options
When creating an OpenGL context using the glXCreateContextAttribs()
function.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
fa90052299 gl: Add context options
Users of the GdkGLContext API should be allowed to set properties on the
shim GdkGLContext instance prior to realization, so that the
backend-specific implementation can use the value of those properties
when creating the windowing system specific resources.

The main three options are:

 • a major/minor version tuple, to request a specific GL version
 • a debug bit, to request a "debug context", which provides additional
   validation and run time checking
 • a forward compatibility bit, to request a context that does not
   have deprecated functionality

See also:
 - https://www.opengl.org/registry/specs/ARB/glx_create_context.txt

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:05 +00:00
Emmanuele Bassi
22e6f37c9c GL: Split GL context creation in two phases
One of the major requests by OpenGL users has been the ability to
specify settings when creating a GL context, like the version to use
or whether the debug support should be enabled.

We have a couple of requirements in terms of API:

 • avoid, if at all possible, the "C arrays of integers with
   attribute, value pairs", which are hard to write and hard
   to bind in non-C languages.
 • allow failing in a recoverable way.
 • do not make the GL context creation API a mess of arguments.

Looking at prior art, it seems that a common pattern is to split the
construction phase in two:

 • a first phase that creates a GL context wrapper object and
   does preliminary checks on the environment.
 • a second phase that creates the backend-specific GL object.

We adopted a similar pattern:

 • gdk_window_create_gl_context() creates a GdkGLContext
 • gdk_gl_context_realize() creates the underlying resources

Calling gdk_gl_context_make_current() also realizes the context, so
simple GL users do not need to care. Advanced users will want to
call gdk_window_create_gl_context(), set up the optional requirements,
and then call gdk_gl_context_realize(). If either of these two steps
fails, it's possible to recover by changing the requirements, or simply
creating a new GdkGLContext instance.

https://bugzilla.gnome.org/show_bug.cgi?id=741946
2015-02-09 19:10:04 +00:00
Chun-wei Fan
0b06b1e3f7 gdkglcontext-win32.h: Clean Up a Bit
We don't have a Win32-specific ->upload_texture() anymore, so don't
indicate so.  Left out this part from my previous commit.
2015-02-06 13:00:59 +08:00
Chun-wei Fan
24e6bda264 GDK-Win32: Drop Win32-specific ->upload_texture()
The default ->upload_texture() works also for Windows since commit 27cf0fa,
as some of the problems described in 742953 also applied for GL core
contexts on Windows as well before 27cf0fa.  Clean up the GDK-Win32 code a
little bit as a result.
2015-02-06 12:41:38 +08:00
William Hua
0a64a4f3c0 mir: release surface before rendering parent
We should remove the mir and cairo surface before rendering the
transient_for, which will regenerate the cairo surface anyways.
Otherwise, we end up releasing both, when we only really want to get rid
of the mir surface.
2015-02-05 17:26:19 +01:00
William Hua
85c5f6058a mir: don't always request mir surfaces
Some child window behaviour is faked by painting in the parent, so we
don't bother creating the Mir surface in that case.
2015-02-05 17:26:19 +01:00
William Hua
bee39d2251 mir: reconstruct surface if window is moved 2015-02-05 17:26:19 +01:00
William Hua
16b250f9bb mir: stop using deprecated surface api 2015-02-05 17:26:19 +01:00
William Hua
5eacc92ba7 mir: fix issues with mouse over parent menu
Mouse over a parent menu[bar] didn't work while the menu was open.
The fix was to correct the behaviour of pointer crossing events so that
the pointer appears to be only inside one window at a time.

See: http://tronche.com/gui/x/xlib/events/window-entry-exit/normal.html
2015-02-05 17:26:19 +01:00
William Hua
6a3904cf0c mir: add back window hierarchy functions 2015-02-05 17:26:19 +01:00
William Hua
c2afa674e2 mir: stop forwarding motion events to subwindows 2015-02-05 17:26:19 +01:00
William Hua
901bc2957d mir: generate leave events for transient children 2015-02-05 17:26:19 +01:00
Marco Trevisan (Treviño)
737e598a17 mir: use monitor plug names more similar to the ones used in Xmir 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
9a84c3e0f5 mir: only paint background if window has one 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
38d46aacae mir: use old scrolling system if we get simple integer values 2015-02-05 17:26:18 +01:00
William Hua
584cfff90a mir: end the current grab on ungrab 2015-02-05 17:26:18 +01:00
William Hua
e843d94405 mir: only render non-top-level transients. 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
9abf990656 mir: handle new MirCloseSurfaceEvent 2015-02-05 17:26:18 +01:00
William Hua
5ac5f6f81a mir: reset cursor_inside on hide/withdraw
Without this, we generate incorrect crossing events for transient
windows.
2015-02-05 17:26:18 +01:00
William Hua
8e0abb4bac mir: disable some debug output 2015-02-05 17:26:18 +01:00
William Hua
4f19be1c82 mir: skip windows that aren't visible 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
05de5b02cb mir: fix IsModifierKey definition 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
345140008e mir: check the log events env variable just once 2015-02-05 17:26:18 +01:00
Marco Trevisan (Treviño)
7e5b216511 mir: set event source device as well 2015-02-05 17:26:18 +01:00
William Hua
7c2e3a812a mir: fix time conversion macro 2015-02-05 17:26:17 +01:00
Marco Trevisan (Treviño)
54f9263f19 mir: implement stub _gdk_mir_keymap_key_is_modifier
Using IsModifierKey for now
2015-02-05 17:26:17 +01:00
Marco Trevisan (Treviño)
a8b1e81816 mir: check (using simple keycode checking) if we're handling a modifier key 2015-02-05 17:26:17 +01:00
Marco Trevisan (Treviño)
9e2eb5d2f6 mir: compute the modifiers using the saved button_state on key events 2015-02-05 17:26:17 +01:00