[Piglit] [PATCH] Fix occlusion query test to expect succesful Gen/DeleteQueries while active

2013-10-30 Thread Carl Worth
A recent inspection of the latest OpenGL specification revealed that
there is no requirement for errors to be generated if GenQueries or
DeleteQueries are called while a query is active.

Specifically, in Section 4.2 of OpenGL 4.4 (Core Profile) the only
errors specified for GenQueries and DeleteQueries is INVALID_VALUE if
the ID is negative.

Additionally, the same section specifies what to do in case the active
query is deleted:

If an active query object is deleted its name immediately
becomes unused,...

Implementing this requires that DeleteQueries be able to succeed when
a query is active.
---

Sorry I missed this test update when I submitted and pushed the recent
patches to Mesa implementing this behavior.

 tests/glean/toccluqry.cpp | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tests/glean/toccluqry.cpp b/tests/glean/toccluqry.cpp
index 580c346..0ea2d37 100644
--- a/tests/glean/toccluqry.cpp
+++ b/tests/glean/toccluqry.cpp
@@ -377,8 +377,8 @@ bool OccluQryTest::conformOQ_EndAfter(GLuint id)
 }
 
 
-/* Calling either GenQueriesARB while any query of any target is active causes
- * an INVALID_OPERATION error to be generated. */
+/* Calling either GenQueriesARB while any query of any target is active
+ * should not cause any error to be generated. */
 bool OccluQryTest::conformOQ_GenIn(GLuint id)
 {
int pass = true;
@@ -386,9 +386,9 @@ bool OccluQryTest::conformOQ_GenIn(GLuint id)
START_QUERY(id);
 
glGenQueriesARB_func(1, &id);
-   if (glGetError() != GL_INVALID_OPERATION) {
-   reportError("No GL_INVALID_OPERATION generated if "
-   "GenQueries in the progress of another.");
+   if (glGetError() != GL_NO_ERROR) {
+   reportError("Error generated when GenQueries called "
+   "in the progress of another.");
pass = false;
}
   
@@ -398,20 +398,22 @@ bool OccluQryTest::conformOQ_GenIn(GLuint id)
 }
 
 
-/* Calling either DeleteQueriesARB while any query of any target is active 
causes
- * an INVALID_OPERATION error to be generated. */
+/* Calling either DeleteQueriesARB while any query of any target is active
+ * should not cause any error to be generated. */
 bool OccluQryTest::conformOQ_DeleteIn(GLuint id)
 {
int pass = true;
+   unsigned int another_id;
 
START_QUERY(id);
 
if (id > 0) {
-   glDeleteQueriesARB_func(1, &id);
+   glGenQueriesARB_func(1, &another_id);
+   glDeleteQueriesARB_func(1, &another_id);
 
-   if (glGetError() != GL_INVALID_OPERATION) {
-   reportError("No GL_INVALID_OPERATION generated if "
-   "DeleteQueries in the progress of another.");
+   if (glGetError() != GL_NO_ERROR) {
+   reportError("Error generated when DeleteQueries called "
+   "in the progress of another.");
pass = false;
}
}
-- 
1.8.4.rc3

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


Re: [Piglit] New test for partial blits after a buffer swap

2013-10-30 Thread Federico Mena Quintero
On Wed, 2013-10-30 at 07:00 -0700, Paul Berry wrote:
> On 29 October 2013 14:46, Eric Anholt  wrote:

> 
>/* FIXME: Does EGL support front buffer rendering at all?
> */
> 
> 
> FYI, we discussed this issue back in May but didn't really come to a
> clear consensus of what we wanted to do about it:
> http://lists.freedesktop.org/archives/mesa-dev/2013-May/040059.html.
> (Note that the replies happened in July so the mesa-dev archives don't
> thread them well.  See
> http://lists.freedesktop.org/archives/mesa-dev/2013-June/subject.html#40129 
> for the replies.)

Nice; thanks for digging this up.  I'm glad to see that it's a known
problem.

... Except that in the mutter/clutter/cogl triumvirate, EGL is not
used :)  They run through GLX as far as I can tell.

AFAIK, clutter/cogl like to do a blit from the back to the front buffer
(or use the CopySubBuffer extension if available) to avoid a full frame
repaint.  This helps when running the desktop shell in a VM (without
acceleration), or over the network, or over some VNC-like thing (or on a
funny platform like IBM mainframes with no acceleration).

I hope that the above can answer the "is this desirable" questions from
the thread you linked.  I can live with either the blits being fixed, or
with CopySubBuffer being added for the software rendering case.

I'll try to see if patching the code to copy the fake front to the real
front is sufficient.  I don't really know the right place to do this,
but let's see.

  Federico


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


Re: [Piglit] [PATCH 2/2] The return code of the fucntion isnan is -1 for vector types.

2013-10-30 Thread Tom Stellard
On Wed, Oct 30, 2013 at 04:01:10PM +0800, Yi Sun wrote:
> According to the OpenCL spec version 1.2/1.1 chacpter 6.12.6:
> The functions isequal, isnotequal, isgreater, isgreaterequal, isless, 
> islessequal, islessgreater,
> isfinite, isinf, isnan, isnormal, isordered, isunordered and signbit 
> described in table 6.14 shall
> return a 0 if the specified relation is false and a 1 if the specified 
> relation is true for scalar
> argument types. These functions shall return a 0 if the specified relation is 
> false and a ???1 (i.e. all
> bits set) if the specified relation is true for vector argument types.
> 
> So, here we can remove the scalar argument types. And change the output from 
> 1 to -1.

Why are you are removing the scalar tests?

> 
> Signed-off-by: Yi Sun 
> 
> diff --git a/generated_tests/generate-cl-relational-builtins.py 
> b/generated_tests/generate-cl-relational-builtins.py
> old mode 100644
> new mode 100755
> index af6849f..5ed73ca
> --- a/generated_tests/generate-cl-relational-builtins.py
> +++ b/generated_tests/generate-cl-relational-builtins.py
> @@ -47,7 +47,7 @@ tests = {
>  'arg_types': [I, F],
>  'function_type': 'ttt',
>  'values': [
> -[0,   1,0,   0],# Result
> +[0,   -1,0,   0],# Result
>  [0.0, float("nan"), 1.0, float("inf") ] # Arg0
>  ]
>  }
> @@ -63,7 +63,7 @@ def main():
>  for fnName in functions:
>  testDefs[(dataType, fnName)] = tests[fnName]
>  
> -gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
> +gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName, [2, 4, 8, 
> 16])
> 

Rather than adding an extra parameter to the gen function, I think it
would be better to add a new 'function_type' : 'vvv' that only operated
on vector types.  This way you could add a new test to the dictionary
for the vector case and leave the old one.  Something like:

'isnan_vector' : {
'arg_types': [I, F],
'function_type': 'vvv',
'values': [
[0,   -1,0,   0],# Result
[0.0, float("nan"), 1.0, float("inf") ] # Arg0
]
}

-Tom


>  
>  main()
> -- 
> 1.7.6.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 6/8] GL_ARB_texture_buffer_object: Add a test for syncing with glBufferSubData().

2013-10-30 Thread Eric Anholt
Ian Romanick  writes:

> On 10/08/2013 02:09 PM, Eric Anholt wrote:
>
> With something done about the versioning comment below,
>
> Reviewed-by: Ian Romanick 

>> +/* Make the buffer bigger than the data to trigger the driver
>> + * code path we want.
>> + */
>> +glBufferData(GL_TEXTURE_BUFFER, 4096, NULL, GL_STREAM_DRAW);
>> +glBufferSubData(GL_TEXTURE_BUFFER, 0, sizeof(g_rgba8), g_rgba8);
>> +
>> +glGenTextures(1, &tex);
>> +glBindTexture(GL_TEXTURE_BUFFER, tex);
>> +glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, bo);
>> +
>> +piglit_draw_rect(-1, -1, 1, 2);
>> +glBufferSubData(GL_TEXTURE_BUFFER, 0, sizeof(b_rgba8), b_rgba8);
>> +piglit_draw_rect(0, -1, 1, 2);
>> +
>> +pass = pass && piglit_probe_rect_rgba(0, 0,
>> +  piglit_width / 2, piglit_height,
>> +  green);
>> +pass = pass && piglit_probe_rect_rgba(piglit_width / 2, 0,
>> +  piglit_width / 2, piglit_height,
>> +  blue);
>> +
>> +piglit_present_results();
>> +
>> +return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +piglit_require_GLSL_version(140);
>> +if (piglit_get_gl_version() < 31)
>
> I don't think anyone will exposed GLSL 1.40 without GL 3.1.  For this to
> be useful, the test should use a 1.20 shader with
> GL_ARB_texture_buffer_object enabled in the pre-3.1 case.

Not even Ironlake?


pgpjzaONdE1QD.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/8] GL_ARB_copy_buffer: Add a test for syncing with glBufferData();

2013-10-30 Thread Eric Anholt
Ian Romanick  writes:

