mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 07:51:08 +01:00
Improve the consistency of identifiers (#5108)
This commit is contained in:
1 parent
4face1c2ba
commit
dec6ea5ea4
31 files changed
+687
-572
No files matched your search
@@ -61,7 +61,7 @@ fn main() {
|
||||
global.instance_create_surface(
|
||||
window.display_handle().unwrap().into(),
|
||||
window.window_handle().unwrap().into(),
|
||||
wgc::id::TypedId::zip(0, 1, wgt::Backend::Empty),
|
||||
wgc::id::Id::zip(0, 1, wgt::Backend::Empty),
|
||||
)
|
||||
}
|
||||
.unwrap();
|
||||
@@ -79,22 +79,21 @@ fn main() {
|
||||
#[cfg(not(feature = "winit"))]
|
||||
compatible_surface: None,
|
||||
},
|
||||
wgc::instance::AdapterInputs::IdSet(
|
||||
&[wgc::id::TypedId::zip(0, 0, backend)],
|
||||
|id| id.backend(),
|
||||
),
|
||||
wgc::instance::AdapterInputs::IdSet(&[wgc::id::Id::zip(0, 0, backend)], |id| {
|
||||
id.backend()
|
||||
}),
|
||||
)
|
||||
.expect("Unable to find an adapter for selected backend");
|
||||
|
||||
let info = gfx_select!(adapter => global.adapter_get_info(adapter)).unwrap();
|
||||
log::info!("Picked '{}'", info.name);
|
||||
let id = wgc::id::TypedId::zip(1, 0, backend);
|
||||
let id = wgc::id::Id::zip(1, 0, backend);
|
||||
let (_, _, error) = gfx_select!(adapter => global.adapter_request_device(
|
||||
adapter,
|
||||
&desc,
|
||||
None,
|
||||
id,
|
||||
id
|
||||
id.transmute()
|
||||
));
|
||||
if let Some(e) = error {
|
||||
panic!("{:?}", e);
|
||||
|
||||
+11
-10
@@ -14,10 +14,10 @@ use std::{borrow::Cow, fs, path::Path};
|
||||
|
||||
pub struct IdentityPassThroughFactory;
|
||||
|
||||
impl<I: wgc::id::TypedId> wgc::identity::IdentityHandlerFactory<I> for IdentityPassThroughFactory {
|
||||
type Input = I;
|
||||
impl<T: wgc::id::Marker> wgc::identity::IdentityHandlerFactory<T> for IdentityPassThroughFactory {
|
||||
type Input = wgc::id::Id<T>;
|
||||
|
||||
fn input_to_id(id_in: Self::Input) -> I {
|
||||
fn input_to_id(id_in: Self::Input) -> wgc::id::Id<T> {
|
||||
id_in
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ pub trait GlobalPlay {
|
||||
device: wgc::id::DeviceId,
|
||||
action: trace::Action,
|
||||
dir: &Path,
|
||||
comb_manager: &mut wgc::identity::IdentityManager<wgc::id::CommandBufferId>,
|
||||
comb_manager: &mut wgc::identity::IdentityManager<wgc::id::markers::CommandBuffer>,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
device: wgc::id::DeviceId,
|
||||
action: trace::Action,
|
||||
dir: &Path,
|
||||
comb_manager: &mut wgc::identity::IdentityManager<wgc::id::CommandBufferId>,
|
||||
comb_manager: &mut wgc::identity::IdentityManager<wgc::id::markers::CommandBuffer>,
|
||||
) {
|
||||
use wgc::device::trace::Action;
|
||||
log::debug!("action {:?}", action);
|
||||
@@ -350,7 +350,7 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
let bin = std::fs::read(dir.join(data)).unwrap();
|
||||
let size = (range.end - range.start) as usize;
|
||||
if queued {
|
||||
self.queue_write_buffer::<A>(device, id, range.start, &bin)
|
||||
self.queue_write_buffer::<A>(device.transmute(), id, range.start, &bin)
|
||||
.unwrap();
|
||||
} else {
|
||||
self.device_wait_for_buffer::<A>(device, id).unwrap();
|
||||
@@ -365,23 +365,24 @@ impl GlobalPlay for wgc::global::Global<IdentityPassThroughFactory> {
|
||||
size,
|
||||
} => {
|
||||
let bin = std::fs::read(dir.join(data)).unwrap();
|
||||
self.queue_write_texture::<A>(device, &to, &bin, &layout, &size)
|
||||
self.queue_write_texture::<A>(device.transmute(), &to, &bin, &layout, &size)
|
||||
.unwrap();
|
||||
}
|
||||
Action::Submit(_index, ref commands) if commands.is_empty() => {
|
||||
self.queue_submit::<A>(device, &[]).unwrap();
|
||||
self.queue_submit::<A>(device.transmute(), &[]).unwrap();
|
||||
}
|
||||
Action::Submit(_index, commands) => {
|
||||
let (encoder, error) = self.device_create_command_encoder::<A>(
|
||||
device,
|
||||
&wgt::CommandEncoderDescriptor { label: None },
|
||||
comb_manager.process(device.backend()),
|
||||
comb_manager.process(device.backend()).transmute(),
|
||||
);
|
||||
if let Some(e) = error {
|
||||
panic!("{e}");
|
||||
}
|
||||
let cmdbuf = self.encode_commands::<A>(encoder, commands);
|
||||
self.queue_submit::<A>(device, &[cmdbuf]).unwrap();
|
||||
self.queue_submit::<A>(device.transmute(), &[cmdbuf])
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user