mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-19 21:40:22 +00:00
gl: Require GL/GLES flag when looking up memory formats
This code just adds the argument to the function and fixes all callers. It's separate because it's just a bunch of boilerplate.
This commit is contained in:
parent
a5d1cb93ef
commit
4e2c7d5eb0
@ -161,7 +161,12 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
if (!(gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_RENDERABLE))
|
||||
continue;
|
||||
|
||||
gdk_memory_format_gl_format (format, &q_internal_format, &q_format, &q_type, q_swizzle);
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
|
||||
if (q_format != gl_format || q_type != gl_type)
|
||||
continue;
|
||||
@ -193,6 +198,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
((gdk_gl_context_get_format_flags (context, format) & GDK_GL_FORMAT_USABLE) == GDK_GL_FORMAT_USABLE))
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
@ -255,6 +261,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
@ -266,6 +273,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
actual_format = gdk_memory_format_get_straight (actual_format);
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
@ -1473,6 +1473,7 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
|
||||
|
||||
void
|
||||
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
@ -1487,6 +1488,7 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
/*
|
||||
* gdk_memory_format_gl_rgba_format:
|
||||
* @format: The format to query
|
||||
* @gles: TRUE for GLES, FALSE for GL
|
||||
* @out_actual_format: The actual RGBA format
|
||||
* @out_internal_format: the GL internal format
|
||||
* @out_format: the GL format
|
||||
@ -1504,6 +1506,7 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
**/
|
||||
gboolean
|
||||
gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
|
@ -55,11 +55,13 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth
|
||||
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4]);
|
||||
gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLenum *out_format,
|
||||
|
@ -1504,6 +1504,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
if ((flags & required_flags) == required_flags)
|
||||
{
|
||||
gdk_memory_format_gl_format (data_format,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
@ -1514,6 +1515,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
|
||||
/* Second, try the potential RGBA format */
|
||||
if (gdk_memory_format_gl_rgba_format (data_format,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
&alt_format,
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
@ -1529,6 +1531,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
return data_format;
|
||||
|
||||
gdk_memory_format_gl_format (alt_format,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
@ -1546,6 +1549,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
if (((flags & required_flags) == required_flags))
|
||||
{
|
||||
gdk_memory_format_gl_format (fallbacks[i],
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
|
@ -638,6 +638,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
*out_format = format;
|
||||
*out_flags = flags;
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
out_gl_internal_format,
|
||||
out_gl_format,
|
||||
out_gl_type,
|
||||
@ -647,6 +648,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
|
||||
/* Second, try the potential RGBA format */
|
||||
if (gdk_memory_format_gl_rgba_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&alt_format,
|
||||
out_gl_internal_format,
|
||||
out_gl_format,
|
||||
@ -670,6 +672,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
*out_format = fallbacks[i];
|
||||
*out_flags = flags;
|
||||
gdk_memory_format_gl_format (fallbacks[i],
|
||||
gdk_gl_context_get_use_es (context),
|
||||
out_gl_internal_format,
|
||||
out_gl_format,
|
||||
out_gl_type,
|
||||
|
Loading…
Reference in New Issue
Block a user