These two logs show a working and broken GL call example. When there is only one uniform active, the draw call works, but when two uniforms are active, the values do not get set and are 0. The draw calls work with either one active, but not with both active. The program is all written in Rust, and uses an FFI to talk to the gl context.
Last active
May 18, 2017 03:41
-
-
Save gregtatum/35748b0064ea90c3b413bc8caaa0a14e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OpenGL Version 4.1 | |
| gl::GenBuffers(size:1, *buffer) | |
| buffer -> 1 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:1) | |
| gl::BufferData(gl::ARRAY_BUFFER, size:9504, *data, gl::STATIC_DRAW) | |
| GLFloat size: 4 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:0) | |
| gl::GenBuffers(size:1, *buffer) | |
| buffer -> 2 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:2) | |
| gl::BufferData(gl::ARRAY_BUFFER, size:11904, *data, gl::STATIC_DRAW) | |
| GLFloat size: 4 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:0) | |
| gl::CreateShader(shader_type:gl::VERTEX_SHADER) | |
| gl::CreateShader -> 1 | |
| " | |
| #version 150 | |
| in vec3 position; | |
| uniform mat4 projection; | |
| uniform float time; | |
| void main() { | |
| projection[0]; | |
| gl_Position = vec4(0.05 * position + vec3(time, 0.0, 0.0), 1.0); | |
| } | |
| " | |
| gl::ShaderSource(shader:1, count:1, source:0x102238000, ptr::null()) | |
| gl::CompileShader(1) | |
| gl::GetShaderiv(shader:1, gl::COMPILE_STATUS, *status) | |
| status -> 1 | |
| gl::CreateShader(shader_type:gl::FRAGMENT_SHADER) | |
| gl::CreateShader -> 2 | |
| " | |
| #version 150 | |
| out vec4 out_color; | |
| void main() { | |
| out_color = vec4(1.0, 1.0, 1.0, 1.0); | |
| } | |
| " | |
| gl::ShaderSource(shader:2, count:1, source:0x1022230c0, ptr::null()) | |
| gl::CompileShader(2) | |
| gl::GetShaderiv(shader:2, gl::COMPILE_STATUS, *status) | |
| status -> 1 | |
| gl::CreateProgram() -> 3 | |
| gl::AttachShader(program:3, vertex_shader:1) | |
| gl::AttachShader(program:3, fragment_shader:2) | |
| gl::LinkProgram(program:3) | |
| gl::GetProgramiv(program:3, gl::LINK_STATUS, &mut status) | |
| status -> 1 | |
| gl::GetActiveAttrib(program:3, attribute:0, max_name_length:127, *name_length, | |
| *data_size, *data_type, *name_buffer) | |
| name -> "position" | |
| name_length -> 8 | |
| data_size -> 1 | |
| data_type -> gl::FLOAT_VEC3 | |
| gl::GenVertexArrays(size:1, *vao) | |
| vao -> 1 | |
| gl::BindVertexArray(1) | |
| gl::BindBuffer(gl::ARRAY_BUFFER, 1) | |
| gl::EnableVertexAttribArray(0) | |
| gl::VertexAttribPointer(index:0, size:3, type:gl::FLOAT, normalize:gl::FALSE, stride:0, | |
| offset: ptr::null()) | |
| gl::BindBuffer(gl::ELEMENT_ARRAY_BUFFER, 2) | |
| gl::BindVertexArray(0) | |
| gl::GetActiveUniform(program:3, uniform:0, max_name_length:127, *name_length, | |
| *data_size, *data_type, *name_buffer) | |
| name -> "projection" | |
| name_length -> 10 | |
| data_size -> 1 | |
| data_type -> gl::FLOAT_MAT4 | |
| gl::GetActiveUniform(program:3, uniform:1, max_name_length:127, *name_length, | |
| *data_size, *data_type, *name_buffer) | |
| name -> "time" | |
| name_length -> 4 | |
| data_size -> 1 | |
| data_type -> gl::FLOAT | |
| update loop time: 68.0452500237152ms | |
| ------------------------------------------------- | |
| gl::UseProgram(program:3) | |
| gl::BindVertexArray(1) | |
| gl::UniformMatrix4fv(location:0, count:1, transpose:false, *GLfloat) -> [1.3728658, 0, 0, 0, 0, 1.8304877, 0, 0, 0, 0, -1.002002, -1, 0, 0, -0.2002002, 0] | |
| gl::Uniform1f(location:1, 0.069852374) | |
| gl::DrawElements(gl::TRIANGLES, count:2976, gl::UNSIGNED_INT, offset:0) | |
| draw time: 2.538075961638242ms | |
| swap buffers time: 4.07383096171543ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OpenGL Version 4.1 | |
| gl::GenBuffers(size:1, *buffer) | |
| buffer -> 1 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:1) | |
| gl::BufferData(gl::ARRAY_BUFFER, size:9504, *data, gl::STATIC_DRAW) | |
| GLFloat size: 4 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:0) | |
| gl::GenBuffers(size:1, *buffer) | |
| buffer -> 2 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:2) | |
| gl::BufferData(gl::ARRAY_BUFFER, size:11904, *data, gl::STATIC_DRAW) | |
| GLFloat size: 4 | |
| gl::BindBuffer(gl::ARRAY_BUFFER, buffer:0) | |
| gl::CreateShader(shader_type:gl::VERTEX_SHADER) | |
| gl::CreateShader -> 1 | |
| " | |
| #version 150 | |
| in vec3 position; | |
| uniform mat4 projection; | |
| uniform float time; | |
| void main() { | |
| // projection[0]; | |
| gl_Position = vec4(0.05 * position + vec3(time, 0.0, 0.0), 1.0); | |
| } | |
| " | |
| gl::ShaderSource(shader:1, count:1, source:0x10d438000, ptr::null()) | |
| gl::CompileShader(1) | |
| gl::GetShaderiv(shader:1, gl::COMPILE_STATUS, *status) | |
| status -> 1 | |
| gl::CreateShader(shader_type:gl::FRAGMENT_SHADER) | |
| gl::CreateShader -> 2 | |
| " | |
| #version 150 | |
| out vec4 out_color; | |
| void main() { | |
| out_color = vec4(1.0, 1.0, 1.0, 1.0); | |
| } | |
| " | |
| gl::ShaderSource(shader:2, count:1, source:0x10d4230c0, ptr::null()) | |
| gl::CompileShader(2) | |
| gl::GetShaderiv(shader:2, gl::COMPILE_STATUS, *status) | |
| status -> 1 | |
| gl::CreateProgram() -> 3 | |
| gl::AttachShader(program:3, vertex_shader:1) | |
| gl::AttachShader(program:3, fragment_shader:2) | |
| gl::LinkProgram(program:3) | |
| gl::GetProgramiv(program:3, gl::LINK_STATUS, &mut status) | |
| status -> 1 | |
| gl::GetActiveAttrib(program:3, attribute:0, max_name_length:127, *name_length, | |
| *data_size, *data_type, *name_buffer) | |
| name -> "position" | |
| name_length -> 8 | |
| data_size -> 1 | |
| data_type -> gl::FLOAT_VEC3 | |
| gl::GenVertexArrays(size:1, *vao) | |
| vao -> 1 | |
| gl::BindVertexArray(1) | |
| gl::BindBuffer(gl::ARRAY_BUFFER, 1) | |
| gl::EnableVertexAttribArray(0) | |
| gl::VertexAttribPointer(index:0, size:3, type:gl::FLOAT, normalize:gl::FALSE, stride:0, | |
| offset: ptr::null()) | |
| gl::BindBuffer(gl::ELEMENT_ARRAY_BUFFER, 2) | |
| gl::BindVertexArray(0) | |
| gl::GetActiveUniform(program:3, uniform:0, max_name_length:127, *name_length, | |
| *data_size, *data_type, *name_buffer) | |
| name -> "time" | |
| name_length -> 4 | |
| data_size -> 1 | |
| data_type -> gl::FLOAT | |
| update loop time: 58.89158800709993ms | |
| ------------------------------------------------- | |
| gl::UseProgram(program:3) | |
| gl::BindVertexArray(1) | |
| gl::Uniform1f(location:0, 0.06052659) | |
| gl::DrawElements(gl::TRIANGLES, count:2976, gl::UNSIGNED_INT, offset:0) | |
| draw time: 2.1764819975942373ms | |
| swap buffers time: 3.714050049893558ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment