mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
Remove gfx_select
.
This commit is contained in:
parent
9794f33823
commit
0287eaf022
@ -21,7 +21,7 @@ impl Resource for WebGpuBindGroupLayout {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.bind_group_layout_drop(self.1));
|
||||
self.0.bind_group_layout_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ impl Resource for WebGpuBindGroup {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.bind_group_drop(self.1));
|
||||
self.0.bind_group_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ pub fn op_webgpu_create_bind_group_layout(
|
||||
entries: Cow::from(entries),
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_bind_group_layout(
|
||||
gfx_put!(instance.device_create_bind_group_layout(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
@ -226,7 +226,7 @@ pub fn op_webgpu_create_pipeline_layout(
|
||||
push_constant_ranges: Default::default(),
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_pipeline_layout(
|
||||
gfx_put!(instance.device_create_pipeline_layout(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
@ -305,7 +305,7 @@ pub fn op_webgpu_create_bind_group(
|
||||
entries: Cow::from(entries),
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_bind_group(
|
||||
gfx_put!(instance.device_create_bind_group(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
|
@ -27,7 +27,7 @@ impl Resource for WebGpuBuffer {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.buffer_drop(self.1));
|
||||
self.0.buffer_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ pub fn op_webgpu_create_buffer(
|
||||
mapped_at_creation,
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_buffer(
|
||||
gfx_put!(instance.device_create_buffer(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
@ -97,7 +97,8 @@ pub async fn op_webgpu_buffer_get_map_async(
|
||||
});
|
||||
|
||||
// TODO(lucacasonato): error handling
|
||||
let maybe_err = gfx_select!(buffer => instance.buffer_map_async(
|
||||
let maybe_err = instance
|
||||
.buffer_map_async(
|
||||
buffer,
|
||||
offset,
|
||||
Some(size),
|
||||
@ -108,8 +109,8 @@ pub async fn op_webgpu_buffer_get_map_async(
|
||||
_ => unreachable!(),
|
||||
},
|
||||
callback: Some(wgpu_core::resource::BufferMapCallback::from_rust(callback)),
|
||||
}
|
||||
))
|
||||
},
|
||||
)
|
||||
.err();
|
||||
|
||||
if maybe_err.is_some() {
|
||||
@ -124,7 +125,8 @@ pub async fn op_webgpu_buffer_get_map_async(
|
||||
{
|
||||
let state = state.borrow();
|
||||
let instance = state.borrow::<super::Instance>();
|
||||
gfx_select!(device => instance.device_poll(device, wgpu_types::Maintain::wait()))
|
||||
instance
|
||||
.device_poll(device, wgpu_types::Maintain::wait())
|
||||
.unwrap();
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
@ -157,11 +159,8 @@ pub fn op_webgpu_buffer_get_mapped_range(
|
||||
let buffer_resource = state.resource_table.get::<WebGpuBuffer>(buffer_rid)?;
|
||||
let buffer = buffer_resource.1;
|
||||
|
||||
let (slice_pointer, range_size) = gfx_select!(buffer => instance.buffer_get_mapped_range(
|
||||
buffer,
|
||||
offset,
|
||||
size
|
||||
))
|
||||
let (slice_pointer, range_size) = instance
|
||||
.buffer_get_mapped_range(buffer, offset, size)
|
||||
.map_err(|e| DomExceptionOperationError::new(&e.to_string()))?;
|
||||
|
||||
// SAFETY: guarantee to be safe from wgpu
|
||||
@ -199,5 +198,5 @@ pub fn op_webgpu_buffer_unmap(
|
||||
slice.copy_from_slice(buf);
|
||||
}
|
||||
|
||||
gfx_ok!(buffer => instance.buffer_unmap(buffer))
|
||||
gfx_ok!(instance.buffer_unmap(buffer))
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ impl Resource for WebGpuRenderBundle {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.render_bundle_drop(self.1));
|
||||
self.0.render_bundle_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ pub fn op_webgpu_render_bundle_encoder_finish(
|
||||
.into_inner();
|
||||
let instance = state.borrow::<super::Instance>();
|
||||
|
||||
gfx_put!(render_bundle_encoder.parent() => instance.render_bundle_encoder_finish(
|
||||
gfx_put!(instance.render_bundle_encoder_finish(
|
||||
render_bundle_encoder,
|
||||
&wgpu_core::command::RenderBundleDescriptor {
|
||||
label: Some(label),
|
||||
|
@ -23,7 +23,7 @@ impl Resource for WebGpuCommandEncoder {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.command_encoder_drop(self.1));
|
||||
self.0.command_encoder_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ impl Resource for WebGpuCommandBuffer {
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
if let Some(id) = *self.1.borrow() {
|
||||
gfx_select!(id => self.0.command_buffer_drop(id));
|
||||
self.0.command_buffer_drop(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ pub fn op_webgpu_create_command_encoder(
|
||||
|
||||
let descriptor = wgpu_types::CommandEncoderDescriptor { label: Some(label) };
|
||||
|
||||
gfx_put!(device => instance.device_create_command_encoder(
|
||||
gfx_put!(instance.device_create_command_encoder(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
@ -210,7 +210,8 @@ pub fn op_webgpu_command_encoder_begin_render_pass(
|
||||
occlusion_query_set: occlusion_query_set_resource,
|
||||
};
|
||||
|
||||
let (render_pass, error) = gfx_select!(command_encoder => instance.command_encoder_create_render_pass_dyn(*command_encoder, &descriptor));
|
||||
let (render_pass, error) =
|
||||
instance.command_encoder_create_render_pass_dyn(*command_encoder, &descriptor);
|
||||
let rid = state
|
||||
.resource_table
|
||||
.add(super::render_pass::WebGpuRenderPass(RefCell::new(
|
||||
@ -262,7 +263,8 @@ pub fn op_webgpu_command_encoder_begin_compute_pass(
|
||||
timestamp_writes: timestamp_writes.as_ref(),
|
||||
};
|
||||
|
||||
let (compute_pass, error) = gfx_select!(command_encoder => instance.command_encoder_create_compute_pass_dyn(*command_encoder, &descriptor));
|
||||
let (compute_pass, error) =
|
||||
instance.command_encoder_create_compute_pass_dyn(*command_encoder, &descriptor);
|
||||
let rid = state
|
||||
.resource_table
|
||||
.add(super::compute_pass::WebGpuComputePass(RefCell::new(
|
||||
@ -297,7 +299,7 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_buffer(
|
||||
.get::<super::buffer::WebGpuBuffer>(destination)?;
|
||||
let destination_buffer = destination_buffer_resource.1;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_copy_buffer_to_buffer(
|
||||
gfx_ok!(instance.command_encoder_copy_buffer_to_buffer(
|
||||
command_encoder,
|
||||
source_buffer,
|
||||
source_offset,
|
||||
@ -360,7 +362,7 @@ pub fn op_webgpu_command_encoder_copy_buffer_to_texture(
|
||||
origin: destination.origin,
|
||||
aspect: destination.aspect,
|
||||
};
|
||||
gfx_ok!(command_encoder => instance.command_encoder_copy_buffer_to_texture(
|
||||
gfx_ok!(instance.command_encoder_copy_buffer_to_texture(
|
||||
command_encoder,
|
||||
&source,
|
||||
&destination,
|
||||
@ -403,7 +405,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_buffer(
|
||||
rows_per_image: destination.rows_per_image,
|
||||
},
|
||||
};
|
||||
gfx_ok!(command_encoder => instance.command_encoder_copy_texture_to_buffer(
|
||||
gfx_ok!(instance.command_encoder_copy_texture_to_buffer(
|
||||
command_encoder,
|
||||
&source,
|
||||
&destination,
|
||||
@ -444,7 +446,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
|
||||
origin: destination.origin,
|
||||
aspect: destination.aspect,
|
||||
};
|
||||
gfx_ok!(command_encoder => instance.command_encoder_copy_texture_to_texture(
|
||||
gfx_ok!(instance.command_encoder_copy_texture_to_texture(
|
||||
command_encoder,
|
||||
&source,
|
||||
&destination,
|
||||
@ -470,7 +472,7 @@ pub fn op_webgpu_command_encoder_clear_buffer(
|
||||
.resource_table
|
||||
.get::<super::buffer::WebGpuBuffer>(buffer_rid)?;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_clear_buffer(
|
||||
gfx_ok!(instance.command_encoder_clear_buffer(
|
||||
command_encoder,
|
||||
destination_resource.1,
|
||||
offset,
|
||||
@ -491,7 +493,7 @@ pub fn op_webgpu_command_encoder_push_debug_group(
|
||||
.get::<WebGpuCommandEncoder>(command_encoder_rid)?;
|
||||
let command_encoder = command_encoder_resource.1;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_push_debug_group(command_encoder, group_label))
|
||||
gfx_ok!(instance.command_encoder_push_debug_group(command_encoder, group_label))
|
||||
}
|
||||
|
||||
#[op2]
|
||||
@ -506,7 +508,7 @@ pub fn op_webgpu_command_encoder_pop_debug_group(
|
||||
.get::<WebGpuCommandEncoder>(command_encoder_rid)?;
|
||||
let command_encoder = command_encoder_resource.1;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_pop_debug_group(command_encoder))
|
||||
gfx_ok!(instance.command_encoder_pop_debug_group(command_encoder))
|
||||
}
|
||||
|
||||
#[op2]
|
||||
@ -522,10 +524,7 @@ pub fn op_webgpu_command_encoder_insert_debug_marker(
|
||||
.get::<WebGpuCommandEncoder>(command_encoder_rid)?;
|
||||
let command_encoder = command_encoder_resource.1;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_insert_debug_marker(
|
||||
command_encoder,
|
||||
marker_label
|
||||
))
|
||||
gfx_ok!(instance.command_encoder_insert_debug_marker(command_encoder, marker_label))
|
||||
}
|
||||
|
||||
#[op2]
|
||||
@ -545,7 +544,7 @@ pub fn op_webgpu_command_encoder_write_timestamp(
|
||||
.resource_table
|
||||
.get::<super::WebGpuQuerySet>(query_set)?;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_write_timestamp(
|
||||
gfx_ok!(instance.command_encoder_write_timestamp(
|
||||
command_encoder,
|
||||
query_set_resource.1,
|
||||
query_index
|
||||
@ -575,7 +574,7 @@ pub fn op_webgpu_command_encoder_resolve_query_set(
|
||||
.resource_table
|
||||
.get::<super::buffer::WebGpuBuffer>(destination)?;
|
||||
|
||||
gfx_ok!(command_encoder => instance.command_encoder_resolve_query_set(
|
||||
gfx_ok!(instance.command_encoder_resolve_query_set(
|
||||
command_encoder,
|
||||
query_set_resource.1,
|
||||
first_query,
|
||||
@ -600,10 +599,7 @@ pub fn op_webgpu_command_encoder_finish(
|
||||
|
||||
let descriptor = wgpu_types::CommandBufferDescriptor { label: Some(label) };
|
||||
|
||||
let (val, maybe_err) = gfx_select!(command_encoder => instance.command_encoder_finish(
|
||||
command_encoder,
|
||||
&descriptor
|
||||
));
|
||||
let (val, maybe_err) = instance.command_encoder_finish(command_encoder, &descriptor);
|
||||
|
||||
let rid = state.resource_table.add(WebGpuCommandBuffer(
|
||||
instance.clone(),
|
||||
|
@ -23,32 +23,17 @@ pub const UNSTABLE_FEATURE_NAME: &str = "webgpu";
|
||||
|
||||
#[macro_use]
|
||||
mod macros {
|
||||
// TODO(#5124): remove this macro.
|
||||
macro_rules! gfx_select {
|
||||
($id:expr => $p0:ident.$p1:tt.$method:ident $params:tt) => {
|
||||
gfx_select!($id => {$p0.$p1}, $method $params)
|
||||
};
|
||||
|
||||
($id:expr => $p0:ident.$method:ident $params:tt) => {
|
||||
gfx_select!($id => {$p0}, $method $params)
|
||||
};
|
||||
|
||||
($id:expr => {$($c:tt)*}, $method:ident $params:tt) => {
|
||||
$($c)*.$method $params
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! gfx_put {
|
||||
($id:expr => $global:ident.$method:ident( $($param:expr),* ) => $state:expr, $rc:expr) => {{
|
||||
let (val, maybe_err) = gfx_select!($id => $global.$method($($param),*));
|
||||
($global:ident.$method:ident( $($param:expr),* ) => $state:expr, $rc:expr) => {{
|
||||
let (val, maybe_err) = $global.$method($($param),*);
|
||||
let rid = $state.resource_table.add($rc($global.clone(), val));
|
||||
Ok(WebGpuResult::rid_err(rid, maybe_err))
|
||||
}};
|
||||
}
|
||||
|
||||
macro_rules! gfx_ok {
|
||||
($id:expr => $global:ident.$method:ident( $($param:expr),* )) => {{
|
||||
let maybe_err = gfx_select!($id => $global.$method($($param),*)).err();
|
||||
($global:ident.$method:ident( $($param:expr),* )) => {{
|
||||
let maybe_err = $global.$method($($param),*).err();
|
||||
Ok(WebGpuResult::maybe_err(maybe_err))
|
||||
}};
|
||||
}
|
||||
@ -78,7 +63,7 @@ impl Resource for WebGpuAdapter {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.adapter_drop(self.1));
|
||||
self.0.adapter_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +74,7 @@ impl Resource for WebGpuDevice {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.device_drop(self.1));
|
||||
self.0.device_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +85,7 @@ impl Resource for WebGpuQuerySet {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.query_set_drop(self.1));
|
||||
self.0.query_set_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,9 +414,9 @@ pub fn op_webgpu_request_adapter(
|
||||
})
|
||||
}
|
||||
};
|
||||
let adapter_features = gfx_select!(adapter => instance.adapter_features(adapter))?;
|
||||
let adapter_features = instance.adapter_features(adapter)?;
|
||||
let features = deserialize_features(&adapter_features);
|
||||
let adapter_limits = gfx_select!(adapter => instance.adapter_limits(adapter))?;
|
||||
let adapter_limits = instance.adapter_limits(adapter)?;
|
||||
|
||||
let instance = instance.clone();
|
||||
|
||||
@ -664,21 +649,24 @@ pub fn op_webgpu_request_device(
|
||||
memory_hints: wgpu_types::MemoryHints::default(),
|
||||
};
|
||||
|
||||
let (device, queue, maybe_err) = gfx_select!(adapter => instance.adapter_request_device(
|
||||
let (device, queue, maybe_err) = instance.adapter_request_device(
|
||||
adapter,
|
||||
&descriptor,
|
||||
std::env::var("DENO_WEBGPU_TRACE").ok().as_ref().map(std::path::Path::new),
|
||||
std::env::var("DENO_WEBGPU_TRACE")
|
||||
.ok()
|
||||
.as_ref()
|
||||
.map(std::path::Path::new),
|
||||
None,
|
||||
None
|
||||
));
|
||||
None,
|
||||
);
|
||||
adapter_resource.close();
|
||||
if let Some(err) = maybe_err {
|
||||
return Err(DomExceptionOperationError::new(&err.to_string()).into());
|
||||
}
|
||||
|
||||
let device_features = gfx_select!(device => instance.device_features(device))?;
|
||||
let device_features = instance.device_features(device)?;
|
||||
let features = deserialize_features(&device_features);
|
||||
let limits = gfx_select!(device => instance.device_limits(device))?;
|
||||
let limits = instance.device_limits(device)?;
|
||||
|
||||
let instance = instance.clone();
|
||||
let instance2 = instance.clone();
|
||||
@ -717,7 +705,7 @@ pub fn op_webgpu_request_adapter_info(
|
||||
let adapter = adapter_resource.1;
|
||||
let instance = state.borrow::<Instance>();
|
||||
|
||||
let info = gfx_select!(adapter => instance.adapter_get_info(adapter))?;
|
||||
let info = instance.adapter_get_info(adapter)?;
|
||||
adapter_resource.close();
|
||||
|
||||
Ok(GPUAdapterInfo {
|
||||
@ -770,7 +758,7 @@ pub fn op_webgpu_create_query_set(
|
||||
count: args.count,
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_query_set(
|
||||
gfx_put!(instance.device_create_query_set(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
|
@ -24,7 +24,7 @@ impl Resource for WebGpuPipelineLayout {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.pipeline_layout_drop(self.1));
|
||||
self.0.pipeline_layout_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ impl Resource for WebGpuComputePipeline {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.compute_pipeline_drop(self.1));
|
||||
self.0.compute_pipeline_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ impl Resource for WebGpuRenderPipeline {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.render_pipeline_drop(self.1));
|
||||
self.0.render_pipeline_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,12 +116,8 @@ pub fn op_webgpu_create_compute_pipeline(
|
||||
cache: None,
|
||||
};
|
||||
|
||||
let (compute_pipeline, maybe_err) = gfx_select!(device => instance.device_create_compute_pipeline(
|
||||
device,
|
||||
&descriptor,
|
||||
None,
|
||||
None,
|
||||
));
|
||||
let (compute_pipeline, maybe_err) =
|
||||
instance.device_create_compute_pipeline(device, &descriptor, None, None);
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
@ -150,7 +146,8 @@ pub fn op_webgpu_compute_pipeline_get_bind_group_layout(
|
||||
.get::<WebGpuComputePipeline>(compute_pipeline_rid)?;
|
||||
let compute_pipeline = compute_pipeline_resource.1;
|
||||
|
||||
let (bind_group_layout, maybe_err) = gfx_select!(compute_pipeline => instance.compute_pipeline_get_bind_group_layout(compute_pipeline, index, None));
|
||||
let (bind_group_layout, maybe_err) =
|
||||
instance.compute_pipeline_get_bind_group_layout(compute_pipeline, index, None);
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
@ -383,12 +380,8 @@ pub fn op_webgpu_create_render_pipeline(
|
||||
cache: None,
|
||||
};
|
||||
|
||||
let (render_pipeline, maybe_err) = gfx_select!(device => instance.device_create_render_pipeline(
|
||||
device,
|
||||
&descriptor,
|
||||
None,
|
||||
None,
|
||||
));
|
||||
let (render_pipeline, maybe_err) =
|
||||
instance.device_create_render_pipeline(device, &descriptor, None, None);
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
@ -410,7 +403,8 @@ pub fn op_webgpu_render_pipeline_get_bind_group_layout(
|
||||
.get::<WebGpuRenderPipeline>(render_pipeline_rid)?;
|
||||
let render_pipeline = render_pipeline_resource.1;
|
||||
|
||||
let (bind_group_layout, maybe_err) = gfx_select!(render_pipeline => instance.render_pipeline_get_bind_group_layout(render_pipeline, index, None));
|
||||
let (bind_group_layout, maybe_err) =
|
||||
instance.render_pipeline_get_bind_group_layout(render_pipeline, index, None);
|
||||
|
||||
let rid = state
|
||||
.resource_table
|
||||
|
@ -20,7 +20,7 @@ impl Resource for WebGpuQueue {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.queue_drop(self.1));
|
||||
self.0.queue_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ pub fn op_webgpu_queue_submit(
|
||||
})
|
||||
.collect::<Result<Vec<_>, AnyError>>()?;
|
||||
|
||||
let maybe_err = gfx_select!(queue => instance.queue_submit(queue, &ids)).err();
|
||||
let maybe_err = instance.queue_submit(queue, &ids).err();
|
||||
|
||||
for rid in command_buffers {
|
||||
let resource = state.resource_table.take::<WebGpuCommandBuffer>(rid)?;
|
||||
@ -95,12 +95,8 @@ pub fn op_webgpu_write_buffer(
|
||||
Some(size) => &buf[data_offset..(data_offset + size)],
|
||||
None => &buf[data_offset..],
|
||||
};
|
||||
let maybe_err = gfx_select!(queue => instance.queue_write_buffer(
|
||||
queue,
|
||||
buffer,
|
||||
buffer_offset,
|
||||
data
|
||||
))
|
||||
let maybe_err = instance
|
||||
.queue_write_buffer(queue, buffer, buffer_offset, data)
|
||||
.err();
|
||||
|
||||
Ok(WebGpuResult::maybe_err(maybe_err))
|
||||
@ -131,11 +127,5 @@ pub fn op_webgpu_write_texture(
|
||||
};
|
||||
let data_layout = data_layout.into();
|
||||
|
||||
gfx_ok!(queue => instance.queue_write_texture(
|
||||
queue,
|
||||
&destination,
|
||||
buf,
|
||||
&data_layout,
|
||||
&size
|
||||
))
|
||||
gfx_ok!(instance.queue_write_texture(queue, &destination, buf, &data_layout, &size))
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ impl Resource for WebGpuSampler {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.sampler_drop(self.1));
|
||||
self.0.sampler_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ pub fn op_webgpu_create_sampler(
|
||||
border_color: None, // native-only
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_sampler(
|
||||
gfx_put!(instance.device_create_sampler(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
|
@ -20,7 +20,7 @@ impl Resource for WebGpuShaderModule {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.shader_module_drop(self.1));
|
||||
self.0.shader_module_drop(self.1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ pub fn op_webgpu_create_shader_module(
|
||||
shader_bound_checks: wgpu_types::ShaderBoundChecks::default(),
|
||||
};
|
||||
|
||||
gfx_put!(device => instance.device_create_shader_module(
|
||||
gfx_put!(instance.device_create_shader_module(
|
||||
device,
|
||||
&descriptor,
|
||||
source,
|
||||
|
@ -63,7 +63,7 @@ pub fn op_webgpu_surface_configure(
|
||||
desired_maximum_frame_latency: 2,
|
||||
};
|
||||
|
||||
let err = gfx_select!(device => instance.surface_configure(surface, device, &conf));
|
||||
let err = instance.surface_configure(surface, device, &conf);
|
||||
|
||||
Ok(WebGpuResult::maybe_err(err))
|
||||
}
|
||||
@ -79,7 +79,7 @@ pub fn op_webgpu_surface_get_current_texture(
|
||||
let surface_resource = state.resource_table.get::<WebGpuSurface>(surface_rid)?;
|
||||
let surface = surface_resource.1;
|
||||
|
||||
let output = gfx_select!(device => instance.surface_get_current_texture(surface, None))?;
|
||||
let output = instance.surface_get_current_texture(surface, None)?;
|
||||
|
||||
match output.status {
|
||||
SurfaceStatus::Good | SurfaceStatus::Suboptimal => {
|
||||
|
@ -24,7 +24,7 @@ impl Resource for WebGpuTexture {
|
||||
fn close(self: Rc<Self>) {
|
||||
if self.owned {
|
||||
let instance = &self.instance;
|
||||
gfx_select!(self.id => instance.texture_drop(self.id));
|
||||
instance.texture_drop(self.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ impl Resource for WebGpuTextureView {
|
||||
}
|
||||
|
||||
fn close(self: Rc<Self>) {
|
||||
gfx_select!(self.1 => self.0.texture_view_drop(self.1)).unwrap();
|
||||
self.0.texture_view_drop(self.1).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,11 +80,7 @@ pub fn op_webgpu_create_texture(
|
||||
view_formats: args.view_formats,
|
||||
};
|
||||
|
||||
let (val, maybe_err) = gfx_select!(device => instance.device_create_texture(
|
||||
device,
|
||||
&descriptor,
|
||||
None
|
||||
));
|
||||
let (val, maybe_err) = instance.device_create_texture(device, &descriptor, None);
|
||||
|
||||
let rid = state.resource_table.add(WebGpuTexture {
|
||||
instance: instance.clone(),
|
||||
@ -125,7 +121,7 @@ pub fn op_webgpu_create_texture_view(
|
||||
range: args.range,
|
||||
};
|
||||
|
||||
gfx_put!(texture => instance.texture_create_view(
|
||||
gfx_put!(instance.texture_create_view(
|
||||
texture,
|
||||
&descriptor,
|
||||
None
|
||||
|
@ -3,7 +3,7 @@
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn main() {
|
||||
use player::GlobalPlay as _;
|
||||
use wgc::{device::trace, gfx_select};
|
||||
use wgc::device::trace;
|
||||
|
||||
use std::{
|
||||
fs,
|
||||
@ -78,17 +78,17 @@ fn main() {
|
||||
)
|
||||
.expect("Unable to find an adapter for selected backend");
|
||||
|
||||
let info = gfx_select!(adapter => global.adapter_get_info(adapter)).unwrap();
|
||||
let info = global.adapter_get_info(adapter).unwrap();
|
||||
log::info!("Picked '{}'", info.name);
|
||||
let device_id = wgc::id::Id::zip(1, 0, backend);
|
||||
let queue_id = wgc::id::Id::zip(1, 0, backend);
|
||||
let (_, _, error) = gfx_select!(adapter => global.adapter_request_device(
|
||||
let (_, _, error) = global.adapter_request_device(
|
||||
adapter,
|
||||
&desc,
|
||||
None,
|
||||
Some(device_id),
|
||||
Some(queue_id)
|
||||
));
|
||||
Some(queue_id),
|
||||
);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
@ -100,14 +100,14 @@ fn main() {
|
||||
log::info!("Executing actions");
|
||||
#[cfg(not(feature = "winit"))]
|
||||
{
|
||||
gfx_select!(device => global.device_start_capture(device));
|
||||
global.device_start_capture(device);
|
||||
|
||||
while let Some(action) = actions.pop() {
|
||||
gfx_select!(device => global.process(device, queue, action, &dir, &mut command_buffer_id_manager));
|
||||
global.process(device, queue, action, &dir, &mut command_buffer_id_manager);
|
||||
}
|
||||
|
||||
gfx_select!(device => global.device_stop_capture(device));
|
||||
gfx_select!(device => global.device_poll(device, wgt::Maintain::wait())).unwrap();
|
||||
global.device_stop_capture(device);
|
||||
global.device_poll(device, wgt::Maintain::wait()).unwrap();
|
||||
}
|
||||
#[cfg(feature = "winit")]
|
||||
{
|
||||
@ -119,27 +119,30 @@ fn main() {
|
||||
let mut resize_config = None;
|
||||
let mut frame_count = 0;
|
||||
let mut done = false;
|
||||
event_loop.run(move |event, target| {
|
||||
event_loop
|
||||
.run(move |event, target| {
|
||||
target.set_control_flow(ControlFlow::Poll);
|
||||
|
||||
match event {
|
||||
Event::WindowEvent { event, .. } => match event {
|
||||
WindowEvent::RedrawRequested if resize_config.is_none() => {
|
||||
|
||||
match actions.pop() {
|
||||
Some(trace::Action::ConfigureSurface(_device_id, config)) => {
|
||||
log::info!("Configuring the surface");
|
||||
let current_size: (u32, u32) = window.inner_size().into();
|
||||
let size = (config.width, config.height);
|
||||
if current_size != size {
|
||||
let _ = window.request_inner_size(winit::dpi::PhysicalSize::new(
|
||||
let _ = window.request_inner_size(
|
||||
winit::dpi::PhysicalSize::new(
|
||||
config.width,
|
||||
config.height,
|
||||
));
|
||||
),
|
||||
);
|
||||
resize_config = Some(config);
|
||||
target.exit();
|
||||
} else {
|
||||
let error = gfx_select!(device => global.surface_configure(surface, device, &config));
|
||||
let error =
|
||||
global.surface_configure(surface, device, &config);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
@ -148,16 +151,22 @@ fn main() {
|
||||
Some(trace::Action::Present(id)) => {
|
||||
frame_count += 1;
|
||||
log::debug!("Presenting frame {}", frame_count);
|
||||
gfx_select!(device => global.surface_present(id)).unwrap();
|
||||
global.surface_present(id).unwrap();
|
||||
target.exit();
|
||||
}
|
||||
Some(trace::Action::DiscardSurfaceTexture(id)) => {
|
||||
log::debug!("Discarding frame {}", frame_count);
|
||||
gfx_select!(device => global.surface_texture_discard(id)).unwrap();
|
||||
global.surface_texture_discard(id).unwrap();
|
||||
target.exit();
|
||||
}
|
||||
Some(action) => {
|
||||
gfx_select!(device => global.process(device, queue, action, &dir, &mut command_buffer_id_manager));
|
||||
global.process(
|
||||
device,
|
||||
queue,
|
||||
action,
|
||||
&dir,
|
||||
&mut command_buffer_id_manager,
|
||||
);
|
||||
}
|
||||
None => {
|
||||
if !done {
|
||||
@ -167,17 +176,18 @@ fn main() {
|
||||
target.exit();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
WindowEvent::Resized(_) => {
|
||||
if let Some(config) = resize_config.take() {
|
||||
let error = gfx_select!(device => global.surface_configure(surface, device, &config));
|
||||
let error = global.surface_configure(surface, device, &config);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
WindowEvent::KeyboardInput {
|
||||
event: KeyEvent {
|
||||
event:
|
||||
KeyEvent {
|
||||
logical_key: Key::Named(NamedKey::Escape),
|
||||
state: ElementState::Pressed,
|
||||
..
|
||||
@ -189,11 +199,12 @@ fn main() {
|
||||
},
|
||||
Event::LoopExiting => {
|
||||
log::info!("Closing");
|
||||
gfx_select!(device => global.device_poll(device, wgt::Maintain::wait())).unwrap();
|
||||
global.device_poll(device, wgt::Maintain::wait()).unwrap();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ impl Test<'_> {
|
||||
let backend = adapter.backend();
|
||||
let device_id = wgc::id::Id::zip(test_num, 0, backend);
|
||||
let queue_id = wgc::id::Id::zip(test_num, 0, backend);
|
||||
let (_, _, error) = wgc::gfx_select!(adapter => global.adapter_request_device(
|
||||
let (_, _, error) = global.adapter_request_device(
|
||||
adapter,
|
||||
&wgt::DeviceDescriptor {
|
||||
label: None,
|
||||
@ -117,8 +117,8 @@ impl Test<'_> {
|
||||
},
|
||||
None,
|
||||
Some(device_id),
|
||||
Some(queue_id)
|
||||
));
|
||||
Some(queue_id),
|
||||
);
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
}
|
||||
@ -126,34 +126,46 @@ impl Test<'_> {
|
||||
let mut command_buffer_id_manager = wgc::identity::IdentityManager::new();
|
||||
println!("\t\t\tRunning...");
|
||||
for action in self.actions {
|
||||
wgc::gfx_select!(device_id => global.process(device_id, queue_id, action, dir, &mut command_buffer_id_manager));
|
||||
global.process(
|
||||
device_id,
|
||||
queue_id,
|
||||
action,
|
||||
dir,
|
||||
&mut command_buffer_id_manager,
|
||||
);
|
||||
}
|
||||
println!("\t\t\tMapping...");
|
||||
for expect in &self.expectations {
|
||||
let buffer = wgc::id::Id::zip(expect.buffer.index, expect.buffer.epoch, backend);
|
||||
wgc::gfx_select!(device_id => global.buffer_map_async(
|
||||
global
|
||||
.buffer_map_async(
|
||||
buffer,
|
||||
expect.offset,
|
||||
Some(expect.data.len() as u64),
|
||||
wgc::resource::BufferMapOperation {
|
||||
host: wgc::device::HostMap::Read,
|
||||
callback: Some(wgc::resource::BufferMapCallback::from_rust(
|
||||
Box::new(map_callback)
|
||||
)),
|
||||
}
|
||||
))
|
||||
callback: Some(wgc::resource::BufferMapCallback::from_rust(Box::new(
|
||||
map_callback,
|
||||
))),
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
println!("\t\t\tWaiting...");
|
||||
wgc::gfx_select!(device_id => global.device_poll(device_id, wgt::Maintain::wait()))
|
||||
global
|
||||
.device_poll(device_id, wgt::Maintain::wait())
|
||||
.unwrap();
|
||||
|
||||
for expect in self.expectations {
|
||||
println!("\t\t\tChecking {}", expect.name);
|
||||
let buffer = wgc::id::Id::zip(expect.buffer.index, expect.buffer.epoch, backend);
|
||||
let (ptr, size) =
|
||||
wgc::gfx_select!(device_id => global.buffer_get_mapped_range(buffer, expect.offset, Some(expect.data.len() as wgt::BufferAddress)))
|
||||
let (ptr, size) = global
|
||||
.buffer_get_mapped_range(
|
||||
buffer,
|
||||
expect.offset,
|
||||
Some(expect.data.len() as wgt::BufferAddress),
|
||||
)
|
||||
.unwrap();
|
||||
let contents = unsafe { slice::from_raw_parts(ptr.as_ptr(), size as usize) };
|
||||
let expected_data = match expect.data {
|
||||
@ -231,11 +243,8 @@ impl Corpus {
|
||||
};
|
||||
|
||||
println!("\tBackend {:?}", backend);
|
||||
let supported_features =
|
||||
wgc::gfx_select!(adapter => global.adapter_features(adapter)).unwrap();
|
||||
let downlevel_caps =
|
||||
wgc::gfx_select!(adapter => global.adapter_downlevel_capabilities(adapter))
|
||||
.unwrap();
|
||||
let supported_features = global.adapter_features(adapter).unwrap();
|
||||
let downlevel_caps = global.adapter_downlevel_capabilities(adapter).unwrap();
|
||||
|
||||
let test = Test::load(dir.join(test_path), adapter.backend());
|
||||
if !supported_features.contains(test.features) {
|
||||
|
@ -10,10 +10,7 @@ of course `Debug`.
|
||||
[`id::BufferId`]: crate::id::BufferId
|
||||
|
||||
Each `Id` contains not only an index for the resource it denotes but
|
||||
also a Backend indicating which `wgpu` backend it belongs to. You
|
||||
can use the [`gfx_select`] macro to dynamically dispatch on an id's
|
||||
backend to a function specialized at compile time for a specific
|
||||
backend. See that macro's documentation for details.
|
||||
also a Backend indicating which `wgpu` backend it belongs to.
|
||||
|
||||
`Id`s also incorporate a generation number, for additional validation.
|
||||
|
||||
@ -96,7 +93,6 @@ creation fails, the id supplied for that resource is marked to indicate
|
||||
as much, allowing subsequent operations using that id to be properly
|
||||
flagged as errors as well.
|
||||
|
||||
[`gfx_select`]: crate::gfx_select
|
||||
[`process`]: crate::identity::IdentityManager::process
|
||||
[`Id<R>`]: crate::id::Id
|
||||
[wrapped in a mutex]: trait.IdentityHandler.html#impl-IdentityHandler%3CI%3E-for-Mutex%3CIdentityManager%3E
|
||||
|
@ -153,169 +153,6 @@ If you are running this program on native and not in a browser and wish to work
|
||||
Adapter::downlevel_properties or Device::downlevel_properties to get a listing of the features the current \
|
||||
platform supports.";
|
||||
|
||||
// #[cfg] attributes in exported macros are interesting!
|
||||
//
|
||||
// The #[cfg] conditions in a macro's expansion are evaluated using the
|
||||
// configuration options (features, target architecture and os, etc.) in force
|
||||
// where the macro is *used*, not where it is *defined*. That is, if crate A
|
||||
// defines a macro like this:
|
||||
//
|
||||
// #[macro_export]
|
||||
// macro_rules! if_bleep {
|
||||
// { } => {
|
||||
// #[cfg(feature = "bleep")]
|
||||
// bleep();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// and then crate B uses it like this:
|
||||
//
|
||||
// fn f() {
|
||||
// if_bleep! { }
|
||||
// }
|
||||
//
|
||||
// then it is crate B's `"bleep"` feature, not crate A's, that determines
|
||||
// whether the macro expands to a function call or an empty statement. The
|
||||
// entire configuration predicate is evaluated in the use's context, not the
|
||||
// definition's.
|
||||
//
|
||||
// Since `wgpu-core` selects back ends using features, we need to make sure the
|
||||
// arms of the `gfx_select!` macro are pruned according to `wgpu-core`'s
|
||||
// features, not those of whatever crate happens to be using `gfx_select!`. This
|
||||
// means we can't use `#[cfg]` attributes in `gfx_select!`s definition itself.
|
||||
// Instead, for each backend, `gfx_select!` must use a macro whose definition is
|
||||
// selected by `#[cfg]` in `wgpu-core`. The configuration predicate is still
|
||||
// evaluated when the macro is used; we've just moved the `#[cfg]` into a macro
|
||||
// used by `wgpu-core` itself.
|
||||
|
||||
/// Define an exported macro named `$public` that expands to an expression if
|
||||
/// the feature `$feature` is enabled, or to a panic otherwise.
|
||||
///
|
||||
/// This is used in the definition of `gfx_select!`, to dispatch the
|
||||
/// call to the appropriate backend, but panic if that backend was not
|
||||
/// compiled in.
|
||||
///
|
||||
/// For a call like this:
|
||||
///
|
||||
/// ```ignore
|
||||
/// define_backend_caller! { name, private, "feature" if cfg_condition }
|
||||
/// ```
|
||||
///
|
||||
/// define a macro `name`, used like this:
|
||||
///
|
||||
/// ```ignore
|
||||
/// name!(expr)
|
||||
/// ```
|
||||
///
|
||||
/// that expands to `expr` if `#[cfg(cfg_condition)]` is enabled, or a
|
||||
/// panic otherwise. The panic message complains that `"feature"` is
|
||||
/// not enabled.
|
||||
///
|
||||
/// Because of odd technical limitations on exporting macros expanded
|
||||
/// by other macros, you must supply both a public-facing name for the
|
||||
/// macro and a private name, `$private`, which is never used
|
||||
/// outside this macro. For details:
|
||||
/// <https://github.com/rust-lang/rust/pull/52234#issuecomment-976702997>
|
||||
macro_rules! define_backend_caller {
|
||||
{ $public:ident, $private:ident, $feature:literal if $cfg:meta } => {
|
||||
#[cfg($cfg)]
|
||||
#[macro_export]
|
||||
macro_rules! $private {
|
||||
( $call:expr ) => ( $call )
|
||||
}
|
||||
|
||||
#[cfg(not($cfg))]
|
||||
#[macro_export]
|
||||
macro_rules! $private {
|
||||
( $call:expr ) => (
|
||||
panic!("Identifier refers to disabled backend feature {:?}", $feature)
|
||||
)
|
||||
}
|
||||
|
||||
// See note about rust-lang#52234 above.
|
||||
#[doc(hidden)] pub use $private as $public;
|
||||
}
|
||||
}
|
||||
|
||||
// Define a macro for each `gfx_select!` match arm. For example,
|
||||
//
|
||||
// gfx_if_vulkan!(expr)
|
||||
//
|
||||
// expands to `expr` if the `"vulkan"` feature is enabled, or to a panic
|
||||
// otherwise.
|
||||
define_backend_caller! { gfx_if_vulkan, gfx_if_vulkan_hidden, "vulkan" if all(feature = "vulkan", not(target_arch = "wasm32")) }
|
||||
define_backend_caller! { gfx_if_metal, gfx_if_metal_hidden, "metal" if all(feature = "metal", any(target_os = "macos", target_os = "ios")) }
|
||||
define_backend_caller! { gfx_if_dx12, gfx_if_dx12_hidden, "dx12" if all(feature = "dx12", windows) }
|
||||
define_backend_caller! { gfx_if_gles, gfx_if_gles_hidden, "gles" if feature = "gles" }
|
||||
define_backend_caller! { gfx_if_empty, gfx_if_empty_hidden, "empty" if all(
|
||||
not(any(feature = "metal", feature = "vulkan", feature = "gles")),
|
||||
any(target_os = "macos", target_os = "ios"),
|
||||
) }
|
||||
|
||||
/// Dispatch on an [`Id`]'s backend to a backend-generic method.
|
||||
///
|
||||
/// Uses of this macro have the form:
|
||||
///
|
||||
/// ```ignore
|
||||
///
|
||||
/// gfx_select!(id => value.method(args...))
|
||||
///
|
||||
/// ```
|
||||
///
|
||||
/// This expands to an expression that calls `value.method::<A>(args...)` for
|
||||
/// the backend `A` selected by `id`. The expansion matches on `id.backend()`,
|
||||
/// with an arm for each backend type in [`wgpu_types::Backend`] which calls the
|
||||
/// specialization of `method` for the given backend. This allows resource
|
||||
/// identifiers to select backends dynamically, even though many `wgpu_core`
|
||||
/// methods are compiled and optimized for a specific back end.
|
||||
///
|
||||
/// This macro is typically used to call methods on [`wgpu_core::global::Global`],
|
||||
/// many of which take a single `hal::Api` type parameter. For example, to
|
||||
/// create a new buffer on the device indicated by `device_id`, one would say:
|
||||
///
|
||||
/// ```ignore
|
||||
/// gfx_select!(device_id => global.device_create_buffer(device_id, ...))
|
||||
/// ```
|
||||
///
|
||||
/// where the `device_create_buffer` method is defined like this:
|
||||
///
|
||||
/// ```ignore
|
||||
/// impl Global {
|
||||
/// pub fn device_create_buffer<A: HalApi>(&self, ...) -> ...
|
||||
/// { ... }
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// That `gfx_select!` call uses `device_id`'s backend to select the right
|
||||
/// backend type `A` for a call to `Global::device_create_buffer<A>`.
|
||||
///
|
||||
/// However, there's nothing about this macro that is specific to `hub::Global`.
|
||||
/// For example, Firefox's embedding of `wgpu_core` defines its own types with
|
||||
/// methods that take `hal::Api` type parameters. Firefox uses `gfx_select!` to
|
||||
/// dynamically dispatch to the right specialization based on the resource's id.
|
||||
///
|
||||
/// [`wgpu_types::Backend`]: wgt::Backend
|
||||
/// [`wgpu_core::global::Global`]: crate::global::Global
|
||||
/// [`Id`]: id::Id
|
||||
//
|
||||
// TODO(#5124): Remove this altogether.
|
||||
#[macro_export]
|
||||
macro_rules! gfx_select {
|
||||
// Simple two-component expression, like `self.0.method(..)`.
|
||||
($id:expr => $c0:ident.$c1:tt.$method:ident $params:tt) => {
|
||||
$crate::gfx_select!($id => {$c0.$c1}, $method $params)
|
||||
};
|
||||
|
||||
// Simple identifier-only expression, like `global.method(..)`.
|
||||
($id:expr => $c0:ident.$method:ident $params:tt) => {
|
||||
$crate::gfx_select!($id => {$c0}, $method $params)
|
||||
};
|
||||
|
||||
($id:expr => {$($c:tt)*}, $method:ident $params:tt) => {
|
||||
$($c)*.$method $params
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "api_log_info")]
|
||||
macro_rules! api_log {
|
||||
($($arg:tt)+) => (log::info!($($arg)+))
|
||||
|
@ -25,8 +25,8 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
use wgc::{
|
||||
command::bundle_ffi::*, device::DeviceLostClosure, gfx_select, id::CommandEncoderId,
|
||||
id::TextureViewId, pipeline::CreateShaderModuleError,
|
||||
command::bundle_ffi::*, device::DeviceLostClosure, id::CommandEncoderId, id::TextureViewId,
|
||||
pipeline::CreateShaderModuleError,
|
||||
};
|
||||
use wgt::WasmNotSendSync;
|
||||
|
||||
@ -646,13 +646,13 @@ impl crate::Context for ContextWgpuCore {
|
||||
if trace_dir.is_some() {
|
||||
log::error!("Feature 'trace' has been removed temporarily, see https://github.com/gfx-rs/wgpu/issues/5974");
|
||||
}
|
||||
let (device_id, queue_id, error) = wgc::gfx_select!(*adapter => self.0.adapter_request_device(
|
||||
let (device_id, queue_id, error) = self.0.adapter_request_device(
|
||||
*adapter,
|
||||
&desc.map_label(|l| l.map(Borrowed)),
|
||||
None,
|
||||
None,
|
||||
None
|
||||
));
|
||||
None,
|
||||
);
|
||||
if let Some(err) = error {
|
||||
return ready(Err(err.into()));
|
||||
}
|
||||
@ -683,7 +683,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
surface: &Self::SurfaceId,
|
||||
_surface_data: &Self::SurfaceData,
|
||||
) -> bool {
|
||||
match wgc::gfx_select!(adapter => self.0.adapter_is_surface_supported(*adapter, *surface)) {
|
||||
match self.0.adapter_is_surface_supported(*adapter, *surface) {
|
||||
Ok(result) => result,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::is_surface_supported"),
|
||||
}
|
||||
@ -694,7 +694,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &Self::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> Features {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_features(*adapter)) {
|
||||
match self.0.adapter_features(*adapter) {
|
||||
Ok(features) => features,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::features"),
|
||||
}
|
||||
@ -705,7 +705,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &Self::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> Limits {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_limits(*adapter)) {
|
||||
match self.0.adapter_limits(*adapter) {
|
||||
Ok(limits) => limits,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::limits"),
|
||||
}
|
||||
@ -716,7 +716,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &Self::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> DownlevelCapabilities {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_downlevel_capabilities(*adapter)) {
|
||||
match self.0.adapter_downlevel_capabilities(*adapter) {
|
||||
Ok(downlevel) => downlevel,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::downlevel_properties"),
|
||||
}
|
||||
@ -727,7 +727,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &wgc::id::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> AdapterInfo {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_get_info(*adapter)) {
|
||||
match self.0.adapter_get_info(*adapter) {
|
||||
Ok(info) => info,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::get_info"),
|
||||
}
|
||||
@ -739,8 +739,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
_adapter_data: &Self::AdapterData,
|
||||
format: wgt::TextureFormat,
|
||||
) -> wgt::TextureFormatFeatures {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_get_texture_format_features(*adapter, format))
|
||||
{
|
||||
match self.0.adapter_get_texture_format_features(*adapter, format) {
|
||||
Ok(info) => info,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::get_texture_format_features"),
|
||||
}
|
||||
@ -751,7 +750,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &Self::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> wgt::PresentationTimestamp {
|
||||
match wgc::gfx_select!(*adapter => self.0.adapter_get_presentation_timestamp(*adapter)) {
|
||||
match self.0.adapter_get_presentation_timestamp(*adapter) {
|
||||
Ok(timestamp) => timestamp,
|
||||
Err(err) => self.handle_error_fatal(err, "Adapter::correlate_presentation_timestamp"),
|
||||
}
|
||||
@ -764,7 +763,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
adapter: &Self::AdapterId,
|
||||
_adapter_data: &Self::AdapterData,
|
||||
) -> wgt::SurfaceCapabilities {
|
||||
match wgc::gfx_select!(adapter => self.0.surface_get_capabilities(*surface, *adapter)) {
|
||||
match self.0.surface_get_capabilities(*surface, *adapter) {
|
||||
Ok(caps) => caps,
|
||||
Err(wgc::instance::GetSurfaceSupportError::Unsupported) => {
|
||||
wgt::SurfaceCapabilities::default()
|
||||
@ -781,7 +780,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
_device_data: &Self::DeviceData,
|
||||
config: &crate::SurfaceConfiguration,
|
||||
) {
|
||||
let error = wgc::gfx_select!(device => self.0.surface_configure(*surface, *device, config));
|
||||
let error = self.0.surface_configure(*surface, *device, config);
|
||||
if let Some(e) = error {
|
||||
self.handle_error_fatal(e, "Surface::configure");
|
||||
} else {
|
||||
@ -843,14 +842,14 @@ impl crate::Context for ContextWgpuCore {
|
||||
device: &Self::DeviceId,
|
||||
_device_data: &Self::DeviceData,
|
||||
) -> Features {
|
||||
match wgc::gfx_select!(device => self.0.device_features(*device)) {
|
||||
match self.0.device_features(*device) {
|
||||
Ok(features) => features,
|
||||
Err(err) => self.handle_error_fatal(err, "Device::features"),
|
||||
}
|
||||
}
|
||||
|
||||
fn device_limits(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) -> Limits {
|
||||
match wgc::gfx_select!(device => self.0.device_limits(*device)) {
|
||||
match self.0.device_limits(*device) {
|
||||
Ok(limits) => limits,
|
||||
Err(err) => self.handle_error_fatal(err, "Device::limits"),
|
||||
}
|
||||
@ -861,7 +860,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
device: &Self::DeviceId,
|
||||
_device_data: &Self::DeviceData,
|
||||
) -> DownlevelCapabilities {
|
||||
match wgc::gfx_select!(device => self.0.device_downlevel_properties(*device)) {
|
||||
match self.0.device_downlevel_properties(*device) {
|
||||
Ok(limits) => limits,
|
||||
Err(err) => self.handle_error_fatal(err, "Device::downlevel_properties"),
|
||||
}
|
||||
@ -913,9 +912,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
ShaderSource::Naga(module) => wgc::pipeline::ShaderModuleSource::Naga(module),
|
||||
ShaderSource::Dummy(_) => panic!("found `ShaderSource::Dummy`"),
|
||||
};
|
||||
let (id, error) = wgc::gfx_select!(
|
||||
device => self.0.device_create_shader_module(*device, &descriptor, source, None)
|
||||
);
|
||||
let (id, error) = self
|
||||
.0
|
||||
.device_create_shader_module(*device, &descriptor, source, None);
|
||||
let compilation_info = match error {
|
||||
Some(cause) => {
|
||||
self.handle_error(
|
||||
@ -944,9 +943,14 @@ impl crate::Context for ContextWgpuCore {
|
||||
// runtime checks
|
||||
shader_bound_checks: unsafe { wgt::ShaderBoundChecks::unchecked() },
|
||||
};
|
||||
let (id, error) = wgc::gfx_select!(
|
||||
device => self.0.device_create_shader_module_spirv(*device, &descriptor, Borrowed(&desc.source), None)
|
||||
);
|
||||
let (id, error) = unsafe {
|
||||
self.0.device_create_shader_module_spirv(
|
||||
*device,
|
||||
&descriptor,
|
||||
Borrowed(&desc.source),
|
||||
None,
|
||||
)
|
||||
};
|
||||
let compilation_info = match error {
|
||||
Some(cause) => {
|
||||
self.handle_error(
|
||||
@ -972,9 +976,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
label: desc.label.map(Borrowed),
|
||||
entries: Borrowed(desc.entries),
|
||||
};
|
||||
let (id, error) = wgc::gfx_select!(
|
||||
device => self.0.device_create_bind_group_layout(*device, &descriptor, None)
|
||||
);
|
||||
let (id, error) = self
|
||||
.0
|
||||
.device_create_bind_group_layout(*device, &descriptor, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1083,11 +1087,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
entries: Borrowed(&entries),
|
||||
};
|
||||
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_bind_group(
|
||||
*device,
|
||||
&descriptor,
|
||||
None
|
||||
));
|
||||
let (id, error) = self.0.device_create_bind_group(*device, &descriptor, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1124,11 +1124,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
push_constant_ranges: Borrowed(desc.push_constant_ranges),
|
||||
};
|
||||
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_pipeline_layout(
|
||||
*device,
|
||||
&descriptor,
|
||||
None
|
||||
));
|
||||
let (id, error) = self
|
||||
.0
|
||||
.device_create_pipeline_layout(*device, &descriptor, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1191,12 +1189,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
cache: desc.cache.map(|c| c.id.into()),
|
||||
};
|
||||
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_render_pipeline(
|
||||
*device,
|
||||
&descriptor,
|
||||
None,
|
||||
None,
|
||||
));
|
||||
let (id, error) = self
|
||||
.0
|
||||
.device_create_render_pipeline(*device, &descriptor, None, None);
|
||||
if let Some(cause) = error {
|
||||
if let wgc::pipeline::CreateRenderPipelineError::Internal { stage, ref error } = cause {
|
||||
log::error!("Shader translation error for stage {:?}: {}", stage, error);
|
||||
@ -1233,12 +1228,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
cache: desc.cache.map(|c| c.id.into()),
|
||||
};
|
||||
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_compute_pipeline(
|
||||
*device,
|
||||
&descriptor,
|
||||
None,
|
||||
None,
|
||||
));
|
||||
let (id, error) = self
|
||||
.0
|
||||
.device_create_compute_pipeline(*device, &descriptor, None, None);
|
||||
if let Some(cause) = error {
|
||||
if let wgc::pipeline::CreateComputePipelineError::Internal(ref error) = cause {
|
||||
log::error!(
|
||||
@ -1271,11 +1263,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
data: desc.data.map(Borrowed),
|
||||
fallback: desc.fallback,
|
||||
};
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_pipeline_cache(
|
||||
*device,
|
||||
&descriptor,
|
||||
None
|
||||
));
|
||||
let (id, error) = unsafe {
|
||||
self.0
|
||||
.device_create_pipeline_cache(*device, &descriptor, None)
|
||||
};
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1293,11 +1284,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
device_data: &Self::DeviceData,
|
||||
desc: &crate::BufferDescriptor<'_>,
|
||||
) -> (Self::BufferId, Self::BufferData) {
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_buffer(
|
||||
*device,
|
||||
&desc.map_label(|l| l.map(Borrowed)),
|
||||
None
|
||||
));
|
||||
let (id, error) =
|
||||
self.0
|
||||
.device_create_buffer(*device, &desc.map_label(|l| l.map(Borrowed)), None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1320,11 +1309,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
desc: &TextureDescriptor<'_>,
|
||||
) -> (Self::TextureId, Self::TextureData) {
|
||||
let wgt_desc = desc.map_label_and_view_formats(|l| l.map(Borrowed), |v| v.to_vec());
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_texture(
|
||||
*device,
|
||||
&wgt_desc,
|
||||
None
|
||||
));
|
||||
let (id, error) = self.0.device_create_texture(*device, &wgt_desc, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1364,11 +1349,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
border_color: desc.border_color,
|
||||
};
|
||||
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_sampler(
|
||||
*device,
|
||||
&descriptor,
|
||||
None
|
||||
));
|
||||
let (id, error) = self.0.device_create_sampler(*device, &descriptor, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1385,11 +1366,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
device_data: &Self::DeviceData,
|
||||
desc: &wgt::QuerySetDescriptor<Label<'_>>,
|
||||
) -> (Self::QuerySetId, Self::QuerySetData) {
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_query_set(
|
||||
*device,
|
||||
&desc.map_label(|l| l.map(Borrowed)),
|
||||
None
|
||||
));
|
||||
let (id, error) =
|
||||
self.0
|
||||
.device_create_query_set(*device, &desc.map_label(|l| l.map(Borrowed)), None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error_nolabel(&device_data.error_sink, cause, "Device::create_query_set");
|
||||
}
|
||||
@ -1401,11 +1380,11 @@ impl crate::Context for ContextWgpuCore {
|
||||
device_data: &Self::DeviceData,
|
||||
desc: &CommandEncoderDescriptor<'_>,
|
||||
) -> (Self::CommandEncoderId, Self::CommandEncoderData) {
|
||||
let (id, error) = wgc::gfx_select!(device => self.0.device_create_command_encoder(
|
||||
let (id, error) = self.0.device_create_command_encoder(
|
||||
*device,
|
||||
&desc.map_label(|l| l.map(Borrowed)),
|
||||
None
|
||||
));
|
||||
None,
|
||||
);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&device_data.error_sink,
|
||||
@ -1442,7 +1421,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
}
|
||||
#[doc(hidden)]
|
||||
fn device_make_invalid(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) {
|
||||
wgc::gfx_select!(device => self.0.device_make_invalid(*device));
|
||||
self.0.device_make_invalid(*device);
|
||||
}
|
||||
#[cfg_attr(not(any(native, Emscripten)), allow(unused))]
|
||||
fn device_drop(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) {
|
||||
@ -1450,13 +1429,13 @@ impl crate::Context for ContextWgpuCore {
|
||||
{
|
||||
// Call device_poll, but don't check for errors. We have to use its
|
||||
// return value, but we just drop it.
|
||||
let _ = wgc::gfx_select!(device => self.0.device_poll(*device, wgt::Maintain::wait()));
|
||||
wgc::gfx_select!(device => self.0.device_drop(*device));
|
||||
let _ = self.0.device_poll(*device, wgt::Maintain::wait());
|
||||
self.0.device_drop(*device);
|
||||
}
|
||||
}
|
||||
#[cfg_attr(target_arch = "wasm32", allow(unused))]
|
||||
fn queue_drop(&self, queue: &Self::QueueId, _device_data: &Self::QueueData) {
|
||||
wgc::gfx_select!(queue => self.0.queue_drop(*queue));
|
||||
self.0.queue_drop(*queue);
|
||||
}
|
||||
fn device_set_device_lost_callback(
|
||||
&self,
|
||||
@ -1465,10 +1444,11 @@ impl crate::Context for ContextWgpuCore {
|
||||
device_lost_callback: crate::context::DeviceLostCallback,
|
||||
) {
|
||||
let device_lost_closure = DeviceLostClosure::from_rust(device_lost_callback);
|
||||
wgc::gfx_select!(device => self.0.device_set_device_lost_closure(*device, device_lost_closure));
|
||||
self.0
|
||||
.device_set_device_lost_closure(*device, device_lost_closure);
|
||||
}
|
||||
fn device_destroy(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) {
|
||||
wgc::gfx_select!(device => self.0.device_destroy(*device));
|
||||
self.0.device_destroy(*device);
|
||||
}
|
||||
fn device_mark_lost(
|
||||
&self,
|
||||
@ -1478,7 +1458,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
) {
|
||||
// We do not provide a reason to device_lose, because all reasons other than
|
||||
// destroyed (which this is not) are "unknown".
|
||||
wgc::gfx_select!(device => self.0.device_mark_lost(*device, message));
|
||||
self.0.device_mark_lost(*device, message);
|
||||
}
|
||||
fn device_poll(
|
||||
&self,
|
||||
@ -1487,10 +1467,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
maintain: crate::Maintain,
|
||||
) -> wgt::MaintainResult {
|
||||
let maintain_inner = maintain.map_index(|i| *i.0.as_ref().downcast_ref().unwrap());
|
||||
match wgc::gfx_select!(device => self.0.device_poll(
|
||||
*device,
|
||||
maintain_inner
|
||||
)) {
|
||||
match self.0.device_poll(*device, maintain_inner) {
|
||||
Ok(done) => match done {
|
||||
true => wgt::MaintainResult::SubmissionQueueEmpty,
|
||||
false => wgt::MaintainResult::Ok,
|
||||
@ -1550,8 +1527,12 @@ impl crate::Context for ContextWgpuCore {
|
||||
))),
|
||||
};
|
||||
|
||||
match wgc::gfx_select!(buffer => self.0.buffer_map_async(*buffer, range.start, Some(range.end-range.start), operation))
|
||||
{
|
||||
match self.0.buffer_map_async(
|
||||
*buffer,
|
||||
range.start,
|
||||
Some(range.end - range.start),
|
||||
operation,
|
||||
) {
|
||||
Ok(()) => (),
|
||||
Err(cause) => {
|
||||
self.handle_error_nolabel(&buffer_data.error_sink, cause, "Buffer::map_async")
|
||||
@ -1565,11 +1546,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
sub_range: Range<wgt::BufferAddress>,
|
||||
) -> Box<dyn crate::context::BufferMappedRange> {
|
||||
let size = sub_range.end - sub_range.start;
|
||||
match wgc::gfx_select!(buffer => self.0.buffer_get_mapped_range(
|
||||
*buffer,
|
||||
sub_range.start,
|
||||
Some(size)
|
||||
)) {
|
||||
match self
|
||||
.0
|
||||
.buffer_get_mapped_range(*buffer, sub_range.start, Some(size))
|
||||
{
|
||||
Ok((ptr, size)) => Box::new(BufferMappedRange {
|
||||
ptr,
|
||||
size: size as usize,
|
||||
@ -1579,7 +1559,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
}
|
||||
|
||||
fn buffer_unmap(&self, buffer: &Self::BufferId, buffer_data: &Self::BufferData) {
|
||||
match wgc::gfx_select!(buffer => self.0.buffer_unmap(*buffer)) {
|
||||
match self.0.buffer_unmap(*buffer) {
|
||||
Ok(()) => (),
|
||||
Err(cause) => {
|
||||
self.handle_error_nolabel(&buffer_data.error_sink, cause, "Buffer::buffer_unmap")
|
||||
@ -1613,9 +1593,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
array_layer_count: desc.array_layer_count,
|
||||
},
|
||||
};
|
||||
let (id, error) = wgc::gfx_select!(
|
||||
texture => self.0.texture_create_view(*texture, &descriptor, None)
|
||||
);
|
||||
let (id, error) = self.0.texture_create_view(*texture, &descriptor, None);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error(
|
||||
&texture_data.error_sink,
|
||||
@ -1632,25 +1610,25 @@ impl crate::Context for ContextWgpuCore {
|
||||
}
|
||||
|
||||
fn adapter_drop(&self, adapter: &Self::AdapterId, _adapter_data: &Self::AdapterData) {
|
||||
wgc::gfx_select!(*adapter => self.0.adapter_drop(*adapter))
|
||||
self.0.adapter_drop(*adapter)
|
||||
}
|
||||
|
||||
fn buffer_destroy(&self, buffer: &Self::BufferId, _buffer_data: &Self::BufferData) {
|
||||
// Per spec, no error to report. Even calling destroy multiple times is valid.
|
||||
let _ = wgc::gfx_select!(buffer => self.0.buffer_destroy(*buffer));
|
||||
let _ = self.0.buffer_destroy(*buffer);
|
||||
}
|
||||
|
||||
fn buffer_drop(&self, buffer: &Self::BufferId, _buffer_data: &Self::BufferData) {
|
||||
wgc::gfx_select!(buffer => self.0.buffer_drop(*buffer))
|
||||
self.0.buffer_drop(*buffer)
|
||||
}
|
||||
|
||||
fn texture_destroy(&self, texture: &Self::TextureId, _texture_data: &Self::TextureData) {
|
||||
// Per spec, no error to report. Even calling destroy multiple times is valid.
|
||||
let _ = wgc::gfx_select!(texture => self.0.texture_destroy(*texture));
|
||||
let _ = self.0.texture_destroy(*texture);
|
||||
}
|
||||
|
||||
fn texture_drop(&self, texture: &Self::TextureId, _texture_data: &Self::TextureData) {
|
||||
wgc::gfx_select!(texture => self.0.texture_drop(*texture))
|
||||
self.0.texture_drop(*texture)
|
||||
}
|
||||
|
||||
fn texture_view_drop(
|
||||
@ -1658,15 +1636,15 @@ impl crate::Context for ContextWgpuCore {
|
||||
texture_view: &Self::TextureViewId,
|
||||
__texture_view_data: &Self::TextureViewData,
|
||||
) {
|
||||
let _ = wgc::gfx_select!(*texture_view => self.0.texture_view_drop(*texture_view));
|
||||
let _ = self.0.texture_view_drop(*texture_view);
|
||||
}
|
||||
|
||||
fn sampler_drop(&self, sampler: &Self::SamplerId, _sampler_data: &Self::SamplerData) {
|
||||
wgc::gfx_select!(*sampler => self.0.sampler_drop(*sampler))
|
||||
self.0.sampler_drop(*sampler)
|
||||
}
|
||||
|
||||
fn query_set_drop(&self, query_set: &Self::QuerySetId, _query_set_data: &Self::QuerySetData) {
|
||||
wgc::gfx_select!(*query_set => self.0.query_set_drop(*query_set))
|
||||
self.0.query_set_drop(*query_set)
|
||||
}
|
||||
|
||||
fn bind_group_drop(
|
||||
@ -1674,7 +1652,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
bind_group: &Self::BindGroupId,
|
||||
_bind_group_data: &Self::BindGroupData,
|
||||
) {
|
||||
wgc::gfx_select!(*bind_group => self.0.bind_group_drop(*bind_group))
|
||||
self.0.bind_group_drop(*bind_group)
|
||||
}
|
||||
|
||||
fn bind_group_layout_drop(
|
||||
@ -1682,7 +1660,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
bind_group_layout: &Self::BindGroupLayoutId,
|
||||
_bind_group_layout_data: &Self::BindGroupLayoutData,
|
||||
) {
|
||||
wgc::gfx_select!(*bind_group_layout => self.0.bind_group_layout_drop(*bind_group_layout))
|
||||
self.0.bind_group_layout_drop(*bind_group_layout)
|
||||
}
|
||||
|
||||
fn pipeline_layout_drop(
|
||||
@ -1690,14 +1668,14 @@ impl crate::Context for ContextWgpuCore {
|
||||
pipeline_layout: &Self::PipelineLayoutId,
|
||||
_pipeline_layout_data: &Self::PipelineLayoutData,
|
||||
) {
|
||||
wgc::gfx_select!(*pipeline_layout => self.0.pipeline_layout_drop(*pipeline_layout))
|
||||
self.0.pipeline_layout_drop(*pipeline_layout)
|
||||
}
|
||||
fn shader_module_drop(
|
||||
&self,
|
||||
shader_module: &Self::ShaderModuleId,
|
||||
_shader_module_data: &Self::ShaderModuleData,
|
||||
) {
|
||||
wgc::gfx_select!(*shader_module => self.0.shader_module_drop(*shader_module))
|
||||
self.0.shader_module_drop(*shader_module)
|
||||
}
|
||||
fn command_encoder_drop(
|
||||
&self,
|
||||
@ -1705,7 +1683,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
command_encoder_data: &Self::CommandEncoderData,
|
||||
) {
|
||||
if command_encoder_data.open {
|
||||
wgc::gfx_select!(command_encoder => self.0.command_encoder_drop(*command_encoder))
|
||||
self.0.command_encoder_drop(*command_encoder)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1714,7 +1692,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
command_buffer: &Self::CommandBufferId,
|
||||
_command_buffer_data: &Self::CommandBufferData,
|
||||
) {
|
||||
wgc::gfx_select!(*command_buffer => self.0.command_buffer_drop(*command_buffer))
|
||||
self.0.command_buffer_drop(*command_buffer)
|
||||
}
|
||||
|
||||
fn render_bundle_drop(
|
||||
@ -1722,7 +1700,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
render_bundle: &Self::RenderBundleId,
|
||||
_render_bundle_data: &Self::RenderBundleData,
|
||||
) {
|
||||
wgc::gfx_select!(*render_bundle => self.0.render_bundle_drop(*render_bundle))
|
||||
self.0.render_bundle_drop(*render_bundle)
|
||||
}
|
||||
|
||||
fn compute_pipeline_drop(
|
||||
@ -1730,7 +1708,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
pipeline: &Self::ComputePipelineId,
|
||||
_pipeline_data: &Self::ComputePipelineData,
|
||||
) {
|
||||
wgc::gfx_select!(*pipeline => self.0.compute_pipeline_drop(*pipeline))
|
||||
self.0.compute_pipeline_drop(*pipeline)
|
||||
}
|
||||
|
||||
fn render_pipeline_drop(
|
||||
@ -1738,7 +1716,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
pipeline: &Self::RenderPipelineId,
|
||||
_pipeline_data: &Self::RenderPipelineData,
|
||||
) {
|
||||
wgc::gfx_select!(*pipeline => self.0.render_pipeline_drop(*pipeline))
|
||||
self.0.render_pipeline_drop(*pipeline)
|
||||
}
|
||||
|
||||
fn pipeline_cache_drop(
|
||||
@ -1746,7 +1724,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
cache: &Self::PipelineCacheId,
|
||||
_cache_data: &Self::PipelineCacheData,
|
||||
) {
|
||||
wgc::gfx_select!(*cache => self.0.pipeline_cache_drop(*cache))
|
||||
self.0.pipeline_cache_drop(*cache)
|
||||
}
|
||||
|
||||
fn compute_pipeline_get_bind_group_layout(
|
||||
@ -1755,7 +1733,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
_pipeline_data: &Self::ComputePipelineData,
|
||||
index: u32,
|
||||
) -> (Self::BindGroupLayoutId, Self::BindGroupLayoutData) {
|
||||
let (id, error) = wgc::gfx_select!(*pipeline => self.0.compute_pipeline_get_bind_group_layout(*pipeline, index, None));
|
||||
let (id, error) = self
|
||||
.0
|
||||
.compute_pipeline_get_bind_group_layout(*pipeline, index, None);
|
||||
if let Some(err) = error {
|
||||
panic!("Error reflecting bind group {index}: {err}");
|
||||
}
|
||||
@ -1768,7 +1748,9 @@ impl crate::Context for ContextWgpuCore {
|
||||
_pipeline_data: &Self::RenderPipelineData,
|
||||
index: u32,
|
||||
) -> (Self::BindGroupLayoutId, Self::BindGroupLayoutData) {
|
||||
let (id, error) = wgc::gfx_select!(*pipeline => self.0.render_pipeline_get_bind_group_layout(*pipeline, index, None));
|
||||
let (id, error) = self
|
||||
.0
|
||||
.render_pipeline_get_bind_group_layout(*pipeline, index, None);
|
||||
if let Some(err) = error {
|
||||
panic!("Error reflecting bind group {index}: {err}");
|
||||
}
|
||||
@ -1787,14 +1769,14 @@ impl crate::Context for ContextWgpuCore {
|
||||
destination_offset: wgt::BufferAddress,
|
||||
copy_size: wgt::BufferAddress,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_copy_buffer_to_buffer(
|
||||
if let Err(cause) = self.0.command_encoder_copy_buffer_to_buffer(
|
||||
*encoder,
|
||||
*source,
|
||||
source_offset,
|
||||
*destination,
|
||||
destination_offset,
|
||||
copy_size
|
||||
)) {
|
||||
copy_size,
|
||||
) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -1811,12 +1793,12 @@ impl crate::Context for ContextWgpuCore {
|
||||
destination: crate::ImageCopyTexture<'_>,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_copy_buffer_to_texture(
|
||||
if let Err(cause) = self.0.command_encoder_copy_buffer_to_texture(
|
||||
*encoder,
|
||||
&map_buffer_copy_view(source),
|
||||
&map_texture_copy_view(destination),
|
||||
©_size
|
||||
)) {
|
||||
©_size,
|
||||
) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -1833,12 +1815,12 @@ impl crate::Context for ContextWgpuCore {
|
||||
destination: crate::ImageCopyBuffer<'_>,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_copy_texture_to_buffer(
|
||||
if let Err(cause) = self.0.command_encoder_copy_texture_to_buffer(
|
||||
*encoder,
|
||||
&map_texture_copy_view(source),
|
||||
&map_buffer_copy_view(destination),
|
||||
©_size
|
||||
)) {
|
||||
©_size,
|
||||
) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -1855,12 +1837,12 @@ impl crate::Context for ContextWgpuCore {
|
||||
destination: crate::ImageCopyTexture<'_>,
|
||||
copy_size: wgt::Extent3d,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_copy_texture_to_texture(
|
||||
if let Err(cause) = self.0.command_encoder_copy_texture_to_texture(
|
||||
*encoder,
|
||||
&map_texture_copy_view(source),
|
||||
&map_texture_copy_view(destination),
|
||||
©_size
|
||||
)) {
|
||||
©_size,
|
||||
) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -1884,10 +1866,13 @@ impl crate::Context for ContextWgpuCore {
|
||||
end_of_pass_write_index: tw.end_of_pass_write_index,
|
||||
});
|
||||
|
||||
let (pass, err) = gfx_select!(encoder => self.0.command_encoder_create_compute_pass_dyn(*encoder, &wgc::command::ComputePassDescriptor {
|
||||
let (pass, err) = self.0.command_encoder_create_compute_pass_dyn(
|
||||
*encoder,
|
||||
&wgc::command::ComputePassDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
timestamp_writes: timestamp_writes.as_ref(),
|
||||
}));
|
||||
},
|
||||
);
|
||||
|
||||
if let Some(cause) = err {
|
||||
self.handle_error(
|
||||
@ -1943,13 +1928,18 @@ impl crate::Context for ContextWgpuCore {
|
||||
end_of_pass_write_index: tw.end_of_pass_write_index,
|
||||
});
|
||||
|
||||
let (pass, err) = gfx_select!(encoder => self.0.command_encoder_create_render_pass_dyn(*encoder, &wgc::command::RenderPassDescriptor {
|
||||
let (pass, err) = self.0.command_encoder_create_render_pass_dyn(
|
||||
*encoder,
|
||||
&wgc::command::RenderPassDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
timestamp_writes: timestamp_writes.as_ref(),
|
||||
color_attachments: std::borrow::Cow::Borrowed(&colors),
|
||||
depth_stencil_attachment: depth_stencil.as_ref(),
|
||||
occlusion_query_set: desc.occlusion_query_set.map(|query_set| query_set.id.into()),
|
||||
}));
|
||||
occlusion_query_set: desc
|
||||
.occlusion_query_set
|
||||
.map(|query_set| query_set.id.into()),
|
||||
},
|
||||
);
|
||||
|
||||
if let Some(cause) = err {
|
||||
self.handle_error(
|
||||
@ -1976,8 +1966,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
) -> (Self::CommandBufferId, Self::CommandBufferData) {
|
||||
let descriptor = wgt::CommandBufferDescriptor::default();
|
||||
encoder_data.open = false; // prevent the drop
|
||||
let (id, error) =
|
||||
wgc::gfx_select!(encoder => self.0.command_encoder_finish(encoder, &descriptor));
|
||||
let (id, error) = self.0.command_encoder_finish(encoder, &descriptor);
|
||||
if let Some(cause) = error {
|
||||
self.handle_error_nolabel(&encoder_data.error_sink, cause, "a CommandEncoder");
|
||||
}
|
||||
@ -1991,11 +1980,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
texture: &crate::Texture,
|
||||
subresource_range: &wgt::ImageSubresourceRange,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_clear_texture(
|
||||
*encoder,
|
||||
texture.id.into(),
|
||||
subresource_range
|
||||
)) {
|
||||
if let Err(cause) =
|
||||
self.0
|
||||
.command_encoder_clear_texture(*encoder, texture.id.into(), subresource_range)
|
||||
{
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2012,11 +2000,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
offset: wgt::BufferAddress,
|
||||
size: Option<wgt::BufferAddress>,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_clear_buffer(
|
||||
*encoder,
|
||||
buffer.id.into(),
|
||||
offset, size
|
||||
)) {
|
||||
if let Err(cause) =
|
||||
self.0
|
||||
.command_encoder_clear_buffer(*encoder, buffer.id.into(), offset, size)
|
||||
{
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2031,9 +2018,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
encoder_data: &Self::CommandEncoderData,
|
||||
label: &str,
|
||||
) {
|
||||
if let Err(cause) =
|
||||
wgc::gfx_select!(encoder => self.0.command_encoder_insert_debug_marker(*encoder, label))
|
||||
{
|
||||
if let Err(cause) = self.0.command_encoder_insert_debug_marker(*encoder, label) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2048,9 +2033,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
encoder_data: &Self::CommandEncoderData,
|
||||
label: &str,
|
||||
) {
|
||||
if let Err(cause) =
|
||||
wgc::gfx_select!(encoder => self.0.command_encoder_push_debug_group(*encoder, label))
|
||||
{
|
||||
if let Err(cause) = self.0.command_encoder_push_debug_group(*encoder, label) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2064,9 +2047,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
encoder: &Self::CommandEncoderId,
|
||||
encoder_data: &Self::CommandEncoderData,
|
||||
) {
|
||||
if let Err(cause) =
|
||||
wgc::gfx_select!(encoder => self.0.command_encoder_pop_debug_group(*encoder))
|
||||
{
|
||||
if let Err(cause) = self.0.command_encoder_pop_debug_group(*encoder) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2083,11 +2064,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
_query_set_data: &Self::QuerySetData,
|
||||
query_index: u32,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_write_timestamp(
|
||||
*encoder,
|
||||
*query_set,
|
||||
query_index
|
||||
)) {
|
||||
if let Err(cause) =
|
||||
self.0
|
||||
.command_encoder_write_timestamp(*encoder, *query_set, query_index)
|
||||
{
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2108,14 +2088,14 @@ impl crate::Context for ContextWgpuCore {
|
||||
_destination_data: &Self::BufferData,
|
||||
destination_offset: wgt::BufferAddress,
|
||||
) {
|
||||
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_resolve_query_set(
|
||||
if let Err(cause) = self.0.command_encoder_resolve_query_set(
|
||||
*encoder,
|
||||
*query_set,
|
||||
first_query,
|
||||
query_count,
|
||||
*destination,
|
||||
destination_offset
|
||||
)) {
|
||||
destination_offset,
|
||||
) {
|
||||
self.handle_error_nolabel(
|
||||
&encoder_data.error_sink,
|
||||
cause,
|
||||
@ -2130,11 +2110,11 @@ impl crate::Context for ContextWgpuCore {
|
||||
encoder_data: Self::RenderBundleEncoderData,
|
||||
desc: &crate::RenderBundleDescriptor<'_>,
|
||||
) -> (Self::RenderBundleId, Self::RenderBundleData) {
|
||||
let (id, error) = wgc::gfx_select!(encoder_data.parent() => self.0.render_bundle_encoder_finish(
|
||||
let (id, error) = self.0.render_bundle_encoder_finish(
|
||||
encoder_data,
|
||||
&desc.map_label(|l| l.map(Borrowed)),
|
||||
None
|
||||
));
|
||||
None,
|
||||
);
|
||||
if let Some(err) = error {
|
||||
self.handle_error_fatal(err, "RenderBundleEncoder::finish");
|
||||
}
|
||||
@ -2150,9 +2130,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
offset: wgt::BufferAddress,
|
||||
data: &[u8],
|
||||
) {
|
||||
match wgc::gfx_select!(
|
||||
*queue => self.0.queue_write_buffer(*queue, *buffer, offset, data)
|
||||
) {
|
||||
match self.0.queue_write_buffer(*queue, *buffer, offset, data) {
|
||||
Ok(()) => (),
|
||||
Err(err) => {
|
||||
self.handle_error_nolabel(&queue_data.error_sink, err, "Queue::write_buffer")
|
||||
@ -2169,9 +2147,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
offset: wgt::BufferAddress,
|
||||
size: wgt::BufferSize,
|
||||
) -> Option<()> {
|
||||
match wgc::gfx_select!(
|
||||
*queue => self.0.queue_validate_write_buffer(*queue, *buffer, offset, size)
|
||||
) {
|
||||
match self
|
||||
.0
|
||||
.queue_validate_write_buffer(*queue, *buffer, offset, size)
|
||||
{
|
||||
Ok(()) => Some(()),
|
||||
Err(err) => {
|
||||
self.handle_error_nolabel(&queue_data.error_sink, err, "Queue::write_buffer_with");
|
||||
@ -2186,9 +2165,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
queue_data: &Self::QueueData,
|
||||
size: wgt::BufferSize,
|
||||
) -> Option<Box<dyn crate::context::QueueWriteBuffer>> {
|
||||
match wgc::gfx_select!(
|
||||
*queue => self.0.queue_create_staging_buffer(*queue, size, None)
|
||||
) {
|
||||
match self.0.queue_create_staging_buffer(*queue, size, None) {
|
||||
Ok((buffer_id, ptr)) => Some(Box::new(QueueWriteBuffer {
|
||||
buffer_id,
|
||||
mapping: BufferMappedRange {
|
||||
@ -2216,9 +2193,10 @@ impl crate::Context for ContextWgpuCore {
|
||||
.as_any()
|
||||
.downcast_ref::<QueueWriteBuffer>()
|
||||
.unwrap();
|
||||
match wgc::gfx_select!(
|
||||
*queue => self.0.queue_write_staging_buffer(*queue, *buffer, offset, staging_buffer.buffer_id)
|
||||
) {
|
||||
match self
|
||||
.0
|
||||
.queue_write_staging_buffer(*queue, *buffer, offset, staging_buffer.buffer_id)
|
||||
{
|
||||
Ok(()) => (),
|
||||
Err(err) => {
|
||||
self.handle_error_nolabel(&queue_data.error_sink, err, "Queue::write_buffer_with");
|
||||
@ -2235,13 +2213,13 @@ impl crate::Context for ContextWgpuCore {
|
||||
data_layout: wgt::ImageDataLayout,
|
||||
size: wgt::Extent3d,
|
||||
) {
|
||||
match wgc::gfx_select!(*queue => self.0.queue_write_texture(
|
||||
match self.0.queue_write_texture(
|
||||
*queue,
|
||||
&map_texture_copy_view(texture),
|
||||
data,
|
||||
&data_layout,
|
||||
&size
|
||||
)) {
|
||||
&size,
|
||||
) {
|
||||
Ok(()) => (),
|
||||
Err(err) => {
|
||||
self.handle_error_nolabel(&queue_data.error_sink, err, "Queue::write_texture")
|
||||
@ -2258,12 +2236,12 @@ impl crate::Context for ContextWgpuCore {
|
||||
dest: crate::ImageCopyTextureTagged<'_>,
|
||||
size: wgt::Extent3d,
|
||||
) {
|
||||
match wgc::gfx_select!(*queue => self.0.queue_copy_external_image_to_texture(
|
||||
match self.0.queue_copy_external_image_to_texture(
|
||||
*queue,
|
||||
source,
|
||||
map_texture_tagged_copy_view(dest),
|
||||
size
|
||||
)) {
|
||||
size,
|
||||
) {
|
||||
Ok(()) => (),
|
||||
Err(err) => self.handle_error_nolabel(
|
||||
&queue_data.error_sink,
|
||||
@ -2283,14 +2261,13 @@ impl crate::Context for ContextWgpuCore {
|
||||
.map(|(i, _)| i)
|
||||
.collect::<SmallVec<[_; 4]>>();
|
||||
|
||||
let index = match wgc::gfx_select!(*queue => self.0.queue_submit(*queue, &temp_command_buffers))
|
||||
{
|
||||
let index = match self.0.queue_submit(*queue, &temp_command_buffers) {
|
||||
Ok(index) => index,
|
||||
Err(err) => self.handle_error_fatal(err, "Queue::submit"),
|
||||
};
|
||||
|
||||
for cmdbuf in &temp_command_buffers {
|
||||
wgc::gfx_select!(*queue => self.0.command_buffer_drop(*cmdbuf));
|
||||
self.0.command_buffer_drop(*cmdbuf);
|
||||
}
|
||||
|
||||
index
|
||||
@ -2301,9 +2278,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
queue: &Self::QueueId,
|
||||
_queue_data: &Self::QueueData,
|
||||
) -> f32 {
|
||||
let res = wgc::gfx_select!(queue => self.0.queue_get_timestamp_period(
|
||||
*queue
|
||||
));
|
||||
let res = self.0.queue_get_timestamp_period(*queue);
|
||||
match res {
|
||||
Ok(v) => v,
|
||||
Err(cause) => {
|
||||
@ -2320,18 +2295,18 @@ impl crate::Context for ContextWgpuCore {
|
||||
) {
|
||||
let closure = wgc::device::queue::SubmittedWorkDoneClosure::from_rust(callback);
|
||||
|
||||
let res = wgc::gfx_select!(queue => self.0.queue_on_submitted_work_done(*queue, closure));
|
||||
let res = self.0.queue_on_submitted_work_done(*queue, closure);
|
||||
if let Err(cause) = res {
|
||||
self.handle_error_fatal(cause, "Queue::on_submitted_work_done");
|
||||
}
|
||||
}
|
||||
|
||||
fn device_start_capture(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) {
|
||||
wgc::gfx_select!(device => self.0.device_start_capture(*device));
|
||||
self.0.device_start_capture(*device);
|
||||
}
|
||||
|
||||
fn device_stop_capture(&self, device: &Self::DeviceId, _device_data: &Self::DeviceData) {
|
||||
wgc::gfx_select!(device => self.0.device_stop_capture(*device));
|
||||
self.0.device_stop_capture(*device);
|
||||
}
|
||||
|
||||
fn device_get_internal_counters(
|
||||
@ -2339,7 +2314,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
device: &Self::DeviceId,
|
||||
_device_data: &Self::DeviceData,
|
||||
) -> wgt::InternalCounters {
|
||||
wgc::gfx_select!(device => self.0.device_get_internal_counters(*device))
|
||||
self.0.device_get_internal_counters(*device)
|
||||
}
|
||||
|
||||
fn device_generate_allocator_report(
|
||||
@ -2347,7 +2322,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
device: &Self::DeviceId,
|
||||
_device_data: &Self::DeviceData,
|
||||
) -> Option<wgt::AllocatorReport> {
|
||||
wgc::gfx_select!(device => self.0.device_generate_allocator_report(*device))
|
||||
self.0.device_generate_allocator_report(*device)
|
||||
}
|
||||
|
||||
fn pipeline_cache_get_data(
|
||||
@ -2356,7 +2331,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
// TODO: Used for error handling?
|
||||
_cache_data: &Self::PipelineCacheData,
|
||||
) -> Option<Vec<u8>> {
|
||||
wgc::gfx_select!(cache => self.0.pipeline_cache_get_data(*cache))
|
||||
self.0.pipeline_cache_get_data(*cache)
|
||||
}
|
||||
|
||||
fn compute_pass_set_pipeline(
|
||||
|
Loading…
Reference in New Issue
Block a user