Re: [Piglit] [PATCH] cl: Add sqrt tests

2013-10-25 Thread Tom Stellard
On Fri, Oct 25, 2013 at 05:40:47PM -0500, Aaron Watry wrote:
> Pretty basic, but we didn't have any tests for this before...
> 
> Tested on r600g w/ CEDAR.
> ---
>  generated_tests/generate-cl-math-builtins.py | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/generated_tests/generate-cl-math-builtins.py 
> b/generated_tests/generate-cl-math-builtins.py
> index b6b4e43..150c412 100644
> --- a/generated_tests/generate-cl-math-builtins.py
> +++ b/generated_tests/generate-cl-math-builtins.py
> @@ -57,6 +57,14 @@ tests = {
>  [1.0, -1.0, 0.0, -0.0, 0.0],
>  [0.5, -0.5, 0.0, -0.0, float("nan")]
>  ]
> +},
> +'sqrt' : {
> +'arg_types': [F, F],
> +'function_type': 'ttt',
> +'values': [
> +[1.0, 2.0,  6.0, 2.5 , float("nan"), 4.0], # Result
> +[1.0, 4.0, 36.0, 6.25, float("nan"), 16.0], # Arg1

I think you should also add one or more cases here that require a lot of
precision.  I'm pretty sure we get this wrong on r600g, since we are
using the instruction that calculates the approximate sqrt.

Also, I think it would be good to add a TODO somewhere in the python
script for checking that the results of the builtins satisfy the ulp
requirements for the spec.

With these changes, the patch is:
Reviewed-by: Tom Stellard 

> +]
>  }
>  }
>  
> -- 
> 1.8.3.2
> 
> ___
> 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 4/6] arb_transform_feedback3: add test trying to draw an invalid stream

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> Passes on NVIDIA (319.60 on GTX 660).
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  tests/all.tests|  1 +
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |  1 +
>  .../draw_using_invalid_stream_index.c  | 67 
> ++
>  3 files changed, 69 insertions(+)
>  create mode 100644 
> tests/spec/arb_transform_feedback3/draw_using_invalid_stream_index.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 585e4a6..6e2fb2c 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2358,6 +2358,7 @@ 
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_stream_m
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_gs_many_streams']
>  = 
> PlainExecTest(['arb_transform_feedback3-ext_interleaved_single_gs_many_streams',
>  '-auto'])
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_draw_streams']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_draw_streams', 
> '-auto'])
>  arb_transform_feedback3['arb_transform_feedback3-bind_buffer_invalid_index'] 
> = PlainExecTest(['arb_transform_feedback3-bind_buffer_invalid_index', 
> '-auto'])
> +arb_transform_feedback3['arb_transform_feedback3-draw_using_invalid_stream_index']
>  = PlainExecTest(['arb_transform_feedback3-draw_using_invalid_stream_index', 
> '-auto'])
>  
>  for param in ['vs', 'gs', 'gs_max']:
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_two_bufs_vs']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_two_bufs', 
> '-auto', param])
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index 9fe3017..ceb2cab 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -15,5 +15,6 @@ piglit_add_executable 
> (arb_transform_feedback3-ext_interleaved_draw_streams ext_
>  piglit_add_executable (arb_transform_feedback3-bind_buffer_invalid_index 
> bind_buffer_invalid_index.c)
>  piglit_add_executable (arb_transform_feedback3-query_with_invalid_index 
> query_with_invalid_index.c)
>  piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero 
> end_query_with_name_zero.c)
> +piglit_add_executable 
> (arb_transform_feedback3-draw_using_invalid_stream_index 
> draw_using_invalid_stream_index.c)
>  
>  # vim: ft=cmake:
> diff --git 
> a/tests/spec/arb_transform_feedback3/draw_using_invalid_stream_index.c 
> b/tests/spec/arb_transform_feedback3/draw_using_invalid_stream_index.c
> new file mode 100644
> index 000..25d6bc1
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/draw_using_invalid_stream_index.c
> @@ -0,0 +1,67 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +
> +/**
> + * @file draw_using_invalid_stream_index.c
> + *
> + * "The error INVALID_VALUE is generated by DrawTransformFeedbackStream
> + *  if  is greater than or equal to the value of MAX_VERTEX_STREAMS."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vao, tfb;
> + bool pass;
> +
> + /* Test is run under desktop OpenGL 3.2 -> use of VAOs is required */
> + glGenVertexArrays(1, &vao);
> + glBindVertexArray(vao);
> +
> + glGenTransformFeedbacks(1, &tfb);
> + glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfb);
> +
> + glDrawTransformFeedbackStream(GL_TRIANGLE_STRIP, tfb,
> + GL_MAX_VERTEX_STREAMS);

Are you sure this works on a core profile?  It

