main: Added entry point for glCreateProgramPipelines
authorMartin Peres <martin.peres@linux.intel.com>
Wed, 11 Feb 2015 16:12:21 +0000 (18:12 +0200)
committerMartin Peres <martin.peres@linux.intel.com>
Wed, 25 Mar 2015 08:05:45 +0000 (10:05 +0200)
v2:
- add spaces in an error message (Laura)

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
src/mapi/glapi/gen/ARB_direct_state_access.xml
src/mesa/main/pipelineobj.c
src/mesa/main/pipelineobj.h
src/mesa/main/tests/dispatch_sanity.cpp

index 05b9f3fe06ff67596dca58cc27bc1fbab36afa3a..9d7a59a5e050c597a070a28b64fbdde5dd94164f 100644 (file)
       <param name="params" type="GLint *" />
    </function>
 
+   <!-- Program Pipeline object functions -->
+
+   <function name="CreateProgramPipelines" offset="assign">
+      <param name="n" type="GLsizei" />
+      <param name="pipelines" type="GLuint *" />
+   </function>
+
    <!-- Query object functions -->
 
    <function name="CreateQueries" offset="assign">
index fb241af1e31d4da2e832ba4c1bcc3c3ac45a96f0..0fefa7d568b5da5e954e830c0fdfb23ec4022154 100644 (file)
@@ -498,16 +498,18 @@ _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines)
  * \param n       Number of IDs to generate.
  * \param pipelines  pipeline of \c n locations to store the IDs.
  */
-void GLAPIENTRY
-_mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines)
+static void
+create_program_pipelines(struct gl_context *ctx, GLsizei n, GLuint *pipelines,
+                         bool dsa)
 {
-   GET_CURRENT_CONTEXT(ctx);
-
+   const char *func;
    GLuint first;
    GLint i;
 
+   func = dsa ? "glCreateProgramPipelines" : "glGenProgramPipelines";
+
    if (n < 0) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glGenProgramPipelines(n<0)");
+      _mesa_error(ctx, GL_INVALID_VALUE, "%s (n < 0)", func);
       return;
    }
 
@@ -523,16 +525,37 @@ _mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines)
 
       obj = _mesa_new_pipeline_object(ctx, name);
       if (!obj) {
-         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenProgramPipelines");
+         _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);
          return;
       }
 
+      if (dsa) {
+         /* make dsa-allocated objects behave like program objects */
+         obj->EverBound = GL_TRUE;
+      }
+
       save_pipeline_object(ctx, obj);
       pipelines[i] = first + i;
    }
 
 }
 
+void GLAPIENTRY
+_mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   create_program_pipelines(ctx, n, pipelines, false);
+}
+
+void GLAPIENTRY
+_mesa_CreateProgramPipelines(GLsizei n, GLuint *pipelines)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   create_program_pipelines(ctx, n, pipelines, true);
+}
+
 /**
  * Determine if ID is the name of an pipeline object.
  *
index 7285a78f1ae1727eebdd20cc7911307a58075132..b57bcb99e5c93627f02b15256f9be06a54e3821c 100644 (file)
@@ -82,6 +82,9 @@ _mesa_DeleteProgramPipelines(GLsizei n, const GLuint *pipelines);
 extern void GLAPIENTRY
 _mesa_GenProgramPipelines(GLsizei n, GLuint *pipelines);
 
+void GLAPIENTRY
+_mesa_CreateProgramPipelines(GLsizei n, GLuint *pipelines);
+
 extern GLboolean GLAPIENTRY
 _mesa_IsProgramPipeline(GLuint pipeline);
 
index c6dd50ba40a9888fac870d2ace9238d7907e340c..cc14674b2309ad83857954325d53c03419445827 100644 (file)
@@ -976,6 +976,7 @@ const struct function gl_core_functions_possible[] = {
    { "glTextureStorage3DMultisample", 45, -1 },
    { "glTextureBuffer", 45, -1 },
    { "glTextureBufferRange", 45, -1 },
+   { "glCreateProgramPipelines", 45, -1 },
    { "glCreateQueries", 45, -1 },
    { "glGetQueryBufferObjectiv", 45, -1 },
    { "glGetQueryBufferObjectuiv", 45, -1 },