> On 10/08/2013 02:09 PM, Eric Anholt wrote:
>> Like the subdata test, make sure that we get back the right results
>> when putting new data in our source or dest after a copy.
>> ---
>>  tests/all.tests  |   1 +
>>  tests/spec/arb_copy_buffer/CMakeLists.gl.txt |   1 +
>>  tests/spec/arb_copy_buffer/data-sync.c   | 109 
>> +++
>>  3 files changed, 111 insertions(+)
>>  create mode 100644 tests/spec/arb_copy_buffer/data-sync.c
>> 
>> diff --git a/tests/all.tests b/tests/all.tests
>> index 5c7bd3f..dfb3b79 100644
>> --- a/tests/all.tests
>> +++ b/tests/all.tests
>> @@ -2485,6 +2485,7 @@ arb_copy_buffer = Group()
>>  spec['ARB_copy_buffer'] = arb_copy_buffer
>>  add_plain_test(arb_copy_buffer, 'copy_buffer_coherency')
>>  add_plain_test(arb_copy_buffer, 'copybuffersubdata')
>> +arb_copy_buffer['data-sync'] = concurrent_test('arb_copy_buffer-data-sync')
>>  arb_copy_buffer['dlist'] = concurrent_test('arb_copy_buffer-dlist')
>>  arb_copy_buffer['get'] = concurrent_test('arb_copy_buffer-get')
>>  arb_copy_buffer['negative-bound-zero'] = 
>> concurrent_test('arb_copy_buffer-negative-bound-zero')
>> diff --git a/tests/spec/arb_copy_buffer/CMakeLists.gl.txt 
>> b/tests/spec/arb_copy_buffer/CMakeLists.gl.txt
>> index 5332f6d..6e5695e 100644
>> --- a/tests/spec/arb_copy_buffer/CMakeLists.gl.txt
>> +++ b/tests/spec/arb_copy_buffer/CMakeLists.gl.txt
>> @@ -11,6 +11,7 @@ link_libraries (
>>  
>>  piglit_add_executable (copy_buffer_coherency copy_buffer_coherency.c)
>>  piglit_add_executable (copybuffersubdata copybuffersubdata.c)
>> +piglit_add_executable (arb_copy_buffer-data-sync data-sync.c)
>>  piglit_add_executable (arb_copy_buffer-dlist dlist.c)
>>  piglit_add_executable (arb_copy_buffer-get get.c)
>>  piglit_add_executable (arb_copy_buffer-overlap overlap.c)
>> diff --git a/tests/spec/arb_copy_buffer/data-sync.c 
>> b/tests/spec/arb_copy_buffer/data-sync.c
>> new file mode 100644
>> index 000..0618722
>> --- /dev/null
>> +++ b/tests/spec/arb_copy_buffer/data-sync.c
>> @@ -0,0 +1,109 @@
>> +/*
>> + * 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 data-sync.c
>> + *
>> + * Tests that glBufferData() synchronizes correctly with
>> + * glCopyBufferSubData().
>> + *
>> + * We make sure that a glBufferData() over the read buffer after the
>> + * copy has no effect, while a glBufferData() over the write buffer
>> + * after the copy does have an effect.
>> + */
>> +
>> +#include "piglit-util-gl-common.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +config.supports_gl_compat_version = 10;
>
> Same comment as previous test.
>
>> +config.supports_gl_core_version = 31;
>> +
>> +config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +void
>> +piglit_init(int argc, char *argv[])
>> +{
>> +bool pass = true;
>> +uint32_t dummy_data_1[4], dummy_data_2[4];
>> +uint32_t good_data[4] = {0, 1, 2, 3};
>> +uint32_t result_data[4];
>> +bool subtest_pass;
>> +size_t size = sizeof(good_data);
>> +GLuint buffer_handles[2];
>> +
>> +memset(dummy_data_1, 0xaa, size);
>> +memset(dummy_data_2, 0xbb, size);
>> +
>> +piglit_require_gl_version(15);
>> +
>> +piglit_require_extension("GL_ARB_copy_buffer");
>> +
>> +glGenBuffersARB(2, buffer_handles);
>> +glBindBufferARB(GL_COPY_READ_BUFFER, buffer_handles[0]);
>> +glBindBufferARB(GL_COPY_WRITE_BUFFER, buffer_handles[1]);
>
> Same comment as previous test.
>
>> +
>> +glBufferData(GL_COPY_READ_BUFFER, size, good_data, GL_STREAM_COPY);
>> +glBufferData(GL_COPY_WRITE_BUFFER, size, dummy_data_1, GL_STREAM_COPY);
>> +glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER,
>> +  

Re: [Piglit] [PATCH 2/8] GL_ARB_copy_buffer: Add a test for syncing with glBufferSubData().

2013-10-30 Thread Eric Anholt
Ian Romanick  writes:

> With the (first) two comments below taken care of,
>
> Reviewed-by: Ian Romanick 
>
> On 10/08/2013 02:09 PM, Eric Anholt wrote:

>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +config.supports_gl_compat_version = 10;
>
> Just make this = 15 and drop the check in piglit_init.
>
>> +config.supports_gl_core_version = 31;
>> +
>> +config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +void
>> +piglit_init(int argc, char *argv[])
>> +{
>> +bool pass = true;
>> +uint32_t dummy_data_1[4], dummy_data_2[4];
>> +uint32_t good_data[4] = {0, 1, 2, 3};
>> +uint32_t result_data[4];
>> +bool subtest_pass;
>> +size_t size = sizeof(good_data);
>> +GLuint buffer_handles[2];
>> +
>> +memset(dummy_data_1, 0xaa, size);
>> +memset(dummy_data_2, 0xbb, size);
>> +
>> +piglit_require_gl_version(15);
>> +
>> +piglit_require_extension("GL_ARB_copy_buffer");
>> +
>> +glGenBuffersARB(2, buffer_handles);
>> +glBindBufferARB(GL_COPY_READ_BUFFER, buffer_handles[0]);
>> +glBindBufferARB(GL_COPY_WRITE_BUFFER, buffer_handles[1]);
>
> s/ARB//g since the test requires GL 1.5.

Fixed these.

>> +glBufferData(GL_COPY_READ_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +glBufferData(GL_COPY_WRITE_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +glGetBufferSubData(GL_COPY_READ_BUFFER, 0, size, good_data);
>> +glGetBufferSubData(GL_COPY_WRITE_BUFFER, 0, size, dummy_data_1);
>> +
>> +glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER,
>> +0, 0, size);
>> +glBufferSubData(GL_COPY_READ_BUFFER, 0, size, dummy_data_2);
>> +memset(result_data, 0xd0, size);
>> +glGetBufferSubData(GL_COPY_WRITE_BUFFER, 0, size, result_data);
>> +subtest_pass = memcmp(good_data, result_data, size) == 0;
>> +if (!subtest_pass) {
>> +fprintf(stderr, "found 0x%08x 0x%08x 0x%08x 0x%08x\n",
>> +result_data[0], result_data[1],
>> +result_data[2], result_data[3]);
>> +pass = false;
>> +}
>> +piglit_report_subtest_result(subtest_pass ? PIGLIT_PASS : PIGLIT_FAIL,
>> + "overwrite source data");
>> +
>> +
>> +glBufferData(GL_COPY_READ_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +glBufferData(GL_COPY_WRITE_BUFFER, 4096, NULL, GL_STREAM_COPY);
>
> Shouldn't this put some (non-zero) data in the buffers?  I guess it
> might not matter since the BufferSubData below overwrites the whole thing...

Yeah, we already trust the first full subdata of each one, it's the
syncing after it we're trying to poke at.


pgp5d2KBR9Y_H.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/4] Rename and clarify interface-blocks-vs-gs-array-size-mismatch.shader_test.

2013-10-30 Thread Paul Berry
The test was correct, but not for the reasons stated in the comment.
The reason a sized VS output interface array should fail to match an
unsized GS input interface array is because geometry shader inputs
require an extra level of array indexing to match corresponding vertex
shader outputs.

This patch renames the test, and updates the comment, to reflect
what's actually being tested.
---
 ...ce-blocks-vs-gs-array-size-mismatch.shader_test | 41 -
 ...erface-vs-array-to-gs-array-unsized.shader_test | 52 ++
 2 files changed, 52 insertions(+), 41 deletions(-)
 delete mode 100644 
tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test

diff --git 
a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
 
b/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
deleted file mode 100644
index 5581ba8..000
--- 
a/tests/spec/glsl-1.50/linker/interface-blocks-vs-gs-array-size-mismatch.shader_test
+++ /dev/null
@@ -1,41 +0,0 @@
-# Test interface blocks declared as arrays must match array sizes.
-#
-# GLSLangSpec.1.50.11, 4.3.7 Interface Blocks:
-# "if a matching block is declared as an array, then the array sizes must
-#  also match"
-[require]
-GLSL >= 1.50
-
-[vertex shader]
-out block {
-vec4 a;
-vec4 b;
-} vs_block[3];
-
-void main()
-{
-   for(int i = 0; i < 3; i++) {
-   vs_block[i].a = vec4(1., 0., 0., 1.);
-   }
-}
-
-[geometry shader]
-layout(triangles) in;
-layout(triangle_strip, max_vertices=3) out;
-
-in block {
-vec4 a;
-vec4 b;
-} vs_block[];
-
-out vec4 color;
-
-void main()
-{
-   for(int i = 0; i < 2; i++) {
-   color = vs_block[i].a;
-   }
-}
-
-[test]
-link error
diff --git 
a/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test
 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test
new file mode 100644
index 000..54498f1
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-unsized.shader_test
@@ -0,0 +1,52 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that trying to link a VS output interface array
+# to an unsized GS input interface array fails, even if the implicit
+# size of the GS input interface array matches the explicit size of
+# the VS output interface array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out block {
+vec4 a;
+vec4 b;
+} vs_block[3];
+
+void main()
+{
+   for(int i = 0; i < 3; i++) {
+   vs_block[i].a = vec4(1., 0., 0., 1.);
+   }
+}
+
+[geometry shader]
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+in block {
+vec4 a;
+vec4 b;
+} vs_block[];
+
+out vec4 color;
+
+void main()
+{
+   for(int i = 0; i < 2; i++) {
+   color = vs_block[i].a;
+   }
+}
+
+[test]
+link error
-- 
1.8.4.2

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


[Piglit] [PATCH 4/4] More tests for vs-fs interface block matching rules.

2013-10-30 Thread Paul Berry
Note: as of Mesa 5cb80f0, tests "interface-vs-array-to-fs-unnamed" and
"interface-vs-unnamed-to-fs-array" are known to fail.
---
 .../interface-vs-unnamed-to-fs-unnamed.shader_test | 58 ++
 .../interface-vs-array-to-fs-named.shader_test | 57 +
 .../interface-vs-array-to-fs-unnamed.shader_test   | 57 +
 .../interface-vs-named-to-fs-array.shader_test | 55 
 .../interface-vs-unnamed-to-fs-array.shader_test   | 55 
 5 files changed, 282 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test 
b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
new file mode 100644
index 000..76d1d94
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
@@ -0,0 +1,58 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that trying to link an unnamed VS output interface
+# to an unnamed FS input interface succeeds.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+};
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+};
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+ok = false;
+  if (distance(b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
new file mode 100644
index 000..0db615a
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
@@ -0,0 +1,57 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that trying to link a VS output interface array
+# to a named FS input interface fails.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+} inst[2];
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  inst[0].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[0].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+  inst[1].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[1].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+} inst;
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(inst.a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+ok = false;
+  if (distance(inst.b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
new file mode 100644
index 000..c166ece
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
@@ -0,0 +1,57 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# 

[Piglit] [PATCH 1/4] Test intrastage interface block array matching rules.

2013-10-30 Thread Paul Berry
Note: as of Mesa 5cb80f0, test "intrastage-interface-unnamed-array" is
known to fail.
---
 ...ge-interface-arrays-unmatched-sizes.shader_test | 42 +++
 .../intrastage-interface-named-array.shader_test   | 47 ++
 .../intrastage-interface-unnamed-array.shader_test | 47 ++
 3 files changed, 136 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test

diff --git 
a/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
 
b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
new file mode 100644
index 000..b1f60fc
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/linker/intrastage-interface-arrays-unmatched-sizes.shader_test
@@ -0,0 +1,42 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that a link error is generated if intrastage
+# array sizes don't match.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+  vec4 foo;
+} inst[2];
+
+void f()
+{
+  inst[1].foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+  vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+  f();
+  inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test 
b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test
new file mode 100644
index 000..a8ef627
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/intrastage-interface-named-array.shader_test
@@ -0,0 +1,47 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# Although it's not explicitly stated, it's clear that when doing
+# intrastage linking, interface block arrays can only match other
+# interface block arrays.
+#
+# This test verifies that a link error occurs if we try to do
+# intrastage linking of a named interface block to an interface block
+# array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+  vec4 foo;
+} inst;
+
+void f()
+{
+  inst.foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+  vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+  f();
+  inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error
diff --git 
a/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test 
b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test
new file mode 100644
index 000..1dee998
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/intrastage-interface-unnamed-array.shader_test
@@ -0,0 +1,47 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# Although it's not explicitly stated, it's clear that when doing
+# intrastage linking, interface block arrays can only match other
+# interface block arrays.
+#
+# This test verifies that a link error occurs if we try to do
+# intrastage linking of an unnamed interface block to an interface
+# block array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out blk {
+  vec4 foo;
+};
+
+void f()
+{
+  foo = vec4(1.0);
+}
+
+[vertex shader]
+out blk {
+  vec4 foo;
+} inst[3];
+
+void f();
+
+void main()
+{
+  f();
+  inst[2].foo = vec4(1.0);
+}
+
+[test]
+link error
-- 
1.8.4.2

___
Piglit mailing list
Pigl

[Piglit] [PATCH 3/4] More tests for vs-gs interface block array matching rules.

2013-10-30 Thread Paul Berry
---
 .../interface-vs-named-to-gs-array.shader_test | 77 ++
 ...nterface-vs-array-to-gs-array-sized.shader_test | 52 +++
 2 files changed, 129 insertions(+)
 create mode 100644 
tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test
 create mode 100644 
tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test

diff --git 
a/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test 
b/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test
new file mode 100644
index 000..364ca61
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/interface-vs-named-to-gs-array.shader_test
@@ -0,0 +1,77 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that trying to link a named VS output interface
+# to a GS input interface array succeeds, even if the instance names
+# differ.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out block {
+  vec4 a;
+  vec4 b;
+} vs_block;
+
+void main()
+{
+  vs_block.a = vec4(0.0, 1.0, 2.0, 3.0) + 10.0 * float(gl_VertexID);
+  vs_block.b = vec4(4.0, 5.0, 6.0, 7.0) + 10.0 * float(gl_VertexID);
+}
+
+[geometry shader]
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+in block {
+  vec4 a;
+  vec4 b;
+} gs_block[3];
+out vec4 color;
+
+void main()
+{
+  const vec4 vertices[4] = vec4[4](
+vec4(-1.0, -1.0, 0.0, 1.0),
+vec4(-1.0,  1.0, 0.0, 1.0),
+vec4( 1.0, -1.0, 0.0, 1.0),
+vec4( 1.0,  1.0, 0.0, 1.0)
+  );
+
+  bool ok = true;
+  for (int i = 0; i < 3; i++) {
+if (gs_block[i].a != vec4(0.0, 1.0, 2.0, 3.0) + 10.0 * float(i))
+  ok = false;
+if (gs_block[i].b != vec4(4.0, 5.0, 6.0, 7.0) + 10.0 * float(i))
+  ok = false;
+  }
+
+  for (int i = 0; i < 4; i++) {
+color = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+gl_Position = vertices[i];
+EmitVertex();
+  }
+}
+
+[fragment shader]
+in vec4 color;
+
+void main()
+{
+  gl_FragColor = color;
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
diff --git 
a/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test
new file mode 100644
index 000..080235c
--- /dev/null
+++ 
b/tests/spec/glsl-1.50/linker/interface-vs-array-to-gs-array-sized.shader_test
@@ -0,0 +1,52 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+# Matched block names within an interface (as defined above) must
+# match in terms of having the same number of declarations with
+# the same sequence of types and the same sequence of member
+# names, as well as having the same member-wise layout
+# qualification (see next section). Furthermore, if a matching
+# block is declared as an array, then the array sizes must also
+# match (or follow array matching rules for the interface between
+# a vertex and a geometry shader).
+#
+# This test verifies that trying to link a VS output interface array
+# to a sized GS input interface array fails, even if the size of the
+# GS input interface array matches the size of the VS output interface
+# array.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+out block {
+vec4 a;
+vec4 b;
+} vs_block[3];
+
+void main()
+{
+   for(int i = 0; i < 3; i++) {
+   vs_block[i].a = vec4(1., 0., 0., 1.);
+   }
+}
+
+[geometry shader]
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+in block {
+vec4 a;
+vec4 b;
+} vs_block[3];
+
+out vec4 color;
+
+void main()
+{
+   for(int i = 0; i < 2; i++) {
+   color = vs_block[i].a;
+   }
+}
+
+[test]
+link error
-- 
1.8.4.2

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


[Piglit] depthstencil-render-miplevels for GL_TEXTURE_2D_ARRAY

2013-10-30 Thread Chad Versace

If you care about 2d-array depthbuffers, I've extended 
depthstencil-render-miplevels
to handle that case. You can find it here:

  git://people.freedesktop.org/~chadversary/piglit.git 
branch=depthstencil-cruelty

The branch isn't ready for publication yet. I wanted to inform people, though, 
in
case anyone was working on related driver code. As expected, many 2d-array tests
fail on Ivybridge.

You can run it in 2d-array mode like this:
  depthstencil-render-miplevels GL_TEXTURE_2D_ARRAY width0 height0 num_layers 
buffer_combination
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cl: Fix build on systems where clock_gettime is only avaiable in librt

2013-10-30 Thread Chad Versace

On 10/30/2013 12:42 PM, Tom Stellard wrote:

From: Tom Stellard 

clock_gettime is available in glibc 2.17 and newer, but anyone using
an older version of glibc must link against librt.
---
  tests/cl/CMakeLists.txt | 4 
  1 file changed, 4 insertions(+)

diff --git a/tests/cl/CMakeLists.txt b/tests/cl/CMakeLists.txt
index b91eda5..53409ad 100644
--- a/tests/cl/CMakeLists.txt
+++ b/tests/cl/CMakeLists.txt
@@ -8,6 +8,10 @@ link_libraries (
${OPENCL_opencl_LIBRARY}
  )

+if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
+link_libraries(rt)
+endif()
+
  function(piglit_cl_add_test)
  add_executable(${ARGV})
  endfunction(piglit_cl_add_test)



Reviewed-by: Chad Versace 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] cl: Fix build on systems where clock_gettime is only avaiable in librt

2013-10-30 Thread Tom Stellard
From: Tom Stellard 

clock_gettime is available in glibc 2.17 and newer, but anyone using
an older version of glibc must link against librt.
---
 tests/cl/CMakeLists.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/cl/CMakeLists.txt b/tests/cl/CMakeLists.txt
index b91eda5..53409ad 100644
--- a/tests/cl/CMakeLists.txt
+++ b/tests/cl/CMakeLists.txt
@@ -8,6 +8,10 @@ link_libraries (
${OPENCL_opencl_LIBRARY}
 )
 
+if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
+link_libraries(rt)
+endif()
+
 function(piglit_cl_add_test)
 add_executable(${ARGV})
 endfunction(piglit_cl_add_test)
-- 
1.8.1.4

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


Re: [Piglit] [PATCH v4] GL3.2 GL_ARB_sync: Test for valid return values from ClientWaitSync

2013-10-30 Thread Ian Romanick
On 10/28/2013 01:57 PM, Chad Versace wrote:
> On 10/21/2013 02:11 PM, Nicholas Mack wrote:
>> v2: Fix comments, initialize variables.  Still need to figure out if
>> GPU commands
>>  needed before testing these.
>>
>> v3: Rewrite test cases, fix comment and config block and add to all.tests
>>
>> v4: Make test work with POSIX_CLOCKS and some other minor changes
>> ---
>>   tests/all.tests  |   1 +
>>   tests/spec/arb_sync/CMakeLists.gl.txt|   1 +
>>   tests/spec/arb_sync/ClientWaitSync-returns.c | 183
>> +++
>>   3 files changed, 185 insertions(+)
>>   create mode 100644 tests/spec/arb_sync/ClientWaitSync-returns.c
> 
> 
> Ken, Eric, Ian, I want your opinion on this GL_ARB_sync testcase.
> 
> It sets up a simple draw call, does *not* call glFlush, inserts a fence
> with a one second timeout, waits for the fence to signal, then verifies
> that the elapsed time is approximately the timeout value.
> 
> The testcase's intent is to verify that fence's correctly timeout.

For this to work, the work implied by the draw call needs to be very
large.  You can't assume that the driver won't start immediately
executing commands as soon as you call glDrawArrays (or whatever).  To
do this, you'd need to figure out how long some work should take:

glFinish();
start = piglit_get_microseconds();
draw_something();
glFinish();
end = piglit_get_microseconds();

// We can guess that draw_something takes about (end - start).
// Set the timeout to be less than that.
timeout = (end - start) / 2;

Of course, you have to handle the case where timeout is epsilon (or
less!) and scale the amount of work done by draw_something() accordingly.

There are tests in... eh-hem... another test suite that have, in the
past, had similar issues. :(

> Of course, i965 fails this test because have a stupid implementation of
> glClientWaitSync. For glClientWaitSync, i965 flushes, waits for the
> batch to complete,
> then returns.
> 
> Test case #1 below currently reports PIGLIT_FAIL on i965.
> i965 conforms to a strict interpretation of the GL_ARB_sync, but I don't
> want to the test to simply pass. It really feels like i965 is cheating, so
> I want the test to report PIGLIT_WARN.
> 
> What's your opinion?
> 
> 
>> +/* Test Case 1: Verify that fence times out correctly after set
>> time */
>> +
>> +/* queue a draw command */
>> +piglit_draw_rect(-1, -1, 2, 2);
>> +
>> +/* create fence sync */
>> +fence1 = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
>> +
>> +/* get initial time */
>> +start = piglit_get_microseconds();
>> +if (start == -1) piglit_report_result(PIGLIT_SKIP);
>> +
>> +/* check fence status */
>> +status1 = glClientWaitSync(fence1, GL_SYNC_FLUSH_COMMANDS_BIT,
>> +ONE_SECOND);
>> +
>> +/* draw call should not be complete since glFlush() wasn't called */
>> +if (status1 != GL_TIMEOUT_EXPIRED) {
>> +printf("Expected: status1 == GL_TIMEOUT_EXPIRED\n"
>> +"Actual: status1 == %s\n",
>> +piglit_get_gl_enum_name(status1));
>> +pass = false;
>> +}
>> +
>> +/* check time elapsed */
>> +end = piglit_get_microseconds();
>> +if (end == -1) piglit_report_result(PIGLIT_SKIP);
>> +seconds_elapsed = (end - start) * .01;
>> +if (seconds_elapsed < 1) { //TODO: check if significantly longer
>> than 1 second
>> +printf("Expected: Test Case 1 wait >= 1 second\n"
>> +"Actual: Test Case 1 wait = %f seconds\n",
>> +seconds_elapsed);
>> +pass = false;
>> +}
>> +
>> +/* clean up */
>> +glFlush();
>> +glDeleteSync(fence1);

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


Re: [Piglit] [PATCH] fbo-blit-after-swap: New test for partial blits after a buffer swap

2013-10-30 Thread Ian Romanick
On 10/29/2013 01:19 PM, Federico Mena Quintero wrote:
> From: Federico Mena Quintero 
> 
> The clutter/cogl libraries try to minimize the area that gets updated on 
> every frame.
> They do this by doing glBlitFramebufferEXT() from the back buffer to the 
> front buffer.
> 
> However, this is buggy with software rendering if there has been a buffer swap
> *before* the first blit from the back buffer to the front buffer.  In this 
> case,
> Mesa copies the whole back buffer into the front buffer, instead of just the
> requested region.
> ---
>  tests/all.tests |   1 +
>  tests/fbo/CMakeLists.gl.txt |   1 +
>  tests/fbo/fbo-blit-after-swap.c | 136 
> 
>  3 files changed, 138 insertions(+)
>  create mode 100644 tests/fbo/fbo-blit-after-swap.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 7ab841e..6c92ebf 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1163,6 +1163,7 @@ for format in ('rgba', 'depth', 'stencil'):
>  test_name = ' '.join(['framebuffer-blit-levels', test_mode, format])
>  arb_framebuffer_object[test_name] = PlainExecTest(test_name + ' 
> -auto')
>  add_plain_test(arb_framebuffer_object, 'fbo-alpha')
> +add_plain_test(arb_framebuffer_object, 'fbo-blit-after-swap')
>  add_plain_test(arb_framebuffer_object, 'fbo-blit-stretch')
>  add_plain_test(arb_framebuffer_object, 'fbo-blit-scaled-linear')
>  add_plain_test(arb_framebuffer_object, 'fbo-attachments-blit-scaled-linear')
> diff --git a/tests/fbo/CMakeLists.gl.txt b/tests/fbo/CMakeLists.gl.txt
> index 588fe26..3ad9ec0 100644
> --- a/tests/fbo/CMakeLists.gl.txt
> +++ b/tests/fbo/CMakeLists.gl.txt
> @@ -31,6 +31,7 @@ piglit_add_executable (fbo-alpha fbo-alpha.c)
>  piglit_add_executable (fbo-luminance-alpha fbo-luminance-alpha.c)
>  piglit_add_executable (fbo-bind-renderbuffer fbo-bind-renderbuffer.c)
>  piglit_add_executable (fbo-blit fbo-blit.c)
> +piglit_add_executable (fbo-blit-after-swap fbo-blit-after-swap.c)
>  piglit_add_executable (fbo-blit-d24s8 fbo-blit-d24s8.c)
>  piglit_add_executable (fbo-blit-stretch fbo-blit-stretch.cpp)
>  piglit_add_executable (fbo-blending-formats fbo-blending-formats.c)
> diff --git a/tests/fbo/fbo-blit-after-swap.c b/tests/fbo/fbo-blit-after-swap.c
> new file mode 100644
> index 000..38fc870
> --- /dev/null
> +++ b/tests/fbo/fbo-blit-after-swap.c
> @@ -0,0 +1,136 @@
> +/*
> + * Copyright 2013 Suse, Inc. 
> + * Copyright © 2011 Henri Verbeet 
> + * Copyright 2011 Red Hat, Inc.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + */
> +
> +/** @file fbo-blit-after-swap.c
> + *
> + * Test a glBlitFrameBuffer() with a smaller-than-the-window region after 
> doing a buffer swap
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 128;
> + config.window_height = 128;

Does the test need a non-default size?  The rest of the test code
appears to adapt to any window size.

> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB;
> + config.requires_displayed_window = true;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +#define SWAP_BUFFERS_BEFORE_BLIT 1
> +
> +static const float red[]   = {1.0f, 0.0f, 0.0f, 1.0f};
> +static const float blue[]  = {0.0f, 0.0f, 1.0f, 1.0f};
> +static const float black[] = {0.0f, 0.0f, 0.0f, 1.0f};
> +
> +static void
> +setup_front_buffer(void)
> +{
> + glDrawBuffer(GL_BACK);
> +
> + glClearColor(blue[0], blue[1], blue[2], blue[3]);
> + glClear(GL_COLOR_BUFFER_BIT);
> +
> +#if SWAP_BUFFERS_BEFORE_BLIT

Ideally, the test binary should be able to do both these things based on
a commandline parameter.

> + piglit_swap_buffers();
> +#else
> + glDrawBuffer(GL_FRONT);
> + glReadBuffer(GL_BACK);
> + glBlitFramebufferEXT(0, 0

Re: [Piglit] [PATCH 8/8] GL_ARB_vertex_buffer_object: Test many draws using glBufferSubData().

2013-10-30 Thread Ian Romanick
On 10/08/2013 02:09 PM, Eric Anholt wrote:
> The previous tests tried to get at bad synchronization for unexpected
> rendering behaviors (repeatedly glBufferSubData()ing over the same
> state), while this tries to get at a more expected rendering behavior
> (incrementally glBufferSubData()ing into subsequent areas in a VBO).
> It also caught a ton of bugs in my initial implementation of
> glBufferSubData GPU stall avoidance.
> ---
>  tests/all.tests|   3 +
>  .../arb_vertex_buffer_object/CMakeLists.gl.txt |   1 +
>  .../arb_vertex_buffer_object/vbo-subdata-many.c| 132 
> +
>  3 files changed, 136 insertions(+)
>  create mode 100644 tests/spec/arb_vertex_buffer_object/vbo-subdata-many.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index beeaa84..bbc2a50 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1594,6 +1594,9 @@ add_plain_test(arb_vertex_buffer_object, 'pos-array')
>  add_plain_test(arb_vertex_buffer_object, 'vbo-bufferdata')
>  add_plain_test(arb_vertex_buffer_object, 'vbo-map-remap')
>  add_concurrent_test(arb_vertex_buffer_object, 'vbo-map-unsync')
> +arb_vertex_buffer_object['vbo-subdata-many drawarrays'] = 
> concurrent_test('arb_vertex_buffer_object-vbo-subdata-many drawarrays')
> +arb_vertex_buffer_object['vbo-subdata-many drawelements'] = 
> concurrent_test('arb_vertex_buffer_object-vbo-subdata-many drawelements')
> +arb_vertex_buffer_object['vbo-subdata-many drawrangeelements'] = 
> concurrent_test('arb_vertex_buffer_object-vbo-subdata-many drawrangeelements')
>  add_plain_test(arb_vertex_buffer_object, 'vbo-subdata-sync')
>  add_plain_test(arb_vertex_buffer_object, 'vbo-subdata-zero')
>  
> diff --git a/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt 
> b/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> index 5b5cf5d..6baaa19 100644
> --- a/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> @@ -13,5 +13,6 @@ piglit_add_executable 
> (arb_vertex_buffer_object-elements-negative-offset element
>  piglit_add_executable (arb_vertex_buffer_object-mixed-immediate-and-vbo 
> mixed-immediate-and-vbo.c)
>  piglit_add_executable (arb_vertex_buffer_object-ib-data-sync ib-data-sync.c)
>  piglit_add_executable (arb_vertex_buffer_object-ib-subdata-sync 
> ib-subdata-sync.c)
> +piglit_add_executable (arb_vertex_buffer_object-vbo-subdata-many 
> vbo-subdata-many.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_vertex_buffer_object/vbo-subdata-many.c 
> b/tests/spec/arb_vertex_buffer_object/vbo-subdata-many.c
> new file mode 100644
> index 000..be37fc7
> --- /dev/null
> +++ b/tests/spec/arb_vertex_buffer_object/vbo-subdata-many.c
> @@ -0,0 +1,132 @@
> +/*
> + * 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"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 200;
> + config.window_height = 200;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static enum {
> + DRAWARRAYS,
> + DRAWELEMENTS,
> + DRAWRANGEELEMENTS,
> +} mode = DRAWARRAYS;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + uint32_t buffer_size = 4096;
> + bool pass = true;
> + GLuint vbo;
> + float green[] = {0, 1, 0, 0};
> + uint32_t count = piglit_width * piglit_height;
> + int i;
> +
> + glClearColor(1, 0, 0, 0);
> + glClear(GL_COLOR_BUFFER_BIT);
> +
> + piglit_ortho_projection(piglit_width, piglit_height, false);
> + glColor4fv(green);
> +
> + glGenBuffersARB(1, &vbo);
> + glBindBufferARB(GL_ARRAY_BUFFER, vbo);
> + glBufferData(GL_ARRAY_BUFFER, buffer_size, NULL, GL_ST

Re: [Piglit] [PATCH 7/8] GL_ARB_texture_buffer_object: Test for a bug in i965 with glBufferData().

2013-10-30 Thread Ian Romanick
On 10/08/2013 02:09 PM, Eric Anholt wrote:

With something done about the versioning comment below,

Reviewed-by: Ian Romanick 

> ---
>  tests/all.tests|   1 +
>  .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
>  tests/spec/arb_texture_buffer_object/data-sync.c   | 102 
> +
>  3 files changed, 104 insertions(+)
>  create mode 100644 tests/spec/arb_texture_buffer_object/data-sync.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index f08878e..beeaa84 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1406,6 +1406,7 @@ add_plain_test(arb_explicit_attrib_location, 
> 'glsl-explicit-location-05')
>  
>  arb_texture_buffer_object = Group()
>  spec['ARB_texture_buffer_object'] = arb_texture_buffer_object
> +arb_texture_buffer_object['data-sync'] = 
> concurrent_test('arb_texture_buffer_object-data-sync')
>  arb_texture_buffer_object['dlist'] = 
> concurrent_test('arb_texture_buffer_object-dlist')
>  arb_texture_buffer_object['formats (FS, 3.1 core)'] = 
> concurrent_test('arb_texture_buffer_object-formats fs core')
>  arb_texture_buffer_object['formats (VS, 3.1 core)'] = 
> concurrent_test('arb_texture_buffer_object-formats vs core')
> diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
> b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> index e4c616d..5019e52 100644
> --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> @@ -10,6 +10,7 @@ link_libraries (
>   ${OPENGL_glu_LIBRARY}
>  )
>  
> +piglit_add_executable (arb_texture_buffer_object-data-sync data-sync.c)
>  piglit_add_executable (arb_texture_buffer_object-dlist dlist.c)
>  piglit_add_executable (arb_texture_buffer_object-formats formats.c)
>  piglit_add_executable (arb_texture_buffer_object-get get.c)
> diff --git a/tests/spec/arb_texture_buffer_object/data-sync.c 
> b/tests/spec/arb_texture_buffer_object/data-sync.c
> new file mode 100644
> index 000..310156c
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_object/data-sync.c
> @@ -0,0 +1,102 @@
> +/*
> + * 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 data-sync.c
> + *
> + * Tests that glBufferData() synchronizes correctly with TBO rendering.
> + *
> + * Caught a bug in the i965 driver after a core Mesa refactor.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> + config.supports_gl_compat_version = 10;
> + config.supports_gl_core_version = 31;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + static const char *vs_source =
> + "#version 140\n"
> + "in vec4 piglit_vertex;\n"
> + "void main()\n"
> + "{\n"
> + "   gl_Position = piglit_vertex;\n"
> + "}\n";
> +
> + static const char *fs_source =
> + "#version 140\n"
> + "uniform samplerBuffer s;\n"
> + "void main()\n"
> + "{\n"
> + "   gl_FragColor = texelFetch(s, 0);\n"
> + "}\n";
> +
> + bool pass = true;
> + GLuint tex, bo;
> + GLuint prog;
> + float green[] = {0, 1, 0, 0};
> + float blue[] =  {0, 0, 1, 0};
> + uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
> + uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
> +
> + prog = piglit_build_simple_program(vs_source, fs_source);
> + glUseProgram(prog);
> +
> +glGenBuffers(1, &bo);
> +glBindBuffer(GL_TEXTURE_BUFFER, bo);

Weird indentation here too.

> + glBufferData(GL_TEXTURE_BUFFER, sizeof(g_rgba8), g_rgba8,
> +  GL_STREAM_DRAW);
> +
> + glGenTextures(1, &tex)

Re: [Piglit] [PATCH 6/8] GL_ARB_texture_buffer_object: Add a test for syncing with glBufferSubData().

2013-10-30 Thread Ian Romanick
On 10/08/2013 02:09 PM, Eric Anholt wrote:

With something done about the versioning comment below,

Reviewed-by: Ian Romanick 

> ---
>  tests/all.tests|   1 +
>  .../arb_texture_buffer_object/CMakeLists.gl.txt|   1 +
>  .../spec/arb_texture_buffer_object/subdata-sync.c  | 102 
> +
>  3 files changed, 104 insertions(+)
>  create mode 100644 tests/spec/arb_texture_buffer_object/subdata-sync.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 14787a6..f08878e 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1418,6 +1418,7 @@ arb_texture_buffer_object['negative-bad-bo'] = 
> concurrent_test('arb_texture_buff
>  arb_texture_buffer_object['negative-bad-format'] = 
> concurrent_test('arb_texture_buffer_object-negative-bad-format')
>  arb_texture_buffer_object['negative-bad-target'] = 
> concurrent_test('arb_texture_buffer_object-negative-bad-target')
>  arb_texture_buffer_object['negative-unsupported'] = 
> concurrent_test('arb_texture_buffer_object-negative-unsupported')
> +arb_texture_buffer_object['subdata-sync'] = 
> concurrent_test('arb_texture_buffer_object-subdata-sync')
>  arb_texture_buffer_object['unused-name'] = 
> concurrent_test('arb_texture_buffer_object-unused-name')
>  
>  arb_texture_buffer_range = Group()
> diff --git a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt 
> b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> index e1f3a2e..e4c616d 100644
> --- a/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_texture_buffer_object/CMakeLists.gl.txt
> @@ -19,5 +19,6 @@ piglit_add_executable 
> (arb_texture_buffer_object-negative-bad-format negative-ba
>  piglit_add_executable (arb_texture_buffer_object-negative-bad-target 
> negative-bad-target.c)
>  piglit_add_executable (arb_texture_buffer_object-negative-unsupported 
> negative-unsupported.c)
>  piglit_add_executable (arb_texture_buffer_object-render-no-bo render-no-bo.c)
> +piglit_add_executable (arb_texture_buffer_object-subdata-sync subdata-sync.c)
>  piglit_add_executable (arb_texture_buffer_object-unused-name unused-name.c)
>  piglit_add_executable (arb_texture_buffer_object-fetch-outside-bounds 
> fetch-outside-bounds.c)
> diff --git a/tests/spec/arb_texture_buffer_object/subdata-sync.c 
> b/tests/spec/arb_texture_buffer_object/subdata-sync.c
> new file mode 100644
> index 000..ff81bb7
> --- /dev/null
> +++ b/tests/spec/arb_texture_buffer_object/subdata-sync.c
> @@ -0,0 +1,102 @@
> +/*
> + * 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 subdata-sync.c
> + *
> + * Tests that glBufferSubData() synchronizes correctly with TBO rendering.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> + config.supports_gl_compat_version = 10;
> + config.supports_gl_core_version = 31;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + static const char *vs_source =
> + "#version 140\n"
> + "in vec4 piglit_vertex;\n"
> + "void main()\n"
> + "{\n"
> + "   gl_Position = piglit_vertex;\n"
> + "}\n";
> +
> + static const char *fs_source =
> + "#version 140\n"
> + "uniform samplerBuffer s;\n"
> + "void main()\n"
> + "{\n"
> + "   gl_FragColor = texelFetch(s, 0);\n"
> + "}\n";
> +
> + bool pass = true;
> + GLuint tex, bo;
> + GLuint prog;
> + float green[] = {0, 1, 0, 0};
> + float blue[] =  {0, 0, 1, 0};
> + uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
> + uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
> +
> + prog = piglit_bui

Re: [Piglit] [PATCH 5/8] GL_ARB_vertex_buffer_object: Add test for glBufferData() on the index buffer.

2013-10-30 Thread Ian Romanick
On 10/08/2013 02:09 PM, Eric Anholt wrote:

Reviewed-by: Ian Romanick 

> ---
>  tests/all.tests|  1 +
>  .../arb_vertex_buffer_object/CMakeLists.gl.txt |  1 +
>  tests/spec/arb_vertex_buffer_object/ib-data-sync.c | 83 
> ++
>  3 files changed, 85 insertions(+)
>  create mode 100644 tests/spec/arb_vertex_buffer_object/ib-data-sync.c
> 
> diff --git a/tests/all.tests b/tests/all.tests
> index 8b276c2..14787a6 100644
> --- a/tests/all.tests
> +++ b/tests/all.tests
> @@ -1586,6 +1586,7 @@ arb_vertex_buffer_object['mixed-immediate-and-vbo'] = 
> PlainExecTest(['arb_vertex
>  add_plain_test(arb_vertex_buffer_object, 'fdo14575')
>  add_plain_test(arb_vertex_buffer_object, 'fdo22540')
>  add_plain_test(arb_vertex_buffer_object, 'fdo31934')
> +arb_vertex_buffer_object['ib-data-sync'] = 
> concurrent_test('arb_vertex_buffer_object-ib-data-sync')
>  arb_vertex_buffer_object['ib-subdata-sync'] = 
> concurrent_test('arb_vertex_buffer_object-ib-subdata-sync')
>  add_plain_test(arb_vertex_buffer_object, 'pos-array')
>  add_plain_test(arb_vertex_buffer_object, 'vbo-bufferdata')
> diff --git a/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt 
> b/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> index 9346dfb..5b5cf5d 100644
> --- a/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> +++ b/tests/spec/arb_vertex_buffer_object/CMakeLists.gl.txt
> @@ -11,6 +11,7 @@ link_libraries (
>  
>  piglit_add_executable (arb_vertex_buffer_object-elements-negative-offset 
> elements-negative-offset.c)
>  piglit_add_executable (arb_vertex_buffer_object-mixed-immediate-and-vbo 
> mixed-immediate-and-vbo.c)
> +piglit_add_executable (arb_vertex_buffer_object-ib-data-sync ib-data-sync.c)
>  piglit_add_executable (arb_vertex_buffer_object-ib-subdata-sync 
> ib-subdata-sync.c)
>  
>  # vim: ft=cmake:
> diff --git a/tests/spec/arb_vertex_buffer_object/ib-data-sync.c 
> b/tests/spec/arb_vertex_buffer_object/ib-data-sync.c
> new file mode 100644
> index 000..f8ee602
> --- /dev/null
> +++ b/tests/spec/arb_vertex_buffer_object/ib-data-sync.c
> @@ -0,0 +1,83 @@
> +/*
> + * 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"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + float verts[] = {
> + -1, -1,
> +  0, -1,
> +  0,  1,
> + -1,  1,
> +
> +  0, -1,
> +  1, -1,
> +  1,  1,
> +  0,  1,
> + };
> + uint32_t ib_1[] = {0, 1, 2, 3};
> + uint32_t ib_2[] = {4, 5, 6, 7};
> +
> + bool pass = true;
> + size_t size = sizeof(ib_1);
> + GLuint vbo, ibo;
> + float green[] = {0, 1, 0, 0};
> +
> + glColor4fv(green);
> +
> + glGenBuffersARB(1, &vbo);
> + glBindBufferARB(GL_ARRAY_BUFFER, vbo);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STREAM_DRAW);
> + glEnableClientState(GL_VERTEX_ARRAY);
> + glVertexPointer(2, GL_FLOAT, 0, NULL);
> +
> + glGenBuffers(1, &ibo);
> + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
> + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, ib_1, GL_STREAM_DRAW);
> +
> + glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
> + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, ib_2, GL_STREAM_DRAW);
> + glDrawElements(GL_TRIANGLE_FAN, 4, GL_UNSIGNED_INT, NULL);
> +
> + pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green);
> +
> + piglit_present_results();
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char *argv[])
> +{

Re: [Piglit] [PATCH 7/7] arb_vertex_attrib_binding: Test zero-stride bindings

2013-10-30 Thread Eric Anholt
Fredrik Höglund  writes:
> diff --git a/tests/spec/arb_vertex_attrib_binding/zero-stride.c 
> b/tests/spec/arb_vertex_attrib_binding/zero-stride.c
> new file mode 100644
> index 000..83b56e4
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/zero-stride.c

> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 128;
> + config.window_height = 128;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;

core, drop size, alpha

> +enum piglit_result
> +piglit_display(void)
> +{
> + const struct {
> + float x, y;
> + } verts[] = {
> + { -1,  1 }, { 1,  1 },
> + { -1, -1 }, { 1, -1 }
> + };
> +
> + const float green[] = { 0.0, 1.0, 0.0, 1.0 };
> +
> + GLuint vbo1, vbo2, vao;
> + bool pass = true;
> +
> + glGenVertexArrays(1, &vao);
> + glBindVertexArray(vao);
> +
> + glGenBuffers(1, &vbo1);
> + glGenBuffers(1, &vbo2);
> +
> + /* vbo1 contains the vertex positions */
> + glBindBuffer(GL_ARRAY_BUFFER, vbo1);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), (const GLvoid *) verts, 
> GL_STATIC_DRAW);
> +
> + /* vbo2 contains the color data */
> + glBindBuffer(GL_ARRAY_BUFFER, vbo2);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(green), (const GLvoid *) green, 
> GL_STATIC_DRAW);

I'd fill the color buffer with some junk after it (such as a red color),
so if the implementation is clamping buffer element indices to the size
of the buffer, you don't just get green.

> + pass = piglit_probe_pixel_rgba(piglit_width * .5, piglit_height * .5, 
> green);

probe_rect.

> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_extension("GL_ARB_vertex_attrib_binding");
> +
> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> + program = piglit_link_simple_program(vs, fs);

build_simple_program()

For the tests with minor comments, with the obvious fixups they're:

Reviewed-by: Eric Anholt 

I think 2/7 was the only one I really didn't review well.  Thanks for
writing a really solid set of tests for this extension!


pgpdvahXU3jou.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 6/7] arb_vertex_attrib_binding: Test instance-divisor

2013-10-30 Thread Eric Anholt
Fredrik Höglund  writes:
> diff --git a/tests/spec/arb_vertex_attrib_binding/instance-divisor.c 
> b/tests/spec/arb_vertex_attrib_binding/instance-divisor.c
> new file mode 100644
> index 000..88ae454
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/instance-divisor.c

> +const char *vs_source =
> + "attribute vec4 pos;\n"
> + "attribute vec2 offset;\n"
> + "attribute vec4 color;\n"
> + "uniform vec2 global_offset;\n"
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "col = color;\n"
> + "gl_Position = pos + vec4(global_offset + offset, vec2(0, 0));\n"
> + "}";

> +enum piglit_result
> +piglit_display(void)
> +{
> + const struct vec2 quad[] = {
> + { -0.125,  0.125 }, { 0.125,  0.125 },
> + { -0.125, -0.125 }, { 0.125, -0.125 }
> + };
> +
> + const struct vec2 offsets[] = {
> + { -.75, 0 }, { -.25, 0 }, { .25, 0 }, { .75, 0 }
> + };
> +
> + const struct vec4 colors[] = {
> + { 1.0, 0.0, 0.0, 1.0 },
> + { 0.0, 1.0, 0.0, 1.0 },
> + { 0.0, 0.0, 1.0, 1.0 },
> + { 1.0, 1.0, 1.0, 1.0 }
> + };
> +
> + GLuint vbo1, vbo2, vbo3, vao;
> + bool pass = true;
> +
> + glGenVertexArrays(1, &vao);
> + glBindVertexArray(vao);
> +
> + glGenBuffers(1, &vbo1);
> + glGenBuffers(1, &vbo2);
> + glGenBuffers(1, &vbo3);
> +
> + glBindBuffer(GL_ARRAY_BUFFER, vbo1);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(quad), (const GLvoid *) quad, 
> GL_STATIC_DRAW);
> +
> + glBindBuffer(GL_ARRAY_BUFFER, vbo2);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(offsets), (const GLvoid *) 
> offsets, GL_STATIC_DRAW);

