vulkan: Add a static assert
authorBenjamin Otte <otte@redhat.com>
Wed, 10 May 2023 15:55:56 +0000 (17:55 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 4 Jun 2023 17:42:01 +0000 (19:42 +0200)
We don't want to make the push constants larger than what the spec
guarantees. And that is 128 bytes, see value for
maxPushConstantsSize in table 55 of
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-minmax

gsk/vulkan/gskvulkanpushconstants.c

index 36ba9852a611945b3aadcb672cbbe9e3c322f4a0..0bf5ca71b04b98edbecd90a81b101f02dce4e134 100644 (file)
@@ -15,6 +15,12 @@ struct _GskVulkanPushConstantsWire
   } common;
 };
 
+/* This is the value we know every conformant GPU must provide.
+ * See value for maxPushConstantsSize in table 55 of
+ * https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-minmax
+ */
+G_STATIC_ASSERT (sizeof (GskVulkanPushConstantsWire) <= 128);
+
 void
 gsk_vulkan_push_constants_init (GskVulkanPushConstants  *constants,
                                 const graphene_matrix_t *mvp,