mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
Merge branch 'gles-vao' into 'main'
glcontext: Add api to check for vertex arrays Closes #6173 See merge request GNOME/gtk!6501
This commit is contained in:
commit
f4a67ebcbb
@ -1867,6 +1867,7 @@ gdk_gl_context_has_sync (GdkGLContext *self)
|
|||||||
return priv->has_sync;
|
return priv->has_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return if GL_BGRA works with glTexImage2D */
|
||||||
gboolean
|
gboolean
|
||||||
gdk_gl_context_has_bgra (GdkGLContext *self)
|
gdk_gl_context_has_bgra (GdkGLContext *self)
|
||||||
{
|
{
|
||||||
@ -1875,6 +1876,27 @@ gdk_gl_context_has_bgra (GdkGLContext *self)
|
|||||||
return priv->has_bgra;
|
return priv->has_bgra;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
|
||||||
|
* can be used
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gdk_gl_context_has_vertex_arrays (GdkGLContext *self)
|
||||||
|
{
|
||||||
|
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
|
||||||
|
|
||||||
|
switch (priv->api)
|
||||||
|
{
|
||||||
|
case GDK_GL_API_GL:
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
case GDK_GL_API_GLES:
|
||||||
|
return gdk_gl_version_get_major (&priv->gl_version) >= 3;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_return_val_if_reached (FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* This is currently private! */
|
/* This is currently private! */
|
||||||
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
|
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -159,6 +159,8 @@ gboolean gdk_gl_context_has_sync (GdkGLContext
|
|||||||
|
|
||||||
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
|
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
|
||||||
|
|
||||||
|
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
|
||||||
|
|
||||||
double gdk_gl_context_get_scale (GdkGLContext *self);
|
double gdk_gl_context_get_scale (GdkGLContext *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -1070,7 +1070,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
|||||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glBlendEquation (GL_FUNC_ADD);
|
glBlendEquation (GL_FUNC_ADD);
|
||||||
|
|
||||||
if (!gdk_gl_context_get_use_es (self->context))
|
if (gdk_gl_context_has_vertex_arrays (self->context))
|
||||||
{
|
{
|
||||||
glGenVertexArrays (1, &vao_id);
|
glGenVertexArrays (1, &vao_id);
|
||||||
glBindVertexArray (vao_id);
|
glBindVertexArray (vao_id);
|
||||||
@ -1257,7 +1257,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
glDeleteBuffers (1, &vbo_id);
|
glDeleteBuffers (1, &vbo_id);
|
||||||
if (!gdk_gl_context_get_use_es (self->context))
|
if (gdk_gl_context_has_vertex_arrays (self->context))
|
||||||
glDeleteVertexArrays (1, &vao_id);
|
glDeleteVertexArrays (1, &vao_id);
|
||||||
|
|
||||||
gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds);
|
gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds);
|
||||||
|
Loading…
Reference in New Issue
Block a user