I'm confused why there's both pos/quad (with two names) and offset.
Could you just have a single pre-baked pos vec2?

> + pass = piglit_probe_pixel_rgba(piglit_width * .125, piglit_height * 
> .75, (const float *) &colors[0]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .375, piglit_height * 
> .75, (const float *) &colors[1]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .625, piglit_height * 
> .75, (const float *) &colors[2]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .875, piglit_height * 
> .75, (const float *) &colors[3]);
> +
> + pass = piglit_probe_pixel_rgba(piglit_width * .125, piglit_height * 
> .25, (const float *) &colors[0]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .375, piglit_height * 
> .25, (const float *) &colors[0]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .625, piglit_height * 
> .25, (const float *) &colors[1]);
> + pass = piglit_probe_pixel_rgba(piglit_width * .875, piglit_height * 
> .25, (const float *) &colors[1]);

Again, not required, but I like probe_rect (when the HW craps out and
only draws some of the pixels, you get fewer false positives).

> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_extension("GL_ARB_vertex_attrib_binding");

Since I think we're enabling this extension on all Mesa drivers
regardless of HW support for instancing, I think this should also depend
on GL_ARB_instanced_arrays.  (It's not called out in the spec because
they wrote it against 4.2).

> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> + program = piglit_link_simple_program(vs, fs);

