[Mesa-dev] [PATCH] mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB
Jeremy Huddleston Sequoia
jeremyhu at apple.com
Sun May 8 08:38:40 UTC 2016
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>
---
src/mesa/main/shaderapi.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 8c1fba8..0b630eb 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -476,6 +476,30 @@ get_attached_shaders(struct gl_context *ctx, GLuint program, GLsizei maxCount,
}
}
+static void
+get_attached_shadersARB(struct gl_context *ctx, GLhandleARB container, GLsizei maxCount,
+ GLsizei *count, GLhandleARB *obj)
+{
+ struct gl_shader_program *shProg;
+
+ if (maxCount < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGetAttachedShadersARB(maxCount < 0)");
+ return;
+ }
+
+ shProg =
+ _mesa_lookup_shader_program_err(ctx, (GLuint)container, "glGetAttachedShaders");
+
+ if (shProg) {
+ GLuint i;
+ for (i = 0; i < (GLuint) maxCount && i < shProg->NumShaders; i++) {
+ obj[i] = (GLhandleARB)shProg->Shaders[i]->Name;
+ }
+ if (count)
+ *count = i;
+ }
+}
+
/**
* glGetHandleARB() - return ID/name of currently bound shader program.
@@ -1371,7 +1395,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_shadersARB(ctx, container, maxCount, count, obj);
}
--
2.8.2
More information about the mesa-dev
mailing list