<div dir="ltr">On 26 August 2013 11:53, 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">Currently tests fail, using glGetFramebufferAttachmentParameteriv to check that<br>
the attachment is layered. The glError GL_INVALID_ENUM is returned from<br>
glGetFramebufferAttachmentParameteriv. It appears that<br>
GL_FRAMEBUFFER_ATTACHMENT_LAYERED may not be correctly working with the function<br></blockquote><div><br></div><div>Same comment as before about the commit message.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

---<br>
 .../gl-3.2/layered-rendering/framebuffertexture.c  | 190 +++++++++++++++++++++<br>
 1 file changed, 190 insertions(+)<br>
 create mode 100644 tests/spec/gl-3.2/layered-rendering/framebuffertexture.c<br>
<br>
diff --git a/tests/spec/gl-3.2/layered-rendering/framebuffertexture.c b/tests/spec/gl-3.2/layered-rendering/framebuffertexture.c<br>
new file mode 100644<br>
index 0000000..788ac6d<br>
--- /dev/null<br>
+++ b/tests/spec/gl-3.2/layered-rendering/framebuffertexture.c<br>
@@ -0,0 +1,190 @@<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 framebuffertexture-layered-attachment.c<br>
+ *<br>
+ * Section 4.4.2(Framebuffer Objects) From GL spec 3.2 core:<br>
+ *<br>
+ * void FramebufferTexture( enum target, enum attachment, uint texture,<br>
+ *                          int level );<br>
+ *<br>
+ * If texture is the name of a three-dimensional texture, cube map texture,<br>
+ * one-or two-dimensional array texture, or two-dimensional multisample array<br>
+ * texture, the texture level attached to the framebuffer attachment point is<br>
+ * an array of images, and the framebuffer attachment is considered layered.<br>
+ */<br></blockquote><div><br></div><div>Is this test redundant with the test from patch 6?  It seems like both tests operate by creating a framebuffer and then checking that TEST_FRAMEBUFFER_ATTACHMENT_LAYERED returns the correct result.<br>
<br>There seems to be a fair amount of duplicate code between the patches in this series, so it seems like it might be nice to merge these two tests into one if it's possible to do so without losing anything of value.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<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>
+<br>
+       config.window_width  = 128;<br>
+       config.window_height = 128;<br>
+       config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+const int texWidth  = 10;<br>
+const int texHeight = 10;<br>
+const int texDepth  = 2;<br>
+<br>
+GLenum testTargets [] = {<br>
+       GL_TEXTURE_3D,<br>
+       GL_TEXTURE_CUBE_MAP,<br>
+       GL_TEXTURE_1D_ARRAY,<br>
+       GL_TEXTURE_2D_ARRAY,<br>
+       GL_TEXTURE_2D_MULTISAMPLE_ARRAY<br>
+};<br>
+<br>
+void<br>
+create_texture(GLenum textureType, GLuint *texture) {<br>
+       int i;<br>
+       glGenTextures(1, texture);<br>
+       glBindTexture(textureType, *texture);<br>
+<br>
+       switch(textureType) {<br>
+       case GL_TEXTURE_2D:<br>
+       case GL_TEXTURE_1D_ARRAY:<br>
+               glTexParameteri(textureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);<br>
+               glTexParameteri(textureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);<br>
+               glTexParameteri(textureType, GL_TEXTURE_WRAP_S, GL_REPEAT);<br>
+               glTexParameteri(textureType, GL_TEXTURE_WRAP_T, GL_REPEAT);<br>
+               glTexImage2D(textureType, 0, GL_RGB, texWidth, texHeight,<br>
+                            0, GL_RGB, GL_FLOAT, NULL);<br>
+               break;<br>
+       case GL_TEXTURE_3D:<br>
+       case GL_TEXTURE_2D_ARRAY:<br>
+               glTexParameteri(textureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR);<br>
+               glTexParameteri(textureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR);<br>
+               glTexParameteri(textureType, GL_TEXTURE_WRAP_S, GL_REPEAT);<br>
+               glTexParameteri(textureType, GL_TEXTURE_WRAP_T, GL_REPEAT);<br>
+               glTexParameteri(textureType, GL_TEXTURE_WRAP_R, GL_REPEAT);<br>
+               glTexImage3D(textureType, 0, GL_RGB, texWidth, texHeight,<br>
+                            texDepth, 0, GL_RGB, GL_FLOAT, NULL);<br>
+               break;<br>
+       case GL_TEXTURE_CUBE_MAP:<br>
+               /* loop through each cube map face */<br>
+               for(i = 0; i < 6; i++) {<br>
+                       glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,<br>
+                                    GL_RGB, texWidth, texHeight, 0, GL_RGB,<br>
+                                    GL_FLOAT, NULL);<br>
+               }<br>
+               break;<br>
+       case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:<br>
+               glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 4,<br>
+                                       GL_RGB, texWidth, texHeight, texDepth,<br>
+                                       GL_FALSE);<br>
+               break;<br>
+       }<br>
+<br>
+}<br>
+<br>
+void<br>
+attach_texture(GLenum target, GLenum textureType, GLuint texture) {<br>
+       switch(textureType) {<br>
+       case GL_TEXTURE_2D:<br>
+               glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0,<br>
+                                      textureType, texture, 0);<br>
+               break;<br>
+       case GL_TEXTURE_1D_ARRAY:<br>
+       case GL_TEXTURE_3D:<br>
+       case GL_TEXTURE_2D_ARRAY:<br>
+       case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:<br>
+               glFramebufferTexture(target, GL_COLOR_ATTACHMENT0, texture, 0);<br>
+               break;<br>
+       case GL_TEXTURE_CUBE_MAP:<br>
+               glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0,<br>
+                                      GL_TEXTURE_CUBE_MAP_POSITIVE_X,<br>
+                                      texture, 0);<br>
+               break;<br>
+       }<br>
+}<br>
+<br>
+bool<br>
+testFramebufferTexture(GLenum textureType) {<br>
+       bool pass = true;<br>
+       GLuint fbo, texture;<br>
+       GLint attachmentLayeredStatus = GL_FALSE;<br>
+<br>
+       glGenFramebuffers(1, &fbo);<br>
+       glBindFramebuffer(GL_FRAMEBUFFER, fbo);<br>
+<br>
+       /* creates and binds the texture of textureType */<br>
+       create_texture(textureType, &texture);<br>
+       piglit_check_gl_error(GL_NO_ERROR);<br>
+<br>
+       /* Attach the texture to the framebuffer */<br>
+       attach_texture(GL_FRAMEBUFFER, textureType, texture);<br>
+       piglit_check_gl_error(GL_NO_ERROR);<br>
+<br>
+       /* Check if the color attachment 0 is layered */<br>
+       glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER,<br>
+                                             GL_COLOR_ATTACHMENT0,<br>
+                                             GL_FRAMEBUFFER_ATTACHMENT_LAYERED,<br>
+                                             &attachmentLayeredStatus);<br>
+<br>
+       piglit_check_gl_error(GL_NO_ERROR);<br>
+<br>
+       glBindFramebuffer(GL_FRAMEBUFFER, 0);<br>
+       glDeleteFramebuffers(1, &fbo);<br>
+       glDeleteTextures(1, &texture);<br>
+<br>
+       switch (attachmentLayeredStatus){<br>
+       case GL_TRUE:<br>
+               break;<br>
+       case GL_FALSE:<br>
+               pass = false;<br>
+               break;<br>
+       default:<br>
+               printf("Recieved incorrect data from "<br>
+                      "glFramebufferAttachmentParameteriv\n");<br>
+               pass =  false;<br>
+               break;<br>
+       }<br>
+<br>
+       return pass;<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       int i;<br>
+       bool pass = true;<br>
+<br>
+       for(i = 0; i < ARRAY_SIZE(testTargets); i++) {<br>
+               pass = testFramebufferTexture(testTargets[i]) && pass;<br>
+       }<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 class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">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>