piglit_build_simple_program().

> + pos   = glGetAttribLocation(program, "pos");
> + offset= glGetAttribLocation(program, "offset");
> + color = glGetAttribLocation(program, "color");
> + global_offset = glGetUniformLocation(program, "global_offset");
> +}


pgpfXKRwNW8Pa.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 5/7] arb_vertex_attrib_binding: Test changing offsets

2013-10-30 Thread Eric Anholt
Fredrik Höglund  writes:

> This test verifies that changing vertex buffer offsets between
> draw calls works as expected.

> diff --git a/tests/spec/arb_vertex_attrib_binding/offsets.c 
> b/tests/spec/arb_vertex_attrib_binding/offsets.c
> new file mode 100644
> index 000..ec99bea
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/offsets.c

> +/**
> + * @file offsets.c
> + *
> + * Tests that changing vertex buffer offsets between draw calls
> + * works as expected.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 128;
> + config.window_height = 128;
> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;

core, size, alpha

> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *vs_source =
> + "attribute vec4 pos;\n"
> + "attribute vec4 color;\n"
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "col = color;\n"
> + "gl_Position = pos;\n"
> + "}";
> +
> +const char *fs_source =
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "gl_FragColor = col;\n"
> + "}";
> +
> +struct Vertex
> +{
> + float pos[2];
> + unsigned char color[4];
> +};

lower case

> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_extension("GL_ARB_vertex_attrib_binding");
> +
> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> + program = piglit_link_simple_program(vs, fs);

piglit_build_simple_program()

> + /* Set up the vertex arrays */
> + pos   = glGetAttribLocation(program, "pos");
> + color = glGetAttribLocation(program, "color");
> +}


