<div dir="ltr">On 3 September 2013 15:52, Jacob Penner <span dir="ltr"><<a href="mailto:jkpenner91@gmail.com" target="_blank">jkpenner91@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 tests/all.tests                                    |  1 +<br>
 .../gl-3.2/layered-rendering/CMakeLists.gl.txt     |  1 +<br>
 tests/spec/gl-3.2/layered-rendering/readpixels.c   | 97 ++++++++++++++++++++++<br>
 3 files changed, 99 insertions(+)<br>
 create mode 100644 tests/spec/gl-3.2/layered-rendering/readpixels.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index dfbb756..877253d 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -751,6 +751,7 @@ spec['!OpenGL 3.2/get-integer-64v'] = concurrent_test('gl-3.2-get-integer-64v')<br>
 spec['!OpenGL 3.2/layered-rendering/blit'] = concurrent_test('gl-3.2-layered-rendering-blit')<br>
 spec['!OpenGL 3.2/layered-rendering/clear-color'] = concurrent_test('gl-3.2-layered-rendering-clear-color')<br>
 spec['!OpenGL 3.2/layered-rendering/framebuffertexture-buffer-textures'] = concurrent_test('gl-3.2-layered-rendering-framebuffertexture-buffer-textures')<br>
+spec['!OpenGL 3.2/layered-rendering/readpixels'] = concurrent_test('gl-3.2-layered-rendering-readpixels')<br>
<br>
 spec['!OpenGL 3.3/minmax'] = concurrent_test('gl-3.3-minmax')<br>
 spec['!OpenGL 3.3/required-renderbuffer-attachment-formats'] = concurrent_test('gl-3.0-required-renderbuffer-attachment-formats 33')<br>
diff --git a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt<br>
index 89b7251..2a66253 100644<br>
--- a/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-3.2/layered-rendering/CMakeLists.gl.txt<br>
@@ -12,4 +12,5 @@ link_libraries (<br>
 piglit_add_executable (gl-3.2-layered-rendering-blit blit.c)<br>
 piglit_add_executable (gl-3.2-layered-rendering-clear-color clear-color.c)<br>
 piglit_add_executable (gl-3.2-layered-rendering-framebuffertexture-buffer-textures framebuffertexture-buffer-textures.c)<br>
+piglit_add_executable (gl-3.2-layered-rendering-readpixels readpixels.c)<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/gl-3.2/layered-rendering/readpixels.c b/tests/spec/gl-3.2/layered-rendering/readpixels.c<br>
new file mode 100644<br>
index 0000000..1de505c<br>
--- /dev/null<br>
+++ b/tests/spec/gl-3.2/layered-rendering/readpixels.c<br>
@@ -0,0 +1,97 @@<br>
+/*<br>
+ * Copyright © 2013 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+<br>
+/** @file readpixel.c<br>
+ *<br>
+ * Section 4.4.7(Framebuffer Objects) From GL spec 3.2 core:<br>
+ *<br>
+ * When commands such as ReadPixels read from a layered framebuffer, the<br>
+ * image at layer zero of the selected attachment is always used to obtain<br>
+ * pixel values.<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_compat_version = 31;<br>
+       config.supports_gl_core_version = 31;<br></blockquote><div><br></div><div>These lines should both use "32" instead of "31".<br><br></div><div>With that fixed, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static const float color[3][3] = {<br>
+       {0.0, 1.0, 0.0},<br>
+       {0.0, 0.0, 1.0}<br>
+};<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       int i, j;<br>
+       bool pass = true;<br>
+       GLuint fbo, texture;<br>
+       float colorData[2][10*10*3];<br>
+<br>
+       /* fill in colorData */<br>
+       for(j = 0; j < 2; j++)<br>
+       for(i = 0; i < 10*10; i++) {<br>
+               colorData[j][i*3+0] = color[j][0];<br>
+               colorData[j][i*3+1] = color[j][1];<br>
+               colorData[j][i*3+2] = color[j][2];<br>
+       }<br>
+<br>
+       /* Create the Source framebuffer object */<br>
+       glGenTextures(1, &texture);<br>
+       glBindTexture(GL_TEXTURE_3D, texture);<br>
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);<br>
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);<br>
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);<br>
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);<br>
+       glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);<br>
+       glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, 10, 10, 2, 0, GL_RGB,<br>
+                    GL_FLOAT, colorData);<br>
+<br>
+       glGenFramebuffers(1, &fbo);<br>
+       glBindFramebuffer(GL_FRAMEBUFFER, fbo);<br>
+       glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,<br>
+                              GL_TEXTURE_3D, texture, 0, 0);<br>
+<br>
+       if(!piglit_check_gl_error(GL_NO_ERROR)) {<br>
+               piglit_report_result(PIGLIT_FAIL);<br>
+       }<br>
+<br>
+       /* piglit_probe_rect_rgb internally calls ReadPixel(). Check that<br>
+        * the color probed is the same as the Zero layer of the texture.<br>
+        */<br>
+       pass = piglit_probe_rect_rgb(0, 0, 10, 10, color[0]) && pass;<br>
+<br>
+       piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       /* UNREACHABLE */<br>
+       return PIGLIT_FAIL;<br>
+}<br>
<span><font color="#888888">--<br>
1.8.3.1<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org" target="_blank">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>