Skip to content

Commit 3cb6dd9

Browse files
committed
add missing 'wgpu_*_destroy' functions
1 parent 29c9b09 commit 3cb6dd9

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

ffi/wgpu.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated with cbindgen:0.14.1 */
1+
/* Generated with cbindgen:0.14.2 */
22

33
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
44
* To generate this file:
@@ -324,6 +324,10 @@ typedef WGPUNonZeroU64 WGPUId_BindGroup_Dummy;
324324

325325
typedef WGPUId_BindGroup_Dummy WGPUBindGroupId;
326326

327+
typedef WGPUNonZeroU64 WGPUId_BindGroupLayout_Dummy;
328+
329+
typedef WGPUId_BindGroupLayout_Dummy WGPUBindGroupLayoutId;
330+
327331
typedef WGPUNonZeroU64 WGPUId_Buffer_Dummy;
328332

329333
typedef WGPUId_Buffer_Dummy WGPUBufferId;
@@ -445,10 +449,6 @@ typedef WGPUNonZeroU64 WGPUId_Surface;
445449

446450
typedef WGPUId_Surface WGPUSurfaceId;
447451

448-
typedef WGPUNonZeroU64 WGPUId_BindGroupLayout_Dummy;
449-
450-
typedef WGPUId_BindGroupLayout_Dummy WGPUBindGroupLayoutId;
451-
452452
typedef struct {
453453
WGPUBufferId buffer;
454454
WGPUBufferAddress offset;
@@ -774,6 +774,8 @@ WGPUDeviceId wgpu_adapter_request_device(WGPUAdapterId adapter_id,
774774

775775
void wgpu_bind_group_destroy(WGPUBindGroupId bind_group_id);
776776

777+
void wgpu_bind_group_layout_destroy(WGPUBindGroupLayoutId bind_group_layout_id);
778+
777779
void wgpu_buffer_destroy(WGPUBufferId buffer_id);
778780

779781
void wgpu_buffer_map_read_async(WGPUBufferId buffer_id,
@@ -872,6 +874,8 @@ void wgpu_compute_pass_set_bind_group(WGPURawPass *pass,
872874

873875
void wgpu_compute_pass_set_pipeline(WGPURawPass *pass, WGPUComputePipelineId pipeline_id);
874876

877+
void wgpu_compute_pipeline_destroy(WGPUComputePipelineId compute_pipeline_id);
878+
875879
WGPUSurfaceId wgpu_create_surface_from_android(void *a_native_window);
876880

877881
WGPUSurfaceId wgpu_create_surface_from_metal_layer(void *layer);
@@ -933,6 +937,8 @@ void wgpu_device_poll(WGPUDeviceId device_id, bool force_wait);
933937

934938
unsigned int wgpu_get_version(void);
935939

940+
void wgpu_pipeline_layout_destroy(WGPUPipelineLayoutId pipeline_layout_id);
941+
936942
/**
937943
* # Safety
938944
*
@@ -1040,6 +1046,8 @@ void wgpu_render_pass_set_viewport(WGPURawPass *pass,
10401046
float depth_min,
10411047
float depth_max);
10421048

1049+
void wgpu_render_pipeline_destroy(WGPURenderPipelineId render_pipeline_id);
1050+
10431051
/**
10441052
* # Safety
10451053
*
@@ -1056,6 +1064,8 @@ void wgpu_set_log_callback(WGPULogCallback callback);
10561064

10571065
int wgpu_set_log_level(WGPULogLevel level);
10581066

1067+
void wgpu_shader_module_destroy(WGPUShaderModuleId shader_module_id);
1068+
10591069
WGPUSwapChainOutput wgpu_swap_chain_get_next_texture(WGPUSwapChainId swap_chain_id);
10601070

10611071
void wgpu_swap_chain_present(WGPUSwapChainId swap_chain_id);

src/device.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ pub extern "C" fn wgpu_device_create_bind_group_layout(
234234
gfx_select!(device_id => GLOBAL.device_create_bind_group_layout(device_id, desc, PhantomData))
235235
}
236236

237+
#[no_mangle]
238+
pub extern "C" fn wgpu_bind_group_layout_destroy(bind_group_layout_id: id::BindGroupLayoutId) {
239+
gfx_select!(bind_group_layout_id => GLOBAL.bind_group_layout_destroy(bind_group_layout_id))
240+
}
241+
237242
#[no_mangle]
238243
pub extern "C" fn wgpu_device_create_pipeline_layout(
239244
device_id: id::DeviceId,
@@ -242,6 +247,11 @@ pub extern "C" fn wgpu_device_create_pipeline_layout(
242247
gfx_select!(device_id => GLOBAL.device_create_pipeline_layout(device_id, desc, PhantomData))
243248
}
244249

250+
#[no_mangle]
251+
pub extern "C" fn wgpu_pipeline_layout_destroy(pipeline_layout_id: id::PipelineLayoutId) {
252+
gfx_select!(pipeline_layout_id => GLOBAL.pipeline_layout_destroy(pipeline_layout_id))
253+
}
254+
245255
#[no_mangle]
246256
pub extern "C" fn wgpu_device_create_bind_group(
247257
device_id: id::DeviceId,
@@ -263,6 +273,11 @@ pub extern "C" fn wgpu_device_create_shader_module(
263273
gfx_select!(device_id => GLOBAL.device_create_shader_module(device_id, desc, PhantomData))
264274
}
265275

276+
#[no_mangle]
277+
pub extern "C" fn wgpu_shader_module_destroy(shader_module_id: id::ShaderModuleId) {
278+
gfx_select!(shader_module_id => GLOBAL.shader_module_destroy(shader_module_id))
279+
}
280+
266281
#[no_mangle]
267282
pub extern "C" fn wgpu_device_create_command_encoder(
268283
device_id: id::DeviceId,
@@ -325,6 +340,11 @@ pub extern "C" fn wgpu_device_create_render_pipeline(
325340
gfx_select!(device_id => GLOBAL.device_create_render_pipeline(device_id, desc, PhantomData))
326341
}
327342

343+
#[no_mangle]
344+
pub extern "C" fn wgpu_render_pipeline_destroy(render_pipeline_id: id::RenderPipelineId) {
345+
gfx_select!(render_pipeline_id => GLOBAL.render_pipeline_destroy(render_pipeline_id))
346+
}
347+
328348
#[no_mangle]
329349
pub extern "C" fn wgpu_device_create_compute_pipeline(
330350
device_id: id::DeviceId,
@@ -333,6 +353,11 @@ pub extern "C" fn wgpu_device_create_compute_pipeline(
333353
gfx_select!(device_id => GLOBAL.device_create_compute_pipeline(device_id, desc, PhantomData))
334354
}
335355

356+
#[no_mangle]
357+
pub extern "C" fn wgpu_compute_pipeline_destroy(compute_pipeline_id: id::ComputePipelineId) {
358+
gfx_select!(compute_pipeline_id => GLOBAL.compute_pipeline_destroy(compute_pipeline_id))
359+
}
360+
336361
#[no_mangle]
337362
pub extern "C" fn wgpu_device_create_swap_chain(
338363
device_id: id::DeviceId,

0 commit comments

Comments
 (0)