vulkan: use VK_NULL_HANDLE in more places

Fixes compiler warnings on 32-bit platforms assigning a void * to a
64-bit integer value.
This commit is contained in:
Matthew Waters 2019-10-16 17:42:33 +11:00 committed by GStreamer Merge Bot
parent 116549b561
commit 7a1bb3001a
7 changed files with 75 additions and 75 deletions

View file

@ -1382,7 +1382,7 @@ _create_sampler (GstVulkanColorConvert * conv)
if (gst_vulkan_error_to_g_error (err, &error, "vkCreateSampler") < 0) {
GST_ERROR_OBJECT (conv, "Failed to create sampler: %s", error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return sampler;
@ -1437,7 +1437,7 @@ _create_descriptor_pool (GstVulkanColorConvert * conv)
GST_ERROR_OBJECT (render, "Failed to create descriptor pool: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return pool;
@ -1468,7 +1468,7 @@ _create_descriptor_set (GstVulkanColorConvert * conv)
GST_ERROR_OBJECT (conv, "Failed to allocate descriptor: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return descriptor;
@ -1536,8 +1536,8 @@ gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), conv->descriptor_pool));
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->uniform)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
@ -1547,8 +1547,8 @@ gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
if (conv->descriptor_pool)
vkDestroyDescriptorPool (render->device->device,
conv->descriptor_pool, NULL);
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->uniform)
gst_memory_unref (conv->uniform);
conv->uniform = NULL;
@ -1583,30 +1583,30 @@ gst_vulkan_color_convert_stop (GstBaseTransform * bt)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), conv->descriptor_pool));
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->sampler)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
(render->last_fence), conv->sampler));
conv->sampler = NULL;
conv->sampler = VK_NULL_HANDLE;
if (conv->uniform)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
(render->last_fence), (GstMiniObject *) conv->uniform));
conv->uniform = NULL;
conv->uniform = VK_NULL_HANDLE;
} else {
if (conv->descriptor_pool)
vkDestroyDescriptorPool (render->device->device,
conv->descriptor_pool, NULL);
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->sampler)
vkDestroySampler (render->device->device, conv->sampler, NULL);
conv->sampler = NULL;
conv->sampler = VK_NULL_HANDLE;
if (conv->uniform)
gst_memory_unref (conv->uniform);
conv->uniform = NULL;
conv->uniform = VK_NULL_HANDLE;
}
}
@ -1646,7 +1646,7 @@ _create_framebuffer (GstVulkanColorConvert * conv, guint n_views,
GST_ERROR_OBJECT (render, "Failed to create framebuffer: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return framebuffer;

View file

@ -419,7 +419,7 @@ _create_pipeline (GstVulkanFullScreenRender * render)
GST_ERROR_OBJECT (render, "Failed to create pipeline layout: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return pipeline;
@ -459,7 +459,7 @@ _create_pipeline_layout (GstVulkanFullScreenRender * render)
GST_ERROR_OBJECT (render, "Failed to create pipeline layout: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return pipeline_layout;
@ -496,7 +496,7 @@ _create_render_pass (GstVulkanFullScreenRender * render)
.pSubpasses = &subpass
};
/* *INDENT-ON* */
VkRenderPass render_pass = NULL;
VkRenderPass render_pass = VK_NULL_HANDLE;
VkResult err;
GError *error = NULL;
@ -508,7 +508,7 @@ _create_render_pass (GstVulkanFullScreenRender * render)
if (gst_vulkan_error_to_g_error (err, &error, "vkCreateRenderPass") < 0) {
GST_ERROR_OBJECT (render, "Failed to create renderpass: %s",
error->message);
return NULL;
return VK_NULL_HANDLE;
}
return render_pass;
@ -543,7 +543,7 @@ _create_descriptor_set_layout (GstVulkanFullScreenRender * render)
"vkCreateDescriptorSetLayout") < 0) {
GST_ERROR_OBJECT (render, "Failed to create renderpass: %s",
error->message);
return NULL;
return VK_NULL_HANDLE;
}
return descriptor_set_layout;
@ -568,45 +568,45 @@ gst_vulkan_full_screen_render_set_caps (GstBaseTransform * bt,
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_set_layout (gst_vulkan_fence_ref
(render->last_fence), render->descriptor_set_layout));
render->descriptor_set_layout = NULL;
render->descriptor_set_layout = VK_NULL_HANDLE;
}
if (render->pipeline_layout) {
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_pipeline_layout (gst_vulkan_fence_ref
(render->last_fence), render->pipeline_layout));
render->pipeline_layout = NULL;
render->pipeline_layout = VK_NULL_HANDLE;
}
if (render->render_pass) {
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_render_pass (gst_vulkan_fence_ref
(render->last_fence), render->render_pass));
render->render_pass = NULL;
render->render_pass = VK_NULL_HANDLE;
}
if (render->graphics_pipeline) {
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_pipeline (gst_vulkan_fence_ref
(render->last_fence), render->graphics_pipeline));
render->graphics_pipeline = NULL;
render->graphics_pipeline = VK_NULL_HANDLE;
}
} else {
if (render->graphics_pipeline)
vkDestroyPipeline (render->device->device,
render->graphics_pipeline, NULL);
render->graphics_pipeline = NULL;
render->graphics_pipeline = VK_NULL_HANDLE;
if (render->pipeline_layout)
vkDestroyPipelineLayout (render->device->device,
render->pipeline_layout, NULL);
render->pipeline_layout = NULL;
render->pipeline_layout = VK_NULL_HANDLE;
if (render->render_pass)
vkDestroyRenderPass (render->device->device, render->render_pass, NULL);
render->render_pass = NULL;
render->render_pass = VK_NULL_HANDLE;
if (render->descriptor_set_layout)
vkDestroyDescriptorSetLayout (render->device->device,
render->descriptor_set_layout, NULL);
render->descriptor_set_layout = NULL;
render->descriptor_set_layout = VK_NULL_HANDLE;
}
if (!(render->descriptor_set_layout = _create_descriptor_set_layout (render)))
@ -771,37 +771,37 @@ gst_vulkan_full_screen_render_stop (GstBaseTransform * bt)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_pipeline (gst_vulkan_fence_ref
(render->last_fence), render->graphics_pipeline));
render->graphics_pipeline = NULL;
render->graphics_pipeline = VK_NULL_HANDLE;
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_pipeline_layout (gst_vulkan_fence_ref
(render->last_fence), render->pipeline_layout));
render->pipeline_layout = NULL;
render->pipeline_layout = VK_NULL_HANDLE;
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_render_pass (gst_vulkan_fence_ref
(render->last_fence), render->render_pass));
render->render_pass = NULL;
render->render_pass = VK_NULL_HANDLE;
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_set_layout (gst_vulkan_fence_ref
(render->last_fence), render->descriptor_set_layout));
render->descriptor_set_layout = NULL;
render->descriptor_set_layout = VK_NULL_HANDLE;
gst_vulkan_fence_unref (render->last_fence);
render->last_fence = NULL;
} else {
vkDestroyPipeline (render->device->device,
render->graphics_pipeline, NULL);
render->graphics_pipeline = NULL;
render->graphics_pipeline = VK_NULL_HANDLE;
vkDestroyPipelineLayout (render->device->device,
render->pipeline_layout, NULL);
render->pipeline_layout = NULL;
render->pipeline_layout = VK_NULL_HANDLE;
vkDestroyRenderPass (render->device->device, render->render_pass, NULL);
render->render_pass = NULL;
render->render_pass = VK_NULL_HANDLE;
vkDestroyDescriptorSetLayout (render->device->device,
render->descriptor_set_layout, NULL);
render->descriptor_set_layout = NULL;
render->descriptor_set_layout = VK_NULL_HANDLE;
}
if (!gst_vulkan_trash_list_wait (render->trash_list, -1))

