♻️ Safened all GL calls except those that actually do access arbitrary memory.
parent
c6f71abbca
commit
d45b95961e
|
@ -82,15 +82,6 @@ void main (void) {
|
|||
}
|
||||
";
|
||||
|
||||
fn enable_vertex_attrib_array (id: Option <u32>) {
|
||||
if let Some (id) = id {
|
||||
// Are safety checks really needed here?
|
||||
unsafe {
|
||||
gl::EnableVertexAttribArray (id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe fn vertex_attrib_pointer (id: Option <u32>, num_coords: i32, slice: &[u8]) {
|
||||
const FALSE_U8: u8 = 0;
|
||||
const FLOAT_SIZE: i32 = 4;
|
||||
|
@ -241,9 +232,9 @@ fn main () {
|
|||
|
||||
const FALSE_U8: u8 = 0;
|
||||
|
||||
enable_vertex_attrib_array (attrs ["pos"]);
|
||||
enable_vertex_attrib_array (attrs ["uv"]);
|
||||
enable_vertex_attrib_array (attrs ["normal"]);
|
||||
glezz::enable_vertex_attrib_array (attrs ["pos"]);
|
||||
glezz::enable_vertex_attrib_array (attrs ["uv"]);
|
||||
glezz::enable_vertex_attrib_array (attrs ["normal"]);
|
||||
|
||||
glezz::enable (gl::DEPTH_TEST);
|
||||
glezz::enable (gl::TEXTURE);
|
||||
|
|
|
@ -26,6 +26,15 @@ pub fn enable (constant: u32) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn enable_vertex_attrib_array (id: Option <u32>) {
|
||||
if let Some (id) = id {
|
||||
// Are safety checks really needed here?
|
||||
unsafe {
|
||||
gl::EnableVertexAttribArray (id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uniform_1i (uni: i32, x: i32) {
|
||||
unsafe {
|
||||
gl::Uniform1i (uni, x);
|
||||
|
|
Loading…
Reference in New Issue