mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
For wgpu web backend, use a real type for submission indices. (#2874)
The wgpu web backend uses `()` as `Context::SubmissionIndex`, which is fine --- WebGPU provides no way to identify individual queue submissions --- except that Clippy is concerned about us passing around `()` in the front end as if it were a real value. Instead, define a new zero-size `wgpu::backend::web::SubmissionIndex` type for this use.
This commit is contained in:
parent
af345cd6c3
commit
5094525fb8
@ -972,6 +972,12 @@ impl Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The web doesn't provide any way to identify specific queue
|
||||||
|
// submissions. But Clippy gets concerned if we pass around `()` as if
|
||||||
|
// it were meaningful.
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
pub struct SubmissionIndex;
|
||||||
|
|
||||||
impl crate::Context for Context {
|
impl crate::Context for Context {
|
||||||
type AdapterId = Sendable<web_sys::GpuAdapter>;
|
type AdapterId = Sendable<web_sys::GpuAdapter>;
|
||||||
type DeviceId = Sendable<web_sys::GpuDevice>;
|
type DeviceId = Sendable<web_sys::GpuDevice>;
|
||||||
@ -996,7 +1002,7 @@ impl crate::Context for Context {
|
|||||||
type SurfaceId = Sendable<web_sys::GpuCanvasContext>;
|
type SurfaceId = Sendable<web_sys::GpuCanvasContext>;
|
||||||
|
|
||||||
type SurfaceOutputDetail = SurfaceOutputDetail;
|
type SurfaceOutputDetail = SurfaceOutputDetail;
|
||||||
type SubmissionIndex = ();
|
type SubmissionIndex = SubmissionIndex;
|
||||||
|
|
||||||
type RequestAdapterFuture = MakeSendFuture<
|
type RequestAdapterFuture = MakeSendFuture<
|
||||||
wasm_bindgen_futures::JsFuture,
|
wasm_bindgen_futures::JsFuture,
|
||||||
@ -2280,7 +2286,7 @@ impl crate::Context for Context {
|
|||||||
|
|
||||||
queue.0.submit(&temp_command_buffers);
|
queue.0.submit(&temp_command_buffers);
|
||||||
|
|
||||||
// SubmissionIndex is (), so just let this function end
|
SubmissionIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
fn queue_get_timestamp_period(&self, _queue: &Self::QueueId) -> f32 {
|
fn queue_get_timestamp_period(&self, _queue: &Self::QueueId) -> f32 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user