On 10/28/2013 12:16 PM, Jon Ashburn wrote:
Tests texture views with data format changes. 1D textures only.
Uses multiple simultaneous views with different lifetimes and
check results via glGetTexImage().

Tested on Nvidia  Quadro 600, all subtests pass.

Signed-off-by: Jon Ashburn <[email protected]>
---
  tests/all.tests                               |   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt |   1 +
  tests/spec/arb_texture_view/lifetime_format.c | 235 ++++++++++++++++++++++++++
  3 files changed, 237 insertions(+)
  create mode 100644 tests/spec/arb_texture_view/lifetime_format.c

diff --git a/tests/all.tests b/tests/all.tests
index a329156..0856467 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1478,6 +1478,7 @@ arb_texture_view['targets'] = 
concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = concurrent_test('arb_texture_view-queries')
  arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')
  arb_texture_view['rendering-levels'] = 
concurrent_test('arb_texture_view-rendering-levels')
+arb_texture_view['lifetime-format'] = 
concurrent_test('arb_texture_view-lifetime-format')

  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt
index a39c7dd..bce50c3 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -16,5 +16,6 @@ piglit_add_executable(arb_texture_view-targets targets.c 
common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
  piglit_add_executable(arb_texture_view-rendering-target rendering_target.c 
common.c)
  piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c 
common.c)
+piglit_add_executable(arb_texture_view-lifetime-format lifetime_format.c 
common.c)

  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/lifetime_format.c 
b/tests/spec/arb_texture_view/lifetime_format.c
new file mode 100644
index 0000000..c1939c8
--- /dev/null
+++ b/tests/spec/arb_texture_view/lifetime_format.c
@@ -0,0 +1,235 @@
+/*
+ * Copyright © 2013 LunarG, Inc.
+ *
+ * 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.
+ *
+ * Author: Jon Ashburn <[email protected]>
+ */
+
+/**
+ * Tests texture views with data format changes. 1D textures only.
+ * Uses multiple simultaneous views with different lifetimes and
+ * check results via glGetTexImage().
+ */
+
+#include "piglit-util-gl-common.h"
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+       config.supports_gl_compat_version = 10;
+       config.supports_gl_core_version = 31;
+
+       config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+/* Texture formats. The format_list variable has these fields: */
+struct format_desc {
+       const char  *name;
+       GLenum      internalfmt;
+       GLenum      storagefmt;
+       GLenum      imagefmt;
+       GLenum      imagetype;
+       GLenum      getfmt;
+       GLenum      gettype;
+       int         red, green, blue, alpha;
+};
+
+#define FORMAT(f) #f, f
+static const struct format_desc format_list[] = {
+       {FORMAT(GL_RGBA8UI), GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE,
+               GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, 8, 8, 8, 8},
+       {FORMAT(GL_RGBA8I), GL_RGBA8I, GL_RGBA, GL_UNSIGNED_BYTE,
+               GL_RGBA_INTEGER, GL_BYTE, 8, 8, 8, 8},
+       {FORMAT(GL_RGB16F), GL_RGB16F, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB,
+               GL_HALF_FLOAT, 16, 16, 16, 0},
+       {FORMAT(GL_RGB16I), GL_RGB16, GL_RGB, GL_UNSIGNED_BYTE,
+               GL_RGB_INTEGER, GL_SHORT, 16, 16, 16, 0},
+       {FORMAT(GL_R16UI), GL_R16, GL_RED, GL_UNSIGNED_BYTE,
+               GL_RED_INTEGER, GL_UNSIGNED_SHORT, 16, 0, 0, 0},
+       {FORMAT(GL_R16F), GL_R16, GL_RED, GL_UNSIGNED_BYTE,
+               GL_RED, GL_HALF_FLOAT, 16, 0, 0, 0},
+       {FORMAT(GL_RGBA16UI), GL_RGBA16, GL_RGBA, GL_UNSIGNED_BYTE,
+               GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, 16, 16, 16, 16},
+       {FORMAT(GL_RGBA16F), GL_RGBA16, GL_RGBA, GL_UNSIGNED_BYTE,
+               GL_RGBA, GL_HALF_FLOAT, 16, 16, 16, 16},
+};
+#undef FORMAT
+
+
+static int
+compare_buffers(unsigned char * buf0, unsigned char *buf1, GLint w)

I think I mentioned before that this could return bool. And maybe rename the function to buffers_equal().


+{
+       int i;
+       for (i = 0; i < w; i++) {
+               if (buf0[i] != buf1[i]) {
+                       printf("mismatched texels at index (%d)\n", i);
+                       printf("  Buffer0: %u\n", buf0[i]);
+                       printf("  Buffer1: %u\n", buf1[i]);
+                       return 1;
+               }
+       }
+
+       return 0;
+}
+

The rest of the series looks good, so I think we can push this with these two minor fixes.

Do you need someone to push to master for you?

-Brian

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to