mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 05:56:31 +00:00
vk*memory: explicitly error out for driver NPOT alignment
This commit is contained in:
parent
0526310a95
commit
268dfcaad9
3 changed files with 17 additions and 2 deletions
|
@ -133,7 +133,12 @@ _vk_buffer_mem_new_alloc (GstAllocator * allocator, GstMemory * parent,
|
|||
mem = g_new0 (GstVulkanBufferMemory, 1);
|
||||
vkGetBufferMemoryRequirements (device->device, buffer, &mem->requirements);
|
||||
|
||||
/* XXX: assumes alignment is a power of 2 */
|
||||
if ((mem->requirements.alignment & (mem->requirements.alignment - 1)) != 0) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
"Vulkan implementation requires unsupported non-power-of 2 memory alignment");
|
||||
goto error;
|
||||
}
|
||||
|
||||
params.align = mem->requirements.alignment - 1;
|
||||
_vk_buffer_mem_init (mem, allocator, parent, device, usage, ¶ms,
|
||||
mem->requirements.size, user_data, notify);
|
||||
|
|
|
@ -29,6 +29,12 @@ G_BEGIN_DECLS
|
|||
#define GST_VULKAN_ERROR (gst_vulkan_error_quark ())
|
||||
GQuark gst_vulkan_error_quark (void);
|
||||
|
||||
/* custom error values */
|
||||
typedef enum
|
||||
{
|
||||
GST_VULKAN_FAILED = 0,
|
||||
} GstVulkanError;
|
||||
|
||||
/* only fills error iff error != NULL and result < 0 */
|
||||
VkResult gst_vulkan_error_to_g_error (VkResult result, GError ** error, const char * format, ...) G_GNUC_PRINTF (3, 4);
|
||||
|
||||
|
|
|
@ -222,7 +222,11 @@ _vk_image_mem_new_alloc (GstAllocator * allocator, GstMemory * parent,
|
|||
mem->requirements.memoryTypeBits, mem_prop_flags, &type_idx))
|
||||
goto error;
|
||||
|
||||
/* XXX: assumes alignment is a power of 2 */
|
||||
if ((mem->requirements.alignment & (mem->requirements.alignment - 1)) != 0) {
|
||||
g_set_error_literal (&error, GST_VULKAN_ERROR, GST_VULKAN_FAILED,
|
||||
"Vulkan implementation requires unsupported non-power-of 2 memory alignment");
|
||||
goto error;
|
||||
}
|
||||
params.align = mem->requirements.alignment - 1;
|
||||
mem->vk_mem = (GstVulkanMemory *) gst_vulkan_memory_alloc (device, type_idx,
|
||||
¶ms, mem->requirements.size, mem_prop_flags);
|
||||
|
|
Loading…
Reference in a new issue