mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-30 16:10:53 +00:00
743a732bd7
I'm not at all sure what I was thinking when I designed it, but I certainly designed it wrong (to the point of being fairly useless). It turns out memory requirements are already aligned in size (so just multiplying is fine), and what I really wanted was to get the next offset aligned to the given requirements.
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
#ifndef __QF_Vulkan_buffer_h
|
|
#define __QF_Vulkan_buffer_h
|
|
|
|
#include "QF/darray.h"
|
|
|
|
typedef struct qfv_buffertransition_s {
|
|
VkBuffer buffer;
|
|
VkAccessFlags srcAccess;
|
|
VkAccessFlags dstAccess;
|
|
uint32_t srcQueueFamily;
|
|
uint32_t dstQueueFamily;
|
|
VkDeviceSize offset;
|
|
VkDeviceSize size;
|
|
} qfv_buffertransition_t;
|
|
|
|
typedef struct qfv_buffertransitionset_s
|
|
DARRAY_TYPE (qfv_buffertransition_t) qfv_buffertransitionset_t;
|
|
typedef struct qfv_bufferbarrierset_s
|
|
DARRAY_TYPE (VkBufferMemoryBarrier) qfv_bufferbarrierset_t;
|
|
|
|
typedef struct qfv_bufferset_s
|
|
DARRAY_TYPE (VkBuffer) qfv_bufferset_t;
|
|
#define QFV_AllocBufferSet(num, allocator) \
|
|
DARRAY_ALLOCFIXED (qfv_bufferset_t, num, allocator)
|
|
|
|
struct qfv_device_s;
|
|
VkBuffer QFV_CreateBuffer (struct qfv_device_s *device,
|
|
VkDeviceSize size,
|
|
VkBufferUsageFlags usage);
|
|
|
|
VkDeviceMemory QFV_AllocBufferMemory (struct qfv_device_s *device,
|
|
VkBuffer buffer,
|
|
VkMemoryPropertyFlags properties,
|
|
VkDeviceSize size, VkDeviceSize offset);
|
|
|
|
int QFV_BindBufferMemory (struct qfv_device_s *device,
|
|
VkBuffer buffer, VkDeviceMemory object,
|
|
VkDeviceSize offset);
|
|
|
|
qfv_bufferbarrierset_t *
|
|
QFV_CreateBufferTransitions (qfv_buffertransition_t *transitions,
|
|
int numTransitions);
|
|
|
|
VkBufferView QFV_CreateBufferView (struct qfv_device_s *device,
|
|
VkBuffer buffer, VkFormat format,
|
|
VkDeviceSize offset, VkDeviceSize size);
|
|
|
|
VkDeviceSize QFV_NextOffset (VkDeviceSize current,
|
|
const VkMemoryRequirements *requirements)
|
|
__attribute__((pure));
|
|
|
|
#endif//__QF_Vulkan_buffer_h
|