pgpjti5hM5CtJ.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 4/7] arb_vertex_attrib_binding: Test switching buffers

2013-10-30 Thread Eric Anholt
Fredrik Höglund  writes:

> This test verifies that switching vertex buffers between draw calls
> works as expected.

> diff --git a/tests/spec/arb_vertex_attrib_binding/buffers.c 
> b/tests/spec/arb_vertex_attrib_binding/buffers.c
> new file mode 100644
> index 000..bba8c17
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/buffers.c

> +/**
> + * @file buffers.c
> + *
> + * Tests that switching buffers between draw calls works as expected.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;
> +
> + config.window_width = 128;
> + config.window_height = 128;

core, drop sizes

> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;

Oops, I didn't notice that in the previous test and this one, you should
have PIGLIT_GL_VISUAL_ALPHA, since you're using probe_rgba.  Of course,
your colors happen to have alpha of 1, so it ends up working out, but
let's be consistent.

> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *vs_source =
> + "attribute vec4 pos;\n"
> + "attribute vec4 color;\n"
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "col = color;\n"
> + "gl_Position = pos;\n"
> + "}";
> +
> +const char *fs_source =
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "gl_FragColor = col;\n"
> + "}";
> +
> +struct Vertex
> +{
> + float pos[2];
> + unsigned char color[4];
> +};

lower case

> + pass = piglit_probe_pixel_rgba(piglit_width * .25, piglit_height * .75, 
> red);
> + pass = piglit_probe_pixel_rgba(piglit_width * .75, piglit_height * .75, 
> green);
> + pass = piglit_probe_pixel_rgba(piglit_width * .25, piglit_height * .25, 
> blue);
> + pass = piglit_probe_pixel_rgba(piglit_width * .75, piglit_height * .25, 
> white);

probe_rect?

> +
> + piglit_present_results();
> +
> + glDeleteBuffers(1, &vbo1);
> + glDeleteBuffers(1, &vbo2);
> + glDeleteBuffers(1, &ibo);
> +
> + glDeleteVertexArrays(1, &vao);
> +
> + glUseProgram(0);
> +
> + return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_extension("GL_ARB_vertex_attrib_binding");
> +
> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> + program = piglit_link_simple_program(vs, fs);

piglit_build_simple_program


pgpqeMffrIOIz.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 3/7] arb_vertex_attrib_binding: Test setting and changing formats

2013-10-30 Thread Eric Anholt
Fredrik Höglund  writes:
> diff --git a/tests/spec/arb_vertex_attrib_binding/format.c 
> b/tests/spec/arb_vertex_attrib_binding/format.c
> new file mode 100644
> index 000..130b65a
> --- /dev/null
> +++ b/tests/spec/arb_vertex_attrib_binding/format.c

> +/**
> + * @file offsets.c

format.c

> + * Tests that changing formats between draw calls works as expected.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 10;

Also core?

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

These lines cause problems on windows, and I think this test is pretty
size-agnostic, so just drop them and take the defaults, I think.

> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +const char *vs_source =
> + "attribute vec4 pos;\n"
> + "attribute vec4 color;\n"
> + "uniform vec2 offset;\n"
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "col = color;\n"
> + "gl_Position = pos + vec4(offset, vec2(0,0));\n"
> + "}";
> +
> +const char *fs_source =
> + "varying vec4 col;\n"
> + "void main() {\n"
> + "gl_FragColor = col;\n"
> + "}";
> +
> +struct Vertex
> +{
> + float pos[2];
> + unsigned char color[4];
> +};
> +
> +static GLuint program;
> +static GLuint pos, color, offset;
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + const struct Vertex verts[] = {

lower case "vertex" for more piglit style.

> + { { -.25,  .25 }, { 255,   255,   0, 255 } },
> + { {  .25,  .25 }, { 255,   255,   0, 255 } },
> + { { -.25, -.25 }, { 255,   255,   0, 255 } },
> + { {  .25, -.25 }, { 255,   255,   0, 255 } },
> + };
> +
> + const float yellow[]= { 1.0, 1.0, 0.0, 1.0 };
> + const float cyan[]  = { 0.0, 1.0, 1.0, 1.0 };
> +
> + GLuint vbo, vao;
> + bool pass = true;
> +
> + glGenVertexArrays(1, &vao);
> + glBindVertexArray(vao);
> +
> + glGenBuffers(1, &vbo);
> + glBindBuffer(GL_ARRAY_BUFFER, vbo);
> + glBufferData(GL_ARRAY_BUFFER, sizeof(verts), (const GLvoid *) verts, 
> GL_STATIC_DRAW);

wrap at 80

> + /* Bind the vertex buffer to binding point 0 */
> + glBindVertexBuffer(0, vbo, 0, sizeof(struct Vertex));
> +
> + /* Set up the attrib -> binding mapping */
> + glVertexAttribBinding(pos,   0);
> + glVertexAttribBinding(color, 0);
> +
> + /* Set up the format and offset for the position */
> + glVertexAttribFormat(pos, 2, GL_FLOAT, GL_FALSE, offsetof(struct 
> Vertex, pos));
> +
> + glEnableVertexAttribArray(pos);
> + glEnableVertexAttribArray(color);
> +
> + glViewport(0, 0, piglit_width, piglit_height);
> + glClearColor(0.0, 0.0, 0.0, 1.0);
> + glClear(GL_COLOR_BUFFER_BIT);
> +
> + glUseProgram(program);
> +
> + /* Set the color format to RGBA order */
> + glUniform2f(offset, -.4, 0);
> + glVertexAttribFormat(color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 
> offsetof(struct Vertex, color));
> + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
> +
> + /* Set the color format to BGRA order */
> + glUniform2f(offset,  .4, 0);
> + glVertexAttribFormat(color, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 
> offsetof(struct Vertex, color));
> + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
> +
> + pass = piglit_probe_pixel_rgba(piglit_width * .25, piglit_height * .5, 
> yellow);
> + pass = piglit_probe_pixel_rgba(piglit_width * .75, piglit_height * .5, 
> cyan);

