Browse Source

Completely remove ctru-sys dep and fix some lints

pull/18/head
Ian Chamberlain 3 years ago
parent
commit
1177a32254
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 1
      citro3d-sys/Cargo.toml
  2. 1
      citro3d-sys/bindgen.sh
  3. 6
      citro3d-sys/src/bindings.rs
  4. 10
      citro3d-sys/src/lib.rs
  5. 8
      citro3d-sys/src/texenv.rs
  6. 1
      citro3d-sys/src/uniforms.rs
  7. 6
      citro3d/examples/triangle.rs

1
citro3d-sys/Cargo.toml

@ -6,4 +6,3 @@ edition = "2021" @@ -6,4 +6,3 @@ edition = "2021"
[dependencies]
libc = "0.2.116"
ctru-sys = { git = "https://github.com/Meziu/ctru-rs.git" }

1
citro3d-sys/bindgen.sh

@ -9,6 +9,7 @@ bindgen "$DEVKITPRO/libctru/include/citro3d.h" \ @@ -9,6 +9,7 @@ bindgen "$DEVKITPRO/libctru/include/citro3d.h" \
--no-layout-tests \
--ctypes-prefix "::libc" \
--no-prepend-enum-name \
--fit-macro-constant-types \
--generate "functions,types,vars" \
--blocklist-type "u(8|16|32|64)" \
--opaque-type "GPU_.*" \

6
citro3d-sys/src/bindings.rs

@ -82,9 +82,9 @@ where @@ -82,9 +82,9 @@ where
}
pub const C3D_AspectRatioTop: f64 = 1.6666666666666667;
pub const C3D_AspectRatioBot: f64 = 1.3333333333333333;
pub const C3D_MTXSTACK_SIZE: u32 = 8;
pub const C3D_FVUNIF_COUNT: u32 = 96;
pub const C3D_IVUNIF_COUNT: u32 = 4;
pub const C3D_MTXSTACK_SIZE: u8 = 8;
pub const C3D_FVUNIF_COUNT: u8 = 96;
pub const C3D_IVUNIF_COUNT: u8 = 4;
pub const C3D_DEFAULT_CMDBUF_SIZE: u32 = 262144;
pub type __int8_t = ::libc::c_schar;
pub type __uint8_t = ::libc::c_uchar;

10
citro3d-sys/src/lib.rs

@ -1,17 +1,15 @@ @@ -1,17 +1,15 @@
#![no_std]
#![allow(non_snake_case)]
#![feature(untagged_unions)] // used for [`C3D_Mtx`]
#![allow(warnings)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(clippy::all)]
pub mod base;
pub mod renderqueue;
pub mod texenv;
pub mod uniforms;
#[allow(warnings)]
#[allow(warnings)]
#[allow(non_upper_case_globals)]
#[allow(non_camel_case_types)]
#[allow(clippy::all)]
mod bindings;
pub use base::*;

8
citro3d-sys/src/texenv.rs

@ -26,14 +26,14 @@ where @@ -26,14 +26,14 @@ where
}
pub unsafe fn C3D_TexEnvInit(env: *mut C3D_TexEnv) {
(*env).srcRgb = gpu_tevsources(ctru_sys::GPU_PREVIOUS, 0, 0) as u16;
(*env).srcRgb = gpu_tevsources(GPU_PREVIOUS, 0, 0) as u16;
(*env).srcAlpha = (*env).srcRgb;
(*env).__bindgen_anon_1.opAll = 0;
(*env).funcRgb = ctru_sys::GPU_REPLACE as u16;
(*env).funcRgb = GPU_REPLACE as u16;
(*env).funcAlpha = (*env).funcRgb;
(*env).color = 0xFFFFFFFF;
(*env).scaleRgb = ctru_sys::GPU_TEVSCALE_1 as u16;
(*env).scaleAlpha = ctru_sys::GPU_TEVSCALE_1 as u16;
(*env).scaleRgb = GPU_TEVSCALE_1 as u16;
(*env).scaleAlpha = GPU_TEVSCALE_1 as u16;
}
// TODO: maybe

1
citro3d-sys/src/uniforms.rs

@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
use super::*;
use ctru_sys::GPU_SHADER_TYPE;
use libc::c_int;
#[inline]

6
citro3d/examples/triangle.rs

@ -57,7 +57,7 @@ fn main() { @@ -57,7 +57,7 @@ fn main() {
break;
}
const CLEAR_COLOR: u32 = 0x68B0D8FF;
const CLEAR_COLOR: u32 = 0x68_B0_D8_FF;
unsafe {
citro3d_sys::C3D_FrameBegin(citro3d_sys::C3D_FRAME_SYNCDRAW as u8);
@ -77,6 +77,8 @@ fn main() { @@ -77,6 +77,8 @@ fn main() {
citro3d_sys::C3D_Fini();
}
}
#[repr(C)]
struct Vertex {
x: f32,
y: f32,
@ -156,7 +158,7 @@ fn scene_init() -> (shaderProgram_s, i8, C3D_Mtx, *mut libc::c_void, *mut DVLB_s @@ -156,7 +158,7 @@ fn scene_init() -> (shaderProgram_s, i8, C3D_Mtx, *mut libc::c_void, *mut DVLB_s
let vbo_data =
citro3d_sys::linearAlloc(vertices_len.try_into().expect("size does not fit in u32"));
vbo_data.copy_from(VERTICES.as_ptr() as _, vertices_len);
vbo_data.copy_from(VERTICES.as_ptr().cast(), vertices_len);
// Configure buffers
let buf_info = citro3d_sys::C3D_GetBufInfo();

Loading…
Cancel
Save