Re: [Piglit] [PATCH 6/6] arb_transform_feedback3: add test trying to set invalid separate mode

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> Pass on NVIDIA (319.60 on GTX 660).
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  tests/all.tests|   1 +
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |   1 +
>  .../arb_transform_feedback3/set_invalid_varyings.c | 191 
> +
>  3 files changed, 193 insertions(+)
>  create mode 100644 tests/spec/arb_transform_feedback3/set_invalid_varyings.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 172bf04..156444a 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2360,6 +2360,7 @@ 
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_draw_streams']
>  arb_transform_feedback3['arb_transform_feedback3-bind_buffer_invalid_index'] 
> = PlainExecTest(['arb_transform_feedback3-bind_buffer_invalid_index', 
> '-auto'])
>  
> arb_transform_feedback3['arb_transform_feedback3-draw_using_invalid_stream_index']
>  = PlainExecTest(['arb_transform_feedback3-draw_using_invalid_stream_index', 
> '-auto'])
>  
> arb_transform_feedback3['arb_transform_feedback3-set_varyings_with_invalid_args']
>  = PlainExecTest(['arb_transform_feedback3-set_varyings_with_invalid_args', 
> '-auto'])
> +arb_transform_feedback3['arb_transform_feedback3-set_invalid_varyings'] = 
> PlainExecTest(['arb_transform_feedback3-set_invalid_varyings', '-auto'])
>  
>  for param in ['vs', 'gs', 'gs_max']:
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_two_bufs_vs']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_two_bufs', 
> '-auto', param])
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index 888683a..7112e73 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -17,5 +17,6 @@ piglit_add_executable 
> (arb_transform_feedback3-query_with_invalid_index query_wi
>  piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero 
> end_query_with_name_zero.c)
>  piglit_add_executable 
> (arb_transform_feedback3-draw_using_invalid_stream_index 
> draw_using_invalid_stream_index.c)
>  piglit_add_executable 
> (arb_transform_feedback3-set_varyings_with_invalid_args 
> set_varyings_with_invalid_args.c)
> +piglit_add_executable (arb_transform_feedback3-set_invalid_varyings 
> set_invalid_varyings.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_transform_feedback3/set_invalid_varyings.c 
> b/tests/spec/arb_transform_feedback3/set_invalid_varyings.c
> new file mode 100644
> index 000..6868183
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/set_invalid_varyings.c
> @@ -0,0 +1,191 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +#include "xfb3_common.h"
> +
> +/**
> + * @file set_invalid_varyings.c 
> + *
> + * Tests that varyings for separate attributes cannot be set using keywords
> + * reserved solely for the interleaved use. The spec:
> + *
> + * "The error INVALID_OPERATION is generated by TransformFeedbackVaryings
> + *  if any pointer in  identifies the special names 
> "gl_NextBuffer",
> + *  "gl_SkipComponents1", "gl_SkipComponents2", "gl_SkipComponents3", or
> + *  "gl_SkipComponents4" and  is not INTERLEAVED_ATTRIBS_NV, or 
> if
> + *  the number of "gl_NextBuffer" pointers in  is greater than or
> + *  equal to the value of MAX_TRANSFORM_FEEDBACK_BUFFERS."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char gs_simple_text[] =
> + "#version 150\n"
> + "layout(points) in;\n"
> + "layout(points) out;\n"
> + "out float x1_out;\n"
>

Re: [Piglit] [PATCH 5/6] arb_transform_feedback3: add test trying to set invalid varyings

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> Non-existing program case crashes on NVIDIA (319.60 on GTX 660)
> but exceeding maximum attribute case passes.
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  tests/all.tests|   1 +
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |   1 +
>  .../set_varyings_with_invalid_args.c   | 121 
> +
>  3 files changed, 123 insertions(+)
>  create mode 100644 
> tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 6e2fb2c..172bf04 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2359,6 +2359,7 @@ 
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_gs_many_
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_draw_streams']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_draw_streams', 
> '-auto'])
>  arb_transform_feedback3['arb_transform_feedback3-bind_buffer_invalid_index'] 
> = PlainExecTest(['arb_transform_feedback3-bind_buffer_invalid_index', 
> '-auto'])
>  
> arb_transform_feedback3['arb_transform_feedback3-draw_using_invalid_stream_index']
>  = PlainExecTest(['arb_transform_feedback3-draw_using_invalid_stream_index', 
> '-auto'])
> +arb_transform_feedback3['arb_transform_feedback3-set_varyings_with_invalid_args']
>  = PlainExecTest(['arb_transform_feedback3-set_varyings_with_invalid_args', 
> '-auto'])
>  
>  for param in ['vs', 'gs', 'gs_max']:
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_two_bufs_vs']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_two_bufs', 
> '-auto', param])
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index ceb2cab..888683a 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -16,5 +16,6 @@ piglit_add_executable 
> (arb_transform_feedback3-bind_buffer_invalid_index bind_bu
>  piglit_add_executable (arb_transform_feedback3-query_with_invalid_index 
> query_with_invalid_index.c)
>  piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero 
> end_query_with_name_zero.c)
>  piglit_add_executable 
> (arb_transform_feedback3-draw_using_invalid_stream_index 
> draw_using_invalid_stream_index.c)
> +piglit_add_executable 
> (arb_transform_feedback3-set_varyings_with_invalid_args 
> set_varyings_with_invalid_args.c)
>  
>  # vim: ft=cmake:
> diff --git 
> a/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c 
> b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
> new file mode 100644
> index 000..b9b085b
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
> @@ -0,0 +1,121 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +#include "xfb3_common.h"
> +
> +/**
> + * @file set_varyings_with_invalid_args.c 
> + *
> + * Tests that TransformFeedbackVaryings() does not accept non-existing 
> program
> + * and that the upper limit for the number of attributes is guarded. The 
> spec:
> + *
> + * "The error INVALID_VALUE is generated by TransformFeedbackVaryings if
> + *   is not the name of a program object, or if  is
> + *  SEPARATE_ATTRIBS and  is greater than the limit
> + *  MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static const char gs_simple_text[] =
> + "#version 150\n"
> + "layout(points) in;\n"
> + "layout(points) out;\n"
> + "out float x1_out;\n"
> +  

Re: [Piglit] [PATCH 3/6] arb_transform_feedback3: add test for ending non-active query

2013-10-25 Thread Ian Romanick
On 10/25/2013 04:59 PM, Ian Romanick wrote:
> On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
>> Passes on NVIDIA (319.60 on GTX 660).
>>
>> Signed-off-by: Topi Pohjolainen 
> 
> With the non-fatal failure issue fixed (same as on the previous two
> patches), this one is
> 
> Reviewed-by: Ian Romanick 

I take that back... if you add the test to all.tests, it's R-b. :)

>> ---
>>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |  1 +
>>  .../end_query_with_name_zero.c | 64 
>> ++
>>  2 files changed, 65 insertions(+)
>>  create mode 100644 
>> tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
>>
>> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
>> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
>> index 44b6229..9fe3017 100644
>> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
>> @@ -14,5 +14,6 @@ piglit_add_executable 
>> (arb_transform_feedback3-ext_interleaved_two_bufs ext_inte
>>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_draw_streams 
>> ext_interleaved_draw_streams.c)
>>  piglit_add_executable (arb_transform_feedback3-bind_buffer_invalid_index 
>> bind_buffer_invalid_index.c)
>>  piglit_add_executable (arb_transform_feedback3-query_with_invalid_index 
>> query_with_invalid_index.c)
>> +piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero 
>> end_query_with_name_zero.c)
>>  
>>  # vim: ft=cmake:
>> diff --git a/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c 
>> b/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
>> new file mode 100644
>> index 000..c36264b
>> --- /dev/null
>> +++ b/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
>> @@ -0,0 +1,64 @@
>> +/*
>> + * Copyright © 2013 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-gl-common.h"
>> +
>> +/**
>> + * @file query_with_invalid_index.c
>> + *
>> + * Tests that EndQueryIndexed() fails without corresponding call to
>> + * BeginQueryIndexed(). The spec says:
>> + *
>> + * "The error INVALID_OPERATION is generated by EndQueryIndexed if the 
>> active
>> + *  query object name at index  of target  is zero."
>> + */
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +config.supports_gl_compat_version = 32;
>> +config.supports_gl_core_version = 32;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +piglit_require_extension("GL_ARB_transform_feedback3");
>> +
>> +glEndQueryIndexed(GL_PRIMITIVES_GENERATED, 0);
>> +if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +piglit_report_result(PIGLIT_FAIL);
>> +
>> +glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, 0);
>> +if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +piglit_report_result(PIGLIT_FAIL);
>> +
>> +piglit_report_result(PIGLIT_PASS);
>> +}
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +/* Should never be reached */
>> +return PIGLIT_FAIL;
>> +}
>>
> 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/6] arb_transform_feedback3: add test for querying with invalid index

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> NVIDIA (319.60 on GTX 660) fails by reporting INVALID_OPERATION
> instead of INVALID_VALUE.
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |  1 +
>  .../query_with_invalid_index.c | 71 
> ++
>  2 files changed, 72 insertions(+)
>  create mode 100644 
> tests/spec/arb_transform_feedback3/query_with_invalid_index.c
> 
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index 5d3608d..44b6229 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -13,5 +13,6 @@ piglit_add_executable 
> (arb_transform_feedback3-ext_interleaved_single_gs_many_st
>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_two_bufs 
> ext_interleaved_two_bufs.c)
>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_draw_streams 
> ext_interleaved_draw_streams.c)
>  piglit_add_executable (arb_transform_feedback3-bind_buffer_invalid_index 
> bind_buffer_invalid_index.c)
> +piglit_add_executable (arb_transform_feedback3-query_with_invalid_index 
> query_with_invalid_index.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_transform_feedback3/query_with_invalid_index.c 
> b/tests/spec/arb_transform_feedback3/query_with_invalid_index.c
> new file mode 100644
> index 000..314d126
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/query_with_invalid_index.c
> @@ -0,0 +1,71 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +
> +/**
> + * @file query_with_invalid_index.c
> + *
> + * Tests that invalid index given to BeginQueryIndexed(), EndQueryIndexed() 
> or
> + * GetQueryIndexediv() is detected and an error is set. The spec says:
> + *
> + * "The error INVALID_VALUE is generated by BeginQueryIndexed, 
> EndQueryIndexed
> + *  or GetQueryIndexediv if  is TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN
> + *  or PRIMITIVES_GENERATED and  is greater or equal
> + *  to MAX_VERTEX_STREAMS."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint queries[2];
> +
> + piglit_require_extension("GL_ARB_transform_feedback3");
> +
> + glGenQueries(ARRAY_SIZE(queries), queries);
> +
> + glBeginQueryIndexed(GL_PRIMITIVES_GENERATED, 0, GL_MAX_VERTEX_STREAMS);

This test has the same problem as the previous.

> + if (!piglit_check_gl_error(GL_INVALID_VALUE))
> + piglit_report_result(PIGLIT_FAIL);

And tests should keep trying things after a non-fatal failure.

> +
> + glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, 0,
> + GL_MAX_VERTEX_STREAMS);
> + if (!piglit_check_gl_error(GL_INVALID_VALUE))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + glDeleteQueries(ARRAY_SIZE(queries), queries);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + /* Should never be reached */
> + return PIGLIT_FAIL;
> +}
> 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/6] arb_transform_feedback3: add test for ending non-active query

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> Passes on NVIDIA (319.60 on GTX 660).
> 
> Signed-off-by: Topi Pohjolainen 

