390: Buffer creation in wgpu-remote r=kvark a=kvark



Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot] 2019-11-28 22:19:09 +00:00 committed by GitHub
commit be600f3708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 8 deletions

View File

@ -169,7 +169,6 @@ impl<F> Global<F> {
range: pending.selector,
});
let aspects = dst_texture.full_range.aspects;
let bytes_per_texel = conv::map_texture_format(dst_texture.format, cmb.features)
.surface_desc()
.bits as u32
@ -246,7 +245,6 @@ impl<F> Global<F> {
range: None .. None,
});
let aspects = src_texture.full_range.aspects;
let bytes_per_texel = conv::map_texture_format(src_texture.format, cmb.features)
.surface_desc()
.bits as u32
@ -328,7 +326,6 @@ impl<F> Global<F> {
range: pending.selector,
}));
let aspects = src_texture.full_range.aspects & dst_texture.full_range.aspects;
let region = hal::command::ImageCopy {
src_subresource: source.to_sub_layers(aspects),
src_offset: conv::map_origin(source.origin),

View File

@ -4,7 +4,7 @@
use core::{
hub::IdentityManager,
id::{AdapterId, DeviceId},
id,
Backend,
};
@ -19,6 +19,7 @@ pub mod server;
struct IdentityHub {
adapters: IdentityManager,
devices: IdentityManager,
buffers: IdentityManager,
}
#[derive(Debug, Default)]
@ -77,7 +78,7 @@ pub extern "C" fn wgpu_client_delete(client: *mut Client) {
#[no_mangle]
pub extern "C" fn wgpu_client_make_adapter_ids(
client: &Client,
ids: *mut AdapterId,
ids: *mut id::AdapterId,
id_length: usize,
) -> usize {
let mut identities = client.identities.lock();
@ -101,7 +102,7 @@ pub extern "C" fn wgpu_client_make_adapter_ids(
#[no_mangle]
pub extern "C" fn wgpu_client_kill_adapter_ids(
client: &Client,
ids: *const AdapterId,
ids: *const id::AdapterId,
id_length: usize,
) {
let mut identity = client.identities.lock();
@ -112,7 +113,7 @@ pub extern "C" fn wgpu_client_kill_adapter_ids(
}
#[no_mangle]
pub extern "C" fn wgpu_client_make_device_id(client: &Client, adapter_id: AdapterId) -> DeviceId {
pub extern "C" fn wgpu_client_make_device_id(client: &Client, adapter_id: id::AdapterId) -> id::DeviceId {
let backend = adapter_id.backend();
client
.identities
@ -123,7 +124,7 @@ pub extern "C" fn wgpu_client_make_device_id(client: &Client, adapter_id: Adapte
}
#[no_mangle]
pub extern "C" fn wgpu_client_kill_device_id(client: &Client, id: DeviceId) {
pub extern "C" fn wgpu_client_kill_device_id(client: &Client, id: id::DeviceId) {
client
.identities
.lock()
@ -131,3 +132,24 @@ pub extern "C" fn wgpu_client_kill_device_id(client: &Client, id: DeviceId) {
.devices
.free(id)
}
#[no_mangle]
pub extern "C" fn wgpu_client_make_buffer_id(client: &Client, device_id: id::DeviceId) -> id::BufferId {
let backend = device_id.backend();
client
.identities
.lock()
.select(backend)
.buffers
.alloc(backend)
}
#[no_mangle]
pub extern "C" fn wgpu_client_kill_buffer_id(client: &Client, id: id::BufferId) {
client
.identities
.lock()
.select(id.backend())
.buffers
.free(id)
}

View File

@ -54,3 +54,13 @@ pub extern "C" fn wgpu_server_adapter_request_device(
pub extern "C" fn wgpu_server_device_destroy(global: &Global<()>, self_id: id::DeviceId) {
gfx_select!(self_id => global.device_destroy(self_id))
}
#[no_mangle]
pub extern "C" fn wgpu_server_device_create_buffer(
global: &Global<()>,
self_id: id::DeviceId,
desc: &core::resource::BufferDescriptor,
new_id: id::BufferId,
) {
gfx_select!(self_id => global.device_create_buffer(self_id, desc, new_id));
}