Skip to content

Commit

Permalink
Merge #28
Browse files Browse the repository at this point in the history
28: Add 'wgpu_device_destroy_render_pipeline()' function r=kvark a=DavidPeicho

Hi,

Nothing fancy, this PR simply forward the call `wgpu_device_destroy_render_pipeline()` to the `render_pipeline_destroy()` method in `wgpu-core`. 

Co-authored-by: David Peicho <[email protected]>
  • Loading branch information
bors[bot] and DavidPeicho authored Jun 2, 2020
2 parents e2be5c4 + 3cb6dd9 commit 9dfa7dc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ typedef WGPUNonZeroU64 WGPUId_BindGroup_Dummy;

typedef WGPUId_BindGroup_Dummy WGPUBindGroupId;

typedef WGPUNonZeroU64 WGPUId_BindGroupLayout_Dummy;

typedef WGPUId_BindGroupLayout_Dummy WGPUBindGroupLayoutId;

typedef WGPUNonZeroU64 WGPUId_Buffer_Dummy;

typedef WGPUId_Buffer_Dummy WGPUBufferId;
Expand Down Expand Up @@ -447,10 +451,6 @@ typedef WGPUNonZeroU64 WGPUId_Surface;

typedef WGPUId_Surface WGPUSurfaceId;

typedef WGPUNonZeroU64 WGPUId_BindGroupLayout_Dummy;

typedef WGPUId_BindGroupLayout_Dummy WGPUBindGroupLayoutId;

typedef struct {
WGPUBufferId buffer;
WGPUBufferAddress offset;
Expand Down Expand Up @@ -777,6 +777,8 @@ WGPUDeviceId wgpu_adapter_request_device(WGPUAdapterId adapter_id,

void wgpu_bind_group_destroy(WGPUBindGroupId bind_group_id);

void wgpu_bind_group_layout_destroy(WGPUBindGroupLayoutId bind_group_layout_id);

void wgpu_buffer_destroy(WGPUBufferId buffer_id);

void wgpu_buffer_map_read_async(WGPUBufferId buffer_id,
Expand Down Expand Up @@ -875,6 +877,8 @@ void wgpu_compute_pass_set_bind_group(WGPURawPass *pass,

void wgpu_compute_pass_set_pipeline(WGPURawPass *pass, WGPUComputePipelineId pipeline_id);

void wgpu_compute_pipeline_destroy(WGPUComputePipelineId compute_pipeline_id);

WGPUSurfaceId wgpu_create_surface_from_android(void *a_native_window);

WGPUSurfaceId wgpu_create_surface_from_metal_layer(void *layer);
Expand Down Expand Up @@ -936,6 +940,8 @@ void wgpu_device_poll(WGPUDeviceId device_id, bool force_wait);

unsigned int wgpu_get_version(void);

void wgpu_pipeline_layout_destroy(WGPUPipelineLayoutId pipeline_layout_id);

/**
* # Safety
*
Expand Down Expand Up @@ -1056,6 +1062,8 @@ void wgpu_render_pass_set_viewport(WGPURawPass *pass,
float depth_min,
float depth_max);

void wgpu_render_pipeline_destroy(WGPURenderPipelineId render_pipeline_id);

/**
* # Safety
*
Expand All @@ -1072,6 +1080,8 @@ void wgpu_set_log_callback(WGPULogCallback callback);

int wgpu_set_log_level(WGPULogLevel level);

void wgpu_shader_module_destroy(WGPUShaderModuleId shader_module_id);

WGPUSwapChainOutput wgpu_swap_chain_get_next_texture(WGPUSwapChainId swap_chain_id);

void wgpu_swap_chain_present(WGPUSwapChainId swap_chain_id);
Expand Down
25 changes: 25 additions & 0 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ pub extern "C" fn wgpu_device_create_bind_group_layout(
gfx_select!(device_id => GLOBAL.device_create_bind_group_layout(device_id, desc, PhantomData))
}

#[no_mangle]
pub extern "C" fn wgpu_bind_group_layout_destroy(bind_group_layout_id: id::BindGroupLayoutId) {
gfx_select!(bind_group_layout_id => GLOBAL.bind_group_layout_destroy(bind_group_layout_id))
}

#[no_mangle]
pub extern "C" fn wgpu_device_create_pipeline_layout(
device_id: id::DeviceId,
Expand All @@ -242,6 +247,11 @@ pub extern "C" fn wgpu_device_create_pipeline_layout(
gfx_select!(device_id => GLOBAL.device_create_pipeline_layout(device_id, desc, PhantomData))
}

#[no_mangle]
pub extern "C" fn wgpu_pipeline_layout_destroy(pipeline_layout_id: id::PipelineLayoutId) {
gfx_select!(pipeline_layout_id => GLOBAL.pipeline_layout_destroy(pipeline_layout_id))
}

#[no_mangle]
pub extern "C" fn wgpu_device_create_bind_group(
device_id: id::DeviceId,
Expand All @@ -263,6 +273,11 @@ pub extern "C" fn wgpu_device_create_shader_module(
gfx_select!(device_id => GLOBAL.device_create_shader_module(device_id, desc, PhantomData))
}

#[no_mangle]
pub extern "C" fn wgpu_shader_module_destroy(shader_module_id: id::ShaderModuleId) {
gfx_select!(shader_module_id => GLOBAL.shader_module_destroy(shader_module_id))
}

#[no_mangle]
pub extern "C" fn wgpu_device_create_command_encoder(
device_id: id::DeviceId,
Expand Down Expand Up @@ -342,6 +357,11 @@ pub extern "C" fn wgpu_device_create_render_pipeline(
gfx_select!(device_id => GLOBAL.device_create_render_pipeline(device_id, desc, PhantomData))
}

#[no_mangle]
pub extern "C" fn wgpu_render_pipeline_destroy(render_pipeline_id: id::RenderPipelineId) {
gfx_select!(render_pipeline_id => GLOBAL.render_pipeline_destroy(render_pipeline_id))
}

#[no_mangle]
pub extern "C" fn wgpu_device_create_compute_pipeline(
device_id: id::DeviceId,
Expand All @@ -350,6 +370,11 @@ pub extern "C" fn wgpu_device_create_compute_pipeline(
gfx_select!(device_id => GLOBAL.device_create_compute_pipeline(device_id, desc, PhantomData))
}

#[no_mangle]
pub extern "C" fn wgpu_compute_pipeline_destroy(compute_pipeline_id: id::ComputePipelineId) {
gfx_select!(compute_pipeline_id => GLOBAL.compute_pipeline_destroy(compute_pipeline_id))
}

#[no_mangle]
pub extern "C" fn wgpu_device_create_swap_chain(
device_id: id::DeviceId,
Expand Down

0 comments on commit 9dfa7dc

Please sign in to comment.