forked from AuroraMiddleware/gtk
Export API to set GL flags
This will be used in the inspector.
This commit is contained in:
parent
d859cf19f6
commit
5d0d1e524e
12
gdk/gdk.c
12
gdk/gdk.c
@ -135,12 +135,12 @@ static GCallback gdk_threads_lock = NULL;
|
||||
static GCallback gdk_threads_unlock = NULL;
|
||||
|
||||
static const GDebugKey gdk_gl_keys[] = {
|
||||
{"disable", GDK_GL_FLAGS_DISABLE},
|
||||
{"always", GDK_GL_FLAGS_ALWAYS},
|
||||
{"software-draw", GDK_GL_FLAGS_SOFTWARE_DRAW_GL | GDK_GL_FLAGS_SOFTWARE_DRAW_SURFACE},
|
||||
{"software-draw-gl", GDK_GL_FLAGS_SOFTWARE_DRAW_GL},
|
||||
{"software-draw-surface", GDK_GL_FLAGS_SOFTWARE_DRAW_SURFACE},
|
||||
{"texture-rectangle", GDK_GL_FLAGS_TEXTURE_RECTANGLE},
|
||||
{"disable", GDK_GL_DISABLE},
|
||||
{"always", GDK_GL_ALWAYS},
|
||||
{"software-draw", GDK_GL_SOFTWARE_DRAW_GL | GDK_GL_SOFTWARE_DRAW_SURFACE},
|
||||
{"software-draw-gl", GDK_GL_SOFTWARE_DRAW_GL},
|
||||
{"software-draw-surface", GDK_GL_SOFTWARE_DRAW_SURFACE},
|
||||
{"texture-rectangle", GDK_GL_TEXTURE_RECTANGLE},
|
||||
};
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
@ -393,7 +393,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
|
||||
/* For direct paint of non-alpha renderbuffer, we can
|
||||
just do a bitblit */
|
||||
if ((_gdk_gl_flags & GDK_GL_FLAGS_SOFTWARE_DRAW_GL) == 0 &&
|
||||
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_GL) == 0 &&
|
||||
source_type == GL_RENDERBUFFER &&
|
||||
alpha_size == 0 &&
|
||||
direct_window != NULL &&
|
||||
@ -474,7 +474,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
|
||||
}
|
||||
/* For direct paint of alpha or non-alpha textures we can use texturing */
|
||||
else if ((_gdk_gl_flags & GDK_GL_FLAGS_SOFTWARE_DRAW_GL) == 0 &&
|
||||
else if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_GL) == 0 &&
|
||||
source_type == GL_TEXTURE &&
|
||||
direct_window != NULL &&
|
||||
direct_window->current_paint.use_gl &&
|
||||
@ -663,7 +663,7 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
guint target;
|
||||
|
||||
paint_context = gdk_gl_context_get_current ();
|
||||
if ((_gdk_gl_flags & GDK_GL_FLAGS_SOFTWARE_DRAW_SURFACE) == 0 &&
|
||||
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_SURFACE) == 0 &&
|
||||
paint_context &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
|
||||
GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, surface, region))
|
||||
|
@ -380,14 +380,14 @@ gdk_gl_context_realize (GdkGLContext *context)
|
||||
priv->has_gl_framebuffer_blit = epoxy_has_gl_extension ("GL_EXT_framebuffer_blit");
|
||||
priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator");
|
||||
|
||||
if (_gdk_gl_flags & GDK_GL_FLAGS_TEXTURE_RECTANGLE)
|
||||
if (_gdk_gl_flags & GDK_GL_TEXTURE_RECTANGLE)
|
||||
priv->use_texture_rectangle = TRUE;
|
||||
else if (has_npot)
|
||||
priv->use_texture_rectangle = FALSE;
|
||||
else if (has_texture_rectangle)
|
||||
priv->use_texture_rectangle = TRUE;
|
||||
else
|
||||
g_warning ("Gl implementation doesn't support any form of non-power-of-two textures");
|
||||
g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
|
||||
|
||||
priv->realized = TRUE;
|
||||
}
|
||||
@ -543,3 +543,32 @@ gdk_gl_context_get_current (void)
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_get_flags:
|
||||
*
|
||||
* Returns the currently active GL flags.
|
||||
*
|
||||
* Returns: the GL flags
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkGLFlags
|
||||
gdk_gl_get_flags (void)
|
||||
{
|
||||
return _gdk_gl_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_set_flags:
|
||||
* @flags: #GdkGLFlags to set
|
||||
*
|
||||
* Sets GL flags.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_gl_set_flags (GdkGLFlags flags)
|
||||
{
|
||||
_gdk_gl_flags = flags;
|
||||
}
|
||||
|
@ -56,6 +56,34 @@ GdkGLContext * gdk_gl_context_get_current (void);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_context_clear_current (void);
|
||||
|
||||
/**
|
||||
* GdkGLFlags:
|
||||
* @GDK_GL_DISABLE: Disable creating new windows with GL rendering
|
||||
* @GDK_GL_ALWAYS: Make all newly created windows use GL rendering
|
||||
* @GDK_GL_SOFTWARE_DRAW_GL: Always use software fallback for drawing
|
||||
* GL content to a cairo_t. This disables the fast paths that exist for
|
||||
* drawing directly to a window and instead reads back the pixels into
|
||||
* a cairo image surface.
|
||||
* @GDK_GL_SOFTWARE_DRAW_SURFACE: Always use software fallback for
|
||||
* drawing cairo surfaces onto a GL-using window. This disables e.g.
|
||||
* texture-from-pixmap on X11.
|
||||
* @GDK_GL_TEXTURE_RECTANGLE: Use the GL_ARB_texture_rectangle extension
|
||||
*
|
||||
* Flags that influence the OpenGL rendering used by GDK.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_GL_DISABLE = 1 << 0,
|
||||
GDK_GL_ALWAYS = 1 << 1,
|
||||
GDK_GL_SOFTWARE_DRAW_GL = 1 << 2,
|
||||
GDK_GL_SOFTWARE_DRAW_SURFACE = 1 << 3,
|
||||
GDK_GL_TEXTURE_RECTANGLE = 1 << 4
|
||||
} GdkGLFlags;
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkGLFlags gdk_gl_get_flags (void);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_set_flags (GdkGLFlags flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_GL_CONTEXT_H__ */
|
||||
|
@ -88,15 +88,6 @@ typedef enum {
|
||||
GDK_DEBUG_OPENGL = 1 << 13,
|
||||
} GdkDebugFlag;
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_FLAGS_DISABLE = 1 << 0,
|
||||
GDK_GL_FLAGS_ALWAYS = 1 << 1,
|
||||
GDK_GL_FLAGS_SOFTWARE_DRAW_GL = 1 << 2,
|
||||
GDK_GL_FLAGS_SOFTWARE_DRAW_SURFACE = 1 << 3,
|
||||
GDK_GL_FLAGS_TEXTURE_RECTANGLE = 1 << 4,
|
||||
} GdkGLFlags;
|
||||
|
||||
|
||||
typedef enum {
|
||||
GDK_RENDERING_MODE_SIMILAR = 0,
|
||||
GDK_RENDERING_MODE_IMAGE,
|
||||
|
@ -1419,7 +1419,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
G_CALLBACK (device_removed_cb), window);
|
||||
|
||||
|
||||
if ((_gdk_gl_flags & (GDK_GL_FLAGS_ALWAYS | GDK_GL_FLAGS_DISABLE)) == GDK_GL_FLAGS_ALWAYS)
|
||||
if ((_gdk_gl_flags & (GDK_GL_ALWAYS | GDK_GL_DISABLE)) == GDK_GL_ALWAYS)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@ -2725,7 +2725,7 @@ gdk_window_ref_impl_surface (GdkWindow *window)
|
||||
GdkGLContext *
|
||||
gdk_window_get_paint_gl_context (GdkWindow *window, GError **error)
|
||||
{
|
||||
if (_gdk_gl_flags & GDK_GL_FLAGS_DISABLE)
|
||||
if (_gdk_gl_flags & GDK_GL_DISABLE)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
|
Loading…
Reference in New Issue
Block a user