[Piglit] [PATCH 1/5] vp-max-array: Refactor query of program parameter limits
Ian Romanick
idr at freedesktop.org
Tue Aug 30 11:25:09 PDT 2011
From: Ian Romanick <ian.d.romanick at intel.com>
Also query the other program parameter related limits.
---
tests/shaders/vp-max-array.c | 48 +++++++++++++++++++++++++++++++++++------
1 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/tests/shaders/vp-max-array.c b/tests/shaders/vp-max-array.c
index 67c8c3a..523325a 100644
--- a/tests/shaders/vp-max-array.c
+++ b/tests/shaders/vp-max-array.c
@@ -53,24 +53,58 @@ piglit_display(void)
}
+bool
+query_and_require_limit(GLenum pname, GLint *param, const char *name,
+ GLint minimum_maximum)
+{
+ glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, pname, param);
+ if (*param < minimum_maximum) {
+ fprintf(stderr, "%s: Expected at least %d, got %d\n",
+ name, minimum_maximum, *param);
+ return false;
+ }
+
+ return true;
+}
+
void
piglit_init(int argc, char **argv)
{
GLint max_parameters;
+ GLint max_native_parameters;
+ GLint max_local_parameters;
+ GLint max_env_parameters;
char shader_source[1024];
+ bool pass = true;
(void) argc;
(void) argv;
piglit_require_vertex_program();
- glGetProgramivARB(GL_VERTEX_PROGRAM_ARB,
- GL_MAX_PROGRAM_PARAMETERS_ARB,
- & max_parameters);
- if (max_parameters < 96) {
- if (! piglit_automatic)
- printf("GL_MAX_PROGRAM_PARAMETERS_ARB < 96\n");
-
+ /* First, query all of the limits.
+ */
+ pass = query_and_require_limit(GL_MAX_PROGRAM_PARAMETERS_ARB,
+ & max_parameters,
+ "GL_MAX_PROGRAM_PARAMETERS_ARB",
+ 96)
+ && pass;
+ pass = query_and_require_limit(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB,
+ & max_native_parameters,
+ "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB",
+ 96)
+ && pass;
+ pass = query_and_require_limit(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB,
+ & max_local_parameters,
+ "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB",
+ 96)
+ && pass;
+ pass = query_and_require_limit(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB,
+ & max_env_parameters,
+ "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB",
+ 96)
+ && pass;
+ if (!pass) {
piglit_report_result(PIGLIT_FAIL);
}
--
1.7.4.4
More information about the Piglit
mailing list