grovesNL / glow

GL on Whatever: a set of bindings to run GL anywhere and avoid target-specific code
Apache License 2.0
1.17k stars 130 forks source link

Missing glProgramBinary and friends #277

Closed chyyran closed 7 months ago

chyyran commented 7 months ago

I'm trying to port this piece of code from gl-rs to glow, which saves a compiled program binary to cache and loads it later onto the GPU

let program = gl::CreateProgram();
// attach shaders + compile

let mut length = 0;
gl::GetProgramiv(program, gl::PROGRAM_BINARY_LENGTH, &mut length);

let mut binary = vec![0; length as usize];
let mut format = 0;
gl::GetProgramBinary(
         program,
         length,
         std::ptr::null_mut(),
         &mut format,
         binary.as_mut_ptr().cast(),
);

// later on 
let blob = get_program_from_cache();
gl::ProgramBinary(program, format, blob.as_ptr().cast(), blob.len() as GLsizei);

However it seems like glow is missing shims from ARB_get_program_binary, but they seem to be defined on context.raw, at least for native targets.