use super::*;
use super::errors::*;

#[repr(C, packed)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct DrawElementsIndirectCommand {
    pub count: u32,
    pub instance_count: u32,
    pub first_index: u32,
    pub base_vertex: u32,
    pub base_instance: u32,
}

#[repr(C, packed)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct DrawArraysIndirectCommand {
    pub count: u32,
    pub instance_count: u32,
    pub first: u32,
    pub base_instance: u32,
}

pub unsafe fn draw_arrays(count: usize) -> Result<()> {
    gl::DrawArrays(gl::TRIANGLES, 0i32, count as i32);

    get_error(())
}

pub unsafe fn multi_draw_elements_indirect(count: usize) -> Result<()> {
    gl::MultiDrawArraysIndirect(
        gl::TRIANGLES,
        0 as *const ::std::os::raw::c_void,
        count as i32,
        0,
    );

    get_error(())
}


pub unsafe fn multi_draw_arrays_indirect(count: usize) -> Result<()> {
    gl::MultiDrawArraysIndirect(
        gl::TRIANGLES,
        0 as *const ::std::os::raw::c_void,
        count as i32,
        0,
    );

    get_error(())
}