To reduce state updates between draws even more, you could have 8 verts
total in the buffer, one quad covering the left half of the screen and
one the right (so you can piglit_probe_rect_rgba instead of just a
single pixel), use glDrawArrays(GL_TRIANGLE_STRIP, 4, 4) for the second
one, and drop the "offset" uniform.  It means that you don't get any
testing of fetched vertex caching by rereading the same data in
different formats, but it reduces the chances of stray state updates
From the uniform change making the test false pass.

Either way, though.  I'm really happy to see a test like this as part of
the test series, and wish we did more of them.

> +void
> +piglit_init(int argc, char **argv)
> +{
> + GLuint vs, fs;
> +
> + piglit_require_extension("GL_ARB_vertex_attrib_binding");
> +
> + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
> + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
> + program = piglit_link_simple_program(vs, fs);

There's now "piglit_build_simple_program(vs_source, fs_source)"
available.


pgpmGNdDiYo51.pgp
Description: PGP signature
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] New test for partial blits after a buffer swap

2013-10-30 Thread Paul Berry
On 29 October 2013 14:46, Eric Anholt  wrote:

> Federico Mena Quintero  writes:
>
> > Hello, everyone,
> >
> > Attached is a new test for piglit which exposes a bug in Mesa's
> > software rendering (and another bug in hardware rendering, but that's
> > not its main purpose).
> >
> > The bug is as follows.  With software rendering, after doing a buffer
> > swap, glBlitFrameBufferEXT() appears to to copy the whole framebuffer
> > instead of just the specified region.  This breaks clutter and cogl,
> > since they keep track of a dirty region themselves, and they use blits
> > instead of full buffer swaps to avoid updating the whole display on
> > every frame unnecessarily.
> >
> > What is happening is actually a bit more complicated.
> > glBlitFrameBufferEXT()'s basic machinery works correctly, but if there
> > has been a buffer swap before it, the following happens:
>
> Hah.  Apparently the problem is you're hitting this line of
> platform_x11.c in EGL:
>
>/* FIXME: Does EGL support front buffer rendering at all? */
>

