mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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::types::*;
|
||||
use std::ptr::null_mut;
|
||||
|
||||
mod ffi;
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
|
@ -7,6 +10,31 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe fn run() {
|
||||
let _display = GetDisplay(DEFAULT_DISPLAY as *mut _);
|
||||
macro_rules! check {
|
||||
($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