From cf3844a265d0c9a69f7ce26b875be681802627a0 Mon Sep 17 00:00:00 2001 From: Jesper Hustad Date: Tue, 30 Aug 2022 16:36:34 +0200 Subject: [PATCH] AArch64 support --- Cargo.lock | 5 +++-- Cargo.toml | 1 + src/util.rs | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 86753f3..b82e002 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index c05229b..8837b6b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/util.rs b/src/util.rs index 18fe0f4..79b2529 100644 --- a/src/util.rs +++ b/src/util.rs @@ -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);