-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ben Holmes wrote:
Apply pretty much the same review comments from the previous test to this one. :) > --- > tests/all.tests | 1 + > tests/texturing/CMakeLists.txt | 1 + > tests/texturing/rg-supply-rgba.c | 117 > ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 119 insertions(+), 0 deletions(-) > create mode 100755 tests/texturing/rg-supply-rgba.c > > diff --git a/tests/all.tests b/tests/all.tests > index 97e766a..78d1659 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -231,6 +231,7 @@ add_plain_test(texturing, 'depth-tex-modes-glsl') > add_plain_test(texturing, 'depth-tex-compare') > add_plain_test(texturing, 'rg-draw-pixels') > add_plain_test(texturing, 'rg-copy-tex') > +add_plain_test(texturing, 'rg-supply-rgba') > > glslparsertest = Group() > def add_glslparsertest(shader, result): > diff --git a/tests/texturing/CMakeLists.txt b/tests/texturing/CMakeLists.txt > index c2e754f..0966fbb 100644 > --- a/tests/texturing/CMakeLists.txt > +++ b/tests/texturing/CMakeLists.txt > @@ -43,3 +43,4 @@ 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) > add_executable (rg-copy-tex rg-copy-tex.c) > +add_executable (rg-supply-rgba rg-supply-rgba.c) > diff --git a/tests/texturing/rg-supply-rgba.c > b/tests/texturing/rg-supply-rgba.c > new file mode 100755 > index 0000000..8d403b7 > --- /dev/null > +++ b/tests/texturing/rg-supply-rgba.c > @@ -0,0 +1,117 @@ > +/* > + * 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]> > + */ > + > +/* > + * Supplies rgba data to glTexImage2d but with internal formats GL_R8 > + * and GL_RG8. Checks rendered for g and b values (should be zero) > + */ > + > +#include "piglit-util.h" > +int piglit_width = 40, piglit_height = 30; > +int piglit_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); > +} > + > +static void > +loadTex() > +{ > + int height = 2; > + int width = 2; > + 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; > + > + } > + } > + } > + > + > + glGenTextures(2, tex); > + glBindTexture(GL_TEXTURE_2D, tex[0]); > + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); > + glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, width, height, 0, > + GL_RGBA, GL_FLOAT, texData); > + > + > + glBindTexture(GL_TEXTURE_2D, tex[1]); > + glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); > + glTexImage2D(GL_TEXTURE_2D, 0, GL_RG8, width, height, 0, > + GL_RGBA, GL_FLOAT, texData); > +} > + > +enum piglit_result > +piglit_display(void) > +{ > + glClear(GL_COLOR_BUFFER_BIT); > + glBindTexture(GL_TEXTURE_2D, tex[0]); > + piglit_draw_rect_tex(0,0,10,10,0,0,1,1); > + > + glBindTexture(GL_TEXTURE_2D, tex[1]); > + piglit_draw_rect_tex(11,0,21,10,0,0,1,1); > + > + GLboolean pass = GL_TRUE; > + GLfloat red[3] = {1.0, 0.0, 0.0}; > + GLfloat redgreen[3] = {1.0, 1.0, 0.0}; > + > + pass = pass && piglit_probe_pixel_rgb(6, 0, red); > + pass = pass && piglit_probe_pixel_rgb(117, 0, redgreen); > + > + 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/ iEYEARECAAYFAksGKjwACgkQX1gOwKyEAw8KAwCgoIj1RIe2dD/ctFwMHl/SYpc2 52IAn2LfhaMsvem7Rp3qcw+2+p9Y7I// =jZt9 -----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
