summaryrefslogtreecommitdiffstats
path: root/gfx/wgpu_bindings/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/wgpu_bindings/src/client.rs')
-rw-r--r--gfx/wgpu_bindings/src/client.rs58
1 files changed, 28 insertions, 30 deletions
diff --git a/gfx/wgpu_bindings/src/client.rs b/gfx/wgpu_bindings/src/client.rs
index bf53a8c871..c49dbea7a5 100644
--- a/gfx/wgpu_bindings/src/client.rs
+++ b/gfx/wgpu_bindings/src/client.rs
@@ -47,7 +47,7 @@ impl ProgrammableStageDescriptor {
fn to_wgpu(&self) -> wgc::pipeline::ProgrammableStageDescriptor {
wgc::pipeline::ProgrammableStageDescriptor {
module: self.module,
- entry_point: cow_label(&self.entry_point).unwrap(),
+ entry_point: cow_label(&self.entry_point),
}
}
}
@@ -177,6 +177,7 @@ pub enum RawBindingType {
SampledTexture,
ReadonlyStorageTexture,
WriteonlyStorageTexture,
+ ReadWriteStorageTexture,
}
#[repr(C)]
@@ -237,7 +238,7 @@ pub struct SamplerDescriptor<'a> {
lod_min_clamp: f32,
lod_max_clamp: f32,
compare: Option<&'a wgt::CompareFunction>,
- anisotropy_clamp: Option<&'a u16>,
+ max_anisotropy: u16,
}
#[repr(C)]
@@ -614,7 +615,7 @@ pub extern "C" fn wgpu_client_create_sampler(
lod_min_clamp: desc.lod_min_clamp,
lod_max_clamp: desc.lod_max_clamp,
compare: desc.compare.cloned(),
- anisotropy_clamp: *desc.anisotropy_clamp.unwrap_or(&1),
+ anisotropy_clamp: desc.max_anisotropy,
border_color: None,
};
let action = DeviceAction::CreateSampler(id, wgpu_desc);
@@ -769,9 +770,8 @@ pub struct ComputePassTimestampWrites<'a> {
#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
- encoder_id: id::CommandEncoderId,
desc: &ComputePassDescriptor,
-) -> *mut wgc::command::ComputePass {
+) -> *mut crate::command::RecordedComputePass {
let &ComputePassDescriptor {
label,
timestamp_writes,
@@ -795,27 +795,24 @@ pub unsafe extern "C" fn wgpu_command_encoder_begin_compute_pass(
});
let timestamp_writes = timestamp_writes.as_ref();
- let pass = wgc::command::ComputePass::new(
- encoder_id,
- &wgc::command::ComputePassDescriptor {
- label,
- timestamp_writes,
- },
- );
+ let pass = crate::command::RecordedComputePass::new(&wgc::command::ComputePassDescriptor {
+ label,
+ timestamp_writes,
+ });
Box::into_raw(Box::new(pass))
}
#[no_mangle]
pub unsafe extern "C" fn wgpu_compute_pass_finish(
- pass: *mut wgc::command::ComputePass,
+ pass: *mut crate::command::RecordedComputePass,
output: &mut ByteBuf,
) {
- let command = Box::from_raw(pass).into_command();
+ let command = Box::from_raw(pass);
*output = make_byte_buf(&command);
}
#[no_mangle]
-pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut wgc::command::ComputePass) {
+pub unsafe extern "C" fn wgpu_compute_pass_destroy(pass: *mut crate::command::RecordedComputePass) {
let _ = Box::from_raw(pass);
}
@@ -838,9 +835,8 @@ pub struct RenderPassTimestampWrites<'a> {
#[no_mangle]
pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
- encoder_id: id::CommandEncoderId,
desc: &RenderPassDescriptor,
-) -> *mut wgc::command::RenderPass {
+) -> *mut crate::command::RecordedRenderPass {
let &RenderPassDescriptor {
label,
color_attachments,
@@ -873,30 +869,27 @@ pub unsafe extern "C" fn wgpu_command_encoder_begin_render_pass(
.iter()
.map(|format| Some(format.clone()))
.collect();
- let pass = wgc::command::RenderPass::new(
- encoder_id,
- &wgc::command::RenderPassDescriptor {
- label,
- color_attachments: Cow::Owned(color_attachments),
- depth_stencil_attachment: depth_stencil_attachment.as_ref(),
- timestamp_writes,
- occlusion_query_set,
- },
- );
+ let pass = crate::command::RecordedRenderPass::new(&wgc::command::RenderPassDescriptor {
+ label,
+ color_attachments: Cow::Owned(color_attachments),
+ depth_stencil_attachment: depth_stencil_attachment.as_ref(),
+ timestamp_writes,
+ occlusion_query_set,
+ });
Box::into_raw(Box::new(pass))
}
#[no_mangle]
pub unsafe extern "C" fn wgpu_render_pass_finish(
- pass: *mut wgc::command::RenderPass,
+ pass: *mut crate::command::RecordedRenderPass,
output: &mut ByteBuf,
) {
- let command = Box::from_raw(pass).into_command();
+ let command = Box::from_raw(pass);
*output = make_byte_buf(&command);
}
#[no_mangle]
-pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut wgc::command::RenderPass) {
+pub unsafe extern "C" fn wgpu_render_pass_destroy(pass: *mut crate::command::RecordedRenderPass) {
let _ = Box::from_raw(pass);
}
@@ -974,6 +967,11 @@ pub unsafe extern "C" fn wgpu_client_create_bind_group_layout(
view_dimension: *entry.view_dimension.unwrap(),
format: *entry.storage_texture_format.unwrap(),
},
+ RawBindingType::ReadWriteStorageTexture => wgt::BindingType::StorageTexture {
+ access: wgt::StorageTextureAccess::ReadWrite,
+ view_dimension: *entry.view_dimension.unwrap(),
+ format: *entry.storage_texture_format.unwrap(),
+ },
},
});
}