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

5
Cargo.lock generated
View File

@@ -580,6 +580,7 @@ dependencies = [
"gl",
"glutin",
"image",
"libc",
"nalgebra-glm",
"rand",
"tobj",
@@ -755,9 +756,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
[[package]]
name = "libc"
version = "0.2.131"
version = "0.2.132"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40"
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
[[package]]
name = "libloading"

View File

@@ -16,3 +16,4 @@ tobj = "3.1.0"
image = "0.24.3"
nalgebra-glm = "0.17.0"
rand = "0.8.4"
libc = "0.2.132"

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);