FYI, we discussed this issue back in May but didn't really come to a clear
consensus of what we wanted to do about it:
http://lists.freedesktop.org/archives/mesa-dev/2013-May/040059.html.  (Note
that the replies happened in July so the mesa-dev archives don't thread
them well.  See
http://lists.freedesktop.org/archives/mesa-dev/2013-June/subject.html#40129for
the replies.)
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/2] genclbuiltins.py: Add a arguments for funtion gen.

2013-10-30 Thread Dylan Baker
s/funtion/function/

On Wednesday, October 30, 2013 04:01:09 PM Yi Sun wrote:
> Via the new arg, we can configure the vector size while generating the
> test.cl. For NOT disturbing previous test cases, set a default value.
> 
> Signed-off-by: Yi Sun 
> 
> diff --git a/generated_tests/genclbuiltins.py
> b/generated_tests/genclbuiltins.py index 721191e..bdb18e9 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -332,7 +332,7 @@ def print_test(f, fnName, argType, functionDef, tests,
> testIdx, vecSize, tss): f.write('\n')
> 
> 

Rather than setting a default you don't want and then overwriting it with one 
you do, why don't you just make the default the value what you want?

> -def gen(types, minVersions, functions, testDefs, dirName):
> +def gen(types, minVersions, functions, testDefs, dirName, sizes=[]):
sizes=sorted([1] + VEC_WIDTHS) or sizes=sorted(ALL_WIDTHS); I don't know 
enough about CL testing to know whether ALL_WIDTHS is valid. Tom or Aaron 
would have to answer that.

>  # Create the output directory if required
>  if not os.path.exists(dirName):
>  os.makedirs(dirName)
> @@ -377,8 +377,10 @@ def gen(types, minVersions, functions, testDefs,
> dirName): numTests = len(outputValues)
> 
>  # Handle all available scalar/vector widths
> -sizes = sorted(VEC_WIDTHS)
> -sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
> +if sizes == []:
> +sizes = sorted(VEC_WIDTHS)
> +sizes.insert(0, 1)  # Add 1-wide scalar to the vector
> widths +

With the suggested changes you wouldn't need this if statement at all

>  for vecSize in sizes:
>  for testIdx in range(0, numTests):
>  print_test(f, fnName, dataType, functionDef, tests,

signature.asc
Description: This is a digitally signed message part.
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCHv2] cl: Add complex real world test: Pyrit

