mirror of
https://github.com/servo/servo.git
synced 2025-08-13 01:15:34 +01:00
Use an appropriate graphics adapter when openxr is present.
This commit is contained in:
parent
50e05a83b4
commit
cacefbad17
2 changed files with 21 additions and 7 deletions
|
@ -40,6 +40,7 @@ use std::mem;
|
|||
use std::os::raw::c_void;
|
||||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use surfman::Adapter;
|
||||
use surfman::Connection;
|
||||
use surfman::SurfaceType;
|
||||
|
||||
|
@ -211,9 +212,12 @@ pub fn init(
|
|||
|
||||
// Initialize surfman
|
||||
let connection = Connection::new().or(Err("Failed to create connection"))?;
|
||||
let adapter = connection
|
||||
.create_adapter()
|
||||
.or(Err("Failed to create adapter"))?;
|
||||
let adapter = match create_adapter() {
|
||||
Some(adapter) => adapter,
|
||||
None => connection
|
||||
.create_adapter()
|
||||
.or(Err("Failed to create adapter"))?,
|
||||
};
|
||||
let native_widget = unsafe {
|
||||
connection.create_native_widget_from_ptr(
|
||||
init_opts.native_widget,
|
||||
|
@ -950,3 +954,13 @@ impl ResourceReaderMethods for ResourceReaderInstance {
|
|||
vec![]
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "uwp")]
|
||||
fn create_adapter() -> Option<Adapter> {
|
||||
webxr::openxr::create_surfman_adapter()
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "uwp"))]
|
||||
fn create_adapter() -> Option<Adapter> {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue