From 66e91e4bc4d112c410e2fede64ce51184e6f5e28 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Thu, 18 Nov 2021 15:57:03 +0100 Subject: [PATCH] Add lifetime management. Ref release for all objects except encoders that get a single delete function. --- webgpu.h | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/webgpu.h b/webgpu.h index 6478ccb..8852505 100644 --- a/webgpu.h +++ b/webgpu.h @@ -1155,6 +1155,16 @@ typedef bool (*WGPUProcAdapterGetLimits)(WGPUAdapter adapter, WGPUSupportedLimit typedef void (*WGPUProcAdapterGetProperties)(WGPUAdapter adapter, WGPUAdapterProperties * properties); typedef bool (*WGPUProcAdapterHasFeature)(WGPUAdapter adapter, WGPUFeatureName feature); typedef void (*WGPUProcAdapterRequestDevice)(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata); +typedef void (*WGPUProcAdapterReference)(WGPUAdapter adapter); +typedef void (*WGPUProcAdapterRelease)(WGPUAdapter adapter); + +// Procs of BindGroup +typedef void (*WGPUProcBindGroupReference)(WGPUBindGroup bindGroup); +typedef void (*WGPUProcBindGroupRelease)(WGPUBindGroup bindGroup); + +// Procs of BindGroupLayout +typedef void (*WGPUProcBindGroupLayoutReference)(WGPUBindGroupLayout bindGroupLayout); +typedef void (*WGPUProcBindGroupLayoutRelease)(WGPUBindGroupLayout bindGroupLayout); // Procs of Buffer typedef void (*WGPUProcBufferDestroy)(WGPUBuffer buffer); @@ -1162,6 +1172,12 @@ typedef void const * (*WGPUProcBufferGetConstMappedRange)(WGPUBuffer buffer, siz typedef void * (*WGPUProcBufferGetMappedRange)(WGPUBuffer buffer, size_t offset, size_t size); typedef void (*WGPUProcBufferMapAsync)(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata); typedef void (*WGPUProcBufferUnmap)(WGPUBuffer buffer); +typedef void (*WGPUProcBufferReference)(WGPUBuffer buffer); +typedef void (*WGPUProcBufferRelease)(WGPUBuffer buffer); + +// Procs of CommandBuffer +typedef void (*WGPUProcCommandBufferReference)(WGPUCommandBuffer commandBuffer); +typedef void (*WGPUProcCommandBufferRelease)(WGPUCommandBuffer commandBuffer); // Procs of CommandEncoder typedef WGPUComputePassEncoder (*WGPUProcCommandEncoderBeginComputePass)(WGPUCommandEncoder commandEncoder, WGPUComputePassDescriptor const * descriptor); @@ -1177,6 +1193,7 @@ typedef void (*WGPUProcCommandEncoderPopDebugGroup)(WGPUCommandEncoder commandEn typedef void (*WGPUProcCommandEncoderPushDebugGroup)(WGPUCommandEncoder commandEncoder, char const * groupLabel); typedef void (*WGPUProcCommandEncoderResolveQuerySet)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset); typedef void (*WGPUProcCommandEncoderWriteTimestamp)(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex); +typedef void (*WGPUProcCommandEncoderDelete)(WGPUCommandEncoder commandEncoder); // Procs of ComputePassEncoder typedef void (*WGPUProcComputePassEncoderBeginPipelineStatisticsQuery)(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); @@ -1189,10 +1206,13 @@ typedef void (*WGPUProcComputePassEncoderPopDebugGroup)(WGPUComputePassEncoder c typedef void (*WGPUProcComputePassEncoderPushDebugGroup)(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); typedef void (*WGPUProcComputePassEncoderSetBindGroup)(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); typedef void (*WGPUProcComputePassEncoderSetPipeline)(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); +typedef void (*WGPUProcComputePassEncoderDelete)(WGPUComputePassEncoder computePassEncoder); // Procs of ComputePipeline typedef WGPUBindGroupLayout (*WGPUProcComputePipelineGetBindGroupLayout)(WGPUComputePipeline computePipeline, uint32_t groupIndex); typedef void (*WGPUProcComputePipelineSetLabel)(WGPUComputePipeline computePipeline, char const * label); +typedef void (*WGPUProcComputePipelineReference)(WGPUComputePipeline computePipeline); +typedef void (*WGPUProcComputePipelineRelease)(WGPUComputePipeline computePipeline); // Procs of Device typedef WGPUBindGroup (*WGPUProcDeviceCreateBindGroup)(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor); @@ -1217,20 +1237,36 @@ typedef bool (*WGPUProcDevicePopErrorScope)(WGPUDevice device, WGPUErrorCallback typedef void (*WGPUProcDevicePushErrorScope)(WGPUDevice device, WGPUErrorFilter filter); typedef void (*WGPUProcDeviceSetDeviceLostCallback)(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); typedef void (*WGPUProcDeviceSetUncapturedErrorCallback)(WGPUDevice device, WGPUErrorCallback callback, void * userdata); +typedef void (*WGPUProcDeviceReference)(WGPUDevice device); +typedef void (*WGPUProcDeviceRelease)(WGPUDevice device); // Procs of Instance typedef WGPUSurface (*WGPUProcInstanceCreateSurface)(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor); typedef void (*WGPUProcInstanceProcessEvents)(WGPUInstance instance); typedef void (*WGPUProcInstanceRequestAdapter)(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata); +typedef void (*WGPUProcInstanceReference)(WGPUInstance instance); +typedef void (*WGPUProcInstanceRelease)(WGPUInstance instance); + +// Procs of PipelineLayout +typedef void (*WGPUProcPipelineLayoutReference)(WGPUPipelineLayout pipelineLayout); +typedef void (*WGPUProcPipelineLayoutRelease)(WGPUPipelineLayout pipelineLayout); // Procs of QuerySet typedef void (*WGPUProcQuerySetDestroy)(WGPUQuerySet querySet); +typedef void (*WGPUProcQuerySetReference)(WGPUQuerySet querySet); +typedef void (*WGPUProcQuerySetRelease)(WGPUQuerySet querySet); // Procs of Queue typedef void (*WGPUProcQueueOnSubmittedWorkDone)(WGPUQueue queue, uint64_t signalValue, WGPUQueueWorkDoneCallback callback, void * userdata); typedef void (*WGPUProcQueueSubmit)(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands); typedef void (*WGPUProcQueueWriteBuffer)(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size); typedef void (*WGPUProcQueueWriteTexture)(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize); +typedef void (*WGPUProcQueueReference)(WGPUQueue queue); +typedef void (*WGPUProcQueueRelease)(WGPUQueue queue); + +// Procs of RenderBundle +typedef void (*WGPUProcRenderBundleReference)(WGPURenderBundle renderBundle); +typedef void (*WGPUProcRenderBundleRelease)(WGPURenderBundle renderBundle); // Procs of RenderBundleEncoder typedef void (*WGPUProcRenderBundleEncoderDraw)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); @@ -1245,6 +1281,7 @@ typedef void (*WGPUProcRenderBundleEncoderSetBindGroup)(WGPURenderBundleEncoder typedef void (*WGPUProcRenderBundleEncoderSetIndexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); typedef void (*WGPUProcRenderBundleEncoderSetPipeline)(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline); typedef void (*WGPUProcRenderBundleEncoderSetVertexBuffer)(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); +typedef void (*WGPUProcRenderBundleEncoderDelete)(WGPURenderBundleEncoder renderBundleEncoder); // Procs of RenderPassEncoder typedef void (*WGPUProcRenderPassEncoderBeginOcclusionQuery)(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex); @@ -1268,25 +1305,44 @@ typedef void (*WGPUProcRenderPassEncoderSetScissorRect)(WGPURenderPassEncoder re typedef void (*WGPUProcRenderPassEncoderSetStencilReference)(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); typedef void (*WGPUProcRenderPassEncoderSetVertexBuffer)(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); typedef void (*WGPUProcRenderPassEncoderSetViewport)(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); +typedef void (*WGPUProcRenderPassEncoderDelete)(WGPURenderPassEncoder renderPassEncoder); // Procs of RenderPipeline typedef WGPUBindGroupLayout (*WGPUProcRenderPipelineGetBindGroupLayout)(WGPURenderPipeline renderPipeline, uint32_t groupIndex); typedef void (*WGPUProcRenderPipelineSetLabel)(WGPURenderPipeline renderPipeline, char const * label); +typedef void (*WGPUProcRenderPipelineReference)(WGPURenderPipeline renderPipeline); +typedef void (*WGPUProcRenderPipelineRelease)(WGPURenderPipeline renderPipeline); + +// Procs of Sampler +typedef void (*WGPUProcSamplerReference)(WGPUSampler sampler); +typedef void (*WGPUProcSamplerRelease)(WGPUSampler sampler); // Procs of ShaderModule typedef void (*WGPUProcShaderModuleGetCompilationInfo)(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata); typedef void (*WGPUProcShaderModuleSetLabel)(WGPUShaderModule shaderModule, char const * label); +typedef void (*WGPUProcShaderModuleReference)(WGPUShaderModule shaderModule); +typedef void (*WGPUProcShaderModuleRelease)(WGPUShaderModule shaderModule); // Procs of Surface typedef WGPUTextureFormat (*WGPUProcSurfaceGetPreferredFormat)(WGPUSurface surface, WGPUAdapter adapter); +typedef void (*WGPUProcSurfaceReference)(WGPUSurface surface); +typedef void (*WGPUProcSurfaceRelease)(WGPUSurface surface); // Procs of SwapChain typedef WGPUTextureView (*WGPUProcSwapChainGetCurrentTextureView)(WGPUSwapChain swapChain); typedef void (*WGPUProcSwapChainPresent)(WGPUSwapChain swapChain); +typedef void (*WGPUProcSwapChainReference)(WGPUSwapChain swapChain); +typedef void (*WGPUProcSwapChainRelease)(WGPUSwapChain swapChain); // Procs of Texture typedef WGPUTextureView (*WGPUProcTextureCreateView)(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor); typedef void (*WGPUProcTextureDestroy)(WGPUTexture texture); +typedef void (*WGPUProcTextureReference)(WGPUTexture texture); +typedef void (*WGPUProcTextureRelease)(WGPUTexture texture); + +// Procs of TextureView +typedef void (*WGPUProcTextureViewReference)(WGPUTextureView textureView); +typedef void (*WGPUProcTextureViewRelease)(WGPUTextureView textureView); #endif // !defined(WGPU_SKIP_PROCS) @@ -1300,6 +1356,16 @@ WGPU_EXPORT bool wgpuAdapterGetLimits(WGPUAdapter adapter, WGPUSupportedLimits * WGPU_EXPORT void wgpuAdapterGetProperties(WGPUAdapter adapter, WGPUAdapterProperties * properties); WGPU_EXPORT bool wgpuAdapterHasFeature(WGPUAdapter adapter, WGPUFeatureName feature); WGPU_EXPORT void wgpuAdapterRequestDevice(WGPUAdapter adapter, WGPUDeviceDescriptor const * descriptor, WGPURequestDeviceCallback callback, void * userdata); +WGPU_EXPORT void wgpuAdapterReference(WGPUAdapter adapter); +WGPU_EXPORT void wgpuAdapterRelease(WGPUAdapter adapter); + +// Methods of BindGroup +WGPU_EXPORT void wgpuBindGroupReference(WGPUBindGroup bindGroup); +WGPU_EXPORT void wgpuBindGroupRelease(WGPUBindGroup bindGroup); + +// Methods of BindGroupLayout +WGPU_EXPORT void wgpuBindGroupLayoutReference(WGPUBindGroupLayout bindGroupLayout); +WGPU_EXPORT void wgpuBindGroupLayoutRelease(WGPUBindGroupLayout bindGroupLayout); // Methods of Buffer WGPU_EXPORT void wgpuBufferDestroy(WGPUBuffer buffer); @@ -1307,6 +1373,12 @@ WGPU_EXPORT void const * wgpuBufferGetConstMappedRange(WGPUBuffer buffer, size_t WGPU_EXPORT void * wgpuBufferGetMappedRange(WGPUBuffer buffer, size_t offset, size_t size); WGPU_EXPORT void wgpuBufferMapAsync(WGPUBuffer buffer, WGPUMapModeFlags mode, size_t offset, size_t size, WGPUBufferMapCallback callback, void * userdata); WGPU_EXPORT void wgpuBufferUnmap(WGPUBuffer buffer); +WGPU_EXPORT void wgpuBufferReference(WGPUBuffer buffer); +WGPU_EXPORT void wgpuBufferRelease(WGPUBuffer buffer); + +// Methods of CommandBuffer +WGPU_EXPORT void wgpuCommandBufferReference(WGPUCommandBuffer commandBuffer); +WGPU_EXPORT void wgpuCommandBufferRelease(WGPUCommandBuffer commandBuffer); // Methods of CommandEncoder WGPU_EXPORT WGPUComputePassEncoder wgpuCommandEncoderBeginComputePass(WGPUCommandEncoder commandEncoder, WGPUComputePassDescriptor const * descriptor); @@ -1322,6 +1394,7 @@ WGPU_EXPORT void wgpuCommandEncoderPopDebugGroup(WGPUCommandEncoder commandEncod WGPU_EXPORT void wgpuCommandEncoderPushDebugGroup(WGPUCommandEncoder commandEncoder, char const * groupLabel); WGPU_EXPORT void wgpuCommandEncoderResolveQuerySet(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t firstQuery, uint32_t queryCount, WGPUBuffer destination, uint64_t destinationOffset); WGPU_EXPORT void wgpuCommandEncoderWriteTimestamp(WGPUCommandEncoder commandEncoder, WGPUQuerySet querySet, uint32_t queryIndex); +WGPU_EXPORT void wgpuCommandEncoderDelete(WGPUCommandEncoder commandEncoder); // Methods of ComputePassEncoder WGPU_EXPORT void wgpuComputePassEncoderBeginPipelineStatisticsQuery(WGPUComputePassEncoder computePassEncoder, WGPUQuerySet querySet, uint32_t queryIndex); @@ -1334,10 +1407,13 @@ WGPU_EXPORT void wgpuComputePassEncoderPopDebugGroup(WGPUComputePassEncoder comp WGPU_EXPORT void wgpuComputePassEncoderPushDebugGroup(WGPUComputePassEncoder computePassEncoder, char const * groupLabel); WGPU_EXPORT void wgpuComputePassEncoderSetBindGroup(WGPUComputePassEncoder computePassEncoder, uint32_t groupIndex, WGPUBindGroup group, uint32_t dynamicOffsetCount, uint32_t const * dynamicOffsets); WGPU_EXPORT void wgpuComputePassEncoderSetPipeline(WGPUComputePassEncoder computePassEncoder, WGPUComputePipeline pipeline); +WGPU_EXPORT void wgpuComputePassEncoderDelete(WGPUComputePassEncoder computePassEncoder); // Methods of ComputePipeline WGPU_EXPORT WGPUBindGroupLayout wgpuComputePipelineGetBindGroupLayout(WGPUComputePipeline computePipeline, uint32_t groupIndex); WGPU_EXPORT void wgpuComputePipelineSetLabel(WGPUComputePipeline computePipeline, char const * label); +WGPU_EXPORT void wgpuComputePipelineReference(WGPUComputePipeline computePipeline); +WGPU_EXPORT void wgpuComputePipelineRelease(WGPUComputePipeline computePipeline); // Methods of Device WGPU_EXPORT WGPUBindGroup wgpuDeviceCreateBindGroup(WGPUDevice device, WGPUBindGroupDescriptor const * descriptor); @@ -1362,20 +1438,36 @@ WGPU_EXPORT bool wgpuDevicePopErrorScope(WGPUDevice device, WGPUErrorCallback ca WGPU_EXPORT void wgpuDevicePushErrorScope(WGPUDevice device, WGPUErrorFilter filter); WGPU_EXPORT void wgpuDeviceSetDeviceLostCallback(WGPUDevice device, WGPUDeviceLostCallback callback, void * userdata); WGPU_EXPORT void wgpuDeviceSetUncapturedErrorCallback(WGPUDevice device, WGPUErrorCallback callback, void * userdata); +WGPU_EXPORT void wgpuDeviceReference(WGPUDevice device); +WGPU_EXPORT void wgpuDeviceRelease(WGPUDevice device); // Methods of Instance WGPU_EXPORT WGPUSurface wgpuInstanceCreateSurface(WGPUInstance instance, WGPUSurfaceDescriptor const * descriptor); WGPU_EXPORT void wgpuInstanceProcessEvents(WGPUInstance instance); WGPU_EXPORT void wgpuInstanceRequestAdapter(WGPUInstance instance, WGPURequestAdapterOptions const * options, WGPURequestAdapterCallback callback, void * userdata); +WGPU_EXPORT void wgpuInstanceReference(WGPUInstance instance); +WGPU_EXPORT void wgpuInstanceRelease(WGPUInstance instance); + +// Methods of PipelineLayout +WGPU_EXPORT void wgpuPipelineLayoutReference(WGPUPipelineLayout pipelineLayout); +WGPU_EXPORT void wgpuPipelineLayoutRelease(WGPUPipelineLayout pipelineLayout); // Methods of QuerySet WGPU_EXPORT void wgpuQuerySetDestroy(WGPUQuerySet querySet); +WGPU_EXPORT void wgpuQuerySetReference(WGPUQuerySet querySet); +WGPU_EXPORT void wgpuQuerySetRelease(WGPUQuerySet querySet); // Methods of Queue WGPU_EXPORT void wgpuQueueOnSubmittedWorkDone(WGPUQueue queue, uint64_t signalValue, WGPUQueueWorkDoneCallback callback, void * userdata); WGPU_EXPORT void wgpuQueueSubmit(WGPUQueue queue, uint32_t commandCount, WGPUCommandBuffer const * commands); WGPU_EXPORT void wgpuQueueWriteBuffer(WGPUQueue queue, WGPUBuffer buffer, uint64_t bufferOffset, void const * data, size_t size); WGPU_EXPORT void wgpuQueueWriteTexture(WGPUQueue queue, WGPUImageCopyTexture const * destination, void const * data, size_t dataSize, WGPUTextureDataLayout const * dataLayout, WGPUExtent3D const * writeSize); +WGPU_EXPORT void wgpuQueueReference(WGPUQueue queue); +WGPU_EXPORT void wgpuQueueRelease(WGPUQueue queue); + +// Methods of RenderBundle +WGPU_EXPORT void wgpuRenderBundleReference(WGPURenderBundle renderBundle); +WGPU_EXPORT void wgpuRenderBundleRelease(WGPURenderBundle renderBundle); // Methods of RenderBundleEncoder WGPU_EXPORT void wgpuRenderBundleEncoderDraw(WGPURenderBundleEncoder renderBundleEncoder, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); @@ -1390,6 +1482,7 @@ WGPU_EXPORT void wgpuRenderBundleEncoderSetBindGroup(WGPURenderBundleEncoder ren WGPU_EXPORT void wgpuRenderBundleEncoderSetIndexBuffer(WGPURenderBundleEncoder renderBundleEncoder, WGPUBuffer buffer, WGPUIndexFormat format, uint64_t offset, uint64_t size); WGPU_EXPORT void wgpuRenderBundleEncoderSetPipeline(WGPURenderBundleEncoder renderBundleEncoder, WGPURenderPipeline pipeline); WGPU_EXPORT void wgpuRenderBundleEncoderSetVertexBuffer(WGPURenderBundleEncoder renderBundleEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); +WGPU_EXPORT void wgpuRenderBundleEncoderDelete(WGPURenderBundleEncoder renderBundleEncoder); // Methods of RenderPassEncoder WGPU_EXPORT void wgpuRenderPassEncoderBeginOcclusionQuery(WGPURenderPassEncoder renderPassEncoder, uint32_t queryIndex); @@ -1413,25 +1506,44 @@ WGPU_EXPORT void wgpuRenderPassEncoderSetScissorRect(WGPURenderPassEncoder rende WGPU_EXPORT void wgpuRenderPassEncoderSetStencilReference(WGPURenderPassEncoder renderPassEncoder, uint32_t reference); WGPU_EXPORT void wgpuRenderPassEncoderSetVertexBuffer(WGPURenderPassEncoder renderPassEncoder, uint32_t slot, WGPUBuffer buffer, uint64_t offset, uint64_t size); WGPU_EXPORT void wgpuRenderPassEncoderSetViewport(WGPURenderPassEncoder renderPassEncoder, float x, float y, float width, float height, float minDepth, float maxDepth); +WGPU_EXPORT void wgpuRenderPassEncoderDelete(WGPURenderPassEncoder renderPassEncoder); // Methods of RenderPipeline WGPU_EXPORT WGPUBindGroupLayout wgpuRenderPipelineGetBindGroupLayout(WGPURenderPipeline renderPipeline, uint32_t groupIndex); WGPU_EXPORT void wgpuRenderPipelineSetLabel(WGPURenderPipeline renderPipeline, char const * label); +WGPU_EXPORT void wgpuRenderPipelineReference(WGPURenderPipeline renderPipeline); +WGPU_EXPORT void wgpuRenderPipelineRelease(WGPURenderPipeline renderPipeline); + +// Methods of Sampler +WGPU_EXPORT void wgpuSamplerReference(WGPUSampler sampler); +WGPU_EXPORT void wgpuSamplerRelease(WGPUSampler sampler); // Methods of ShaderModule WGPU_EXPORT void wgpuShaderModuleGetCompilationInfo(WGPUShaderModule shaderModule, WGPUCompilationInfoCallback callback, void * userdata); WGPU_EXPORT void wgpuShaderModuleSetLabel(WGPUShaderModule shaderModule, char const * label); +WGPU_EXPORT void wgpuShaderModuleReference(WGPUShaderModule shaderModule); +WGPU_EXPORT void wgpuShaderModuleRelease(WGPUShaderModule shaderModule); // Methods of Surface WGPU_EXPORT WGPUTextureFormat wgpuSurfaceGetPreferredFormat(WGPUSurface surface, WGPUAdapter adapter); +WGPU_EXPORT void wgpuSurfaceReference(WGPUSurface surface); +WGPU_EXPORT void wgpuSurfaceRelease(WGPUSurface surface); // Methods of SwapChain WGPU_EXPORT WGPUTextureView wgpuSwapChainGetCurrentTextureView(WGPUSwapChain swapChain); WGPU_EXPORT void wgpuSwapChainPresent(WGPUSwapChain swapChain); +WGPU_EXPORT void wgpuSwapChainReference(WGPUSwapChain swapChain); +WGPU_EXPORT void wgpuSwapChainRelease(WGPUSwapChain swapChain); // Methods of Texture WGPU_EXPORT WGPUTextureView wgpuTextureCreateView(WGPUTexture texture, WGPUTextureViewDescriptor const * descriptor); WGPU_EXPORT void wgpuTextureDestroy(WGPUTexture texture); +WGPU_EXPORT void wgpuTextureReference(WGPUTexture texture); +WGPU_EXPORT void wgpuTextureRelease(WGPUTexture texture); + +// Methods of TextureView +WGPU_EXPORT void wgpuTextureViewReference(WGPUTextureView textureView); +WGPU_EXPORT void wgpuTextureViewRelease(WGPUTextureView textureView); #endif // !defined(WGPU_SKIP_DECLARATIONS)