View file

@ -306,7 +306,7 @@ _create_descriptor_pool (GstVulkanImageIdentity * vk_identity)
GST_ERROR_OBJECT (render, "Failed to create descriptor pool: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return pool;
@ -338,7 +338,7 @@ _create_descriptor_set (GstVulkanImageIdentity * vk_identity)
GST_ERROR_OBJECT (vk_identity, "Failed to allocate descriptor: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return descriptor;
@ -359,13 +359,13 @@ gst_vulkan_image_identity_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), vk_identity->descriptor_pool));
vk_identity->descriptor_set = NULL;
vk_identity->descriptor_pool = NULL;
vk_identity->descriptor_set = VK_NULL_HANDLE;
vk_identity->descriptor_pool = VK_NULL_HANDLE;
} else {
vkDestroyDescriptorPool (render->device->device,
vk_identity->descriptor_pool, NULL);
vk_identity->descriptor_set = NULL;
vk_identity->descriptor_pool = NULL;
vk_identity->descriptor_set = VK_NULL_HANDLE;
vk_identity->descriptor_pool = VK_NULL_HANDLE;
}
if (!(vk_identity->descriptor_pool = _create_descriptor_pool (vk_identity)))
@ -411,7 +411,7 @@ _create_sampler (GstVulkanImageIdentity * vk_identity)
GST_ERROR_OBJECT (vk_identity, "Failed to create sampler: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return sampler;
@ -442,25 +442,25 @@ gst_vulkan_image_identity_stop (GstBaseTransform * bt)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), vk_identity->descriptor_pool));
vk_identity->descriptor_set = NULL;
vk_identity->descriptor_pool = NULL;
vk_identity->descriptor_set = VK_NULL_HANDLE;
vk_identity->descriptor_pool = VK_NULL_HANDLE;
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
(render->last_fence), vk_identity->sampler));
vk_identity->sampler = NULL;
vk_identity->sampler = VK_NULL_HANDLE;
} else {
vkDestroyDescriptorPool (render->device->device,
vk_identity->descriptor_pool, NULL);
vk_identity->descriptor_set = NULL;
vk_identity->descriptor_pool = NULL;
vk_identity->descriptor_set = VK_NULL_HANDLE;
vk_identity->descriptor_pool = VK_NULL_HANDLE;
vkDestroySampler (render->device->device, vk_identity->sampler, NULL);
vk_identity->sampler = NULL;
vk_identity->sampler = VK_NULL_HANDLE;
}
}
if (vk_identity->cmd_pool)
gst_object_unref (vk_identity->cmd_pool);
vk_identity->cmd_pool = NULL;
vk_identity->cmd_pool = VK_NULL_HANDLE;
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (bt);
}
@ -524,7 +524,7 @@ _create_framebuffer (GstVulkanImageIdentity * vk_identity, VkImageView view)
GST_ERROR_OBJECT (render, "Failed to create framebuffer: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return framebuffer;

View file

@ -46,12 +46,12 @@ _vk_create_shader (GstVulkanDevice * device, gchar * code, gsize size,
guint32 first_word;
guint32 *new_code = NULL;
g_return_val_if_fail (size >= 4, NULL);
g_return_val_if_fail (size % 4 == 0, NULL);
g_return_val_if_fail (size >= 4, VK_NULL_HANDLE);
g_return_val_if_fail (size % 4 == 0, VK_NULL_HANDLE);
first_word = ((guint32 *) code)[0];
g_return_val_if_fail (first_word == SPIRV_MAGIC_NUMBER_NE
|| first_word == SPIRV_MAGIC_NUMBER_OE, NULL);
|| first_word == SPIRV_MAGIC_NUMBER_OE, VK_NULL_HANDLE);
if (first_word == SPIRV_MAGIC_NUMBER_OE) {
/* endianness swap... */
guint32 *old_code = (guint32 *) code;
@ -81,7 +81,7 @@ _vk_create_shader (GstVulkanDevice * device, gchar * code, gsize size,
res = vkCreateShaderModule (device->device, &info, NULL, &ret);
g_free (new_code);
if (gst_vulkan_error_to_g_error (res, error, "VkCreateShaderModule") < 0)
return NULL;
return VK_NULL_HANDLE;
g_free (new_code);

View file

@ -1992,7 +1992,7 @@ _create_sampler (GstVulkanViewConvert * conv)
err = vkCreateSampler (render->device->device, &samplerInfo, NULL, &sampler);
if (gst_vulkan_error_to_g_error (err, &error, "vkCreateSampler") < 0) {
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return sampler;
@ -2047,7 +2047,7 @@ _create_descriptor_pool (GstVulkanViewConvert * conv)
GST_ERROR_OBJECT (render, "Failed to create descriptor pool: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return pool;
@ -2078,7 +2078,7 @@ _create_descriptor_set (GstVulkanViewConvert * conv)
GST_ERROR_OBJECT (conv, "Failed to allocate descriptor: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return descriptor;
@ -2111,8 +2111,8 @@ gst_vulkan_view_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), conv->descriptor_pool));
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->uniform)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
@ -2122,8 +2122,8 @@ gst_vulkan_view_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
if (conv->descriptor_pool)
vkDestroyDescriptorPool (render->device->device,
conv->descriptor_pool, NULL);
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->uniform)
gst_memory_unref (conv->uniform);
conv->uniform = NULL;
@ -2158,13 +2158,13 @@ gst_vulkan_view_convert_stop (GstBaseTransform * bt)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_descriptor_pool (gst_vulkan_fence_ref
(render->last_fence), conv->descriptor_pool));
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->sampler)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
(render->last_fence), conv->sampler));
conv->sampler = NULL;
conv->sampler = VK_NULL_HANDLE;
if (conv->uniform)
gst_vulkan_trash_list_add (render->trash_list,
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
@ -2174,14 +2174,14 @@ gst_vulkan_view_convert_stop (GstBaseTransform * bt)
if (conv->descriptor_pool)
vkDestroyDescriptorPool (render->device->device,
conv->descriptor_pool, NULL);
conv->descriptor_set = NULL;
conv->descriptor_pool = NULL;
conv->descriptor_set = VK_NULL_HANDLE;
conv->descriptor_pool = VK_NULL_HANDLE;
if (conv->sampler)
vkDestroySampler (render->device->device, conv->sampler, NULL);
conv->sampler = NULL;
conv->sampler = VK_NULL_HANDLE;
if (conv->uniform)
gst_memory_unref (conv->uniform);
conv->uniform = NULL;
conv->uniform = VK_NULL_HANDLE;
}
}
@ -2221,7 +2221,7 @@ _create_framebuffer (GstVulkanViewConvert * conv, guint n_views,
GST_ERROR_OBJECT (render, "Failed to create framebuffer: %s",
error->message);
g_clear_error (&error);
return NULL;
return VK_NULL_HANDLE;
}
return framebuffer;

