[Piglit] [PATCH] isinf-and-isnan: add clamp / min / max tests
From: Roland Scheidegger We expect non-nan results for these (according to d3d10 rules, and at least for min/max, also according to ieee rules). The tests will not actually fail with other results (since GL's NaN behavior is all undefined), albeit some apps may rely on this. (We'll use clamp to 0/1 on purpose, which may get optimized to a saturate modifier on some hw, and ideally we'd see a non-nan result there too. The expected result there is really zero (d3d10 would require this), so if it gets decomposed into min/max combo the order is actually important.) On r600, right now all 3 give undesired (NaN) results (pending fixes), albeit all legal. --- tests/spec/glsl-1.30/execution/isinf-and-isnan.c | 9 + 1 file changed, 9 insertions(+) diff --git a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c index 099b5c2..77a7591 100644 --- a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c +++ b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c @@ -340,6 +340,7 @@ enum behavior B_FINITE = 1, /* Expected to evaluate to a finite value */ B_POSINF = 2, /* Expected to evaluate to +Infinity */ B_NEGINF = 3, /* Expected to evaluate to -Infinity */ + B_FINITE_NANOK = 4, /* Expected finite value, but NaN ok */ }; struct expression_table_element @@ -369,6 +370,10 @@ static struct expression_table_element expressions[] = { { "log(-1.0+z)", B_NAN }, { "sqrt(-1.0)", B_NAN }, { "sqrt(-1.0+z)", B_NAN }, + { "clamp(u_nan, 0.0, 1.0)", B_FINITE_NANOK }, + { "min(u_two, u_nan)", B_FINITE_NANOK }, + { "max(u_two, u_nan)", B_FINITE_NANOK }, + }; /** @@ -446,6 +451,7 @@ test_expr(char *expression, int expected_behavior) "uniform float u_inf;\n" /* Always == +infinity */ "uniform float u_minus_inf;\n" /* Always == -infinity */ "uniform float u_nan;\n" /* Always == NaN */ + "uniform float u_two = 2.0;\n" /* To defeat constant folding */ "float compute_value() {\n" " return %s;\n" "}\n", @@ -523,6 +529,9 @@ test_expr(char *expression, int expected_behavior) pass = false; } break; + case B_FINITE_NANOK: + expected_behavior_string = "finite"; + break; default: expected_behavior_string = "NaN"; break; -- 2.7.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] cmake: also install Windows manifest files
The previous patch (5087aa3f1020d0 "cmake: create Win10 manifest files for particular executables") didn't copy the manifest files when doing 'make install'. This fixes that. It requires CMake 3.0 or later. Thanks to Brad King for helping out! --- cmake/piglit_util.cmake | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake index 9b85761..918ea84 100644 --- a/cmake/piglit_util.cmake +++ b/cmake/piglit_util.cmake @@ -114,8 +114,11 @@ function(piglit_create_manifest_file target) # the manifest file, but I've been unsuccessful in getting # that to work. file(GENERATE -OUTPUT bin/${target}.exe.manifest +OUTPUT $.manifest INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt) + + install(FILES $.manifest + DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin) endif() endif() endfunction(piglit_create_manifest_file) -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] framework: specify GL_NEAREST filter for FBO textures
By setting the min/mag filters, we give a hint to the OpenGL driver that we probaby don't want mipmapped textures. This results in the Mesa state tracker allocating single-level textures here instead of full mipmaps. --- tests/util/piglit-framework-gl/piglit_fbo_framework.c | 4 1 file changed, 4 insertions(+) diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c index 77e717b..7064753 100644 --- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c +++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c @@ -77,6 +77,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw) glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, piglit_width, piglit_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); @@ -93,6 +95,8 @@ init_gl(struct piglit_wfl_framework *wfl_fw) */ glGenTextures(1, &depth); glBindTexture(GL_TEXTURE_2D, depth); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL, piglit_width, piglit_height, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL); -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] gl-1.0-logicop: allow testing single mode on the command line
And require GL 1.1 since that's when color logicops were introduced. Technically, we should move/rename the test, but it's hardly worth it. --- tests/spec/gl-1.0/logicop.c | 90 + 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c index 9ff80be..d415335 100644 --- a/tests/spec/gl-1.0/logicop.c +++ b/tests/spec/gl-1.0/logicop.c @@ -46,7 +46,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN - config.supports_gl_compat_version = 10; + config.supports_gl_compat_version = 11; config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; @@ -54,12 +54,28 @@ PIGLIT_GL_TEST_CONFIG_BEGIN PIGLIT_GL_TEST_CONFIG_END -void -piglit_init(int argc, char **argv) -{ - srand(0); - piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); -} + +static const GLenum logicop_modes[] = { + GL_CLEAR, + GL_SET, + GL_COPY, + GL_COPY_INVERTED, + GL_NOOP, + GL_INVERT, + GL_AND, + GL_NAND, + GL_OR, + GL_NOR, + GL_XOR, + GL_EQUIV, + GL_AND_REVERSE, + GL_AND_INVERTED, + GL_OR_REVERSE, + GL_OR_INVERTED +}; + +static GLenum test_single = 0; /* 0 = test all logicop modes */ + static GLubyte* random_image_data(void) @@ -67,7 +83,7 @@ random_image_data(void) int i; GLubyte *img = malloc(4 * img_width * img_height * sizeof(GLubyte)); for (i = 0; i < 4 * img_width * img_height; ++i) { - img[i] = rand() % 256; + img[i] = /*rand()*/ (100+i) % 256; } return img; } @@ -284,32 +300,42 @@ piglit_display(void) enum piglit_result subtest; unsigned int op; - static GLenum logicop_modes[] = { - GL_CLEAR, - GL_SET, - GL_COPY, - GL_COPY_INVERTED, - GL_NOOP, - GL_INVERT, - GL_AND, - GL_NAND, - GL_OR, - GL_NOR, - GL_XOR, - GL_EQUIV, - GL_AND_REVERSE, - GL_AND_INVERTED, - GL_OR_REVERSE, - GL_OR_INVERTED - }; - for (op = 0; op < ARRAY_SIZE(logicop_modes); ++op) { - subtest = test_logicop(logicop_modes[op]); - piglit_report_subtest_result(subtest, "%s", - piglit_get_gl_enum_name(logicop_modes[op])); - if (subtest == PIGLIT_FAIL) - result = PIGLIT_FAIL; + if (test_single == 0 || test_single == logicop_modes[op]) { + subtest = test_logicop(logicop_modes[op]); + piglit_report_subtest_result(subtest, "%s", + piglit_get_gl_enum_name(logicop_modes[op])); + if (subtest == PIGLIT_FAIL) + result = PIGLIT_FAIL; + } } return result; } + + +void +piglit_init(int argc, char **argv) +{ + srand(0); + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + + if (argc > 1) { + /* argv[1] may be one of the logic op modes, like "GL_XOR" */ + int i; + + for (i = 0; i < ARRAY_SIZE(logicop_modes); i++) { + const char * mode = + piglit_get_gl_enum_name(logicop_modes[i]); + if (strcmp(argv[1], mode) == 0) { + test_single = logicop_modes[i]; + break; + } + } + if (test_single == 0) { + printf("Invalid glLogicOp mode %s\n", argv[1]); + piglit_report_result(PIGLIT_SKIP); + } + } + +} -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 01/12] Port point sprite test from Glean to Piglit
The new test is also a bit stricter on rasterization then the old one. It shouldn't be stricter than the spec, however. --- tests/all.py | 1 + tests/spec/CMakeLists.txt | 1 + tests/spec/arb_point_sprite/CMakeLists.gl.txt | 14 ++ tests/spec/arb_point_sprite/CMakeLists.txt| 1 + tests/spec/arb_point_sprite/mipmap.c | 238 ++ 5 files changed, 255 insertions(+) create mode 100644 tests/spec/arb_point_sprite/CMakeLists.gl.txt create mode 100644 tests/spec/arb_point_sprite/CMakeLists.txt create mode 100644 tests/spec/arb_point_sprite/mipmap.c diff --git a/tests/all.py b/tests/all.py index ae4a995..56f6b40 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1754,6 +1754,7 @@ with profile.test_list.group_manager( with profile.test_list.group_manager( PiglitGLTest, grouptools.join('spec', 'ARB_point_sprite')) as g: g(['point-sprite'], run_concurrent=False) +g(['arb_point_sprite-mipmap']) # Group ARB_tessellation_shader with profile.test_list.group_manager( diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index d196d6b..f02c98d 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory (arb_multisample) add_subdirectory (arb_occlusion_query) add_subdirectory (arb_occlusion_query2) add_subdirectory (arb_point_parameters) +add_subdirectory (arb_point_sprite) add_subdirectory (arb_provoking_vertex) add_subdirectory (arb_robustness) add_subdirectory (arb_sample_shading) diff --git a/tests/spec/arb_point_sprite/CMakeLists.gl.txt b/tests/spec/arb_point_sprite/CMakeLists.gl.txt new file mode 100644 index 000..10a39c4 --- /dev/null +++ b/tests/spec/arb_point_sprite/CMakeLists.gl.txt @@ -0,0 +1,14 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} + ${piglit_SOURCE_DIR}/tests/util +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} +) + +piglit_add_executable (arb_point_sprite-mipmap mipmap.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_point_sprite/CMakeLists.txt b/tests/spec/arb_point_sprite/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_point_sprite/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_point_sprite/mipmap.c b/tests/spec/arb_point_sprite/mipmap.c new file mode 100644 index 000..0f6b3cb --- /dev/null +++ b/tests/spec/arb_point_sprite/mipmap.c @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2007 Intel Corporation + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file mipmap.c: Test the GL_ARB_point_sprite extension + * + * Create mipmap textures which size varies from 32x32 to 1x1, every texture + * has different two colors: the upper half is one color and the lower half is + * another color. + * Draw point and polygon which mode is GL_POINT, and check that the point is + * rendered correctly. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 14; + config.window_visual = PIGLIT_GL_VISUAL_RGBA; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +/* For the 1x1 LOD, only lower part (second color in the table) is used. */ +static const float tex_color[6][2][4] = { + {{1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}}, /* 32x32 */ + {{0.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0}}, /* 16x16 */ + {{1.0, 0.0, 1.0, 1.0}, {0.0, 1.0, 1.0, 1.0}}, /* 8x8 */ + {{1.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 0.0, 1.0}}, /* 4x4 */ + {{0.0, 1.0, 0.0, 1.0}, {0.0, 0.0, 1.0, 1.0}}, /* 2x2 */ + {{1.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 1.0, 1.0}}, /* 1x1 */ +}; + +static int +level(int point_size) +{ + /* Note: we use GL_NEAREST_MIPMAP_NEAREST for GL_TEXTURE_MIN
[Piglit] [PATCH 09/12] Port tex coord generation test from Glean to Piglit
Note that the Glean test used multiple vertex specification modes (immediate, vertex arrays, display lists, ...). This new test only uses one since the manner of vertex specification has no impact on the code path wrt texture coordinate generation in modern OpenGL implementations. Also this test draws and icosahedron instead of a sliced and stacked sphere. --- tests/all.py| 1 + tests/spec/gl-1.0/CMakeLists.gl.txt | 1 + tests/spec/gl-1.0/texgen.c | 321 3 files changed, 323 insertions(+) create mode 100644 tests/spec/gl-1.0/texgen.c diff --git a/tests/all.py b/tests/all.py index 9130844..a89efb0 100644 --- a/tests/all.py +++ b/tests/all.py @@ -876,6 +876,7 @@ with profile.test_list.group_manager( g(['gl-1.0-scissor-offscreen']) g(['gl-1.0-scissor-polygon']) g(['gl-1.0-scissor-stencil-clear']) +g(['gl-1.0-texgen']) with profile.test_list.group_manager( PiglitGLTest, diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt b/tests/spec/gl-1.0/CMakeLists.gl.txt index 4c282fc..9ec381f 100644 --- a/tests/spec/gl-1.0/CMakeLists.gl.txt +++ b/tests/spec/gl-1.0/CMakeLists.gl.txt @@ -41,5 +41,6 @@ piglit_add_executable (gl-1.0-scissor-stencil-clear scissor-stencil-clear.c) piglit_add_executable (gl-1.0-simple-readbuffer simple-readbuffer.c) piglit_add_executable (gl-1.0-spot-light spot-light.c) piglit_add_executable (gl-1.0-swapbuffers-behavior swapbuffers-behavior.c) +piglit_add_executable (gl-1.0-texgen texgen.c) # vim: ft=cmake: diff --git a/tests/spec/gl-1.0/texgen.c b/tests/spec/gl-1.0/texgen.c new file mode 100644 index 000..493d543 --- /dev/null +++ b/tests/spec/gl-1.0/texgen.c @@ -0,0 +1,321 @@ +/* + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file texgen.c: Basic test of GL texture coordinate generation. + * Author: Brian Sharp (br...@maniacal.org) December 2000 + * + * This test does a basic test of the glTexGen functions, including + * object_linear, eye_linear, and sphere_map. We draw an icosahedron + * and map a checkerboard texture onto it. + * We use an ortho projection to keep it simple. The result should be a 1:1 + * mapping of the check texture for all three modes (sphere map maps 1:1 + * because mapping it onto a sphere inverts the spheremap math). + * + * Note that accuracy issues might cause this test to fail if the + * texcoords near the center are a little warped; I've specifically tried + * to keep the matrices as "pure" as possible (no rotations) to + * keep the numerical precision high. So far it seems to work fine. + * Introducing a rotation by 90 degrees about the x axis resulted, + * on one driver, in a warping at the center of the sphere which caused + * the test to fail. + * + * For the second test of the three, we offset the texture by 0.5, + * so that each test's rendering is visually distinct from the + * previous. + * + * To test for pass/fail we examine the color buffer for green and blue, + * (the check colors) in the appropriate places. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + config.window_visual = PIGLIT_GL_VISUAL_RGB; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + config.window_width = 50; + config.window_height = 50; + +PIGLIT_GL_TEST_CONFIG_END + +/* Colors of checkerboard texture */ +static float green[] = {0, 1, 0, 1}; +static float blue[] = {0, 0, 1, 1}; + +static int num_vertices; +static int num_indices; +static float *vertices; +static float *normals; +static unsigned short *indices; + +static void +generate_sphere(float radius, int slices, int stacks) +{ + int v = 0, n = 0, i = 0; + /* Can't have a sphere of less than 2 slices or stacks. */ + assert(slices >= 2 && stacks >= 2); + + /* We have 2 verts for the top and bottom
[Piglit] [PATCH 12/12] Remove texture unit Glean test
--- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/ttexunits.cpp | 319 -- tests/glean/ttexunits.h | 75 -- 4 files changed, 396 deletions(-) delete mode 100644 tests/glean/ttexunits.cpp delete mode 100644 tests/glean/ttexunits.h diff --git a/tests/all.py b/tests/all.py index dec8d5a..bc49590 100644 --- a/tests/all.py +++ b/tests/all.py @@ -305,7 +305,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: g('shaderAPI') g('texCube') g('texture_srgb') -g('texUnits') g('vertArrayBGRA') g('vertattrib') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 16a0d46..dd50025 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -38,7 +38,6 @@ piglit_add_executable (glean tshaderapi.cpp ttexcube.cpp ttexture_srgb.cpp - ttexunits.cpp tvertarraybgra.cpp tvertattrib.cpp tvertprog1.cpp diff --git a/tests/glean/ttexunits.cpp b/tests/glean/ttexunits.cpp deleted file mode 100644 index 6cdcea5..000 --- a/tests/glean/ttexunits.cpp +++ /dev/null @@ -1,319 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 2008 VMware, Inc. All Rights Reserved. -// -// 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 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 ALLEN AKIN 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. -// -// END_COPYRIGHT - -// Test texture unit things -// We're generally just testing API-related things, not rendering. -// Brian Paul 31 Dec 2008 - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include "ttexunits.h" - - -namespace GLEAN { - -void -TexUnitsTest::reportFailure(const char *msg) const -{ - env->log << "FAILURE:\n"; - env->log << "\t" << msg << "\n"; -} - - -void -TexUnitsTest::reportFailure(const char *msg, GLint unit) const -{ - char s[100]; -#if defined(_MSC_VER) - _snprintf(s, sizeof(s), msg, unit); -#else - snprintf(s, sizeof(s), msg, unit); -#endif - env->log << "FAILURE:\n"; - env->log << "\t" << s << "\n"; -} - - -bool -TexUnitsTest::setup(void) -{ - // check that we have at least OpenGL 2.0 - if (GLUtils::getVersion() < 2.0) { - env->log << "OpenGL >= 2.0 not supported\n"; - return false; - } - - glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxCombinedUnits); - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxImageUnits); - glGetIntegerv(GL_MAX_TEXTURE_COORDS, &maxCoordUnits); - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &maxUnits); - - return true; -} - - -bool -TexUnitsTest::testLimits(void) -{ - if (maxImageUnits < maxUnits) { - reportFailure("GL_MAX_TEXTURE_IMAGE_UNITS < GL_MAX_TEXTURE_UNITS"); - return false; - } - if (maxCoordUnits < maxUnits) { - reportFailure("GL_MAX_TEXTURE_COORD_UNITS < GL_MAX_TEXTURE_UNITS"); - return false; - } - return true; -} - - -bool -TexUnitsTest::testActiveTexture(void) -{ - GLint i; - - // clear any error state - while (glGetError()) - ; - - // test glActiveTexture() - for (i = 0; i < maxCombinedUnits; i++) { - glActiveTexture(GL_TEXTURE0 + i); - if (glGetError()) { - reportFailure("glActiveTexture(GL_TEXTURE%d) failed", i); - return false; - } - - GLint unit; - glGetIntegerv(GL_ACTIVE_TEXTURE, &unit); - if (unit != GL_TEXTURE0 + i || glGetError()) { - reportFailure("glGetIntegerv(GL_ACTIVE_TEXTURE) failed"); - return false; - } - } - - // this should fail: - glActiveTexture(GL_TEXTURE0 + maxCombinedUnits); - if (glGetError() != GL_INVALID_ENUM) { - reportFailure("glActiveTexture(GL_TEXTURE%d) failed to generate an error", -maxCombinedUnits); - return false; - } - - - // test glClientActiveTexture() - for (i = 0; i < maxCoordUnits; i++) { - glClientActiveTexture(GL_TEXTURE0 + i); - if (glGetError()) { - reportFailure("glClientActiveTexture(GL_TEXTURE%
[Piglit] [PATCH 08/12] Remove texture env combine4 Glean test
--- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/ttexcombine4.cpp | 415 -- tests/glean/ttexcombine4.h| 88 - 4 files changed, 505 deletions(-) delete mode 100644 tests/glean/ttexcombine4.cpp delete mode 100644 tests/glean/ttexcombine4.h diff --git a/tests/all.py b/tests/all.py index 84ca8b2..9130844 100644 --- a/tests/all.py +++ b/tests/all.py @@ -305,7 +305,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: g('shaderAPI') g('texCube') g('texgen') -g('texCombine4') g('texture_srgb') g('texUnits') g('vertArrayBGRA') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index b91ed6e..569faaf 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -36,7 +36,6 @@ piglit_add_executable (glean tmultitest.cpp tpixelformats.cpp tshaderapi.cpp - ttexcombine4.cpp ttexcube.cpp ttexgen.cpp ttexture_srgb.cpp diff --git a/tests/glean/ttexcombine4.cpp b/tests/glean/ttexcombine4.cpp deleted file mode 100644 index ac2257f..000 --- a/tests/glean/ttexcombine4.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 2009 VMware, Inc. All Rights Reserved. -// -// 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 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 VMWARE 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. -// -// END_COPYRIGHT - - -// Test GL_NV_texture_env_combine4 -// Generate some random combiner state and colors, compute the expected -// color, then render with the combiner state and compare the results. -// Only one texture unit is tested and not all possible combiner terms -// are exercised. -// -// Brian Paul -// 23 Jan 2009 - - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include "ttexcombine4.h" - - -namespace GLEAN { - -TexCombine4Result::TexCombine4Result() -{ - pass = true; -} - - -// generate random combiner state -void -TexCombine4Test::generate_state(struct combine_state &state) -{ - int i; - - if (rand.next() > 0.5f) - state.CombineMode = GL_ADD; - else - state.CombineMode = GL_ADD_SIGNED_EXT; - - for (i = 0; i < 4; i++) { - int src = int(rand.next() * 4.0); - switch (src) { - case 0: - state.Source[i] = GL_ZERO; - break; - case 1: - state.Source[i] = GL_TEXTURE; - break; - case 2: - state.Source[i] = GL_CONSTANT_EXT; - break; - default: - state.Source[i] = GL_PRIMARY_COLOR_EXT; - break; - } - - if (rand.next() > 0.5f) { - state.OperandRGB[i] = GL_SRC_COLOR; - state.OperandA[i] = GL_SRC_ALPHA; - } - else { - state.OperandRGB[i] = GL_ONE_MINUS_SRC_COLOR; - state.OperandA[i] = GL_ONE_MINUS_SRC_ALPHA; - } - } - - state.PrimaryColor[0] = rand.next(); - state.PrimaryColor[1] = rand.next(); - state.PrimaryColor[2] = rand.next(); - state.PrimaryColor[3] = rand.next(); - - state.ConstantColor[0] = rand.next(); - state.ConstantColor[1] = rand.next(); - state.ConstantColor[2] = rand.next(); - state.ConstantColor[3] = rand.next(); - - state.TextureColor[0] = rand.next(); - state.TextureColor[1] = rand.next(); - state.TextureColor[2] = rand.next(); - state.TextureColor[3] = rand.next(); -} - - -// compute expected final color -void -TexCombine4Test::evaluate_state(const struct combine_state &state, - GLfloat result[4]) -{ - GLfloat arg[4][4]; - int i; - - // setup terms - for (i = 0; i < 4; i++)
[Piglit] [PATCH 03/12] Port texture env combine test from Glean to Piglit
--- tests/all.py |5 + tests/llvmpipe.py |1 + tests/quick.py |7 + tests/spec/CMakeLists.txt |1 + .../spec/ext_texture_env_combine/CMakeLists.gl.txt | 11 + tests/spec/ext_texture_env_combine/CMakeLists.txt |1 + tests/spec/ext_texture_env_combine/combine.c | 1245 7 files changed, 1271 insertions(+) create mode 100644 tests/spec/ext_texture_env_combine/CMakeLists.gl.txt create mode 100644 tests/spec/ext_texture_env_combine/CMakeLists.txt create mode 100644 tests/spec/ext_texture_env_combine/combine.c diff --git a/tests/all.py b/tests/all.py index 2408586..ce52dac 100644 --- a/tests/all.py +++ b/tests/all.py @@ -2768,6 +2768,11 @@ with profile.test_list.group_manager( with profile.test_list.group_manager( PiglitGLTest, +grouptools.join('spec', 'ext_texture_env_combine')) as g: +g(['ext_texture_env_combine-combine'], 'texture-env-combine') + +with profile.test_list.group_manager( +PiglitGLTest, grouptools.join('spec', 'arb_texture_env_crossbar')) as g: g(['crossbar'], run_concurrent=False) diff --git a/tests/llvmpipe.py b/tests/llvmpipe.py index 52168c4..93a4664 100644 --- a/tests/llvmpipe.py +++ b/tests/llvmpipe.py @@ -28,6 +28,7 @@ remove(join('glean', 'texCombine')) remove(join('spec', '!OpenGL 1.0', 'gl-1.0-blend-func')) remove(join('spec', '!OpenGL 1.1', 'streaming-texture-leak')) remove(join('spec', '!OpenGL 1.1', 'max-texture-size')) +remove(join('spec', 'ext_texture_env_combine', 'ext_texture_env_combine-combine')) if platform.system() != 'Windows': remove(join('glx', 'glx-multithread-shader-compile')) diff --git a/tests/quick.py b/tests/quick.py index c587357..5107d9f 100644 --- a/tests/quick.py +++ b/tests/quick.py @@ -63,6 +63,13 @@ with profile.test_list.group_manager( with profile.test_list.allow_reassignment: g(['arb_shader_image_size-builtin', '--quick'], 'builtin') +# Set the --quick flag on the texture env combine test +with profile.test_list.group_manager( +PiglitGLTest, +grouptools.join('spec', 'ext_texture_env_combine')) as g: +with profile.test_list.allow_reassignment: +g(['ext_texture_env_combine-combine', '--quick'], 'texture-env-combine') + # These take too long profile.filters.append(lambda n, _: '-explosion' not in n) profile.filters.append(FilterVsIn()) diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index f02c98d..44659d5 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -90,6 +90,7 @@ add_subdirectory (ext_memory_object) add_subdirectory (ext_packed_depth_stencil) add_subdirectory (ext_packed_float) add_subdirectory (ext_shader_samples_identical) +add_subdirectory (ext_texture_env_combine) add_subdirectory (ext_texture_swizzle) add_subdirectory (ext_timer_query) add_subdirectory (ext_transform_feedback) diff --git a/tests/spec/ext_texture_env_combine/CMakeLists.gl.txt b/tests/spec/ext_texture_env_combine/CMakeLists.gl.txt new file mode 100644 index 000..3f55442 --- /dev/null +++ b/tests/spec/ext_texture_env_combine/CMakeLists.gl.txt @@ -0,0 +1,11 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} +) + +piglit_add_executable (ext_texture_env_combine-combine combine.c) diff --git a/tests/spec/ext_texture_env_combine/CMakeLists.txt b/tests/spec/ext_texture_env_combine/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/ext_texture_env_combine/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/ext_texture_env_combine/combine.c b/tests/spec/ext_texture_env_combine/combine.c new file mode 100644 index 000..3436eb8 --- /dev/null +++ b/tests/spec/ext_texture_env_combine/combine.c @@ -0,0 +1,1245 @@ +/* + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN BE + * LIABLE FOR ANY CLAIM, DAMAGES OR
[Piglit] [PATCH 05/12] Port texture env test from Glean to Piglit
Note: 3 texture environment functions (modulate, decal and blend) were introduces with OpenGL 1.0. GL 1.1 and 1.3 added the replace and add functions, respectively. As this test tests all 5 functions it is classified as OpenGL 1.3. --- tests/all.py| 1 + tests/spec/gl-1.3/CMakeLists.gl.txt | 1 + tests/spec/gl-1.3/texture-env.c | 526 3 files changed, 528 insertions(+) create mode 100644 tests/spec/gl-1.3/texture-env.c diff --git a/tests/all.py b/tests/all.py index 3fd1153..3142ad2 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1037,6 +1037,7 @@ with profile.test_list.group_manager( grouptools.join('spec', '!opengl 1.3')) as g: g(['texunits']) g(['tex-border-1']) +g(['gl-1.3-texture-env']) g(['tex3d-depth1']) with profile.test_list.group_manager( diff --git a/tests/spec/gl-1.3/CMakeLists.gl.txt b/tests/spec/gl-1.3/CMakeLists.gl.txt index 607d2c1..8eaa94d 100644 --- a/tests/spec/gl-1.3/CMakeLists.gl.txt +++ b/tests/spec/gl-1.3/CMakeLists.gl.txt @@ -9,5 +9,6 @@ link_libraries ( ) piglit_add_executable (gl-1.3-alpha_to_coverage_nop alpha_to_coverage_nop.c) +piglit_add_executable (gl-1.3-texture-env texture-env.c) # vim: ft=cmake: diff --git a/tests/spec/gl-1.3/texture-env.c b/tests/spec/gl-1.3/texture-env.c new file mode 100644 index 000..7b43507 --- /dev/null +++ b/tests/spec/gl-1.3/texture-env.c @@ -0,0 +1,526 @@ +/* + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file tex-env.c: Test the basic texture env modes + * Author: Brian Paul (bri...@valinux.com) April 2001 + * + * Test procedure: + * Setup a texture with 81 columns of unique RGBA colors, 3 texels each. + * Draw a 81 uniquely-colored flat-shaded quads as wide horizontal bands, + * with the above texture. This makes a matrix of 81*81 colored squares + * for which we test that the current texture environment mode and texture + * format produced the correct color. + * Finally, we blend over a gray background in order to verify that the + * post-texture alpha value is correct. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 13; + config.window_visual = PIGLIT_GL_VISUAL_RGBA; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + config.window_width = 256; + config.window_height = 256; + +PIGLIT_GL_TEST_CONFIG_END + +#define BLEND_WITH_BACKGROUND 1 + +#define COLORS (3 * 3 * 3 * 3) + +static float colors[COLORS][4]; + +static float bg_color[4] = {0.5, 0.5, 0.5, 0.5}; + +static const GLenum format_enums[] = { + GL_ALPHA, + GL_LUMINANCE, + GL_LUMINANCE_ALPHA, + GL_INTENSITY, + GL_RGB, + GL_RGBA +}; + +static const GLenum env_mode_enums[] = { + GL_REPLACE, + GL_MODULATE, + GL_DECAL, + GL_BLEND, + GL_ADD +}; + +/* Compute expected texenv result given the texture env mode, the texture + * base format, texture color, fragment color, and texture env color. + * This also blends the result with the background color if that option + * is enabled (see above). */ +static void +compute_expected_color(GLenum env_mode, GLenum tex_format, + const float tex_color[4], const float frag_color[4], + const float env_color[4], float result[4]) +{ + switch (env_mode) { + case GL_REPLACE: + switch (tex_format) { + case GL_ALPHA: + result[0] = frag_color[0]; + result[1] = frag_color[1]; + result[2] = frag_color[2]; + result[3] = tex_color[3]; /* alpha */ + break; + case GL_LUMINANCE: + result[0] = tex_color[0]; /* lum */ + result[1] = tex_color[0]; +
[Piglit] [PATCH 02/12] Remove point sprite Glean test
Replaced by new piglit arb_point_sprite-mipmap test. --- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/tpointsprite.cpp | 454 -- tests/glean/tpointsprite.h| 74 --- 4 files changed, 530 deletions(-) delete mode 100644 tests/glean/tpointsprite.cpp delete mode 100644 tests/glean/tpointsprite.h diff --git a/tests/all.py b/tests/all.py index 56f6b40..2408586 100644 --- a/tests/all.py +++ b/tests/all.py @@ -300,7 +300,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: g('fbo') g('getString') g('pixelFormats') -g('pointSprite') # exactRGBA is not included intentionally, because it's too strict and # the equivalent functionality is covered by other tests g('shaderAPI') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 9bbf324..b082eec 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -35,7 +35,6 @@ piglit_add_executable (glean tglsl1.cpp tmultitest.cpp tpixelformats.cpp - tpointsprite.cpp tshaderapi.cpp ttexcombine.cpp ttexcombine4.cpp diff --git a/tests/glean/tpointsprite.cpp b/tests/glean/tpointsprite.cpp deleted file mode 100644 index 774c0cb..000 --- a/tests/glean/tpointsprite.cpp +++ /dev/null @@ -1,454 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- - -/* - * Copyright (C) 2007 Intel Corporation - * Copyright (C) 1999 Allen Akin All Rights Reserved. - * - * 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 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 ALLEN AKIN 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. - * - */ - -/* tpointsprite.cpp: Test the ARB_point_sprite extension - * Author: Nian Wu - * - * Test procedure: - * Create mipmap textures which size varies from 32x32 to 1x1, every texture - * has different two colors: the upper half is one color and the lower half - * is another color. - * Draw point and polygon which mode is GL_POINT, and check that the point - * is rendered correctly. - */ - -#define GL_GLEXT_PROTOTYPES - -#include -#include -#include -#include -#include "tpointsprite.h" - - -namespace GLEAN { - -//background color -static GLfloat bgColor[4] = {0.0, 0.0, 0.0, 0.0}; - -// Partition each mipmap into two halves. The top half gets one color, and -// the bottom half gets a different color. Use a different pair of colors for -// each LOD. -// -// For the 1x1 LOD, only lower part (second color in the table) is used. -static GLfloat texColor[6][2][4] = { - {{1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}}, // 32x32 - {{0.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0}}, // 16x16 - {{1.0, 0.0, 1.0, 1.0}, {0.0, 1.0, 1.0, 1.0}}, // 8x8 - {{1.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 0.0, 1.0}}, // 4x4 - {{0.0, 1.0, 0.0, 1.0}, {0.0, 0.0, 1.0, 1.0}}, // 2x2 - {{1.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 1.0, 1.0}}, // 1x1 -}; - -//generate mipmap -void -PointSpriteTest::GenMipmap() -{ - int level, i, j; - GLint texWidth; - GLfloat *texPtr; - GLfloat *upperColor, *lowColor; - - for (level = 0; level < 6; level++) - { - texWidth = 1 << (6 - level - 1); - texImages[level] = (GLfloat *)malloc(texWidth * texWidth * 4 * sizeof(GLfloat)); - texPtr = texImages[level]; - upperColor = texColor[level][0]; - lowColor = texColor[level][1]; - - for (i = 0; i < texWidth; i++) - { - for (j = 0; j < texWidth; j++) - { - if (i < texWidth / 2) //lower part - { - *texPtr++ = lowColor[0]; - *texPtr++ = lowColor[1]; - *texPtr++ = lowColor[2]; - *texPtr++ = lowColor[3]; -
[Piglit] [PATCH 04/12] Remove texture env combine Glean test
Replaced by new piglit ext_texture_env_combine-combine test. --- tests/all.py |1 - tests/glean/CMakeLists.gl.txt |1 - tests/glean/ttexcombine.cpp | 1715 - tests/glean/ttexcombine.h | 137 tests/llvmpipe.py |1 - 5 files changed, 1855 deletions(-) delete mode 100644 tests/glean/ttexcombine.cpp delete mode 100644 tests/glean/ttexcombine.h diff --git a/tests/all.py b/tests/all.py index ce52dac..3fd1153 100644 --- a/tests/all.py +++ b/tests/all.py @@ -303,7 +303,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: # exactRGBA is not included intentionally, because it's too strict and # the equivalent functionality is covered by other tests g('shaderAPI') -g('texCombine') g('texCube') g('texEnv') g('texgen') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index b082eec..42bcada 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -36,7 +36,6 @@ piglit_add_executable (glean tmultitest.cpp tpixelformats.cpp tshaderapi.cpp - ttexcombine.cpp ttexcombine4.cpp ttexcube.cpp ttexenv.cpp diff --git a/tests/glean/ttexcombine.cpp b/tests/glean/ttexcombine.cpp deleted file mode 100644 index 1a41c4d..000 --- a/tests/glean/ttexcombine.cpp +++ /dev/null @@ -1,1715 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 1999 Allen Akin All Rights Reserved. -// -// 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 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 ALLEN AKIN 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. -// -// END_COPYRIGHT - - -// ttexcombine.cpp: Test the GL_EXT_texture_env_combine extension -// Author: Brian Paul (bri...@valinux.com) September 2000 -// -// GL_EXT_texture_env_dot3 extension test -// Author: Gareth Hughes (gar...@valinux.com) January 2001 -// -// GL_ARB_texture_env_crossbar extension test -// Author: Brian Paul (br...@tungstengraphics.com) December 2002 -// -// The challenge with testing this extension is dealing with combinatorial -// explosion. There are 16 state variables in this extension: -// -// GL_COMBINE_RGB_EXT which has 5 possible values -// GL_COMBINE_ALPHA_EXT which has 5 possible values -// GL_SOURCE0_RGB_EXT which has 4 possible values -// GL_SOURCE1_RGB_EXT which has 4 possible values -// GL_SOURCE2_RGB_EXT which has 4 possible values -// GL_SOURCE0_ALPHA_EXT which has 4 possible values -// GL_SOURCE1_ALPHA_EXT which has 4 possible values -// GL_SOURCE2_ALPHA_EXT which has 4 possible values -// GL_OPERAND0_RGB_EXT which has 4 possible values -// GL_OPERAND1_RGB_EXT which has 4 possible values -// GL_OPERAND2_RGB_EXT which has 2 possible values -// GL_OPERAND0_ALPHA_EXT which has 2 possible values -// GL_OPERAND1_ALPHA_EXT which has 2 possible values -// GL_OPERAND2_ALPHA_EXT which has 1 possible value -// GL_RGB_SCALE_EXT which has 3 possible values -// GL_ALPHA_SCALE which has 3 possible values -// -// The product of those values is 117,964,800. And that's just for one -// texture unit! If we wanted to fully exercise N texture units we'd -// need to run 117,964,800 ^ N tests! Ideally we'd also like to test -// with a number of different fragment, texenv and texture colors. -// Clearly we can't test everything. -// -// So, we've partitioned the combination space into subsets defined -// by the ReplaceParams[], AddParams[], InterpolateParams[], etc arrays. -// For multitexture, we do an even more limited set of tests: testing -// all permutations of the 5 combine modes on all texture units. -// -// In the future we might look at programs that use the combine -// extension to see which mode combination are important to them and -// put them into this test. -// - -#include "ttexcombine.h" -#include -#include -#include - -#define CLAMP(VAL, MIN, MAX) \ - ((VAL) < (MIN) ? (MIN) : ((VAL) > (MAX) ? (MAX) : (VAL))) - -#define COPY4(DST, SRC)\ -{
[Piglit] [PATCH 11/12] Port texture unit test from Glean to Piglit
--- tests/all.py| 1 + tests/spec/gl-2.0/api/CMakeLists.gl.txt | 1 + tests/spec/gl-2.0/api/texture-units.c | 260 3 files changed, 262 insertions(+) create mode 100644 tests/spec/gl-2.0/api/texture-units.c diff --git a/tests/all.py b/tests/all.py index c8b02b7..dec8d5a 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1138,6 +1138,7 @@ with profile.test_list.group_manager( g(['gl-2.0-active-sampler-conflict']) g(['incomplete-cubemap', 'size'], 'incomplete-cubemap-size') g(['incomplete-cubemap', 'format'], 'incomplete-cubemap-format') +g(['gl-2.0-texture-units']) with profile.test_list.group_manager( PiglitGLTest, diff --git a/tests/spec/gl-2.0/api/CMakeLists.gl.txt b/tests/spec/gl-2.0/api/CMakeLists.gl.txt index fe59747..b4481d9 100644 --- a/tests/spec/gl-2.0/api/CMakeLists.gl.txt +++ b/tests/spec/gl-2.0/api/CMakeLists.gl.txt @@ -12,5 +12,6 @@ piglit_add_executable (gl-2.0-active-sampler-conflict active-sampler-conflict.c) piglit_add_executable (attrib-assignments attrib-assignments.c) piglit_add_executable (getattriblocation-conventional getattriblocation-conventional.c) piglit_add_executable (clip-flag-behavior clip-flag-behavior.c) +piglit_add_executable (gl-2.0-texture-units texture-units.c) # vim: ft=cmake: diff --git a/tests/spec/gl-2.0/api/texture-units.c b/tests/spec/gl-2.0/api/texture-units.c new file mode 100644 index 000..2deb056 --- /dev/null +++ b/tests/spec/gl-2.0/api/texture-units.c @@ -0,0 +1,260 @@ +/* + * Copyright (C) 2008 VMware, Inc. All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file texture-unit.c: Test texture unit things + * Author: Brian Paul 31 Dec 2008 + * + * We're generally just testing API-related things, not rendering. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 20; + config.window_visual = PIGLIT_GL_VISUAL_RGB; + config.khr_no_error_support = PIGLIT_HAS_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +static int max_combined_units; +static int max_image_units; +static int max_coord_units; +static int max_units; + +static void +setup(void) +{ + glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, + &max_combined_units); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_image_units); + glGetIntegerv(GL_MAX_TEXTURE_COORDS, &max_coord_units); + glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_units); +} + +static bool +test_limits(void) +{ + if (max_image_units < max_units) { + printf("GL_MAX_TEXTURE_IMAGE_UNITS < GL_MAX_TEXTURE_UNITS"); + return false; + } + if (max_coord_units < max_units) { + printf("GL_MAX_TEXTURE_COORD_UNITS < GL_MAX_TEXTURE_UNITS"); + return false; + } + return true; +} + +static bool +test_active_texture(void) +{ + /* test glActiveTexture() */ + for (int i = 0; i < max_combined_units; i++) { + glActiveTexture(GL_TEXTURE0 + i); + if (!piglit_check_gl_error(GL_NO_ERROR)) { + printf("glActiveTexture(GL_TEXTURE%d) failed", i); + return false; + } + + int unit; + glGetIntegerv(GL_ACTIVE_TEXTURE, &unit); + if (!piglit_check_gl_error(GL_NO_ERROR) || + unit != GL_TEXTURE0 + i) { + printf("glGetIntegerv(GL_ACTIVE_TEXTURE) failed"); + return false; + } + } + + /* this should fail: */ + glActiveTexture(GL_TEXTURE0 + max_combined_units); + if (!piglit_check_gl_error(GL_INVALID_ENUM)) { + printf("glActiveTexture(GL_TEXTURE%d) failed to generate an " + "error", max_combined_units); + return false; + } + + +
[Piglit] [PATCH 07/12] Port texture env combine4 test from Glean to Piglit
The custom rolled random number generation was replaced by one from stdlib. --- tests/all.py | 5 + tests/spec/CMakeLists.txt | 1 + .../spec/nv_texture_env_combine4/CMakeLists.gl.txt | 13 ++ tests/spec/nv_texture_env_combine4/CMakeLists.txt | 1 + tests/spec/nv_texture_env_combine4/combine.c | 256 + 5 files changed, 276 insertions(+) create mode 100644 tests/spec/nv_texture_env_combine4/CMakeLists.gl.txt create mode 100644 tests/spec/nv_texture_env_combine4/CMakeLists.txt create mode 100644 tests/spec/nv_texture_env_combine4/combine.c diff --git a/tests/all.py b/tests/all.py index 4ec6596..84ca8b2 100644 --- a/tests/all.py +++ b/tests/all.py @@ -3909,6 +3909,11 @@ with profile.test_list.group_manager( with profile.test_list.group_manager( PiglitGLTest, +grouptools.join('spec', 'nv_texture_env_combine4')) as g: +g(['nv_texture_env_combine4-combine']) + +with profile.test_list.group_manager( +PiglitGLTest, grouptools.join('spec', 'nv_conditional_render')) as g: g(['nv_conditional_render-begin-while-active'], 'begin-while-active') g(['nv_conditional_render-begin-zero'], 'begin-zero') diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 44659d5..99fa95f 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -98,6 +98,7 @@ add_subdirectory (nv_conditional_render) add_subdirectory (nv_fill_rectangle) add_subdirectory (nv_image_formats) add_subdirectory (nv_texture_barrier) +add_subdirectory (nv_texture_env_combine4) add_subdirectory (oes_compressed_etc1_rgb8_texture) add_subdirectory (oes_compressed_paletted_texture) add_subdirectory (oes_required_internalformat) diff --git a/tests/spec/nv_texture_env_combine4/CMakeLists.gl.txt b/tests/spec/nv_texture_env_combine4/CMakeLists.gl.txt new file mode 100644 index 000..d5ab5b2 --- /dev/null +++ b/tests/spec/nv_texture_env_combine4/CMakeLists.gl.txt @@ -0,0 +1,13 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} +) + +piglit_add_executable (nv_texture_env_combine4-combine combine.c) + +# vim: ft=cmake: diff --git a/tests/spec/nv_texture_env_combine4/CMakeLists.txt b/tests/spec/nv_texture_env_combine4/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/nv_texture_env_combine4/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/nv_texture_env_combine4/combine.c b/tests/spec/nv_texture_env_combine4/combine.c new file mode 100644 index 000..b76ce98 --- /dev/null +++ b/tests/spec/nv_texture_env_combine4/combine.c @@ -0,0 +1,256 @@ +/* + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file combine.c: Test GL_NV_texture_env_combine4 + * Author: Brian Paul (bri...@valinux.com) Januar 2009 + * + * Generate some random combiner state and colors, compute the expected + * color, then render with the combiner state and compare the results. + * Only one texture unit is tested and not all possible combiner terms + * are exercised. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 13; + config.window_visual = PIGLIT_GL_VISUAL_RGB; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +#ifdef _WIN32 +#define SRAND(x) srand(x) +#define DRAND() ((float)rand() / RAND_MAX) +#else +#define SRAND(x) srand48(x) +#define DRAND() drand48() +#endif + +#define NUM_TESTS 200 + +struct combine_state { + GLenum combine_mode; + GLenum source[4]; + GLenum operand_rgb[4]; + GLenum operand_a[4]; + float primary_color[4]; + float constant_color[4]; + float texture_co
[Piglit] [PATCH 06/12] Remove texture environment Glean test
--- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/ttexenv.cpp | 674 -- tests/glean/ttexenv.h | 69 - 4 files changed, 745 deletions(-) delete mode 100644 tests/glean/ttexenv.cpp delete mode 100644 tests/glean/ttexenv.h diff --git a/tests/all.py b/tests/all.py index 3142ad2..4ec6596 100644 --- a/tests/all.py +++ b/tests/all.py @@ -304,7 +304,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: # the equivalent functionality is covered by other tests g('shaderAPI') g('texCube') -g('texEnv') g('texgen') g('texCombine4') g('texture_srgb') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 42bcada..b91ed6e 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -38,7 +38,6 @@ piglit_add_executable (glean tshaderapi.cpp ttexcombine4.cpp ttexcube.cpp - ttexenv.cpp ttexgen.cpp ttexture_srgb.cpp ttexunits.cpp diff --git a/tests/glean/ttexenv.cpp b/tests/glean/ttexenv.cpp deleted file mode 100644 index d9f16a5..000 --- a/tests/glean/ttexenv.cpp +++ /dev/null @@ -1,674 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 1999 Allen Akin All Rights Reserved. -// -// 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 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 ALLEN AKIN 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. -// -// END_COPYRIGHT - - -// ttexenv.cpp: Test the basic texture env modes -// Author: Brian Paul (bri...@valinux.com) April 2001 -// -// Test procedure: -// Setup a texture with 81 columns of unique RGBA colors, 3 texels each. -// Draw a 81 uniquely-colored flat-shaded quads as wide horizontal bands, -// with the above texture. This makes a matrix of 81*81 colored squares -// for which we test that the current texture environment mode and texture -// format produced the correct color. -// Finally, we blend over a gray background in order to verify that the -// post-texture alpha value is correct. -// - -#include -#include -#include -#include -#include -#include "ttexenv.h" - - -namespace GLEAN { - - -// If this is true, we enable blending over a gray background in order -// to test the alpha results of the texture env. If this is false, -// we don't blend. It might be useful to disable blending in order to -// diagnose failures -#define BLEND_WITH_BACKGROUND 1 - -static GLfloat BgColor[4] = { 0.5, 0.5, 0.5, 0.5 }; - - -static const GLenum FormatEnums[] = { - GL_ALPHA, - GL_LUMINANCE, - GL_LUMINANCE_ALPHA, - GL_INTENSITY, - GL_RGB, - GL_RGBA -}; - -static const char *FormatNames[] = { - "GL_ALPHA", - "GL_LUMINANCE", - "GL_LUMINANCE_ALPHA", - "GL_INTENSITY", - "GL_RGB", - "GL_RGBA" -}; - -static const GLenum EnvModeEnums[] = { - GL_REPLACE, - GL_MODULATE, - GL_DECAL, - GL_BLEND, - GL_ADD -}; - -static const char *EnvModeNames[] = { - "GL_REPLACE", - "GL_MODULATE", - "GL_DECAL", - "GL_BLEND", - "GL_ADD" -}; - - -// -// Test if two colors are close enough to be considered the same -// -bool -TexEnvTest::TestColor(const GLfloat c1[3], const GLfloat c2[3]) { - if (fabs(c1[0] - c2[0]) <= mTolerance[0] && - fabs(c1[1] - c2[1]) <= mTolerance[1] && - fabs(c1[2] - c2[2]) <= mTolerance[2]) - return true; - else - return false; -} - -// -// Compute expected texenv result given the texture env mode, the texture -// base format, texture color, fragment color, and texture env color. -// This also blends the result with the background color if that option -// is enabled (see above). -// -void -TexEnvTest::ComputeExpectedColor(GLenum envMode, GLenum texFormat, - const GLfloat texColor[4], const GLfloat fragColor[4], - const GLfloat envColor[4], GLfloat result[4]) { - - switch (envMode) { -
[Piglit] [PATCH 10/12] Remove text coord generation Glean test
--- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/ttexgen.cpp | 376 -- tests/glean/ttexgen.h | 67 4 files changed, 445 deletions(-) delete mode 100644 tests/glean/ttexgen.cpp delete mode 100644 tests/glean/ttexgen.h diff --git a/tests/all.py b/tests/all.py index a89efb0..c8b02b7 100644 --- a/tests/all.py +++ b/tests/all.py @@ -304,7 +304,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: # the equivalent functionality is covered by other tests g('shaderAPI') g('texCube') -g('texgen') g('texture_srgb') g('texUnits') g('vertArrayBGRA') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 569faaf..16a0d46 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -37,7 +37,6 @@ piglit_add_executable (glean tpixelformats.cpp tshaderapi.cpp ttexcube.cpp - ttexgen.cpp ttexture_srgb.cpp ttexunits.cpp tvertarraybgra.cpp diff --git a/tests/glean/ttexgen.cpp b/tests/glean/ttexgen.cpp deleted file mode 100644 index f44cb9a..000 --- a/tests/glean/ttexgen.cpp +++ /dev/null @@ -1,376 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 1999 Allen Akin All Rights Reserved. -// -// 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 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 ALLEN AKIN 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. -// -// END_COPYRIGHT - - -// ttexgen.cpp: Basic test of GL texture coordinate generation. -// This test does a basic test of the glTexGen functions, including -// object_linear, eye_linear, and sphere_map. We use the Sphere3D with -// a GeomRenderer to draw a sphere, and map a check texture onto it. We -// use an ortho projection to keep it simple. The result should be a 1:1 -// mapping of the check texture for all three modes (sphere map maps 1:1 -// because mapping it onto a sphere inverts the spheremap math). -// -// Note that accuracy issues might cause this test to fail if the -// texcoords near the center are a little warped; I've specifically tried -// to keep the matrices as "pure" as possible (no rotations) to -// keep the numerical precision high. So far it seems to work fine. -// Introducing a rotation by 90 degrees about the x axis resulted, -// on one driver, in a warping at the center of the sphere which caused -// the test to fail. -// -// For the second test of the three, we offset the texture by 0.5, -// so that each test's rendering is visually distinct from the -// previous. -// -// To test for pass/fail we examine the color buffer for red and blue, -// (the check colors) in the appropriate places. -// -// Author: Brian Sharp (br...@maniacal.org) December 2000 - -#include "ttexgen.h" -#include -#include "geomutil.h" - - -const GLuint viewSize=50; - - -namespace GLEAN { - -void -TexgenTest::FailMessage(BasicResult &r, const std::string& texgenMode, - GeomRenderer::DrawMethod method, bool arraysCompiled, - int retainedMode, - const std::string& colorMismatch) const { - env->log << name << ": FAIL " - << r.config->conciseDescription() << '\n'; - env->log << "\t" << "during mode " << texgenMode << ", "; -switch(method) -{ -case GeomRenderer::GLVERTEX_MODE: env->log << "glVertex-style rendering, "; break; -case GeomRenderer::GLARRAYELEMENT_MODE: env->log << "glArrayElement-style rendering, "; break; -case GeomRenderer::GLDRAWELEMENTS_MODE: env->log << "glDrawElements-style rendering, "; break; -case GeomRenderer::GLDRAWARRAYS_MODE: env->log << "glDrawArrays-style rendering, "; break; -} -if (arraysCompiled) env->log << "arrays locked, "; -else env->log << "arrays not locked, "; - -if (retainedMode) env->log << "built into a display list, "; -else env->log << "called immediately (not display listed), "; - -env->log
Re: [Piglit] [PATCH] cmake: also install Windows manifest files
On 09/11/17 20:51, Brian Paul wrote: The previous patch (5087aa3f1020d0 "cmake: create Win10 manifest files for particular executables") didn't copy the manifest files when doing 'make install'. This fixes that. It requires CMake 3.0 or later. Thanks to Brad King for helping out! --- cmake/piglit_util.cmake | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake index 9b85761..918ea84 100644 --- a/cmake/piglit_util.cmake +++ b/cmake/piglit_util.cmake @@ -114,8 +114,11 @@ function(piglit_create_manifest_file target) # the manifest file, but I've been unsuccessful in getting # that to work. file(GENERATE -OUTPUT bin/${target}.exe.manifest +OUTPUT $.manifest INPUT ${CMAKE_SOURCE_DIR}/cmake/win10-manifest.txt) + + install(FILES $.manifest + DESTINATION ${PIGLIT_INSTALL_LIBDIR}/bin) endif() endif() endfunction(piglit_create_manifest_file) Looks great! Reviewed-by: Jose Fonseca ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] util: remove -compat from arguments so as not to confuse tests
From: Marek Olšák --- tests/util/piglit-framework-gl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 29e0e3a..22aadc5 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned *force_samples, } } else if (!strcmp(argv[j], "-compat")) { if (config->supports_gl_es_version) { fprintf(stderr, "-compat isn't allowed with ES tests!\n"); piglit_report_result(PIGLIT_FAIL); } config->supports_gl_compat_version = 10; config->supports_gl_core_version = 0; puts("The compatibility profile forced."); + delete_arg(argv, *argc, j--); + *argc -= 1; } } } void piglit_gl_process_args(int *argc, char *argv[], struct piglit_gl_test_config *config) { unsigned force_samples = 0; -- 2.7.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] arb_enhanced_layouts: add test for location aliasing with non-numerical type
On 09/11/17 18:52, Iago Toral wrote: This is not so much based on the spec but based on the original code we had in the linker (which we still have) which assumes that all locations consumed by a struct variable use up all 4 components (thus preventing any kind of aliasing to be successful) based on the fact that the component layout qualifier can't be used on structs (or its members): if (type->without_array()->is_record()) { /* The component qualifier can't be used on structs so just treat * all component slots as used. */ last_comp = 4; } else { ... } However, thinking a bit more about it, it is not 100% clear that this assumption is correct and maybe we should be doing the same for structs that I did for interface blocks members and check the actual components used by each field member and only produce link errors if there is actual component aliasing. Yeah I wrote that code but looking at it now I'm not sure if its correct. The problem with structs is nesting, it could get very complicated trying to figure out packing with a struct. Let's drop this patch for now. Iago On Thu, 2017-11-09 at 12:43 +1100, Timothy Arceri wrote: On 06/11/17 23:22, Iago Toral Quiroga wrote: This is not allowed so we check that we produce a linker error. It's not 100% obvious why this wouldn't be allowed. Can we have a spec quote added to the test header? --- .../vs-to-fs-type-not-numerical.shader_test| 52 ++ 1 file changed, 52 insertions(+) create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs- type-not-numerical.shader_test diff --git a/tests/spec/arb_enhanced_layouts/linker/component- layout/vs-to-fs-type-not-numerical.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs- type-not-numerical.shader_test new file mode 100644 index 0..aede6ce8d --- /dev/null +++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs- to-fs-type-not-numerical.shader_test @@ -0,0 +1,52 @@ +# Test for link error between vertex and fragment shaders when +# component qualifiers don't match. This case checks that +# location aliasing is not permitted for non-numerical types +# such as a struct + +[require] +GLSL >= 3.30 +GL_ARB_enhanced_layouts +GL_ARB_separate_shader_objects + +[vertex shader] +#version 330 +#extension GL_ARB_enhanced_layouts: require +#extension GL_ARB_separate_shader_objects: require + +struct S { + vec3 foo; + vec4 bar; +}; + +layout(location = 0, component = 3) out float b; +layout(location = 0) out S a; + +void main() +{ + a.foo = vec3(1.0); + a.bar = vec4(1.0); + b = 0.5; +} + +[fragment shader] +#version 330 +#extension GL_ARB_enhanced_layouts: require +#extension GL_ARB_separate_shader_objects: require + +struct S { + vec3 foo; + vec4 bar; +}; + +layout(location = 0, component = 3) in float b; +layout(location = 0) in S a; + +out vec4 color; + +void main() +{ + color = vec4(a.foo + a.bar.xyz, b); +} + +[test] +link error ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] util: remove -compat from arguments so as not to confuse tests
On Thu, Nov 9, 2017 at 11:55 PM, Brian Paul wrote: > On 11/09/2017 03:49 PM, Marek Olšák wrote: >> >> From: Marek Olšák >> >> --- >> tests/util/piglit-framework-gl.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/tests/util/piglit-framework-gl.c >> b/tests/util/piglit-framework-gl.c >> index 29e0e3a..22aadc5 100644 >> --- a/tests/util/piglit-framework-gl.c >> +++ b/tests/util/piglit-framework-gl.c >> @@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned >> *force_samples, >> } >> } else if (!strcmp(argv[j], "-compat")) { >> if (config->supports_gl_es_version) { >> fprintf(stderr, >> "-compat isn't allowed with ES >> tests!\n"); >> piglit_report_result(PIGLIT_FAIL); >> } >> config->supports_gl_compat_version = 10; >> config->supports_gl_core_version = 0; >> puts("The compatibility profile forced."); >> + delete_arg(argv, *argc, j--); >> + *argc -= 1; >> } >> } >> } >> >> void >> piglit_gl_process_args(int *argc, char *argv[], >>struct piglit_gl_test_config *config) >> { >> unsigned force_samples = 0; >> >> > > Reviewed-by: Brian Paul > > IMO, the delete_arg() function should take care of decrementing argc. Want > to do that too? Not planning to. I don't remember what the other delete_arg call sites expect. Marek ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 01/12] Port point sprite test from Glean to Piglit
On 11/09/2017 02:27 PM, Fabian Bieler wrote: The new test is also a bit stricter on rasterization then the old one. It shouldn't be stricter than the spec, however. --- tests/all.py | 1 + tests/spec/CMakeLists.txt | 1 + tests/spec/arb_point_sprite/CMakeLists.gl.txt | 14 ++ tests/spec/arb_point_sprite/CMakeLists.txt| 1 + tests/spec/arb_point_sprite/mipmap.c | 238 ++ 5 files changed, 255 insertions(+) create mode 100644 tests/spec/arb_point_sprite/CMakeLists.gl.txt create mode 100644 tests/spec/arb_point_sprite/CMakeLists.txt create mode 100644 tests/spec/arb_point_sprite/mipmap.c diff --git a/tests/all.py b/tests/all.py index ae4a995..56f6b40 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1754,6 +1754,7 @@ with profile.test_list.group_manager( with profile.test_list.group_manager( PiglitGLTest, grouptools.join('spec', 'ARB_point_sprite')) as g: g(['point-sprite'], run_concurrent=False) +g(['arb_point_sprite-mipmap']) # Group ARB_tessellation_shader with profile.test_list.group_manager( diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index d196d6b..f02c98d 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -42,6 +42,7 @@ add_subdirectory (arb_multisample) add_subdirectory (arb_occlusion_query) add_subdirectory (arb_occlusion_query2) add_subdirectory (arb_point_parameters) +add_subdirectory (arb_point_sprite) add_subdirectory (arb_provoking_vertex) add_subdirectory (arb_robustness) add_subdirectory (arb_sample_shading) diff --git a/tests/spec/arb_point_sprite/CMakeLists.gl.txt b/tests/spec/arb_point_sprite/CMakeLists.gl.txt new file mode 100644 index 000..10a39c4 --- /dev/null +++ b/tests/spec/arb_point_sprite/CMakeLists.gl.txt @@ -0,0 +1,14 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} + ${piglit_SOURCE_DIR}/tests/util +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} +) + +piglit_add_executable (arb_point_sprite-mipmap mipmap.c) + +# vim: ft=cmake: diff --git a/tests/spec/arb_point_sprite/CMakeLists.txt b/tests/spec/arb_point_sprite/CMakeLists.txt new file mode 100644 index 000..144a306 --- /dev/null +++ b/tests/spec/arb_point_sprite/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/spec/arb_point_sprite/mipmap.c b/tests/spec/arb_point_sprite/mipmap.c new file mode 100644 index 000..0f6b3cb --- /dev/null +++ b/tests/spec/arb_point_sprite/mipmap.c @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2007 Intel Corporation + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + * + */ + +/** + * @file mipmap.c: Test the GL_ARB_point_sprite extension + * + * Create mipmap textures which size varies from 32x32 to 1x1, every texture + * has different two colors: the upper half is one color and the lower half is + * another color. + * Draw point and polygon which mode is GL_POINT, and check that the point is + * rendered correctly. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 14; + config.window_visual = PIGLIT_GL_VISUAL_RGBA; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +/* For the 1x1 LOD, only lower part (second color in the table) is used. */ +static const float tex_color[6][2][4] = { + {{1.0, 0.0, 0.0, 1.0}, {0.0, 1.0, 0.0, 1.0}}, /* 32x32 */ + {{0.0, 0.0, 1.0, 1.0}, {1.0, 1.0, 0.0, 1.0}}, /* 16x16 */ + {{1.0, 0.0, 1.0, 1.0}, {0.0, 1.0, 1.0, 1.0}}, /* 8x8 */ + {{1.0, 1.0, 1.0, 1.0}, {1.0, 0.0, 0.0, 1.0}}, /* 4x4 */ + {{0.0, 1.0, 0.0, 1.0}, {0.0, 0.0, 1.0, 1.0}}, /* 2x2 */ + {{1.0, 1.0, 0.0, 1.0}, {1.0, 1.0, 1.0, 1.0}}, /* 1x1 */ +}; + +static int +level(int point_size) +{ +
Re: [Piglit] [PATCH 10/12] Remove text coord generation Glean test
In subject line: s/text/texture/ -Brian On 11/09/2017 02:27 PM, Fabian Bieler wrote: --- tests/all.py | 1 - tests/glean/CMakeLists.gl.txt | 1 - tests/glean/ttexgen.cpp | 376 -- tests/glean/ttexgen.h | 67 4 files changed, 445 deletions(-) delete mode 100644 tests/glean/ttexgen.cpp delete mode 100644 tests/glean/ttexgen.h diff --git a/tests/all.py b/tests/all.py index a89efb0..c8b02b7 100644 --- a/tests/all.py +++ b/tests/all.py @@ -304,7 +304,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as g: # the equivalent functionality is covered by other tests g('shaderAPI') g('texCube') -g('texgen') g('texture_srgb') g('texUnits') g('vertArrayBGRA') diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt index 569faaf..16a0d46 100644 --- a/tests/glean/CMakeLists.gl.txt +++ b/tests/glean/CMakeLists.gl.txt @@ -37,7 +37,6 @@ piglit_add_executable (glean tpixelformats.cpp tshaderapi.cpp ttexcube.cpp - ttexgen.cpp ttexture_srgb.cpp ttexunits.cpp tvertarraybgra.cpp diff --git a/tests/glean/ttexgen.cpp b/tests/glean/ttexgen.cpp deleted file mode 100644 index f44cb9a..000 --- a/tests/glean/ttexgen.cpp +++ /dev/null @@ -1,376 +0,0 @@ -// BEGIN_COPYRIGHT -*- glean -*- -// -// Copyright (C) 1999 Allen Akin All Rights Reserved. -// -// 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 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 ALLEN AKIN 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. -// -// END_COPYRIGHT - - -// ttexgen.cpp: Basic test of GL texture coordinate generation. -// This test does a basic test of the glTexGen functions, including -// object_linear, eye_linear, and sphere_map. We use the Sphere3D with -// a GeomRenderer to draw a sphere, and map a check texture onto it. We -// use an ortho projection to keep it simple. The result should be a 1:1 -// mapping of the check texture for all three modes (sphere map maps 1:1 -// because mapping it onto a sphere inverts the spheremap math). -// -// Note that accuracy issues might cause this test to fail if the -// texcoords near the center are a little warped; I've specifically tried -// to keep the matrices as "pure" as possible (no rotations) to -// keep the numerical precision high. So far it seems to work fine. -// Introducing a rotation by 90 degrees about the x axis resulted, -// on one driver, in a warping at the center of the sphere which caused -// the test to fail. -// -// For the second test of the three, we offset the texture by 0.5, -// so that each test's rendering is visually distinct from the -// previous. -// -// To test for pass/fail we examine the color buffer for red and blue, -// (the check colors) in the appropriate places. -// -// Author: Brian Sharp (br...@maniacal.org) December 2000 - -#include "ttexgen.h" -#include -#include "geomutil.h" - - -const GLuint viewSize=50; - - -namespace GLEAN { - -void -TexgenTest::FailMessage(BasicResult &r, const std::string& texgenMode, - GeomRenderer::DrawMethod method, bool arraysCompiled, - int retainedMode, - const std::string& colorMismatch) const { - env->log << name << ": FAIL " - << r.config->conciseDescription() << '\n'; - env->log << "\t" << "during mode " << texgenMode << ", "; -switch(method) -{ -case GeomRenderer::GLVERTEX_MODE: env->log << "glVertex-style rendering, "; break; -case GeomRenderer::GLARRAYELEMENT_MODE: env->log << "glArrayElement-style rendering, "; break; -case GeomRenderer::GLDRAWELEMENTS_MODE: env->log << "glDrawElements-style rendering, "; break; -case GeomRenderer::GLDRAWARRAYS_MODE: env->log << "glDrawArrays-style rendering, "; break; -} -if (arraysCompiled) env->log << "arrays locked, "; -else env->log << "arrays not locked, "; - -if (retainedMode) env->log << "built into a display l
Re: [Piglit] [PATCH] util: remove -compat from arguments so as not to confuse tests
On 11/09/2017 03:49 PM, Marek Olšák wrote: From: Marek Olšák --- tests/util/piglit-framework-gl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 29e0e3a..22aadc5 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned *force_samples, } } else if (!strcmp(argv[j], "-compat")) { if (config->supports_gl_es_version) { fprintf(stderr, "-compat isn't allowed with ES tests!\n"); piglit_report_result(PIGLIT_FAIL); } config->supports_gl_compat_version = 10; config->supports_gl_core_version = 0; puts("The compatibility profile forced."); + delete_arg(argv, *argc, j--); + *argc -= 1; } } } void piglit_gl_process_args(int *argc, char *argv[], struct piglit_gl_test_config *config) { unsigned force_samples = 0; Reviewed-by: Brian Paul IMO, the delete_arg() function should take care of decrementing argc. Want to do that too? -Brian ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 1/2] framework: fix wflinfo issues in opengl module
1. If the PIGLIT_PLATFORM string is 'mixed_glx_egl' we need to convert it to 'glx' so that wflinfo understands it. 2. Look in the piglit bin/ directory for the wflinfo.exe program. When we build piglit, we copy wflinfo.exe into the bin/ directory for packaging to avoid having to install waffle on target machines. If it's not found there, assume it's in our PATH just like before. v2: Pass env argument to subprocess.check_output() instead of using the find_wflinfo() function, per Dylan. --- framework/wflinfo.py | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/framework/wflinfo.py b/framework/wflinfo.py index b9a05f8..3849838 100644 --- a/framework/wflinfo.py +++ b/framework/wflinfo.py @@ -24,11 +24,13 @@ from __future__ import ( import errno import os import subprocess +import sys import six from framework import exceptions, core from framework.options import OPTIONS +from framework.test import piglit_test class StopWflinfo(exceptions.PiglitException): @@ -77,16 +79,34 @@ class WflInfo(object): """ with open(os.devnull, 'w') as d: try: -raw = subprocess.check_output( -['wflinfo', - '--platform', OPTIONS.env['PIGLIT_PLATFORM']] + opts, -stderr=d) +# Get the piglit platform string and, if needed, convert it +# to something that wflinfo understands. +platform = OPTIONS.env['PIGLIT_PLATFORM'] +if platform == "mixed_glx_egl": +platform = "glx" + +if sys.platform in ['windows', 'cygwin']: +bin = 'wflinfo.exe' +else: +bin = 'wflinfo' + +cmd = [bin, '--platform', platform] + opts + +# setup execution environment where we extend the PATH env var +# to include the piglit TEST_BIN_DIR +new_env = os.environ +new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR, +os.environ['PATH']]) + +raw = subprocess.check_output(cmd, env=new_env, stderr=d) + except subprocess.CalledProcessError: # When we hit this error it usually going to be because we have # an incompatible platform/profile combination raise StopWflinfo('Called') except OSError as e: # If we get a 'no wflinfo' warning then just return +print("wflinfo utility not found.") if e.errno == errno.ENOENT: raise StopWflinfo('OSError') raise @@ -122,8 +142,7 @@ class WflInfo(object): try: ret = self.__call_wflinfo(const + [var]) except StopWflinfo as e: -# This means tat the particular api or profile is -# unsupported +# This means the particular api or profile is unsupported if e.reason == 'Called': continue else: -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH 2/2] all.py: filter directories traversed to find shader tests
The script searches all files under tests/ and generated_tests/ for files ending in ".shader_test". For each match, a ShaderTest() object is created and added to the test list. For GL extensions or versions not supported by the driver, this is wasted effort. This patch looks for directories under spec/ and tries to determine if the extension/feature is actually supported by the current driver. If not, it's skipped. This somewhat reduces Piglit start up time, but substantially more time is spent in the ShaderTest() constructor which actually opens and parses each file to determine its GL/ES dependencies. I'll try to address that in the future. v2: - replace os.path.walk() with my own walk_dir_tree() which avoids decending into subdirs when the parent directory/feature is not supported. - Use env var to enable/disable shader directory filtering - Also, fix naming conventions and minor formatting issues. --- tests/all.py | 73 +++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/tests/all.py b/tests/all.py index ae4a995..93f66cf 100644 --- a/tests/all.py +++ b/tests/all.py @@ -8,12 +8,15 @@ import collections import itertools import os import platform +import re import six from six.moves import range from framework import grouptools +from framework.test import opengl from framework import options +from framework import wflinfo from framework.profile import TestProfile from framework.driver_classifier import DriverClassifier from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest, @@ -210,9 +213,77 @@ profile = TestProfile() # pylint: disable=invalid-name shader_tests = collections.defaultdict(list) +wfl_info = wflinfo.WflInfo() + + +def gl_extension_supported(ext_name): +"""Is the named OpenGL extension supported?""" +return ext_name in wfl_info.gl_extensions + +def is_feature_directory_supported(dir_name): +"""Determine if dir_name specifies an OpenGL feature (extension or GL +version) which is supported by the host. If we return False, it means +the extension/version is definitely not supported. If we return True, +it means the extension/version is possibly suppported. We're a little +fuzzy because we don't yet parse all the directory name possibilities +(like ES tests). +""" +if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}: +# The directory is a GL extension name, but of the format "arb_foo_bar" +# instead of "GL_ARB_foo_bar". We convert the former into the later +# and check if the extension is supported. +ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:] +return gl_extension_supported(ext_name) +elif re.match("gl-\d\.\d+", dir_name): +# The directory is a GL version +version = dir_name[3:] +return float(version) <= float(wfl_info.gl_version) +elif re.match("glsl-\d\.\d+", dir_name): +# The directory is a GLSL version +version = dir_name[5:] +return float(version) <= float(wfl_info.glsl_version) +else: +# The directory is something else. Don't skip it. +return True + + +def walk_filter_dir_tree(root): +"""Recursively walk the directory tree rooted at 'root'. +If we find a directory path of the form ".../spec/foo/" we'll check if +'foo' is a supported extension/feature/version. If not, we do not +traverse foo/. Otherwise, we add continue traversing. +The return value is a list of (dirpath, filename) tuples. +""" +curdir = os.path.split(root)[1] +files = [] +retval = [] + +for entry in os.listdir(root): +full_path = os.path.join(root, entry) +if os.path.isdir(full_path): +# Check if we're in a "spec/" direcotry +if curdir == "spec" and not is_feature_directory_supported(entry): +# The directory's tests aren't supported by the driver. +print("Skipping spec/{}".format(entry)) +else: +# recursively walk the subdirectory +retval += walk_filter_dir_tree(full_path) +elif os.path.isfile(full_path): +# Add the file to the files list +files += [entry] + +retval += [(root, None, files)] + +return retval + + # Find and add all shader tests. for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]: -for dirpath, _, filenames in os.walk(basedir): +if os.environ.get("PIGLIT_FILTER_DIRECTORIES"): +files = walk_filter_dir_tree(basedir) +else: +files = os.walk(basedir) +for dirpath, _, filenames in files: groupname = grouptools.from_path(os.path.relpath(dirpath, basedir)) for filename in filenames: testname, ext = os.path.splitext(filename) -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailm
Re: [Piglit] [PATCH 1/2] framework: fix wflinfo issues in opengl module
Quoting Brian Paul (2017-11-09 15:16:32) > 1. If the PIGLIT_PLATFORM string is 'mixed_glx_egl' we need to convert > it to 'glx' so that wflinfo understands it. > > 2. Look in the piglit bin/ directory for the wflinfo.exe program. > When we build piglit, we copy wflinfo.exe into the bin/ directory for > packaging to avoid having to install waffle on target machines. If > it's not found there, assume it's in our PATH just like before. > > v2: Pass env argument to subprocess.check_output() instead of using > the find_wflinfo() function, per Dylan. > --- > framework/wflinfo.py | 31 +-- > 1 file changed, 25 insertions(+), 6 deletions(-) > > diff --git a/framework/wflinfo.py b/framework/wflinfo.py > index b9a05f8..3849838 100644 > --- a/framework/wflinfo.py > +++ b/framework/wflinfo.py > @@ -24,11 +24,13 @@ from __future__ import ( > import errno > import os > import subprocess > +import sys > > import six > > from framework import exceptions, core > from framework.options import OPTIONS > +from framework.test import piglit_test > > > class StopWflinfo(exceptions.PiglitException): > @@ -77,16 +79,34 @@ class WflInfo(object): > """ > with open(os.devnull, 'w') as d: > try: > -raw = subprocess.check_output( > -['wflinfo', > - '--platform', OPTIONS.env['PIGLIT_PLATFORM']] + opts, > -stderr=d) > +# Get the piglit platform string and, if needed, convert it > +# to something that wflinfo understands. > +platform = OPTIONS.env['PIGLIT_PLATFORM'] > +if platform == "mixed_glx_egl": > +platform = "glx" > + > +if sys.platform in ['windows', 'cygwin']: > +bin = 'wflinfo.exe' > +else: > +bin = 'wflinfo' > + > +cmd = [bin, '--platform', platform] + opts > + > +# setup execution environment where we extend the PATH env > var > +# to include the piglit TEST_BIN_DIR > +new_env = os.environ > +new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR, > +os.environ['PATH']]) > + > +raw = subprocess.check_output(cmd, env=new_env, stderr=d) > + > except subprocess.CalledProcessError: > # When we hit this error it usually going to be because we > have > # an incompatible platform/profile combination > raise StopWflinfo('Called') > except OSError as e: > # If we get a 'no wflinfo' warning then just return > +print("wflinfo utility not found.") maybe send this to stderr: print("...", file=sys.stderr) > if e.errno == errno.ENOENT: > raise StopWflinfo('OSError') > raise > @@ -122,8 +142,7 @@ class WflInfo(object): > try: > ret = self.__call_wflinfo(const + [var]) > except StopWflinfo as e: > -# This means tat the particular api or profile is > -# unsupported > +# This means the particular api or profile is unsupported > if e.reason == 'Called': > continue > else: > -- > 1.9.1 > Either way, Reviewed-by: Dylan Baker signature.asc Description: signature ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/2] all.py: filter directories traversed to find shader tests
Quoting Brian Paul (2017-11-09 15:16:33) > The script searches all files under tests/ and generated_tests/ for > files ending in ".shader_test". For each match, a ShaderTest() object > is created and added to the test list. > > For GL extensions or versions not supported by the driver, this is > wasted effort. > > This patch looks for directories under spec/ and tries to determine if > the extension/feature is actually supported by the current driver. If > not, it's skipped. > > This somewhat reduces Piglit start up time, but substantially more > time is spent in the ShaderTest() constructor which actually opens > and parses each file to determine its GL/ES dependencies. I'll try > to address that in the future. > > v2: > - replace os.path.walk() with my own walk_dir_tree() which avoids > decending into subdirs when the parent directory/feature is not supported. > - Use env var to enable/disable shader directory filtering > - Also, fix naming conventions and minor formatting issues. > --- > tests/all.py | 73 > +++- > 1 file changed, 72 insertions(+), 1 deletion(-) > > diff --git a/tests/all.py b/tests/all.py > index ae4a995..93f66cf 100644 > --- a/tests/all.py > +++ b/tests/all.py > @@ -8,12 +8,15 @@ import collections > import itertools > import os > import platform > +import re > > import six > from six.moves import range > > from framework import grouptools > +from framework.test import opengl > from framework import options > +from framework import wflinfo > from framework.profile import TestProfile > from framework.driver_classifier import DriverClassifier > from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest, > @@ -210,9 +213,77 @@ profile = TestProfile() # pylint: disable=invalid-name > > shader_tests = collections.defaultdict(list) > > +wfl_info = wflinfo.WflInfo() > + > + > +def gl_extension_supported(ext_name): > +"""Is the named OpenGL extension supported?""" > +return ext_name in wfl_info.gl_extensions There should be one extra newline here. > + > +def is_feature_directory_supported(dir_name): > +"""Determine if dir_name specifies an OpenGL feature (extension or GL > +version) which is supported by the host. If we return False, it means > +the extension/version is definitely not supported. If we return True, > +it means the extension/version is possibly suppported. We're a little > +fuzzy because we don't yet parse all the directory name possibilities > +(like ES tests). > +""" > +if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}: > +# The directory is a GL extension name, but of the format > "arb_foo_bar" > +# instead of "GL_ARB_foo_bar". We convert the former into the later > +# and check if the extension is supported. > +ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:] > +return gl_extension_supported(ext_name) > +elif re.match("gl-\d\.\d+", dir_name): You're using `re` here because you're not checking gl[sl]-es, right? Does it make more sense to handle ES before desktop GL so you don't need to use re? > +# The directory is a GL version > +version = dir_name[3:] > +return float(version) <= float(wfl_info.gl_version) > +elif re.match("glsl-\d\.\d+", dir_name): > +# The directory is a GLSL version > +version = dir_name[5:] > +return float(version) <= float(wfl_info.glsl_version) > +else: > +# The directory is something else. Don't skip it. > +return True > + > + > +def walk_filter_dir_tree(root): > +"""Recursively walk the directory tree rooted at 'root'. > +If we find a directory path of the form ".../spec/foo/" we'll check if > +'foo' is a supported extension/feature/version. If not, we do not > +traverse foo/. Otherwise, we add continue traversing. > +The return value is a list of (dirpath, filename) tuples. > +""" > +curdir = os.path.split(root)[1] > +files = [] > +retval = [] > + > +for entry in os.listdir(root): > +full_path = os.path.join(root, entry) > +if os.path.isdir(full_path): > +# Check if we're in a "spec/" direcotry > +if curdir == "spec" and not > is_feature_directory_supported(entry): > +# The directory's tests aren't supported by the driver. > +print("Skipping spec/{}".format(entry)) > +else: > +# recursively walk the subdirectory > +retval += walk_filter_dir_tree(full_path) > +elif os.path.isfile(full_path): > +# Add the file to the files list > +files += [entry] > + > +retval += [(root, None, files)] It wont affect anything in our use, but to address potential future problems, None should be [] here. > + > +return retval Just a comment, os.walk is a generator, it yields values instead
[Piglit] [PATCH] framework: decrement argc in delete_arg()
So it doesn't have to be done after every call to delete_arg(). --- tests/util/piglit-framework-gl.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 22aadc5..1b2078d 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -87,13 +87,14 @@ piglit_gl_test_config_init(struct piglit_gl_test_config *config) } static void -delete_arg(char *argv[], int argc, int arg) +delete_arg(char *argv[], int *argc, int arg) { int i; - for (i = arg + 1; i < argc; i++) { + for (i = arg + 1; i < *argc; i++) { argv[i - 1] = argv[i]; } + (*argc)--; } /** @@ -117,16 +118,13 @@ process_args(int *argc, char *argv[], unsigned *force_samples, for (j = 1; j < *argc; j++) { if (!strcmp(argv[j], "-auto")) { piglit_automatic = 1; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-fbo")) { piglit_use_fbo = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-png")) { piglit_dump_png = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-rlimit")) { char *ptr; unsigned long lim; @@ -158,12 +156,10 @@ process_args(int *argc, char *argv[], unsigned *force_samples, j -= 2; } else if (!strncmp(argv[j], "-samples=", 9)) { *force_samples = atoi(argv[j]+9); - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } else if (!strcmp(argv[j], "-khr_no_error")) { piglit_khr_no_error = true; - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); if (config->khr_no_error_support == PIGLIT_UNKNOWN_ERROR_STATUS) { fprintf(stderr, @@ -186,8 +182,7 @@ process_args(int *argc, char *argv[], unsigned *force_samples, config->supports_gl_compat_version = 10; config->supports_gl_core_version = 0; puts("The compatibility profile forced."); - delete_arg(argv, *argc, j--); - *argc -= 1; + delete_arg(argv, argc, j--); } } } -- 1.9.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] all.py: filter directories traversed to find shader tests
The script searches all files under tests/ and generated_tests/ for files ending in ".shader_test". For each match, a ShaderTest() object is created and added to the test list. For GL extensions or versions not supported by the driver, this is wasted effort. This patch looks for directories under spec/ and tries to determine if the extension/feature is actually supported by the current driver. If not, it's skipped. This, with other recent optimizations, reduces Piglit startup time for a Windows VM from nearly 5 minutes to 45 seconds. v2: - replace os.path.walk() with my own walk_dir_tree() which avoids decending into subdirs when the parent directory/feature is not supported. - Use env var to enable/disable shader directory filtering - Also, fix naming conventions and minor formatting issues. v3: - minor Piglit style changes, per Dylan - handle ES cases in is_feature_directory_supported() --- tests/all.py | 81 +++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/tests/all.py b/tests/all.py index ae4a995..6c89d7a 100644 --- a/tests/all.py +++ b/tests/all.py @@ -13,7 +13,9 @@ import six from six.moves import range from framework import grouptools +from framework.test import opengl from framework import options +from framework import wflinfo from framework.profile import TestProfile from framework.driver_classifier import DriverClassifier from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest, @@ -210,9 +212,86 @@ profile = TestProfile() # pylint: disable=invalid-name shader_tests = collections.defaultdict(list) +wfl_info = wflinfo.WflInfo() + + +def gl_extension_supported(ext_name): +"""Is the named OpenGL extension supported?""" +return ext_name in wfl_info.gl_extensions + + +def is_feature_directory_supported(dir_name): +"""Determine if dir_name specifies an OpenGL feature (extension or GL +version) which is supported by the host. If we return False, it means +the extension/version is definitely not supported. If we return True, +it means the extension/version is possibly suppported. We're a little +fuzzy because we don't yet parse all the directory name possibilities +(like ES tests). +""" +if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}: +# The directory is a GL extension name, but of the format "arb_foo_bar" +# instead of "GL_ARB_foo_bar". We convert the former into the later +# and check if the extension is supported. +ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:] +return gl_extension_supported(ext_name) +elif dir_name[:5] == "gles-": +# OpenGL ES test +version = dir_name[5:] +return float(version) <= float(wfl_info.gles_version) +elif dir_name[:8] == "glsl-es-": +# OpenGL ES shader test +version = dir_name[8:] +return float(version) <= float(wfl_info.glsl_es_version) +elif dir_name[:3] == "gl-": +# The directory is a GL version +version = dir_name[3:] +return float(version) <= float(wfl_info.gl_version) +elif dir_name[:5] == "glsl-": +# The directory is a GLSL version +version = dir_name[5:] +return float(version) <= float(wfl_info.glsl_version) +else: +# The directory is something else. Don't skip it. +return True + + +def walk_filter_dir_tree(root): +"""Recursively walk the directory tree rooted at 'root'. +If we find a directory path of the form ".../spec/foo/" we'll check if +'foo' is a supported extension/feature/version. If not, we do not +traverse foo/. Otherwise, we add continue traversing. +The return value is a list of (dirpath, filename) tuples. +""" +curdir = os.path.split(root)[1] +files = [] +retval = [] + +for entry in os.listdir(root): +full_path = os.path.join(root, entry) +if os.path.isdir(full_path): +# Check if we're in a "spec/" direcotry +if curdir == "spec" and not is_feature_directory_supported(entry): +# The directory's tests aren't supported by the driver. +print("Skipping spec/{}".format(entry)) +else: +# recursively walk the subdirectory +retval += walk_filter_dir_tree(full_path) +elif os.path.isfile(full_path): +# Add the file to the files list +files += [entry] + +retval += [(root, [], files)] + +return retval + + # Find and add all shader tests. for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]: -for dirpath, _, filenames in os.walk(basedir): +if os.environ.get("PIGLIT_FILTER_DIRECTORIES"): +files = walk_filter_dir_tree(basedir) +else: +files = os.walk(basedir) +for dirpath, _, filenames in files: groupname = grouptools.from_path(os.path.relpath(dirpath, basedir)) for filename in
Re: [Piglit] [PATCH 2/2] all.py: filter directories traversed to find shader tests
On 11/09/2017 05:29 PM, Dylan Baker wrote: Quoting Brian Paul (2017-11-09 15:16:33) The script searches all files under tests/ and generated_tests/ for files ending in ".shader_test". For each match, a ShaderTest() object is created and added to the test list. For GL extensions or versions not supported by the driver, this is wasted effort. This patch looks for directories under spec/ and tries to determine if the extension/feature is actually supported by the current driver. If not, it's skipped. This somewhat reduces Piglit start up time, but substantially more time is spent in the ShaderTest() constructor which actually opens and parses each file to determine its GL/ES dependencies. I'll try to address that in the future. v2: - replace os.path.walk() with my own walk_dir_tree() which avoids decending into subdirs when the parent directory/feature is not supported. - Use env var to enable/disable shader directory filtering - Also, fix naming conventions and minor formatting issues. --- tests/all.py | 73 +++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/tests/all.py b/tests/all.py index ae4a995..93f66cf 100644 --- a/tests/all.py +++ b/tests/all.py @@ -8,12 +8,15 @@ import collections import itertools import os import platform +import re import six from six.moves import range from framework import grouptools +from framework.test import opengl from framework import options +from framework import wflinfo from framework.profile import TestProfile from framework.driver_classifier import DriverClassifier from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest, @@ -210,9 +213,77 @@ profile = TestProfile() # pylint: disable=invalid-name shader_tests = collections.defaultdict(list) +wfl_info = wflinfo.WflInfo() + + +def gl_extension_supported(ext_name): +"""Is the named OpenGL extension supported?""" +return ext_name in wfl_info.gl_extensions There should be one extra newline here. + +def is_feature_directory_supported(dir_name): +"""Determine if dir_name specifies an OpenGL feature (extension or GL +version) which is supported by the host. If we return False, it means +the extension/version is definitely not supported. If we return True, +it means the extension/version is possibly suppported. We're a little +fuzzy because we don't yet parse all the directory name possibilities +(like ES tests). +""" +if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}: +# The directory is a GL extension name, but of the format "arb_foo_bar" +# instead of "GL_ARB_foo_bar". We convert the former into the later +# and check if the extension is supported. +ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:] +return gl_extension_supported(ext_name) +elif re.match("gl-\d\.\d+", dir_name): You're using `re` here because you're not checking gl[sl]-es, right? Does it make more sense to handle ES before desktop GL so you don't need to use re? Yeah, I can flesh out the ES cases and get rid of re. +# The directory is a GL version +version = dir_name[3:] +return float(version) <= float(wfl_info.gl_version) +elif re.match("glsl-\d\.\d+", dir_name): +# The directory is a GLSL version +version = dir_name[5:] +return float(version) <= float(wfl_info.glsl_version) +else: +# The directory is something else. Don't skip it. +return True + + +def walk_filter_dir_tree(root): +"""Recursively walk the directory tree rooted at 'root'. +If we find a directory path of the form ".../spec/foo/" we'll check if +'foo' is a supported extension/feature/version. If not, we do not +traverse foo/. Otherwise, we add continue traversing. +The return value is a list of (dirpath, filename) tuples. +""" +curdir = os.path.split(root)[1] +files = [] +retval = [] + +for entry in os.listdir(root): +full_path = os.path.join(root, entry) +if os.path.isdir(full_path): +# Check if we're in a "spec/" direcotry +if curdir == "spec" and not is_feature_directory_supported(entry): +# The directory's tests aren't supported by the driver. +print("Skipping spec/{}".format(entry)) +else: +# recursively walk the subdirectory +retval += walk_filter_dir_tree(full_path) +elif os.path.isfile(full_path): +# Add the file to the files list +files += [entry] + +retval += [(root, None, files)] It wont affect anything in our use, but to address potential future problems, None should be [] here. + +return retval Just a comment, os.walk is a generator, it yields values instead of returning a sequence. The way you're using them they're interchangeable, but they are not universally int