[Mesa-dev] [PATCH 11/15] mesa/sso: Add support for GL_PROGRAM_SEPARABLE query

Ian Romanick idr at freedesktop.org
Fri Feb 7 22:00:21 PST 2014


From: Gregory Hainaut <gregory.hainaut at gmail.com>

This was originally included in another patch, but it was split out by
Ian Romanick.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/mtypes.h    |  6 ++++++
 src/mesa/main/shaderapi.c | 25 +++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a1514fc..4d49d88 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2579,6 +2579,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 */
 
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 64bfe08..c7b207f 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -689,6 +689,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;
    }
@@ -1729,6 +1735,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;
    }
-- 
1.8.1.4



More information about the mesa-dev mailing list