With the non-fatal failure issue fixed (same as on the previous two
patches), this one is

Reviewed-by: Ian Romanick 

> ---
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |  1 +
>  .../end_query_with_name_zero.c | 64 
> ++
>  2 files changed, 65 insertions(+)
>  create mode 100644 
> tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
> 
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index 44b6229..9fe3017 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -14,5 +14,6 @@ piglit_add_executable 
> (arb_transform_feedback3-ext_interleaved_two_bufs ext_inte
>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_draw_streams 
> ext_interleaved_draw_streams.c)
>  piglit_add_executable (arb_transform_feedback3-bind_buffer_invalid_index 
> bind_buffer_invalid_index.c)
>  piglit_add_executable (arb_transform_feedback3-query_with_invalid_index 
> query_with_invalid_index.c)
> +piglit_add_executable (arb_transform_feedback3-end_query_with_name_zero 
> end_query_with_name_zero.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c 
> b/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
> new file mode 100644
> index 000..c36264b
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/end_query_with_name_zero.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +
> +/**
> + * @file query_with_invalid_index.c
> + *
> + * Tests that EndQueryIndexed() fails without corresponding call to
> + * BeginQueryIndexed(). The spec says:
> + *
> + * "The error INVALID_OPERATION is generated by EndQueryIndexed if the active
> + *  query object name at index  of target  is zero."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + piglit_require_extension("GL_ARB_transform_feedback3");
> +
> + glEndQueryIndexed(GL_PRIMITIVES_GENERATED, 0);
> + if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, 0);
> + if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + piglit_report_result(PIGLIT_PASS);
> +}
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + /* Should never be reached */
> + return PIGLIT_FAIL;
> +}
> 

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/6] arb_transform_feedback3: add test for buffer binding with invalid index

