mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
gl: Split internal format for GdkMemoryFormat into GL/GLES
This commit just duplicates the struct. It's separate because it's just a bunch of boilerplate.
This commit is contained in:
parent
4e2c7d5eb0
commit
2f974a1f5a
@ -335,7 +335,8 @@ struct _GdkMemoryFormatDescription
|
||||
GdkMemoryDepth depth;
|
||||
const GdkMemoryFormat *fallbacks;
|
||||
struct {
|
||||
GLint internal_format;
|
||||
GLint internal_gl_format;
|
||||
GLint internal_gles_format;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
GLint swizzle[4];
|
||||
@ -375,7 +376,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -402,7 +404,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -429,7 +432,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -455,7 +459,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -482,7 +487,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -509,7 +515,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -536,7 +543,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -562,7 +570,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -590,7 +599,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -618,7 +628,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -646,7 +657,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -673,7 +685,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA8,
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -701,7 +714,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB8,
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -728,7 +742,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB8,
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.format = GL_BGR,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -759,7 +774,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB16,
|
||||
.internal_gl_format = GL_RGB16,
|
||||
.internal_gles_format = GL_RGB16,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -788,7 +804,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16,
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -817,7 +834,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16,
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -846,7 +864,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB16F,
|
||||
.internal_gl_format = GL_RGB16F,
|
||||
.internal_gles_format = GL_RGB16F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -874,7 +893,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16F,
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -902,7 +922,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA16F,
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -931,7 +952,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGB32F,
|
||||
.internal_gl_format = GL_RGB32F,
|
||||
.internal_gles_format = GL_RGB32F,
|
||||
.format = GL_RGB,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -959,7 +981,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA32F,
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -987,7 +1010,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RGBA32F,
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -1014,7 +1038,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG8,
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1041,7 +1066,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG8,
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1068,7 +1094,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R8,
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@ -1098,7 +1125,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG16,
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1128,7 +1156,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_RG16,
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1158,7 +1187,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16,
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@ -1185,7 +1215,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R8,
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1215,7 +1246,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16,
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1244,7 +1276,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R16F,
|
||||
.internal_gl_format = GL_R16F,
|
||||
.internal_gles_format = GL_R16F,
|
||||
.format = GL_RED,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1273,7 +1306,8 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
-1,
|
||||
},
|
||||
.gl = {
|
||||
.internal_format = GL_R32F,
|
||||
.internal_gl_format = GL_R32F,
|
||||
.internal_gles_format = GL_R32F,
|
||||
.format = GL_RED,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1479,7 +1513,10 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
{
|
||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[format].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[format].gl.internal_gl_format;
|
||||
*out_format = memory_formats[format].gl.format;
|
||||
*out_type = memory_formats[format].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
|
||||
@ -1519,7 +1556,10 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
return FALSE;
|
||||
|
||||
*out_actual_format = actual;
|
||||
*out_internal_format = memory_formats[actual].gl.internal_format;
|
||||
if (gles)
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gl_format;
|
||||
*out_format = memory_formats[actual].gl.format;
|
||||
*out_type = memory_formats[actual].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.rgba_swizzle, sizeof(GLint) * 4);
|
||||
|
Loading…
Reference in New Issue
Block a user