mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 14:01:08 +01:00
add serde into scope and fix wgpu-remote
This commit is contained in:
1 parent
565e5fdfeb
commit
10547b937f
2 files changed
+12
-7
No files matched your search
@@ -38,6 +38,8 @@ pub use self::pipeline::*;
|
||||
pub use self::resource::*;
|
||||
pub use self::swap_chain::*;
|
||||
use self::hub::{Epoch, Id, Index, NewId};
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::ptr;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
@@ -222,7 +224,6 @@ macro_rules! new_id {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
define_id!(InstanceId);
|
||||
type InstanceHandle = back::Instance;
|
||||
|
||||
|
||||
+10
-6
@@ -1,5 +1,6 @@
|
||||
//TODO: remove once `cbindgen` is smart enough
|
||||
extern crate wgpu_native as wgn;
|
||||
use wgn::TypedId;
|
||||
|
||||
use crate::server::Server;
|
||||
|
||||
@@ -92,7 +93,8 @@ pub extern "C" fn wgpu_terminate(factory: *mut ClientFactory) {
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_client_create(factory: &ClientFactory) -> *mut Client {
|
||||
let instance_id = factory.instance_identities.lock().alloc();
|
||||
let id = factory.instance_identities.lock().alloc();
|
||||
let instance_id = id.into();
|
||||
let msg = GlobalMessage::Instance(InstanceMessage::Create(instance_id));
|
||||
factory.channel.send(msg).unwrap();
|
||||
let client = Client {
|
||||
@@ -108,7 +110,7 @@ pub extern "C" fn wgpu_client_destroy(factory: &ClientFactory, client: *mut Clie
|
||||
let client = unsafe {
|
||||
Box::from_raw(client)
|
||||
};
|
||||
factory.instance_identities.lock().free(client.instance_id);
|
||||
factory.instance_identities.lock().free(client.instance_id.raw());
|
||||
let msg = GlobalMessage::Instance(InstanceMessage::Destroy(client.instance_id));
|
||||
client.channel.send(msg).unwrap();
|
||||
}
|
||||
@@ -119,13 +121,14 @@ pub extern "C" fn wgpu_client_get_adapter(
|
||||
desc: &wgn::AdapterDescriptor,
|
||||
) -> wgn::AdapterId {
|
||||
let id = client.identity.lock().adapters.alloc();
|
||||
let adapter_id = id.into();
|
||||
let msg = GlobalMessage::Instance(InstanceMessage::InstanceGetAdapter(
|
||||
client.instance_id,
|
||||
desc.clone(),
|
||||
id,
|
||||
adapter_id,
|
||||
));
|
||||
client.channel.send(msg).unwrap();
|
||||
id
|
||||
adapter_id
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
@@ -135,11 +138,12 @@ pub extern "C" fn wgpu_client_adapter_create_device(
|
||||
desc: &wgn::DeviceDescriptor,
|
||||
) -> wgn::DeviceId {
|
||||
let id = client.identity.lock().devices.alloc();
|
||||
let device_id = id.into();
|
||||
let msg = GlobalMessage::Instance(InstanceMessage::AdapterCreateDevice(
|
||||
adapter_id,
|
||||
desc.clone(),
|
||||
id,
|
||||
device_id,
|
||||
));
|
||||
client.channel.send(msg).unwrap();
|
||||
id
|
||||
device_id
|
||||
}
|
||||
Reference in new issue
Block a user