mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Resolve lints for Rust 1.78-1.81 that can be preempted before upgrade (#6225)
* chore: remove `Context` methods detected as dead code This is detected by `rustc` as of Rust 1.79.0. * refactor: satisfy `clippy::manual_inspect` Detected as of Rust 1.81.0. * refactor: satisfy `clippy::needless_borrows_for_generic_args` Detected as of Rust 1.81.0. * refactor: suppress false-positive `dead_code` lint for `SubmissionIndex` * chore: eliminate `dead_code` when `target_os = "emscripten"`
This commit is contained in:
parent
07684d3623
commit
0e352f5b34
@ -447,7 +447,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
group.bench_function(
|
group.bench_function(
|
||||||
&format!("{cpasses} computepasses x {dispatch_per_pass} dispatches ({label})"),
|
format!("{cpasses} computepasses x {dispatch_per_pass} dispatches ({label})"),
|
||||||
|b| {
|
|b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
for threads in [2, 4, 8] {
|
for threads in [2, 4, 8] {
|
||||||
let dispatch_per_pass = dispatch_count / threads;
|
let dispatch_per_pass = dispatch_count / threads;
|
||||||
group.bench_function(
|
group.bench_function(
|
||||||
&format!("{threads} threads x {dispatch_per_pass} dispatch"),
|
format!("{threads} threads x {dispatch_per_pass} dispatch"),
|
||||||
|b| {
|
|b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
@ -537,7 +537,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
let mut group = ctx.benchmark_group("Computepass: Bindless");
|
let mut group = ctx.benchmark_group("Computepass: Bindless");
|
||||||
group.throughput(Throughput::Elements(dispatch_count_bindless as _));
|
group.throughput(Throughput::Elements(dispatch_count_bindless as _));
|
||||||
|
|
||||||
group.bench_function(&format!("{dispatch_count_bindless} dispatch"), |b| {
|
group.bench_function(format!("{dispatch_count_bindless} dispatch"), |b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
b.iter_custom(|iters| {
|
b.iter_custom(|iters| {
|
||||||
|
@ -448,7 +448,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
group.bench_function(
|
group.bench_function(
|
||||||
&format!("{rpasses} renderpasses x {draws_per_pass} draws ({label})"),
|
format!("{rpasses} renderpasses x {draws_per_pass} draws ({label})"),
|
||||||
|b| {
|
|b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
@ -501,9 +501,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
|
|
||||||
for threads in [2, 4, 8] {
|
for threads in [2, 4, 8] {
|
||||||
let draws_per_pass = draw_count / threads;
|
let draws_per_pass = draw_count / threads;
|
||||||
group.bench_function(
|
group.bench_function(format!("{threads} threads x {draws_per_pass} draws"), |b| {
|
||||||
&format!("{threads} threads x {draws_per_pass} draws"),
|
|
||||||
|b| {
|
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
b.iter_custom(|iters| {
|
b.iter_custom(|iters| {
|
||||||
@ -534,8 +532,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
|
|
||||||
duration
|
duration
|
||||||
})
|
})
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
group.finish();
|
group.finish();
|
||||||
|
|
||||||
@ -543,7 +540,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
let mut group = ctx.benchmark_group("Renderpass: Bindless");
|
let mut group = ctx.benchmark_group("Renderpass: Bindless");
|
||||||
group.throughput(Throughput::Elements(draw_count as _));
|
group.throughput(Throughput::Elements(draw_count as _));
|
||||||
|
|
||||||
group.bench_function(&format!("{draw_count} draws"), |b| {
|
group.bench_function(format!("{draw_count} draws"), |b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
b.iter_custom(|iters| {
|
b.iter_custom(|iters| {
|
||||||
|
@ -17,7 +17,7 @@ fn run_bench(ctx: &mut Criterion) {
|
|||||||
for threads in [1, 2, 4, 8] {
|
for threads in [1, 2, 4, 8] {
|
||||||
let resources_per_thread = RESOURCES_TO_CREATE / threads;
|
let resources_per_thread = RESOURCES_TO_CREATE / threads;
|
||||||
group.bench_function(
|
group.bench_function(
|
||||||
&format!("{threads} threads x {resources_per_thread} resource"),
|
format!("{threads} threads x {resources_per_thread} resource"),
|
||||||
|b| {
|
|b| {
|
||||||
Lazy::force(&state);
|
Lazy::force(&state);
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ pub enum ArcComputeCommand {
|
|||||||
},
|
},
|
||||||
|
|
||||||
PushDebugGroup {
|
PushDebugGroup {
|
||||||
|
#[cfg_attr(target_os = "emscripten", allow(dead_code))]
|
||||||
color: u32,
|
color: u32,
|
||||||
len: usize,
|
len: usize,
|
||||||
},
|
},
|
||||||
@ -222,6 +223,7 @@ pub enum ArcComputeCommand {
|
|||||||
PopDebugGroup,
|
PopDebugGroup,
|
||||||
|
|
||||||
InsertDebugMarker {
|
InsertDebugMarker {
|
||||||
|
#[cfg_attr(target_os = "emscripten", allow(dead_code))]
|
||||||
color: u32,
|
color: u32,
|
||||||
len: usize,
|
len: usize,
|
||||||
},
|
},
|
||||||
|
@ -464,11 +464,13 @@ pub enum ArcRenderCommand {
|
|||||||
indexed: bool,
|
indexed: bool,
|
||||||
},
|
},
|
||||||
PushDebugGroup {
|
PushDebugGroup {
|
||||||
|
#[cfg_attr(target_os = "emscripten", allow(dead_code))]
|
||||||
color: u32,
|
color: u32,
|
||||||
len: usize,
|
len: usize,
|
||||||
},
|
},
|
||||||
PopDebugGroup,
|
PopDebugGroup,
|
||||||
InsertDebugMarker {
|
InsertDebugMarker {
|
||||||
|
#[cfg_attr(target_os = "emscripten", allow(dead_code))]
|
||||||
color: u32,
|
color: u32,
|
||||||
len: usize,
|
len: usize,
|
||||||
},
|
},
|
||||||
|
@ -442,10 +442,9 @@ impl TextureTracker {
|
|||||||
let transitions = self
|
let transitions = self
|
||||||
.temp
|
.temp
|
||||||
.drain(..)
|
.drain(..)
|
||||||
.map(|pending| {
|
.inspect(|pending| {
|
||||||
let tex = unsafe { self.metadata.get_resource_unchecked(pending.id as _) };
|
let tex = unsafe { self.metadata.get_resource_unchecked(pending.id as _) };
|
||||||
textures.push(tex.inner.get(snatch_guard));
|
textures.push(tex.inner.get(snatch_guard));
|
||||||
pending
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
(transitions, textures)
|
(transitions, textures)
|
||||||
|
@ -554,10 +554,9 @@ impl Drop for super::InstanceShared {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Keep du alive since destroy_instance may also log
|
// Keep du alive since destroy_instance may also log
|
||||||
let _du = self.debug_utils.take().map(|du| {
|
let _du = self.debug_utils.take().inspect(|du| {
|
||||||
du.extension
|
du.extension
|
||||||
.destroy_debug_utils_messenger(du.messenger, None);
|
.destroy_debug_utils_messenger(du.messenger, None);
|
||||||
du
|
|
||||||
});
|
});
|
||||||
if self.drop_guard.is_none() {
|
if self.drop_guard.is_none() {
|
||||||
self.raw.destroy_instance(None);
|
self.raw.destroy_instance(None);
|
||||||
|
@ -37,7 +37,10 @@ impl Drop for Queue {
|
|||||||
/// This type is unique to the Rust API of `wgpu`.
|
/// This type is unique to the Rust API of `wgpu`.
|
||||||
/// There is no analogue in the WebGPU specification.
|
/// There is no analogue in the WebGPU specification.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SubmissionIndex(pub(crate) Arc<crate::Data>);
|
pub struct SubmissionIndex {
|
||||||
|
#[cfg_attr(not(native), allow(dead_code))]
|
||||||
|
pub(crate) data: Arc<crate::Data>,
|
||||||
|
}
|
||||||
#[cfg(send_sync)]
|
#[cfg(send_sync)]
|
||||||
static_assertions::assert_impl_all!(SubmissionIndex: Send, Sync);
|
static_assertions::assert_impl_all!(SubmissionIndex: Send, Sync);
|
||||||
|
|
||||||
@ -248,7 +251,7 @@ impl Queue {
|
|||||||
let data =
|
let data =
|
||||||
DynContext::queue_submit(&*self.context, self.data.as_ref(), &mut command_buffers);
|
DynContext::queue_submit(&*self.context, self.data.as_ref(), &mut command_buffers);
|
||||||
|
|
||||||
SubmissionIndex(data)
|
SubmissionIndex { data }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the amount of nanoseconds each tick of a timestamp query represents.
|
/// Gets the amount of nanoseconds each tick of a timestamp query represents.
|
||||||
|
@ -1403,14 +1403,6 @@ impl crate::context::Context for ContextWebGpu {
|
|||||||
map_wgt_limits(device_data.0.limits())
|
map_wgt_limits(device_data.0.limits())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_downlevel_properties(
|
|
||||||
&self,
|
|
||||||
_device_data: &Self::DeviceData,
|
|
||||||
) -> wgt::DownlevelCapabilities {
|
|
||||||
// WebGPU is assumed to be fully compliant
|
|
||||||
wgt::DownlevelCapabilities::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
not(any(
|
not(any(
|
||||||
feature = "spirv",
|
feature = "spirv",
|
||||||
@ -2033,12 +2025,6 @@ impl crate::context::Context for ContextWebGpu {
|
|||||||
device_data.0.destroy();
|
device_data.0.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_mark_lost(&self, _device_data: &Self::DeviceData, _message: &str) {
|
|
||||||
// TODO: figure out the GPUDevice implementation of this, including resolving
|
|
||||||
// the device.lost promise, which will require a different invocation pattern
|
|
||||||
// with a callback.
|
|
||||||
}
|
|
||||||
|
|
||||||
fn queue_drop(&self, _queue_data: &Self::QueueData) {
|
fn queue_drop(&self, _queue_data: &Self::QueueData) {
|
||||||
// Queue is dropped automatically
|
// Queue is dropped automatically
|
||||||
}
|
}
|
||||||
@ -3023,52 +3009,6 @@ impl crate::context::Context for ContextWebGpu {
|
|||||||
.draw_indexed_indirect_with_f64(&indirect_buffer_data.0.buffer, indirect_offset as f64);
|
.draw_indexed_indirect_with_f64(&indirect_buffer_data.0.buffer, indirect_offset as f64);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count: u32,
|
|
||||||
) {
|
|
||||||
panic!("MULTI_DRAW_INDIRECT feature must be enabled to call multi_draw_indirect")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count: u32,
|
|
||||||
) {
|
|
||||||
panic!("MULTI_DRAW_INDIRECT feature must be enabled to call multi_draw_indexed_indirect")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count_buffer_data: &Self::BufferData,
|
|
||||||
_count_buffer_offset: wgt::BufferAddress,
|
|
||||||
_max_count: u32,
|
|
||||||
) {
|
|
||||||
panic!(
|
|
||||||
"MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indirect_count"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count_buffer_data: &Self::BufferData,
|
|
||||||
_count_buffer_offset: wgt::BufferAddress,
|
|
||||||
_max_count: u32,
|
|
||||||
) {
|
|
||||||
panic!("MULTI_DRAW_INDIRECT_COUNT feature must be enabled to call multi_draw_indexed_indirect_count")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_pass_set_pipeline(
|
fn render_pass_set_pipeline(
|
||||||
&self,
|
&self,
|
||||||
pass_data: &mut Self::RenderPassData,
|
pass_data: &mut Self::RenderPassData,
|
||||||
|
@ -793,13 +793,6 @@ impl crate::Context for ContextWgpuCore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_downlevel_properties(&self, device_data: &Self::DeviceData) -> DownlevelCapabilities {
|
|
||||||
match self.0.device_downlevel_properties(device_data.id) {
|
|
||||||
Ok(limits) => limits,
|
|
||||||
Err(err) => self.handle_error_fatal(err, "Device::downlevel_properties"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
not(any(
|
not(any(
|
||||||
feature = "spirv",
|
feature = "spirv",
|
||||||
@ -1374,17 +1367,12 @@ impl crate::Context for ContextWgpuCore {
|
|||||||
fn device_destroy(&self, device_data: &Self::DeviceData) {
|
fn device_destroy(&self, device_data: &Self::DeviceData) {
|
||||||
self.0.device_destroy(device_data.id);
|
self.0.device_destroy(device_data.id);
|
||||||
}
|
}
|
||||||
fn device_mark_lost(&self, device_data: &Self::DeviceData, message: &str) {
|
|
||||||
// We do not provide a reason to device_lose, because all reasons other than
|
|
||||||
// destroyed (which this is not) are "unknown".
|
|
||||||
self.0.device_mark_lost(device_data.id, message);
|
|
||||||
}
|
|
||||||
fn device_poll(
|
fn device_poll(
|
||||||
&self,
|
&self,
|
||||||
device_data: &Self::DeviceData,
|
device_data: &Self::DeviceData,
|
||||||
maintain: crate::Maintain,
|
maintain: crate::Maintain,
|
||||||
) -> wgt::MaintainResult {
|
) -> wgt::MaintainResult {
|
||||||
let maintain_inner = maintain.map_index(|i| *i.0.as_ref().downcast_ref().unwrap());
|
let maintain_inner = maintain.map_index(|i| *i.data.as_ref().downcast_ref().unwrap());
|
||||||
match self.0.device_poll(device_data.id, maintain_inner) {
|
match self.0.device_poll(device_data.id, maintain_inner) {
|
||||||
Ok(done) => match done {
|
Ok(done) => match done {
|
||||||
true => wgt::MaintainResult::SubmissionQueueEmpty,
|
true => wgt::MaintainResult::SubmissionQueueEmpty,
|
||||||
@ -2484,50 +2472,6 @@ impl crate::Context for ContextWgpuCore {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count: u32,
|
|
||||||
) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count: u32,
|
|
||||||
) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count_buffer_data: &Self::BufferData,
|
|
||||||
_count_buffer_offset: wgt::BufferAddress,
|
|
||||||
_max_count: u32,
|
|
||||||
) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
&self,
|
|
||||||
_encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
_indirect_buffer_data: &Self::BufferData,
|
|
||||||
_indirect_offset: wgt::BufferAddress,
|
|
||||||
_count_buffer_data: &Self::BufferData,
|
|
||||||
_count_buffer_offset: wgt::BufferAddress,
|
|
||||||
_max_count: u32,
|
|
||||||
) {
|
|
||||||
unimplemented!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_pass_set_pipeline(
|
fn render_pass_set_pipeline(
|
||||||
&self,
|
&self,
|
||||||
pass_data: &mut Self::RenderPassData,
|
pass_data: &mut Self::RenderPassData,
|
||||||
|
@ -21,6 +21,7 @@ use crate::{
|
|||||||
/// Meta trait for an data associated with an id tracked by a context.
|
/// Meta trait for an data associated with an id tracked by a context.
|
||||||
///
|
///
|
||||||
/// There is no need to manually implement this trait since there is a blanket implementation for this trait.
|
/// There is no need to manually implement this trait since there is a blanket implementation for this trait.
|
||||||
|
#[cfg_attr(target_os = "emscripten", allow(dead_code))]
|
||||||
pub trait ContextData: Debug + WasmNotSendSync + 'static {}
|
pub trait ContextData: Debug + WasmNotSendSync + 'static {}
|
||||||
impl<T: Debug + WasmNotSendSync + 'static> ContextData for T {}
|
impl<T: Debug + WasmNotSendSync + 'static> ContextData for T {}
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
|||||||
|
|
||||||
type CompilationInfoFuture: Future<Output = CompilationInfo> + WasmNotSend + 'static;
|
type CompilationInfoFuture: Future<Output = CompilationInfo> + WasmNotSend + 'static;
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "emscripten"))]
|
||||||
fn init(instance_desc: wgt::InstanceDescriptor) -> Self;
|
fn init(instance_desc: wgt::InstanceDescriptor) -> Self;
|
||||||
unsafe fn instance_create_surface(
|
unsafe fn instance_create_surface(
|
||||||
&self,
|
&self,
|
||||||
@ -122,7 +124,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
|||||||
|
|
||||||
fn device_features(&self, device_data: &Self::DeviceData) -> Features;
|
fn device_features(&self, device_data: &Self::DeviceData) -> Features;
|
||||||
fn device_limits(&self, device_data: &Self::DeviceData) -> Limits;
|
fn device_limits(&self, device_data: &Self::DeviceData) -> Limits;
|
||||||
fn device_downlevel_properties(&self, device_data: &Self::DeviceData) -> DownlevelCapabilities;
|
|
||||||
fn device_create_shader_module(
|
fn device_create_shader_module(
|
||||||
&self,
|
&self,
|
||||||
device_data: &Self::DeviceData,
|
device_data: &Self::DeviceData,
|
||||||
@ -203,7 +204,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
|||||||
device_lost_callback: DeviceLostCallback,
|
device_lost_callback: DeviceLostCallback,
|
||||||
);
|
);
|
||||||
fn device_destroy(&self, device_data: &Self::DeviceData);
|
fn device_destroy(&self, device_data: &Self::DeviceData);
|
||||||
fn device_mark_lost(&self, device_data: &Self::DeviceData, message: &str);
|
|
||||||
fn queue_drop(&self, queue_data: &Self::QueueData);
|
fn queue_drop(&self, queue_data: &Self::QueueData);
|
||||||
fn device_poll(&self, device_data: &Self::DeviceData, maintain: Maintain) -> MaintainResult;
|
fn device_poll(&self, device_data: &Self::DeviceData, maintain: Maintain) -> MaintainResult;
|
||||||
fn device_on_uncaptured_error(
|
fn device_on_uncaptured_error(
|
||||||
@ -547,40 +547,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
|||||||
indirect_buffer_data: &Self::BufferData,
|
indirect_buffer_data: &Self::BufferData,
|
||||||
indirect_offset: BufferAddress,
|
indirect_offset: BufferAddress,
|
||||||
);
|
);
|
||||||
fn render_bundle_encoder_multi_draw_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
indirect_buffer_data: &Self::BufferData,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
);
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
indirect_buffer_data: &Self::BufferData,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
);
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
indirect_buffer_data: &Self::BufferData,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count_buffer_data: &Self::BufferData,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
);
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut Self::RenderBundleEncoderData,
|
|
||||||
indirect_buffer_data: &Self::BufferData,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count_buffer_data: &Self::BufferData,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
);
|
|
||||||
|
|
||||||
fn render_pass_set_pipeline(
|
fn render_pass_set_pipeline(
|
||||||
&self,
|
&self,
|
||||||
@ -788,6 +754,7 @@ pub type DeviceLostCallback = Box<dyn Fn(DeviceLostReason, String) + 'static>;
|
|||||||
|
|
||||||
/// An object safe variant of [`Context`] implemented by all types that implement [`Context`].
|
/// An object safe variant of [`Context`] implemented by all types that implement [`Context`].
|
||||||
pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
||||||
|
#[cfg(not(target_os = "emscripten"))]
|
||||||
fn as_any(&self) -> &dyn Any;
|
fn as_any(&self) -> &dyn Any;
|
||||||
|
|
||||||
unsafe fn instance_create_surface(
|
unsafe fn instance_create_surface(
|
||||||
@ -850,7 +817,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
|||||||
|
|
||||||
fn device_features(&self, device_data: &crate::Data) -> Features;
|
fn device_features(&self, device_data: &crate::Data) -> Features;
|
||||||
fn device_limits(&self, device_data: &crate::Data) -> Limits;
|
fn device_limits(&self, device_data: &crate::Data) -> Limits;
|
||||||
fn device_downlevel_properties(&self, device_data: &crate::Data) -> DownlevelCapabilities;
|
|
||||||
fn device_create_shader_module(
|
fn device_create_shader_module(
|
||||||
&self,
|
&self,
|
||||||
device_data: &crate::Data,
|
device_data: &crate::Data,
|
||||||
@ -931,7 +897,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
|||||||
device_lost_callback: DeviceLostCallback,
|
device_lost_callback: DeviceLostCallback,
|
||||||
);
|
);
|
||||||
fn device_destroy(&self, device_data: &crate::Data);
|
fn device_destroy(&self, device_data: &crate::Data);
|
||||||
fn device_mark_lost(&self, device_data: &crate::Data, message: &str);
|
|
||||||
fn queue_drop(&self, queue_data: &crate::Data);
|
fn queue_drop(&self, queue_data: &crate::Data);
|
||||||
fn device_poll(&self, device_data: &crate::Data, maintain: Maintain) -> MaintainResult;
|
fn device_poll(&self, device_data: &crate::Data, maintain: Maintain) -> MaintainResult;
|
||||||
fn device_on_uncaptured_error(
|
fn device_on_uncaptured_error(
|
||||||
@ -1243,40 +1208,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
|||||||
indirect_buffer_data: &crate::Data,
|
indirect_buffer_data: &crate::Data,
|
||||||
indirect_offset: BufferAddress,
|
indirect_offset: BufferAddress,
|
||||||
);
|
);
|
||||||
fn render_bundle_encoder_multi_draw_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
);
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
);
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count_buffer_data: &crate::Data,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
);
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
command_buffer_data: &crate::Data,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
);
|
|
||||||
|
|
||||||
fn render_pass_set_pipeline(&self, pass_data: &mut crate::Data, pipeline_data: &crate::Data);
|
fn render_pass_set_pipeline(&self, pass_data: &mut crate::Data, pipeline_data: &crate::Data);
|
||||||
fn render_pass_set_bind_group(
|
fn render_pass_set_bind_group(
|
||||||
@ -1422,6 +1353,7 @@ impl<T> DynContext for T
|
|||||||
where
|
where
|
||||||
T: Context + 'static,
|
T: Context + 'static,
|
||||||
{
|
{
|
||||||
|
#[cfg(not(target_os = "emscripten"))]
|
||||||
fn as_any(&self) -> &dyn Any {
|
fn as_any(&self) -> &dyn Any {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -1564,11 +1496,6 @@ where
|
|||||||
Context::device_limits(self, device_data)
|
Context::device_limits(self, device_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_downlevel_properties(&self, device_data: &crate::Data) -> DownlevelCapabilities {
|
|
||||||
let device_data = downcast_ref(device_data);
|
|
||||||
Context::device_downlevel_properties(self, device_data)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn device_create_shader_module(
|
fn device_create_shader_module(
|
||||||
&self,
|
&self,
|
||||||
device_data: &crate::Data,
|
device_data: &crate::Data,
|
||||||
@ -1736,11 +1663,6 @@ where
|
|||||||
Context::device_destroy(self, device_data)
|
Context::device_destroy(self, device_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn device_mark_lost(&self, device_data: &crate::Data, message: &str) {
|
|
||||||
let device_data = downcast_ref(device_data);
|
|
||||||
Context::device_mark_lost(self, device_data, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn queue_drop(&self, queue_data: &crate::Data) {
|
fn queue_drop(&self, queue_data: &crate::Data) {
|
||||||
let queue_data = downcast_ref(queue_data);
|
let queue_data = downcast_ref(queue_data);
|
||||||
Context::queue_drop(self, queue_data)
|
Context::queue_drop(self, queue_data)
|
||||||
@ -2474,88 +2396,6 @@ where
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
) {
|
|
||||||
let encoder_data = downcast_mut::<T::RenderBundleEncoderData>(encoder_data);
|
|
||||||
let indirect_buffer_data = downcast_ref(indirect_buffer_data);
|
|
||||||
Context::render_bundle_encoder_multi_draw_indirect(
|
|
||||||
self,
|
|
||||||
encoder_data,
|
|
||||||
indirect_buffer_data,
|
|
||||||
indirect_offset,
|
|
||||||
count,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count: u32,
|
|
||||||
) {
|
|
||||||
let encoder_data = downcast_mut::<T::RenderBundleEncoderData>(encoder_data);
|
|
||||||
let indirect_buffer_data = downcast_ref(indirect_buffer_data);
|
|
||||||
Context::render_bundle_encoder_multi_draw_indexed_indirect(
|
|
||||||
self,
|
|
||||||
encoder_data,
|
|
||||||
indirect_buffer_data,
|
|
||||||
indirect_offset,
|
|
||||||
count,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count_buffer_data: &crate::Data,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
) {
|
|
||||||
let encoder_data = downcast_mut::<T::RenderBundleEncoderData>(encoder_data);
|
|
||||||
let indirect_buffer_data = downcast_ref(indirect_buffer_data);
|
|
||||||
let count_buffer_data = downcast_ref(count_buffer_data);
|
|
||||||
Context::render_bundle_encoder_multi_draw_indirect_count(
|
|
||||||
self,
|
|
||||||
encoder_data,
|
|
||||||
indirect_buffer_data,
|
|
||||||
indirect_offset,
|
|
||||||
count_buffer_data,
|
|
||||||
count_buffer_offset,
|
|
||||||
max_count,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
&self,
|
|
||||||
encoder_data: &mut crate::Data,
|
|
||||||
indirect_buffer_data: &crate::Data,
|
|
||||||
indirect_offset: BufferAddress,
|
|
||||||
count_buffer_data: &crate::Data,
|
|
||||||
count_buffer_offset: BufferAddress,
|
|
||||||
max_count: u32,
|
|
||||||
) {
|
|
||||||
let encoder_data = downcast_mut::<T::RenderBundleEncoderData>(encoder_data);
|
|
||||||
let indirect_buffer_data = downcast_ref(indirect_buffer_data);
|
|
||||||
let count_buffer_data = downcast_ref(count_buffer_data);
|
|
||||||
Context::render_bundle_encoder_multi_draw_indexed_indirect_count(
|
|
||||||
self,
|
|
||||||
encoder_data,
|
|
||||||
indirect_buffer_data,
|
|
||||||
indirect_offset,
|
|
||||||
count_buffer_data,
|
|
||||||
count_buffer_offset,
|
|
||||||
max_count,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn render_pass_set_pipeline(&self, pass_data: &mut crate::Data, pipeline_data: &crate::Data) {
|
fn render_pass_set_pipeline(&self, pass_data: &mut crate::Data, pipeline_data: &crate::Data) {
|
||||||
let pass_data = downcast_mut::<T::RenderPassData>(pass_data);
|
let pass_data = downcast_mut::<T::RenderPassData>(pass_data);
|
||||||
let pipeline_data = downcast_ref(pipeline_data);
|
let pipeline_data = downcast_ref(pipeline_data);
|
||||||
@ -2864,6 +2704,7 @@ pub trait QueueWriteBuffer: WasmNotSendSync + Debug {
|
|||||||
|
|
||||||
fn slice_mut(&mut self) -> &mut [u8];
|
fn slice_mut(&mut self) -> &mut [u8];
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "emscripten"))]
|
||||||
fn as_any(&self) -> &dyn Any;
|
fn as_any(&self) -> &dyn Any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user