Commit Graph

23 Commits

Author SHA1 Message Date
Chun-wei Fan
060365a9bb GDK/Win32: Fix build after GDKGL refactoring
There were some parts that need some updates after the refactoring in
GDKGL, so that the code will continue to build and run.

For gdkwindow-win32.c, comment out the parts where we check for use_gl
(which was removed), since we are going to move all drawing to OpenGL,
but don't remove/disable the whole portion as that transition is not
complete at this point.

There a is new GDKGL function that checks for the damaged area of the back
buffer, but since the notion of "damage" is for *NIX (GLX/EGL for
Wayland/mir), meaning that there is no such extension for Windows in this
regard, so we can't support this on Windows as-is, at least for now.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-12-06 16:47:47 +08:00
Benjamin Otte
ca78f5d3cb gdk: Make gdk_window_begin_draw_frame() take a draw context
... instead of a gl context.

This requires some refactoring in the way we mark the shared context as
drawing: We now call begin_frame/end_frame() on it and ignore the call
on the main context.
Unfortunately we need to do this check in all vfuncs, which sucks. But I
haven't found a better way.
2016-12-05 15:02:47 +01:00
Benjamin Otte
725a7236c0 gdk: Turn GdkGLContext into a GdkDrawContext 2016-12-05 15:02:47 +01:00
Benjamin Otte
182d18bcd1 gdk: Large GL refactoring
No visible changes as GL rendering is disabled at the moment.

What was done:

1. Move window->invalidate_for_new_frame to glcontext->begin_frame
This moves the code to where it is used (the GLContext) and prepares it
for being called where it is used when actually beginning to draw the
frame.

2. Get rid of buffer-age usage
We want to let the application render directly to the backbuffer.
Because of that, we cannot make any assumptions about the contents the
application renders outside the clip area.
In particular GskGLRenderer renders random stuff there but not actual
contents.

3. Pass the actual GL context
Previously, we passed the shared context to end_frame, now we pass the
actual GL context that the application uses for rendering. This is so
that the vfuncs could prepare the actual contexts for rendering (they
don't currently).

4. Simplify the code
The previous code set up the final drawing method in begin_frame.
Instead, we now just ensure the clip area is something we can render
and decide on the actual method in end_frame.
This is both more robust (we can change the clip area in between if we
want to) and less code.
2016-12-05 15:02:47 +01:00
Chun-wei Fan
2d7df8e66a gdk/win32: Complete gdk_screen_is_composited() removal
Commit d249e77 (API: screen: Remove gdk_screen_is_composited()) attempted
to update the GDK-Win32 for the removal of the API, but some parts were
missed.  This updates the code so that things continue to build and run.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-11-02 15:37:10 +08:00
Chun-wei Fan
b960008955 GDK-Win32/4.0: Improve GL on Windows
Update the GDKGL implementation:

-Allow legacy contexts to be created.
-Use finer-grained attributes to ask for a pixel format when possible,
 which also adds support for anti-aliasing

In fact the changes here are required for GTKGL to work properly on
Windows for 4.x.

Note that creation of gles contexts is not done here, as the system does
not support such contexts directly on Windows, but only through means such
as ANGLE, which is a totally different issue here.

https://bugzilla.gnome.org/show_bug.cgi?id=773528
2016-10-28 15:56:49 +08:00
Chun-wei Fan
fcecec1a9d GDK/Win32: Deal with leftovers from removal of GdkWindow items
We need to further remove items for the removal of:
-GdkWindow->depth (commit 6cc94ff)
-gdk_window_get_visual()/GdkWindow->visual (commit f420dc7)
-GDK visual query APIs (commit 45c0379)

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2016-10-28 15:56:36 +08:00
Benjamin Otte
f420dc7456 API: gdk: Remove gdk_window_get_visual()
With it, remove window->visual.
2016-10-28 05:22:49 +02:00
Chun-wei Fan
15c9b3e692 GDK-Win32: Make update_stye_bits() available within the backend
Other portions of the GDK-Win32 backend make use of this function as
layered windows need to be disabled for GL windows and possibly other
parts, so make this function a private function that is available within
the backend.

https://bugzilla.gnome.org/show_bug.cgi?id=763285
2016-03-08 13:26:59 +08:00
Chun-wei Fan
3f190e0fa6 Win32: Disable layered windows for GL
Layered windows and GL do not work well together, so disable layered
windows when initiating a GdkGLContext, so that GtkGLArea programs can run
properly.

Also based on patch by LRN to address the issue.

https://bugzilla.gnome.org/show_bug.cgi?id=763080
2016-03-08 12:16:37 +08:00
Chun-wei Fan
bbd1c6cefa gdkglcontext-win32.c: Remove Obsolete Comments
We now have proper checks for gdk_screen_is_composited() and a proper
implementation for gdk_screen_get_rgba_visual() for Windows, so we
can remove the comments in this file stating that they aren't
available for Windows.
2015-04-30 19:50:30 +08:00
Ryan Lortie
c91076f64c gdkglcontext-win32: fix variable names in GDK_NOTE
These probably weren't caught because GDK_NOTE was disabled when the
change was tested.

https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Ryan Lortie
4f0ab5656b gdkglcontext-win32: remove unused variables
https://bugzilla.gnome.org/show_bug.cgi?id=745400
2015-03-01 21:38:19 -05:00
Chun-wei Fan
933ee3af56 gdkglcontext-win32.c: Fix Build on C89 Compilers
Make sure variables are declared at the top of the block.
2015-02-13 18:36:34 +08:00
Emmanuele Bassi
d066e7541e Remove GdkGLProfile
The existence of OpenGL implementations that do not provide the full
core profile compatibility because of reasons beyond the technical, like
llvmpipe not implementing floating point buffers, makes the existence of
GdkGLProfile and documenting the fact that we use core profiles a bit
harder.

Since we do not have any existing profile except the default, we can
remove the GdkGLProfile and its related API from GDK and GTK+, and sweep
the whole thing under the carpet, while we wait for an extension that
lets us ask for the most compatible profile possible.

https://bugzilla.gnome.org/show_bug.cgi?id=744407
2015-02-12 17:51:31 +00:00
Emmanuele Bassi
022724aa69 gl: Drop profile for gdk_window_create_gl_context()
Now that we have a two-stages GL context creation sequence, we can move
the profile to a pre-realize option, like the debug and forward
compatibility bits, or the GL version to use.
2015-02-12 12:34:28 +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
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
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
Chun-wei Fan
36245b7058 GDK-Win32: Drop Some Unused Items
There were a bit of unused items from the GDK-Win32 work on GL support, so
drop them.
2014-12-22 11:25:49 +08:00
Chun-wei Fan
536fa88cd8 Add OpenGL Support for the GDK Windows Backend
This adds support for OpenGL to the GDK Windows backend using the WGL API
calls, which enables programs that uses the GTK+ GLArea widgets to work on
Windows as well.

This also adds a simple utility function to query for the version of OpenGL
that is supported by the Windows system, like the one provided by the X11
backend.

Many thanks to Alex (and Emmanuele, who started the OpenGL integration in
GTK+) who offered advice and help along the way, as well as the X11 and
Wayland backend for this work to refer to and to model upon.

https://bugzilla.gnome.org/show_bug.cgi?id=740795
2014-12-17 16:07:02 +08:00