[Mesa-dev] [PATCH] mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB

Jeremy Huddleston Sequoia jeremyhu at apple.com
Thu Aug 17 22:52:45 UTC 2017


Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
CC: Nicolai Hähnle <nhaehnle at gmail.com>
CC: Matt Turner <mattst88 at gmail.com>
CC: Ian Romanick <idr at freedesktop.org>
CC: Brian Paul <brianp at vmware.com>
---
 src/mesa/main/shaderapi.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 6dd617be7e..7282435583 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -513,10 +513,12 @@ detach_shader_no_error(struct gl_context *ctx, GLuint program, GLuint shader)
 
 /**
  * Return list of shaders attached to shader program.
+ * \param objOut  returns GLuint ids
+ * \param handleOut  returns GLhandleARB handles
  */
 static void
 get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount,
-                     GLsizei *count, GLuint *obj)
+                     GLsizei *countOut, GLuint *objOut, GLhandleARB *handleOut)
 {
    struct gl_shader_program *shProg;
 
@@ -531,14 +533,20 @@ get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount,
    if (shProg) {
       GLuint i;
       for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) {
-         obj[i] = shProg->Shaders[i]->Name;
+         if (objOut) {
+            objOut[i] = shProg->Shaders[i]->Name;
+         }
+
+         if (handleOut) {
+            handleOut[i] = (GLhandleARB) shProg->Shaders[i]->Name;
+         }
+      }
+      if (countOut) {
+         *countOut = i;
       }
-      if (count)
-         *count = i;
    }
 }
 
-
 /**
  * glGetHandleARB() - return ID/name of currently bound shader program.
  */
@@ -1575,7 +1583,7 @@ _mesa_GetAttachedObjectsARB(GLhandleARB container, GLsizei maxCount,
                             GLsizei * count, GLhandleARB * obj)
 {
    GET_CURRENT_CONTEXT(ctx);
-   get_attached_shaders(ctx, container, maxCount, count, obj);
+   get_attached_shaders(ctx, (GLuint)container, maxCount, count, NULL, obj);
 }
 
 
@@ -1584,7 +1592,7 @@ _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
                          GLsizei *count, GLuint *obj)
 {
    GET_CURRENT_CONTEXT(ctx);
-   get_attached_shaders(ctx, program, maxCount, count, obj);
+   get_attached_shaders(ctx, program, maxCount, count, obj, NULL);
 }
 
 
-- 
2.13.3



More information about the mesa-dev mailing list