AArch64 support

This commit is contained in:
Jesper Hustad
2022-08-30 16:36:34 +02:00
parent 0d03698914
commit cf3844a265
3 changed files with 8 additions and 5 deletions

View File

@@ -1,14 +1,15 @@
use std::ffi::CString;
use libc;
pub unsafe fn get_gl_string(name: gl::types::GLenum) -> String {
std::ffi::CStr::from_ptr(gl::GetString(name) as *mut i8).to_string_lossy().to_string()
std::ffi::CStr::from_ptr(gl::GetString(name) as *mut libc::c_char).to_string_lossy().to_string()
}
// Debug callback to panic upon enountering any OpenGL error
pub extern "system" fn debug_callback(
source: u32, e_type: u32, id: u32,
severity: u32, _length: i32,
msg: *const i8, _data: *mut std::ffi::c_void
msg: *const libc::c_char, _data: *mut std::ffi::c_void
) {
if e_type != gl::DEBUG_TYPE_ERROR { return }
if severity == gl::DEBUG_SEVERITY_HIGH ||
@@ -22,7 +23,7 @@ pub extern "system" fn debug_callback(
_ => "unknown",
};
unsafe {
let string = CString::from_raw(msg as *mut i8);
let string = CString::from_raw(msg as *mut libc::c_char);
let error_message = String::from_utf8_lossy(string.as_bytes()).to_string();
panic!("{}: Error of severity {} raised from {}: {}\n",
id, severity_string, source, error_message);