summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/program_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/program_resource.c')
-rw-r--r--src/mesa/main/program_resource.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/main/program_resource.c b/src/mesa/main/program_resource.c
index 9eb4e2ffd0c..b15a13210c0 100644
--- a/src/mesa/main/program_resource.c
+++ b/src/mesa/main/program_resource.c
@@ -276,6 +276,28 @@ _mesa_GetProgramResourceiv(GLuint program, GLenum programInterface,
const GLenum *props, GLsizei bufSize,
GLsizei *length, GLint *params)
{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader_program *shProg =
+ _mesa_lookup_shader_program_err(ctx, program, "glGetProgramResourceiv");
+
+ if (!shProg || !params)
+ return;
+
+ /* The error INVALID_VALUE is generated if <propCount> is zero.
+ * Note that we check < 0 here because it makes sense to bail early.
+ */
+ if (propCount <= 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetProgramResourceiv(propCount <= 0)");
+ return;
+ }
+
+ /* No need to write any properties, user requested none. */
+ if (bufSize == 0)
+ return;
+
+ _mesa_get_program_resourceiv(shProg, programInterface, index,
+ propCount, props, bufSize, length, params);
}
/**