glium icon indicating copy to clipboard operation
glium copied to clipboard

"UniformXARB doesn't exist" comments in uniform_storage.rs

Open OLEGSHA opened this issue 4 months ago • 0 comments

I wanted to implement support for non-square matrix uniform values, and I am currently looking at uniform_storage.rs. Some data types have comments like // Uniform1uiARB doesn't exist and use a workaround instead of the uniform! macro.

I did some digging and I can't quite understand what's going on.

Let's examine UnsignedIntVec2. According to OpenGL reference at Khronos, glUniform2uiv is unavailable before 3.0. Current workaround code will attempt to use it in OpenGL versions 1.5, 2.0 and 2.1 (let's ignore ES for now):

if ctxt.version >= &Version(Api::Gl, 1, 5) ||
   ctxt.version >= &Version(Api::GlEs, 2, 0)
{
    ctxt.gl.Uniform2uiv( // ...

Otherwise, it will use the signed integer ARB version, Uniform2ivARB.

  1. How can this work in OpenGL 1.5*?
  2. How can this work in OpenGL 2.0, 2.1?
  3. Why is there no runtime check for values that wouldn't fit into Uniform2ivARB if it's used? I imagine debugging a bug caused by this conversion could be a nightmare.
  4. Why does this workaround even exist if Glium is an "Easy-to-use, high-level, OpenGL3+ wrapper" (from docs index)?
  5. Do I need to use the same workaround for non-square matrices that seem to be in the same situation?

* - I don't have any real experience working carefully with context versions, by from my understanding, even if ARB_shader_objects was ubiquitously available before 2.0, it would still require the use of the suffixed symbols.

OLEGSHA avatar Oct 13 '24 16:10 OLEGSHA