mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
gdk: Allow querying GL SRGB formats
Nobody is using this yet.
This commit is contained in:
parent
8d5224eba7
commit
2f4e19d514
@ -151,7 +151,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLint q_internal_format;
|
||||
GLint q_internal_format, q_internal_srgb_format;
|
||||
GLenum q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
@ -164,6 +164,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_internal_srgb_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
@ -187,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GLint gl_internal_format;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
|
||||
@ -199,7 +200,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
download->format == format)
|
||||
@ -262,7 +263,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
}
|
||||
@ -274,7 +275,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,9 @@ struct _GdkMemoryFormatDescription
|
||||
struct {
|
||||
GLint internal_gl_format;
|
||||
GLint internal_gles_format;
|
||||
GLint internal_srgb_format;
|
||||
GLenum format;
|
||||
GLenum srgb_format;
|
||||
GLenum type;
|
||||
GLint swizzle[4];
|
||||
/* -1 if none exists, ie the format is already RGBA
|
||||
@ -367,6 +369,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -397,6 +400,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -427,6 +431,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -456,6 +461,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -486,6 +492,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -516,6 +523,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -546,6 +554,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -575,6 +584,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -606,6 +616,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -637,6 +648,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -668,6 +680,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -698,6 +711,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@ -729,6 +743,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_srgb_format = GL_SRGB8,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -759,6 +774,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_srgb_format = GL_SRGB8,
|
||||
.format = GL_BGR,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -793,6 +809,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16,
|
||||
.internal_gles_format = GL_RGB16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -825,6 +842,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -857,6 +875,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -889,6 +908,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16F,
|
||||
.internal_gles_format = GL_RGB16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -920,6 +940,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -951,6 +972,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -983,6 +1005,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB32F,
|
||||
.internal_gles_format = GL_RGB32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -1014,6 +1037,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -1045,6 +1069,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@ -1075,6 +1100,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1105,6 +1131,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1135,6 +1162,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@ -1168,6 +1196,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1201,6 +1230,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@ -1234,6 +1264,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@ -1264,6 +1295,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1297,6 +1329,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1329,6 +1362,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16F,
|
||||
.internal_gles_format = GL_R16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1361,6 +1395,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R32F,
|
||||
.internal_gles_format = GL_R32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@ -1575,6 +1610,7 @@ void
|
||||
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
@ -1583,6 +1619,7 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
*out_internal_format = memory_formats[format].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[format].gl.internal_gl_format;
|
||||
*out_internal_srgb_format = memory_formats[format].gl.internal_srgb_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);
|
||||
@ -1594,6 +1631,8 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
* @gles: TRUE for GLES, FALSE for GL
|
||||
* @out_actual_format: The actual RGBA format
|
||||
* @out_internal_format: the GL internal format
|
||||
* @out_internal_srgb_format: the GL internal format to use for automatic
|
||||
* sRGB<=>linear conversion
|
||||
* @out_format: the GL format
|
||||
* @out_type: the GL type
|
||||
* @out_swizzle: The swizzle to use
|
||||
@ -1612,6 +1651,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
@ -1626,6 +1666,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gl_format;
|
||||
*out_internal_srgb_format = memory_formats[actual].gl.internal_srgb_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);
|
||||
|
@ -65,6 +65,7 @@ GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth
|
||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4]);
|
||||
|
@ -1483,6 +1483,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
gboolean ensure_mipmap,
|
||||
gboolean *out_can_mipmap,
|
||||
GLint *gl_internalformat,
|
||||
GLint *gl_internalsrgbformat,
|
||||
GLenum *gl_format,
|
||||
GLenum *gl_type,
|
||||
GLint gl_swizzle[4])
|
||||
@ -1507,6 +1508,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
gdk_memory_format_gl_format (data_format,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_internalsrgbformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
gl_swizzle);
|
||||
@ -1519,6 +1521,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
&alt_format,
|
||||
gl_internalformat,
|
||||
gl_internalsrgbformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
gl_swizzle))
|
||||
@ -1534,6 +1537,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
gdk_memory_format_gl_format (alt_format,
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_internalsrgbformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
gl_swizzle);
|
||||
@ -1552,6 +1556,7 @@ memory_format_gl_format (GskGLCommandQueue *self,
|
||||
gdk_memory_format_gl_format (fallbacks[i],
|
||||
gdk_gl_context_get_use_es (self->context),
|
||||
gl_internalformat,
|
||||
gl_internalsrgbformat,
|
||||
gl_format,
|
||||
gl_type,
|
||||
gl_swizzle);
|
||||
@ -1670,7 +1675,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
int width, height;
|
||||
GdkMemoryFormat data_format;
|
||||
GLint gl_internalformat;
|
||||
GLint gl_internalformat, gl_internalsrgbformat;
|
||||
GLenum gl_format;
|
||||
GLenum gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
@ -1713,6 +1718,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
||||
ensure_mipmap,
|
||||
out_can_mipmap,
|
||||
&gl_internalformat,
|
||||
&gl_internalsrgbformat,
|
||||
&gl_format,
|
||||
&gl_type,
|
||||
gl_swizzle);
|
||||
|
@ -635,6 +635,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
GdkMemoryFormat *out_format,
|
||||
GskGpuImageFlags *out_flags,
|
||||
GLint *out_gl_internal_format,
|
||||
GLint *out_gl_internal_srgb_format,
|
||||
GLenum *out_gl_format,
|
||||
GLenum *out_gl_type,
|
||||
GLint out_swizzle[4])
|
||||
@ -654,6 +655,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
out_gl_internal_format,
|
||||
out_gl_internal_srgb_format,
|
||||
out_gl_format,
|
||||
out_gl_type,
|
||||
out_swizzle);
|
||||
@ -665,6 +667,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&alt_format,
|
||||
out_gl_internal_format,
|
||||
out_gl_internal_srgb_format,
|
||||
out_gl_format,
|
||||
out_gl_type,
|
||||
out_swizzle) &&
|
||||
@ -688,6 +691,7 @@ gsk_gl_device_find_gl_format (GskGLDevice *self,
|
||||
gdk_memory_format_gl_format (fallbacks[i],
|
||||
gdk_gl_context_get_use_es (context),
|
||||
out_gl_internal_format,
|
||||
out_gl_internal_srgb_format,
|
||||
out_gl_format,
|
||||
out_gl_type,
|
||||
out_swizzle);
|
||||
|
@ -26,6 +26,7 @@ void gsk_gl_device_find_gl_format (GskGLDe
|
||||
GdkMemoryFormat *out_format,
|
||||
GskGpuImageFlags *out_flags,
|
||||
GLint *out_gl_internal_format,
|
||||
GLint *out_gl_internal_srgb_format,
|
||||
GLenum *out_gl_format,
|
||||
GLenum *out_gl_type,
|
||||
GLint out_swizzle[4]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "gskglimageprivate.h"
|
||||
|
||||
@ -78,6 +78,7 @@ gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
GskGLImage *self;
|
||||
GskGpuImageFlags flags;
|
||||
GLint swizzle[4];
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
|
||||
self = g_object_new (GSK_TYPE_GL_IMAGE, NULL);
|
||||
|
||||
@ -87,11 +88,14 @@ gsk_gl_image_new_backbuffer (GskGLDevice *device,
|
||||
0,
|
||||
&format,
|
||||
&flags,
|
||||
&self->gl_internal_format,
|
||||
&gl_internal_format,
|
||||
&gl_internal_srgb_format,
|
||||
&self->gl_format,
|
||||
&self->gl_type,
|
||||
swizzle);
|
||||
|
||||
|
||||
self->gl_internal_format = gl_internal_format;
|
||||
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self), flags, format, width, height);
|
||||
|
||||
/* texture_id == 0 means backbuffer */
|
||||
@ -116,6 +120,7 @@ gsk_gl_image_new (GskGLDevice *device,
|
||||
GskGLImage *self;
|
||||
GLint swizzle[4];
|
||||
GskGpuImageFlags flags;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
gsize max_size;
|
||||
|
||||
max_size = gsk_gpu_device_get_max_image_size (GSK_GPU_DEVICE (device));
|
||||
@ -129,11 +134,14 @@ gsk_gl_image_new (GskGLDevice *device,
|
||||
required_flags,
|
||||
&format,
|
||||
&flags,
|
||||
&self->gl_internal_format,
|
||||
&gl_internal_format,
|
||||
&gl_internal_srgb_format,
|
||||
&self->gl_format,
|
||||
&self->gl_type,
|
||||
swizzle);
|
||||
|
||||
|
||||
self->gl_internal_format = gl_internal_format;
|
||||
|
||||
gsk_gpu_image_setup (GSK_GPU_IMAGE (self),
|
||||
flags,
|
||||
format,
|
||||
@ -177,6 +185,7 @@ gsk_gl_image_new_for_texture (GskGLDevice *device,
|
||||
GdkMemoryFormat format, real_format;
|
||||
GskGpuImageFlags flags;
|
||||
GskGLImage *self;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLint swizzle[4];
|
||||
|
||||
format = gdk_texture_get_format (owner);
|
||||
@ -188,10 +197,14 @@ gsk_gl_image_new_for_texture (GskGLDevice *device,
|
||||
0,
|
||||
&real_format,
|
||||
&flags,
|
||||
&self->gl_internal_format,
|
||||
&gl_internal_format,
|
||||
&gl_internal_srgb_format,
|
||||
&self->gl_format,
|
||||
&self->gl_type,
|
||||
swizzle);
|
||||
|
||||
self->gl_internal_format = gl_internal_format;
|
||||
|
||||
if (format != real_format)
|
||||
flags = GSK_GPU_IMAGE_NO_BLIT |
|
||||
(gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT ? GSK_GPU_IMAGE_STRAIGHT_ALPHA : 0);
|
||||
|
Loading…
Reference in New Issue
Block a user