Fix leaky abstractions
This commit is contained in:
+40
-37
@@ -33,15 +33,14 @@ extern "C" {
|
||||
// Instance
|
||||
// ======================================================================
|
||||
|
||||
PrRhiInstance *prRhiCreateInstance(PrRhiInstanceDesc desc, WpAllocator *alloc);
|
||||
void prRhiDestroyInstance(PrRhiInstance *inst, WpAllocator *alloc);
|
||||
void *prRhiGetNativeInstanceHandle(PrRhiInstance *inst);
|
||||
PrRhiInstance *prRhiCreateInstance(PrRhiInstanceDesc desc, WpAllocator *allocator);
|
||||
void prRhiDestroyInstance(PrRhiInstance *inst, WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Physical device enumeration
|
||||
// ======================================================================
|
||||
|
||||
PrRhiPhysicalDeviceArray prRhiGetPhysicalDevices(PrRhiInstance *inst, const WpAllocator *scratch);
|
||||
PrRhiPhysicalDeviceArray prRhiGetPhysicalDevices(PrRhiInstance *inst, const WpAllocator *allocator);
|
||||
void prRhiGetPhysicalDeviceName(PrRhiPhysicalDevice *pdev, WpStr8 *out);
|
||||
void prRhiGetPhysicalDeviceDriverInfo(PrRhiPhysicalDevice *pdev, WpStr8 *out);
|
||||
void prRhiGetPhysicalDeviceProperties(PrRhiPhysicalDevice *pdev,
|
||||
@@ -51,8 +50,9 @@ void prRhiGetPhysicalDeviceProperties(PrRhiPhysicalDevice *p
|
||||
// Surface (platform-specific)
|
||||
// ======================================================================
|
||||
|
||||
PrRhiSurface *prRhiCreateSurface(PrRhiInstance *inst, void *window_handle, WpAllocator *alloc);
|
||||
void prRhiDestroySurface(PrRhiInstance *inst, PrRhiSurface *surface, WpAllocator *alloc);
|
||||
PrRhiSurface *prRhiCreateSurfaceFromWindow(PrRhiInstance *inst, void *window_handle,
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroySurface(PrRhiInstance *inst, PrRhiSurface *surface, WpAllocator *allocator);
|
||||
PrRhiSurfaceCapabilities prRhiGetSurfaceCapabilities(PrRhiPhysicalDevice *pdev,
|
||||
PrRhiSurface *surface);
|
||||
|
||||
@@ -61,8 +61,8 @@ PrRhiSurfaceCapabilities prRhiGetSurfaceCapabilities(PrRhiPhysicalDevice *pdev,
|
||||
// ======================================================================
|
||||
|
||||
PrRhiDevice *prRhiCreateDevice(PrRhiPhysicalDevice *pdev, PrRhiSurface *surface,
|
||||
PrRhiDeviceDesc desc, WpAllocator *alloc);
|
||||
void prRhiDestroyDevice(PrRhiDevice *device, WpAllocator *alloc);
|
||||
PrRhiDeviceDesc desc, WpAllocator *allocator);
|
||||
void prRhiDestroyDevice(PrRhiDevice *device, WpAllocator *allocator);
|
||||
void prRhiDeviceWaitIdle(PrRhiDevice *device);
|
||||
u32 prRhiGetQueueFamilyIndex(PrRhiDevice *device);
|
||||
|
||||
@@ -71,9 +71,9 @@ u32 prRhiGetQueueFamilyIndex(PrRhiDevice *device);
|
||||
// ======================================================================
|
||||
|
||||
PrRhiSwapchain *prRhiCreateSwapchain(PrRhiDevice *device, PrRhiSwapchainDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroySwapchain(PrRhiDevice *device, PrRhiSwapchain *swapchain,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
PrRhiSwapchainResult prRhiAcquireNextImage(PrRhiDevice *device, PrRhiSwapchain *swapchain,
|
||||
PrRhiSemaphore *signal_semaphore, u32 *out_image_index);
|
||||
@@ -82,7 +82,7 @@ PrRhiSwapchainResult prRhiPresent(PrRhiDevice *device, PrRhiSwapchain *swapchain
|
||||
PrRhiSemaphore *wait_semaphore);
|
||||
|
||||
void prRhiRecreateSwapchain(PrRhiDevice *device, PrRhiSwapchain **swapchain,
|
||||
u32 width, u32 height, WpAllocator *alloc);
|
||||
u32 width, u32 height, WpAllocator *allocator);
|
||||
|
||||
PrRhiTexture *prRhiGetSwapchainTexture(PrRhiSwapchain *swapchain, u32 image_index);
|
||||
PrRhiTexture *prRhiGetSwapchainDepthTexture(PrRhiSwapchain *swapchain);
|
||||
@@ -93,8 +93,8 @@ PrRhiFormat prRhiGetSwapchainFormat(PrRhiSwapchain *swapchain);
|
||||
// ======================================================================
|
||||
|
||||
PrRhiBuffer *prRhiCreateBuffer(PrRhiDevice *device, PrRhiBufferDesc desc,
|
||||
WpAllocator *alloc);
|
||||
void prRhiDestroyBuffer(PrRhiDevice *device, PrRhiBuffer *buffer, WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyBuffer(PrRhiDevice *device, PrRhiBuffer *buffer, WpAllocator *allocator);
|
||||
|
||||
void *prRhiBufferMap(PrRhiDevice *device, PrRhiBuffer *buffer);
|
||||
void prRhiBufferUnmap(PrRhiDevice *device, PrRhiBuffer *buffer);
|
||||
@@ -106,26 +106,29 @@ PrRhiDeviceAddress prRhiGetBufferDeviceAddress(PrRhiDevice *device, PrRhiBuffer
|
||||
// ======================================================================
|
||||
|
||||
PrRhiTexture *prRhiCreateTexture(PrRhiDevice *device, PrRhiTextureDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
PrRhiTexture *prRhiCreateTextureFromKtx(PrRhiDevice *device, const char *path,
|
||||
PrRhiCommandPool *pool, PrRhiCommandBuffer *cb,
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyTexture(PrRhiDevice *device, PrRhiTexture *texture,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Samplers
|
||||
// ======================================================================
|
||||
|
||||
PrRhiSampler *prRhiCreateSampler(PrRhiDevice *device, PrRhiSamplerDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroySampler(PrRhiDevice *device, PrRhiSampler *sampler,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Shaders (from SPIR-V)
|
||||
// ======================================================================
|
||||
|
||||
PrRhiShader *prRhiCreateShader(PrRhiDevice *device, PrRhiShaderDesc desc,
|
||||
WpAllocator *alloc);
|
||||
void prRhiDestroyShader(PrRhiDevice *device, PrRhiShader *shader, WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyShader(PrRhiDevice *device, PrRhiShader *shader, WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Pipeline layouts
|
||||
@@ -133,10 +136,10 @@ void prRhiDestroyShader(PrRhiDevice *device, PrRhiShader *shader, WpAllo
|
||||
|
||||
PrRhiPipelineLayout *prRhiCreatePipelineLayout(PrRhiDevice *device,
|
||||
PrRhiPipelineLayoutDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyPipelineLayout(PrRhiDevice *device,
|
||||
PrRhiPipelineLayout *layout,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Pipelines
|
||||
@@ -144,12 +147,12 @@ void prRhiDestroyPipelineLayout(PrRhiDevice *device,
|
||||
|
||||
PrRhiPipeline *prRhiCreateGraphicsPipeline(PrRhiDevice *device,
|
||||
PrRhiGraphicsPipelineDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
PrRhiPipeline *prRhiCreateComputePipeline(PrRhiDevice *device,
|
||||
PrRhiComputePipelineDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyPipeline(PrRhiDevice *device, PrRhiPipeline *pipeline,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Descriptor set layouts
|
||||
@@ -157,10 +160,10 @@ void prRhiDestroyPipeline(PrRhiDevice *device, PrRhiPipeline *pipeline
|
||||
|
||||
PrRhiDescriptorSetLayout *prRhiCreateDescriptorSetLayout(PrRhiDevice *device,
|
||||
PrRhiDescriptorSetLayoutDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyDescriptorSetLayout(PrRhiDevice *device,
|
||||
PrRhiDescriptorSetLayout *layout,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Descriptor pools
|
||||
@@ -168,10 +171,10 @@ void prRhiDestroyDescriptorSetLayout(PrRhiDevice *device,
|
||||
|
||||
PrRhiDescriptorPool *prRhiCreateDescriptorPool(PrRhiDevice *device,
|
||||
PrRhiDescriptorPoolDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyDescriptorPool(PrRhiDevice *device,
|
||||
PrRhiDescriptorPool *pool,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Descriptor sets
|
||||
@@ -179,9 +182,9 @@ void prRhiDestroyDescriptorPool(PrRhiDevice *device,
|
||||
|
||||
PrRhiDescriptorSet *prRhiAllocateDescriptorSet(PrRhiDevice *device, PrRhiDescriptorPool *pool,
|
||||
PrRhiDescriptorSetLayout *layout,
|
||||
u32 variable_count, WpAllocator *alloc);
|
||||
u32 variable_count, WpAllocator *allocator);
|
||||
void prRhiFreeDescriptorSet(PrRhiDevice *device, PrRhiDescriptorPool *pool,
|
||||
PrRhiDescriptorSet *set, WpAllocator *alloc);
|
||||
PrRhiDescriptorSet *set, WpAllocator *allocator);
|
||||
void prRhiUpdateDescriptorSet(PrRhiDevice *device, PrRhiWriteDescriptorSetArray writes);
|
||||
|
||||
// ======================================================================
|
||||
@@ -189,28 +192,28 @@ void prRhiUpdateDescriptorSet(PrRhiDevice *device, PrRhiWriteDesc
|
||||
// ======================================================================
|
||||
|
||||
PrRhiFence *prRhiCreateFence(PrRhiDevice *device, PrRhiFenceDesc desc,
|
||||
WpAllocator *alloc);
|
||||
void prRhiDestroyFence(PrRhiDevice *device, PrRhiFence *fence, WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyFence(PrRhiDevice *device, PrRhiFence *fence, WpAllocator *allocator);
|
||||
|
||||
void prRhiWaitForFences(PrRhiDevice *device, PrRhiFenceArray fences, u32 count,
|
||||
b8 wait_all, u64 timeout_ns);
|
||||
void prRhiResetFences(PrRhiDevice *device, PrRhiFenceArray fences, u32 count);
|
||||
|
||||
PrRhiSemaphore *prRhiCreateSemaphore(PrRhiDevice *device, WpAllocator *alloc);
|
||||
PrRhiSemaphore *prRhiCreateSemaphore(PrRhiDevice *device, WpAllocator *allocator);
|
||||
void prRhiDestroySemaphore(PrRhiDevice *device, PrRhiSemaphore *semaphore,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
// ======================================================================
|
||||
// Command pools and command buffers
|
||||
// ======================================================================
|
||||
|
||||
PrRhiCommandPool *prRhiCreateCommandPool(PrRhiDevice *device, PrRhiCommandPoolDesc desc,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
void prRhiDestroyCommandPool(PrRhiDevice *device, PrRhiCommandPool *pool,
|
||||
WpAllocator *alloc);
|
||||
WpAllocator *allocator);
|
||||
|
||||
PrRhiCommandBufferArray prRhiAllocateCommandBuffers(PrRhiDevice *device, PrRhiCommandPool *pool,
|
||||
u32 count, WpAllocator *alloc);
|
||||
u32 count, WpAllocator *allocator);
|
||||
void prRhiFreeCommandBuffers(PrRhiDevice *device, PrRhiCommandPool *pool,
|
||||
u32 count, PrRhiCommandBufferArray buffers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user