Add gpuFlushBuffer
This commit is contained in:
1 parent
6c6dd5626c
commit
f308900207
2 files changed
+15
No files matched your search
@@ -354,6 +354,13 @@ typedef struct GpuBufferCreateRequest {
|
|||||||
GpuBufferUsage usage;
|
GpuBufferUsage usage;
|
||||||
} GpuBufferCreateRequest;
|
} GpuBufferCreateRequest;
|
||||||
|
|
||||||
|
typedef struct GpuBufferFlushRequest {
|
||||||
|
GpuDevice *device;
|
||||||
|
GpuBuffer buffer;
|
||||||
|
u64 offset;
|
||||||
|
u64 size;
|
||||||
|
} GpuBufferFlushRequest;
|
||||||
|
|
||||||
typedef struct GpuFence GpuFence;
|
typedef struct GpuFence GpuFence;
|
||||||
typedef GpuFence **GpuFencePtrArray;
|
typedef GpuFence **GpuFencePtrArray;
|
||||||
|
|
||||||
@@ -1192,6 +1199,7 @@ GpuImage *gpuLoadImageFromFile(const WpAllocator *allocator
|
|||||||
ivec3s gpuGetImageSize(GpuImage *image);
|
ivec3s gpuGetImageSize(GpuImage *image);
|
||||||
GpuBuffer gpuCreateBuffer(const WpAllocator *allocator, GpuBufferCreateRequest request);
|
GpuBuffer gpuCreateBuffer(const WpAllocator *allocator, GpuBufferCreateRequest request);
|
||||||
void gpuDestroyBuffer(GpuBuffer *buffer);
|
void gpuDestroyBuffer(GpuBuffer *buffer);
|
||||||
|
void gpuFlushBuffer(GpuBufferFlushRequest request);
|
||||||
GpuFence *gpuCreateFence(const WpAllocator *allocator, GpuDevice *device);
|
GpuFence *gpuCreateFence(const WpAllocator *allocator, GpuDevice *device);
|
||||||
void gpuDestroyFence(GpuFence *fence);
|
void gpuDestroyFence(GpuFence *fence);
|
||||||
void gpuResetFences(const WpAllocator *temp, GpuResetFencesRequest request);
|
void gpuResetFences(const WpAllocator *temp, GpuResetFencesRequest request);
|
||||||
|
|||||||
@@ -1037,6 +1037,13 @@ void gpuDestroyBuffer(GpuBuffer *buffer) {
|
|||||||
buffer->size = 0;
|
buffer->size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gpuFlushBuffer(GpuBufferFlushRequest request) {
|
||||||
|
u64 size = request.size > 0 ? request.size : VK_WHOLE_SIZE;
|
||||||
|
VkResult vk_result = vmaFlushAllocation(request.device->allocator, request.buffer.internal->allocation,
|
||||||
|
request.offset, size);
|
||||||
|
assertWithLogger(vk_result == VK_SUCCESS, &logger, "Failed to flush buffer");
|
||||||
|
}
|
||||||
|
|
||||||
GpuFence *gpuCreateFence(const WpAllocator *allocator, GpuDevice *device) {
|
GpuFence *gpuCreateFence(const WpAllocator *allocator, GpuDevice *device) {
|
||||||
GpuFence *fence = wpMemAllocatorAlloc(allocator, sizeof(GpuFence));
|
GpuFence *fence = wpMemAllocatorAlloc(allocator, sizeof(GpuFence));
|
||||||
assertWithLogger(fence != NULL, &logger, "Failed to allocate fence internal");
|
assertWithLogger(fence != NULL, &logger, "Failed to allocate fence internal");
|
||||||
|
|||||||
Reference in new issue
Block a user