Skip to content

Commit

Permalink
Add get_program_validate_status
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
sagudev committed Oct 23, 2024
1 parent 15957bf commit ed62b5b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ pub trait HasContext: __private::Sealed {

unsafe fn get_program_completion_status(&self, program: Self::Program) -> bool;

unsafe fn get_program_validate_status(&self, program: Self::Program) -> bool;

unsafe fn get_program_link_status(&self, program: Self::Program) -> bool;

unsafe fn get_program_info_log(&self, program: Self::Program) -> String;
Expand Down
7 changes: 7 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,13 @@ impl HasContext for Context {
1 == status
}

unsafe fn get_program_validate_status(&self, program: Self::Program) -> bool {
let gl = &self.raw;
let mut status = 0;
gl.GetProgramiv(program.0.get(), VALIDATE_STATUS, &mut status);
status == 1
}

unsafe fn get_program_info_log(&self, program: Self::Program) -> String {
let gl = &self.raw;
let mut length = 0;
Expand Down
15 changes: 15 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1946,6 +1946,21 @@ impl HasContext for Context {
.unwrap_or(false)
}

unsafe fn get_program_validate_status(&self, program: Self::Program) -> bool {
let programs = self.programs.borrow();
let raw_program = programs.get_unchecked(program);
match self.raw {
RawRenderingContext::WebGl1(ref gl) => {
gl.get_program_parameter(raw_program, VALIDATE_STATUS)
}
RawRenderingContext::WebGl2(ref gl) => {
gl.get_program_parameter(raw_program, VALIDATE_STATUS)
}
}
.as_bool()
.unwrap_or(false)
}

unsafe fn get_program_info_log(&self, program: Self::Program) -> String {
let programs = self.programs.borrow();
let raw_program = programs.get_unchecked(program);
Expand Down

0 comments on commit ed62b5b

Please sign in to comment.