2013-10-30 Thread Dylan Baker
On Wednesday, October 30, 2013 10:00:28 AM Peter Wu wrote:
> (see below, it is about the Pyrit license)
> 
> On Tuesday 29 October 2013 17:06:10 Dylan Baker wrote:
> > On Tuesday, October 29, 2013 07:58:11 PM Tom Stellard wrote:
> > > On Tue, Oct 29, 2013 at 04:42:19PM -0700, Dylan Baker wrote:
> > > > On Tuesday, October 29, 2013 10:35:42 PM Peter Wu wrote:
> > > > > Pyrit computes pairwise master keys (PMKs) to attack WPA/WPA2-PSK.
> > > > > This
> > > > > 
> > > > > test verifies two aspects:
> > > > >  - Computation of the second round of a HMAC (using SHA-1).
> > > > >  - A calculation of the PMK key.
> > > > > 
> > > > > Both tests use test vectors from IEEE 802.11-2012, pre-processed to
> > > > > fit
> > > > > in the model used by Pyrit (one part is pre-calculated before
> > > > > passing
> > > > > it
> > > > > to the kernel).
> > > > > 
> > > > > The results have been verified with POCL and r600g (mesa master+llvm
> > > > > trunk).
> > > > > 
> > > > > Signed-off-by: Peter Wu 
> > > > > ---
> > > > > 
> > > > >  v2: copy global value to private memory space before passing to
> > > > >  function
> > > > >  
> > > > >  sha1_process. Fixes sha1_process_test failure with r600g.
> > > > > 
> > > > > ---
> > > > > 
> > > > >  tests/cl/program/execute/pyrit-wpa-psk.cl | 286
> > > > > 
> > > > > ++ 1 file changed, 286 insertions(+)
> > > > > 
> > > > >  create mode 100644 tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > > 
> > > > > diff --git a/tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > > b/tests/cl/program/execute/pyrit-wpa-psk.cl new file mode 100644
> > > > > index 000..d65b01f
> > > > > --- /dev/null
> > > > > +++ b/tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > > @@ -0,0 +1,286 @@
> > > > > +/*
> > > > > + * The test vector (3) is retrieved from IEEE 802.11-2012, M.4.3
> > > > > Test
> > > > > vectors. + * (pre-processed to be suitable for this kernel)
> > > > > + */
> > > > > +
> > > > > +/*!
> > > > > +[config]
> > > > > +name: Pyrit WPA2-PSK accelerator
> > > > > +clc_version_min: 10
> > > > > +
> > > > > +[test]
> > > > > +name: Modified SHA1
> > > > > +kernel_name: sha1_process_test
> > > > > +arg_in:  0 buffer uint[5] 0xe3bcd593 0x6ca97caf 0x4649641c
> > > > > 0x0e1f5a9a
> > > > > 0xfc7c4ae4 +arg_in:  1 buffer uint[5] 0x4fd12729 0x58d980a3
> > > > > 0x0a67237e
> > > > > 0xdc613a91 0xb22be163 +arg_out: 1 buffer uint[5] 0x361d6abc
> > > > > 0x7ce2d5af
> > > > > 0x76ae1207 0xf2f3c14b 0x1ea9d157 +
> > > > > +[test]
> > > > > +kernel_name: opencl_pmk_kernel
> > > > > +arg_in:  0 buffer uint[20] \
> > > > > +  0xe3bcd593 0x6ca97caf 0x4649641c 0x0e1f5a9a 0xfc7c4ae4 0x6a7ffb2d
> > > > > 0x441f7f1c \ +  0x26ee2ef9 0x5cc03865 0xbccde0ce 0x4fd12729
> > > > > 0x58d980a3
> > > > > 0x0a67237e 0xdc613a91 \ +  0xb22be163 0xe1f8b33b 0x097bf8ff
> > > > > 0x651c04f9
> > > > > 0x2e727d48 0xf6ba8052 +arg_out: 1 buffer uint[8]  \
> > > > > +  0xbecb9386 0x6bb8c383 0x2cb777c2 0xf559807c \
> > > > > +  0x8c59afcb 0x6eae7348 0x85001300 0xa981cc62
> > > > > +!*/
> > > > > +
> > > > > +typedef unsigned int uint32_t;
> > > > > +
> > > > > +typedef struct {
> > > > > +  uint32_t h0, h1, h2, h3, h4;
> > > > > +} SHA_DEV_CTX;
> > > > > +
> > > > > +#define CPY_DEVCTX(src, dst) \
> > > > > +{ \
> > > > > +  (dst).h0 = (src).h0; (dst).h1 = (src).h1; \
> > > > > +  (dst).h2 = (src).h2; (dst).h3 = (src).h3; \
> > > > > +  (dst).h4 = (src).h4; \
> > > > > +}
> > > > > +
> > > > > +typedef struct {
> > > > > +  SHA_DEV_CTX ctx_ipad;
> > > > > +  SHA_DEV_CTX ctx_opad;
> > > > > +  SHA_DEV_CTX e1;
> > > > > +  SHA_DEV_CTX e2;
> > > > > +} gpu_inbuffer;
> > > > > +
> > > > > +typedef struct {
> > > > > +  SHA_DEV_CTX pmk1;
> > > > > +  SHA_DEV_CTX pmk2;
> > > > > +} gpu_outbuffer;
> > > > > +
> > > > > +void sha1_process(__private const SHA_DEV_CTX ctx, __private
> > > > > SHA_DEV_CTX
> > > > > *data); +
> > > > > +__kernel
> > > > > +void sha1_process_test(__global const SHA_DEV_CTX *ctxp, __global
> > > > > SHA_DEV_CTX *data) { +  SHA_DEV_CTX data_priv;
> > > > > +  SHA_DEV_CTX ctx_priv;
> > > > > +
> > > > > +  CPY_DEVCTX(data[0], data_priv);
> > > > > +  CPY_DEVCTX(ctxp[0], ctx_priv);
> > > > > +  sha1_process(ctx_priv, &data_priv);
> > > > > +  CPY_DEVCTX(data_priv, data[0]);
> > > > > +}
> > > > > +
> > > > > +/* vim: set sw=2 ts=2 et: */
> > > > > +
> > > > > +/* The following is copied verbatim from _cpyrit_oclkernel.cl. */
> > > > > +/*
> > > > > +#
> > > > > +#Copyright 2008-2011 Lukas Lueg, lukas.l...@gmail.com
> > > > > +#
> > > > > +#This file is part of Pyrit.
> > > > > +#
> > > > > +#Pyrit is free software: you can redistribute it and/or modify
> > > > > +#it under the terms of the GNU General Public License as
> > > > > published
> > > > > by
> > > > > +#the Free Software Foundation, either version 3 of the License,
> > > > > or
> > > > > +#(at your option) any later version.
> > > > > +#
> > > > > +#Pyrit is distributed in the hope that it wil

Re: [Piglit] [PATCHv2] cl: Add complex real world test: Pyrit

2013-10-30 Thread Peter Wu
(see below, it is about the Pyrit license)

On Tuesday 29 October 2013 17:06:10 Dylan Baker wrote:
> On Tuesday, October 29, 2013 07:58:11 PM Tom Stellard wrote:
> > On Tue, Oct 29, 2013 at 04:42:19PM -0700, Dylan Baker wrote:
> > > On Tuesday, October 29, 2013 10:35:42 PM Peter Wu wrote:
> > > > Pyrit computes pairwise master keys (PMKs) to attack WPA/WPA2-PSK.
> > > > This
> > > > 
> > > > test verifies two aspects:
> > > >  - Computation of the second round of a HMAC (using SHA-1).
> > > >  - A calculation of the PMK key.
> > > > 
> > > > Both tests use test vectors from IEEE 802.11-2012, pre-processed to
> > > > fit
> > > > in the model used by Pyrit (one part is pre-calculated before passing
> > > > it
> > > > to the kernel).
> > > > 
> > > > The results have been verified with POCL and r600g (mesa master+llvm
> > > > trunk).
> > > > 
> > > > Signed-off-by: Peter Wu 
> > > > ---
> > > > 
> > > >  v2: copy global value to private memory space before passing to
> > > >  function
> > > >  
> > > >  sha1_process. Fixes sha1_process_test failure with r600g.
> > > > 
> > > > ---
> > > > 
> > > >  tests/cl/program/execute/pyrit-wpa-psk.cl | 286
> > > > 
> > > > ++ 1 file changed, 286 insertions(+)
> > > > 
> > > >  create mode 100644 tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > 
> > > > diff --git a/tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > b/tests/cl/program/execute/pyrit-wpa-psk.cl new file mode 100644
> > > > index 000..d65b01f
> > > > --- /dev/null
> > > > +++ b/tests/cl/program/execute/pyrit-wpa-psk.cl
> > > > @@ -0,0 +1,286 @@
> > > > +/*
> > > > + * The test vector (3) is retrieved from IEEE 802.11-2012, M.4.3 Test
> > > > vectors. + * (pre-processed to be suitable for this kernel)
> > > > + */
> > > > +
> > > > +/*!
> > > > +[config]
> > > > +name: Pyrit WPA2-PSK accelerator
> > > > +clc_version_min: 10
> > > > +
> > > > +[test]
> > > > +name: Modified SHA1
> > > > +kernel_name: sha1_process_test
> > > > +arg_in:  0 buffer uint[5] 0xe3bcd593 0x6ca97caf 0x4649641c 0x0e1f5a9a
> > > > 0xfc7c4ae4 +arg_in:  1 buffer uint[5] 0x4fd12729 0x58d980a3 0x0a67237e
> > > > 0xdc613a91 0xb22be163 +arg_out: 1 buffer uint[5] 0x361d6abc 0x7ce2d5af
> > > > 0x76ae1207 0xf2f3c14b 0x1ea9d157 +
> > > > +[test]
> > > > +kernel_name: opencl_pmk_kernel
> > > > +arg_in:  0 buffer uint[20] \
> > > > +  0xe3bcd593 0x6ca97caf 0x4649641c 0x0e1f5a9a 0xfc7c4ae4 0x6a7ffb2d
> > > > 0x441f7f1c \ +  0x26ee2ef9 0x5cc03865 0xbccde0ce 0x4fd12729 0x58d980a3
> > > > 0x0a67237e 0xdc613a91 \ +  0xb22be163 0xe1f8b33b 0x097bf8ff 0x651c04f9
> > > > 0x2e727d48 0xf6ba8052 +arg_out: 1 buffer uint[8]  \
> > > > +  0xbecb9386 0x6bb8c383 0x2cb777c2 0xf559807c \
> > > > +  0x8c59afcb 0x6eae7348 0x85001300 0xa981cc62
> > > > +!*/
> > > > +
> > > > +typedef unsigned int uint32_t;
> > > > +
> > > > +typedef struct {
> > > > +  uint32_t h0, h1, h2, h3, h4;
> > > > +} SHA_DEV_CTX;
> > > > +
> > > > +#define CPY_DEVCTX(src, dst) \
> > > > +{ \
> > > > +  (dst).h0 = (src).h0; (dst).h1 = (src).h1; \
> > > > +  (dst).h2 = (src).h2; (dst).h3 = (src).h3; \
> > > > +  (dst).h4 = (src).h4; \
> > > > +}
> > > > +
> > > > +typedef struct {
> > > > +  SHA_DEV_CTX ctx_ipad;
> > > > +  SHA_DEV_CTX ctx_opad;
> > > > +  SHA_DEV_CTX e1;
> > > > +  SHA_DEV_CTX e2;
> > > > +} gpu_inbuffer;
> > > > +
> > > > +typedef struct {
> > > > +  SHA_DEV_CTX pmk1;
> > > > +  SHA_DEV_CTX pmk2;
> > > > +} gpu_outbuffer;
> > > > +
> > > > +void sha1_process(__private const SHA_DEV_CTX ctx, __private
> > > > SHA_DEV_CTX
> > > > *data); +
> > > > +__kernel
> > > > +void sha1_process_test(__global const SHA_DEV_CTX *ctxp, __global
> > > > SHA_DEV_CTX *data) { +  SHA_DEV_CTX data_priv;
> > > > +  SHA_DEV_CTX ctx_priv;
> > > > +
> > > > +  CPY_DEVCTX(data[0], data_priv);
> > > > +  CPY_DEVCTX(ctxp[0], ctx_priv);
> > > > +  sha1_process(ctx_priv, &data_priv);
> > > > +  CPY_DEVCTX(data_priv, data[0]);
> > > > +}
> > > > +
> > > > +/* vim: set sw=2 ts=2 et: */
> > > > +
> > > > +/* The following is copied verbatim from _cpyrit_oclkernel.cl. */
> > > > +/*
> > > > +#
> > > > +#Copyright 2008-2011 Lukas Lueg, lukas.l...@gmail.com
> > > > +#
> > > > +#This file is part of Pyrit.
> > > > +#
> > > > +#Pyrit is free software: you can redistribute it and/or modify
> > > > +#it under the terms of the GNU General Public License as
> > > > published
> > > > by
> > > > +#the Free Software Foundation, either version 3 of the License,
> > > > or
> > > > +#(at your option) any later version.
> > > > +#
> > > > +#Pyrit is distributed in the hope that it will be useful,
> > > > +#but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > > +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > > > +#GNU General Public License for more details.
> > > > +#
> > > > +#You should have received a copy of the GNU General Public
> > > > License
> > > > +#along with Pyrit.  If not, see 

[Piglit] [PATCH 2/2] The return code of the fucntion isnan is -1 for vector types.

2013-10-30 Thread Yi Sun
According to the OpenCL spec version 1.2/1.1 chacpter 6.12.6:
The functions isequal, isnotequal, isgreater, isgreaterequal, isless, 
islessequal, islessgreater,
isfinite, isinf, isnan, isnormal, isordered, isunordered and signbit described 
in table 6.14 shall
return a 0 if the specified relation is false and a 1 if the specified relation 
is true for scalar
argument types. These functions shall return a 0 if the specified relation is 
false and a –1 (i.e. all
bits set) if the specified relation is true for vector argument types.

So, here we can remove the scalar argument types. And change the output from 1 
to -1.

Signed-off-by: Yi Sun 

diff --git a/generated_tests/generate-cl-relational-builtins.py 
b/generated_tests/generate-cl-relational-builtins.py
old mode 100644
new mode 100755
index af6849f..5ed73ca
--- a/generated_tests/generate-cl-relational-builtins.py
+++ b/generated_tests/generate-cl-relational-builtins.py
@@ -47,7 +47,7 @@ tests = {
 'arg_types': [I, F],
 'function_type': 'ttt',
 'values': [
-[0,   1,0,   0],# Result
+[0,   -1,0,   0],# Result
 [0.0, float("nan"), 1.0, float("inf") ] # Arg0
 ]
 }
@@ -63,7 +63,7 @@ def main():
 for fnName in functions:
 testDefs[(dataType, fnName)] = tests[fnName]
 
-gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName)
+gen(DATA_TYPES, CLC_VERSION_MIN, functions, testDefs, dirName, [2, 4, 8, 
16])
 
 
 main()
-- 
1.7.6.4

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


[Piglit] [PATCH 1/2] genclbuiltins.py: Add a arguments for funtion gen.

2013-10-30 Thread Yi Sun
Via the new arg, we can configure the vector size while generating the test.cl.
For NOT disturbing previous test cases, set a default value.

Signed-off-by: Yi Sun 

diff --git a/generated_tests/genclbuiltins.py b/generated_tests/genclbuiltins.py
index 721191e..bdb18e9 100644
--- a/generated_tests/genclbuiltins.py
+++ b/generated_tests/genclbuiltins.py
@@ -332,7 +332,7 @@ def print_test(f, fnName, argType, functionDef, tests, 
testIdx, vecSize, tss):
 f.write('\n')
 
 
-def gen(types, minVersions, functions, testDefs, dirName):
+def gen(types, minVersions, functions, testDefs, dirName, sizes=[]):
 # Create the output directory if required
 if not os.path.exists(dirName):
 os.makedirs(dirName)
@@ -377,8 +377,10 @@ def gen(types, minVersions, functions, testDefs, dirName):
 numTests = len(outputValues)
 
 # Handle all available scalar/vector widths
-sizes = sorted(VEC_WIDTHS)
-sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
+if sizes == []:
+sizes = sorted(VEC_WIDTHS)
+sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
+
 for vecSize in sizes:
 for testIdx in range(0, numTests):
 print_test(f, fnName, dataType, functionDef, tests,
-- 
1.7.6.4

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