2013-10-25 Thread Ian Romanick
On 10/22/2013 06:48 AM, Topi Pohjolainen wrote:
> Passes on NVIDIA (319.60 on GTX 660).
> 
> Signed-off-by: Topi Pohjolainen 
> ---
>  tests/all.tests|  1 +
>  .../spec/arb_transform_feedback3/CMakeLists.gl.txt |  1 +
>  .../bind_buffer_invalid_index.c| 74 
> ++
>  3 files changed, 76 insertions(+)
>  create mode 100644 
> tests/spec/arb_transform_feedback3/bind_buffer_invalid_index.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index b9f8b9c..585e4a6 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -2357,6 +2357,7 @@ 
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_stream_m
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_stream_many_buffers_gs']
>  = 
> PlainExecTest(['arb_transform_feedback3-ext_interleaved_single_stream_many_buffers',
>  '-auto', 'gs'])
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_single_gs_many_streams']
>  = 
> PlainExecTest(['arb_transform_feedback3-ext_interleaved_single_gs_many_streams',
>  '-auto'])
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_draw_streams']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_draw_streams', 
> '-auto'])
> +arb_transform_feedback3['arb_transform_feedback3-bind_buffer_invalid_index'] 
> = PlainExecTest(['arb_transform_feedback3-bind_buffer_invalid_index', 
> '-auto'])
>  
>  for param in ['vs', 'gs', 'gs_max']:
>  
> arb_transform_feedback3['arb_transform_feedback3-ext_interleaved_two_bufs_vs']
>  = PlainExecTest(['arb_transform_feedback3-ext_interleaved_two_bufs', 
> '-auto', param])
> diff --git a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt 
> b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> index 337f53c..5d3608d 100644
> --- a/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> +++ b/tests/spec/arb_transform_feedback3/CMakeLists.gl.txt
> @@ -12,5 +12,6 @@ piglit_add_executable 
> (arb_transform_feedback3-ext_interleaved_single_stream_man
>  piglit_add_executable 
> (arb_transform_feedback3-ext_interleaved_single_gs_many_streams 
> ext_interleaved_single_gs_many_streams.c)
>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_two_bufs 
> ext_interleaved_two_bufs.c)
>  piglit_add_executable (arb_transform_feedback3-ext_interleaved_draw_streams 
> ext_interleaved_draw_streams.c)
> +piglit_add_executable (arb_transform_feedback3-bind_buffer_invalid_index 
> bind_buffer_invalid_index.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_transform_feedback3/bind_buffer_invalid_index.c 
> b/tests/spec/arb_transform_feedback3/bind_buffer_invalid_index.c
> new file mode 100644
> index 000..18ecf78
> --- /dev/null
> +++ b/tests/spec/arb_transform_feedback3/bind_buffer_invalid_index.c
> @@ -0,0 +1,74 @@
> +/*
> + * Copyright © 2013 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-gl-common.h"
> +
> +/**
> + * @file bind_buffer_invalid_index.c
> + *
> + * Tests that invalid index given to BindBufferRange() or BindBufferBase()
> + * is detected and an error is set. The spec says:
> + *
> + *  "The error INVALID_VALUE is generated by BindBufferRange,
> + *   BindBufferOffsetEXT, or BindBufferBase if  is
> + *   TRANSFORM_FEEDBACK_BUFFER and  is greater than or equal to the
> + *   value of MAX_TRANSFORM_FEEDBACK_BUFFERS."
> + */
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 32;
> + config.supports_gl_core_version = 32;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint xfb;
> +
> + piglit_require_extension("GL_ARB_transform_feedback3");
> +
> + /* Set up the transform feedback buffers. */
> + glGenBuffers(1, &xfb);
> + glBindBufferBase(GL_TRANSFORM_

[Piglit] [PATCH V2 5/6] ARB_sample_shading: Add test to verify the functionality of gl_SamplePosition

2013-10-25 Thread Anuj Phogat
V2: Use better technique to verify sample positions in fragment shader.
Get rid of redundant projection matrix.
Signed-off-by: Anuj Phogat 
---
 tests/all.tests|   5 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../execution/builtin-gl-sample-position.cpp   | 231 +
 3 files changed, 237 insertions(+)
 create mode 100644 
tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp

diff --git a/tests/all.tests b/tests/all.tests
index c5dd80c..9df5a94 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1352,6 +1352,11 @@ for num_samples in TEST_SAMPLE_COUNTS:
 executable = 'arb_sample_shading-{0} -auto'.format(test_name)
 arb_sample_shading[test_name] = PlainExecTest(executable)
 
+for num_samples in TEST_SAMPLE_COUNTS:
+test_name = 'builtin-gl-sample-position {0}'.format(num_samples)
+executable = 'arb_sample_shading-{0} -auto'.format(test_name)
+arb_sample_shading[test_name] = PlainExecTest(executable)
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index d2f1f4a..a832189 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -14,4 +14,5 @@ piglit_add_executable (arb_sample_shading-api api.c)
 piglit_add_executable (arb_sample_shading-builtin-gl-num-samples 
builtin-gl-num-samples.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-id 
builtin-gl-sample-id.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask 
builtin-gl-sample-mask.cpp)
+piglit_add_executable (arb_sample_shading-builtin-gl-sample-position 
builtin-gl-sample-position.cpp)
 # vim: ft=cmake:
diff --git 
a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp 
b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp
new file mode 100644
index 000..17ca45a
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-position.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/** \file builtin-gl-sample-position.cpp
+ *  This test verifies that using gl_SamplePosition in fragment shader
+ *  program works as per ARB_sample_shading specification.
+ *
+ **/
+
+#include "piglit-fbo.h"
+using namespace piglit_util_fbo;
+
+const int pattern_width = 128; const int pattern_height = 128;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_width = pattern_width;
+   config.window_height = pattern_height;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int  num_samples;
+static unsigned prog, vao, vertex_buf;
+static Fbo multisampled_fbo, singlesampled_fbo;
+
+static void
+print_usage_and_exit(char *prog_name)
+{
+   printf("Usage: %s \n", prog_name);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+void
+compile_shader(void)
+{
+   static const char *vert =
+   "#version 130\n"
+   "in vec2 pos;\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = vec4(pos, 0.0, 1.0);\n"
+   "}\n";
+   static const char *frag =
+   "#version 130\n"
+   "#extension GL_ARB_sample_shading : enable\n"
+   "uniform int samples;\n"
+   "uniform vec2 expected_pos[8];\n"
+   "out vec4 out_color;\n"
+   "void main()\n"
+   "{\n"
+   "  if ((expected_pos[gl_SampleID] == gl_SamplePosition) ||\n"
+   "  (samples == 0 && gl_SamplePosition == vec2(0.5, 0.5)))\n"
+ 

[Piglit] [PATCH V2 6/6] ARB_sample_shading: Add compiler tests for new builtins

2013-10-25 Thread Anuj Phogat
Tests gl_SamplePosition,
  gl_SampleID,
  gl_NumSamples,
  gl_SampleMask[]

Signed-off-by: Anuj Phogat 
---
 tests/all.tests |  4 
 tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag   | 12 
 tests/spec/arb_sample_shading/compiler/gl_SampleID.frag | 12 
 tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag   | 13 +
 .../spec/arb_sample_shading/compiler/gl_SamplePosition.frag | 12 
 5 files changed, 53 insertions(+)
 create mode 100644 tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag
 create mode 100644 tests/spec/arb_sample_shading/compiler/gl_SampleID.frag
 create mode 100644 tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag
 create mode 100644 
tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag

diff --git a/tests/all.tests b/tests/all.tests
index 9df5a94..717d41f 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1357,6 +1357,10 @@ for num_samples in TEST_SAMPLE_COUNTS:
 executable = 'arb_sample_shading-{0} -auto'.format(test_name)
 arb_sample_shading[test_name] = PlainExecTest(executable)
 
+import_glsl_parser_tests(spec['ARB_sample_shading'],
+ os.path.join(testsDir, 'spec', 'arb_sample_shading'),
+ ['compiler'])
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag 
b/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag
new file mode 100644
index 000..d99e8b8
--- /dev/null
+++ b/tests/spec/arb_sample_shading/compiler/gl_NumSamples.frag
@@ -0,0 +1,12 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_ARB_sample_shading
+// [end config]
+#version 130
+#extension GL_ARB_sample_shading : enable
+
+int func()
+{
+   return gl_NumSamples;
+}
diff --git a/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag 
b/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag
new file mode 100644
index 000..0d202be
--- /dev/null
+++ b/tests/spec/arb_sample_shading/compiler/gl_SampleID.frag
@@ -0,0 +1,12 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_ARB_sample_shading
+// [end config]
+#version 130
+#extension GL_ARB_sample_shading : enable
+
+int func()
+{
+   return gl_SampleID;
+}
diff --git a/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag 
b/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag
new file mode 100644
index 000..1e659bc
--- /dev/null
+++ b/tests/spec/arb_sample_shading/compiler/gl_SampleMask.frag
@@ -0,0 +1,13 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_ARB_sample_shading
+// [end config]
+#version 130
+#extension GL_ARB_sample_shading : enable
+
+int func()
+{
+gl_SampleMask[0] = 0xff;
+   return 0;
+}
diff --git a/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag 
b/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag
new file mode 100644
index 000..be42d90
--- /dev/null
+++ b/tests/spec/arb_sample_shading/compiler/gl_SamplePosition.frag
@@ -0,0 +1,12 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// require_extensions: GL_ARB_sample_shading
+// [end config]
+#version 130
+#extension GL_ARB_sample_shading : enable
+
+vec2 func()
+{
+   return gl_SamplePosition;
+}
-- 
1.8.1.4

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH V2 4/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleMask[]

2013-10-25 Thread Anuj Phogat
V2: Get rid of redundant projection matrix.
Signed-off-by: Anuj Phogat 
---
 tests/all.tests|   5 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../execution/builtin-gl-sample-mask.cpp   | 236 +
 3 files changed, 242 insertions(+)
 create mode 100644 
tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp

diff --git a/tests/all.tests b/tests/all.tests
index d861a91..c5dd80c 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1347,6 +1347,11 @@ for num_samples in TEST_SAMPLE_COUNTS:
 executable = 'arb_sample_shading-{0} -auto'.format(test_name)
 arb_sample_shading[test_name] = PlainExecTest(executable)
 
+for num_samples in TEST_SAMPLE_COUNTS:
+test_name = 'builtin-gl-sample-mask {0}'.format(num_samples)
+executable = 'arb_sample_shading-{0} -auto'.format(test_name)
+arb_sample_shading[test_name] = PlainExecTest(executable)
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index 35f2905..d2f1f4a 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -13,4 +13,5 @@ link_libraries (
 piglit_add_executable (arb_sample_shading-api api.c)
 piglit_add_executable (arb_sample_shading-builtin-gl-num-samples 
builtin-gl-num-samples.cpp)
 piglit_add_executable (arb_sample_shading-builtin-gl-sample-id 
builtin-gl-sample-id.cpp)
+piglit_add_executable (arb_sample_shading-builtin-gl-sample-mask 
builtin-gl-sample-mask.cpp)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp 
b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp
new file mode 100644
index 000..2b4e7d7
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-mask.cpp
@@ -0,0 +1,236 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/** \file builtin-gl-sample-mask.cpp
+ *  This test verifies that supplying a value to gl_SampleMask[]
+ *  in fragment shader program works as per ARB_sample_shading
+ *  specification.
+ **/
+
+#include "piglit-fbo.h"
+using namespace piglit_util_fbo;
+
+const int pattern_width = 128; const int pattern_height = 128;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_width = pattern_width;
+   config.window_height = pattern_height;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int  num_samples;
+static unsigned prog, vao, vertex_buf;
+static Fbo multisampled_fbo, singlesampled_fbo;
+
+static void
+print_usage_and_exit(char *prog_name)
+{
+   printf("Usage: %s \n", prog_name);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+void
+compile_shader(void)
+{
+   static const char *vert =
+   "#version 130\n"
+   "in vec2 pos;\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = vec4(pos, 0.0, 1.0);\n"
+   "}\n";
+   static const char *frag =
+   "#version 130\n"
+   "#extension GL_ARB_sample_shading : enable\n"
+   "uniform int sample_mask;\n"
+   "out vec4 out_color;\n"
+   "void main()\n"
+   "{\n"
+   "  gl_SampleMask[0] = sample_mask;\n"
+   "  out_color = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "}\n";
+   /* Compile program */
+   prog = glCreateProgram();
+   GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
+   glAttachShader(prog, vs);
+   piglit_check_gl_error(GL_NO_ERROR);
+   GLint fs = piglit_compile_sha

[Piglit] [PATCH V2 3/6] ARB_sample_shading: Add test to verify the functionality of gl_SampleID

2013-10-25 Thread Anuj Phogat
V2: Get rid of redundant projection matrix.
Signed-off-by: Anuj Phogat 
---
 tests/all.tests|   5 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../execution/builtin-gl-sample-id.cpp | 230 +
 3 files changed, 236 insertions(+)
 create mode 100644 
tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp

diff --git a/tests/all.tests b/tests/all.tests
index 1fcd08a..d861a91 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1342,6 +1342,11 @@ for num_samples in TEST_SAMPLE_COUNTS:
 executable = 'arb_sample_shading-{0} -auto'.format(test_name)
 arb_sample_shading[test_name] = PlainExecTest(executable)
 
+for num_samples in TEST_SAMPLE_COUNTS:
+test_name = 'builtin-gl-sample-id {0}'.format(num_samples)
+executable = 'arb_sample_shading-{0} -auto'.format(test_name)
+arb_sample_shading[test_name] = PlainExecTest(executable)
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index 56fa0da..35f2905 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -12,4 +12,5 @@ link_libraries (
 
 piglit_add_executable (arb_sample_shading-api api.c)
 piglit_add_executable (arb_sample_shading-builtin-gl-num-samples 
builtin-gl-num-samples.cpp)
+piglit_add_executable (arb_sample_shading-builtin-gl-sample-id 
builtin-gl-sample-id.cpp)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp 
b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp
new file mode 100644
index 000..143dc95
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-sample-id.cpp
@@ -0,0 +1,230 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/** \file builtin-gl-sample-id.cpp
+ *  This test verifies that using gl_SampleID in fragment shader program
+ *  works as per ARB_sample_shading specification.
+ *
+ **/
+
+#include "piglit-fbo.h"
+using namespace piglit_util_fbo;
+
+const int pattern_width = 128; const int pattern_height = 128;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_width = pattern_width;
+   config.window_height = pattern_height;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int  num_samples;
+static unsigned prog, vao, vertex_buf;
+static Fbo multisampled_fbo, singlesampled_fbo;
+
+static void
+print_usage_and_exit(char *prog_name)
+{
+   printf("Usage: %s \n", prog_name);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+void
+compile_shader(void)
+{
+   static const char *vert =
+   "#version 130\n"
+   "in vec2 pos;\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = vec4(pos, 0.0, 1.0);\n"
+   "}\n";
+   static const char *frag =
+   "#version 130\n"
+   "#extension GL_ARB_sample_shading : enable\n"
+   "uniform int samples;\n"
+   "out vec4 out_color;\n"
+   "void main()\n"
+   "{\n"
+   "  if(samples == 0)\n"
+   "out_color = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "  else\n"
+   "out_color = vec4(0.0, float(gl_SampleID) / samples, 0.0, 
1.0);\n"
+   "}\n";
+   /* Compile program */
+   prog = glCreateProgram();
+   GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
+   glAttachShader(prog, vs);
+   piglit_check_gl_error(GL_NO_ERROR);
+   GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER

[Piglit] [PATCH V2 1/6] ARB_sample_shading: Add test to verify new functions and enums

2013-10-25 Thread Anuj Phogat
Tests basic functionality of function:
MinSampleShadingARB()
and enums:
SAMPLE_SHADING_ARB
MIN_SAMPLE_SHADING_VALUE_ARB

Signed-off-by: Anuj Phogat 
---
 tests/all.tests|  5 ++
 tests/spec/CMakeLists.txt  |  1 +
 tests/spec/arb_sample_shading/CMakeLists.txt   |  1 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt | 14 +
 .../arb_sample_shading/execution/CMakeLists.txt|  1 +
 tests/spec/arb_sample_shading/execution/api.c  | 69 ++
 6 files changed, 91 insertions(+)
 create mode 100644 tests/spec/arb_sample_shading/CMakeLists.txt
 create mode 100644 tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
 create mode 100644 tests/spec/arb_sample_shading/execution/CMakeLists.txt
 create mode 100644 tests/spec/arb_sample_shading/execution/api.c

diff --git a/tests/all.tests b/tests/all.tests
index 9502ead..e30eb3b 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1331,6 +1331,11 @@ arb_sampler_objects['sampler-incomplete'] = 
concurrent_test('arb_sampler_objects
 arb_sampler_objects['GL_EXT_texture_sRGB_decode'] = 
concurrent_test('arb_sampler_objects-srgb-decode')
 arb_sampler_objects['framebufferblit'] = 
plain_test('arb_sampler_objects-framebufferblit')
 
+# Group ARB_sample_shading
+arb_sample_shading = Group()
+spec['ARB_sample_shading'] = arb_sample_shading
+add_plain_test(arb_sample_shading, 'arb_sample_shading-api')
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b846d..4951c3c 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -18,6 +18,7 @@ add_subdirectory (arb_occlusion_query)
 add_subdirectory (arb_occlusion_query2)
 add_subdirectory (arb_provoking_vertex)
 add_subdirectory (arb_robustness)
+add_subdirectory (arb_sample_shading)
 add_subdirectory (arb_sampler_objects)
 add_subdirectory (arb_seamless_cube_map)
 add_subdirectory (amd_seamless_cubemap_per_texture)
diff --git a/tests/spec/arb_sample_shading/CMakeLists.txt 
b/tests/spec/arb_sample_shading/CMakeLists.txt
new file mode 100644
index 000..bb76f08
--- /dev/null
+++ b/tests/spec/arb_sample_shading/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory (execution)
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
new file mode 100644
index 000..36289e0
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+   ${piglit_SOURCE_DIR}/tests/spec/arb_sample_shading
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+piglit_add_executable (arb_sample_shading-api api.c)
+# vim: ft=cmake:
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_sample_shading/execution/api.c 
b/tests/spec/arb_sample_shading/execution/api.c
new file mode 100644
index 000..bb3f55b
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/api.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/**
+ * @file api.c
+ *
+ * Tests new APIs and enums added by ARB_sample_shading spec:
+ */
+
+
+#include "piglit-util-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{

[Piglit] [PATCH V2 2/6] ARB_sample_shading: Add test to verify the functionality of gl_NumSamples

2013-10-25 Thread Anuj Phogat
V2: Get rid of redundant projection matrix.
Signed-off-by: Anuj Phogat 
---
 tests/all.tests|   6 +
 .../arb_sample_shading/execution/CMakeLists.gl.txt |   1 +
 .../execution/builtin-gl-num-samples.cpp   | 220 +
 3 files changed, 227 insertions(+)
 create mode 100644 
tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp

diff --git a/tests/all.tests b/tests/all.tests
index e30eb3b..1fcd08a 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1336,6 +1336,12 @@ arb_sample_shading = Group()
 spec['ARB_sample_shading'] = arb_sample_shading
 add_plain_test(arb_sample_shading, 'arb_sample_shading-api')
 
+TEST_SAMPLE_COUNTS = (0, 2, 4, 6, 8, 16, 32)
+for num_samples in TEST_SAMPLE_COUNTS:
+test_name = 'builtin-gl-num-samples {0}'.format(num_samples)
+executable = 'arb_sample_shading-{0} -auto'.format(test_name)
+arb_sample_shading[test_name] = PlainExecTest(executable)
+
 # Group ARB_debug_output
 arb_debug_output = Group()
 spec['ARB_debug_output'] = arb_debug_output
diff --git a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt 
b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
index 36289e0..56fa0da 100644
--- a/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
+++ b/tests/spec/arb_sample_shading/execution/CMakeLists.gl.txt
@@ -11,4 +11,5 @@ link_libraries (
 )
 
 piglit_add_executable (arb_sample_shading-api api.c)
+piglit_add_executable (arb_sample_shading-builtin-gl-num-samples 
builtin-gl-num-samples.cpp)
 # vim: ft=cmake:
diff --git a/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp 
b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
new file mode 100644
index 000..585fb75
--- /dev/null
+++ b/tests/spec/arb_sample_shading/execution/builtin-gl-num-samples.cpp
@@ -0,0 +1,220 @@
+/*
+ * Copyright © 2013 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.
+ */
+
+/** \file builtin-gl-num-samples.cpp
+ *  This test verifies that using gl_NumSamples in fragment shader
+ *  program works as per ARB_sample_shading specification.
+ *
+ **/
+
+#include "piglit-fbo.h"
+using namespace piglit_util_fbo;
+
+const int pattern_width = 128; const int pattern_height = 128;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_width = pattern_width;
+   config.window_height = pattern_height;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int  num_samples;
+static unsigned prog, vao, vertex_buf;
+static Fbo multisampled_fbo, singlesampled_fbo;
+
+static void
+print_usage_and_exit(char *prog_name)
+{
+   printf("Usage: %s \n", prog_name);
+   piglit_report_result(PIGLIT_FAIL);
+}
+
+void
+compile_shader(void)
+{
+   static const char *vert =
+   "#version 130\n"
+   "uniform mat4 proj;\n"
+   "in vec2 pos;\n"
+   "void main()\n"
+   "{\n"
+   "  gl_Position = vec4(pos, 0.0, 1.0);\n"
+   "}\n";
+   static const char *frag =
+   "#version 130\n"
+   "#extension GL_ARB_sample_shading : require\n"
+   "uniform int samples;\n"
+   "out vec4 out_color;\n"
+   "void main()\n"
+   "{\n"
+   "  if (gl_NumSamples == samples)\n"
+   "out_color = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "  else\n"
+   "out_color = vec4(1.0, 0.0, 0.0, 1.0);\n"
+   "}\n";
+   /* Compile program */
+   prog = glCreateProgram();
+   GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert);
+   glAttachShader(prog, vs);
+   piglit_check_gl_error(GL_NO_ERROR);
+   GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag);
+   glAttachShade

[Piglit] [PATCH] cl: Add sqrt tests

2013-10-25 Thread Aaron Watry
Pretty basic, but we didn't have any tests for this before...

Tested on r600g w/ CEDAR.
---
 generated_tests/generate-cl-math-builtins.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/generated_tests/generate-cl-math-builtins.py 
b/generated_tests/generate-cl-math-builtins.py
index b6b4e43..150c412 100644
--- a/generated_tests/generate-cl-math-builtins.py
+++ b/generated_tests/generate-cl-math-builtins.py
@@ -57,6 +57,14 @@ tests = {
 [1.0, -1.0, 0.0, -0.0, 0.0],
 [0.5, -0.5, 0.0, -0.0, float("nan")]
 ]
+},
+'sqrt' : {
+'arg_types': [F, F],
+'function_type': 'ttt',
+'values': [
+[1.0, 2.0,  6.0, 2.5 , float("nan"), 4.0], # Result
+[1.0, 4.0, 36.0, 6.25, float("nan"), 16.0], # Arg1
+]
 }
 }
 
-- 
1.8.3.2

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 2/2] summary.py: Replace buildDictionary function with a much simpler method

2013-10-25 Thread Dylan Baker
This patch produces the exact same output as the previous approach, just
in a much simpler way. It also moves some more of the status information
out of if branches and into the Status class in the status module.

There are a few side effects of using a defaultdict class, namely that
they do not generate a KeyError when one calls for a non existent key.
This means there are a couple of places where try/except blocks are
replaced by if checks.

v2: - fix HTMLIndex._groupResult()
- don't overwrite the previous status with skip
- Use a helper function to reduce code duplication

Tested-by: Ben Widawsky 
Signed-off-by: Dylan Baker 
---
 framework/status.py  |   6 +-
 framework/summary.py | 153 +++
 2 files changed, 48 insertions(+), 111 deletions(-)

diff --git a/framework/status.py b/framework/status.py
index a265317..2fe153e 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -104,10 +104,11 @@ class Status(object):
 
 # Using __slots__ allows us to implement the flyweight pattern, limiting
 # the memory consumed for creating tens of thousands of these objects.
-__slots__ = ['name', 'value']
+__slots__ = ['name', 'value', 'fraction']
 
 name = None
 value = None
+fraction = (0, 1)
 
 def __init__(self):
 raise NotImplementedError
@@ -149,6 +150,7 @@ class Status(object):
 class NotRun(Status):
 name = 'Not Run'
 value = 0
+fraction = (0, 0)
 
 def __init__(self):
 pass
@@ -157,6 +159,7 @@ class NotRun(Status):
 class Pass(Status):
 name = 'pass'
 value = 10
+fraction = (1, 1)
 
 def __init__(self):
 pass
@@ -205,6 +208,7 @@ class Crash(Status):
 class Skip(Status):
 name = 'skip'
 value = 50
+fraction = (0, 0)
 
 def __init__(self):
 pass
diff --git a/framework/summary.py b/framework/summary.py
index f5af627..eaba2b3 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -23,12 +23,14 @@ import os
 import os.path as path
 import itertools
 import shutil
+import collections
 from mako.template import Template
 
-import core
 # a local variable status exists, prevent accidental overloading by renaming
 # the module
 import status as so
+import core
+
 
 __all__ = [
 'Summary',
@@ -141,13 +143,9 @@ class HTMLIndex(list):
 currentDir.append(localGroup)
 for each in summary.results:
 # Decide which fields need to be updated
-try:
-self._groupResult(summary.fractions[each.name]
-  [path.join(*currentDir)],
-  summary.status[each.name]
-  [path.join(*currentDir)])
-except KeyError:
-self._groupResult((0, 0), 'skip')
+self._groupResult(
+summary.fractions[each.name][path.join(*currentDir)],
+summary.status[each.name][path.join(*currentDir)])
 
 # After each group increase the depth by one
 depth += 1
@@ -194,6 +192,9 @@ class HTMLIndex(list):
 Helper function for appending the results of groups to the
 HTML summary file.
 """
+# "Not Run" is not a valid css class replace it with skip
+if isinstance(css, so.NotRun):
+css = 'skip'
 
 self.append({'type': "groupResult",
  'class': css,
@@ -245,98 +246,6 @@ class Summary:
 piglit-run.
 """
 
-def buildDictionary(summary):
-# Build a dictionary from test name to pass count/total count, i.e.
-# counts['spec/glsl/foo'] == (456, 800)
-counts = {}
-
-if not summary.tests:
-return {}
-
-lastGroup = ''
-
-# Build a dictionary of group stati, passing groupname = status.
-# This is the "worst" status of the group in descending order:
-# crash, skip, fail, warn, pass
-status = {}
-
-# currentStack is a stack containing numerical values that that
-# relate to a status output, 5 for crash, 4 for skip, 3 for fail, 2
-# for warn, 1 for pass
-currentStatus = []
-
-# Stack contains tuples like: (pass count, total count)
-stack = []
-
-def openGroup(name):
-stack.append((0, 0))
-
-# Since NotRun is the "lowest" status for HTML generation, if
-# there is another status it will replace skip
-currentStatus.append(so.NotRun())
-
-def closeGroup(group_name):
-# We're done with this group, record the number of pass/total
-# in the dictionary.
-(nr_pass, nr_total) = stack.pop()
-counts[group_name] = (nr_pass, 

[Piglit] [PATCH v2 1/2] status.py: convert status object attributes from instance to class

2013-10-25 Thread Dylan Baker
This converts Status objects attributes to class attributes. This should
reduce lookup time and memory consumption of these classes.

Tested-by: Ben Widawsky 
Signed-off-by: Dylan Baker 
---
 framework/status.py | 51 +++
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/framework/status.py b/framework/status.py
index 5267380..a265317 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -106,6 +106,9 @@ class Status(object):
 # the memory consumed for creating tens of thousands of these objects.
 __slots__ = ['name', 'value']
 
+name = None
+value = None
+
 def __init__(self):
 raise NotImplementedError
 
@@ -144,48 +147,64 @@ class Status(object):
 
 
 class NotRun(Status):
+name = 'Not Run'
+value = 0
+
 def __init__(self):
-self.name = 'Not Run'
-self.value = 0
+pass
 
 
 class Pass(Status):
+name = 'pass'
+value = 10
+
 def __init__(self):
-self.name = 'pass'
-self.value = 10
+pass
 
 
 class DmesgWarn(Status):
+name = 'dmesg-warn'
+value = 20
+
 def __init__(self):
-self.name = 'dmesg-warn'
-self.value = 20
+pass
 
 
 class Warn(Status):
+name = 'warn'
+value = 25
+
 def __init__(self):
-self.name = 'warn'
-self.value = 25
+pass
 
 
 class DmesgFail(Status):
+name = 'dmesg-fail'
+value = 30
+
 def __init__(self):
-self.name = 'dmesg-fail'
-self.value = 30
+pass
 
 
 class Fail(Status):
+name = 'fail'
+value = 35
+
 def __init__(self):
-self.name = 'fail'
-self.value = 35
+pass
 
 
 class Crash(Status):
+name = 'crash'
+value = 40
+
 def __init__(self):
-self.name = 'crash'
-self.value = 40
+pass
 
 
 class Skip(Status):
+name = 'skip'
+value = 50
+
 def __init__(self):
-self.name = 'skip'
-self.value = 50
+pass
-- 
1.8.1.5

___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 5/7] ARB_texture_view: Test for rendering various targets in texture view

2013-10-25 Thread Brian Paul

On 10/25/2013 10:41 AM, Jon Ashburn wrote:

RE your comment:

+config.window_width = 128;
+config.window_height = 128;


"Is 128 special?  Can you just go with the defaults?  In the past we've
had trouble on Windows when the width is < 130 or so pixels.  Long story. "


128 isn't special  and I could use a larger number (>130). However,
since a line is drawn diagonally across the full screen and sampled in
its middle by this test, certain width and height combinations  fail.
The default values  work but I am worried about the user overiding  the
default value (not sure how that behaves). Other option is to make the
test  more robust to varying  window width and heights rather than
fixing the window width and height to a value that samples correctly.


OK, if you pick a size like 200x200 or 256x256 we should be OK.  People 
seldom resize piglit windows.


-Brian


___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] query_renderer: Add some common infrastructure for GLX_MESA_query_renderer tests

2013-10-25 Thread Ian Romanick
From: Ian Romanick 

All of the tests for this extension will require a bunch of function
pointers, etc.  This patch adds a function to get these function
pointers and some macros to wrap calls using them.

Signed-off-by: Ian Romanick 
---
 .../query-renderer-common.c| 70 +
 .../query-renderer-common.h| 72 ++
 2 files changed, 142 insertions(+)
 create mode 100644 tests/spec/glx_mesa_query_renderer/query-renderer-common.c
 create mode 100644 tests/spec/glx_mesa_query_renderer/query-renderer-common.h

diff --git a/tests/spec/glx_mesa_query_renderer/query-renderer-common.c 
b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c
new file mode 100644
index 000..429f360
--- /dev/null
+++ b/tests/spec/glx_mesa_query_renderer/query-renderer-common.c
@@ -0,0 +1,70 @@
+/* Copyright © 2013 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-gl-common.h"
+#include "piglit-glx-util.h"
+#include "query-renderer-common.h"
+
+PFNGLXQUERYRENDERERSTRINGMESAPROC __piglit_glXQueryRendererStringMESA = NULL;
+PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC 
__piglit_glXQueryCurrentRendererStringMESA = NULL;
+PFNGLXQUERYRENDERERINTEGERMESAPROC __piglit_glXQueryRendererIntegerMESA = NULL;
+PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC 
__piglit_glXQueryCurrentRendererIntegerMESA = NULL;
+PFNGLXCREATECONTEXTATTRIBSARBPROC __piglit_glXCreateContextAttribsARB = NULL;
+
+static void *
+get_and_verify_proc(const char *name)
+{
+   void *func;
+
+   func = glXGetProcAddress((GLubyte *) name);
+   if (func == NULL) {
+   fprintf(stderr, "Could not get function pointer for %s\n",
+   name);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   return func;
+}
+
+void
+initialize_function_pointers(Display *dpy)
+{
+   piglit_require_glx_extension(dpy, "GLX_MESA_query_renderer");
+
+   __piglit_glXQueryRendererStringMESA =
+   (PFNGLXQUERYRENDERERSTRINGMESAPROC)
+   get_and_verify_proc("glXQueryRendererStringMESA");
+   __piglit_glXQueryCurrentRendererStringMESA =
+   (PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC)
+   get_and_verify_proc("glXQueryCurrentRendererStringMESA");
+   __piglit_glXQueryRendererIntegerMESA =
+   (PFNGLXQUERYRENDERERINTEGERMESAPROC)
+   get_and_verify_proc("glXQueryRendererIntegerMESA");
+   __piglit_glXQueryCurrentRendererIntegerMESA =
+   (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)
+   get_and_verify_proc("glXQueryCurrentRendererIntegerMESA");
+
+   piglit_require_glx_extension(dpy, "GLX_ARB_create_context");
+
+   __piglit_glXCreateContextAttribsARB =
+   (PFNGLXCREATECONTEXTATTRIBSARBPROC)
+   get_and_verify_proc("glXCreateContextAttribsARB");
+}
diff --git a/tests/spec/glx_mesa_query_renderer/query-renderer-common.h 
b/tests/spec/glx_mesa_query_renderer/query-renderer-common.h
new file mode 100644
index 000..4dc0b0a
--- /dev/null
+++ b/tests/spec/glx_mesa_query_renderer/query-renderer-common.h
@@ -0,0 +1,72 @@
+/* Copyright © 2013 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", WITHO

[Piglit] [PATCH 2/2] query_renderer: Add test that compares values from glXQueryRendererIntegerMESA et al

2013-10-25 Thread Ian Romanick
From: Ian Romanick 

Verifies that all values from glXQueryRendererIntegerMESA,
glXQueryCurrentRendererIntegerMESA, glXQueryRendererStringMESA, and
glXQueryCurrentRendererStringMESA can be queried.  It also verifies that
each of the Current and non-Current versions returns the same value for
each query.

Signed-off-by: Ian Romanick 
---
This test currently fails on Mesa master with the
GLX_MESA_query_renderer patches on the mesa-dev list.  It appears that
Adam's d101204 commit breaks some calls to glXMakeContextCurrent.  I'm
tracking down the root cause of that problem now.  With that patch
reverted, everything here passes.

 tests/all.tests|   4 +
 tests/spec/CMakeLists.txt  |   1 +
 .../spec/glx_mesa_query_renderer/CMakeLists.gl.txt |  28 +++
 tests/spec/glx_mesa_query_renderer/CMakeLists.txt  |   1 +
 tests/spec/glx_mesa_query_renderer/coverage.c  | 275 +
 5 files changed, 309 insertions(+)
 create mode 100644 tests/spec/glx_mesa_query_renderer/CMakeLists.gl.txt
 create mode 100644 tests/spec/glx_mesa_query_renderer/CMakeLists.txt
 create mode 100644 tests/spec/glx_mesa_query_renderer/coverage.c

diff --git a/tests/all.tests b/tests/all.tests
index e5e63e4..1d2a916 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -468,6 +468,10 @@ oml_sync_control['swapbuffersmsc-return swap_interval 0'] 
= concurrent_test('glx
 oml_sync_control['swapbuffersmsc-return swap_interval 1'] = 
concurrent_test('glx-oml-sync-control-swapbuffersmsc-return 1')
 oml_sync_control['waitformsc'] = 
concurrent_test('glx-oml-sync-control-waitformsc')
 
+mesa_query_renderer = Group()
+glx['GLX_MESA_query_renderer'] = mesa_query_renderer
+mesa_query_renderer['coverage'] = 
concurrent_test('glx-query-renderer-coverage')
+
 def texwrap_test(args):
 test = PlainExecTest(['texwrap', '-fbo', '-auto'] + args)
 test.runConcurrent = True
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 18b846d..a2903d8 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -77,6 +77,7 @@ add_subdirectory (gles-2.0)
 add_subdirectory (gles-3.0)
 add_subdirectory (glx_arb_create_context)
 add_subdirectory (glx_ext_import_context)
+add_subdirectory (glx_mesa_query_renderer)
 add_subdirectory (glx_oml_sync_control)
 add_subdirectory (arb_vertex_type_2_10_10_10_rev)
 add_subdirectory (ext_texture_array)
diff --git a/tests/spec/glx_mesa_query_renderer/CMakeLists.gl.txt 
b/tests/spec/glx_mesa_query_renderer/CMakeLists.gl.txt
new file mode 100644
index 000..f51ceff
--- /dev/null
+++ b/tests/spec/glx_mesa_query_renderer/CMakeLists.gl.txt
@@ -0,0 +1,28 @@
+
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+if(PIGLIT_BUILD_GLX_TESTS)
+link_libraries (
+piglitglxutil
+)
+endif(PIGLIT_BUILD_GLX_TESTS)
+
+link_libraries (
+   ${OPENGL_gl_LIBRARY}
+   ${OPENGL_glu_LIBRARY}
+)
+
+IF(PIGLIT_BUILD_GLX_TESTS)
+   include_directories(
+   ${GLPROTO_INCLUDE_DIRS}
+   )
+   link_libraries (
+   ${X11_X11_LIB}
+   )
+   piglit_add_executable (glx-query-renderer-coverage coverage.c 
query-renderer-common.c)
+ENDIF(PIGLIT_BUILD_GLX_TESTS)
+
+# vim: ft=cmake:
diff --git a/tests/spec/glx_mesa_query_renderer/CMakeLists.txt 
b/tests/spec/glx_mesa_query_renderer/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/glx_mesa_query_renderer/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/glx_mesa_query_renderer/coverage.c 
b/tests/spec/glx_mesa_query_renderer/coverage.c
new file mode 100644
index 000..2f5367c
--- /dev/null
+++ b/tests/spec/glx_mesa_query_renderer/coverage.c
@@ -0,0 +1,275 @@
+/* Copyright © 2013 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-gl-common.

Re: [Piglit] [PATCH 5/7] ARB_texture_view: Test for rendering various targets in texture view

2013-10-25 Thread Jon Ashburn

RE your comment:

+config.window_width = 128;
+config.window_height = 128;


"Is 128 special?  Can you just go with the defaults?  In the past we've 
had trouble on Windows when the width is < 130 or so pixels.  Long story. "



128 isn't special  and I could use a larger number (>130). However, 
since a line is drawn diagonally across the full screen and sampled in 
its middle by this test, certain width and height combinations  fail.  
The default values  work but I am worried about the user overiding  the 
default value (not sure how that behaves). Other option is to make the 
test  more robust to varying  window width and heights rather than 
fixing the window width and height to a value that samples correctly.


Jon
On 10/24/2013 05:56 PM, Brian Paul wrote:

I didn't really study this test, but some things jumped out...


On 10/24/2013 03:49 PM, Jon Ashburn wrote:

Tests GL_ARB_texture_view rendering with various texture targets.
Creates texture maps with different solid colors for each level or layer
reads the framebuffer to ensure the rendered color is correct.

Tested on Nvidia  Quadro 600, all subtests pass.
---
  tests/all.tests|   1 +
  tests/spec/arb_texture_view/CMakeLists.gl.txt  |   1 +
  tests/spec/arb_texture_view/common.c   | 109 +-
  tests/spec/arb_texture_view/common.h   |  19 +-
  tests/spec/arb_texture_view/rendering_target.c | 269 
+

  5 files changed, 396 insertions(+), 3 deletions(-)
  create mode 100644 tests/spec/arb_texture_view/rendering_target.c

diff --git a/tests/all.tests b/tests/all.tests
index 8784e24..5941eb2 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1476,6 +1476,7 @@ arb_texture_view['params'] = 
concurrent_test('arb_texture_view-params')
  arb_texture_view['formats'] = 
concurrent_test('arb_texture_view-formats')
  arb_texture_view['targets'] = 
concurrent_test('arb_texture_view-targets')
  arb_texture_view['queries'] = 
concurrent_test('arb_texture_view-queries')
+arb_texture_view['rendering-target'] = 
concurrent_test('arb_texture_view-rendering-target')


  tdfx_texture_compression_fxt1 = Group()
  spec['3DFX_texture_compression_FXT1'] = tdfx_texture_compression_fxt1
diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt 
b/tests/spec/arb_texture_view/CMakeLists.gl.txt

index 6945a05..6b69bb1 100644
--- a/tests/spec/arb_texture_view/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
@@ -14,5 +14,6 @@ piglit_add_executable(arb_texture_view-params 
params.c)

  piglit_add_executable(arb_texture_view-formats formats.c common.c)
  piglit_add_executable(arb_texture_view-targets targets.c common.c)
  piglit_add_executable(arb_texture_view-queries queries.c)
+piglit_add_executable(arb_texture_view-rendering-target 
rendering_target.c common.c)


  # vim: ft=cmake:
diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c

index f8ecb9e..acbcfad 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -36,7 +36,46 @@
   * the variable parameters.
   */

-unsigned int update_valid_arrays(GLenum *valid, GLenum *invalid,
+GLubyte Colors[][8] = {
+{127,0,   0, 255,  0, 10, 20,  0},
+{  0, 127,   0, 255,  0,  0, 80, 90},
+{  0,0, 127, 255, 25,  0,  0, 60},
+{  0, 127, 127, 255, 15, 15,  0,  0},
+{127,0, 127, 255,  0,  2, 50,  0},
+{127, 127,   0, 255, 80, 10, 70, 20},
+{255,0,   0, 255, 60,  0, 40, 30},
+{  0, 255,   0, 255, 50, 20,  2, 40},
+{  0,0, 255, 255, 40,  0,  1,  0},
+{  0, 255, 255, 255, 30,  5,  3,  8},
+{255,0, 255, 255, 20, 18,  4,  7},
+{255, 255,   0, 255,  10, 24, 77, 67},
+{255, 255, 255, 255,  5,  33, 88, 44}
+};
+
+/**
+ * Create a single-color image. Up to 64 bits per pixel depending 
upon bytes

+ */
+GLubyte *
+create_solid_image(GLint w, GLint h, GLint d, const unsigned int bytes,
+   const unsigned int idx)
+{
+GLubyte *buf = (GLubyte *) malloc(w * h * d * bytes);
+int i,j;
+
+if (buf == NULL || idx > (sizeof(Colors) / bytes - 1)) {
+free(buf);
+return NULL;
+}
+for (i = 0; i < w * h * d; i++) {
+for (j = 0; j < bytes; j++) {
+buf[i*bytes+j] = Colors[idx][j];
+}
+}
+return buf;
+}
+
+unsigned int
+update_valid_arrays(GLenum *valid, GLenum *invalid,
   unsigned int numInvalid, ... )
  {
  va_list args;
@@ -58,3 +97,71 @@ unsigned int update_valid_arrays(GLenum *valid, 
GLenum *invalid,

  va_end(args);
  return num;
  }
+
+/**
+ * Draw a textured line  from x, y to x+w, y+h. Use tex coordinates 
0.0 to 1.0

+ */
+void
+draw_line(float x, float y, float w, float h)
+{
+GLfloat vertices[6] =  {x, y, 0.0, x+w, y+h, 0.0};
+GLuint elements[4] = {0, 1};
+GLfloat texcoords[2] = {0.0, 1.0};
+
+glVertexPointer(3, GL_FLOAT, 0, v