forked from AuroraMiddleware/gtk
Add GdkGLContext::profile
This commit is contained in:
parent
398697eb2f
commit
0eb2fb01fd
@ -81,6 +81,7 @@
|
||||
typedef struct {
|
||||
GdkWindow *window;
|
||||
GdkGLContext *shared_context;
|
||||
GdkGLProfile profile;
|
||||
|
||||
guint realized : 1;
|
||||
guint use_texture_rectangle : 1;
|
||||
@ -91,6 +92,7 @@ enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_WINDOW,
|
||||
PROP_PROFILE,
|
||||
PROP_SHARED_CONTEXT,
|
||||
|
||||
LAST_PROP
|
||||
@ -154,6 +156,10 @@ gdk_gl_context_set_property (GObject *gobject,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_PROFILE:
|
||||
priv->profile = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
@ -177,6 +183,10 @@ gdk_gl_context_get_property (GObject *gobject,
|
||||
g_value_set_object (value, priv->shared_context);
|
||||
break;
|
||||
|
||||
case PROP_PROFILE:
|
||||
g_value_set_enum (value, priv->profile);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
@ -203,6 +213,23 @@ gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLContext:profile:
|
||||
*
|
||||
* The #GdkGLProfile of the context
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
obj_pspecs[PROP_PROFILE] =
|
||||
g_param_spec_enum ("profile",
|
||||
P_("Profile"),
|
||||
P_("The GL profile the context was created for"),
|
||||
GDK_TYPE_GL_PROFILE,
|
||||
GDK_GL_PROFILE_DEFAULT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLContext:shared-context:
|
||||
*
|
||||
@ -330,6 +357,26 @@ gdk_gl_context_get_window (GdkGLContext *context)
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_profile:
|
||||
* @context: a #GdkGLContext
|
||||
*
|
||||
* Retrieves the #GdkGLProfile that @context was created for.
|
||||
*
|
||||
* Returns: a #GdkGLProfile
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkGLProfile
|
||||
gdk_gl_context_get_profile (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), GDK_GL_PROFILE_LEGACY);
|
||||
|
||||
return priv->profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_shared_context:
|
||||
* @context: a #GdkGLContext
|
||||
|
@ -44,6 +44,8 @@ GType gdk_gl_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkWindow * gdk_gl_context_get_window (GdkGLContext *context);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkGLProfile gdk_gl_context_get_profile (GdkGLContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_context_make_current (GdkGLContext *context);
|
||||
|
@ -326,6 +326,9 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (profile == GDK_GL_PROFILE_DEFAULT)
|
||||
profile = GDK_GL_PROFILE_LEGACY;
|
||||
|
||||
if (profile == GDK_GL_PROFILE_3_2_CORE &&
|
||||
!display_wayland->have_egl_khr_create_context)
|
||||
{
|
||||
@ -363,6 +366,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
|
||||
|
||||
context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
|
||||
"window", window,
|
||||
"profile", profile,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
|
||||
|
@ -1043,6 +1043,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
|
||||
/* GDK_GL_PROFILE_DEFAULT is currently
|
||||
* equivalent to the LEGACY profile
|
||||
*/
|
||||
profile = GDK_GL_PROFILE_LEGACY;
|
||||
glx_context = create_gl_context (display, config, share);
|
||||
}
|
||||
|
||||
@ -1119,6 +1120,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
|
||||
|
||||
context = g_object_new (GDK_TYPE_X11_GL_CONTEXT,
|
||||
"window", window,
|
||||
"profile", profile,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user