On 3 September 2013 15:52, Jacob Penner <jkpenne...@gmail.com> wrote:
> --- > tests/all.tests | 1 + > .../gl-3.2/layered-rendering/CMakeLists.gl.txt | 1 + > tests/spec/gl-3.2/layered-rendering/readpixels.c | 97 > ++++++++++++++++++++++ > 3 files changed, 99 insertions(+) > create mode 100644 tests/spec/gl-3.2/layered-rendering/readpixels.c > > diff --git a/tests/all.tests b/tests/all.tests > index dfbb756..877253d 100644 > --- a/tests/all.tests > +++ b/tests/all.tests > @@ -751,6 +751,7 @@ spec['!OpenGL 3.2/get-integer-64v'] = > concurrent_test('gl-3.2-get-integer-64v') > spec['!OpenGL 3.2/layered-rendering/blit'] = > concurrent_test('gl-3.2-layered-rendering-blit') > spec['!OpenGL 3.2/layered-rendering/clear-color'] = > concurrent_test('gl-3.2-layered-rendering-clear-color') > spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] > = > concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures') > +spec['!OpenGL 3.2/layered-rendering/readpixels'] = > concurrent_test('gl-3.2-layered-rendering-readpixels') > > spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax') > spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = > concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33') > diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt > b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt > index 89b7251..2a66253 100644 > --- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt > +++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt > @@ -12,4 +12,5 @@ link_libraries ( > piglit_add_executable (gl-3.2-layered-rendering-blit blit.c) > piglit_add_executable (gl-3.2-layered-rendering-clear-color clear-color.c) > piglit_add_executable > (gl-3.2-layered-rendering-framebuffertexture-buffer-textures > framebuffertexture-buffer-textures.c) > +piglit_add_executable (gl-3.2-layered-rendering-readpixels readpixels.c) > # vim: ft=cmake: > diff --git a/tests/spec/gl-3.2/layered-rendering/readpixels.c > b/tests/spec/gl-3.2/layered-rendering/readpixels.c > new file mode 100644 > index 0000000..1de505c > --- /dev/null > +++ b/tests/spec/gl-3.2/layered-rendering/readpixels.c > @@ -0,0 +1,97 @@ > +/* > + * Copyright © 2013 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. > + */ > + > + > +/** @file readpixel.c > + * > + * Section 4.4.7(Framebuffer Objects) From GL spec 3.2 core: > + * > + * When commands such as ReadPixels read from a layered framebuffer, the > + * image at layer zero of the selected attachment is always used to obtain > + * pixel values. > + */ > + > +#include "piglit-util-gl-common.h" > + > +PIGLIT_GL_TEST_CONFIG_BEGIN > + > + config.supports_gl_compat_version = 31; > + config.supports_gl_core_version = 31; > These lines should both use "32" instead of "31". With that fixed, this patch is: Reviewed-by: Paul Berry <stereotype...@gmail.com> > + > +PIGLIT_GL_TEST_CONFIG_END > + > +static const float color[3][3] = { > + {0.0, 1.0, 0.0}, > + {0.0, 0.0, 1.0} > +}; > + > +void > +piglit_init(int argc, char **argv) > +{ > + int i, j; > + bool pass = true; > + GLuint fbo, texture; > + float colorData[2][10*10*3]; > + > + /* fill in colorData */ > + for(j = 0; j < 2; j++) > + for(i = 0; i < 10*10; i++) { > + colorData[j][i*3+0] = color[j][0]; > + colorData[j][i*3+1] = color[j][1]; > + colorData[j][i*3+2] = color[j][2]; > + } > + > + /* Create the Source framebuffer object */ > + glGenTextures(1, &texture); > + glBindTexture(GL_TEXTURE_3D, texture); > + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); > + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); > + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT); > + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT); > + glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); > + glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 10, 10, 2, 0, GL_RGB, > + GL_FLOAT, colorData); > + > + glGenFramebuffers(1, &fbo); > + glBindFramebuffer(GL_FRAMEBUFFER, fbo); > + glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, > + GL_TEXTURE_3D, texture, 0, 0); > + > + if(!piglit_check_gl_error(GL_NO_ERROR)) { > + piglit_report_result(PIGLIT_FAIL); > + } > + > + /* piglit_probe_rect_rgb internally calls ReadPixel(). Check that > + * the color probed is the same as the Zero layer of the texture. > + */ > + pass = piglit_probe_rect_rgb(0, 0, 10, 10, color[0]) && pass; > + > + piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); > +} > + > +enum piglit_result > +piglit_display(void) > +{ > + /* UNREACHABLE */ > + return PIGLIT_FAIL; > +} > -- > 1.8.3.1 > > _______________________________________________ > Piglit mailing list > Piglit@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/piglit >
_______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit