On Fri, 18 Nov 2011 15:38:46 +0800, Yuanhan Liu <yuanhan....@linux.intel.com> wrote: > > The two patches tries to fix an issue that happened while calling glDrawPixels > with texture enabled. > > Here I attached a piglit testcase for this issue.
git send-email does reasonable things if you supply arguments from 2 separate git format-patch series, instead of putting the patch from the other series inline here. > -- > From c199828cddae5bd0f8e96d586b91be6ad423dbce Mon Sep 17 00:00:00 2001 > From: Yuanhan Liu <yuanhan....@linux.intel.com> > Date: Fri, 18 Nov 2011 15:37:33 +0800 > Subject: [PATCH] Add a draw-pixel-with-texture testcase > > Add a draw-pixel-with-texture testcase to check if sampling is happened > while drawing pixels by glDrawPixels. > > Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com> > --- > tests/all.tests | 1 + > tests/general/CMakeLists.gl.txt | 1 + > tests/general/draw-pixel-with-texture.c | 80 > +++++++++++++++++++++++++++++++ > 3 files changed, 82 insertions(+), 0 deletions(-) > create mode 100644 tests/general/draw-pixel-with-texture.c > > diff --git a/tests/all.tests b/tests/all.tests > index 48ce2cb..851db11 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -242,6 +242,7 @@ general['draw-elements-user'] = > PlainExecTest(['draw-elements', '-auto', 'user'] > add_plain_test(general, 'draw-elements-vs-inputs') > add_plain_test(general, 'draw-instanced') > add_plain_test(general, 'draw-instanced-divisor') > +add_plain_test(general, 'draw-pixel-with-texture') > add_plain_test(general, 'draw-vertices') > general['draw-vertices-user'] = PlainExecTest(['draw-vertices', '-auto', > 'user']) > add_plain_test(general, 'draw-vertices-half-float') > diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt > index 2cfc7be..58cbaa1 100644 > --- a/tests/general/CMakeLists.gl.txt > +++ b/tests/general/CMakeLists.gl.txt > @@ -42,6 +42,7 @@ ENDIF (UNIX) > add_executable (draw-elements-vs-inputs draw-elements-vs-inputs.c) > add_executable (draw-instanced draw-instanced.c) > add_executable (draw-instanced-divisor draw-instanced-divisor.c) > +add_executable (draw-pixel-with-texture draw-pixel-with-texture.c) > add_executable (draw-sync draw-sync.c) > add_executable (draw-vertices draw-vertices.c) > add_executable (draw-vertices-half-float draw-vertices-half-float.c) > diff --git a/tests/general/draw-pixel-with-texture.c > b/tests/general/draw-pixel-with-texture.c > new file mode 100644 > index 0000000..c39d35e > --- /dev/null > +++ b/tests/general/draw-pixel-with-texture.c > @@ -0,0 +1,80 @@ > +/* > + * Copyright (C) 2011 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: > + * Yuanhan Liu <yuanhan....@linux.intel.com> > + */ > + > +#include "piglit-util.h" > + > +int piglit_width = 100, piglit_height = 100; > +int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE; > + > + > +enum piglit_result > +piglit_display(void) > +{ > + GLboolean pass = GL_TRUE; > + GLfloat tex_data[2 * 2 * 4] = { > + 1, 0, 0, 1, 1, 0, 0, 1, > + 1, 0, 0, 1, 1, 0, 0, 1, > + }; > + GLfloat pixels[20 * 20 * 4]; > + GLfloat expected[4] = {0.2, 0, 0, 1}; > + int i; > + > + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_FLOAT, > tex_data); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); > + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); > + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); > + > + glTexCoord2f(0.5, 0.5); > + glEnable(GL_TEXTURE_2D); > + > + for (i = 0; i < 20 * 20 * 4; i += 4) { > + pixels[i + 0] = 0.2; > + pixels[i + 1] = 1; > + pixels[i + 2] = 0; > + pixels[i + 3] = 1; > + } > + > + glClear(GL_COLOR_BUFFER_BIT); > + > + glDrawPixels(20, 20, GL_RGBA, GL_FLOAT, pixels); > + > + /* Here just sample a small set of pixels */ > + pass &= piglit_probe_pixel_rgba(5, 5, expected); > + pass &= piglit_probe_pixel_rgba(7, 12, expected); > + pass &= piglit_probe_pixel_rgba(10, 10, expected); > + pass &= piglit_probe_pixel_rgba(18, 18, expected); there's piglit_probe_rect_rgba() available instead of picking some arbitrary subset of pixels.
pgpnGRcMrMIQq.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev