mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
examples/glupload: Pass actual program
handle to glGetProgramiv()
This is what you get with an untyped API. `glGetError()` further down the line was returning `GL_INVALID_OPERATION` and failing other calls after `load()` in the `glutin 0.31` upgrade. This turns out to be [returned by `glGetProgramiv`] when the `program` that is passed in does not refer to a program object. Which was the case here, where the fragment shader identifier was passed in instead. Just in case we insert a few extra asserts that check the result of `glGetError()` to catch such issues earlier on in the chain, instead of postponing them and falsely accusing code that runs later. [returned by `glGetProgramiv`]: https://registry.khronos.org/OpenGL-Refpages/es2.0/xhtml/glGetProgramiv.xml#errors Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1336>
This commit is contained in:
parent
5fdd56747f
commit
73180e530b
1 changed files with 6 additions and 3 deletions
|
@ -206,9 +206,10 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
|||
gl.LinkProgram(program);
|
||||
|
||||
{
|
||||
let mut success: gl::types::GLint = 1;
|
||||
gl.GetProgramiv(fs, gl::LINK_STATUS, &mut success);
|
||||
assert!(success != 0);
|
||||
let mut success = 1;
|
||||
gl.GetProgramiv(program, gl::LINK_STATUS, &mut success);
|
||||
assert_ne!(success, 0);
|
||||
assert_eq!(gl.GetError(), 0);
|
||||
}
|
||||
|
||||
let attr_position = gl.GetAttribLocation(program, b"a_position\0".as_ptr() as *const _);
|
||||
|
@ -279,6 +280,8 @@ fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
|||
gl.BindBuffer(gl::ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.BindBuffer(gl::ARRAY_BUFFER, 0);
|
||||
|
||||
assert_eq!(gl.GetError(), 0);
|
||||
|
||||
(
|
||||
program,
|
||||
attr_position,
|
||||
|
|
Loading…
Reference in a new issue