diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2011-08-30 11:15:49 -0700 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2011-09-04 18:14:43 -0700 |
commit | 022186bbe2058276d789a807a043b1bd0ab93471 (patch) | |
tree | 00dbdb3874221caf01dde2f97a0f714a0c179de7 /tests/shaders/vp-max-array.c | |
parent | c19366f77895608bc4cd0e6b3bbc92b6b17f2c29 (diff) |
vp-max-array: Exercise GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB with a contant array
This is essentially the same test as for
GL_MAX_PROGRAM_PARAMETERS_ARB, but it uses indirect addressing to
force all of the parameters to be used.
Tested-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests/shaders/vp-max-array.c')
-rw-r--r-- | tests/shaders/vp-max-array.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/shaders/vp-max-array.c b/tests/shaders/vp-max-array.c index 78de26117..1a67a753a 100644 --- a/tests/shaders/vp-max-array.c +++ b/tests/shaders/vp-max-array.c @@ -48,6 +48,13 @@ static const char template_footer[] = "END\n" ; +static const char max_native_template_footer[] = + " };\n" + "ADDRESS a;\n" + "ARL a.x, vertex.position.x;\n" + "MOV result.color, colors[a.x];\n" + "END\n" + ; enum piglit_result piglit_display(void) @@ -119,6 +126,7 @@ piglit_init(int argc, char **argv) */ len = sizeof(template_header) + sizeof(template_footer) + + sizeof(max_native_template_footer) + (80 * max_parameters) + 1; shader_source = malloc(len); if (shader_source == NULL) @@ -147,4 +155,30 @@ piglit_init(int argc, char **argv) sizeof(template_footer)); (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); + + /* Generate a program that uses the full native parameter space using + * an array of constants. The array is accessed indirectly, so the + * assembler cannot know which elements may be used. As a result, it + * has to upload all of them. This exercises + * GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB. + */ + offset = snprintf(shader_source, len, template_header, + max_native_parameters); + for (i = 0; i < max_native_parameters; i++) { + int comma = (i < (max_native_parameters - 1)) ? ',' : ' '; + int used = snprintf(& shader_source[offset], + len - offset, + "\t\t{ %.1f, %.1f, %.1f, %.1f }%c\n", + (float) i, + (float) i + 0.2, + (float) i + 0.4, + (float) i + 0.6, + comma); + offset += used; + } + + memcpy(& shader_source[offset], max_native_template_footer, + sizeof(max_native_template_footer)); + + (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); } |