From 73180e530b4e4db2a4cf47fef8942c6ea773b721 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Thu, 2 Nov 2023 22:49:44 +0100 Subject: [PATCH] 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: --- examples/src/glupload.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index 852b36c8c..8403ed87d 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -206,9 +206,10 @@ fn load(gl_context: &glutin::WindowedContext) -> 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) -> Gl { gl.BindBuffer(gl::ELEMENT_ARRAY_BUFFER, 0); gl.BindBuffer(gl::ARRAY_BUFFER, 0); + assert_eq!(gl.GetError(), 0); + ( program, attr_position,