mesa/sso: Add support for GL_PROGRAM_SEPARABLE query
authorGregory Hainaut <gregory.hainaut@gmail.com>
Fri, 28 Jun 2013 21:05:49 +0000 (14:05 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 21 Feb 2014 23:41:02 +0000 (15:41 -0800)
This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/mesa/main/mtypes.h
src/mesa/main/shaderapi.c

index c998cc6a02cf6ed04619547ad40f7ce24cfd9d61..fbbca5528d950a11d73224e88caa82abdf2665a3 100644 (file)
@@ -2586,6 +2586,12 @@ struct gl_shader_program
     */
    GLboolean InternalSeparateShader;
 
+   /**
+    * Indicates whether program can be bound for individual pipeline stages
+    * using UseProgramStages after it is next linked.
+    */
+   GLboolean SeparateShader;
+
    GLuint NumShaders;          /**< number of attached shaders */
    struct gl_shader **Shaders; /**< List of attached the shaders */
 
index ac95dc735cf61b16779968b486aa198b79ec49df..79ef149d765678c2a15cba011a3566dee2c3672f 100644 (file)
@@ -696,6 +696,12 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
          params[i] = shProg->Comp.LocalSize[i];
       return;
    }
+   case GL_PROGRAM_SEPARABLE:
+      if (!ctx->Extensions.ARB_separate_shader_objects)
+         break;
+
+      *params = shProg->SeparateShader;
+      return;
    default:
       break;
    }
@@ -1736,6 +1742,25 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
        */
       shProg->BinaryRetreivableHint = value;
       return;
+
+   case GL_PROGRAM_SEPARABLE:
+      if (!ctx->Extensions.ARB_separate_shader_objects)
+         break;
+
+      /* Spec imply that the behavior is the same as ARB_get_program_binary
+       * Chapter 7.3 Program Objects
+       */
+      if (value != GL_TRUE && value != GL_FALSE) {
+         _mesa_error(ctx, GL_INVALID_VALUE,
+                     "glProgramParameteri(pname=%s, value=%d): "
+                     "value must be 0 or 1.",
+                     _mesa_lookup_enum_by_nr(pname),
+                     value);
+         return;
+      }
+      shProg->SeparateShader = value;
+      return;
+
    default:
       break;
    }