mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
egl-configs: get the number of configs
This commit is contained in:
parent
90ba22b8d2
commit
89f6c6dbf0
1 changed files with 31 additions and 3 deletions
|
@ -1,5 +1,8 @@
|
||||||
mod ffi;
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
|
use ffi::types::*;
|
||||||
|
use std::ptr::null_mut;
|
||||||
|
|
||||||
|
mod ffi;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -7,6 +10,31 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn run() {
|
macro_rules! check {
|
||||||
let _display = GetDisplay(DEFAULT_DISPLAY as *mut _);
|
($name: ident ( $($arg: expr),* )) => {
|
||||||
|
check($name( $($arg),* ), stringify!($name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn run() {
|
||||||
|
let display = GetDisplay(DEFAULT_DISPLAY as *mut _);
|
||||||
|
assert!(!display.is_null());
|
||||||
|
|
||||||
|
check!(Initialize(display, null_mut(), null_mut()));
|
||||||
|
|
||||||
|
let mut num_config = -1;
|
||||||
|
check!(GetConfigs(display, null_mut(), 0, &mut num_config));
|
||||||
|
println!("Got {} configs", num_config);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn check(result: EGLBoolean, function_name: &str) {
|
||||||
|
check_error();
|
||||||
|
assert_eq!(result, TRUE, "{} failed", function_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe fn check_error() {
|
||||||
|
let status = GetError();
|
||||||
|
if status != SUCCESS as i32 {
|
||||||
|
println!("Error: 0x{:x}", status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue