diff --git a/ctru-sys/src/gpu/gpu.rs b/ctru-sys/src/gpu/gpu.rs index 30e7a03..47ba027 100644 --- a/ctru-sys/src/gpu/gpu.rs +++ b/ctru-sys/src/gpu/gpu.rs @@ -1,26 +1,27 @@ /* automatically generated by rust-bindgen */ -#[inline] -pub fn GPUCMD_HEADER(incremental: u32, mask: u32, reg: u32) -> u32{ - (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF)) +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +extern "C" { + pub static mut gpuCmdBuf: *mut u32_; + pub static mut gpuCmdBufSize: u32_; + pub static mut gpuCmdBufOffset: u32_; } - extern "C" { - pub static mut gpuCmdBuf: *mut u32; - pub static mut gpuCmdBufSize: u32; - pub static mut gpuCmdBufOffset: u32; - - pub fn GPUCMD_SetBuffer(adr: *mut u32, size: u32, offset: u32); - pub fn GPUCMD_SetBufferOffset(offset: u32); - pub fn GPUCMD_GetBuffer(adr: *mut *mut u32, size: *mut u32, - offset: *mut u32); - pub fn GPUCMD_AddRawCommands(cmd: *mut u32, size: u32); + pub fn GPUCMD_SetBuffer(adr: *mut u32_, size: u32_, offset: u32_); + pub fn GPUCMD_SetBufferOffset(offset: u32_); + pub fn GPUCMD_GetBuffer(adr: *mut *mut u32_, size: *mut u32_, + offset: *mut u32_); + pub fn GPUCMD_AddRawCommands(cmd: *const u32_, size: u32_); pub fn GPUCMD_Run(); pub fn GPUCMD_FlushAndRun(); - pub fn GPUCMD_Add(header: u32, param: *mut u32, paramlength: u32); + pub fn GPUCMD_Add(header: u32_, param: *const u32_, paramlength: u32_); pub fn GPUCMD_Finalize(); - pub fn f32tof16(f: f32) -> u32; - pub fn f32tof20(f: f32) -> u32; - pub fn f32tof24(f: f32) -> u32; - pub fn f32tof31(f: f32) -> u32; + pub fn f32tof16(f: f32) -> u32_; + pub fn f32tof20(f: f32) -> u32_; + pub fn f32tof24(f: f32) -> u32_; + pub fn f32tof31(f: f32) -> u32_; } +use ::types::*; diff --git a/ctru-sys/src/gpu/gx.rs b/ctru-sys/src/gpu/gx.rs index 69eeddf..22b7949 100644 --- a/ctru-sys/src/gpu/gx.rs +++ b/ctru-sys/src/gpu/gx.rs @@ -1,94 +1,55 @@ -use ::Result; - -#[inline] -pub fn GX_BUFFER_DIM(w: u32, h: u32) { - (((h)<<16)|((w)&0xFFFF)); -} - -#[repr(C)] -pub enum GX_TRANSFER_FORMAT -{ - GX_TRANSFER_FMT_RGBA8 = 0, - GX_TRANSFER_FMT_RGB8 = 1, - GX_TRANSFER_FMT_RGB565 = 2, - GX_TRANSFER_FMT_RGB5A1 = 3, - GX_TRANSFER_FMT_RGBA4 = 4, -} - -#[repr(C)] -pub enum GX_TRANSFER_SCALE -{ - GX_TRANSFER_SCALE_NO = 0, - GX_TRANSFER_SCALE_X = 1, - GX_TRANSFER_SCALE_Y = 2, -} - -#[repr(C)] +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum GX_TRANSFER_FORMAT { + GX_TRANSFER_FMT_RGBA8 = 0, + GX_TRANSFER_FMT_RGB8 = 1, + GX_TRANSFER_FMT_RGB565 = 2, + GX_TRANSFER_FMT_RGB5A1 = 3, + GX_TRANSFER_FMT_RGBA4 = 4, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum GX_TRANSFER_SCALE { + GX_TRANSFER_SCALE_NO = 0, + GX_TRANSFER_SCALE_X = 1, + GX_TRANSFER_SCALE_XY = 2, +} +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] pub enum GX_FILL_CONTROL { - GX_FILL_TRIGGER = 0x001, - GX_FILL_FINISHED = 0x002, - GX_FILL_16BIT_DEPTH = 0x000, - GX_FILL_24BIT_DEPTH = 0x100, - GX_FILL_32BIT_DEPTH = 0x200, -} - -#[inline] -pub fn GX_TRANSFER_FLIP_VERT(x: i32) { - ((x)<<0); -} - -#[inline] -pub fn GX_TRANSFER_OUT_TILED(x: i32) { - ((x)<<1); -} - -#[inline] -pub fn GX_TRANSFER_RAW_COPY(x: i32) { - ((x)<<3); + GX_FILL_TRIGGER = 1, + GX_FILL_FINISHED = 2, + GX_FILL_16BIT_DEPTH = 0, + GX_FILL_24BIT_DEPTH = 256, + GX_FILL_32BIT_DEPTH = 512, } - -#[inline] -pub fn GX_TRANSFER_IN_FORMAT(x: i32) { - ((x)<<8); -} - -#[inline] -pub fn GX_TRANSFER_OUT_FORMAT(x: i32) { - ((x)<<12); -} - -#[inline] -pub fn GX_TRANSFER_SCALING(x: i32) { - ((x)<<24); -} - -#[inline] -pub fn GX_CMDLIST_BIT0() { - (1u32<<(0)); -} - -#[inline] -pub fn GX_CMNDLIST_FLUSH() { - (1u32<<(1)); +extern "C" { + pub static mut gxCmdBuf: *mut u32_; } - extern "C" { - pub static mut gxCmdBuf: *mut u32; - - pub fn GX_RequestDma(src: *mut u32, dst: *mut u32, length: u32) + pub fn GX_RequestDma(src: *mut u32_, dst: *mut u32_, length: u32_) -> Result; - pub fn GX_ProcessCommandList(buf0a: *mut u32, buf0s: u32, flags: u8) + pub fn GX_ProcessCommandList(buf0a: *mut u32_, buf0s: u32_, flags: u8_) -> Result; - pub fn GX_MemoryFill(buf0a: *mut u32, buf0v: u32, buf0e: *mut u32, - control0: u16, buf1a: *mut u32, buf1v: u32, - buf1e: *mut u32, control1: u16) -> Result; - pub fn GX_DisplayTransfer(inadr: *mut u32, indim: u32, - outadr: *mut u32, outdim: u32, flags: u32) + pub fn GX_MemoryFill(buf0a: *mut u32_, buf0v: u32_, buf0e: *mut u32_, + control0: u16_, buf1a: *mut u32_, buf1v: u32_, + buf1e: *mut u32_, control1: u16_) -> Result; + pub fn GX_DisplayTransfer(inadr: *mut u32_, indim: u32_, + outadr: *mut u32_, outdim: u32_, flags: u32_) -> Result; - pub fn GX_TextureCopy(inadr: *mut u32, indim: u32, outadr: *mut u32, - outdim: u32, size: u32, flags: u32) -> Result; - pub fn GX_FlushCacheRegions(buf0a: *mut u32, buf0s: u32, - buf1a: *mut u32, buf1s: u32, - buf2a: *mut u32, buf2s: u32) -> Result; + pub fn GX_TextureCopy(inadr: *mut u32_, indim: u32_, outadr: *mut u32_, + outdim: u32_, size: u32_, flags: u32_) -> Result; + pub fn GX_FlushCacheRegions(buf0a: *mut u32_, buf0s: u32_, + buf1a: *mut u32_, buf1s: u32_, + buf2a: *mut u32_, buf2s: u32_) -> Result; } - +use ::types::*; diff --git a/ctru-sys/src/gpu/shaderProgram.rs b/ctru-sys/src/gpu/shaderProgram.rs index 4d56d1d..1c86711 100644 --- a/ctru-sys/src/gpu/shaderProgram.rs +++ b/ctru-sys/src/gpu/shaderProgram.rs @@ -1,88 +1,68 @@ -use ::types::*; -use gpu::shbin::*; - +/* automatically generated by rust-bindgen */ +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed1 { - pub id: u32, - pub data: [u32; 3usize], -} -impl ::core::clone::Clone for Struct_Unnamed1 { - fn clone(&self) -> Self { *self } +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct float24Uniform_s { + pub id: u32_, + pub data: [u32_; 3usize], } -impl ::core::default::Default for Struct_Unnamed1 { +impl ::core::default::Default for float24Uniform_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type float24Uniform_s = Struct_Unnamed1; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed2 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct shaderInstance_s { pub dvle: *mut DVLE_s, - pub boolUniforms: u16, - pub boolUniformMask: u16, - pub intUniforms: [u32; 4usize], + pub boolUniforms: u16_, + pub boolUniformMask: u16_, + pub intUniforms: [u32_; 4usize], pub float24Uniforms: *mut float24Uniform_s, - pub intUniformMask: u8, - pub numFloat24Uniforms: u8, + pub intUniformMask: u8_, + pub numFloat24Uniforms: u8_, } -impl ::core::clone::Clone for Struct_Unnamed2 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed2 { +impl ::core::default::Default for shaderInstance_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type shaderInstance_s = Struct_Unnamed2; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed3 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct shaderProgram_s { pub vertexShader: *mut shaderInstance_s, pub geometryShader: *mut shaderInstance_s, - pub geoShaderInputPermutation: [u32; 2usize], - pub geoShaderInputStride: u8, - pub geoShaderMode: u8, -} -impl ::core::clone::Clone for Struct_Unnamed3 { - fn clone(&self) -> Self { *self } + pub geoShaderInputPermutation: [u32_; 2usize], + pub geoShaderInputStride: u8_, } -impl ::core::default::Default for Struct_Unnamed3 { +impl ::core::default::Default for shaderProgram_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type shaderProgram_s = Struct_Unnamed3; -#[derive(Clone, Copy)] -#[repr(u32)] -pub enum Enum_Unnamed4 { - GSH_NORMAL = 0, - GSH_PARTICLE = 1, - GSH_SUBDIVISION_LOOP = 2, - GSH_SUBDIVISION_CATMULL_CLARK = 3, -} -pub type geoShaderMode = Enum_Unnamed4; extern "C" { pub fn shaderInstanceInit(si: *mut shaderInstance_s, dvle: *mut DVLE_s) -> Result; pub fn shaderInstanceFree(si: *mut shaderInstance_s) -> Result; - pub fn shaderInstanceSetBool(si: *mut shaderInstance_s, - id: i32, value: u8) - -> Result; - pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, - id: i32, value: *mut u8) - -> Result; + pub fn shaderInstanceSetBool(si: *mut shaderInstance_s, id: ::libc::c_int, + value: u8) -> Result; + pub fn shaderInstanceGetBool(si: *mut shaderInstance_s, id: ::libc::c_int, + value: *mut u8) -> Result; pub fn shaderInstanceGetUniformLocation(si: *mut shaderInstance_s, - name: - *const u8) + name: *const ::libc::c_char) -> s8; pub fn shaderProgramInit(sp: *mut shaderProgram_s) -> Result; pub fn shaderProgramFree(sp: *mut shaderProgram_s) -> Result; pub fn shaderProgramSetVsh(sp: *mut shaderProgram_s, dvle: *mut DVLE_s) -> Result; pub fn shaderProgramSetGsh(sp: *mut shaderProgram_s, dvle: *mut DVLE_s, - stride: u8) -> Result; + stride: u8_) -> Result; pub fn shaderProgramSetGshInputPermutation(sp: *mut shaderProgram_s, - permutation: u64) -> Result; - pub fn shaderProgramSetGshMode(sp: *mut shaderProgram_s, - mode: geoShaderMode) -> Result; + permutation: u64_) -> Result; pub fn shaderProgramConfigure(sp: *mut shaderProgram_s, sendVshCode: u8, sendGshCode: u8) -> Result; pub fn shaderProgramUse(sp: *mut shaderProgram_s) -> Result; } +use ::types::*; +use super::shbin::*; diff --git a/ctru-sys/src/gpu/shbin.rs b/ctru-sys/src/gpu/shbin.rs index 1c5a453..67bf419 100644 --- a/ctru-sys/src/gpu/shbin.rs +++ b/ctru-sys/src/gpu/shbin.rs @@ -1,23 +1,25 @@ -use ::types::*; +/* automatically generated by rust-bindgen */ -#[derive(Clone, Copy)] +#![allow(dead_code, + non_camel_case_types, + non_upper_case_globals, + non_snake_case)] +#[derive(Copy, Clone)] #[repr(u32)] -pub enum Enum_Unnamed1 { - VERTEX_SHDR = 0, - GEOMETRY_SHDR = 1, -} -pub type DVLE_type = Enum_Unnamed1; -#[derive(Clone, Copy)] +#[derive(Debug)] +pub enum DVLE_type { VERTEX_SHDR = 0, GEOMETRY_SHDR = 1, } +#[derive(Copy, Clone)] #[repr(u32)] -pub enum Enum_Unnamed2 { +#[derive(Debug)] +pub enum DVLE_constantType { DVLE_CONST_BOOL = 0, DVLE_CONST_u8 = 1, DVLE_CONST_FLOAT24 = 2, } -pub type DVLE_constantType = Enum_Unnamed2; -#[derive(Clone, Copy)] +#[derive(Copy, Clone)] #[repr(u32)] -pub enum Enum_Unnamed3 { +#[derive(Debug)] +pub enum DVLE_outputAttribute_t { RESULT_POSITION = 0, RESULT_NORMALQUAT = 1, RESULT_COLOR = 2, @@ -26,111 +28,107 @@ pub enum Enum_Unnamed3 { RESULT_TEXCOORD1 = 5, RESULT_TEXCOORD2 = 6, RESULT_VIEW = 8, + RESULT_DUMMY = 9, } -pub type DVLE_outputAttribute_t = Enum_Unnamed3; -#[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed4 { - pub codeSize: u32, - pub codeData: *mut u32, - pub opdescSize: u32, - pub opcdescData: *mut u32, -} -impl ::core::clone::Clone for Struct_Unnamed4 { - fn clone(&self) -> Self { *self } +#[derive(Copy, Clone)] +#[repr(u32)] +#[derive(Debug)] +pub enum DVLE_geoShaderMode { + GSH_POINT = 0, + GSH_VARIABLE_PRIM = 1, + GSH_FIXED_PRIM = 2, } -impl ::core::default::Default for Struct_Unnamed4 { +#[repr(C)] +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLP_s { + pub codeSize: u32_, + pub codeData: *mut u32_, + pub opdescSize: u32_, + pub opcdescData: *mut u32_, +} +impl ::core::default::Default for DVLP_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLP_s = Struct_Unnamed4; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed5 { - pub _type: u16, - pub id: u16, - pub data: [u32; 4usize], -} -impl ::core::clone::Clone for Struct_Unnamed5 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed5 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLE_constEntry_s { + pub type_: u16_, + pub id: u16_, + pub data: [u32_; 4usize], +} +impl ::core::default::Default for DVLE_constEntry_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLE_constEntry_s = Struct_Unnamed5; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed6 { - pub _type: u16, - pub regID: u16, - pub mask: u8, - pub unk: [u8; 3usize], -} -impl ::core::clone::Clone for Struct_Unnamed6 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed6 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLE_outEntry_s { + pub type_: u16_, + pub regID: u16_, + pub mask: u8_, + pub unk: [u8_; 3usize], +} +impl ::core::default::Default for DVLE_outEntry_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLE_outEntry_s = Struct_Unnamed6; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed7 { - pub symbolOffset: u32, - pub startReg: u16, - pub endReg: u16, -} -impl ::core::clone::Clone for Struct_Unnamed7 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed7 { +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLE_uniformEntry_s { + pub symbolOffset: u32_, + pub startReg: u16_, + pub endReg: u16_, +} +impl ::core::default::Default for DVLE_uniformEntry_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLE_uniformEntry_s = Struct_Unnamed7; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed8 { - pub _type: DVLE_type, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLE_s { + pub type_: DVLE_type, + pub mergeOutmaps: u8, + pub gshMode: DVLE_geoShaderMode, + pub gshFixedVtxStart: u8_, + pub gshVariableVtxNum: u8_, + pub gshFixedVtxNum: u8_, pub dvlp: *mut DVLP_s, - pub mainOffset: u32, - pub endmainOffset: u32, - pub constTableSize: u32, + pub mainOffset: u32_, + pub endmainOffset: u32_, + pub constTableSize: u32_, pub constTableData: *mut DVLE_constEntry_s, - pub outTableSize: u32, + pub outTableSize: u32_, pub outTableData: *mut DVLE_outEntry_s, - pub uniformTableSize: u32, + pub uniformTableSize: u32_, pub uniformTableData: *mut DVLE_uniformEntry_s, - pub symbolTableData: *mut u8, - pub outmapMask: u8, - pub outmapData: [u32; 8usize], - pub outmapMode: u32, - pub outmapClock: u32, + pub symbolTableData: *mut ::libc::c_char, + pub outmapMask: u8_, + pub outmapData: [u32_; 8usize], + pub outmapMode: u32_, + pub outmapClock: u32_, } -impl ::core::clone::Clone for Struct_Unnamed8 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed8 { +impl ::core::default::Default for DVLE_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLE_s = Struct_Unnamed8; #[repr(C)] -#[derive(Copy)] -pub struct Struct_Unnamed9 { - pub numDVLE: u32, +#[derive(Copy, Clone)] +#[derive(Debug)] +pub struct DVLB_s { + pub numDVLE: u32_, pub DVLP: DVLP_s, pub DVLE: *mut DVLE_s, } -impl ::core::clone::Clone for Struct_Unnamed9 { - fn clone(&self) -> Self { *self } -} -impl ::core::default::Default for Struct_Unnamed9 { +impl ::core::default::Default for DVLB_s { fn default() -> Self { unsafe { ::core::mem::zeroed() } } } -pub type DVLB_s = Struct_Unnamed9; extern "C" { - pub fn DVLB_ParseFile(shbinData: *mut u32, shbinSize: u32) + pub fn DVLB_ParseFile(shbinData: *mut u32_, shbinSize: u32_) -> *mut DVLB_s; pub fn DVLB_Free(dvlb: *mut DVLB_s); pub fn DVLE_GetUniformRegister(dvle: *mut DVLE_s, - name: *const u8) -> s8; + name: *const ::libc::c_char) -> s8; pub fn DVLE_GenerateOutmap(dvle: *mut DVLE_s); } +use ::types::*;