331: Add a function to describe a device r=kvark a=paulkernfeld

This is for https://github.com/gfx-rs/wgpu-rs/pull/29

This successfully describes the device on my machine. I think I may have done the imports wrong. If so, apologies.

Co-authored-by: Paul Kernfeld <paulkernfeld@gmail.com>
This commit is contained in:
bors[bot]andPaul Kernfeld authored and GitHub committed 2019-09-12 01:42:08 +00:00
commit c3609d71c9
2 files changed
+17

No files matched your search

+16
View File
@@ -5,6 +5,7 @@ use crate::{
hub::{GfxBackend, Token, GLOBAL},
id::{Input, Output},
AdapterId,
AdapterInfo,
Backend,
Device,
DeviceId,
@@ -478,3 +479,18 @@ pub extern "C" fn wgpu_adapter_request_device(
let desc = &desc.cloned().unwrap_or_default();
gfx_select!(adapter_id => adapter_request_device(adapter_id, desc, PhantomData))
}
pub fn adapter_get_info<B: GfxBackend>(adapter_id: AdapterId) -> AdapterInfo {
let hub = B::hub();
let mut token = Token::root();
let (adapter_guard, _) = hub.adapters.read(&mut token);
let adapter = &adapter_guard[adapter_id];
adapter.raw.info.clone()
}
#[cfg(not(feature = "remote"))]
pub fn wgpu_adapter_get_info(
adapter_id: AdapterId
) -> AdapterInfo {
gfx_select!(adapter_id => adapter_get_info(adapter_id))
}
+1
View File
@@ -33,6 +33,7 @@ pub use self::pipeline::*;
pub use self::resource::*;
pub use self::swap_chain::*;
pub use hal::pso::read_spirv;
pub use hal::adapter::AdapterInfo;
use std::{
os::raw::c_char,