<div dir="ltr">On 5 January 2013 01:07, Chris Forbes <span dir="ltr"><<a href="mailto:chrisf@ijw.co.nz" target="_blank">chrisf@ijw.co.nz</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">
This tests that the new teximage state added in ARB_texture_multisample<br>
exists and has correct defaults for non-multisample textures:<br>
<br>
    - GL_TEXTURE_SAMPLES = 0<br>
    - GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = false<br></blockquote><div><br></div><div>I think you mean "true" here.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Signed-off-by: Chris Forbes <<a href="mailto:chrisf@ijw.co.nz">chrisf@ijw.co.nz</a>><br>
---<br>
 tests/all.tests                                    |  1 +<br>
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |  1 +<br>
 tests/spec/arb_texture_multisample/texstate.c      | 58 ++++++++++++++++++++++<br>
 3 files changed, 60 insertions(+)<br>
 create mode 100644 tests/spec/arb_texture_multisample/texstate.c<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 379964f..9963e46 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -845,6 +845,7 @@ arb_texture_multisample = Group()<br>
 spec['ARB_texture_multisample'] = arb_texture_multisample<br>
 add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-minmax')<br>
 add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-fb-completeness')<br>
+add_concurrent_test(arb_texture_multisample, 'arb_texture_multisample-texstate')<br>
<br>
 # Group AMD_shader_stencil_export<br>
 spec['AMD_shader_stencil_export'] = Group()<br>
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt<br>
index d793256..d4cd51f 100644<br>
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt<br>
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt<br>
@@ -12,5 +12,6 @@ link_libraries (<br>
<br>
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)<br>
 piglit_add_executable (arb_texture_multisample-fb-completeness fb-completeness.c)<br>
+piglit_add_executable (arb_texture_multisample-texstate texstate.c)<br>
<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/arb_texture_multisample/texstate.c b/tests/spec/arb_texture_multisample/texstate.c<br>
new file mode 100644<br>
index 0000000..37c111e<br>
--- /dev/null<br>
+++ b/tests/spec/arb_texture_multisample/texstate.c<br>
@@ -0,0 +1,58 @@<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+    config.supports_gl_compat_version = 30;<br>
+<br>
+    config.window_width = 10;<br>
+    config.window_height = 10;<br>
+    config.window_visual = PIGLIT_GL_VISUAL_RGB;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+    return PIGLIT_FAIL;<br>
+}<br>
+<br>
+static bool<br>
+check_texlevelparameter_int(GLuint target, GLuint level,<br>
+        char const *name, GLuint pname, GLint expected_value)<br>
+{<br>
+    GLint actual_value;<br>
+    glGetTexLevelParameteriv(target, level, pname, &actual_value);<br>
+    if (!piglit_check_gl_error(GL_NO_ERROR))<br>
+        return false;<br>
+<br>
+    if (actual_value != expected_value) {<br>
+        printf("Expected %s value of %d but got %d\n",<br>
+                name, expected_value, actual_value);<br>
+        return false;<br>
+    }<br>
+<br>
+    return true;<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+    GLuint tex2d;<br>
+    bool pass = true;<br>
+    piglit_require_extension("GL_ARB_texture_multisample");<br>
+<br>
+    /* check that new image state required by ARB_texture_multisample<br>
+     * exists, and has correct defaults. Tests against a non-multisample<br>
+     * texture target, since this state exists on all images. */<br>
+<br>
+    glGenTextures(1, &tex2d);<br>
+    glBindTexture(GL_TEXTURE_2D, tex2d);<br>
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);<br>
+<br>
+    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, "GL_TEXTURE_SAMPLES",<br>
+            GL_TEXTURE_SAMPLES, 0) && pass;<br>
+    pass = check_texlevelparameter_int(GL_TEXTURE_2D, 0, "GL_TEXTURE_FIXED_SAMPLE_LOCATIONS",<br>
+            GL_TEXTURE_FIXED_SAMPLE_LOCATIONS, GL_TRUE) && pass;<br>
+<br>
+    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.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>