[Mesa-dev] [PATCH 12/16] main: Added entry point for glCreateProgramPipelines
Martin Peres
martin.peres at linux.intel.com
Mon Feb 16 06:14:03 PST 2015
Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
src/mapi/glapi/gen/ARB_direct_state_access.xml | 7 ++++++
src/mesa/main/pipelineobj.c | 35 +++++++++++++++++++++-----
src/mesa/main/pipelineobj.h | 3 +++
src/mesa/main/tests/dispatch_sanity.cpp | 1 +
4 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml
index 99d2422..2102e82 100644
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml
@@ -308,6 +308,13 @@
<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">
diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index b713d95..96bf086 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -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.
*
diff --git a/src/mesa/main/pipelineobj.h b/src/mesa/main/pipelineobj.h
index 7285a78..b57bcb9 100644
--- a/src/mesa/main/pipelineobj.h
+++ b/src/mesa/main/pipelineobj.h
@@ -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);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index b65080e..cc2b267 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -993,6 +993,7 @@ const struct function gl_core_functions_possible[] = {
{ "glTextureStorage2DMultisample", 45, -1 },
{ "glTextureStorage3DMultisample", 45, -1 },
{ "glTextureBuffer", 45, -1 },
+ { "glCreateProgramPipelines", 45, -1 },
{ "glCreateQueries", 45, -1 },
{ "glGetQueryBufferObjectiv", 45, -1 },
{ "glGetQueryBufferObjectuiv", 45, -1 },
--
2.3.0
More information about the mesa-dev
mailing list