gdk: Add GDK_N_DEPTHS to the enum

We are indexing arrays by the number of depths, and when adding depths
we don't want to forget to grow those arrays.
This commit is contained in:
Benjamin Otte 2024-06-26 20:01:13 +02:00
parent a35f9102f2
commit 33d87bc22e
4 changed files with 8 additions and 2 deletions

View File

@ -1479,6 +1479,7 @@ gdk_memory_depth_merge (GdkMemoryDepth depth1,
else
return GDK_MEMORY_FLOAT32;
case GDK_N_DEPTHS:
default:
g_assert_not_reached ();
return GDK_MEMORY_U8;
@ -1507,6 +1508,7 @@ gdk_memory_depth_get_format (GdkMemoryDepth depth)
return GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED;
case GDK_MEMORY_FLOAT32:
return GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
case GDK_N_DEPTHS:
default:
g_return_val_if_reached (GDK_MEMORY_R8G8B8A8_PREMULTIPLIED);
}
@ -1534,6 +1536,7 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
return GDK_MEMORY_A16_FLOAT;
case GDK_MEMORY_FLOAT32:
return GDK_MEMORY_A32_FLOAT;
case GDK_N_DEPTHS:
default:
g_return_val_if_reached (GDK_MEMORY_A8);
}

View File

@ -40,7 +40,9 @@ typedef enum {
GDK_MEMORY_U8,
GDK_MEMORY_U16,
GDK_MEMORY_FLOAT16,
GDK_MEMORY_FLOAT32
GDK_MEMORY_FLOAT32,
GDK_N_DEPTHS
} GdkMemoryDepth;
gsize gdk_memory_format_alignment (GdkMemoryFormat format) G_GNUC_CONST;

View File

@ -72,7 +72,7 @@ struct _GdkVulkanContextPrivate {
struct {
VkSurfaceFormatKHR vk_format;
GdkMemoryFormat gdk_format;
} formats[4];
} formats[GDK_N_DEPTHS];
GdkMemoryDepth current_depth;
VkSwapchainKHR swapchain;

View File

@ -3614,6 +3614,7 @@ append_texture_param (Printer *p,
g_string_append (p->str, "url(\"data:image/tiff;base64,\\\n");
break;
case GDK_N_DEPTHS:
default:
g_assert_not_reached ();
}