-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ben Holmes wrote: > --- > tests/all.tests | 1 + > tests/texturing/CMakeLists.txt | 1 + > tests/texturing/rg-draw-pixels.c | 96 > ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 98 insertions(+), 0 deletions(-) > create mode 100755 tests/texturing/rg-draw-pixels.c
I went ahead and committed this, but there were some errors: * Don't mix declarations (e.g., "pass" in piglit_display) and code. * Make sure your code compiles (e.g., pilgit_window_mode vs. piglit_window_mode). :) * Check for extensions that the test needs using piglit_require_extension. > diff --git a/tests/all.tests b/tests/all.tests > index dedf55e..e054c6f 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -229,6 +229,7 @@ add_plain_test(texturing, 'tfp') > add_plain_test(texturing, 'depth-tex-modes') > add_plain_test(texturing, 'depth-tex-modes-glsl') > add_plain_test(texturing, 'depth-tex-compare') > +add_plain_test(texturing, 'rg-draw-pixels') > > glslparsertest = Group() > def add_glslparsertest(shader, result): > diff --git a/tests/texturing/CMakeLists.txt b/tests/texturing/CMakeLists.txt > index 6c8b3af..a580e88 100644 > --- a/tests/texturing/CMakeLists.txt > +++ b/tests/texturing/CMakeLists.txt > @@ -41,3 +41,4 @@ add_executable (depth-tex-modes depth-tex-modes.c) > add_executable (depth-tex-modes-glsl depth-tex-modes-glsl.c) > add_executable (depth-tex-compare depth-tex-compare.c) > add_executable (tex-swizzle tex-swizzle.c) > +add_executable (rg-draw-pixels rg-draw-pixels.c) > diff --git a/tests/texturing/rg-draw-pixels.c > b/tests/texturing/rg-draw-pixels.c > new file mode 100755 > index 0000000..5605d3b > --- /dev/null > +++ b/tests/texturing/rg-draw-pixels.c > @@ -0,0 +1,96 @@ > +/* > + * Copyright © 2009 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > + * DEALINGS IN THE SOFTWARE. > + * > + * Authors: > + * Ben Holmes <[email protected]> > + */ > + > +/* > + * This test draws to the screen using glDrawPixels with data formats of > GL_RED > + * and GL_RG and tests for the correct color output. > + */ > + > +#include "piglit-util.h" > + > +int piglit_width = 40, piglit_height = 30; > +int pilgit_window_mode = GLUT_RGB | GLUT_DOUBLE; > + > +static GLuint tex[2]; > + > +void > +piglit_init(int argc, char **argv) > +{ > + > + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); > + > + glEnable(GL_TEXTURE_2D); > + glClearColor(0.2, 0.2, 0.2, 1.0); > +} > + > +enum piglit_result > +piglit_display(void) > +{ > + glClear(GL_COLOR_BUFFER_BIT); > + > + int height = 16; > + int width = 16; > + int i, j; > + > + GLfloat texData[width][height][4]; > + for (i=0; i < width; ++i) { > + for (j=0; j < height; ++j) { > + if ((i+j) & 1) { > + texData[i][j][0] = 1.0; > + texData[i][j][1] = 1.0; > + texData[i][j][2] = 1.0; > + texData[i][j][3] = 1.0; > + } > + else { > + texData[i][j][0] = 0.0; > + texData[i][j][1] = 0.0; > + texData[i][j][2] = 0.0; > + texData[i][j][3] = 0.0; > + } > + } > + } > + > + glRasterPos2i(0,0); > + glDrawPixels(width,height,GL_RED,GL_FLOAT,texData); > + > + glRasterPos2i(18,0); > + glDrawPixels(width,height,GL_RG,GL_FLOAT,texData); > + > + GLboolean pass = GL_TRUE; > + GLfloat red[3] = {1.0, 0.0, 0.0}; > + GLfloat rg[3] = {1.0, 1.0, 0.0}; > + GLfloat black[3] = {0.0, 0.0, 0.0}; > + > + pass = pass && piglit_probe_pixel_rgb(15,0,red); > + pass = pass && piglit_probe_pixel_rgb(0,0,black); > + pass = pass && piglit_probe_pixel_rgb(18,0,rg); > + pass = pass && piglit_probe_pixel_rgb(23,0,black); > + > + glFinish(); > + glutSwapBuffers(); > + > + return pass ? PIGLIT_SUCCESS : PIGLIT_FAILURE; > +} -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAksGJvsACgkQX1gOwKyEAw8cAACgkKoSxLXqIF/KF3OaXXvm6eHC L0UAn2/jrLhYxwC9nylQ7gXOGhJoc5a9 =/8dK -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Mesa3d-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mesa3d-dev
