Debug FPS display with rendering backend info
This commit is contained in:
1 parent
ee7b76fa6a
commit
07371cc893
8 files changed
+133
-4
No files matched your search
@@ -35,6 +35,7 @@ mod imp {
|
||||
fn dc_ws_send(id: i32, p: *const u8, pl: u32) -> i32;
|
||||
fn dc_ws_take(id: i32) -> i32;
|
||||
fn dc_ws_close(id: i32);
|
||||
fn dc_renderer() -> i32;
|
||||
}
|
||||
|
||||
// starts a request; poll the returned id with http_poll()
|
||||
@@ -171,6 +172,18 @@ mod imp {
|
||||
unsafe { dc_ws_close(id) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn renderer() -> String {
|
||||
unsafe {
|
||||
let n = dc_renderer();
|
||||
if n < 0 {
|
||||
return String::new();
|
||||
}
|
||||
let mut buf = vec![0u8; n as usize];
|
||||
dc_storage_take(buf.as_mut_ptr());
|
||||
String::from_utf8(buf).unwrap_or_default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@@ -233,6 +246,21 @@ mod imp {
|
||||
None
|
||||
}
|
||||
pub fn ws_close(_id: i32) {}
|
||||
|
||||
pub fn renderer() -> String {
|
||||
#[cfg(target_vendor = "apple")]
|
||||
{
|
||||
use macroquad::miniquad::conf::AppleGfxApi;
|
||||
return match macroquad::miniquad::window::apple_gfx_api() {
|
||||
AppleGfxApi::Metal => "Metal".into(),
|
||||
AppleGfxApi::OpenGl => "OpenGL".into(),
|
||||
};
|
||||
}
|
||||
#[cfg(not(target_vendor = "apple"))]
|
||||
{
|
||||
return "OpenGL".into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use imp::*;
|
||||
|
||||
Reference in new issue
Block a user