2023-08-31 00:19:12 +02:00
|
|
|
/* Spa */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
|
|
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
|
|
2019-08-19 16:32:22 +02:00
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
|
|
|
|
|
#include <spa/buffer/buffer.h>
|
2022-05-30 18:34:31 +02:00
|
|
|
#include <spa/node/node.h>
|
2019-08-19 16:32:22 +02:00
|
|
|
|
2023-08-27 00:24:04 +02:00
|
|
|
#include "vulkan-types.h"
|
|
|
|
|
|
|
|
|
|
#define VK_CHECK_RESULT(f) \
|
|
|
|
|
{ \
|
|
|
|
|
VkResult _result = (f); \
|
|
|
|
|
int _r = -vulkan_vkresult_to_errno(_result); \
|
|
|
|
|
if (_result != VK_SUCCESS) { \
|
|
|
|
|
spa_log_error(s->log, "error: %d (%d %s)", _result, _r, spa_strerror(_r)); \
|
|
|
|
|
return _r; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2023-08-11 22:59:22 +02:00
|
|
|
#define VK_CHECK_RESULT_LOOP(f) \
|
|
|
|
|
{ \
|
|
|
|
|
VkResult _result = (f); \
|
|
|
|
|
int _r = -vkresult_to_errno(_result); \
|
|
|
|
|
if (_result != VK_SUCCESS) { \
|
|
|
|
|
spa_log_error(s->log, "error: %d (%d %s)", _result, _r, spa_strerror(_r)); \
|
|
|
|
|
continue; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2023-08-27 00:24:04 +02:00
|
|
|
#define CHECK(f) \
|
|
|
|
|
{ \
|
|
|
|
|
int _res = (f); \
|
|
|
|
|
if (_res < 0) \
|
|
|
|
|
return _res; \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int vulkan_commandPool_create(struct vulkan_base *s, VkCommandPool *commandPool);
|
|
|
|
|
int vulkan_commandBuffer_create(struct vulkan_base *s, VkCommandPool commandPool, VkCommandBuffer *commandBuffer);
|
|
|
|
|
|
|
|
|
|
uint32_t vulkan_memoryType_find(struct vulkan_base *s,
|
|
|
|
|
uint32_t memoryTypeBits, VkMemoryPropertyFlags properties);
|
2023-08-11 22:59:22 +02:00
|
|
|
struct vulkan_format_info *vulkan_formatInfo_find(struct vulkan_base *s, VkFormat format);
|
|
|
|
|
struct vulkan_modifier_info *vulkan_modifierInfo_find(struct vulkan_base *s, VkFormat format, uint64_t modifier);
|
2023-08-27 00:24:04 +02:00
|
|
|
|
|
|
|
|
void vulkan_buffer_clear(struct vulkan_base *s, struct vulkan_buffer *buffer);
|
|
|
|
|
|
|
|
|
|
int vulkan_stream_init(struct vulkan_stream *stream, enum spa_direction direction,
|
2022-05-30 18:34:31 +02:00
|
|
|
struct spa_dict *props);
|
|
|
|
|
|
2023-02-21 16:29:17 +01:00
|
|
|
uint32_t vulkan_vkformat_to_id(VkFormat vkFormat);
|
|
|
|
|
VkFormat vulkan_id_to_vkformat(uint32_t id);
|
|
|
|
|
|
2023-08-27 00:24:04 +02:00
|
|
|
int vulkan_vkresult_to_errno(VkResult result);
|
2019-08-19 16:32:22 +02:00
|
|
|
|
2023-08-13 19:01:19 +02:00
|
|
|
int vulkan_wait_fence(struct vulkan_base *s, VkFence fence);
|
|
|
|
|
int vulkan_wait_idle(struct vulkan_base *s);
|
|
|
|
|
|
2023-08-27 00:24:04 +02:00
|
|
|
int vulkan_base_init(struct vulkan_base *s, struct vulkan_base_info *info);
|
|
|
|
|
void vulkan_base_deinit(struct vulkan_base *s);
|