Re: [Piglit] [PATCH] util: Remove custom defs of C99 types for MSVC (v2)
Looks good. Jose - Original Message - piglit-util.h contained an #ifdef that defined C99 types for MSVC. Remove the C99 definitions there and let MSVC simply include the C99 headers located at $PIGLIT_TOP/include/msvc/c99. v2: Don't delete `#define log2`, per Ken. CC: Kennth Graunke kenn...@whitecape.org Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- tests/util/piglit-util.h | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h index 2d89775..6ea423d 100755 --- a/tests/util/piglit-util.h +++ b/tests/util/piglit-util.h @@ -36,26 +36,12 @@ extern C { #endif #if defined(_MSC_VER) -typedef signed char int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#ifndef __cplusplus -#define bool BOOL -#define true 1 -#define false 0 -#endif #define log2(x) (log(x) / log(2)) -#else -#include stdint.h -#include stdbool.h #endif #include assert.h +#include stdbool.h +#include stdint.h #include string.h #include stdio.h #include stdlib.h -- 1.7.10.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 02/14] cmake: For MSVC, add include/msvc/c99 to include path
- Original Message - Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- CMakeLists.txt |2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7202417..0dbb14f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,8 @@ if (MINGW) endif () if (WIN32) + include_directories(include/msvc/c99) + WIN32 is also defined for MinGW, which does not need these headers. To only include this on MSVC this should be done as if (MSVC) include_directories(include/msvc/c99) endif () Jose # MSVC MinGW only define use APIENTRY add_definitions (-DGLAPIENTRY=__stdcall) -- 1.7.10.4 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] cmake: Give an early error message when the required make.template module is not available.
From: José Fonseca jfons...@vmware.com --- CMakeLists.txt | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7202417..0aad196 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,16 +76,24 @@ if(NOT DEFINED python) message(FATAL_ERROR python version 2.x (where x = 6) required) endif(NOT DEFINED python) -# Check for the presence of numpy, which is needed to build generated -# tests. +# Check for the presence of several python packages, which are needed to build +# generated tests. execute_process( COMMAND ${python} -c import numpy OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE import_numpy_error_code) if(NOT import_numpy_error_code EQUAL 0) - message(FATAL_ERROR numpy library not found) + message(FATAL_ERROR numpy python module not found) endif(NOT import_numpy_error_code EQUAL 0) +execute_process( + COMMAND ${python} -c from mako.template import Template + OUTPUT_QUIET + ERROR_QUIET + RESULT_VARIABLE import_mako_error_code) +if(NOT import_mako_error_code EQUAL 0) + message(FATAL_ERROR mako.template python module not found) +endif(NOT import_mako_error_code EQUAL 0) # Default to compiling with debug information (`gcc -g`): if(NOT CMAKE_BUILD_TYPE) -- 1.7.10 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 00/14] Move main() from libpiglitutil into each test
On 06/12/2012 05:02 PM, Chad Versace wrote: The goal that this series achieves is to replace the main() function in piglit-framework.c with a new function, piglit_gl_test_run(), that takes as its input a data structure describing the test initialization info. This goal is a stepping stone towards a larger set of goals discussed earlier this month [1]. In the future, the piglit_gl_test_info struct will also contain a declarative desciption of each test's requirements on GL context flavor, extensions, and window systems. There is another reason, in addition to those discussed in [1], for why main() should be moved out of libpiglitutil. The EGL tests, GLX tests, and glean all define main(), yet also link to libpiglitutil. Surprisingly, the linker doesn't complain. However, the situation is fragile. If you modify the libraries or tests in a way that changes the order in which the linker resolves things, link failure occurs. The proper solution is not to tiptoe around the linker; it's to remove main() from the library. If you want to skip to the important stuff, see patches 11-14. All the other patches are just prerequisite cleanups that prepare for those last 4. This series taks a few detours, cleans out the closet, and reorganizes your kitchen junk drawer. Often, you must clean up the house before remodeling it. I feel that all the little detours were needed and that Piglit really benefits from them. I wanted to clean up a lot more, but I restrained myself only to the cleanups that directly benefited the series' stated goal. No regresssions found on Sandybridge. Could you check this into a branch first for additional testing (MSVC, mingw32, etc)? -Brian ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 02/14] cmake: For MSVC, add include/msvc/c99 to include path
On 06/13/2012 12:41 AM, Jose Fonseca wrote: - Original Message - Signed-off-by: Chad Versace chad.vers...@linux.intel.com --- CMakeLists.txt |2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7202417..0dbb14f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,6 +138,8 @@ if (MINGW) endif () if (WIN32) +include_directories(include/msvc/c99) + WIN32 is also defined for MinGW, which does not need these headers. To only include this on MSVC this should be done as if (MSVC) include_directories(include/msvc/c99) endif () Thanks for catching this. It's fixed now on my separate-main-v11 branch. ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] cmake: Give an early error message when the required make.template module is not available.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/13/2012 01:47 AM, jfons...@vmware.com wrote: From: José Fonseca jfons...@vmware.com --- CMakeLists.txt | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7202417..0aad196 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,16 +76,24 @@ if(NOT DEFINED python) message(FATAL_ERROR python version 2.x (where x = 6) required) endif(NOT DEFINED python) -# Check for the presence of numpy, which is needed to build generated -# tests. +# Check for the presence of several python packages, which are needed to build +# generated tests. execute_process( COMMAND ${python} -c import numpy OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE import_numpy_error_code) if(NOT import_numpy_error_code EQUAL 0) - message(FATAL_ERROR numpy library not found) + message(FATAL_ERROR numpy python module not found) endif(NOT import_numpy_error_code EQUAL 0) +execute_process( + COMMAND ${python} -c from mako.template import Template + OUTPUT_QUIET + ERROR_QUIET + RESULT_VARIABLE import_mako_error_code) +if(NOT import_mako_error_code EQUAL 0) + message(FATAL_ERROR mako.template python module not found) +endif(NOT import_mako_error_code EQUAL 0) # Default to compiling with debug information (`gcc -g`): if(NOT CMAKE_BUILD_TYPE) Reviewed-by: Chad Versace chad.vers...@linux.intel.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJP2QDnAAoJEAIvNt057x8izhUP+gKaVvDAZm4qq0h+kuUkdRTO elLdT7f6FKTl8fGV/2IJRbhjwU9ghhGSQgfhUEW231G0Rx3kTGTxqrmNN1BZHpFm PrgQKwnnnSTUfiJUJriBHB84LXFML2Db/ABg2UvtpV3abj8kGfvLAVWlBmV0Lqsk bE0eWggysvkKXPXsUKXhsAP5d7XkUpt/t91e9krUA5bb4ziGXtK84zCH08Hxu74m YulR9NkMfnKEKvbgBmlfjvy5PkvtbG8AMtda8/f4vfwbpfS9b2Sa+26hXFxagcED pSlEfvRsXmOntafIDT8Bt8itU/Z/CJYxobBCxiTHP004Li8FK4LlKQs8h8q8BGcT zkVQ+NHr/er5qIbx2DqhJYAeGO2uukXnvFqgfdj7Gr6sRhRPY8glCih+gEw6Twh5 wo0WQ4rK7PwXTNU3TrEDKT8xtUCI8G4+IoOAYyrLqNrZG9QjUpW5UTJFe7j5LsqP A4ytgPW2A0pl5sJf/K1X7qmgwYkkqzMl/qYFzHbjcZGlRWmFb5HHQdRCHo90M095 BGs1QxTZYMCZR3U3vjq9klaikSuAT3GjtRoYpKXcH91JqVp6cLB9TZJnFfzYurPZ 8u5lhG7B2rQCrxySmiBTXJqCAsC4nj0EeXkD9dOdveqk9VTTDMBfQaCmz5yDkuN4 iqNosMDoK3IlP0YUOc2y =AqP6 -END PGP SIGNATURE- ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 2/5] glx_arb_create_context_profile: Verify that the core profile is supported for OpenGL 3.2
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/12/2012 02:30 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com NVIDIA's closed-source driver passes this test. AMD's closed-source driver has not been tested. NVIDIA's closed-source driver supports both core and compatibility profiles. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- tests/all.tests|1 + .../spec/glx_arb_create_context/CMakeLists.gl.txt |1 + tests/spec/glx_arb_create_context/core-profile.c | 108 3 files changed, 110 insertions(+), 0 deletions(-) create mode 100644 tests/spec/glx_arb_create_context/core-profile.c diff --git a/tests/all.tests b/tests/all.tests index 7b1f341..a5ac403 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -686,6 +686,7 @@ create_context['forward-compatible flag with 3.0'] = PlainExecTest(['glx-create- create_context_profile = Group(); glx['GLX_ARB_create_context_profile'] = create_context_profile +create_context_profile['3.2 core profile required'] = PlainExecTest(['glx-create-context-core-profile']) create_context_profile['invalid profile'] = PlainExecTest(['glx-create-context-invalid-profile']) texturing = Group() diff --git a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt index 94c6d19..f318266 100644 --- a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt +++ b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt @@ -22,6 +22,7 @@ IF(BUILD_GLX_TESTS) link_libraries ( ${X11_X11_LIB} ) + piglit_add_executable (glx-create-context-core-profile core-profile.c common.c) piglit_add_executable (glx-create-context-default-major-version default-major-version.c common.c) piglit_add_executable (glx-create-context-default-minor-version default-minor-version.c common.c) piglit_add_executable (glx-create-context-invalid-attribute invalid-attribute.c common.c) diff --git a/tests/spec/glx_arb_create_context/core-profile.c b/tests/spec/glx_arb_create_context/core-profile.c new file mode 100644 index 000..0c98bc2 --- /dev/null +++ b/tests/spec/glx_arb_create_context/core-profile.c @@ -0,0 +1,108 @@ +/* Copyright © 2012 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#include piglit-util.h +#include piglit-glx-util.h +#include common.h + +int main(int argc, char **argv) +{ + static const int attribs[] = { + GLX_CONTEXT_PROFILE_MASK_ARB, + GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB, + GLX_CONTEXT_MAJOR_VERSION_ARB, + 3, + GLX_CONTEXT_MINOR_VERSION_ARB, + 2, + None + }; + + bool pass = true; + bool got_core = false; + bool got_compatibility = false; + GLXContext ctx; + + + GLX_ARB_create_context_setup(); + piglit_require_glx_extension(dpy, GLX_ARB_create_context_profile); + + /* The GLX_ARB_create_context_profile spec says: + * + * All OpenGL 3.2 implementations are required to implement the + * core profile, but implementation of the compatibility profile + * is optional. + * + * If it is possible to create a context with the compatibility + * profile, then it must also be possible to create a context with the + * core profile. Conversely, if it is not possible to create a + * context with the core profile, it must also not possible to create + * a context with the compatibility profile. + */ + ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, + attribs + 2); + XSync(dpy, 0); + + if (ctx != NULL) { + glXDestroyContext(dpy, ctx); +
Re: [Piglit] [PATCH 1/5] glx_arb_create_context_profile: Verify that invalid profiles are rejected
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/12/2012 02:30 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com NVIDIA's closed-source driver passes this test. AMD's closed-source driver has not been tested. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Reviewed-by: Chad Versace chad.vers...@linux.intel.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJP2QV8AAoJEAIvNt057x8i1yQP/j6cnvXXLcd/JVIu4v/k3Ii2 v7o0C3wcTHndxW7F1vC/CH6SbtqukPYMxy4JNaIy6ahjTKGC4fKiXqPFZvdkGIny hMJRq+8XY4aN7Y5KGYj+DtdixEUHeg69mIGreZJl+KhAaJ6uJImh5KW0MTBqH98N QYe8jddVdza8PIXVJizTW5cy++t8VobAc42pCvV0jYc2KJQqEpRQB+qiMvuTPCpk vWZS8iA1g2/SlCrR0MfZkzy9ijmH4atozgNBgR9COXK6jPsSl+/QWLWnNsRc+CJE blaY8bawIgTgTZxkddFigHbjIEuZvX/+SwAbJlFMUYLS9/DZoZ+lV8t7Kh3SBVJ1 /wl/sBmiLXolAuOPjYERmXQsvTF3YwEWy+ha5s2daaQsiRiQIKroOWwL6YjVt1Tf xVlQbkzNGrzdtH0jw9+dnU8aevErqLDlt7yckn/joEkLHXK8P71NAGy06cVav8Z8 +Kuhi2pEVCzXMxVXkAC8r8GciSm1V6tQq6yXTLu4DMiofD1CH8prGPlgd9S76lun U6iDBN45AP89fwSwzuAlN9JAYB5JzyKDOaOdibJuTuEgQEb+Y+cR8iSSV4aUez5N 90Ee5rAjPxhNJAfpGmpihZsTb2Ly95R8Vh71tY+fA7ak1pwjLp9dbSuuxCazY6Td 9KBxu8JjYg8ddVCnaR4G =jSOi -END PGP SIGNATURE- ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 3/5] glx_arb_create_context_profile: Verify that the profile is ignored pre-3.2
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/12/2012 02:30 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com The profile mechanism is only meaningful for OpenGL 3.2 or later. Verify that the profile setting is silently ignored when a version earlier than 3.2 is requested. NVIDIA's closed-source driver passes this test. AMD's closed-source driver has not been tested. Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- tests/all.tests|1 + .../spec/glx_arb_create_context/CMakeLists.gl.txt |1 + .../spec/glx_arb_create_context/pre-GL3-profile.c | 67 3 files changed, 69 insertions(+), 0 deletions(-) create mode 100644 tests/spec/glx_arb_create_context/pre-GL3-profile.c Reviewed-by: Chad Versace chad.vers...@linux.intel.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJP2QWZAAoJEAIvNt057x8ii5AP/0vB7bS2nXoF/VcwLFJLIqvv 8PTp0faBuQmC+xuV9n53liXs4jHBexpNqoIfn7qr6gnNrfHonmKo7DhF/Ix6mvjm 5DVR4WqN5Uj/W37UCTU7WavEzGd9ZmQTfVs3jZWv7e6RLlzxwK++GHIRM+f8Q8Tt eZeudhmXwOPlcoZvddA9mG6KhuXm4OOIdmxAmLLmV17iYXLGKjJup2aQrBZg/zwe b9eyXB20/kUJgVwQ8n+sak1Qy3l8Wkqqz9gh23CKAaQFIt6dhQAi5pP8ZGWXPRQ3 ThZLP8L6JpsaRzPWNmykjjfX8ImfBNCPowY/4dRYeDH2TWdZTerAqXUg7NPFWZjq /hI2SHJ6sg+7SKZf3Z+LXNnwOjY1HHV1vpDQyg9EjX50EZy7zXzPDZ3kfnf7mfBM LouAInvqh/lBnmfHF2wN5MldVApG7B+r4oHGxaO1ZvhuiGl/wPfZ4I9enw/GbLYE XffFNQDf8+2VPriXozp8K1IUMXitU134GSIj8bT71XSc+rtcWutF1zUUCv+aeRFB PHZG+nzc7GcHXaAV0U7p+Wa/gICNXi+p1/fcrWmOdSPO0wP/ldfp+D0EsKr11Hd2 aw62Ok+C6EtGc6dykmxSSfDF68CdItCgvsZSSEdGT3LhpR9eaa4+payd+5tuyTHK 8WXmd63cDb4LLqkJt8+L =UkZC -END PGP SIGNATURE- ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH 5/5] glx_ext_create_context_es2_profile: Verify that the invalid ES versions are rejected
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/12/2012 02:30 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com NVIDIA's closed-source driver fails this test. GLXBadProfileARB is generated instead of BadMatch. The specification isn't specific about what error should be generated, but I don't think GLXBadProfileARB is correct. GLXBadProfileARB seems to only be generated in cases where the bit mask specified for GLX_CONTEXT_PROFILE_MASK_ARB is invalid. Cases where the GLX_CONTEXT_PROFILE_MASK_ARB is incongruous with the specified version either result in GLX_CONTEXT_PROFILE_MASK_ARB being ignored or BadMatch. AMD's closed-source driver has not been tested. Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: James Jones jajo...@nvidia.com --- tests/all.tests|1 + .../spec/glx_arb_create_context/CMakeLists.gl.txt |1 + .../glx_arb_create_context/invalid-es-version.c| 105 3 files changed, 107 insertions(+), 0 deletions(-) create mode 100644 tests/spec/glx_arb_create_context/invalid-es-version.c I really don't care if the error is GLXBadMatch or GLXBadProfile. Whatever decision you and James arrive at, this test is Reviewed-by: Chad Versace chad.vers...@linux.intel.com -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJP2QY1AAoJEAIvNt057x8i7xEP/jLCRPqaPBHTnX+nEB1w5C9T cZH6t1s2TnPU0VwgpLQPGLgKhSAocnX9hRgP3yoRNwovwCqGFyr4A4nLnDaTM9OS iS9GgBijEIWIYn+eI68pjjj0TIDm+2DRxVHogQPIWm2nxOP/GagcomlincCjfxch xrtocPz+IxMW3hOocJnsqCtiD00B6j+K05t84vXUabgOcOpmZgFM9G1jppLgWEC2 q56iOaK/x9nw/XJt38lULJauQzvTMV+bXO7rj7KRzAdPjQfF+oaUQkVvZZjVHxfN uBJL1MptdMf7TPWMZqHXFUWTJjSZAp9ed9A/Lrmyz+oVW4w0WHbT102SBTWrVGuN 4peozPqTt3RQMJ+3ZuIU324oG6iRQEjDRzaplz/7mPxJ8rR8H3JeWISafCLYexO3 3NkI1unRTE+zqiqv2OILDra+S6QANPabpjvbfxTscumWbaNTWgObToEEhrJgliZZ EpvrUHKNF7Kx6bRcaNh3yl8IyRjLlJFuSbTctND6xCd7h1NylooxEj1pdT4j5uwU yajbW3gF+WNYNmLLOQXQT5e3rpqAwIvDonizPz6ofoYslOcaifFOLQ9qxgCy2s0+ xB1T9dNBxHn6CGlnQy83oMurjCDidFBx/o/IVUzXtJRYhgZCwYZ/stAgD/WGdEr4 vJt1pBeU3J78IxpN7jOU =4DwK -END PGP SIGNATURE- ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] glsl-1.30: Verify proper conversion of large floats to uints.
This patch adds two new tests that exercise a bug in Mesa/i965: conversion from float to uint was being done in a two step process: convert first to int and then to uint. Since i965 uses saturating arithmetic in float-int conversion, this caused conversion to give the wrong result for values greater than 0x7fff. I'll be submitting a Mesa fix shortly. --- .../execution/fs-float-uint-conversion.shader_test | 37 +++ .../execution/vs-float-uint-conversion.shader_test | 38 2 files changed, 75 insertions(+), 0 deletions(-) create mode 100644 tests/spec/glsl-1.30/execution/fs-float-uint-conversion.shader_test create mode 100644 tests/spec/glsl-1.30/execution/vs-float-uint-conversion.shader_test diff --git a/tests/spec/glsl-1.30/execution/fs-float-uint-conversion.shader_test b/tests/spec/glsl-1.30/execution/fs-float-uint-conversion.shader_test new file mode 100644 index 000..5c346a6 --- /dev/null +++ b/tests/spec/glsl-1.30/execution/fs-float-uint-conversion.shader_test @@ -0,0 +1,37 @@ +# Check that a very large floating point value can be converted to a +# uint, even though it falls outside the valid range of ints. +# +# The very large floating point value we test with is 0xff00 == +# 4278190080, which can be represented exactly using a 32-bit float, +# so we don't need to worry about rounding error. + +[require] +GLSL = 1.30 + +[vertex shader] +#version 130 +void main() +{ + gl_Position = gl_Vertex; +} + +[fragment shader] +#version 130 +uniform float float_value; +uniform uint uint_value; + +#define RED vec4(1.0, 0.0, 0.0, 1.0) +#define GREEN vec4(0.0, 1.0, 0.0, 1.0) + +void main() +{ + uint converted = uint(float_value); + bool match = converted == uint_value; + gl_FragColor = match ? GREEN : RED; +} + +[test] +uniform float float_value 4278190080 +uniform uint uint_value 4278190080 +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 diff --git a/tests/spec/glsl-1.30/execution/vs-float-uint-conversion.shader_test b/tests/spec/glsl-1.30/execution/vs-float-uint-conversion.shader_test new file mode 100644 index 000..03b8c60 --- /dev/null +++ b/tests/spec/glsl-1.30/execution/vs-float-uint-conversion.shader_test @@ -0,0 +1,38 @@ +# Check that a very large floating point value can be converted to a +# uint, even though it falls outside the valid range of ints. +# +# The very large floating point value we test with is 0xff00 == +# 4278190080, which can be represented exactly using a 32-bit float, +# so we don't need to worry about rounding error. + +[require] +GLSL = 1.30 + +[vertex shader] +#version 130 +uniform float float_value; +uniform uint uint_value; + +#define RED vec4(1.0, 0.0, 0.0, 1.0) +#define GREEN vec4(0.0, 1.0, 0.0, 1.0) + +void main() +{ + gl_Position = gl_Vertex; + uint converted = uint(float_value); + bool match = converted == uint_value; + gl_FrontColor = match ? GREEN : RED; +} + +[fragment shader] +#version 130 +void main() +{ + gl_FragColor = gl_Color; +} + +[test] +uniform float float_value 4278190080 +uniform uint uint_value 4278190080 +draw rect -1 -1 2 2 +probe all rgba 0.0 1.0 0.0 1.0 -- 1.7.7.6 ___ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit