[Mesa-dev] [PATCH v2] mesa/es3.1: Fix error code for glCreateShaderProgram

Marta Lofstedt marta.lofstedt at linux.intel.com
Tue Jun 23 07:04:40 PDT 2015


From: Marta Lofstedt <marta.lofstedt at intel.com>

According to the OpenGL ES standard, 7.3.
For a call to glCreateShaderProgram with count < 0,
a GL_INVALID_VALUE error should be generated.

Signed-off-by: Marta Lofstedt <marta.lofstedt at linux.intel.com>
---
 src/mesa/main/shaderapi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c783c69..266064d 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1890,6 +1890,15 @@ _mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
    const GLuint shader = create_shader(ctx, type);
    GLuint program = 0;
 
+   /*
+    * According to OpenGL ES 3.1 standard 7.3: GL_INVALID_VALUE
+    * should be generated, if count < 0.
+    */
+   if (_mesa_is_gles31(ctx) && count < 0) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glCreateShaderProgram (count < 0)");
+      return program;
+   }
+
    if (shader) {
       _mesa_ShaderSource(shader, count, strings, NULL);
 
-- 
1.9.1



More information about the mesa-dev mailing list