<div dir="ltr">On 15 August 2013 12:40, Steve Miller <span dir="ltr"><<a href="mailto:dervishx@gmail.com" target="_blank">dervishx@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
add new test to existing arb_seamless_cube_map group: sample three adjoining<br>
faces and use average. if three faces are the same color, that color must<br>
be used.<br>
add test to makelists and all.tests<br>
---<br>
tests/all.tests | 1 +<br>
tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt | 1 +<br>
.../arb_seamless_cube_map/three-faces-average.c | 142 +++++++++++++++++++++<br>
3 files changed, 144 insertions(+)<br>
create mode 100644 tests/spec/arb_seamless_cube_map/three-faces-average.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 8766572..7240312 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -2233,6 +2233,7 @@ arb_seamless_cube_map = Group()<br>
spec['ARB_seamless_cube_map'] = arb_seamless_cube_map<br>
add_plain_test(arb_seamless_cube_map, 'arb_seamless_cubemap')<br>
add_plain_test(arb_seamless_cube_map, 'arb_seamless_cubemap-initially-disabled')<br>
+add_plain_test(arb_seamless_cube_map, 'arb_seamless_cubemap-three-faces-average')<br>
<br>
amd_seamless_cubemap_per_texture = Group()<br>
spec['AMD_seamless_cubemap_per_texture'] = amd_seamless_cubemap_per_texture<br>
diff --git a/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt b/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt<br>
index eac572a..e31759a 100644<br>
--- a/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_seamless_cube_map/CMakeLists.gl.txt<br>
@@ -11,5 +11,6 @@ link_libraries (<br>
<br>
piglit_add_executable (arb_seamless_cubemap arb_seamless_cubemap.c)<br>
piglit_add_executable (arb_seamless_cubemap-initially-disabled initially-disabled.c)<br>
+piglit_add_executable (arb_seamless_cubemap-three-faces-average three-faces-average.c)<br>
<br>
# vim: ft=cmake:<br>
diff --git a/tests/spec/arb_seamless_cube_map/three-faces-average.c b/tests/spec/arb_seamless_cube_map/three-faces-average.c<br>
new file mode 100644<br>
index 0000000..5c3609d<br>
--- /dev/null<br>
+++ b/tests/spec/arb_seamless_cube_map/three-faces-average.c<br>
@@ -0,0 +1,142 @@<br>
+/*<br>
+ * Copyright © Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>><br></blockquote><div><br></div><div>I think you changed enough from the test you were cribbing from that it makes sense to change this to "Copyright © 2013 Intel Corporation".<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ *<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 shall be included<br>
+ * in all copies or substantial portions of the Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS<br>
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN<br>
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN<br>
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/*<br>
+ * Test verifies that when sampling from three ajoining faces in a cube map,<br>
+ * samples will be averaged.If they share the same value, that value must be<br></blockquote><div><br></div><div>Space after the period.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ * guaranteed to be the result of the average. Resulting color should not include<br>
+ * border color contamination.<br>
+ */<br>
+<br>
+/*<br>
+ * ARB_seamless_cube_map Section 3.8.7 says:<br>
+ * "If LINEAR filtering is done within a miplevel, always apply wrap mode<br>
+ * CLAMP_TO_BORDER. Then, ...<br>
+ *<br>
+ * If a texture sample location would lie in the texture border in<br>
+ * both u and v (in one of the corners of the cube), there is no<br>
+ * unique neighboring face from which to extract one texel. The<br>
+ * recommended method is to average the values of the three<br>
+ * available samples. However, implementations are free to<br>
+ * construct this fourth texel in another way, so long as, when the<br>
+ * three available samples have the same value, this texel also has<br>
+ * that value."<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+ config.supports_gl_compat_version = 10;<br>
+<br>
+ config.window_width = 100;<br>
+ config.window_height = 40;<br>
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+static const float red[3] = { 1., 0., 0. };<br>
+static const float blue[3] = { 0., 0., 1. };<br>
+static const float black[3] = { 0., 0., 0. };<br>
+<br>
+static const GLenum targets[6] = {<br>
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,<br>
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,<br>
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,<br>
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,<br>
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,<br>
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB<br>
+};<br>
+<br>
+static void draw_quad(int x, int y, float s, float t, float r)<br>
+{<br>
+ glBegin(GL_QUADS);<br>
+ glTexCoord3f(s, t, r);<br>
+ glVertex2i(x, y);<br>
+ glVertex2i(x, y+20);<br>
+ glVertex2i(x+20, y+20);<br>
+ glVertex2i(x+20, y);<br>
+ glEnd();<br>
+}<br></blockquote><div><br></div><div>We try to avoid using deprecated functionality in new tests. Please rewrite this test to use shaders, VBO's, etc.<br><br></div><div>Other than that, the test looks reasonable. Thanks!<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+void piglit_init( int argc, char **argv)<br>
+{<br>
+ GLint i;<br>
+<br>
+ piglit_require_extension( "GL_ARB_texture_cube_map" );<br>
+ piglit_require_extension( "GL_ARB_seamless_cube_map" );<br>
+<br>
+ glBindTexture( GL_TEXTURE_CUBE_MAP_ARB, 1 );<br>
+ /* set filter to linear, hardware should behave as if<br>
+ * wrap modes are set to CLAMP_TO_BORDER<br>
+ */<br>
+ glTexParameterfv( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_BORDER_COLOR,<br>
+ black );<br>
+ glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,<br>
+ GL_LINEAR );<br>
+ glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER,<br>
+ GL_LINEAR );<br>
+<br>
+ /* texture positive axes/faces red */<br>
+ for( i = 0; i < 3; i++ )<br>
+ {<br>
+ glTexImage2D( targets[i], 0, GL_RGBA8, 1, 1, 0, GL_RGB, GL_FLOAT,<br>
+ red );<br>
+ }<br>
+<br>
+ /* texuture negative axes/faces blue */<br>
+ for( i = 3; i < 6; i++ )<br>
+ {<br>
+ glTexImage2D( targets[i], 0, GL_RGBA8, 1, 1, 0, GL_RGB, GL_FLOAT,<br>
+ blue );<br>
+ }<br>
+<br>
+ glEnable( GL_TEXTURE_CUBE_MAP_ARB );<br>
+<br>
+ glClearColor( 0.0, 0.0, 0.0, 0.0 );<br>
+<br>
+ piglit_ortho_projection( piglit_width, piglit_height, GL_FALSE );<br>
+}<br>
+<br>
+enum piglit_result piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+<br>
+ glClear( GL_COLOR_BUFFER_BIT );<br>
+<br>
+ glEnable( GL_TEXTURE_CUBE_MAP_SEAMLESS );<br>
+<br>
+ /* texcoords should target vector to upper corner */<br>
+ draw_quad( 10, 10, 0.5, 0.5, 0.5 );<br>
+ /* expect red */<br>
+ pass = piglit_probe_pixel_rgb( 20, 20, red ) && pass;<br>
+<br>
+ /* texcoords should target vector to bottom corner */<br>
+ draw_quad ( 40, 10, -0.5, -0.5, -0.5 );<br>
+ /* expect blue */<br>
+ pass = piglit_probe_pixel_rgb( 50, 20, blue ) && pass;<br>
+<br>
+ glDisable( GL_TEXTURE_CUBE_MAP_SEAMLESS );<br>
+<br>
+ piglit_present_results();<br>
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<span class=""><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>