View file

@ -1202,7 +1202,7 @@ reacquire:
GST_DEBUG_OBJECT (swapper, "out of date frame acquired");
vkDestroySemaphore (swapper->device->device, acquire_semaphore, NULL);
acquire_semaphore = NULL;
acquire_semaphore = VK_NULL_HANDLE;
if (!_swapchain_resize (swapper, error))
goto error;
goto reacquire;
@ -1252,7 +1252,7 @@ reacquire:
GST_MINI_OBJECT_CAST (cmd_buf)));
gst_vulkan_trash_list_add (swapper->priv->trash_list,
gst_vulkan_trash_new_free_semaphore (fence, acquire_semaphore));
acquire_semaphore = NULL;
acquire_semaphore = VK_NULL_HANDLE;
gst_vulkan_command_buffer_unlock (cmd_buf);
cmd_buf = NULL;

View file

@ -101,7 +101,7 @@ G_PASTE(gst_vulkan_trash_new_free_,type_name) (GstVulkanFence * fence, \
type type_name) \
{ \
GstVulkanTrash *trash; \
g_return_val_if_fail (type_name != NULL, NULL); \
g_return_val_if_fail (type_name != VK_NULL_HANDLE, NULL); \
trash = gst_vulkan_trash_new (fence, \
(GstVulkanTrashNotify) G_PASTE(_free_,type_name), type_name); \
return trash; \
@ -135,7 +135,7 @@ G_PASTE(gst_vulkan_trash_new_free_,type_name) (GstVulkanFence * fence, \
{ \
struct G_PASTE(free_parent_info_,type_name) *info; \
GstVulkanTrash *trash; \
g_return_val_if_fail (type_name != NULL, NULL); \
g_return_val_if_fail (type_name != VK_NULL_HANDLE, NULL); \
info = g_new0 (struct G_PASTE(free_parent_info_,type_name), 1); \
/* FIXME: keep parent alive ? */\
info->parent = parent; \