[Mesa-dev] [PATCH 1/4] mesa: Stub implementation of glBindFragDataLocation

Ian Romanick idr at freedesktop.org
Fri Nov 4 16:40:57 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

This just validates the input parameters so far.

Fixes piglit's bindfragdata-invalid-parameters test.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/shader_query.cpp |   37 +++++++++++++++++++++++++++++++++++++
 src/mesa/main/shaderapi.c      |   18 ------------------
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index bd873a4..0694b48 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -237,3 +237,40 @@ _mesa_longest_attribute_name_length(struct gl_shader_program *shProg)
 
    return longest;
 }
+
+void GLAPIENTRY
+_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
+			   const GLchar *name)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_shader_program *const shProg =
+      _mesa_lookup_shader_program_err(ctx, program, "glBindFragDataLocation");
+   if (!shProg)
+      return;
+
+   if (!name)
+      return;
+
+   if (strncmp(name, "gl_", 3) == 0) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glBindFragDataLocation(illegal name)");
+      return;
+   }
+
+   if (colorNumber >= ctx->Const.MaxDrawBuffers) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glBindFragDataLocation(index)");
+      return;
+   }
+
+   /* Replace the current value if it's already in the list.  Add
+    * FRAG_RESULT_DATA0 because that's how the linker differentiates
+    * between built-in attributes and user-defined attributes.
+    */
+
+
+   /*
+    * Note that this binding won't go into effect until
+    * glLinkProgram is called again.
+    */
+}
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 56d955c..078f534 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -325,14 +325,6 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
 }
 
 
-static void
-bind_frag_data_location(struct gl_context *ctx, GLuint program,
-                        GLuint colorNumber, const GLchar *name)
-{
-   _mesa_problem(ctx, "bind_frag_data_location() not implemented yet");
-}
-
-
 static GLuint
 create_shader(struct gl_context *ctx, GLenum type)
 {
@@ -1049,16 +1041,6 @@ _mesa_AttachShader(GLuint program, GLuint shader)
 }
 
 
-/* GL_EXT_gpu_shader4, GL3 */
-void GLAPIENTRY
-_mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
-                           const GLchar *name)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   bind_frag_data_location(ctx, program, colorNumber, name);
-}
-
-
 void GLAPIENTRY
 _mesa_CompileShaderARB(GLhandleARB shaderObj)
 {
-- 
1.7.6.4



More information about the mesa-dev mailing list