summaryrefslogtreecommitdiff
path: root/gdk/gdkglcontext.c
Commit message (Collapse)AuthorAgeFilesLines
* drawcontext: Only pass the region that mattersBenjamin Otte2018-04-241-3/+2
| | | | | | We used to pass 2 regions to GdkDrawCotnext.end_frame() but code was confusing what they meant. So we now don't do that anymore and only pass the region that matters: The frame region.
* gdk: Move begin/end_frame() functionsBenjamin Otte2018-04-241-2/+2
| | | | | | | | | | 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.
* gdk: Remove gdk_gl_context_get_damage()Benjamin Otte2018-04-241-19/+1
| | | | | Remove it only form public API, because we still use the vfunc to figure out the damage area in begin_frame().
* glcontext: Store the buffer age regions in the GL contextBenjamin Otte2018-04-091-0/+27
| | | | | | | | That way, we can store the right region there: The actual painted area instead of the exposed area (which is way too small). Also, the GL context is the only user of this data, so storing it there seems way smarter.
* GdkGLContext: Add a GL debug message callbackTimm Bäder2018-03-251-0/+106
| | | | | | | If G_ENABLE_CONSISTENCY_CHECKS is defined (i.e. if our buildtype is 'debug'), add a opengl debug callback that prints all debug messages with a severity higher than SEVERITY_NOTIFICATION as a warning to the console.
* GdkSurface: Rename lots of stuff from window->surfaceAlexander Larsson2018-03-201-8/+8
| | | | | Mostly these are internal things, but the major public change is that event.window is now event.surface.
* GdkSurface: Rename various functions and variablesAlexander Larsson2018-03-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* GdkWindow -> GdkSurface initial type renameAlexander Larsson2018-03-201-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* The big versioning cleanupMatthias Clasen2018-02-061-36/+0
| | | | | | | Remove all the old 2.x and 3.x version annotations. GTK+ 4 is a new start, and from the perspective of a GTK+ 4 developer all these APIs have been around since the beginning.
* Make gdk logging per-displayMatthias Clasen2018-01-141-5/+14
| | | | | | | As far as possible, use per-display debug flags. This will minimize the debug spew that we get from the inspector if it is running on a separate display.
* gdk: Reorganize env varsMatthias Clasen2018-01-141-32/+3
| | | | | | Drop GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE. Merge the useful bits into GDK_DEBUG. Drop unused debug flags (CURSOR).
* gdk: Cosmetic rewording of draw context docsMatthias Clasen2017-12-261-2/+2
| | | | | Avoid draw context <> drawing context confusion, as far as possible.
* Document more structsMatthias Clasen2017-12-261-0/+7
|
* doc: Replace uses of #NULL with %NULLDaniel Boles2017-11-221-1/+1
|
* Don't mention GdkVisual in the docsMatthias Clasen2017-10-311-2/+2
| | | | It is going away.
* gdkgl: Add gdk_gl_context_get_damage()Benjamin Otte2016-12-051-0/+36
| | | | | | | | | | | | | | | | This is a way to query the damaged area of the backbuffer. The GL renderer uses this to compute the extents of that damage region (computed via buffer age) and use them to minimize the area to redraw. This changes the semantics of GL rendering to "When calling gdk_window_begin_frame() with a GL context, the area by gdk_gl_context_get_damage() needs to be redrawn and every other pixel of the backbuffer is guaranteed to be correct. After gdk_window_end_frame() on a GL-drawn window, the whole backbuffer must be correct. We can always glXBufferSwap() now because of this.
* gdk: Make gdk_window_begin_draw_frame() take a draw contextBenjamin Otte2016-12-051-110/+51
| | | | | | | | | | ... 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.
* gdk: Turn GdkGLContext into a GdkDrawContextBenjamin Otte2016-12-051-87/+10
|
* glcontext: Make begin/end_draw() pairedBenjamin Otte2016-12-051-1/+83
| | | | | | | | | | This way, we can query the GL context's state via gdk_gl_context_is_drawing(). Use this function to make GL contexts as attached and grant them access to the front/backbuffer for rendering. All of this is still unused because GL drawing is still disabled.
* GdkGLContext: chain finalize handlerMassimo Valentini2016-11-101-0/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=773979
* gdkgl: Change prototype of functionBenjamin Otte2016-11-011-8/+7
| | | | | | The function does not upload a cairo surface, it uploads pixel data. So don't take a cairo surface as an argument, take pixel data.
* gl: Check whether use_es is positiveEmmanuele Bassi2016-10-221-2/+2
| | | | | | Now that the use_es field is an int with a possible negative value, we cannot use it its truth value directly; we need to check if it's a positive value, instead.
* gl: Set legacy bit depending on OpenGL versionEmmanuele Bassi2016-10-221-1/+8
| | | | | | | | | GDK defaults to asking for an OpenGL 3.2 Core Profile, but if we get a legacy profile from the underlying windowing system, the OpenGL version will be fixed to 3.0. If that happens, we need to set the legacy bit on the GdkGLContext, since that bit will be used to determine the version and type of GLSL shaders that will be used by application and toolkit code alike.
* gdk/gl: Allow autodetection for GL/GLESEmmanuele Bassi2016-10-211-5/+21
| | | | | | | If the GdkGLContext was not explicitly instructed to use or not GLES, we can detect whether the underlying API is going to be desktop GL or GLES. https://bugzilla.gnome.org/show_bug.cgi?id=773180
* gdk: Don't second-guess whether a context is GLESAdam Jackson2016-10-211-1/+0
| | | | | | | | | We've already set ->use_es correctly at context creation time, all this can possibly do is change our mind about what kind of GL we're using. Signed-off-by: Adam Jackson <ajax@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=773180
* Add some missing (nullable) annotationsRico Tzschichholz2016-09-221-4/+4
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=771826
* gl: Add a realize() fallbackEmmanuele Bassi2016-05-231-0/+12
| | | | | | Calling gdk_gl_context_realize() should always result in a valid result, so we need to provide a default implementation, to avoid a call to a NULL function pointer.
* gdk/gdkglcontext.c: Avoid a GCCismChun-wei Fan2016-04-261-2/+2
| | | | | Pointer arithmetic on GLvoid* (a void*) is a GCCism, so cast it to an unsigned char*, which is the type cairo_image_surface_get_data() returns.
* docs: Clarify the platform-dependency of GdkGLContext:use-esEmmanuele Bassi2016-04-251-4/+5
| | | | Not all platforms allow creating an OpenGL ES context.
* gl: Add fallback for missing subimage unpackingEmmanuele Bassi2016-04-251-5/+23
| | | | | For GLES 2.0 platforms with the subimage unpacking extension we need to upload one row of the image surface at a time.
* gl: Use the appropriate format on GLESEmmanuele Bassi2016-04-251-3/+11
| | | | | | When uploading a Cairo image surface to a GL texture we cannot use GL_BGRA and GL_UNSIGNED_INT_8_8_8_8_REV on OpenGL ES, as they do not exist in the core spec.
* gl: Add more OpenGL ES checksEmmanuele Bassi2016-04-251-21/+92
| | | | | Check for the appropriate extensions depending on which type of API we're using.
* gl: Relay use-es from context to paint dataEmmanuele Bassi2016-04-251-0/+1
| | | | | | This way we can select the appropriate API or the appropriate shaders. https://bugzilla.gnome.org/show_bug.cgi?id=743746
* gl: Add 'use-es' flagEmmanuele Bassi2016-04-251-5/+41
| | | | | | | | | | | | | On some platforms we can ask the GL context machinery to create a GLES context, instead of a GL one. In order to ask for a GLES context at GdkGLContext realization time, we use a bit field like we do for forward compatible, or debug contexts. The 'use-es' bit also changes the way we select a default version, because OpenGL and OpenGLES versions differ. https://bugzilla.gnome.org/show_bug.cgi?id=743746
* gdk: Don't use g_print for debug outputMatthias Clasen2016-02-281-13/+13
| | | | | | The g_print documentation explicitly says not to do this, since g_print is meant to be redirected by applications. Instead use g_message for logging that can be triggered via GTK_DEBUG.
* docs: Improve description of gdk_gl_context_is_legacy()Emmanuele Bassi2015-10-071-1/+14
| | | | | | Explain why this function is available, and why you may need it. https://bugzilla.gnome.org/show_bug.cgi?id=756142
* gl: Store the legacy bit in the GL program dataEmmanuele Bassi2015-10-071-1/+4
| | | | | | We need to know if we're using a legacy GL context in various places. https://bugzilla.gnome.org/show_bug.cgi?id=756142
* gdk: Allow querying if a GL context is in legacy modeEmmanuele Bassi2015-10-071-0/+33
| | | | | | | | | | | | | | | | | | | | We want to have the ability to fall back to legacy GL contexts when creating them. In order to do so, we need to store the legacy bit on the GdkGLContext, as well as being able to query it. Setting the legacy bit from outside GDK is not possible; we cannot create GL contexts in 3.2 core profile *and* compatibility modes at the same time, and if we allowed users to select the legacy mode themselves, it would break the creation of the GdkWindow's paint GL context. What we do allow is falling back to legacy GL context if the platform does not support 3.2 core profiles — for instance, on older GPUs or inside virtualized environments. We are also going to use the legacy bit internally, to choose which GL API we can use when drawing GL content. https://bugzilla.gnome.org/show_bug.cgi?id=756142
* GdkGLContext little fix to property names and descriptions.Daniel Hams2015-07-191-3/+3
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=752502
* gl: Warn the user if they request a GL context version less than 3.2Niels Nesse2015-03-061-7/+10
| | | | | | | | | If the user requests a version less than 3.2 the version is forced to 3.2. Previous checking code have an inconsistent behavior depending on which minor version number was specified. This is avoided now by temporarily converting the major/minor pair into a single integer. https://bugzilla.gnome.org/show_bug.cgi?id=744288
* Remove GdkGLProfileEmmanuele Bassi2015-02-121-75/+0
| | | | | | | | | | | | | | | 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
* gl: Add gdk_gl_context_get_version()Emmanuele Bassi2015-02-121-1/+34
| | | | | | Store the OpenGL version when we first do the extensions check; this allows client code to check the available GL version without requiring a call to gdk_gl_context_make_current() and epoxy_gl_version().
* gl: Drop profile for gdk_window_create_gl_context()Emmanuele Bassi2015-02-121-3/+31
| | | | | | 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.
* gl: Fix the required version setterEmmanuele Bassi2015-02-101-1/+14
| | | | | | | 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
* gl: Drop GdkGLContextClass.upload_texture()Emmanuele Bassi2015-02-091-5/+1
| | | | It's unnecessary to allow per-backend overrides.
* gl: Clean up the required version accessorsEmmanuele Bassi2015-02-091-28/+17
| | | | | | We can simplify the code, since we only have core GL profiles in GDK. https://bugzilla.gnome.org/show_bug.cgi?id=741946
* docs: We do not support non-core GL profilesEmmanuele Bassi2015-02-091-12/+14
| | | | | | | 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
* gl: Clean up pre-requisite checks for GdkGLContext settersEmmanuele Bassi2015-02-091-1/+3
| | | | | | We don't support non-core profiles. https://bugzilla.gnome.org/show_bug.cgi?id=741946
* gl: Add more debugging notesEmmanuele Bassi2015-02-091-0/+13
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=741946
* gl: Drop OpenGL legacy profileEmmanuele Bassi2015-02-091-11/+1
| | | | | | | | | | | | | 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