gstvulkan: Constify code in create_shader

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1226>
This commit is contained in:
Martin Reboredo 2021-10-21 23:35:41 -03:00
parent e3bb858239
commit 944623c3aa
2 changed files with 5 additions and 5 deletions

View File

@ -497,8 +497,8 @@ gst_vulkan_get_or_create_image_view (GstVulkanImageMemory * image)
* Since: 1.18 * Since: 1.18
*/ */
GstVulkanHandle * GstVulkanHandle *
gst_vulkan_create_shader (GstVulkanDevice * device, gchar * code, gsize size, gst_vulkan_create_shader (GstVulkanDevice * device, const gchar * code,
GError ** error) gsize size, GError ** error)
{ {
VkShaderModule shader; VkShaderModule shader;
VkResult res; VkResult res;
@ -509,7 +509,7 @@ gst_vulkan_create_shader (GstVulkanDevice * device, gchar * code, gsize size,
.pNext = NULL, .pNext = NULL,
.flags = 0, .flags = 0,
.codeSize = size, .codeSize = size,
.pCode = (guint32 *) code .pCode = (const guint32 *) code
}; };
/* *INDENT-ON* */ /* *INDENT-ON* */
guint32 first_word; guint32 first_word;
@ -523,7 +523,7 @@ gst_vulkan_create_shader (GstVulkanDevice * device, gchar * code, gsize size,
|| first_word == SPIRV_MAGIC_NUMBER_OE, VK_NULL_HANDLE); || first_word == SPIRV_MAGIC_NUMBER_OE, VK_NULL_HANDLE);
if (first_word == SPIRV_MAGIC_NUMBER_OE) { if (first_word == SPIRV_MAGIC_NUMBER_OE) {
/* endianness swap... */ /* endianness swap... */
guint32 *old_code = (guint32 *) code; const guint32 *old_code = (const guint32 *) code;
gsize i; gsize i;
GST_DEBUG ("performaing endianness conversion on spirv shader of size %" GST_DEBUG ("performaing endianness conversion on spirv shader of size %"

View File

@ -57,7 +57,7 @@ GstVulkanImageView * gst_vulkan_get_or_create_image_view (GstVulkanImageM
GST_VULKAN_API GST_VULKAN_API
GstVulkanHandle * gst_vulkan_create_shader (GstVulkanDevice * device, GstVulkanHandle * gst_vulkan_create_shader (GstVulkanDevice * device,
gchar * code, const gchar * code,
gsize size, gsize size,
GError ** error); GError ** error);