memoryformat: Make the big array more readable

Prefix the struct members with their name, similar to how our Vulkan
code looks.
This commit is contained in:
Benjamin Otte 2023-12-09 02:42:33 +01:00
parent 2b6e7147d6
commit 84de90756d

View File

@ -350,301 +350,466 @@ struct _GdkMemoryFormatDescription
static const GdkMemoryFormatDescription memory_formats[] = {
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
b8g8r8a8_premultiplied_to_float,
b8g8r8a8_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = b8g8r8a8_premultiplied_to_float,
.from_float = b8g8r8a8_premultiplied_from_float,
},
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
a8r8g8b8_premultiplied_to_float,
a8r8g8b8_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = a8r8g8b8_premultiplied_to_float,
.from_float = a8r8g8b8_premultiplied_from_float,
},
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r8g8b8a8_premultiplied_to_float,
r8g8b8a8_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r8g8b8a8_premultiplied_to_float,
.from_float = r8g8b8a8_premultiplied_from_float,
},
[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
a8b8g8r8_premultiplied_to_float,
a8b8g8r8_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = a8b8g8r8_premultiplied_to_float,
.from_float = a8b8g8r8_premultiplied_from_float,
},
[GDK_MEMORY_B8G8R8A8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
b8g8r8a8_to_float,
b8g8r8a8_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = b8g8r8a8_to_float,
.from_float = b8g8r8a8_from_float,
},
[GDK_MEMORY_A8R8G8B8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
a8r8g8b8_to_float,
a8r8g8b8_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = a8r8g8b8_to_float,
.from_float = a8r8g8b8_from_float,
},
[GDK_MEMORY_R8G8B8A8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r8g8b8a8_to_float,
r8g8b8a8_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r8g8b8a8_to_float,
.from_float = r8g8b8a8_from_float,
},
[GDK_MEMORY_A8B8G8R8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
a8b8g8r8_to_float,
a8b8g8r8_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = a8b8g8r8_to_float,
.from_float = a8b8g8r8_from_float,
},
[GDK_MEMORY_B8G8R8X8] = {
GDK_MEMORY_ALPHA_OPAQUE,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
b8g8r8x8_to_float,
b8g8r8x8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
},
.to_float = b8g8r8x8_to_float,
.from_float = b8g8r8x8_from_float,
},
[GDK_MEMORY_X8R8G8B8] = {
GDK_MEMORY_ALPHA_OPAQUE,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_BGRA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
x8r8g8b8_to_float,
x8r8g8b8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_BGRA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
},
.to_float = x8r8g8b8_to_float,
.from_float = x8r8g8b8_from_float,
},
[GDK_MEMORY_R8G8B8X8] = {
GDK_MEMORY_ALPHA_OPAQUE,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
r8g8b8x8_to_float,
r8g8b8x8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
},
.to_float = r8g8b8x8_to_float,
.from_float = r8g8b8x8_from_float,
},
[GDK_MEMORY_X8B8G8R8] = {
GDK_MEMORY_ALPHA_OPAQUE,
4,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGBA8, GL_RGBA, GDK_GL_UNSIGNED_BYTE_FLIPPED, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
x8b8g8r8_to_float,
x8b8g8r8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGBA8,
.format = GL_RGBA,
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
},
.to_float = x8b8g8r8_to_float,
.from_float = x8b8g8r8_from_float,
},
[GDK_MEMORY_R8G8B8] = {
GDK_MEMORY_ALPHA_OPAQUE,
3,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r8g8b8_to_float,
r8g8b8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 3,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGB8,
.format = GL_RGB,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r8g8b8_to_float,
.from_float = r8g8b8_from_float,
},
[GDK_MEMORY_B8G8R8] = {
GDK_MEMORY_ALPHA_OPAQUE,
3,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
b8g8r8_to_float,
b8g8r8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 3,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RGB8,
.format = GL_BGR,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = b8g8r8_to_float,
.from_float = b8g8r8_from_float,
},
[GDK_MEMORY_R16G16B16] = {
GDK_MEMORY_ALPHA_OPAQUE,
6,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_to_float,
r16g16b16_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 6,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_RGB16,
.format = GL_RGB,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16_to_float,
.from_float = r16g16b16_from_float,
},
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
8,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16a16_to_float,
r16g16b16a16_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 8,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_RGBA16,
.format = GL_RGBA,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16a16_to_float,
.from_float = r16g16b16a16_from_float,
},
[GDK_MEMORY_R16G16B16A16] = {
GDK_MEMORY_ALPHA_STRAIGHT,
8,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_RGBA16, GL_RGBA, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16a16_to_float,
r16g16b16a16_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 8,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_RGBA16,
.format = GL_RGBA,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16a16_to_float,
.from_float = r16g16b16a16_from_float,
},
[GDK_MEMORY_R16G16B16_FLOAT] = {
GDK_MEMORY_ALPHA_OPAQUE,
6,
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_float_to_float,
r16g16b16_float_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 6,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_FLOAT16,
.gl = {
.internal_format = GL_RGB16F,
.format = GL_RGB,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16_float_to_float,
.from_float = r16g16b16_float_from_float,
},
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
8,
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16a16_float_to_float,
r16g16b16a16_float_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 8,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_FLOAT16,
.gl = {
.internal_format = GL_RGBA16F,
.format = GL_RGBA,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16a16_float_to_float,
.from_float = r16g16b16a16_float_from_float,
},
[GDK_MEMORY_R16G16B16A16_FLOAT] = {
GDK_MEMORY_ALPHA_STRAIGHT,
8,
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16a16_float_to_float,
r16g16b16a16_float_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 8,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_FLOAT16,
.gl = {
.internal_format = GL_RGBA16F,
.format = GL_RGBA,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r16g16b16a16_float_to_float,
.from_float = r16g16b16a16_float_from_float,
},
[GDK_MEMORY_R32G32B32_FLOAT] = {
GDK_MEMORY_ALPHA_OPAQUE,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
12,
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32_float_to_float,
r32g32b32_float_from_float,
.alignment = G_ALIGNOF (float),
.depth = GDK_MEMORY_FLOAT32,
.gl = {
.internal_format = GL_RGB32F,
.format = GL_RGB,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r32g32b32_float_to_float,
.from_float = r32g32b32_float_from_float,
},
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
16,
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32a32_float_to_float,
r32g32b32a32_float_from_float,
.alignment = G_ALIGNOF (float),
.depth = GDK_MEMORY_FLOAT32,
.gl = {
.internal_format = GL_RGBA32F,
.format = GL_RGBA,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r32g32b32a32_float_to_float,
.from_float = r32g32b32a32_float_from_float,
},
[GDK_MEMORY_R32G32B32A32_FLOAT] = {
GDK_MEMORY_ALPHA_STRAIGHT,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
16,
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32a32_float_to_float,
r32g32b32a32_float_from_float,
.alignment = G_ALIGNOF (float),
.depth = GDK_MEMORY_FLOAT32,
.gl = {
.internal_format = GL_RGBA32F,
.format = GL_RGBA,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
},
.to_float = r32g32b32a32_float_to_float,
.from_float = r32g32b32a32_float_from_float,
},
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
2,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g8a8_premultiplied_to_float,
g8a8_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 2,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RG8,
.format = GL_RG,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
},
.to_float = g8a8_premultiplied_to_float,
.from_float = g8a8_premultiplied_from_float,
},
[GDK_MEMORY_G8A8] = {
GDK_MEMORY_ALPHA_STRAIGHT,
2,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_RG8, GL_RG, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g8a8_to_float,
g8a8_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 2,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_RG8,
.format = GL_RG,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
},
.to_float = g8a8_to_float,
.from_float = g8a8_from_float,
},
[GDK_MEMORY_G8] = {
GDK_MEMORY_ALPHA_OPAQUE,
1,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_ONE } },
g8_to_float,
g8_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 1,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_R8,
.format = GL_RED,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
},
.to_float = g8_to_float,
.from_float = g8_from_float,
},
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g16a16_premultiplied_to_float,
g16a16_premultiplied_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_RG16,
.format = GL_RG,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
},
.to_float = g16a16_premultiplied_to_float,
.from_float = g16a16_premultiplied_from_float,
},
[GDK_MEMORY_G16A16] = {
GDK_MEMORY_ALPHA_STRAIGHT,
4,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_RG16, GL_RG, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_GREEN } },
g16a16_to_float,
g16a16_from_float,
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_RG16,
.format = GL_RG,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
},
.to_float = g16a16_to_float,
.from_float = g16a16_from_float,
},
[GDK_MEMORY_G16] = {
GDK_MEMORY_ALPHA_OPAQUE,
2,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_ONE } },
g16_to_float,
g16_from_float,
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
.bytes_per_pixel = 2,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_R16,
.format = GL_RED,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
},
.to_float = g16_to_float,
.from_float = g16_from_float,
},
[GDK_MEMORY_A8] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
1,
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ GL_R8, GL_RED, GL_UNSIGNED_BYTE, { GL_RED, GL_RED, GL_RED, GL_RED } },
a8_to_float,
a8_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 1,
.alignment = G_ALIGNOF (guchar),
.depth = GDK_MEMORY_U8,
.gl = {
.internal_format = GL_R8,
.format = GL_RED,
.type = GL_UNSIGNED_BYTE,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
},
.to_float = a8_to_float,
.from_float = a8_from_float,
},
[GDK_MEMORY_A16] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
2,
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ GL_R16, GL_RED, GL_UNSIGNED_SHORT, { GL_RED, GL_RED, GL_RED, GL_RED } },
a16_to_float,
a16_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 2,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_U16,
.gl = {
.internal_format = GL_R16,
.format = GL_RED,
.type = GL_UNSIGNED_SHORT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
},
.to_float = a16_to_float,
.from_float = a16_from_float,
},
[GDK_MEMORY_A16_FLOAT] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
2,
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ GL_R16F, GL_RED, GL_HALF_FLOAT, { GL_RED, GL_RED, GL_RED, GL_RED } },
a16_float_to_float,
a16_float_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 2,
.alignment = G_ALIGNOF (guint16),
.depth = GDK_MEMORY_FLOAT16,
.gl = {
.internal_format = GL_R16F,
.format = GL_RED,
.type = GL_HALF_FLOAT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
},
.to_float = a16_float_to_float,
.from_float = a16_float_from_float,
},
[GDK_MEMORY_A32_FLOAT] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
4,
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ GL_R32F, GL_RED, GL_FLOAT, { GL_RED, GL_RED, GL_RED, GL_RED } },
a32_float_to_float,
a32_float_from_float,
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
.bytes_per_pixel = 4,
.alignment = G_ALIGNOF (float),
.depth = GDK_MEMORY_FLOAT32,
.gl = {
.internal_format = GL_R32F,
.format = GL_RED,
.type = GL_FLOAT,
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
},
.to_float = a32_float_to_float,
.from_float = a32_float_from_float,
}
};