Skip to content

Commit

Permalink
Add get_active_uniforms_parameter
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Oct 27, 2024
1 parent 0561fe5 commit d2d86fb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,14 @@ pub trait HasContext: __private::Sealed {

unsafe fn get_active_uniforms(&self, program: Self::Program) -> u32;

#[doc(alias = "GetActiveUniformsiv")]
unsafe fn get_active_uniforms_parameter(
&self,
program: Self::Program,
uniforms: &[u32],
pname: u32,
) -> Vec<i32>;

unsafe fn get_active_uniform(
&self,
program: Self::Program,
Expand Down
18 changes: 18 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,24 @@ impl HasContext for Context {
count as u32
}

unsafe fn get_active_uniforms_parameter(
&self,
program: Self::Program,
uniforms: &[u32],
pname: u32,
) -> Vec<i32> {
let gl = &self.raw;
let mut results = vec![0; uniforms.len()];
gl.GetActiveUniformsiv(
program.0.get(),
uniforms.len() as _,
uniforms.as_ptr(),
pname,
results.as_mut_ptr(),
);
results
}

unsafe fn get_active_uniform(
&self,
program: Self::Program,
Expand Down
9 changes: 9 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,15 @@ impl HasContext for Context {
.unwrap_or(0)
}

unsafe fn get_active_uniforms_parameter(
&self,
_program: Self::Program,
_uniforms: &[u32],
_pname: u32,
) -> Vec<i32> {
panic!("GetActiveUniformsiv is not supported")
}

unsafe fn get_active_uniform(
&self,
program: Self::Program,
Expand Down

0 comments on commit d2d86fb

Please sign in to comment.