[Mesa-dev] [PATCH 01/11] mesa: Returns a GL_INVALID_VALUE error on several glGet* APIs when max length is negative

Eduardo Lima Mitev elima at igalia.com
Tue Jan 20 04:18:50 PST 2015


Thank you Erik and Ian for taking a look to the patch.

On 01/20/2015 03:52 AM, Ian Romanick wrote:
> On 01/19/2015 03:32 AM, Eduardo Lima Mitev wrote:
>> The manual page for glGetAttachedShaders, glGetShaderSource, glGetActiveUniform and
>> glGetActiveUniform state that a GL_INVALID_VALUE is returned if the maximum length
>> argument is less than zero. For reference, see:
>> https://www.opengl.org/sdk/docs/man3/xhtml/glGetAttachedShaders.xml,
>> https://www.khronos.org/opengles/sdk/docs/man31/html/glGetAttachedShaders.xhtml,
>> https://www.opengl.org/sdk/docs/man3/xhtml/glGetShaderSource.xml,
>> https://www.khronos.org/opengles/sdk/docs/man31/html/glGetShaderSource.xhtml,
>> https://www.opengl.org/sdk/docs/man3/xhtml/glGetActiveUniform.xml,
>> https://www.khronos.org/opengles/sdk/docs/man31/html/glGetActiveUniform.xhtml,
>> https://www.opengl.org/sdk/docs/man3/xhtml/glGetActiveAttrib.xml,
>> https://www.khronos.org/opengles/sdk/docs/man31/html/glGetActiveAttrib.xhtml.
> 
> It's probably easier to quote section 2.3.1 (Errors):
> 
>     If a negative number is provided where an argument of type sizei or
>     sizeiptr is specified, an INVALID_VALUE error is generated.
> 

Indeed. I failed to find the relevant text in the specs (only looked at
GLES3.0 and GL3.3 though), so I decided to finally quote the man pages
even if I knew it is not a good practice. Thought is was better than
nothing.

> I think we should be consistent (as much as possible) with the order
> errors are generated.  Each function below will check things in a
> different order.  get_attached_shaders can even generate multiple errors
> (one in _mesa_lookup_shader_program_err and one for maxCount < 0).  If
> you change all three to check max*, then call
> _mesa_lookup_shader_program_err, the patch is
> 

Agree. I will rework the patch to make it more consistent as you suggest.

Thanks again!

Eduardo



More information about the mesa-dev mailing list