mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 00:03:29 +00:00
[wgpu] Remove unused ObjectId
field of SubmissionIndex
. (#5780)
Drop the first field of `wgpu::SubmissionIndex`, as it is unused. Adjust uses of the types' other field. Delete the `wgpu::context::Context` trait's `SubmissionIndex` associated type. Remove it from implementations. Drop the first field of the `Context` trait's `queue_submit` method's return value. Adjust implementations.
This commit is contained in:
parent
eb24be47e1
commit
6c370522a7
@ -1158,7 +1158,6 @@ impl crate::context::Context for ContextWebGpu {
|
||||
type SurfaceData = Sendable<(Canvas, webgpu_sys::GpuCanvasContext)>;
|
||||
|
||||
type SurfaceOutputDetail = SurfaceOutputDetail;
|
||||
type SubmissionIndex = Unused;
|
||||
type SubmissionIndexData = ();
|
||||
type PipelineCacheId = Unused;
|
||||
type PipelineCacheData = ();
|
||||
@ -2950,14 +2949,12 @@ impl crate::context::Context for ContextWebGpu {
|
||||
_queue: &Self::QueueId,
|
||||
queue_data: &Self::QueueData,
|
||||
command_buffers: I,
|
||||
) -> (Self::SubmissionIndex, Self::SubmissionIndexData) {
|
||||
) -> Self::SubmissionIndexData {
|
||||
let temp_command_buffers = command_buffers
|
||||
.map(|(_, data)| data.0)
|
||||
.collect::<js_sys::Array>();
|
||||
|
||||
queue_data.0.submit(&temp_command_buffers);
|
||||
|
||||
(Unused, ())
|
||||
}
|
||||
|
||||
fn queue_get_timestamp_period(
|
||||
|
@ -551,7 +551,6 @@ impl crate::Context for ContextWgpuCore {
|
||||
type SurfaceId = wgc::id::SurfaceId;
|
||||
type SurfaceData = Surface;
|
||||
type SurfaceOutputDetail = SurfaceOutputDetail;
|
||||
type SubmissionIndex = Unused;
|
||||
type SubmissionIndexData = wgc::device::queue::WrappedSubmissionIndex;
|
||||
|
||||
type RequestAdapterFuture = Ready<Option<(Self::AdapterId, Self::AdapterData)>>;
|
||||
@ -1525,7 +1524,7 @@ impl crate::Context for ContextWgpuCore {
|
||||
_device_data: &Self::DeviceData,
|
||||
maintain: crate::Maintain,
|
||||
) -> wgt::MaintainResult {
|
||||
let maintain_inner = maintain.map_index(|i| *i.1.as_ref().downcast_ref().unwrap());
|
||||
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
|
||||
@ -2322,18 +2321,15 @@ impl crate::Context for ContextWgpuCore {
|
||||
queue: &Self::QueueId,
|
||||
_queue_data: &Self::QueueData,
|
||||
command_buffers: I,
|
||||
) -> (Self::SubmissionIndex, Self::SubmissionIndexData) {
|
||||
) -> Self::SubmissionIndexData {
|
||||
let temp_command_buffers = command_buffers
|
||||
.map(|(i, _)| i)
|
||||
.collect::<SmallVec<[_; 4]>>();
|
||||
|
||||
let index = match wgc::gfx_select!(*queue => self.0.queue_submit(*queue, &temp_command_buffers))
|
||||
{
|
||||
match wgc::gfx_select!(*queue => self.0.queue_submit(*queue, &temp_command_buffers)) {
|
||||
Ok(index) => index,
|
||||
Err(err) => self.handle_error_fatal(err, "Queue::submit"),
|
||||
};
|
||||
|
||||
(Unused, index)
|
||||
}
|
||||
}
|
||||
|
||||
fn queue_get_timestamp_period(
|
||||
|
@ -78,7 +78,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
||||
type SurfaceData: ContextData;
|
||||
|
||||
type SurfaceOutputDetail: WasmNotSendSync + 'static;
|
||||
type SubmissionIndex: ContextId + Clone + Copy + WasmNotSendSync;
|
||||
type SubmissionIndexData: ContextData + Copy;
|
||||
|
||||
type RequestAdapterFuture: Future<Output = Option<(Self::AdapterId, Self::AdapterData)>>
|
||||
@ -597,7 +596,7 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
|
||||
queue: &Self::QueueId,
|
||||
queue_data: &Self::QueueData,
|
||||
command_buffers: I,
|
||||
) -> (Self::SubmissionIndex, Self::SubmissionIndexData);
|
||||
) -> Self::SubmissionIndexData;
|
||||
fn queue_get_timestamp_period(
|
||||
&self,
|
||||
queue: &Self::QueueId,
|
||||
@ -1593,7 +1592,7 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
|
||||
queue: &ObjectId,
|
||||
queue_data: &crate::Data,
|
||||
command_buffers: &mut dyn Iterator<Item = (ObjectId, Box<crate::Data>)>,
|
||||
) -> (ObjectId, Arc<crate::Data>);
|
||||
) -> Arc<crate::Data>;
|
||||
fn queue_get_timestamp_period(&self, queue: &ObjectId, queue_data: &crate::Data) -> f32;
|
||||
fn queue_on_submitted_work_done(
|
||||
&self,
|
||||
@ -3039,16 +3038,15 @@ where
|
||||
queue: &ObjectId,
|
||||
queue_data: &crate::Data,
|
||||
command_buffers: &mut dyn Iterator<Item = (ObjectId, Box<crate::Data>)>,
|
||||
) -> (ObjectId, Arc<crate::Data>) {
|
||||
) -> Arc<crate::Data> {
|
||||
let queue = <T::QueueId>::from(*queue);
|
||||
let queue_data = downcast_ref(queue_data);
|
||||
let command_buffers = command_buffers.map(|(id, data)| {
|
||||
let command_buffer_data: <T as Context>::CommandBufferData = *data.downcast().unwrap();
|
||||
(<T::CommandBufferId>::from(id), command_buffer_data)
|
||||
});
|
||||
let (submission_index, data) =
|
||||
Context::queue_submit(self, &queue, queue_data, command_buffers);
|
||||
(submission_index.into(), Arc::new(data) as _)
|
||||
let data = Context::queue_submit(self, &queue, queue_data, command_buffers);
|
||||
Arc::new(data) as _
|
||||
}
|
||||
|
||||
fn queue_get_timestamp_period(&self, queue: &ObjectId, queue_data: &crate::Data) -> f32 {
|
||||
|
@ -186,7 +186,7 @@ static_assertions::assert_impl_all!(Device: Send, Sync);
|
||||
/// This type is unique to the Rust API of `wgpu`.
|
||||
/// There is no analogue in the WebGPU specification.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SubmissionIndex(ObjectId, Arc<crate::Data>);
|
||||
pub struct SubmissionIndex(Arc<crate::Data>);
|
||||
#[cfg(send_sync)]
|
||||
static_assertions::assert_impl_all!(SubmissionIndex: Send, Sync);
|
||||
|
||||
@ -5397,14 +5397,14 @@ impl Queue {
|
||||
.into_iter()
|
||||
.map(|mut comb| (comb.id.take().unwrap(), comb.data.take().unwrap()));
|
||||
|
||||
let (raw, data) = DynContext::queue_submit(
|
||||
let data = DynContext::queue_submit(
|
||||
&*self.context,
|
||||
&self.id,
|
||||
self.data.as_ref(),
|
||||
&mut command_buffers,
|
||||
);
|
||||
|
||||
SubmissionIndex(raw, data)
|
||||
SubmissionIndex(data)
|
||||
}
|
||||
|
||||
/// Gets the amount of nanoseconds each tick of a timestamp query represents.
|
||||
|
Loading…
Reference in New Issue
Block a user