Fix swizzle values for some memory formats

For opaque formats with 3 channels, we should use the default
GL_ALPHA, but for opaque formats with an ignored 4th channel,
we must use GL_ONE.
This commit is contained in:
Matthias Clasen 2023-10-25 21:39:52 -04:00
parent 677e78bdce
commit 4a749aee6e

View File

@ -481,7 +481,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ 0, 0, 0, 0 },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r8g8b8_to_float,
r8g8b8_from_float,
},
@ -491,7 +491,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
b8g8r8_to_float,
b8g8r8_from_float,
},
@ -501,7 +501,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ 0, 0, 3, 0 },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_to_float,
r16g16b16_from_float,
},
@ -531,7 +531,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ 0, 0, 3, 0 },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_float_to_float,
r16g16b16_float_from_float,
},
@ -561,7 +561,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ 0, 0, 3, 0 },
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32_float_to_float,
r32g32b32_float_from_float,
},