Re: [Piglit] [Mesa-dev] Rename "master" branch to "main"?

2021-04-30 Thread Jordan Justen
On 2021-03-25 08:11:45, Jason Ekstrand wrote:
> On Thu, Mar 25, 2021 at 9:41 AM Rob Clark  wrote:
> >
> > yeah, I meant to convert a repo w/ more MRs than 7 but less than mesa
> > using the script to beta test that, wasn't suggesting to do it by hand
> 
> Plan is to convert piglit next.  It's sitting at about 60 open MRs.
> 

Piglit's conversion went through last month without any issues.
Therefore I opened an MR for mesa:

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10474

This MR makes some changes to the tree to rename the branch, and it
adds an empty warning message commit. This warning message will live
as the last commit on the upstream master branch for the forseeable
future as a notice to developers that they need to change the upstream
tracking ref to main.

We also have a related issue open to track some other tasks related to
the rename:

https://gitlab.freedesktop.org/mesa/mesa/-/issues/4501

Timing wise, it's probably about the best time around now to maximize
the time before the next release branchpoint.

Regarding the 21.1 release, I think there could be arguments for
before or after. One reason to go before the release is to work out
any kinks before the potentially more urgent 20.1.1 release. But,
before or after, I think Eric and Dylan will be more than capable of
doing some extra checks to verify that the scripts are working for the
stable branches.

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] piglit default main branch results - Re: [Mesa-dev] Rename "master" branch to "main"?

2021-03-30 Thread Jordan Justen
On 2021-03-24 23:47:46, Jordan Justen wrote:
> On 2021-03-24 21:14:57, Jason Ekstrand wrote:
> > 
> > Jordan, is there any way you can make the script sort by last updated 
> > before it
> > re-targets the MRs so they at least stay in the same order? Updating them 
> > in MR
> > # order wouldn't be bad either, I guess.
> > 
> 
> It already does process them sorting by the oldest "update time"
> first, so roughly speaking the order sorted by update time should be
> the same.
> 
> I don't know what might happen if 2 MRs were updated within the same
> second. But, the updates are actually a bit slow (maybe ~1 update per
> second), so there doesn't seem to be much risk, as far as I can see,
> of, for instance, 10 updates happening within the same second.
> 

Crucible and piglit are now changed over to using main.

Piglit has had at least 2 MR's merge to main now:
 * https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/463
 * https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/497

It appears that the "last updated sort order" stayed 100% the same
before and after the script ran to update the open MR branch targets.

It took ~48 seconds for the script to update 58 piglit merge-requests.

I have only seen one issue so far for the piglit default branch
change. It appears that the piglit patchwork scripting isn't
configured for the main branch. I think it's long past time to retire
the piglit patchwork, so I made a request to the admins to do that. I
think Mesa already retired patchwork.

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [Mesa-dev] Rename "master" branch to "main"?

2021-03-26 Thread Jordan Justen
On 2021-03-24 21:14:57, Jason Ekstrand wrote:
> 
> Jordan, is there any way you can make the script sort by last updated before 
> it
> re-targets the MRs so they at least stay in the same order? Updating them in 
> MR
> # order wouldn't be bad either, I guess.
> 

It already does process them sorting by the oldest "update time"
first, so roughly speaking the order sorted by update time should be
the same.

I don't know what might happen if 2 MRs were updated within the same
second. But, the updates are actually a bit slow (maybe ~1 update per
second), so there doesn't seem to be much risk, as far as I can see,
of, for instance, 10 updates happening within the same second.

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [Mesa-dev] Rename "master" branch to "main"?

2021-03-24 Thread Jordan Justen
On 2021-03-23 09:38:59, Eric Anholt wrote:
> On Tue, Mar 23, 2021 at 7:02 AM Jason Ekstrand  wrote:
> >
> > Trying to pick this discussion back up.  Daniel Stone thinks it's a
> > half hour of API bashing to retarget all the MRs so, if the fd.o
> > admins have some heads up, it should be tractable.  Should we do this
> > right after branching 21.1 along with the LTS branch?
> 
> +1

Jason,

I opened a related Mesa issue:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/4501

I made this change in crucible, and used a script to update the 7 MR
target branches:
https://gitlab.freedesktop.org/mesa/crucible/-/issues/5

As mentioned in the Mesa issue, I think we should use piglit as
another test run before changing Mesa:
https://gitlab.freedesktop.org/mesa/piglit/-/issues/50

Piglit currently has 60 open merge requests.

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] Should piglit drop bugzilla and move to using gitlab issues?

2019-03-01 Thread Jordan Justen
I guess piglit makes very light usage of bugzilla. Would it be simpler
to just use gitlab issues in the piglit gitlab project?

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

[Piglit] Piglit gitlab merge requests enabled - Re: GitLab migration of Piglit

2019-03-01 Thread Jordan Justen
On 2019-02-20 07:36:48, Den wrote:
> > Given the discussion below, I think we'll make piglit a sub-project of 
> > mesa.  Those who need commit access to piglit but not mesa can be 
> > added directly to the piglit project.
> 
> Hi list.
> 
> Since piglit was also moved to the gitlab, same with mesa, our team is 
> interested in process workflow for contributing to it. Before (again, 
> same with mesa) we created mailing threads and after reviewing test was 
> pushed to master by somebody with access.
> Now mesa got a new possibility for reviewing - merge requests, which 
> doesn't exist in piglit. Also, according to Jason's conclusion, anybody 
> can request commit access to piglit. But in this case how the review 
> process will be done?

I notice that no one replied to Den with concern about using merge
requests for piglit.

Several of us discussed this yesterday, and it seems even more useful
for the piglit project to use merge requests than Mesa.

Therefore, I enabled merge requests on the piglit project. If no one
objects, then I think we should document it on the piglit webpage.

Does anyone have concerns about this plan?

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] Piglit website in sphinx

2019-01-07 Thread Jordan Justen
On 2018-12-18 14:57:43, Dylan Baker wrote:
> Quoting Eric Anholt (2018-12-18 11:21:08)
> > Jordan Justen  writes:
> > 
> > > On 2018-12-17 22:07:21, Tapani Pälli wrote:
> > >> Hi;
> > >> 
> > >> On 12/17/18 11:50 AM, Jordan Justen wrote:
> > >> > Although I doubt it generates much traffic, I wanted to try to convert
> > >> > the https://piglit.freedesktop.org/ homepage into an 'auto-building'
> > >> > gitlab branch.
> > >> > 
> > >> > I think the current site was built by ikiwiki, but I was after
> > >> > spending way more time that I hoped, I still was unable to reproduce
> > >> > the site without lots of extra undesirable links.
> > >> > 
> > >> > So, I tried converting it to sphinx. Of course, I expected it would
> > >> > look somewhat different with sphinx. This change proved much easier,
> > >> > and I think looks pretty good:
> > >> > 
> > >> > https://jljusten.pages.freedesktop.org/piglit/
> > >> 
> > >> Looks nice and clean! Maybe at same time the documentation could be 
> > >> improved. Some of the Piglit options seem to be missing, as example I 
> > >> never saw PIGLIT_PLATFORM documented, there is no list of platforms so 
> > >> only way is to grep the source ... or are they somewhere?
> > >
> > > Eric pointed out that it could be good to make the website sources
> > > appear under the docs directory, like Mesa does. I made the changes to
> > > do that here:
> > >
> > > https://gitlab.freedesktop.org/jljusten/piglit/commits/master
> > >
> > > With this version, the website would be rebuilt whenever the docs
> > > directory changes on the master branch.
> > >
> > > I guess my point is that by putting the website under the docs
> > > directory of the main branch, maybe it will allow others to contribute
> > > changes (like this) more easily. :)
> > >
> > > Another change that we might consider is whether to use merge requests
> > > in piglit. That would also require a change to the website.
> > 
> > This looks pretty nice to me.
> > 
> > Acked-by: Eric Anholt 
> 
> I also think it looks pretty nice, and doesn't require me bothering Daniel 
> Stone
> to remind me how to update the webpage when it needs to happen every 10 years 
> or
> so...
> 
> Acked-by: Dylan Baker 

Eric, Dylan,

I didn't really follow the normal process of posting patches, yet I
think 2 Acked-by is better than average for code review on piglit. :)

Should I post the patches to the list, or just merge it with your
guys' acks?

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Piglit website in sphinx

2018-12-17 Thread Jordan Justen
On 2018-12-17 22:07:21, Tapani Pälli wrote:
> Hi;
> 
> On 12/17/18 11:50 AM, Jordan Justen wrote:
> > Although I doubt it generates much traffic, I wanted to try to convert
> > the https://piglit.freedesktop.org/ homepage into an 'auto-building'
> > gitlab branch.
> > 
> > I think the current site was built by ikiwiki, but I was after
> > spending way more time that I hoped, I still was unable to reproduce
> > the site without lots of extra undesirable links.
> > 
> > So, I tried converting it to sphinx. Of course, I expected it would
> > look somewhat different with sphinx. This change proved much easier,
> > and I think looks pretty good:
> > 
> > https://jljusten.pages.freedesktop.org/piglit/
> 
> Looks nice and clean! Maybe at same time the documentation could be 
> improved. Some of the Piglit options seem to be missing, as example I 
> never saw PIGLIT_PLATFORM documented, there is no list of platforms so 
> only way is to grep the source ... or are they somewhere?

Eric pointed out that it could be good to make the website sources
appear under the docs directory, like Mesa does. I made the changes to
do that here:

https://gitlab.freedesktop.org/jljusten/piglit/commits/master

With this version, the website would be rebuilt whenever the docs
directory changes on the master branch.

I guess my point is that by putting the website under the docs
directory of the main branch, maybe it will allow others to contribute
changes (like this) more easily. :)

Another change that we might consider is whether to use merge requests
in piglit. That would also require a change to the website.

-Jordan

> > The source code is here in this branch:
> > 
> > https://gitlab.freedesktop.org/jljusten/piglit/commits/website
> > 
> > It is setup such that we could add a small 'website' branch to the
> > piglit repo. The branch's history would be detacted from the source
> > code history.
> > 
> > Then, if we need to change the piglit website again, in, say a decade
> > or so :), it'll be a bit simpler.
> > 
> > Does it look ok, and does it seem like an ok plan?
> > 
> > -Jordan
> > ___
> > Piglit mailing list
> > Piglit@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/piglit
> > 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Piglit website in sphinx

2018-12-17 Thread Jordan Justen
On 2018-12-17 12:09:23, Eric Anholt wrote:
> Jordan Justen  writes:
> 
> > Although I doubt it generates much traffic, I wanted to try to convert
> > the https://piglit.freedesktop.org/ homepage into an 'auto-building'
> > gitlab branch.
> >
> > I think the current site was built by ikiwiki, but I was after
> > spending way more time that I hoped, I still was unable to reproduce
> > the site without lots of extra undesirable links.
> >
> > So, I tried converting it to sphinx. Of course, I expected it would
> > look somewhat different with sphinx. This change proved much easier,
> > and I think looks pretty good:
> >
> > https://jljusten.pages.freedesktop.org/piglit/
> >
> > The source code is here in this branch:
> >
> > https://gitlab.freedesktop.org/jljusten/piglit/commits/website
> >
> > It is setup such that we could add a small 'website' branch to the
> > piglit repo. The branch's history would be detacted from the source
> > code history.
> >
> > Then, if we need to change the piglit website again, in, say a decade
> > or so :), it'll be a bit simpler.
> >
> > Does it look ok, and does it seem like an ok plan?
> 
> Looks nice to me, only nit is the title is "Piglit 1 documentation" --
> where did that "1" come from?

Whoops. :) I guess the full title was "Piglit -- Piglit 1
documentation". If I set "html_title = None" in the config file, it
becomes "Piglit".

> I kind of like having the website in master so that some of the contents
> on the site can be documentation in-tree as well, but I'm happy with it
> at least being easily modifiable.

I can look into embedding it in master for piglit.

For waffle, we're looking at something kind of similar for the
website, but we also have the release tarballs in the website.
Therefore, we want to use a separate branch so the tarballs can use
git-lfs, and not be part of the main repo. With git-lfs the tarballs
are downloaded when you checkout the website branch, but not if you
just clone the repo.

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] Piglit website in sphinx

2018-12-17 Thread Jordan Justen
Although I doubt it generates much traffic, I wanted to try to convert
the https://piglit.freedesktop.org/ homepage into an 'auto-building'
gitlab branch.

I think the current site was built by ikiwiki, but I was after
spending way more time that I hoped, I still was unable to reproduce
the site without lots of extra undesirable links.

So, I tried converting it to sphinx. Of course, I expected it would
look somewhat different with sphinx. This change proved much easier,
and I think looks pretty good:

https://jljusten.pages.freedesktop.org/piglit/

The source code is here in this branch:

https://gitlab.freedesktop.org/jljusten/piglit/commits/website

It is setup such that we could add a small 'website' branch to the
piglit repo. The branch's history would be detacted from the source
code history.

Then, if we need to change the piglit website again, in, say a decade
or so :), it'll be a bit simpler.

Does it look ok, and does it seem like an ok plan?

-Jordan
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/3] sanity: Fix test names

2018-09-28 Thread Jordan Justen
I noticed that although the tests ran successfully, the output of
'piglit summary console' did not have proper names.

For example, before:
../../build/debug/piglit/target_api/no_api/tests/tests/fast_color_clear/all-colors:
 pass

after:
fast_color_clear/all-colors: pass

Cc: Dylan Baker 
Signed-off-by: Jordan Justen 
---
 tests/sanity.py | 62 +
 1 file changed, 32 insertions(+), 30 deletions(-)

diff --git a/tests/sanity.py b/tests/sanity.py
index 6ba80ccbc..ed3aba004 100644
--- a/tests/sanity.py
+++ b/tests/sanity.py
@@ -49,46 +49,48 @@ gen_basepath = 
os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), basepath
 
 def add_shader_test(shader):
 """Given an adder, creates a group and adds a shader test."""
-abs_path = os.path.abspath(shader)
+basedir = TESTS_DIR
+abs_path = os.path.abspath(os.path.join(basedir, shader))
+dirpath, filename = os.path.split(os.path.join(basedir, shader))
+dirname = os.path.relpath(dirpath, basepath)
+filepath = os.path.join(dirname, filename)
+
 if os.path.commonprefix([abs_path, GENERATED_TESTS_DIR]) == 
GENERATED_TESTS_DIR:
-installpath = os.path.relpath(shader, gen_basepath)
+installpath = os.path.relpath(filepath, gen_basepath)
 else:
 installpath = None
 
-dirpath = os.path.dirname(shader)
-groupname = grouptools.from_path(os.path.relpath(
-dirpath, GENERATED_TESTS_DIR if installpath else TESTS_DIR))
+groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 testname = os.path.splitext(os.path.basename(shader))[0]
-
-profile.test_list[grouptools.join(groupname, testname)] = \
-ShaderTest.new(shader, installpath)
+group = grouptools.join(groupname, testname)
+profile.test_list[group] = ShaderTest.new(filepath, installpath)
 
 
 profile = TestProfile()
 
 shader_tests = (
-'tests/fast_color_clear/all-colors.shader_test',
-'tests/shaders/arb_texture_gather-miplevels.shader_test',
-'tests/shaders/glsl-algebraic-add-zero.shader_test',
-'tests/shaders/glsl-derivs-varyings.shader_test',
-'tests/shaders/glsl-fs-max-3.shader_test',
-'tests/shaders/glsl-fs-texture2d-branching.shader_test',
-'tests/shaders/glsl-vs-mat-mul-1.shader_test',
-
'tests/spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test',
-
'tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test',
-'tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test',
-'tests/spec/arb_compute_shader/execution/shared-atomics.shader_test',
-'tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test',
-
'tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test',
-
'tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test',
-'tests/spec/arb_shader_group_vote/cs-all.shader_test',
-
'tests/spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test',
-
'tests/spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test',
-
'tests/spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test',
-'tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test',
-'tests/spec/arb_tessellation_shader/execution/sanity.shader_test',
-'tests/spec/glsl-1.50/execution/geometry-basic.shader_test',
-'tests/spec/oes_viewport_array/viewport-gs-write-simple.shader_test',
+'fast_color_clear/all-colors.shader_test',
+'shaders/arb_texture_gather-miplevels.shader_test',
+'shaders/glsl-algebraic-add-zero.shader_test',
+'shaders/glsl-derivs-varyings.shader_test',
+'shaders/glsl-fs-max-3.shader_test',
+'shaders/glsl-fs-texture2d-branching.shader_test',
+'shaders/glsl-vs-mat-mul-1.shader_test',
+
'spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test',
+
'spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test',
+'spec/arb_compute_shader/execution/basic-ssbo.shader_test',
+'spec/arb_compute_shader/execution/shared-atomics.shader_test',
+'spec/arb_derivative_control/execution/dfdx-dfdy.shader_test',
+
'spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test',
+
'spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test',
+'spec/arb_shader_group_vote/cs-all.shader_test',
+
'spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test',
+'spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test',
+
'spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test',
+'spec/arb_tessellation_shader/execution/barrier-patch.shader_test',
+'spec/arb_tessellation_shader/execution/sanity.shader_test',
+'spe

[Piglit] [PATCH 2/3] sanity: Support generated shader tests

2018-09-28 Thread Jordan Justen
Cc: Dylan Baker 
Signed-off-by: Jordan Justen 
---
 tests/CMakeLists.no_api.txt | 2 +-
 tests/sanity.py | 9 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/CMakeLists.no_api.txt b/tests/CMakeLists.no_api.txt
index 632c6786a..455b059d8 100644
--- a/tests/CMakeLists.no_api.txt
+++ b/tests/CMakeLists.no_api.txt
@@ -61,7 +61,7 @@ add_custom_target(gen-gl-xml)
 piglit_generate_xml(opengl opengl gen-gl-xml "")
 piglit_generate_xml(quick_gl quick_gl gen-gl-xml "")
 piglit_generate_xml(llvmpipe_gl llvmpipe_gl gen-gl-xml "")
-piglit_generate_xml(sanity sanity gen-gl-xml "")
+piglit_generate_xml(sanity sanity gen-gl-xml "" gen-gl-tests)
 
 add_custom_target(gen-gl-gen-xml)
 piglit_generate_xml(glslparser glslparser gen-gl-gen-xml "" gen-gl-tests 
static-glslparser-tests static-asmparser-tests)
diff --git a/tests/sanity.py b/tests/sanity.py
index ed3aba004..0011000a2 100644
--- a/tests/sanity.py
+++ b/tests/sanity.py
@@ -49,8 +49,13 @@ gen_basepath = 
os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), basepath
 
 def add_shader_test(shader):
 """Given an adder, creates a group and adds a shader test."""
-basedir = TESTS_DIR
-abs_path = os.path.abspath(os.path.join(basedir, shader))
+for d in (TESTS_DIR, GENERATED_TESTS_DIR,):
+s = os.path.abspath(os.path.join(d, shader))
+if os.path.exists(s):
+basedir = d
+abs_path = s
+break
+
 dirpath, filename = os.path.split(os.path.join(basedir, shader))
 dirname = os.path.relpath(dirpath, basepath)
 filepath = os.path.join(dirname, filename)
-- 
2.19.0

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


[Piglit] [PATCH 3/3] sanity: Add some generated tests

2018-09-28 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/sanity.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/tests/sanity.py b/tests/sanity.py
index 0011000a2..12f1614c9 100644
--- a/tests/sanity.py
+++ b/tests/sanity.py
@@ -81,19 +81,26 @@ shader_tests = (
 'shaders/glsl-fs-max-3.shader_test',
 'shaders/glsl-fs-texture2d-branching.shader_test',
 'shaders/glsl-vs-mat-mul-1.shader_test',
+
'spec/amd_shader_trinary_minmax/execution/built-in-functions/cs-max3-uvec4-uvec4-uvec4.shader_test',
+
'spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-max3-vec4-vec4-vec4.shader_test',
 
'spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test',
 
'spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test',
 'spec/arb_compute_shader/execution/basic-ssbo.shader_test',
 'spec/arb_compute_shader/execution/shared-atomics.shader_test',
 'spec/arb_derivative_control/execution/dfdx-dfdy.shader_test',
 
'spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test',
+
'spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-distance-dvec4-dvec4.shader_test',
+
'spec/arb_gpu_shader_int64/execution/built-in-functions/cs-op-div-i64vec4-i64vec4.shader_test',
 
'spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test',
 'spec/arb_shader_group_vote/cs-all.shader_test',
 
'spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test',
+'spec/arb_shader_precision/gs-op-div-vec4-vec4.shader_test',
 'spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test',
 
'spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test',
 'spec/arb_tessellation_shader/execution/barrier-patch.shader_test',
+
'spec/arb_tessellation_shader/execution/built-in-functions/tcs-any-bvec4-using-if.shader_test',
 'spec/arb_tessellation_shader/execution/sanity.shader_test',
+
'spec/arb_vertex_attrib_64bit/execution/vs_in/vs-input-uint_uvec4-double_dmat3x4_array2-position.shader_test',
 'spec/glsl-1.50/execution/geometry-basic.shader_test',
 'spec/oes_viewport_array/viewport-gs-write-simple.shader_test',
 )
-- 
2.19.0

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


[Piglit] [PATCH 2/2] sanity: Add various shader_runner tests

2018-09-21 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/sanity.py | 25 +
 1 file changed, 25 insertions(+)

diff --git a/tests/sanity.py b/tests/sanity.py
index 566d63218..5550cd13e 100644
--- a/tests/sanity.py
+++ b/tests/sanity.py
@@ -67,10 +67,35 @@ def add_shader_test(shader):
 profile = TestProfile()
 
 shader_tests = '''
+generated_tests/spec/amd_shader_trinary_minmax/execution/built-in-functions/cs-max3-uvec4-uvec4-uvec4.shader_test
+generated_tests/spec/amd_shader_trinary_minmax/execution/built-in-functions/tcs-max3-vec4-vec4-vec4.shader_test
+generated_tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-distance-dvec4-dvec4.shader_test
+generated_tests/spec/arb_gpu_shader_int64/execution/built-in-functions/cs-op-div-i64vec4-i64vec4.shader_test
+generated_tests/spec/arb_shader_precision/gs-op-div-vec4-vec4.shader_test
+generated_tests/spec/arb_tessellation_shader/execution/built-in-functions/tcs-any-bvec4-using-if.shader_test
+generated_tests/spec/arb_vertex_attrib_64bit/execution/vs_in/vs-input-uint_uvec4-double_dmat3x4_array2-position.shader_test
+tests/fast_color_clear/all-colors.shader_test
+tests/shaders/arb_texture_gather-miplevels.shader_test
 tests/shaders/glsl-algebraic-add-zero.shader_test
+tests/shaders/glsl-derivs-varyings.shader_test
+tests/shaders/glsl-fs-max-3.shader_test
+tests/shaders/glsl-fs-texture2d-branching.shader_test
+tests/shaders/glsl-vs-mat-mul-1.shader_test
+tests/spec/arb_arrays_of_arrays/execution/image_store/basic-imageStore-mixed-const-non-const-uniform-index.shader_test
+tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst.shader_test
 tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
+tests/spec/arb_compute_shader/execution/shared-atomics.shader_test
+tests/spec/arb_derivative_control/execution/dfdx-dfdy.shader_test
+tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldReverse.shader_test
+tests/spec/arb_shader_ballot/execution/fs-readFirstInvocation-uint-loop.shader_test
+tests/spec/arb_shader_group_vote/cs-all.shader_test
+tests/spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test
+tests/spec/arb_shader_subroutine/execution/two-subroutines-nested.shader_test
+tests/spec/arb_shader_texture_lod/execution/glsl-fs-shadow2DGradARB-cumulative.shader_test
+tests/spec/arb_tessellation_shader/execution/barrier-patch.shader_test
 tests/spec/arb_tessellation_shader/execution/sanity.shader_test
 tests/spec/glsl-1.50/execution/geometry-basic.shader_test
+tests/spec/oes_viewport_array/viewport-gs-write-simple.shader_test
 '''
 
 for line in shader_tests.split():
-- 
2.18.0

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


Re: [Piglit] [PATCH] tests/sanity: Rework sanity to be more useful

2018-07-03 Thread Jordan Justen
On 2018-07-03 10:24:27, Dylan Baker wrote:
> Originally sanity was billed as a sort of "check if the installation
> works" sort of profile. No one seems to use sanity at all, so we'd like
> to re-purpose it (a little) to be a sort of "driver sanity" check, in
> other words, a minimal number of tests that are able to touch a broad
> swath of OpenGL features.
> 
> Some of the things this touches now:
>  - vertex shaders
>  - fragment shaders
>  - geometry shaders
>  - tesselation shaders
>  - compute shaders
>  - transform feedback
>  - ssbos
>  - atomics
> ---
>  tests/sanity.py | 66 +
>  1 file changed, 61 insertions(+), 5 deletions(-)
> 
> cc: jordan.l.jus...@intel.com
> 
> diff --git a/tests/sanity.py b/tests/sanity.py
> index cb66bd33c..13f7859fb 100644
> --- a/tests/sanity.py
> +++ b/tests/sanity.py
> @@ -1,20 +1,76 @@
> -#
> -# Minimal tests to check whether the installation is working
> -#
> +# Copyright © 2018 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 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.
> +
> +"""A minimal profile that aims to touch test most major OpenGL features with 
> as
> +few tests as possible.
> +
> +This is largely aimed at bring up of a new driver or a driver on new 
> hardware,
> +where performance and stability are not necessarily the best. The idea is to
> +touch the main functionality of important features without running for too
> +long. This *will* miss many corner cases, that's okay. For more stable
> +hardware or software stacks the "gpu" or "quick" profiles are probably more
> +appropriate.
> +"""
>  
>  from __future__ import (
>  absolute_import, division, print_function, unicode_literals
>  )
> +import os
>  
>  from framework import grouptools
>  from framework.profile import TestProfile
>  from framework.test import PiglitGLTest
> +from framework.test.shader_test import ShaderTest
> +from .py_modules.constants import GENERATED_TESTS_DIR, TESTS_DIR
>  
>  __all__ = ['profile']
>  
> +basepath = os.path.normpath(os.path.join(TESTS_DIR, '..'))
> +gen_basepath = os.path.relpath(os.path.join(GENERATED_TESTS_DIR, '..'), 
> basepath)
> +
> +
> +def add_shader_test(shader):
> +"""Given an adder, creates a group and adds a shader test."""
> +abs_path = os.path.abspath(shader)
> +if os.path.commonprefix([abs_path, GENERATED_TESTS_DIR]) == 
> GENERATED_TESTS_DIR:
> +installpath = os.path.relpath(shader, gen_basepath)
> +else:
> +installpath = None
> +
> +dirpath = os.path.dirname(shader)
> +groupname = grouptools.from_path(os.path.relpath(
> +dirpath, GENERATED_TESTS_DIR if installpath else TESTS_DIR))
> +testname = os.path.splitext(os.path.basename(shader))[0]
> +
> +profile.test_list[grouptools.join(groupname, testname)] = \
> +ShaderTest.new(shader, installpath)
> +
> +
>  profile = TestProfile()
>  
> +add_shader_test('tests/shaders/glsl-algebraic-add-zero.shader_test')

Will add_shader_test handle the unix path sep on windows?

Thanks for looking into this!

Reviewed-by: Jordan Justen 

> +add_shader_test('tests/spec/glsl-1.50/execution/geometry-basic.shader_test')
> +add_shader_test('tests/spec/arb_tessellation_shader/execution/sanity.shader_test')
> +add_shader_test('tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test')
> +
>  with profile.test_list.group_manager(
>  PiglitGLTest,
> -grouptools.join('spec', '!OpenGL 1.0')) as g:
> -g(['gl-1.0-readpixsanity'], run_concurrent=True)
> +grouptools.join('spec', 'glsl-1.50')) as g:
> +g(['glsl-1.50-transform-feedback-builtins'], 
> 'transform-feedback-builtins')
> -- 
> 2.18.0
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework: add a --timeout parameter

2018-06-28 Thread Jordan Justen
On 2018-06-28 13:45:21, Dylan Baker wrote:
> This allows an timeout (in integers) to be set for each test. If the
> tests run over this alotted time they'll be killed and the status will
> be set to timeout. This only work on Unix-like machines running with
> python 3.x or with 2.7 and subprocess32 installed.
> 
> It can be made to work for windows, either by bumping the python version
> or by writing some windows specific code for killing processes.
> 
> cc: jordan.l.jus...@intel.com
> cc: clayton.a.cr...@intel.com
> 
> ---
>  framework/programs/run.py | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/framework/programs/run.py b/framework/programs/run.py
> index afb7eb78d..337a49631 100644
> --- a/framework/programs/run.py
> +++ b/framework/programs/run.py
> @@ -39,6 +39,7 @@ from framework import exceptions
>  from framework import monitoring
>  from framework import profile
>  from framework.results import TimeAttribute
> +from framework.test import base
>  from . import parsers
>  
>  __all__ = ['run',
> @@ -220,6 +221,13 @@ def _run_parser(input_):
>  dest="ignore_missing",
>  action="store_true",
>  help="missing tests are considered as 'notrun'")
> +parser.add_argument('--timeout',
> +dest='timeout',
> +action='store',
> +type=int,
> +default=None,
> +metavar='',
> +help='Sets a timeout threshold for tests to run in.')

Since the tests can override this, should we say a *default* timeout?
(And add default in subject?)

I think --timeout is good for the param. (And not --default-timeout)

Reviewed-by: Jordan Justen 

>  parser.add_argument("test_profile",
>  metavar="",
>  nargs='+',
> @@ -247,6 +255,7 @@ def _create_metadata(args, name, forced_test_list):
>  opts['platform'] = args.platform
>  opts['forced_test_list'] = forced_test_list
>  opts['ignore_missing'] = args.ignore_missing
> +opts['timeout'] = args.timeout
>  
>  metadata = {'options': opts}
>  metadata['name'] = name
> @@ -291,6 +300,7 @@ def run(input_):
>  
>  """
>  args = _run_parser(input_)
> +base.Test.timeout = args.timeout
>  _disable_windows_exception_messages()
>  
>  # If dmesg is requested we must have serial run, this is because dmesg
> @@ -423,6 +433,7 @@ def resume(input_):
>  core.get_config(args.config_file)
>  
>  options.OPTIONS.env['PIGLIT_PLATFORM'] = results.options['platform']
> +base.Test.timeout = results.options['timeout']
>  
>  results.options['env'] = core.collect_system_info()
>  results.options['name'] = results.name
> -- 
> 2.18.0
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 1/2] glsl-1.10 / glsl-1.20: Don't use ortho in variable indexing tests.

2018-06-12 Thread Jordan Justen
From: Matt Turner 

Using ortho makes shrinking the window size much more difficult, which
makes running tests in simulation take much longer.

Ref: https://lists.freedesktop.org/archives/piglit/2013-November/008298.html
[jordan.l.jus...@intel.com: convert from shell script to mako]
Signed-off-by: Jordan Justen 
Cc: Kenneth Graunke 
---
 .../templates/gen_variable_index_read_tests/helpers.mako   | 7 ++-
 .../gen_variable_index_write_tests/fs.shader_test.mako | 3 ---
 .../templates/gen_variable_index_write_tests/helpers.mako  | 4 ++--
 .../gen_variable_index_write_tests/vs.shader_test.mako | 3 ---
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git 
a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako 
b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
index 155eb8c4e..3ca306daf 100644
--- a/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_read_tests/helpers.mako
@@ -179,9 +179,6 @@ void main()
 <%def name="emit_test_vectors(params)" filter="dedent">
   <%block filter="newlines">
   [test]
-  clear color 0.5 0.5 0.5 0.5
-  clear
-  ortho
   % if params.mode == 'uniform' and params.glsl_version == 110 and 
params.test_array_dim == 0:
 uniform ${params.cxr_type} m ${matrix_data(1, params.matrix_dim, delim=' 
')}
   % endif
@@ -220,8 +217,8 @@ void main()
   x = x_base + 15 * column - 10
   y = 15 * row - 10
 %>
-draw rect ${x} ${y} 10 10
-probe rgb ${x + 5} ${y + 5} 0.0 1.0 0.0
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
 
 
   % endfor
diff --git 
a/generated_tests/templates/gen_variable_index_write_tests/fs.shader_test.mako 
b/generated_tests/templates/gen_variable_index_write_tests/fs.shader_test.mako
index 1db0e5c69..f22ae888c 100644
--- 
a/generated_tests/templates/gen_variable_index_write_tests/fs.shader_test.mako
+++ 
b/generated_tests/templates/gen_variable_index_write_tests/fs.shader_test.mako
@@ -33,8 +33,5 @@ void main() { gl_Position = gl_ModelViewProjectionMatrix * 
gl_Vertex; }
 ${helpers.emit_fs(params)}
 
 [test]
-clear color 0.5 0.5 0.5 0.5
-clear
-ortho
 
 ${helpers.emit_test_vectors(params)}
diff --git 
a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako 
b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
index 8d688a8c9..8f2ee13f1 100644
--- a/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
+++ b/generated_tests/templates/gen_variable_index_write_tests/helpers.mako
@@ -185,8 +185,8 @@ void main()
 x = x_base + 15 * c - 10
 y = 15 * r - 10
   %>
-  draw rect ${x} ${y} 10 10
-  probe rgb ${x + 5} ${y + 5} 0.0 1.0 0.0
+  draw rect -1 -1 2 2
+  probe all rgb 0.0 1.0 0.0
 
   ## This is replaced with a newline, after the formatting functions are 
applied
   >>newline
diff --git 
a/generated_tests/templates/gen_variable_index_write_tests/vs.shader_test.mako 
b/generated_tests/templates/gen_variable_index_write_tests/vs.shader_test.mako
index 06e539cfc..9b2cf56e1 100644
--- 
a/generated_tests/templates/gen_variable_index_write_tests/vs.shader_test.mako
+++ 
b/generated_tests/templates/gen_variable_index_write_tests/vs.shader_test.mako
@@ -67,8 +67,5 @@ void main()
 
 
 [test]
-clear color 0.5 0.5 0.5 0.5
-clear
-ortho
 
 ${helpers.emit_test_vectors(params)}
-- 
2.17.0

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


[Piglit] [PATCH 2/2] glsl-1.20: Don't use ortho in outerProduct tests.

2018-06-12 Thread Jordan Justen
From: Matt Turner 

Ref: https://lists.freedesktop.org/archives/piglit/2013-November/008299.html
[jordan.l.jus...@intel.com: convert from shell script to mako]
Signed-off-by: Jordan Justen 
Cc: Kenneth Graunke 
---
 .../gen_outerproduct_tests/template.shader_test.mako  | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git 
a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako 
b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
index 8c2d6c9af..971512937 100644
--- a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
+++ b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
@@ -108,20 +108,17 @@ void main() {
 %endif
 
 [test]
-clear color 0.5 0.5 0.5 0.0
-clear
-ortho
 
 %if type == 'uniform':
 % for x in range(1, 5):
 uniform ${params.vec_type}${params.columns} c ${" ".join(str(i + x) for i in 
range(1, params.columns + 1))}
 uniform ${params.vec_type}${params.rows} r ${" ".join(str(i + x + 
params.columns) for i in range(1, params.rows + 1))}
 uniform mat${params.rows}x${params.columns} expected ${" ".join(str((i + x + 
params.columns) * (j + x)) for i in range(1, params.rows + 1) for j in range(1, 
params.columns + 1))}
-draw rect ${20 * x - 10} 10 10 10
-probe rgb ${20 * x - 5} 15 0.0 1.0 0.0
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
 
 % endfor
 %elif type == 'const':
-draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
+draw rect -1 -1 2 2
+probe all rgb 0.0 1.0 0.0
 %endif
-- 
2.17.0

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


Re: [Piglit] [PATCH 1/9] shader_runner: Support testing GL_NUM_PROGRAM_BINARY_FORMATS

2018-06-10 Thread Jordan Justen
On 2018-06-09 21:56:33, Timothy Arceri wrote:
> Small nit with patch 2. Patch 8 seems obsolete with patch 6 I'm a 
> missing something?

They are close. Patch 6 tests that the uniform is reset by examining
the result of drawing. Patch 8 tests by reading the uniform value via
the GL API.

I guess there is a small chance that restoring the program might
somehow cause a different result in the program state vs the GL API
state.

I wrote 6 and 8 last fall, and I can't remember if I saw an actual bug
that made me write the test in patch 8.

-Jordan

> Otherwise, this series looks great thanks for working on it :)
> 
> Reviewed-by: Timothy Arceri 
> 
> On 09/06/18 15:47, Jordan Justen wrote:
> > Signed-off-by: Jordan Justen 
> > ---
> >   tests/shaders/shader_runner.c | 16 
> >   1 file changed, 16 insertions(+)
> > 
> > diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> > index 794524e8f..c4e25a33d 100644
> > --- a/tests/shaders/shader_runner.c
> > +++ b/tests/shaders/shader_runner.c
> > @@ -98,6 +98,7 @@ static int gl_max_vertex_uniform_components;
> >   static int gl_max_vertex_attribs;
> >   static int gl_max_varying_components;
> >   static int gl_max_clip_planes;
> > +static int gl_num_program_binary_formats = 0;
> >   
> >   static const char *test_start = NULL;
> >   static unsigned test_start_line_num = 0;
> > @@ -768,6 +769,11 @@ process_requirement(const char *line)
> >   _max_varying_components,
> >   "varying components",
> >   },
> > + {
> > + "GL_NUM_PROGRAM_BINARY_FORMATS",
> > + _num_program_binary_formats,
> > + "num program binary formats",
> > + },
> >   };
> >   unsigned i;
> >   
> > @@ -4090,6 +4096,16 @@ piglit_init(int argc, char **argv)
> >   read_width = render_width = piglit_width;
> >   read_height = render_height = piglit_height;
> >   
> > +#ifdef PIGLIT_USE_OPENGL
> > + if (piglit_is_extension_supported("GL_ARB_get_program_binary"))
> > + glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS,
> > +   _num_program_binary_formats);
> > +#else
> > + if (piglit_is_extension_supported("GL_OES_get_program_binary"))
> > + glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES,
> > +   _num_program_binary_formats);
> > +#endif
> > +
> >   /* Automatic mode can run multiple tests per session. */
> >   if (report_subtests) {
> >   char testname[4096], *ext;
> > 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 5/9] shader_runner: Add 'program binary save restore' command

2018-06-08 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 0b449c056..b954520f3 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -583,7 +583,7 @@ compile_and_bind_program(GLenum target, const char *start, 
int len)
 }
 
 static bool
-program_binary_save_restore()
+program_binary_save_restore(bool script_command)
 {
GLint binary_length;
void *binary;
@@ -591,12 +591,22 @@ program_binary_save_restore()
GLint ok;
GLuint new_prog;
 
-   if (!use_get_program_binary)
+   if (!script_command && !use_get_program_binary)
return true;
 
+   if (script_command && gl_num_program_binary_formats == 0)
+   piglit_report_result(PIGLIT_SKIP);
+
glGetProgramiv(prog, GL_LINK_STATUS, );
-   if (!ok)
-   return true;
+   if (!ok) {
+   if (script_command) {
+   fprintf(stderr, "Can't save/restore program that is "
+   "not linked!\n");
+   piglit_report_result(PIGLIT_FAIL);
+   } else {
+   return true;
+   }
+   }
 
 #ifdef PIGLIT_USE_OPENGL
glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, _length);
@@ -690,7 +700,7 @@ link_sso(GLenum target)
return PIGLIT_FAIL;
}
 
-   if (!program_binary_save_restore())
+   if (!program_binary_save_restore(false))
return PIGLIT_FAIL;
 
switch (target) {
@@ -1184,7 +1194,7 @@ link_and_use_shaders(void)
glLinkProgram(prog);
 
if (!sso_in_use) {
-   if (!program_binary_save_restore())
+   if (!program_binary_save_restore(false))
return PIGLIT_FAIL;
glGetProgramiv(prog, GL_LINK_STATUS, );
if (ok) {
@@ -3941,6 +3951,8 @@ piglit_display(void)
set_parameter(rest);
} else if (parse_str(line, "patch parameter ", )) {
set_patch_parameter(rest);
+   } else if (parse_str(line, "program binary save restore", 
)) {
+   program_binary_save_restore(true);
} else if (parse_str(line, "provoking vertex ", )) {
set_provoking_vertex(rest);
} else if (parse_str(line, "link error", )) {
-- 
2.17.1

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


[Piglit] [PATCH 4/9] shader_runner: Support SHADER_RUNNER_GET_PROGRAM_BINARY env var

2018-06-08 Thread Jordan Justen
If set to 1/yes/true, SHADER_RUNNER_GET_PROGRAM_BINARY will run as if
the -get-program-binary parameter were used.

This allows comparing piglit runs with and without shader runner using
GetProgramBinary.

Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b3f1b3deb..0b449c056 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -4126,7 +4126,10 @@ piglit_init(int argc, char **argv)
float default_piglit_tolerance[4];
 
use_get_program_binary =
-   piglit_strip_arg(, argv, "-get-program-binary");
+   piglit_strip_arg(, argv, "-get-program-binary") ||
+   piglit_env_var_as_boolean("SHADER_RUNNER_GET_PROGRAM_BINARY",
+ false);
+
report_subtests = piglit_strip_arg(, argv, "-report-subtests");
if (argc < 2) {
printf("usage: shader_runner \n");
-- 
2.17.1

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


[Piglit] [PATCH 9/9] ARB_get_program_binary: Test that restoring active program takes effect

2018-06-08 Thread Jordan Justen
Signed-off-by: Jordan Justen 
Cc: Timothy Arceri 
---
 .../arb_get_program_binary/CMakeLists.gl.txt  |   2 +
 .../restore-implicit-use-program.c| 145 ++
 2 files changed, 147 insertions(+)
 create mode 100644 
tests/spec/arb_get_program_binary/restore-implicit-use-program.c

diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt 
b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
index 2f2b99aaa..0032d9f2a 100644
--- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
+++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
@@ -12,5 +12,7 @@ piglit_add_executable (arb_get_program_binary-api-errors 
api-errors.c)
 piglit_add_executable (arb_get_program_binary-overrun overrun.c)
 piglit_add_executable (arb_get_program_binary-retrievable_hint 
retrievable_hint.c)
 piglit_add_executable (arb_get_program_binary-reset-uniform reset-uniform.c 
gpb-common.c)
+piglit_add_executable (arb_get_program_binary-restore-implicit-use-program
+   restore-implicit-use-program.c gpb-common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_get_program_binary/restore-implicit-use-program.c 
b/tests/spec/arb_get_program_binary/restore-implicit-use-program.c
new file mode 100644
index 0..51060c8e5
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/restore-implicit-use-program.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018 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 restore-implicit-use-program.c
+ *
+ * Ref: https://bugs.freedesktop.org/show_bug.cgi?id=106810
+ *
+ * From section 7.3 (Program Objects) of the OpenGL 4.5 spec:
+ *
+ *"If LinkProgram or ProgramBinary successfully re-links a program
+ * object that is active for any shader stage, then the newly generated
+ * executable code will be installed as part of the current rendering
+ * state for all shader stages where the program is active.
+ * Additionally, the newly generated executable code is made part of
+ * the state of any program pipeline for all stages where the program
+ * is attached."
+ */
+
+#include "piglit-util-gl.h"
+#include "gpb-common.h"
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   GLsizei bin_length;
+   void *green_binary;
+   GLenum bin_format;
+   int num_formats = 0;
+   float red[] = { 1.0, 0.0, 0.0, 1.0 };
+   float green[] = { 0.0, 1.0, 0.0, 1.0 };
+   GLuint green_prog, red_then_green_prog;
+   bool pass = true;
+
+   static const char vs_source[] =
+   "void main()\n"
+   "{\n"
+   "gl_Position = gl_Vertex;\n"
+   "}\n";
+   static const char green_fs_source[] =
+   "#version 120\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "}\n";
+   static const char red_fs_source[] =
+   "#version 120\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
+   "}\n";
+
+   piglit_require_extension("GL_ARB_get_program_binary");
+
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, _formats);
+   if (num_formats == 0)
+   piglit_report_result(PIGLIT_SKIP);
+
+   green_prog = piglit_build_simple_program(vs_source, green_fs_source);
+   glUseProgram(green_prog);
+
+  

[Piglit] [PATCH 8/9] ARB_get_program_binary: Test that uniforms are reset on program reload (API)

2018-06-08 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 .../arb_get_program_binary/CMakeLists.gl.txt  |   1 +
 .../arb_get_program_binary/reset-uniform.c| 121 ++
 2 files changed, 122 insertions(+)
 create mode 100644 tests/spec/arb_get_program_binary/reset-uniform.c

diff --git a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt 
b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
index 9e71ce010..2f2b99aaa 100644
--- a/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
+++ b/tests/spec/arb_get_program_binary/CMakeLists.gl.txt
@@ -11,5 +11,6 @@ link_libraries (
 piglit_add_executable (arb_get_program_binary-api-errors api-errors.c)
 piglit_add_executable (arb_get_program_binary-overrun overrun.c)
 piglit_add_executable (arb_get_program_binary-retrievable_hint 
retrievable_hint.c)
+piglit_add_executable (arb_get_program_binary-reset-uniform reset-uniform.c 
gpb-common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_get_program_binary/reset-uniform.c 
b/tests/spec/arb_get_program_binary/reset-uniform.c
new file mode 100644
index 0..93defd378
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/reset-uniform.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2017 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 reset-uniform.c
+ *
+ * From the ARB_get_program_binary extension spec:
+ *
+ * "A successful call to ProgramBinary will reset all uniform variables
+ *  to their initial values. The initial value is either the value of
+ *  the variable's initializer as specified in the original shader
+ *  source, or 0 if no initializer was present."
+ *
+ * Verify that a uniform value as read through the OpenGL API is
+ * restored to its initial value when glProgramBinary is used.
+ */
+
+#include "piglit-util-gl.h"
+#include "gpb-common.h"
+#include 
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint prog;
+
+static void
+check_color(const float *exp, const float *clr)
+{
+   if (exp[0] != clr[0] || exp[1] != clr[1] || exp[2] != clr[2] ||
+   exp[3] != clr[3]) {
+   fprintf(stderr, "uniform color didn't match expected color\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   int num_formats = 0;
+   float red[] = { 1.0, 0.0, 0.0, 1.0 };
+   float green[] = { 0.0, 1.0, 0.0, 1.0 };
+   float clr[4];
+   GLint loc;
+
+   static const char vs_source[] =
+   "void main()\n"
+   "{\n"
+   "gl_Position = gl_Vertex;\n"
+   "}\n";
+   static const char fs_source[] =
+   "#version 120\n"
+   "uniform vec4 color = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = color;\n"
+   "}\n";
+
+   piglit_require_extension("GL_ARB_get_program_binary");
+
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, _formats);
+   if (num_formats == 0)
+   piglit_report_result(PIGLIT_SKIP);
+
+   prog = piglit_build_simple_program(vs_source, fs_source);
+   glUseProgram(prog);
+
+   loc = glGetUniformLocation(prog, "color");
+   if (loc < 0)
+   piglit_report_result(PIGLIT_FAIL);
+
+   glGetUniformfv(prog, loc, clr);
+   check_color(green, clr);
+
+   glUniform4fv(loc, 1, red);
+   glGetUniformfv(prog, loc, clr);
+   check_color(red, clr);
+
+   gpb_save_restore();
+
+ 

[Piglit] [PATCH 7/9] ARB_get_program_binary: Add some common functions

2018-06-08 Thread Jordan Justen
---
 .../spec/arb_get_program_binary/gpb-common.c  | 126 ++
 .../spec/arb_get_program_binary/gpb-common.h  |  37 +
 2 files changed, 163 insertions(+)
 create mode 100644 tests/spec/arb_get_program_binary/gpb-common.c
 create mode 100644 tests/spec/arb_get_program_binary/gpb-common.h

diff --git a/tests/spec/arb_get_program_binary/gpb-common.c 
b/tests/spec/arb_get_program_binary/gpb-common.c
new file mode 100644
index 0..06194696e
--- /dev/null
+++ b/tests/spec/arb_get_program_binary/gpb-common.c
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2018 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.h"
+#include "gpb-common.h"
+#include 
+
+bool
+gpb_save_program(GLuint prog, void **binary, GLsizei *length, GLenum *format)
+{
+   GLsizei binary_length;
+   void *binary_buffer;
+   GLenum binary_format;
+   GLint ok;
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok) {
+   fprintf(stderr, "Can't save/restore program that is "
+   "not linked!\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, _length);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramiv GL_PROGRAM_BINARY_LENGTH "
+   "error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   binary_buffer = malloc(binary_length);
+   if (!binary_buffer)
+   return false;
+
+   glGetProgramBinary(prog, binary_length, _length, _format,
+  binary_buffer);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramBinary error\n");
+   free(binary_buffer);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   *length = binary_length;
+   *binary = binary_buffer;
+   *format = binary_format;
+   return true;
+}
+
+bool
+gpb_restore_program(GLuint prog, void *binary, GLsizei length, GLenum format)
+{
+   GLint ok;
+
+   glProgramBinary(prog, format, binary, length);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glProgramBinary error "
+   "(should not happend according to spec.)\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok) {
+   fprintf(stderr, "link failure after glProgramBinary\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   return true;
+}
+
+bool
+gpb_save_restore(GLuint *prog)
+{
+   GLsizei bin_length;
+   void *binary;
+   GLenum bin_format;
+   GLuint new_prog;
+
+   if (!gpb_save_program(*prog, , _length, _format)) {
+   fprintf(stderr,
+   "failed to save program with GetProgramBinary\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   new_prog = glCreateProgram();
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (!gpb_restore_program(new_prog, binary, bin_length, bin_format)) {
+   free(binary);
+   fprintf(stderr, "failed to restore binary program\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   free(binary);
+
+   glUseProgram(new_prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+
+   glDeleteProgram(*prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   *prog = new_prog;
+
+   return true;
+}
diff --git a/tests/spec/arb_get_program_binary/gpb-common.h 
b/tests/spec/arb_get_program_binary/gpb-common.h
new file mode 100644
index 

[Piglit] [PATCH 1/9] shader_runner: Support testing GL_NUM_PROGRAM_BINARY_FORMATS

2018-06-08 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 794524e8f..c4e25a33d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -98,6 +98,7 @@ static int gl_max_vertex_uniform_components;
 static int gl_max_vertex_attribs;
 static int gl_max_varying_components;
 static int gl_max_clip_planes;
+static int gl_num_program_binary_formats = 0;
 
 static const char *test_start = NULL;
 static unsigned test_start_line_num = 0;
@@ -768,6 +769,11 @@ process_requirement(const char *line)
_max_varying_components,
"varying components",
},
+   {
+   "GL_NUM_PROGRAM_BINARY_FORMATS",
+   _num_program_binary_formats,
+   "num program binary formats",
+   },
};
unsigned i;
 
@@ -4090,6 +4096,16 @@ piglit_init(int argc, char **argv)
read_width = render_width = piglit_width;
read_height = render_height = piglit_height;
 
+#ifdef PIGLIT_USE_OPENGL
+   if (piglit_is_extension_supported("GL_ARB_get_program_binary"))
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS,
+ _num_program_binary_formats);
+#else
+   if (piglit_is_extension_supported("GL_OES_get_program_binary"))
+   glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES,
+ _num_program_binary_formats);
+#endif
+
/* Automatic mode can run multiple tests per session. */
if (report_subtests) {
char testname[4096], *ext;
-- 
2.17.1

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


[Piglit] [PATCH 3/9] util: Add piglit_env_var_as_boolean

2018-06-08 Thread Jordan Justen
This is copied from Mesa's env_var_as_boolean.

Signed-off-by: Jordan Justen 
---
 tests/util/piglit-util.c | 27 +++
 tests/util/piglit-util.h |  9 +
 2 files changed, 36 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index ed7d21c95..3a8f9bcfb 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -867,3 +867,30 @@ piglit_free_aligned(void *p)
free(p);
 #endif
 }
+
+
+/**
+ * \brief Reads an environment variable and interprets its value as a boolean.
+ *
+ * Recognizes 0/false/no and 1/true/yes.  Other values result in the
+ * \a default_value.
+ */
+bool
+piglit_env_var_as_boolean(const char *var_name, bool default_value)
+{
+   const char *str = getenv(var_name);
+   if (str == NULL)
+  return default_value;
+
+   if (strcmp(str, "1") == 0 ||
+   strcasecmp(str, "true") == 0 ||
+   strcasecmp(str, "yes") == 0) {
+  return true;
+   } else if (strcmp(str, "0") == 0 ||
+  strcasecmp(str, "false") == 0 ||
+  strcasecmp(str, "no") == 0) {
+  return false;
+   } else {
+  return default_value;
+   }
+}
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 0a5eab810..53cffedbb 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -392,6 +392,15 @@ piglit_source_dir(void);
 size_t
 piglit_join_paths(char buf[], size_t buf_size, int n, ...);
 
+/**
+ * \brief Reads an environment variable and interprets its value as a boolean.
+ *
+ * Recognizes 0/false/no and 1/true/yes.  Other values result in the
+ * \a default_value.
+ */
+bool
+piglit_env_var_as_boolean(const char *var_name, bool default_value);
+
 /**
  * \brief Whether piglit_time_get* return monotonically increasing time.
  *
-- 
2.17.1

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


[Piglit] [PATCH 2/9] shader_runner: Add -get-program-binary parameter

2018-06-08 Thread Jordan Justen
This parameter will test ARB_get_program_binary and
OES_get_program_binary with any shader runner test.

If -get-program-binary, then shader_runner will check to see if the
extension is supported, and if 1 or more binary formats are supported.
If the extensions are not supported, or 0 formats are supported, then
the test will result in a skip.

If the program binary extension is supported and 1 or more binary
formats are supported, then following a successful link of the shader
runner program:

1. GetProgramBinary will be used to get the program
2. A new program will be generated
3. ProgramBinary will be used on the new program with the previously
   returned binary
4. The old program will be deleted
5. The shader runner will continue to run using the new program

Although this is not a focused test of the get_program_binary
extensions, it does allow any of the thousands of previously written
shader runner tests to be run while testing get_program_binary.

Signed-off-by: Jordan Justen 
---
 tests/shaders/shader_runner.c | 96 +++
 1 file changed, 96 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index c4e25a33d..b3f1b3deb 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -149,6 +149,8 @@ static GLuint draw_fbo, read_fbo;
 static GLint render_width, render_height;
 static GLint read_width, read_height;
 
+static bool use_get_program_binary = false;
+
 static bool report_subtests = false;
 
 static struct texture_binding {
@@ -580,6 +582,88 @@ compile_and_bind_program(GLenum target, const char *start, 
int len)
return PIGLIT_PASS;
 }
 
+static bool
+program_binary_save_restore()
+{
+   GLint binary_length;
+   void *binary;
+   GLenum binary_format;
+   GLint ok;
+   GLuint new_prog;
+
+   if (!use_get_program_binary)
+   return true;
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok)
+   return true;
+
+#ifdef PIGLIT_USE_OPENGL
+   glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH, _length);
+#else
+   glGetProgramiv(prog, GL_PROGRAM_BINARY_LENGTH_OES, _length);
+#endif
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramiv GL_PROGRAM_BINARY_LENGTH "
+   "error\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   binary = malloc(binary_length);
+   if (!binary)
+   return false;
+
+#ifdef PIGLIT_USE_OPENGL
+   glGetProgramBinary(prog, binary_length, _length, _format,
+  binary);
+#else
+   glGetProgramBinaryOES(prog, binary_length, _length,
+ _format, binary);
+#endif
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glGetProgramBinary error\n");
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   new_prog = glCreateProgram();
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   free(binary);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+#ifdef PIGLIT_USE_OPENGL
+   glProgramBinary(new_prog, binary_format, binary, binary_length);
+#else
+   glProgramBinaryOES(new_prog, binary_format, binary, binary_length);
+#endif
+   free(binary);
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   fprintf(stderr, "glProgramBinary error "
+   "(should not happend according to spec.)\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glGetProgramiv(prog, GL_LINK_STATUS, );
+   if (!ok) {
+   fprintf(stderr, "link failure after glProgramBinary\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (prog_in_use) {
+   glUseProgram(new_prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   glDeleteProgram(prog);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+   piglit_report_result(PIGLIT_FAIL);
+   prog = new_prog;
+
+   return true;
+}
+
 static enum piglit_result
 link_sso(GLenum target)
 {
@@ -606,6 +690,9 @@ link_sso(GLenum target)
return PIGLIT_FAIL;
}
 
+   if (!program_binary_save_restore())
+   return PIGLIT_FAIL;
+
switch (target) {
case GL_VERTEX_SHADER:
sso_vertex_prog = prog;
@@ -1097,6 +1184,8 @@ link_and_use_shaders(void)
glLinkProgram(prog);
 
if (!sso_in_use) {
+   if (!program_binary_save_restore())
+   return PIGLIT_FAIL;
glGetProgramiv(prog, GL_LINK_STATUS, );
if (ok) {
link_ok = true;
@@ -4036,6 +4125,8 @@ piglit_init(int argc, char **argv)
enum pi

[Piglit] [PATCH 6/9] ARB_get_program_binary: Test that uniforms are reset on program reload

2018-06-08 Thread Jordan Justen
Signed-off-by: Jordan Justen 
---
 .../uniform-after-restore.shader_test | 35 +++
 1 file changed, 35 insertions(+)
 create mode 100644 
tests/spec/arb_get_program_binary/execution/uniform-after-restore.shader_test

diff --git 
a/tests/spec/arb_get_program_binary/execution/uniform-after-restore.shader_test 
b/tests/spec/arb_get_program_binary/execution/uniform-after-restore.shader_test
new file mode 100644
index 0..5b18c04c2
--- /dev/null
+++ 
b/tests/spec/arb_get_program_binary/execution/uniform-after-restore.shader_test
@@ -0,0 +1,35 @@
+# From the ARB_get_program_binary extension spec:
+#
+# "A successful call to ProgramBinary will reset all uniform variables
+#  to their initial values. The initial value is either the value of
+#  the variable's initializer as specified in the original shader
+#  source, or 0 if no initializer was present."
+#
+
+[require]
+GLSL >= 1.20
+GL_NUM_PROGRAM_BINARY_FORMATS >= 1
+
+[vertex shader]
+void main()
+{
+gl_Position = gl_Vertex;
+}
+
+[fragment shader]
+#version 120
+
+uniform vec4 color = vec4(0.0, 1.0, 0.0, 1.0);
+void main()
+{
+gl_FragColor = color;
+}
+
+[test]
+uniform vec4 color 1.0 0.0 1.0 0.0
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 1.0 0.0
+uniform vec4 color 1.0 0.0 1.0 0.0
+program binary save restore
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.17.1

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


[Piglit] [PATCH 2/2] shader_runner: Support PIGLIT_DEFAULT_SIZE env var

2018-01-31 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 700b11327..c6ee8e3de 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -46,8 +46,10 @@ decode_drawing_mode(const char *mode_str);
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
-   config.window_width = DEFAULT_WINDOW_WIDTH;
-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size()) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
config.khr_no_error_support = PIGLIT_NO_ERRORS;
 
@@ -3926,8 +3928,10 @@ validate_current_gl_context(const char *filename)
 {
struct piglit_gl_test_config config = { 0 };
 
-   config.window_width = DEFAULT_WINDOW_WIDTH;
-   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   if (!piglit_gl_test_config_override_size()) {
+   config.window_width = DEFAULT_WINDOW_WIDTH;
+   config.window_height = DEFAULT_WINDOW_HEIGHT;
+   }
 
get_required_config(filename, );
 
-- 
2.15.1

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


[Piglit] [PATCH 1/2] framework-gl: Export window size override function

2018-01-31 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/util/piglit-framework-gl.c | 6 +++---
 tests/util/piglit-framework-gl.h | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 1b2078d5c..c80441870 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -47,8 +47,8 @@ static void
 process_args(int *argc, char *argv[], unsigned *force_samples,
 struct piglit_gl_test_config *config);
 
-static bool
-override_size(struct piglit_gl_test_config *config)
+bool
+piglit_gl_test_config_override_size(struct piglit_gl_test_config *config)
 {
const char *default_size;
unsigned int width;
@@ -74,7 +74,7 @@ piglit_gl_test_config_init(struct piglit_gl_test_config 
*config)
 {
memset(config, 0, sizeof(*config));
 
-   if (!override_size(config)) {
+   if (!piglit_gl_test_config_override_size(config)) {
/* Default window size.  Note: Win8's min window width */
/* seems to be 160 pixels.  When the window size is */
/* unexpectedly resized, tests are marked as "WARN". */
diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index 970fd5502..a4ecddbe7 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -226,6 +226,9 @@ void
 piglit_gl_process_args(int *argc, char *argv[],
   struct piglit_gl_test_config *config);
 
+bool
+piglit_gl_test_config_override_size(struct piglit_gl_test_config *config);
+
 /**
  * Get the list of command-line selected tests from the piglit_gl_test_config
  *
-- 
2.15.1

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


Re: [Piglit] [PATCH] compute: add test variants for local_size decls in other shaders

2017-10-22 Thread Jordan Justen
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2017-10-22 14:58:00, Ilia Mirkin wrote:
> Only one shader is required to have a local_size layout, and it's not
> required to be the one with the main function. Add tests which verify
> that these derived values are properly computed in such a circumstance.
> 
> Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
> ---
>  .../execution/separate-global-id.shader_test   | 68 
> ++
>  .../execution/separate-global-id.shader_test   | 49 
>  2 files changed, 117 insertions(+)
>  create mode 100644 
> tests/spec/arb_compute_shader/execution/separate-global-id.shader_test
>  create mode 100644 
> tests/spec/arb_compute_variable_group_size/execution/separate-global-id.shader_test
> 
> diff --git 
> a/tests/spec/arb_compute_shader/execution/separate-global-id.shader_test 
> b/tests/spec/arb_compute_shader/execution/separate-global-id.shader_test
> new file mode 100644
> index 0..3352f1d81
> --- /dev/null
> +++ b/tests/spec/arb_compute_shader/execution/separate-global-id.shader_test
> @@ -0,0 +1,68 @@
> +# Simple test that verifies gl_GlobalInvocationID values are
> +# functioning. Atomic counters are used as outputs.
> +#
> +# The additional twist is that the layout (and thus gl_WorkGroupSize)
> +# is declared in a different shader.
> +
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_compute_shader
> +GL_ARB_shader_atomic_counters
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +
> +layout(local_size_x = 4, local_size_y = 2, local_size_z = 4) in;
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_shader_atomic_counters: require
> +
> +layout(binding = 0) uniform atomic_uint a0;
> +layout(binding = 0) uniform atomic_uint a1;
> +layout(binding = 0) uniform atomic_uint a2;
> +layout(binding = 0) uniform atomic_uint a3;
> +layout(binding = 0) uniform atomic_uint a4;
> +layout(binding = 0) uniform atomic_uint a5;
> +layout(binding = 0) uniform atomic_uint a6;
> +layout(binding = 0) uniform atomic_uint a7;
> +
> +void main()
> +{
> +uint x = gl_GlobalInvocationID.x;
> +uint y = gl_GlobalInvocationID.y;
> +uint z = gl_GlobalInvocationID.z;
> +
> +if (((x & y) & z) == 0u)
> +atomicCounterIncrement(a0);
> +if (((x | y) | z) == 7u)
> +atomicCounterIncrement(a1);
> +if (x == y && y == z)
> +atomicCounterIncrement(a2);
> +if (x != y && y != z && x != z)
> +atomicCounterIncrement(a3);
> +if (((x & y) & z) == 2u)
> +atomicCounterIncrement(a4);
> +if (((x | y) | z) == 5u)
> +atomicCounterIncrement(a5);
> +if (x < 4u && y < 4u && z < 4u)
> +atomicCounterIncrement(a6);
> +if (x >= 4u || y >= 4u || z >= 4u)
> +atomicCounterIncrement(a7);
> +}
> +
> +[test]
> +atomic counters 8
> +
> +compute 2 4 2
> +probe atomic counter 0 == 343
> +probe atomic counter 1 == 343
> +probe atomic counter 2 == 8
> +probe atomic counter 3 == 336
> +probe atomic counter 4 == 49
> +probe atomic counter 5 == 49
> +probe atomic counter 6 == 64
> +probe atomic counter 7 == 448
> diff --git 
> a/tests/spec/arb_compute_variable_group_size/execution/separate-global-id.shader_test
>  
> b/tests/spec/arb_compute_variable_group_size/execution/separate-global-id.shader_test
> new file mode 100644
> index 0..434eecf6a
> --- /dev/null
> +++ 
> b/tests/spec/arb_compute_variable_group_size/execution/separate-global-id.shader_test
> @@ -0,0 +1,49 @@
> +# Simple test that verifies gl_GlobalInvocationID derived values are
> +# computed properly.
> +
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_compute_shader
> +GL_ARB_compute_variable_group_size
> +GL_ARB_shader_storage_buffer_object
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: require
> +#extension GL_ARB_compute_variable_group_size: require
> +
> +layout(local_size_variable) in;
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: require
> +#extension GL_ARB_shader_storage_buffer_object: require
> +
> +// no mention of variable group size in this shader
> +
> +layout(std430)
> +buffer SSBO {
> +   uvec2 id[4];
> +};
> +
> +void main()
> +{
> +   uint g = gl_GlobalInvocationID.x;
> +   uint l = gl_LocalInvocationID.x;
> +   id[g] = uvec2(g, l);
> +}
> +
> +[test]
> +ssbo 0 32
> +
> +compute group size 2 1 1 

Re: [Piglit] [PATCH] arb_compute_variable_group_size: ensure local size works with fixed

2017-10-22 Thread Jordan Justen
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2017-10-22 15:12:58, Ilia Mirkin wrote:
> The new gl_LocalGroupSizeARB variable is meant to work with fixed sizes
> as well. Test it.
> 
> Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
> ---
>  .../execution/fixed-local-size.shader_test | 32 
> ++
>  1 file changed, 32 insertions(+)
>  create mode 100644 
> tests/spec/arb_compute_variable_group_size/execution/fixed-local-size.shader_test
> 
> diff --git 
> a/tests/spec/arb_compute_variable_group_size/execution/fixed-local-size.shader_test
>  
> b/tests/spec/arb_compute_variable_group_size/execution/fixed-local-size.shader_test
> new file mode 100644
> index 0..6d92aeaad
> --- /dev/null
> +++ 
> b/tests/spec/arb_compute_variable_group_size/execution/fixed-local-size.shader_test
> @@ -0,0 +1,32 @@
> +# Simple test that verifies gl_LocalGroupSizeARB values are
> +# functioning. Atomic counters are used as outputs.
> +
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_compute_variable_group_size
> +GL_ARB_shader_atomic_counters
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_compute_variable_group_size: enable
> +#extension GL_ARB_shader_atomic_counters: require
> +
> +layout(binding = 0) uniform atomic_uint a;
> +
> +layout(local_size_x = 8, local_size_y = 4, local_size_z = 2) in;
> +
> +void main()
> +{
> +   if (gl_LocalGroupSizeARB.x == 8u &&
> +   gl_LocalGroupSizeARB.y == 4u &&
> +   gl_LocalGroupSizeARB.z == 2u)
> +   atomicCounterIncrement(a);
> +}
> +
> +[test]
> +atomic counters 1
> +
> +compute 1 1 1
> +probe atomic counter 0 == 64
> -- 
> 2.13.6
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] crucible: Convert from glslc to glslang

2017-04-14 Thread Jordan Justen
This essentially reverts b5a52577781ff191766f49866ce00af749cb86b7, but
it seems that glslangValidator has since become a little more
friendly. Additionally, I used python tempfile module to simplify
creating tempfiles with the required extensions.

One reason to revert to using glslangValidator is just to remove the
additional shaderc/glslc dependency. An advantage of using
glslangValidator is that the SPIR-V binary and assembly code can be
generated with a single invocation of glslangValidator.

Cc: Jason Ekstrand <ja...@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 INSTALL  |  2 +-
 Makefile.am  |  2 +-
 configure.ac | 10 +-
 misc/glsl_scraper.py | 48 +---
 4 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/INSTALL b/INSTALL
index 17a1a68..fad9989 100644
--- a/INSTALL
+++ b/INSTALL
@@ -3,7 +3,7 @@ How to Build
 
 External Dependencies
 -
-- glslc, from Google's shaderc project (http://github.com/google/shaderc)
+- glslang, from Khronos's glslang project 
(https://github.com/KhronosGroup/glslang)
 - AsciiDoc (http://asciidoc.org)
 - libxml2 (http://www.xmlsoft.org)
 - Python3
diff --git a/Makefile.am b/Makefile.am
index 4b4050c..49790de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,7 +136,7 @@ bin_crucible_LDADD = $(MESA_LDFLAGS) -lm -lvulkan -lpthread 
$(libpng_LIBS) \
 $(LIBXML2_LIBS)
 
 %-spirv.h: %.c misc/glsl_scraper.py
-   $(AM_V_GEN) $(PYTHON3) $(srcdir)/misc/glsl_scraper.py 
--with-glslc=$(GLSLC) -o $@ $<
+   $(AM_V_GEN) $(PYTHON3) $(srcdir)/misc/glsl_scraper.py 
--with-glslang=$(GLSLANG) -o $@ $<
 
 %_gen.c: %_gen.py
$(AM_V_GEN) $(PYTHON3) $<
diff --git a/configure.ac b/configure.ac
index 9e137e7..b300674 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,11 +48,11 @@ AC_CHECK_PROGS([PYTHON2], [python2 python])
 AC_CHECK_PROGS([PYTHON3], [python3])
 AX_CHECK_PYTHON2_MODULE_OPENCV()
 
-AC_ARG_VAR([GLSLC], [path to glslc executable])
-AC_SUBST([GLSLC])
-AC_CHECK_PROGS([GLSLC], [glslc])
-if test "x$GLSLC" = "x"; then
-AC_MSG_ERROR([failed to find glslc])
+AC_ARG_VAR([GLSLANG], [path to glslangValidator executable])
+AC_SUBST([GLSLANG])
+AC_CHECK_PROGS([GLSLANG], [glslangValidator])
+if test "x$GLSLANG" = "x"; then
+AC_MSG_ERROR([failed to find glslangValidator])
 fi
 
 PKG_CHECK_MODULES([libpng16], [libpng16], [HAVE_LIBPNG16=1], [HAVE_LIBPNG16=0])
diff --git a/misc/glsl_scraper.py b/misc/glsl_scraper.py
index 4534555..df42b2e 100644
--- a/misc/glsl_scraper.py
+++ b/misc/glsl_scraper.py
@@ -30,31 +30,38 @@ class Shader:
 def glsl_source(self):
 return dedent(self.stream.getvalue())
 
-def __run_glslc(self, extra_args=[]):
-stage_flag = '-fshader-stage='
+def __run_glslang(self, extra_args=[]):
 if self.stage == 'VERTEX':
-stage_flag += 'vertex'
+stage = 'vert'
 elif self.stage == 'TESS_CONTROL':
-stage_flag += 'tesscontrol'
+stage = 'tesc'
 elif self.stage == 'TESS_EVALUATION':
-stage_flag += 'tesseval'
+stage = 'tese'
 elif self.stage == 'GEOMETRY':
-stage_flag += 'geometry'
+stage = 'geom'
 elif self.stage == 'FRAGMENT':
-stage_flag += 'fragment'
+stage = 'frag'
 elif self.stage == 'COMPUTE':
-stage_flag += 'compute'
+stage = 'comp'
 else:
 assert False
 
-with subprocess.Popen([glslc] + extra_args +
-  [stage_flag, '-std=430core', '-o', '-', '-'],
+stage_flags = ['-S', stage]
+
+in_file = tempfile.NamedTemporaryFile(suffix='.'+stage)
+src = ('#version 430\n' + self.glsl_source()).encode('utf-8')
+in_file.write(src)
+in_file.flush()
+out_file = tempfile.NamedTemporaryFile(suffix='.spirv')
+args = [glslang, '-H'] + extra_args + stage_flags
+args += ['-o', out_file.name, in_file.name]
+with subprocess.Popen(args,
   stdout = subprocess.PIPE,
   stderr = subprocess.PIPE,
   stdin = subprocess.PIPE) as proc:
 
-proc.stdin.write(self.glsl_source().encode('utf-8'))
 out, err = proc.communicate(timeout=30)
+in_file.close()
 
 if proc.returncode != 0:
 # Unfortunately, glslang dumps errors to standard out.
@@ -63,7 +70,10 @@ class Shader:
 message = out.decode('utf-8') + '\n' + err.decode('utf-8')
 raise ShaderCompileError(message.strip())
 
-return out
+out_file.seek(0)
+spirv = out_file.read()
+out_file.close()
+return (spirv, out)
 
 def compile(

Re: [Piglit] [PATCH] arb_compute_variable_group_size: Fix require section.

2016-10-17 Thread Jordan Justen
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2016-10-17 12:39:18, Matt Turner wrote:
> ---
>  .../linker/mixed_fixed_variable_local_work_size.shader_test | 2 
> +-
>  .../linker/no_local_size_specified.shader_test  | 2 
> +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git 
> a/tests/spec/arb_compute_variable_group_size/linker/mixed_fixed_variable_local_work_size.shader_test
>  
> b/tests/spec/arb_compute_variable_group_size/linker/mixed_fixed_variable_local_work_size.shader_test
> index d660d56..32088ad 100644
> --- 
> a/tests/spec/arb_compute_variable_group_size/linker/mixed_fixed_variable_local_work_size.shader_test
> +++ 
> b/tests/spec/arb_compute_variable_group_size/linker/mixed_fixed_variable_local_work_size.shader_test
> @@ -7,7 +7,7 @@
>  [require]
>  GL >= 3.3
>  GLSL >= 3.30
> -GL_ARB_compute_shader
> +GL_ARB_compute_variable_group_size
>  
>  [compute shader]
>  #version 330
> diff --git 
> a/tests/spec/arb_compute_variable_group_size/linker/no_local_size_specified.shader_test
>  
> b/tests/spec/arb_compute_variable_group_size/linker/no_local_size_specified.shader_test
> index 6371c29..92a1646 100644
> --- 
> a/tests/spec/arb_compute_variable_group_size/linker/no_local_size_specified.shader_test
> +++ 
> b/tests/spec/arb_compute_variable_group_size/linker/no_local_size_specified.shader_test
> @@ -7,7 +7,7 @@
>  [require]
>  GL >= 3.3
>  GLSL >= 3.30
> -GL_ARB_compute_shader
> +GL_ARB_compute_variable_group_size
>  
>  [compute shader]
>  #version 330
> -- 
> 2.7.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] framework: Fix piglit-command

2016-08-26 Thread Jordan Justen
On 2016-08-26 11:59:12, Dylan Baker wrote:
> This actually fixes the help message for the piglit command, but doesn't
> break using other commands, like the last patch.
> 

I tried the 'summary console' command with your previous patch, and it
seemed to work. It must have been some other interaction...

This one works too, so:

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> CC: jordan.l.jus...@intel.com
> ---
>  piglit | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/piglit b/piglit
> index 05fff14..4ce6c41 100755
> --- a/piglit
> +++ b/piglit
> @@ -162,7 +162,11 @@ def main():
>  # example), and then pass the arguments that this parser doesn't know 
> about
>  # to that executable
>  parsed, args = parser.parse_known_args(input_)
> -returncode = parsed.func(args)
> +try:
> +returncode = parsed.func(args)
> +except AttributeError:
> +parser.print_help()
> +sys.exit(1)
>  sys.exit(returncode)
>  
>  
> -- 
> 2.9.3
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] piglit: Print help instead of excepting if no arguments are given

2016-08-25 Thread Jordan Justen
On 2016-08-25 11:34:57, Dylan Baker wrote:
> This fixes a small bug that causes piglit to print an exception when
> ./piglit is called with no arguments. It will, with this patch, print
> the help message and exit.
> 
> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> ---
>  piglit | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/piglit b/piglit
> index 05fff14..14094a7 100755
> --- a/piglit
> +++ b/piglit
> @@ -121,6 +121,9 @@ def main():
>  input_ = sys.argv[1:]
>  
>  parser = argparse.ArgumentParser()
> +# This ugly little line just causes piglit to print the help message if
> +# ./piglit is run without any positional arguments
> +parser.set_defaults(func=lambda *_, **__: parser.print_help())

Not sure about the comment (I'd be fine to drop it), but:

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

>  subparsers = parser.add_subparsers()
>  print_cmd = subparsers.add_parser('print-cmd',
>add_help=False,
> -- 
> 2.9.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] arb_query_buffer_object: Silence Coverity unchecked return value defect.

2016-07-01 Thread Jordan Justen
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2016-07-01 14:39:41, Vinson Lee wrote:
> CID: 1361479
> Signed-off-by: Vinson Lee <v...@freedesktop.org>
> ---
>  tests/spec/arb_query_buffer_object/qbo.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/spec/arb_query_buffer_object/qbo.c 
> b/tests/spec/arb_query_buffer_object/qbo.c
> index 1bcbe1035fad..c00b53475383 100644
> --- a/tests/spec/arb_query_buffer_object/qbo.c
> +++ b/tests/spec/arb_query_buffer_object/qbo.c
> @@ -263,9 +263,9 @@ run_subtest_and_present(void)
> char *subtest_name;
> enum piglit_result r = run_subtest();
> piglit_present_results();
> -   asprintf(_name, "query-%s-%s",
> -piglit_get_gl_enum_name(query_type),
> -sync_mode_names[sync_mode]);
> +   (void)!asprintf(_name, "query-%s-%s",
> +   piglit_get_gl_enum_name(query_type),
> +   sync_mode_names[sync_mode]);
> piglit_report_subtest_result(r, "%s", subtest_name);
> free(subtest_name);
> return r;
> -- 
> 2.7.4
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] shader_runner: Use %u in "probe atomic counter" scanf calls.

2016-06-01 Thread Jordan Justen
On 2016-05-31 23:00:02, Ilia Mirkin wrote:
> On Wed, Jun 1, 2016 at 1:49 AM, Kenneth Graunke <kenn...@whitecape.org> wrote:
> > On Wednesday, June 1, 2016 1:34:42 AM PDT Ilia Mirkin wrote:
> >> Because strtol() truncates the the maximum value of "long", as does
> >> scanf apparently. This will make it impossible to test that a counter
> >> == -1 though, right?
> >
> > Yes, I suppose it would.  But you can always do == 4294967295 instead,
> > and that seems pretty reasonable (if a bit inconvenient) considering
> > the GLSL type is "atomic_uint"...
> 
> Fair enough. For ssbo I made it read 0xfoo for those. And there's already a
> 
> tests/spec/arb_compute_shader/execution/atomic-counter.shader_test:probe
> atomic counter 1 == 4294966784
> 

And another bug as well:

https://bugs.freedesktop.org/show_bug.cgi?id=96298

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

> So what you're doing seems reasonable.
> 
> Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu>
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2] arb_query_buffer_object: Update and add more test scenarios

2016-04-22 Thread Jordan Justen
Bump requirement to OpenGL 3.2 and add OpenGL Core profile support.

Test several other query types. (Previously only GL_SAMPLES_PASSED was
tested.)

Also test retrieving the result to CPU memory before and after the
buffer based result.

Don't warn if the async test always has the results available.

v2:
 * Only check GL_ARB_pipeline_statistics_query queries if the
   extension is supported (Ilia)

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_query_buffer_object/qbo.c | 351 ---
 1 file changed, 232 insertions(+), 119 deletions(-)

diff --git a/tests/spec/arb_query_buffer_object/qbo.c 
b/tests/spec/arb_query_buffer_object/qbo.c
index 0cee6c8..bd47dd2 100644
--- a/tests/spec/arb_query_buffer_object/qbo.c
+++ b/tests/spec/arb_query_buffer_object/qbo.c
@@ -28,13 +28,14 @@
  * Tests ARB_query_buffer_object
  * - synchronous wait for result
  * - asynchrounous result, default value is left intact if result unavailable
+ * - asynchrounous result, retrieve result to client memory before & after
  */
 
 #include "piglit-util-gl.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
-   config.supports_gl_compat_version = 30;
-// config.supports_gl_core_version = 32;
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE |
PIGLIT_GL_VISUAL_DEPTH;
 
@@ -43,200 +44,312 @@ PIGLIT_GL_TEST_CONFIG_END
 #define BUFFER_OFFSET(i) ((GLint *)((unsigned char*)NULL + (i)))
 
 static const float green[] = {0, 1, 0, 1};
-static const float red[] = {1, 0, 0, 1};
 
 static unsigned query;
 static unsigned qbo;
 
 static int prog;
 static int qbo_prog;
+static int sync_mode_loc;
+static int original_count_loc;
+static int expect_exact_loc;
 static int expected_count_loc;
-static int qbo_async_prog;
-
-enum piglit_result
-synchronous_query(void)
+static bool has_pipeline_stats;
+
+enum sync_mode {
+   QBO_SYNC,
+   QBO_ASYNC,
+   QBO_ASYNC_CPU_READ_BEFORE,
+   QBO_ASYNC_CPU_READ_AFTER,
+   NUM_QBO_SYNC_MODES,
+};
+
+static char* sync_mode_names[] = {
+   "SYNC",
+   "ASYNC",
+   "ASYNC_CPU_READ_BEFORE",
+   "ASYNC_CPU_READ_AFTER",
+};
+
+static enum sync_mode sync_mode;
+
+static bool
+is_pipeline_stats_query(GLenum q)
 {
-   GLboolean pass;
-
-   glClearColor(0.5, 0.5, 0.5, 1.0);
-   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-   // enable query, draw something that should pass
-   glEnable(GL_DEPTH_TEST);
-   glUseProgram(prog);
-   glBeginQuery(GL_SAMPLES_PASSED, query);
-   piglit_draw_rect_z(0.5, -1, -1, 2, 2);
-   glEndQuery(GL_SAMPLES_PASSED);
-
-   // Stuff query result into qbo
-   glBindBuffer(GL_QUERY_BUFFER, qbo);
-   glGetQueryObjectivARB(query, GL_QUERY_RESULT, BUFFER_OFFSET(0));
-   // Make it available to shader as uniform buffer 0
-   glBindBufferBase(GL_UNIFORM_BUFFER, 0, qbo);
+   switch (q) {
+   case GL_VERTICES_SUBMITTED_ARB:
+   case GL_PRIMITIVES_SUBMITTED_ARB:
+   case GL_VERTEX_SHADER_INVOCATIONS_ARB:
+   case GL_TESS_CONTROL_SHADER_PATCHES_ARB:
+   case GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB:
+   case GL_GEOMETRY_SHADER_INVOCATIONS:
+   case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:
+   case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:
+   case GL_COMPUTE_SHADER_INVOCATIONS_ARB:
+   case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
+   case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
+   return true;
+   default:
+   return false;
+   }
+}
 
-   glUseProgram(qbo_prog);
+static GLenum query_types[] = {
+   GL_ANY_SAMPLES_PASSED,
+   GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
+   GL_CLIPPING_INPUT_PRIMITIVES_ARB,
+   GL_CLIPPING_OUTPUT_PRIMITIVES_ARB,
+   /* GL_COMPUTE_SHADER_INVOCATIONS_ARB, */
+   GL_FRAGMENT_SHADER_INVOCATIONS_ARB,
+   /* GL_GEOMETRY_SHADER_INVOCATIONS, */
+   /* GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, */
+   GL_PRIMITIVES_GENERATED,
+   GL_PRIMITIVES_SUBMITTED_ARB,
+   GL_SAMPLES_PASSED_ARB,
+   /* GL_TESS_CONTROL_SHADER_PATCHES_ARB, */
+   /* GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB, */
+   GL_TIMESTAMP,
+   GL_TIME_ELAPSED,
+   GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
+   GL_VERTEX_SHADER_INVOCATIONS_ARB,
+   GL_VERTICES_SUBMITTED_ARB,
+};
+
+static GLenum query_type;
+
+static void
+get_query_values(GLenum query_type, uint32_t *original,
+bool *exact, uint32_t *expected)
+{
+   *original = 0x;
+   *exact = true;
+
+   switch (query_type) {
+   case GL_ANY_SAMPLES_PASSED:
+   case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+   *expected = 1;
+   break;
+   case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
+   case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
+

[Piglit] [PATCH] arb_query_buffer_object: Update and add more test scenarios

2016-04-21 Thread Jordan Justen
Bump requirement to OpenGL 3.2 and add OpenGL Core profile support.

Test several other query types. (Previously only GL_SAMPLES_PASSED was
tested.)

Also test retrieving the result to CPU memory before and after the
buffer based result.

Don't warn if the async test always has the results available.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_query_buffer_object/qbo.c | 324 +++
 1 file changed, 205 insertions(+), 119 deletions(-)

diff --git a/tests/spec/arb_query_buffer_object/qbo.c 
b/tests/spec/arb_query_buffer_object/qbo.c
index 0cee6c8..847642a 100644
--- a/tests/spec/arb_query_buffer_object/qbo.c
+++ b/tests/spec/arb_query_buffer_object/qbo.c
@@ -28,13 +28,14 @@
  * Tests ARB_query_buffer_object
  * - synchronous wait for result
  * - asynchrounous result, default value is left intact if result unavailable
+ * - asynchrounous result, retrieve result to client memory before & after
  */
 
 #include "piglit-util-gl.h"
 
 PIGLIT_GL_TEST_CONFIG_BEGIN
-   config.supports_gl_compat_version = 30;
-// config.supports_gl_core_version = 32;
+   config.supports_gl_compat_version = 32;
+   config.supports_gl_core_version = 32;
config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE |
PIGLIT_GL_VISUAL_DEPTH;
 
@@ -43,200 +44,285 @@ PIGLIT_GL_TEST_CONFIG_END
 #define BUFFER_OFFSET(i) ((GLint *)((unsigned char*)NULL + (i)))
 
 static const float green[] = {0, 1, 0, 1};
-static const float red[] = {1, 0, 0, 1};
 
 static unsigned query;
 static unsigned qbo;
 
 static int prog;
 static int qbo_prog;
+static int sync_mode_loc;
+static int original_count_loc;
+static int expect_exact_loc;
 static int expected_count_loc;
-static int qbo_async_prog;
 
-enum piglit_result
-synchronous_query(void)
+enum sync_mode {
+   QBO_SYNC,
+   QBO_ASYNC,
+   QBO_ASYNC_CPU_READ_BEFORE,
+   QBO_ASYNC_CPU_READ_AFTER,
+   NUM_QBO_SYNC_MODES,
+};
+
+static char* sync_mode_names[] = {
+   "SYNC",
+   "ASYNC",
+   "ASYNC_CPU_READ_BEFORE",
+   "ASYNC_CPU_READ_AFTER",
+};
+
+static enum sync_mode sync_mode;
+
+static GLenum query_types[] = {
+   GL_ANY_SAMPLES_PASSED,
+   GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
+   GL_CLIPPING_INPUT_PRIMITIVES_ARB,
+   GL_CLIPPING_OUTPUT_PRIMITIVES_ARB,
+   /* GL_COMPUTE_SHADER_INVOCATIONS_ARB, */
+   GL_FRAGMENT_SHADER_INVOCATIONS_ARB,
+   /* GL_GEOMETRY_SHADER_INVOCATIONS, */
+   /* GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB, */
+   GL_PRIMITIVES_GENERATED,
+   GL_PRIMITIVES_SUBMITTED_ARB,
+   GL_SAMPLES_PASSED_ARB,
+   /* GL_TESS_CONTROL_SHADER_PATCHES_ARB, */
+   /* GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB, */
+   GL_TIMESTAMP,
+   GL_TIME_ELAPSED,
+   GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
+   GL_VERTEX_SHADER_INVOCATIONS_ARB,
+   GL_VERTICES_SUBMITTED_ARB,
+};
+
+static GLenum query_type;
+
+static void
+get_query_values(GLenum query_type, uint32_t *original,
+bool *exact, uint32_t *expected)
 {
-   GLboolean pass;
-
-   glClearColor(0.5, 0.5, 0.5, 1.0);
-   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-   // enable query, draw something that should pass
-   glEnable(GL_DEPTH_TEST);
-   glUseProgram(prog);
-   glBeginQuery(GL_SAMPLES_PASSED, query);
-   piglit_draw_rect_z(0.5, -1, -1, 2, 2);
-   glEndQuery(GL_SAMPLES_PASSED);
-
-   // Stuff query result into qbo
-   glBindBuffer(GL_QUERY_BUFFER, qbo);
-   glGetQueryObjectivARB(query, GL_QUERY_RESULT, BUFFER_OFFSET(0));
-   // Make it available to shader as uniform buffer 0
-   glBindBufferBase(GL_UNIFORM_BUFFER, 0, qbo);
-
-   glUseProgram(qbo_prog);
+   *original = 0x;
+   *exact = true;
+
+   switch (query_type) {
+   case GL_ANY_SAMPLES_PASSED:
+   case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+   *expected = 1;
+   break;
+   case GL_CLIPPING_INPUT_PRIMITIVES_ARB:
+   case GL_CLIPPING_OUTPUT_PRIMITIVES_ARB:
+   *exact = false;
+   *expected = 1;
+   break;
+   case GL_FRAGMENT_SHADER_INVOCATIONS_ARB:
+   *exact = false;
+   *expected = 1;
+   break;
+   case GL_PRIMITIVES_GENERATED:
+   case GL_PRIMITIVES_SUBMITTED_ARB:
+   *exact = false;
+   *expected = 1;
+   break;
+   case GL_SAMPLES_PASSED_ARB:
+   *expected = piglit_width * piglit_height;
+   break;
+   case GL_TIMESTAMP:
+   case GL_TIME_ELAPSED:
+   *exact = false;
+   *expected = 1;
+   break;
+   case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+   *expected = 0;
+   break;
+   case GL_VERTEX_SHADER_INVOCATIONS_ARB:
+   ca

[Piglit] [PATCH] arb_compute_shader: Add test for Mesa bug 93840

2016-02-25 Thread Jordan Justen
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93840
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 .../linker/bug-93840.shader_test   | 40 ++
 1 file changed, 40 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/linker/bug-93840.shader_test

diff --git a/tests/spec/arb_compute_shader/linker/bug-93840.shader_test 
b/tests/spec/arb_compute_shader/linker/bug-93840.shader_test
new file mode 100644
index 000..06dc899
--- /dev/null
+++ b/tests/spec/arb_compute_shader/linker/bug-93840.shader_test
@@ -0,0 +1,40 @@
+# Tests linking a shader with a large workgroup and local data set.
+#
+# This is related to:
+# Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93840
+#
+# There are two important elements to this test:
+#
+# 1. local workgroup size of 1024 based on the spec requirements.
+#
+# 2. Use a 'large' size of live local data. In the test this is
+#controlled with the SIZE macro. This is hardware specific, and
+#the value of 64 was chosen because it was observed to fail on the
+#Mesa i965 driver.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1024) in;
+
+#define SIZE 64
+
+shared int sa[SIZE];
+
+void main()
+{
+int a[SIZE] = sa;
+a[int(gl_LocalInvocationIndex) % SIZE] += 1;
+if (a[int(gl_LocalInvocationIndex) % SIZE] == 0)
+sa[0] = 1;
+}
+
+[test]
+link success
-- 
2.7.0

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


Re: [Piglit] [PATCH v2] compute: add an execution test for shared atomics

2016-02-19 Thread Jordan Justen
Tested-by: Jordan Justen <jordan.l.jus...@intel.com>

Passes on IVB and BDW. As you noted on patch v1, it fails on HSW.

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2016-02-19 10:07:34, Ilia Mirkin wrote:
> This adds a very simple test of atomicAdd on a shared variable.
> 
> Signed-off-by: Ilia Mirkin <imir...@alum.mit.edu>
> ---
> 
> v1 -> v2:
>  - use an atomic
>  - allow the local size to be messed with easily without changing other bits
> 
>  .../execution/shared-atomics.shader_test   | 36 
> ++
>  1 file changed, 36 insertions(+)
>  create mode 100644 
> tests/spec/arb_compute_shader/execution/shared-atomics.shader_test
> 
> diff --git 
> a/tests/spec/arb_compute_shader/execution/shared-atomics.shader_test 
> b/tests/spec/arb_compute_shader/execution/shared-atomics.shader_test
> new file mode 100644
> index 000..65f150a
> --- /dev/null
> +++ b/tests/spec/arb_compute_shader/execution/shared-atomics.shader_test
> @@ -0,0 +1,36 @@
> +# Verify simple usage of atomics and shared variables
> +
> +[require]
> +GL >= 3.3
> +GLSL >= 3.30
> +GL_ARB_compute_shader
> +GL_ARB_shader_atomic_counters
> +
> +[compute shader]
> +#version 330
> +#extension GL_ARB_compute_shader: enable
> +#extension GL_ARB_shader_atomic_counters: enable
> +
> +layout(local_size_x = 2, local_size_y = 3) in;
> +
> +shared uint value;
> +layout(binding = 0) uniform atomic_uint pass;
> +const uint size = gl_WorkGroupSize.x * gl_WorkGroupSize.y * 
> gl_WorkGroupSize.z;
> +
> +void main()
> +{
> +   if (gl_LocalInvocationIndex == 0u)
> +  value = 0u;
> +   barrier();
> +   atomicAdd(value, gl_LocalInvocationIndex);
> +   barrier();
> +   if (gl_LocalInvocationIndex == 0u) {
> +  if (value == size * (size - 1u) / 2u)
> + atomicCounterIncrement(pass);
> +   }
> +}
> +
> +[test]
> +atomic counters 1
> +compute 2 3 4
> +probe atomic counter 0 == 24
> -- 
> 2.4.10
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] cmake: don't fail, on Linux, if X11 is not found

2016-02-16 Thread Jordan Justen
On 2016-02-16 10:54:30, Mircea Gherzan wrote:
> If X11 is not found then GLX cannot be available, so just disable the
> building of the OpenGL test instead of hardcoding libGL/GLX as a build
> requirement.

You can run GL tests without GLX. We can't build GL tests without
X11-dev?

-Jordan

> GLES tests are on by default on Linux, so the build still
> makes sense.
> 
> Signed-off-by: Mircea Gherzan 
> ---
>  CMakeLists.txt | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 736677f..902ca3e 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -45,6 +45,10 @@ option(PIGLIT_BUILD_GLES2_TESTS "Build tests for OpenGL 
> ES2" ${PIGLIT_BUILD_GLES
>  option(PIGLIT_BUILD_GLES3_TESTS "Build tests for OpenGL ES3" 
> ${PIGLIT_BUILD_GLES_TESTS_DEFAULT})
>  option(PIGLIT_BUILD_CL_TESTS "Build tests for OpenCL" OFF)
>  
> +if((NOT X11_FOUND) AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"))
> +   set(PIGLIT_BUILD_GL_TESTS OFF)
> +endif()
> +
>  if(PIGLIT_BUILD_GL_TESTS)
> find_package(OpenGL REQUIRED)
>  endif()
> -- 
> 2.5.0
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] arb_compute_shader: Add test for dispatches with a zero size

2016-02-16 Thread Jordan Justen
The ARB_compute_shader spec says:

  "If the work group count in any dimension is zero, no work groups
   are dispatched."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94100
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/all.py   |  1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt|  1 +
 tests/spec/arb_compute_shader/zero-dispatch-size.c | 82 ++
 3 files changed, 84 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/zero-dispatch-size.c

diff --git a/tests/all.py b/tests/all.py
index 1dc7f9d..848ff6f 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4195,6 +4195,7 @@ with profile.group_manager(
 g(['arb_compute_shader-indirect-compute'], 'indirect-compute')
 g(['arb_compute_shader-local-id'], 'local-id' + '-explosion')
 g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
+g(['arb_compute_shader-zero-dispatch-size'], 'zero-dispatch-size')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index 103ad2c..d7b9812 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -17,5 +17,6 @@ set(depends cs-ids-common.c common.c)
 piglit_add_executable (arb_compute_shader-indirect-compute indirect-compute.c 
${depends})
 piglit_add_executable (arb_compute_shader-local-id local-id.c ${depends})
 piglit_add_executable (arb_compute_shader-render-and-compute 
render-and-compute.c ${depends})
+piglit_add_executable (arb_compute_shader-zero-dispatch-size 
zero-dispatch-size.c ${depends})
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/zero-dispatch-size.c 
b/tests/spec/arb_compute_shader/zero-dispatch-size.c
new file mode 100644
index 000..3ebf558
--- /dev/null
+++ b/tests/spec/arb_compute_shader/zero-dispatch-size.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2016 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
+ *
+ * Tests compute dispatches with a zero workgroups
+ */
+
+#include "cs-ids-common.h"
+
+static struct piglit_gl_test_config *piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = 
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   uint32_t global[3] = { 4, 8, 2 };
+   enum piglit_result result = PIGLIT_PASS;
+   int i;
+
+   cs_ids_common_init();
+   cs_ids_set_local_id_test();
+   cs_ids_set_local_size(5, 2, 5);
+
+   for (i = 0; i < 16; i++) {
+   if (i == 0)
+   cs_ids_use_direct_dispatch();
+   else if (i == 8)
+   cs_ids_use_indirect_dispatch();
+
+   cs_ids_set_global_size((i & 1) ? global[0] : 0u,
+  (i & 2) ? global[1] : 0u,
+  (i & 4) ? global[2] : 0u);
+
+   cs_ids_set_local_id_test();
+   result = cs_ids_run_test();
+   if (result != PIGLIT_PASS)
+   piglit_report_result(result);
+
+   cs_ids_set_global_id_test();
+   result = cs_ids_run_test();
+   if (result != PIGLIT_PASS)
+   piglit_report_result(result);
+   }
+
+   cs_ids_common_destroy();
+
+   piglit_report_result(result);
+}
-- 
2.7.0

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


[Piglit] [PATCH 1/2] arb_compute_shader: Support ID tests with work group sizes of 0

2016-02-16 Thread Jordan Justen
The ARB_compute_shader spec says:

  "If the work group count in any dimension is zero, no work groups
   are dispatched."

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_compute_shader/cs-ids-common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/spec/arb_compute_shader/cs-ids-common.c 
b/tests/spec/arb_compute_shader/cs-ids-common.c
index 9676c82..e5987d3 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.c
+++ b/tests/spec/arb_compute_shader/cs-ids-common.c
@@ -135,7 +135,8 @@ confirm_size()
 
memset(, 0, sizeof values);
 
-   for (z = 0; z < zs; z++) {
+   const bool no_work = global_x == 0 || global_y == 0 || global_z == 0;
+   for (z = 0; z < zs && !no_work; z++) {
for (y = 0; y < ys; y++) {
for (x = 0; x < xs; x++) {
if (((x & y) & z) == 0u)
@@ -280,8 +281,7 @@ cs_ids_run_test()
   local_x, local_y, local_z,
   global_x, global_y, global_z);
 
-   if (local_x == 0 || local_y == 0 || local_z == 0 ||
-   global_x == 0 || global_y == 0 || global_z == 0)
+   if (local_x == 0 || local_y == 0 || local_z == 0)
return PIGLIT_FAIL;
 
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, atomics_bo);
-- 
2.7.0

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


Re: [Piglit] [PATCH V2 1/3] util: add infrastructure to look-up glMemoryBarrier() enums via names

2015-12-11 Thread Jordan Justen
On 2015-12-10 14:42:27, Timothy Arceri wrote:
> V2: make the existing piglit_get_gl_enum_from_name() function handle the
> memory barrier enums (Suggested by Jordan).
> 
> Cc: Jordan Justen <jordan.l.jus...@intel.com>
> ---
>  tests/util/gen_dispatch.py  | 15 ++-
>  tests/util/piglit-util-gl.h |  3 +++
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
> index 80099ad..708c1f8 100644
> --- a/tests/util/gen_dispatch.py
> +++ b/tests/util/gen_dispatch.py
> @@ -142,8 +142,11 @@ class EnumCode(object):
>  def emit(cls, out_dir, gl_registry):
>  assert isinstance(gl_registry, registry.gl.Registry)
>  enums = cls.get_enums_in_default_namespace(gl_registry)
> +memory_barrier = cls.get_enums_in_memory_barrier_group(gl_registry)
> +combined_enums = list(enums)
> +combined_enums.extend(memory_barrier)

I would like to hear if Dylan has any concerns with this code, but for
v2 of the series:

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

>  unique_enums = cls.get_unique_enums(enums)
> -enums_by_name = cls.get_enums_by_name(enums)
> +enums_by_name = cls.get_enums_by_name(combined_enums)
>  render_template(
>  cls.C_TEMPLATE,
>  out_dir,
> @@ -161,6 +164,16 @@ class EnumCode(object):
>  return enums
>  
>  @classmethod
> +def get_enums_in_memory_barrier_group(cls, gl_registry):
> +enums = []
> +for enum_group in gl_registry.enum_groups:
> +if enum_group.name == 'MemoryBarrierMask':
> +   if enum_group.type == 'bitmask':
> +for enum in enum_group.enums:
> +enums.append(enum)
> +return enums
> +
> +@classmethod
>  def get_unique_enums(cls, enums):
>  def append_enum_if_new_value(enum_list, enum):
>  if enum_list[-1].num_value < enum.num_value:
> diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
> index 5a8c82b..4ba0aa3 100644
> --- a/tests/util/piglit-util-gl.h
> +++ b/tests/util/piglit-util-gl.h
> @@ -95,6 +95,9 @@ const char *piglit_get_gl_enum_name(GLenum param);
>   */
>  GLenum piglit_get_gl_enum_from_name(const char *name);
>  
> +GLenum
> +piglit_get_gl_memory_barrier_enum_from_name(const char *name);
> +
>  /**
>   * \brief Convert a GL primitive type enum value to a string.
>   *
> -- 
> 2.4.3
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 1/3] util: add infrastructure to look-up glMemoryBarrier() enums via names

2015-12-10 Thread Jordan Justen
Thanks for looking at this! I wanted to add the memory barrier command
to shader_runner to, but I also found that
piglit_get_gl_enum_from_name would not handle those strings.

My question is, why not just make piglit_get_gl_enum_from_name handle
more strings?

I think the enum=>string translation is ambiguous, but string=>enum
should not be, right?

-Jordan

On 2015-12-09 15:36:50, Timothy Arceri wrote:
> ---
>  tests/util/gen_dispatch.py| 14 +-
>  tests/util/piglit-util-gl-enum-gen.c.mako | 24 
>  tests/util/piglit-util-gl.h   |  3 +++
>  3 files changed, 40 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
> index 80099ad..dd05687 100644
> --- a/tests/util/gen_dispatch.py
> +++ b/tests/util/gen_dispatch.py
> @@ -144,12 +144,14 @@ class EnumCode(object):
>  enums = cls.get_enums_in_default_namespace(gl_registry)
>  unique_enums = cls.get_unique_enums(enums)
>  enums_by_name = cls.get_enums_by_name(enums)
> +memory_barrier = cls.get_enums_in_memory_barrier_group(gl_registry)
>  render_template(
>  cls.C_TEMPLATE,
>  out_dir,
>  gl_registry=gl_registry,
>  sorted_unique_enums_in_default_namespace=unique_enums,
> -sorted_enums_by_name=enums_by_name)
> +sorted_enums_by_name=enums_by_name,
> +sorted_by_name_memory_barrier_enums=memory_barrier)
>  
>  @classmethod
>  def get_enums_in_default_namespace(cls, gl_registry):
> @@ -161,6 +163,16 @@ class EnumCode(object):
>  return enums
>  
>  @classmethod
> +def get_enums_in_memory_barrier_group(cls, gl_registry):
> +enums = []
> +for enum_group in gl_registry.enum_groups:
> +if enum_group.name == 'MemoryBarrierMask':
> +   if enum_group.type == 'bitmask':
> +for enum in enum_group.enums:
> +enums.append(enum)
> +return cls.get_enums_by_name(enums)
> +
> +@classmethod
>  def get_unique_enums(cls, enums):
>  def append_enum_if_new_value(enum_list, enum):
>  if enum_list[-1].num_value < enum.num_value:
> diff --git a/tests/util/piglit-util-gl-enum-gen.c.mako 
> b/tests/util/piglit-util-gl-enum-gen.c.mako
> index 9a0fff8..04b79b8 100644
> --- a/tests/util/piglit-util-gl-enum-gen.c.mako
> +++ b/tests/util/piglit-util-gl-enum-gen.c.mako
> @@ -64,6 +64,30 @@ compare_enum_name(const void *a, const void *b)
>  }
>  
>  GLenum
> +piglit_get_gl_memory_barrier_enum_from_name(const char *name)
> +{
> +>---static const struct gl_name_to_enum names[] = {
> +% for enum in sorted_by_name_memory_barrier_enums:
> +>--->---{ "${enum.name}", ${enum.c_num_literal} },
> +% endfor
> +>---};
> +>---struct gl_name_to_enum key = { name, 0 };
> +>---struct gl_name_to_enum *result;
> +
> +>---result = (struct gl_name_to_enum*)
> +>--->---bsearch(,
> +>--->---names, ARRAY_SIZE(names), sizeof names[0],
> +>--->---compare_enum_name);
> +
> +>---if (result == NULL) {
> +>--->---fprintf(stderr, "No known enum named %s!\n", name);
> +>--->---abort();
> +>---}
> +
> +>---return result->_enum;
> +}
> +
> +GLenum
>  piglit_get_gl_enum_from_name(const char *name)
>  {
>  >---static const struct gl_name_to_enum names[] = {
> diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
> index 5a8c82b..4ba0aa3 100644
> --- a/tests/util/piglit-util-gl.h
> +++ b/tests/util/piglit-util-gl.h
> @@ -95,6 +95,9 @@ const char *piglit_get_gl_enum_name(GLenum param);
>   */
>  GLenum piglit_get_gl_enum_from_name(const char *name);
>  
> +GLenum
> +piglit_get_gl_memory_barrier_enum_from_name(const char *name);
> +
>  /**
>   * \brief Convert a GL primitive type enum value to a string.
>   *
> -- 
> 2.4.3
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] arb_shader_storage_buffer_object: Test linking programs with large copies

2015-11-20 Thread Jordan Justen
We test linking of programs that copy a large array, and a large
structure.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 
tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
 seemed a bit too complex, when the more immediate issue was the linking
 failure. Maybe it would be good to verify that the copy actually works, but
 these at least expose the linking issue.

 .../linker/copy-large-array.shader_test| 27 +++
 .../linker/copy-large-struct.shader_test   | 31 ++
 2 files changed, 58 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/copy-large-array.shader_test
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/linker/copy-large-struct.shader_test

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-array.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-array.shader_test
new file mode 100644
index 000..e0b04e5
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-array.shader_test
@@ -0,0 +1,27 @@
+# Tests linking of a fragment shader that copies a 'large' array field
+# within an SSBO.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_storage_buffer_object: require
+
+#define SIZE 16
+
+buffer SSBO {
+mat4 src[SIZE];
+mat4 dst[SIZE];
+};
+
+void main() {
+dst = src;
+}
+
+[test]
+link success
diff --git 
a/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-struct.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-struct.shader_test
new file mode 100644
index 000..81de526
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/linker/copy-large-struct.shader_test
@@ -0,0 +1,31 @@
+# Tests linking of a fragment shader that copies a 'large' struct
+# field within an SSBO.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_storage_buffer_object: require
+
+#define SIZE 16
+
+struct S {
+mat4 m[SIZE];
+};
+
+buffer SSBO {
+S src;
+S dst;
+};
+
+void main() {
+dst = src;
+}
+
+[test]
+link success
-- 
2.6.2

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


[Piglit] [PATCH] arb_shader_storage_buffer_object: Test copying a large SSBO item

2015-11-19 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Kristian Høgsberg <k...@bitplanet.net>
Cc: Samuel Iglesias Gonsalvez <sigles...@igalia.com>
Cc: Iago Toral Quiroga <ito...@igalia.com>
---
 This fails to link on i965.

 .../execution/large-field-copy.shader_test | 66 ++
 1 file changed, 66 insertions(+)
 create mode 100644 
tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
 
b/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
new file mode 100644
index 000..a949507
--- /dev/null
+++ 
b/tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
@@ -0,0 +1,66 @@
+# Test that a 'large' field of an SSBO can be copied.
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_storage_buffer_object
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_storage_buffer_object: require
+
+#define SIZE 16
+
+layout (std430) buffer SSBO {
+mat4 m1[SIZE];
+mat4 m2[SIZE];
+};
+
+out vec4 color;
+
+uniform uint mode;
+
+void main() {
+bool pass = true;
+int i;
+
+switch (mode) {
+case 0u:
+for (i = 0; i < SIZE; i++) {
+   m1[i] = mat4(vec4(i + 0), vec4(i + 1),
+vec4(i + 2), vec4(i + 3));
+   }
+   break;
+case 1u:
+m2 = m1;
+   break;
+case 2u:
+for (i = 0; i < SIZE; i++) {
+   pass = pass && (m2[i] == mat4(vec4(i + 0), vec4(i + 1),
+ vec4(i + 2), vec4(i + 3)));
+   }
+   break;
+}
+
+if (pass)
+color = vec4(0.0, 1.0, 0.0, 1.0);
+else
+color = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+ssbo 2048
+
+uniform uint mode 0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uint mode 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform uint mode 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.6.2

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


Re: [Piglit] [PATCH] arb_compute_shader: Fix loop bounds.

2015-11-15 Thread Jordan Justen
Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2015-11-14 23:29:29, Vinson Lee wrote:
> Fixes "out-of-bounds read" defect reported by Coverity.
> 
> Signed-off-by: Vinson Lee <v...@freedesktop.org>
> ---
>  tests/spec/arb_compute_shader/cs-ids-common.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/spec/arb_compute_shader/cs-ids-common.c 
> b/tests/spec/arb_compute_shader/cs-ids-common.c
> index 0f67f43..e05587f 100644
> --- a/tests/spec/arb_compute_shader/cs-ids-common.c
> +++ b/tests/spec/arb_compute_shader/cs-ids-common.c
> @@ -333,15 +333,15 @@ cs_ids_test_all_sizes()
> uint32_t x, y, z;
>  
>  
> -   for (zi = 0; zi <= ARRAY_SIZE(sizes); zi++) {
> +   for (zi = 0; zi < ARRAY_SIZE(sizes); zi++) {
> z = sizes[zi];
> if (z > 64)
> break;
> -   for (yi = 0; yi <= ARRAY_SIZE(sizes); yi++) {
> +   for (yi = 0; yi < ARRAY_SIZE(sizes); yi++) {
> y = sizes[yi];
> if ((y * z) > 1024)
> break;
> -   for (xi = 0; xi <= ARRAY_SIZE(sizes); xi++) {
> +   for (xi = 0; xi < ARRAY_SIZE(sizes); xi++) {
> x = sizes[xi];
> if ((x * y * z) > 1024)
> break;
> -- 
> 2.4.9 (Apple Git-60)
> 
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] shader_runner: Allow geometry and tessellation shaders in OpenGLES 3.2

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 17a3e3a..764f46d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -357,11 +357,21 @@ compile_glsl(GLenum target)
break;
case GL_TESS_CONTROL_SHADER:
case GL_TESS_EVALUATION_SHADER:
-   if (gl_version.num < 40)
+   if (gl_version.es) {
+   if (gl_version.num < 32) {
+   printf("OpenGLES 3.2 is required for 
tessellation shader support\n");
+   piglit_report_result(PIGLIT_SKIP);
+   }
+   } else if (gl_version.num < 40)
piglit_require_extension("GL_ARB_tessellation_shader");
break;
case GL_GEOMETRY_SHADER:
-   if (gl_version.num < 32)
+   if (gl_version.es) {
+   if (gl_version.num < 32) {
+   printf("OpenGLES 3.2 is required for geometry 
shader support\n");
+   piglit_report_result(PIGLIT_SKIP);
+   }
+   } else if (gl_version.num < 32)
piglit_require_extension("GL_ARB_geometry_shader4");
break;
case GL_COMPUTE_SHADER:
-- 
2.6.2

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


[Piglit] [PATCH 1/2] shader_runner: Allow compute shaders in OpenGLES 3.1

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index a967e52..17a3e3a 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -365,7 +365,12 @@ compile_glsl(GLenum target)
piglit_require_extension("GL_ARB_geometry_shader4");
break;
case GL_COMPUTE_SHADER:
-   if (gl_version.num < 43)
+   if (gl_version.es) {
+   if (gl_version.num < 31) {
+   printf("OpenGLES 3.1 is required for compute 
shader support\n");
+   piglit_report_result(PIGLIT_SKIP);
+   }
+   } else if (gl_version.num < 43)
piglit_require_extension("GL_ARB_compute_shader");
break;
}
-- 
2.6.2

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


[Piglit] [PATCH 2/3] arb_compute_shader: Add barrier() function compiler test

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_compute_shader/compiler/barrier.comp | 15 +++
 1 file changed, 15 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/compiler/barrier.comp

diff --git a/tests/spec/arb_compute_shader/compiler/barrier.comp 
b/tests/spec/arb_compute_shader/compiler/barrier.comp
new file mode 100644
index 000..23b49c2
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/barrier.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+barrier();
+}
-- 
2.6.2

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


[Piglit] [PATCH 1/3] arb_compute_shader: Add compiler tests for CS memory barrier functions

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 .../arb_compute_shader/compiler/groupMemoryBarrier.comp   | 15 +++
 .../compiler/memoryBarrierAtomicCounter.comp  | 15 +++
 .../arb_compute_shader/compiler/memoryBarrierBuffer.comp  | 15 +++
 .../arb_compute_shader/compiler/memoryBarrierImage.comp   | 15 +++
 .../arb_compute_shader/compiler/memoryBarrierShared.comp  | 15 +++
 5 files changed, 75 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
 create mode 100644 
tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp

diff --git a/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp 
b/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
new file mode 100644
index 000..b482790
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+groupMemoryBarrier();
+}
diff --git 
a/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp 
b/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
new file mode 100644
index 000..2ef7b89
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+memoryBarrierAtomicCounter();
+}
diff --git a/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp 
b/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
new file mode 100644
index 000..b1fe8c4
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+memoryBarrierBuffer();
+}
diff --git a/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp 
b/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
new file mode 100644
index 000..7fb0b6e
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+memoryBarrierImage();
+}
diff --git a/tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp 
b/tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp
new file mode 100644
index 000..3809c69
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp
@@ -0,0 +1,15 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+memoryBarrierShared();
+}
-- 
2.6.2

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


Re: [Piglit] [PATCH 1/3] arb_compute_shader: Add compiler tests for CS memory barrier functions

2015-11-05 Thread Jordan Justen
On 2015-11-05 10:57:12, Ilia Mirkin wrote:
> On Thu, Nov 5, 2015 at 1:50 PM, Jordan Justen <jordan.l.jus...@intel.com> 
> wrote:
> > Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
> > ---
> >  .../arb_compute_shader/compiler/groupMemoryBarrier.comp   | 15 
> > +++
> >  .../compiler/memoryBarrierAtomicCounter.comp  | 15 
> > +++
> >  .../arb_compute_shader/compiler/memoryBarrierBuffer.comp  | 15 
> > +++
> >  .../arb_compute_shader/compiler/memoryBarrierImage.comp   | 15 
> > +++
> >  .../arb_compute_shader/compiler/memoryBarrierShared.comp  | 15 
> > +++
> >  5 files changed, 75 insertions(+)
> >  create mode 100644 
> > tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
> >  create mode 100644 
> > tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
> >  create mode 100644 
> > tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
> >  create mode 100644 
> > tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
> >  create mode 100644 
> > tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp
> >
> > diff --git a/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp 
> > b/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
> > new file mode 100644
> > index 000..b482790
> > --- /dev/null
> > +++ b/tests/spec/arb_compute_shader/compiler/groupMemoryBarrier.comp
> > @@ -0,0 +1,15 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 3.30
> > +// require_extensions: GL_ARB_compute_shader
> > +// [end config]
> > +
> > +#version 330
> 
> May I ask why you're using version 330 for all these? The spec calls
> for GL 4.2, although I think the only dependency is glMemoryBarrier
> introduced by images.

I just copied the previous compiler tests, which had 330. I guess the
ext spec does say that 4.2 is required.

r-b with that changed?

-Jordan

> 
>   -ilia
> 
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_x = 1) in;
> > +
> > +void main()
> > +{
> > +groupMemoryBarrier();
> > +}
> > diff --git 
> > a/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp 
> > b/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
> > new file mode 100644
> > index 000..2ef7b89
> > --- /dev/null
> > +++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierAtomicCounter.comp
> > @@ -0,0 +1,15 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 3.30
> > +// require_extensions: GL_ARB_compute_shader
> > +// [end config]
> > +
> > +#version 330
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_x = 1) in;
> > +
> > +void main()
> > +{
> > +memoryBarrierAtomicCounter();
> > +}
> > diff --git 
> > a/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp 
> > b/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
> > new file mode 100644
> > index 000..b1fe8c4
> > --- /dev/null
> > +++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierBuffer.comp
> > @@ -0,0 +1,15 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 3.30
> > +// require_extensions: GL_ARB_compute_shader
> > +// [end config]
> > +
> > +#version 330
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_x = 1) in;
> > +
> > +void main()
> > +{
> > +memoryBarrierBuffer();
> > +}
> > diff --git a/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp 
> > b/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
> > new file mode 100644
> > index 000..7fb0b6e
> > --- /dev/null
> > +++ b/tests/spec/arb_compute_shader/compiler/memoryBarrierImage.comp
> > @@ -0,0 +1,15 @@
> > +// [config]
> > +// expect_result: pass
> > +// glsl_version: 3.30
> > +// require_extensions: GL_ARB_compute_shader
> > +// [end config]
> > +
> > +#version 330
> > +#extension GL_ARB_compute_shader: enable
> > +
> > +layout(local_size_x = 1) in;
> > +
> > +void main()
> > +{
> > +memoryBarrierImage();
> > +}
> > diff --git 
> > a/tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp 
> > b/tests/spec/arb_compute_shader/compiler/memoryBarrierShared.comp
> > new file mode 10064

[Piglit] [PATCH 3/3] arb_compute_shader: shared variable atomic functions compiler tests

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 .../compiler/shared-atomics.comp   | 40 ++
 1 file changed, 40 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/compiler/shared-atomics.comp

diff --git a/tests/spec/arb_compute_shader/compiler/shared-atomics.comp 
b/tests/spec/arb_compute_shader/compiler/shared-atomics.comp
new file mode 100644
index 000..c144206
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/shared-atomics.comp
@@ -0,0 +1,40 @@
+// [config]
+// expect_result: pass
+// glsl_version: 3.30
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 330
+#extension GL_ARB_compute_shader: enable
+
+shared uint u;
+shared int i;
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+atomicAdd(u, 1u);
+atomicAdd(i, 1);
+
+atomicMin(u, 1u);
+atomicMin(i, 1);
+
+atomicMax(u, 1u);
+atomicMax(i, 1);
+
+atomicAnd(u, 1u);
+atomicAnd(i, 1);
+
+atomicOr(u, 1u);
+atomicOr(i, 1);
+
+atomicXor(u, 1u);
+atomicXor(i, 1);
+
+atomicExchange(u, 1u);
+atomicExchange(i, 1);
+
+atomicCompSwap(u, 1u, 2u);
+atomicCompSwap(i, 1, 2);
+}
-- 
2.6.2

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


[Piglit] [PATCH v2 1/2] shader_runner: Allow compute shaders in OpenGLES 3.1

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index a967e52..59a76fa 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -365,7 +365,7 @@ compile_glsl(GLenum target)
piglit_require_extension("GL_ARB_geometry_shader4");
break;
case GL_COMPUTE_SHADER:
-   if (gl_version.num < 43)
+   if (gl_version.num < (gl_version.es ? 31 : 43))
piglit_require_extension("GL_ARB_compute_shader");
break;
}
-- 
2.6.2

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


[Piglit] [PATCH v2 2/2] shader_runner: Allow geometry and tessellation shaders in OpenGLES 3.2

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 59a76fa..b010cbb 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -357,12 +357,16 @@ compile_glsl(GLenum target)
break;
case GL_TESS_CONTROL_SHADER:
case GL_TESS_EVALUATION_SHADER:
-   if (gl_version.num < 40)
-   piglit_require_extension("GL_ARB_tessellation_shader");
+   if (gl_version.num < (gl_version.es ? 32 : 40))
+   piglit_require_extension(gl_version.es ?
+"GL_OES_tessellation_shader" :
+"GL_ARB_tessellation_shader");
break;
case GL_GEOMETRY_SHADER:
if (gl_version.num < 32)
-   piglit_require_extension("GL_ARB_geometry_shader4");
+   piglit_require_extension(gl_version.es ?
+"GL_OES_geometry_shader" :
+"GL_ARB_geometry_shader4");
break;
case GL_COMPUTE_SHADER:
if (gl_version.num < (gl_version.es ? 31 : 43))
-- 
2.6.2

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


[Piglit] [PATCH] arb_compute_shader: Test parsing shared variables

2015-11-05 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 .../compiler/shared-variables.comp | 44 ++
 1 file changed, 44 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/compiler/shared-variables.comp

diff --git a/tests/spec/arb_compute_shader/compiler/shared-variables.comp 
b/tests/spec/arb_compute_shader/compiler/shared-variables.comp
new file mode 100644
index 000..cd4a3d2
--- /dev/null
+++ b/tests/spec/arb_compute_shader/compiler/shared-variables.comp
@@ -0,0 +1,44 @@
+// [config]
+// expect_result: pass
+// glsl_version: 4.20
+// require_extensions: GL_ARB_compute_shader
+// [end config]
+
+#version 420
+#extension GL_ARB_compute_shader: enable
+
+#define DECL(q, t) q t t##_v; q t t##_va[2]
+#define DECL_234(q, t) DECL(q, t##2); DECL(q, t##3); DECL(q, t##4)
+
+#define DECL_VARS(q) \
+DECL(q, uint); \
+DECL(q, int); \
+DECL(q, float); \
+DECL_234(q, uvec); \
+DECL_234(q, ivec); \
+DECL_234(q, vec); \
+DECL_234(q, mat)
+
+struct s1 {
+DECL_VARS();
+};
+
+struct s2 {
+s1 s;
+s1 sa[2];
+};
+
+DECL_VARS(shared);
+
+shared s1 s1i;
+shared s2 s2i;
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+uint_va[1] = s2i.sa[1].uint_va[1];
+s1i.mat4_va[1] = mat4_v;
+s2i.sa[1].vec4_va[0] = s1i.mat4_va[1][3];
+s2i.s.mat2_va[1][1][0] = float_v;
+}
-- 
2.6.2

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


Re: [Piglit] [PATCH 1/3] Make atomic counter tests more robust against race conditions.

2015-10-21 Thread Jordan Justen
Series Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2015-10-21 01:11:25, Kenneth Graunke wrote:
> From: Chris Wilson <ch...@chris-wilson.co.uk>
> 
> Drivers with synchronization bugs could generate errors such as:
> 
> Probe value at (0)
>   Expected: 0x0001
>   Observed: 0x0001
> 
> This is because the initial comparison and the print statement access
> the buffer at different times, leading to the following scenario.
> 
> 1. Comparison reads wrong value from the buffer (test properly fails).
> 2. Right value finally lands in buffer.
> 3. Error message prints the current value...which is the not the value
>used by the comparison.  Instead, it's the expected value, so the
>message makes no sense.
> 
> [Ken imported this patch from Chris Wilson's Bugzilla comment linked
>  below and wrote a commit message.]
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91298
> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
> ---
>  tests/spec/arb_shader_atomic_counters/common.c | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> Chris, I made you the author on this patch since it's your code.
> It didn't look like a patch ever hit the mailing list, so I went
> ahead and put one together...
> 
> diff --git a/tests/spec/arb_shader_atomic_counters/common.c 
> b/tests/spec/arb_shader_atomic_counters/common.c
> index b966009..c732699 100644
> --- a/tests/spec/arb_shader_atomic_counters/common.c
> +++ b/tests/spec/arb_shader_atomic_counters/common.c
> @@ -35,6 +35,7 @@ atomic_counters_probe_buffer(unsigned base, unsigned count,
>  uint32_t *p = glMapBufferRange(
>  GL_ATOMIC_COUNTER_BUFFER, base * sizeof(uint32_t),
>  count * sizeof(uint32_t), GL_MAP_READ_BIT);
> +bool pass = true;
>  unsigned i;
>  
>  if (!p) {
> @@ -43,17 +44,18 @@ atomic_counters_probe_buffer(unsigned base, unsigned 
> count,
>  }
>  
>  for (i = 0; i < count; ++i) {
> -if (p[i] != expected[i]) {
> +uint32_t found = p[i];
> +if (found != expected[i]) {
>  printf("Probe value at (%i)\n", i);
>  printf("  Expected: 0x%08x\n", expected[i]);
> -printf("  Observed: 0x%08x\n", p[i]);
> -glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
> -return false;
> +printf("  Observed: 0x%08x\n", found);
> +pass = false;
> +break;
>  }
>  }
>  
>  glUnmapBuffer(GL_ATOMIC_COUNTER_BUFFER);
> -return true;
> +return pass;
>  }
>  
>  bool
> -- 
> 2.6.1
> 
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/2] arb_compute_shader: A simple CS test with SSBO

2015-09-29 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 .../execution/basic-ssbo.shader_test   | 74 ++
 1 file changed, 74 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test

diff --git a/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
new file mode 100644
index 000..4bf7e1c
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/basic-ssbo.shader_test
@@ -0,0 +1,74 @@
+[require]
+GLSL >= 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_storage_buffer_object
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_storage_buffer_object: require
+#extension GL_ARB_shader_atomic_counters: require
+
+#define SIZE 256u
+
+layout(local_size_x = SIZE) in;
+
+layout(binding = 0) uniform atomic_uint counter;
+
+layout(std430)
+buffer SSBO {
+   uintu[SIZE];
+};
+
+uniform uint mode;
+
+void main()
+{
+   uint index = gl_LocalInvocationIndex;
+
+   switch (mode) {
+   case 0u:
+   u[index] = SIZE;
+   break;
+   case 1u:
+   u[index] = index;
+   break;
+   case 2u:
+   if (u[index] == SIZE)
+   atomicCounterIncrement(counter);
+   break;
+   case 3u:
+   if (u[index] == index)
+   atomicCounterIncrement(counter);
+   break;
+   }
+}
+
+[test]
+atomic counters 1
+ssbo 1024
+
+uniform uint mode 0
+compute 1 1 1
+probe atomic counter 0 == 0
+
+uniform uint mode 3
+compute 1 1 1
+probe atomic counter 0 == 0
+
+uniform uint mode 2
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 1
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 2
+compute 1 1 1
+probe atomic counter 0 == 256
+
+uniform uint mode 3
+compute 1 1 1
+probe atomic counter 0 == 512
-- 
2.5.1

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


[Piglit] [PATCH 1/2] shader_runner: Add SSBO buffer initialization command

2015-09-29 Thread Jordan Justen
The command is:

  ssbo 

where  is the size in bytes to allocate for the SSBO buffer.

This command only sets of a buffer for SSBO index 0.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/shaders/shader_runner.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index e8c3aaa..32ac7bd 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -113,6 +113,7 @@ GLenum geometry_layout_input_type = GL_TRIANGLES;
 GLenum geometry_layout_output_type = GL_TRIANGLE_STRIP;
 GLint geometry_layout_vertices_out = 0;
 GLuint atomics_bo = 0;
+GLuint ssbo = 0;
 
 #define SHADER_TYPES 6
 static GLuint *subuniform_locations[SHADER_TYPES];
@@ -2898,6 +2899,13 @@ piglit_display(void)
glShadeModel(GL_SMOOTH);
} else if (string_match("shade model flat", line)) {
glShadeModel(GL_FLAT);
+   } else if (sscanf(line, "ssbo %d", ) == 1) {
+   GLuint *ssbo_init = calloc(x, 1);
+   glGenBuffers(1, );
+   glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo);
+   glBufferData(GL_SHADER_STORAGE_BUFFER, x,
+ssbo_init, GL_DYNAMIC_DRAW);
+   free(ssbo_init);
} else if (sscanf(line, "texture rgbw %d ( %d", , ) == 2) 
{
GLenum int_fmt = GL_RGBA;
int num_scanned =
-- 
2.5.1

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


Re: [Piglit] [PATCH 1/2] shader_runner: Add SSBO buffer initialization command

2015-09-29 Thread Jordan Justen
On 2015-09-29 20:30:48, Chris Forbes wrote:
>I don't think this is correct. The non-indexed binding point (which
>BindBuffer, BufferData uses) is distinct from the 0'th indexed binding
>point (which BindBuffer{Base,Range} use).

You mean that the BindBufferBase is not sufficient to bind the buffer
before using BufferData?

If I understand your concern correctly, then the man page seems to
disagree:

https://www.opengl.org/sdk/docs/man/docbook4/xhtml/glBindBufferBase.xml

"In addition to binding buffer to the indexed buffer binding target,
 glBindBufferBase also binds buffer to the generic buffer binding
 point specified by target."

-Jordan

>- Chris
>On Wed, Sep 30, 2015 at 1:10 PM, Jordan Justen <jordan.l.jus...@intel.com>
>wrote:
> 
>  The command is:
> 
>ssbo 
> 
>  where  is the size in bytes to allocate for the SSBO buffer.
> 
>  This command only sets of a buffer for SSBO index 0.
> 
>  Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
>  ---
>   tests/shaders/shader_runner.c | 8 
>   1 file changed, 8 insertions(+)
> 
>  diff --git a/tests/shaders/shader_runner.c
>  b/tests/shaders/shader_runner.c
>  index e8c3aaa..32ac7bd 100644
>  --- a/tests/shaders/shader_runner.c
>  +++ b/tests/shaders/shader_runner.c
>  @@ -113,6 +113,7 @@ GLenum geometry_layout_input_type = GL_TRIANGLES;
>   GLenum geometry_layout_output_type = GL_TRIANGLE_STRIP;
>   GLint geometry_layout_vertices_out = 0;
>   GLuint atomics_bo = 0;
>  +GLuint ssbo = 0;
> 
>   #define SHADER_TYPES 6
>   static GLuint *subuniform_locations[SHADER_TYPES];
>  @@ -2898,6 +2899,13 @@ piglit_display(void)
>  glShadeModel(GL_SMOOTH);
>  } else if (string_match("shade model flat", line)) {
>  glShadeModel(GL_FLAT);
>  +   } else if (sscanf(line, "ssbo %d", ) == 1) {
>  +   GLuint *ssbo_init = calloc(x, 1);
>  +   glGenBuffers(1, );
>  +   glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0,
>  ssbo);
>  +   glBufferData(GL_SHADER_STORAGE_BUFFER, x,
>  +ssbo_init, GL_DYNAMIC_DRAW);
>  +   free(ssbo_init);
>  } else if (sscanf(line, "texture rgbw %d ( %d", ,
>  ) == 2) {
>  GLenum int_fmt = GL_RGBA;
>  int num_scanned =
>  --
>  2.5.1
> 
>  ___
>  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 v1] Remove Occluqry Glean test.

2015-09-25 Thread Jordan Justen
Add aedc01a5979ec5e6a4498ed3054aa67927f70ca8 reference to commit
message?

Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com>

On 2015-09-25 15:19:51, Juliet Fru wrote:
> ---
>  tests/all.py  |   1 -
>  tests/glean/toccluqry.cpp | 708 
> --
>  tests/glean/toccluqry.h   |  75 -
>  3 files changed, 784 deletions(-)
>  delete mode 100644 tests/glean/toccluqry.cpp
>  delete mode 100644 tests/glean/toccluqry.h
> 
> diff --git a/tests/all.py b/tests/all.py
> index 748165f..846bceb 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -257,7 +257,6 @@ with profile.group_manager(GleanTest, 'glean') as g:
>  g('depthStencil')
>  g('fbo')
>  g('getString')
> -g('occluQry')
>  g('paths')
>  g('pixelFormats')
>  g('pointAtten')
> diff --git a/tests/glean/toccluqry.cpp b/tests/glean/toccluqry.cpp
> deleted file mode 100644
> index d97b7ee..000
> --- a/tests/glean/toccluqry.cpp
> +++ /dev/null
> @@ -1,708 +0,0 @@
> -// BEGIN_COPYRIGHT -*- glean -*-
> -
> -/*
> - * Copyright �� 2006 Intel Corporation
> - * Copyright �� 1999 Allen Akin
> - *
> - * 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.
> - *
> - * Authors:
> - *  Wei Wang <wei.z.w...@intel.com>
> - *
> - */
> -
> -/* 
> - * toccluqry.cpp: Conformance test on ARB_occlusion_query extension
> - */
> -
> -#define GL_GLEXT_PROTOTYPES
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> -#include "rand.h"
> -#include "toccluqry.h"
> -
> -
> -#define START_QUERY(id)\
> -   glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
> -
> -
> -#define TERM_QUERY()\
> -   glEndQueryARB(GL_SAMPLES_PASSED_ARB);\
> -
> -
> -namespace GLEAN {
> -
> -void
> -OccluQryTest::reportError(const char *msg)
> -{
> -   env->log << name << ": Error: " << msg << "\n";
> -}
> -
> -void
> -OccluQryTest::reportWarning(const char *msg)
> -{
> -   env->log << name << ": Warning: " << msg << "\n";
> -}
> -
> -
> -
> -/* Generate a box which will be occluded by the occluder */
> -void OccluQryTest::gen_box(GLfloat left, GLfloat right,
> - GLfloat top, GLfloat btm)
> -{
> -   glBegin(GL_POLYGON);
> -   glVertex3f(left, top, 0);
> -   glVertex3f(right, top, 0);
> -   glVertex3f(right, btm, 0);
> -   glVertex3f(left,  btm, 0);
> -   glEnd();
> -}
> -
> -
> -bool OccluQryTest::chk_ext()
> -{
> -   const char *ext = (const char *) glGetString(GL_EXTENSIONS);
> -
> -   if (!strstr(ext, "GL_ARB_occlusion_query")) {
> -   reportWarning("Extension GL_ARB_occlusion_query is missing.");
> -   return false;
> -   }
> -
> -   return true;
> -}
> -
> -
> -void OccluQryTest::setup()
> -{
> -}
> -
> -GLuint OccluQryTest::find_unused_id()
> -{
> -   RandomBits idRand(32, 183485);
> -   unsigned int id;
> -   int counter = 0;
> -
> -#define MAX_FIND_ID_ROUND 256
> -
> -   while (1) {
> -   /* assuming that at least 2^32-1  can be generated */
> -   id = idRand.next();
> -   if (id != 0 && glIsQueryARB(id) == GL_FALSE)
> -   return id;
> -   if (++ counter >= MAX_FIND_ID_ROUND) {
> -   char str[1000];
> -   sprintf(str

[Piglit] [PATCH] arb_compute_shader: Use gl_NumWorkGroups in global ID tests

2015-09-24 Thread Jordan Justen
The test program for IDs (generated in cs-ids-common.c) has hx, hy and
hz variables that are half of the maximum ID for that dimension.

Previously we only considered the local workgroup size, even when we
were reading the gl_GlobalInvocationID variable.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_compute_shader/cs-ids-common.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests/spec/arb_compute_shader/cs-ids-common.c 
b/tests/spec/arb_compute_shader/cs-ids-common.c
index f08e886..b60fb2d 100644
--- a/tests/spec/arb_compute_shader/cs-ids-common.c
+++ b/tests/spec/arb_compute_shader/cs-ids-common.c
@@ -63,8 +63,10 @@ static const char *compute_shader_source =
"\n"
"#ifdef GLOBAL_ID_TEST\n"
"#define ID_VAR gl_GlobalInvocationID\n"
+   "#define ID_DIM(a) (gl_NumWorkGroups.a * gl_WorkGroupSize.a)\n"
"#else\n"
"#define ID_VAR gl_LocalInvocationID\n"
+   "#define ID_DIM(a) (gl_WorkGroupSize.a)\n"
"#endif\n"
"\n"
"void main()\n"
@@ -72,9 +74,9 @@ static const char *compute_shader_source =
"uint x = ID_VAR.x;\n"
"uint y = ID_VAR.y;\n"
"uint z = ID_VAR.z;\n"
-   "uint hx = gl_WorkGroupSize.x / 2u;\n"
-   "uint hy = gl_WorkGroupSize.y / 2u;\n"
-   "uint hz = gl_WorkGroupSize.z / 2u;\n"
+   "uint hx = ID_DIM(x) / 2u;\n"
+   "uint hy = ID_DIM(y) / 2u;\n"
+   "uint hz = ID_DIM(z) / 2u;\n"
"\n"
"if (((x & y) & z) == 0u)\n"
"atomicCounterIncrement(a0);\n"
@@ -120,16 +122,16 @@ confirm_size()
ys = local_y;
zs = local_z;
 
-   hx = xs / 2u;
-   hy = ys / 2u;
-   hz = zs / 2u;
-
if (global_id) {
xs *= global_x;
ys *= global_y;
zs *= global_z;
}
 
+   hx = xs / 2u;
+   hy = ys / 2u;
+   hz = zs / 2u;
+
memset(, 0, sizeof values);
 
for (z = 0; z < zs; z++) {
-- 
2.5.1

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


[Piglit] [PATCH 5/5] arb_compute_shader: Add indirect compute dispatch test

2015-09-19 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/all.py |  1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt  |  1 +
 tests/spec/arb_compute_shader/indirect-compute.c | 88 
 3 files changed, 90 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/indirect-compute.c

diff --git a/tests/all.py b/tests/all.py
index 9a5142c..9868ce7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4066,6 +4066,7 @@ with profile.group_manager(
   'built-in constants')
 g(['arb_compute_shader-work_group_size_too_large'],
   grouptools.join('compiler', 'work_group_size_too_large'))
+g(['arb_compute_shader-indirect-compute'], 'indirect-compute')
 g(['arb_compute_shader-local-id'], 'local-id' + '-explosion')
 g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
 
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index c9012a4..1db352a 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -15,6 +15,7 @@ piglit_add_executable (arb_compute_shader-minmax minmax.c)
 
 set(depends cs-ids-common.c common.c)
 
+piglit_add_executable (arb_compute_shader-indirect-compute indirect-compute.c 
${depends})
 piglit_add_executable (arb_compute_shader-local-id local-id.c ${depends})
 piglit_add_executable (arb_compute_shader-render-and-compute 
render-and-compute.c ${depends})
 
diff --git a/tests/spec/arb_compute_shader/indirect-compute.c 
b/tests/spec/arb_compute_shader/indirect-compute.c
new file mode 100644
index 000..0142ff3
--- /dev/null
+++ b/tests/spec/arb_compute_shader/indirect-compute.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2015 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
+ *
+ * Tests indirect dispatch of a compute shader
+ */
+
+#include "cs-ids-common.h"
+
+static struct piglit_gl_test_config *piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = 
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+
+static struct {
+   uint32_t local[3];
+   uint32_t global[3];
+} scenarios[] = {
+   { { 2, 4, 8 }, { 8, 4, 2 } },
+   { { 4, 4, 4 }, { 4, 4, 4 } },
+   { { 8, 8, 8 }, { 8, 8, 8 } },
+};
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   enum piglit_result result = PIGLIT_PASS;
+   int i;
+
+   cs_ids_common_init();
+   cs_ids_set_local_id_test();
+   cs_ids_use_indirect_dispatch();
+
+   for (i = 0; i < ARRAY_SIZE(scenarios); i++) {
+   uint32_t *local = scenarios[i].local;
+   uint32_t *global = scenarios[i].global;
+
+   cs_ids_set_local_size(local[0], local[1], local[2]);
+   cs_ids_set_global_size(global[0], global[1], global[2]);
+
+   cs_ids_set_local_id_test();
+   result = cs_ids_run_test();
+   if (result != PIGLIT_PASS)
+   piglit_report_result(result);
+
+   cs_ids_set_global_id_test();
+   result = cs_ids_run_test();
+   if (result != PIGLIT_PASS)
+   piglit_report_result(result);
+   }
+
+   cs_ids_common_destroy();
+
+   piglit_report_result(result);
+}
-- 
2.5.1

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


[Piglit] [PATCH 2/5] arb_compute_shader: Add common functions for checking invocation IDs

2015-09-19 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_compute_shader/CMakeLists.gl.txt |   2 +-
 tests/spec/arb_compute_shader/cs-ids-common.c   | 422 
 tests/spec/arb_compute_shader/cs-ids-common.h   |  67 
 3 files changed, 490 insertions(+), 1 deletion(-)
 create mode 100644 tests/spec/arb_compute_shader/cs-ids-common.c
 create mode 100644 tests/spec/arb_compute_shader/cs-ids-common.h

diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index 4ef0446..a91ff8c 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -13,6 +13,6 @@ link_libraries (
 piglit_add_executable (arb_compute_shader-api_errors api_errors.c)
 piglit_add_executable (arb_compute_shader-minmax minmax.c)
 
-set(depends common.c)
+set(depends cs-ids-common.c common.c)
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/cs-ids-common.c 
b/tests/spec/arb_compute_shader/cs-ids-common.c
new file mode 100644
index 000..f08e886
--- /dev/null
+++ b/tests/spec/arb_compute_shader/cs-ids-common.c
@@ -0,0 +1,422 @@
+/*
+ * Copyright (c) 2014 - 2015 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
+ *
+ * Test cases in which the ARB_compute_shader API is expected to
+ * generate an error.
+ */
+
+#include "piglit-util-gl.h"
+#include "piglit-shader.h"
+#include "common.h"
+
+#define NUM_ATOMIC_COUNTERS 8
+
+static GLuint atomics_bo = 0;
+static GLuint indirect_bo = 0;
+static bool verbose = false;
+static bool indirect_dispatch = false;
+static bool global_id = false;
+static GLint prog = 0;
+
+static uint32_t global_x = 0, global_y = 0, global_z = 0;
+static uint32_t local_x = 0, local_y = 0, local_z = 0;
+
+static uint32_t sizes[] = {
+   1, 2, 3, 4, 5, 7, 8, 9, 15, 16, 17, 31, 32, 33, 63, 64, 65,
+   127, 128, 129, 255, 256, 257, 511, 512, 513, 1023, 1024
+};
+
+static const char *extensions =
+   "#extension GL_ARB_shader_atomic_counters: require\n";
+
+static const char *compute_shader_source =
+   "layout(binding = 0) uniform atomic_uint a0;\n"
+   "layout(binding = 0) uniform atomic_uint a1;\n"
+   "layout(binding = 0) uniform atomic_uint a2;\n"
+   "layout(binding = 0) uniform atomic_uint a3;\n"
+   "layout(binding = 0) uniform atomic_uint a4;\n"
+   "layout(binding = 0) uniform atomic_uint a5;\n"
+   "layout(binding = 0) uniform atomic_uint a6;\n"
+   "layout(binding = 0) uniform atomic_uint a7;\n"
+   "\n"
+   "#ifdef GLOBAL_ID_TEST\n"
+   "#define ID_VAR gl_GlobalInvocationID\n"
+   "#else\n"
+   "#define ID_VAR gl_LocalInvocationID\n"
+   "#endif\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "uint x = ID_VAR.x;\n"
+   "uint y = ID_VAR.y;\n"
+   "uint z = ID_VAR.z;\n"
+   "uint hx = gl_WorkGroupSize.x / 2u;\n"
+   "uint hy = gl_WorkGroupSize.y / 2u;\n"
+   "uint hz = gl_WorkGroupSize.z / 2u;\n"
+   "\n"
+   "if (((x & y) & z) == 0u)\n"
+   "atomicCounterIncrement(a0);\n"
+   "if (((x | y) | z) == 7u)\n"
+   "atomicCounterIncrement(a1);\n"
+   "if (x == y && y == z)\n"
+   "atomicCounterIncrement(a2);\n"
+   "if (x != y && y != z && x != z)\n"
+   "atomicCounterIncrement(a3);\n"
+   "if (((x & y) & z) == 2u)\n"

[Piglit] [PATCH 1/5] arb_compute_shader: Add common functions to generate a CS program

2015-09-19 Thread Jordan Justen
These are a very simplified version of the similar image load/store
versions.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/spec/arb_compute_shader/CMakeLists.gl.txt |  2 +
 tests/spec/arb_compute_shader/common.c  | 98 +
 tests/spec/arb_compute_shader/common.h  | 52 +
 3 files changed, 152 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/common.c
 create mode 100644 tests/spec/arb_compute_shader/common.h

diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index a3367a7..4ef0446 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -13,4 +13,6 @@ link_libraries (
 piglit_add_executable (arb_compute_shader-api_errors api_errors.c)
 piglit_add_executable (arb_compute_shader-minmax minmax.c)
 
+set(depends common.c)
+
 # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/common.c 
b/tests/spec/arb_compute_shader/common.c
new file mode 100644
index 000..c2d98b7
--- /dev/null
+++ b/tests/spec/arb_compute_shader/common.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014 - 2015 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 common.c
+ *
+ * Utility code for building a compute shader program.
+ */
+
+#include "common.h"
+
+char *
+concat(char *hunk0, ...)
+{
+   char *s = hunk0;
+   char *hunk;
+   va_list ap;
+
+   va_start(ap, hunk0);
+
+   while ((hunk = va_arg(ap, char *))) {
+   char *t = s;
+   asprintf(, "%s\n%s", t, hunk);
+   free(t);
+   free(hunk);
+   }
+
+   va_end(ap);
+   return s;
+}
+
+GLuint
+generate_cs_prog(unsigned x, unsigned y, unsigned z, char *ext,
+char *src)
+{
+   char *source = NULL;
+
+   if (ext == NULL)
+   ext = hunk("");
+
+   asprintf(,
+"#version 330\n"
+"#extension GL_ARB_compute_shader : enable\n"
+"%s\n"
+"layout(local_size_x = %d, local_size_y = %d, local_size_z = 
%d) in;\n"
+"\n"
+"%s\n",
+ext,
+x, y, z,
+src
+);
+   free(ext);
+   free(src);
+
+   GLuint prog = glCreateProgram();
+
+   GLuint shader =
+   piglit_compile_shader_text_nothrow(GL_COMPUTE_SHADER, source);
+
+   free(source);
+
+   if (!shader) {
+   glDeleteProgram(prog);
+   return 0;
+   }
+
+   glAttachShader(prog, shader);
+
+   glLinkProgram(prog);
+
+   glDeleteShader(shader);
+
+   if (!piglit_link_check_status(prog)) {
+   glDeleteProgram(prog);
+   return 0;
+   }
+
+   return prog;
+}
diff --git a/tests/spec/arb_compute_shader/common.h 
b/tests/spec/arb_compute_shader/common.h
new file mode 100644
index 000..e870827
--- /dev/null
+++ b/tests/spec/arb_compute_shader/common.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014 -2015 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 S

[Piglit] [PATCH 4/5] arb_compute_shader: Add render + compute test

2015-09-19 Thread Jordan Justen
This test verifieds that rendering and compute operations can be
interleaved.

Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 tests/all.py   |   1 +
 tests/spec/arb_compute_shader/CMakeLists.gl.txt|   1 +
 tests/spec/arb_compute_shader/render-and-compute.c | 101 +
 3 files changed, 103 insertions(+)
 create mode 100644 tests/spec/arb_compute_shader/render-and-compute.c

diff --git a/tests/all.py b/tests/all.py
index eee86ef..9a5142c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4067,6 +4067,7 @@ with profile.group_manager(
 g(['arb_compute_shader-work_group_size_too_large'],
   grouptools.join('compiler', 'work_group_size_too_large'))
 g(['arb_compute_shader-local-id'], 'local-id' + '-explosion')
+g(['arb_compute_shader-render-and-compute'], 'render-and-compute')
 
 with profile.group_manager(
 PiglitGLTest,
diff --git a/tests/spec/arb_compute_shader/CMakeLists.gl.txt 
b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
index 6655148..c9012a4 100644
--- a/tests/spec/arb_compute_shader/CMakeLists.gl.txt
+++ b/tests/spec/arb_compute_shader/CMakeLists.gl.txt
@@ -16,5 +16,6 @@ piglit_add_executable (arb_compute_shader-minmax minmax.c)
 set(depends cs-ids-common.c common.c)
 
 piglit_add_executable (arb_compute_shader-local-id local-id.c ${depends})
+piglit_add_executable (arb_compute_shader-render-and-compute 
render-and-compute.c ${depends})
 
 # vim: ft=cmake:
diff --git a/tests/spec/arb_compute_shader/render-and-compute.c 
b/tests/spec/arb_compute_shader/render-and-compute.c
new file mode 100644
index 000..d2ad41d
--- /dev/null
+++ b/tests/spec/arb_compute_shader/render-and-compute.c
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014 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
+ *
+ * Test cases in which the ARB_compute_shader API is expected to
+ * generate an error.
+ */
+
+#include "cs-ids-common.h"
+
+static struct piglit_gl_test_config *piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   piglit_config = 
+   config.supports_gl_compat_version = 33;
+   config.supports_gl_core_version = 33;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+const char passthrough_vs_src[] =
+   "#version 330\n"
+   "\n"
+   "in vec4 piglit_vertex;\n"
+   "\n"
+   "void main() {\n"
+   "gl_Position = piglit_vertex;\n"
+   "}\n"
+   ;
+
+
+static const char *green_fs_src =
+   "#version 330\n"
+   "\n"
+   "void main()\n"
+   "{\n"
+   "gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
+   "}\n";
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   enum piglit_result result;
+   GLuint render_program;
+   int i;
+   float green[4] = { 0.0, 1.0, 0.0, 1.0 };
+
+   cs_ids_common_init();
+   cs_ids_set_local_id_test();
+   cs_ids_set_local_size(4, 4, 4);
+   cs_ids_set_global_size(4, 4, 4);
+
+   render_program =
+   piglit_build_simple_program(passthrough_vs_src,
+   green_fs_src);
+   glClearColor(0.0, 0.0, 0.0, 0.0);
+
+   for (i = 0; i < 2; i++) {
+   result = cs_ids_run_test();
+   if (result != PIGLIT_PASS)
+   piglit_report_result(result);
+
+   glUseProgram(render_program);
+   glClear(GL_COLOR_BUFFER_BIT);
+   piglit_draw_rect(-1, -1, 2, 2);
+   result = piglit_probe_rect_rgba(0, 0, piglit_width,
+   piglit_height, green)
+   ? PIGLIT_PASS : PIGLIT_FAIL;
+   }
+
+   cs_ids

[Piglit] [PATCH] arb_shader_storage_buffer_object: Test std430 packing of vec2/vec3 array data

2015-09-15 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Samuel Iglesias Gonsálvez <sigles...@igalia.com>
---
 Passes on NVidia's 340.76 driver & Igalia's SSBO branch for i965

 .../layout-std430-write-shader.c   | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c 
b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
index c25e921..f821f69 100644
--- a/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
+++ b/tests/spec/arb_shader_storage_buffer_object/layout-std430-write-shader.c
@@ -46,7 +46,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-#define SSBO_SIZE 48
+#define SSBO_SIZE 64
 
 static const char vs_pass_thru_text[] =
"#version 130\n"
@@ -65,6 +65,8 @@ static const char vs_pass_thru_text[] =
"   float f;\n"
"   A s;\n"
"   mat3x4 m;\n"
+   "   vec2 v2a[3];\n"
+   "   vec3 v3a[2];\n"
"   float unsized_array[];\n"
"};\n"
"in vec4 piglit_vertex;\n"
@@ -78,6 +80,10 @@ static const char vs_pass_thru_text[] =
"   s.sb[0].b1[0] = 18.0;\n"
"   s.sb[0].b1[1] = 19.0;\n"
"   m[1] = vec4(25.0, 26.0, 27.0, 28.0);\n"
+   "   v2a[0].yx = vec2(34.0, 33.0);\n"
+   "   v2a[1].y = 36.0;\n"
+   "   v3a[0].xz = vec2(39.0, 41.0);\n"
+   "   v3a[1].y = 43.0;\n"
"   int index = int(v.x); // index should be zero\n"
"   unsized_array[index + gl_VertexID] = unsized_array.length();\n"
"}\n";
@@ -99,6 +105,8 @@ static const char fs_source[] =
"   float f;\n"
"   A s;\n"
"   mat3x4 m;\n"
+   "   vec2 v2a[3];\n"
+   "   vec3 v3a[2];\n"
"   float unsized_array[];\n"
"};\n"
"out vec4 color;\n"
@@ -112,6 +120,10 @@ static const char fs_source[] =
"   s.sb[1].b1[2] = 20.0;\n"
"   m[0] = vec4(21.0, 22.0, 23.0, 24.0);\n"
"   m[2] = vec4(29.0, 30.0, 31.0, 32.0);\n"
+   "   v2a[1].x = 35.0;\n"
+   "   v2a[2].xy = vec2(37.0, 38.0);\n"
+   "   v3a[0].y = 40.0;\n"
+   "   v3a[1].xz = vec2(42.0, 44.0);\n"
"   int index = int(v.z + gl_FragCoord.x);\n"
"   unsized_array[index] = unsized_array.length() * 2.0;\n"
"}\n";
@@ -129,6 +141,10 @@ float expected[SSBO_SIZE] = { 0.0,  1.0,  2.0,  3.0, // 
vec4 v
 21.0, 22.0, 23.0, 24.0, // mat3x4 m[0]
 25.0, 26.0, 27.0, 28.0, // mat3x4 m[1]
 29.0, 30.0, 31.0, 32.0, // mat3x4 m[2]
+33.0, 34.0, 35.0, 36.0, // vec2 v2a[3]
+37.0, 38.0,  0.0,  0.0, //
+39.0, 40.0, 41.0,  0.0, // vec3 v3a[2]
+42.0, 43.0, 44.0,  0.0, //
  4.0,  4.0,  8.0,  8.0  // float unsized_array[0]
 };
 
-- 
2.5.0

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


[Piglit] [PATCH] ARB_shader_image_load_store: Test loading from a cleared image

2015-09-04 Thread Jordan Justen
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Francisco Jerez <curroje...@riseup.net>
---
 .../execution/load-from-cleared-image.shader_test  | 77 ++
 1 file changed, 77 insertions(+)
 create mode 100644 
tests/spec/arb_shader_image_load_store/execution/load-from-cleared-image.shader_test

diff --git 
a/tests/spec/arb_shader_image_load_store/execution/load-from-cleared-image.shader_test
 
b/tests/spec/arb_shader_image_load_store/execution/load-from-cleared-image.shader_test
new file mode 100644
index 000..abecfb4
--- /dev/null
+++ 
b/tests/spec/arb_shader_image_load_store/execution/load-from-cleared-image.shader_test
@@ -0,0 +1,77 @@
+# Tests loading from an image just after clearing the image texture
+#
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_shader_image_load_store
+
+[vertex shader]
+#version 130
+in vec4 piglit_vertex;
+
+void main()
+{
+   gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_shader_image_load_store: enable
+
+uniform vec4 color;
+layout(rgba8) readonly uniform image2D src;
+out vec4 outcolor;
+
+void main()
+{
+   ivec2 coord = ivec2(gl_FragCoord);
+   if (imageLoad(src, coord) == color)
+   outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+   else
+   outcolor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Setup src image
+texture rgbw 0 (16, 16) GL_RGBA8
+uniform int src 0
+image texture 0 GL_RGBA8
+
+# Texture 1 is the rendering output
+texture rgbw 1 (16, 16) GL_RGBA8
+
+
+# Clear the src image that we will be loading from
+uniform vec4 color 0.0 0.0 0.0 0.0
+clear color 0.0 0.0 0.0 0.0
+fb tex 2d 0
+clear
+
+# Test using image loads of the cleared texture
+fb tex 2d 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+
+# Clear the src image that we will be loading from
+uniform vec4 color 1.0 0.0 1.0 0.0
+clear color 1.0 0.0 1.0 0.0
+fb tex 2d 0
+clear
+
+# Test using image loads of the cleared texture
+fb tex 2d 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+
+# Clear the src image that we will be loading from
+uniform vec4 color 0.0 1.0 0.0 1.0
+clear color 0.0 1.0 0.0 1.0
+fb tex 2d 0
+clear
+
+# Test using image loads of the cleared texture
+fb tex 2d 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.5.0

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


[Piglit] [PATCH 2/3] arb_compute_shader: Test values of gl_WorkGroupID

2015-08-23 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 .../execution/basic-group-id.shader_test   | 61 ++
 1 file changed, 61 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/execution/basic-group-id.shader_test

diff --git a/tests/spec/arb_compute_shader/execution/basic-group-id.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-group-id.shader_test
new file mode 100644
index 000..d6422f5
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/basic-group-id.shader_test
@@ -0,0 +1,61 @@
+# Simple test that verifies gl_WorkGroupID values are
+# functioning. Atomic counters are used as outputs.
+
+[require]
+GL = 3.3
+GLSL = 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 0) uniform atomic_uint a0;
+layout(binding = 0) uniform atomic_uint a1;
+layout(binding = 0) uniform atomic_uint a2;
+layout(binding = 0) uniform atomic_uint a3;
+layout(binding = 0) uniform atomic_uint a4;
+layout(binding = 0) uniform atomic_uint a5;
+layout(binding = 0) uniform atomic_uint a6;
+layout(binding = 0) uniform atomic_uint a7;
+
+layout(local_size_x = 1) in;
+
+void main()
+{
+uint x = gl_WorkGroupID.x;
+uint y = gl_WorkGroupID.y;
+uint z = gl_WorkGroupID.z;
+
+if (((x  y)  z) == 0u)
+atomicCounterIncrement(a0);
+if (((x | y) | z) == 7u)
+atomicCounterIncrement(a1);
+if (x == y  y == z)
+atomicCounterIncrement(a2);
+if (x != y  y != z  x != z)
+atomicCounterIncrement(a3);
+if (((x  y)  z) == 2u)
+atomicCounterIncrement(a4);
+if (((x | y) | z) == 5u)
+atomicCounterIncrement(a5);
+if (x  4u  y  4u  z  4u)
+atomicCounterIncrement(a6);
+if (x = 4u || y = 4u || z = 4u)
+atomicCounterIncrement(a7);
+}
+
+[test]
+atomic counters 8
+
+compute 8 8 8
+probe atomic counter 0 == 343
+probe atomic counter 1 == 343
+probe atomic counter 2 == 8
+probe atomic counter 3 == 336
+probe atomic counter 4 == 49
+probe atomic counter 5 == 49
+probe atomic counter 6 == 64
+probe atomic counter 7 == 448
-- 
2.1.4

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


[Piglit] [PATCH 3/3] arb_compute_shader: Test values of gl_LocalInvocationIndex

2015-08-23 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 .../execution/basic-local-index.shader_test| 61 ++
 1 file changed, 61 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/execution/basic-local-index.shader_test

diff --git 
a/tests/spec/arb_compute_shader/execution/basic-local-index.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-local-index.shader_test
new file mode 100644
index 000..6bb9ce9
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/basic-local-index.shader_test
@@ -0,0 +1,61 @@
+# Simple test that verifies gl_LocalInvocationID values are
+# functioning. Atomic counters are used as outputs.
+
+[require]
+GL = 3.3
+GLSL = 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 0) uniform atomic_uint a0;
+layout(binding = 0) uniform atomic_uint a1;
+layout(binding = 0) uniform atomic_uint a2;
+layout(binding = 0) uniform atomic_uint a3;
+layout(binding = 0) uniform atomic_uint a4;
+layout(binding = 0) uniform atomic_uint a5;
+layout(binding = 0) uniform atomic_uint a6;
+layout(binding = 0) uniform atomic_uint a7;
+
+layout(local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
+
+void main()
+{
+uint x = gl_LocalInvocationIndex  0x7u;
+uint y = (gl_LocalInvocationIndex  3u)  0x7u;
+uint z = (gl_LocalInvocationIndex  6u)  0x7u;
+
+if (((x  y)  z) == 0u)
+atomicCounterIncrement(a0);
+if (((x | y) | z) == 7u)
+atomicCounterIncrement(a1);
+if (x == y  y == z)
+atomicCounterIncrement(a2);
+if (x != y  y != z  x != z)
+atomicCounterIncrement(a3);
+if (((x  y)  z) == 2u)
+atomicCounterIncrement(a4);
+if (((x | y) | z) == 5u)
+atomicCounterIncrement(a5);
+if (x  4u  y  4u  z  4u)
+atomicCounterIncrement(a6);
+if (x = 4u || y = 4u || z = 4u)
+atomicCounterIncrement(a7);
+}
+
+[test]
+atomic counters 8
+
+compute 1 1 1
+probe atomic counter 0 == 343
+probe atomic counter 1 == 343
+probe atomic counter 2 == 8
+probe atomic counter 3 == 336
+probe atomic counter 4 == 49
+probe atomic counter 5 == 49
+probe atomic counter 6 == 64
+probe atomic counter 7 == 448
-- 
2.1.4

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


[Piglit] [PATCH 1/3] arb_compute_shader: Test values of gl_GlobalInvocationID

2015-08-23 Thread Jordan Justen
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 .../execution/basic-global-id.shader_test  | 61 ++
 1 file changed, 61 insertions(+)
 create mode 100644 
tests/spec/arb_compute_shader/execution/basic-global-id.shader_test

diff --git 
a/tests/spec/arb_compute_shader/execution/basic-global-id.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-global-id.shader_test
new file mode 100644
index 000..98a10dd
--- /dev/null
+++ b/tests/spec/arb_compute_shader/execution/basic-global-id.shader_test
@@ -0,0 +1,61 @@
+# Simple test that verifies gl_GlobalInvocationID values are
+# functioning. Atomic counters are used as outputs.
+
+[require]
+GL = 3.3
+GLSL = 3.30
+GL_ARB_compute_shader
+GL_ARB_shader_atomic_counters
+
+[compute shader]
+#version 330
+#extension GL_ARB_compute_shader: enable
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 0) uniform atomic_uint a0;
+layout(binding = 0) uniform atomic_uint a1;
+layout(binding = 0) uniform atomic_uint a2;
+layout(binding = 0) uniform atomic_uint a3;
+layout(binding = 0) uniform atomic_uint a4;
+layout(binding = 0) uniform atomic_uint a5;
+layout(binding = 0) uniform atomic_uint a6;
+layout(binding = 0) uniform atomic_uint a7;
+
+layout(local_size_x = 4, local_size_y = 2, local_size_z = 4) in;
+
+void main()
+{
+uint x = gl_GlobalInvocationID.x;
+uint y = gl_GlobalInvocationID.y;
+uint z = gl_GlobalInvocationID.z;
+
+if (((x  y)  z) == 0u)
+atomicCounterIncrement(a0);
+if (((x | y) | z) == 7u)
+atomicCounterIncrement(a1);
+if (x == y  y == z)
+atomicCounterIncrement(a2);
+if (x != y  y != z  x != z)
+atomicCounterIncrement(a3);
+if (((x  y)  z) == 2u)
+atomicCounterIncrement(a4);
+if (((x | y) | z) == 5u)
+atomicCounterIncrement(a5);
+if (x  4u  y  4u  z  4u)
+atomicCounterIncrement(a6);
+if (x = 4u || y = 4u || z = 4u)
+atomicCounterIncrement(a7);
+}
+
+[test]
+atomic counters 8
+
+compute 2 4 2
+probe atomic counter 0 == 343
+probe atomic counter 1 == 343
+probe atomic counter 2 == 8
+probe atomic counter 3 == 336
+probe atomic counter 4 == 49
+probe atomic counter 5 == 49
+probe atomic counter 6 == 64
+probe atomic counter 7 == 448
-- 
2.1.4

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


[Piglit] [PATCH] xz: Use --help when detecting xz presence

2015-08-02 Thread Jordan Justen
If xz is present, and the piglit command's output is redirected, then
xz will think its output is redirected. This will cause xz to try to
read data from stdin to compress.

Instead we can run xz with --help to cause it to print help
information if the xz executable is present, and prevent xz from
trying to compress data from stdin.

Since we don't want to see 'xz --help' output from piglit, we now need
to redirect both stdout and stderr to /dev/null.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Cc: Dylan Baker baker.dyla...@gmail.com
---
 framework/backends/compression.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/backends/compression.py 
b/framework/backends/compression.py
index 88bde2a..97b0f32 100644
--- a/framework/backends/compression.py
+++ b/framework/backends/compression.py
@@ -95,7 +95,7 @@ try:
 except ImportError:
 try:
 with open(os.devnull, 'w') as d:
-subprocess.check_call(['xz'], stderr=d)
+subprocess.check_call(['xz', '--help'], stdout=d, 
stderr=subprocess.STDOUT)
 except subprocess.CalledProcessError as e:
 if e.returncode == 1:
 import contextlib
-- 
2.1.4

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


Re: [Piglit] [PATCH] xz: Use --help when detecting xz presence

2015-08-02 Thread Jordan Justen
On 2015-08-02 09:57:00, Dylan Baker wrote:
On Aug 2, 2015 00:45, Jordan Justen jordan.l.jus...@intel.com wrote:

 If xz is present, and the piglit command's output is redirected, then
 xz will think its output is redirected. This will cause xz to try to
 read data from stdin to compress.

 Instead we can run xz with --help to cause it to print help
 information if the xz executable is present, and prevent xz from
 trying to compress data from stdin.

 Since we don't want to see 'xz --help' output from piglit, we now need
 to redirect both stdout and stderr to /dev/null.

 Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
 Cc: Dylan Baker baker.dyla...@gmail.com
 ---
  framework/backends/compression.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/framework/backends/compression.py
b/framework/backends/compression.py
 index 88bde2a..97b0f32 100644
 --- a/framework/backends/compression.py
 +++ b/framework/backends/compression.py
 @@ -95,7 +95,7 @@ try:
  except ImportError:
  try:
  with open(os.devnull, 'w') as d:
 -subprocess.check_call(['xz'], stderr=d)
 +subprocess.check_call(['xz', '--help'], stdout=d,
stderr=subprocess.STDOUT)
 
Based on you're commit message I don't think this sides what you want. I
think you should set stderr=d to hide both stderr and stdout.

stderr=subprocess.STDOUT should send stderr to the same file as
stdout, and stdout is sent to /dev/null.

-Jordan

 
  except subprocess.CalledProcessError as e:
  if e.returncode == 1:
  import contextlib
 --
 2.1.4

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


[Piglit] Redirect summary console output

2015-08-01 Thread Jordan Justen
Dylan,

I often send piglit summary console output to less or grep, but lately
it doesn't seem to work.

For example, if I try to send it to cat, I have to press Ctrl-C, and
then I see this output:

$ ./piglit summary console results/t | cat
^CTraceback (most recent call last):
  File ./piglit, line 107, in module
import framework.programs.run as run
  File /home/jljusten/src/fdo/piglit/framework/programs/run.py, line 32, in 
module
from framework import core, backends, exceptions
  File /home/jljusten/src/fdo/piglit/framework/backends/__init__.py, line 48, 
in module
from .compression import COMPRESSION_SUFFIXES
  File /home/jljusten/src/fdo/piglit/framework/backends/compression.py, line 
98, in module
subprocess.check_call(['xz'], stderr=d)
  File /usr/lib/python2.7/subprocess.py, line 535, in check_call
retcode = call(*popenargs, **kwargs)
  File /usr/lib/python2.7/subprocess.py, line 522, in call
return Popen(*popenargs, **kwargs).wait()
  File /usr/lib/python2.7/subprocess.py, line 1384, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File /usr/lib/python2.7/subprocess.py, line 476, in _eintr_retry_call
return func(*args)
KeyboardInterrupt

I guess it is related to xz support somehow...

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


Re: [Piglit] [PATCH 1/2] arb_shader_image_load_store/host-mem-barrier: Skip UBO/RaW test if the required UBO size is unsupported.

2015-07-24 Thread Jordan Justen
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On 2015-07-24 11:01:46, Francisco Jerez wrote:
 This test assumes it can bind a UBO of size larger than the minimum
 maximum guaranteed by the GL standard, what recently started causing
 failures unrelated to ARB_shader_image_load_store since Mesa became
 more strict about shaders declaring UBOs of unsupported size
 (f734d2556013e9239e91f43b563b5b1d8f03ada4).  Skip it if the
 implementation doesn't support the size we want.
 ---
  tests/spec/arb_shader_image_load_store/host-mem-barrier.c | 11 ++-
  1 file changed, 10 insertions(+), 1 deletion(-)
 
 diff --git a/tests/spec/arb_shader_image_load_store/host-mem-barrier.c 
 b/tests/spec/arb_shader_image_load_store/host-mem-barrier.c
 index 9727ddc..833d7ec 100644
 --- a/tests/spec/arb_shader_image_load_store/host-mem-barrier.c
 +++ b/tests/spec/arb_shader_image_load_store/host-mem-barrier.c
 @@ -250,6 +250,14 @@ run_test_element_array_raw(const struct 
 image_barrier_info *bar, unsigned l)
  }
  
  static bool
 +can_test_ubo_raw(void)
 +{
 +   int size = 0;
 +   glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, size);
 +   return size = 16 * N;
 +}
 +
 +static bool
  run_test_ubo_raw(const struct image_barrier_info *bar, unsigned l)
  {
  const struct grid_info grid =
 @@ -995,7 +1003,8 @@ piglit_init(int argc, char **argv)
  barrier_subtest(status, true, 
 run_test_element_array_raw,
  Element array/RaW, bar, l);
  
 -barrier_subtest(status, true, run_test_ubo_raw,
 +barrier_subtest(status, can_test_ubo_raw(),
 +run_test_ubo_raw,
  Uniform buffer/RaW, bar, l);
  
  barrier_subtest(status, true, 
 run_test_tex_fetch_raw,
 -- 
 2.4.3
 
 ___
 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 2/2] arb_shader_image_load_store/invalid: Skip the index bounds test on Intel Ivybridge hardware.

2015-07-24 Thread Jordan Justen
On 2015-07-24 12:49:05, Francisco Jerez wrote:
 Jordan Justen jordan.l.jus...@intel.com writes:
  I don't know of any other cases where we skip a test based on the
  render name. I don't think this is a good practice to start.
 
 What do you think we should do in that case?

* Let the driver hang when the test is run

* See if we can make the driver crash rather than hang the GPU

* See if we can make the driver neither crash nor hang the GPU

* Let the piglit community reach consensus that a driver quirks system
  is reasonable (and thus, go ahead and skip the test on ivb...)

  On 2015-07-24 11:01:47, Francisco Jerez wrote:
  This test is known to cause a GPU hang on IVB due to a hardware bug.
  The reason is that the hardware seems to be unable to cope with
  binding table indices mapping to an invalid surface, which is
  sometimes the case when a shader accesses an array of images out of
  bounds.
  
  According to the ARB_shader_image_load_store spec if the index used
  to select an individual element [of an array of images] is negative or
  greater than or equal to the size of the array, the results of the
  operation are undefined but may not lead to termination. -- Which is

Hmm. Maybe we shouldn't test the scenario where the results (according
to the spec) are undefined?

-Jordan

  precisely one of the typical outcomes of the GPU hang caused by this
  test.
  
  In theory this could be fixed by implementing array bounds checking in
  software, but it doesn't seem worth doing because on the one hand it
  would punish well-behaved applications unnecessarily, and on the other
  hand there doesn't seem to be any reasonable use-case for the
  behaviour required by the spec [the implementation may set the
  computer on fire as long as it somehow manages not to terminate the
  program ;)].
  
  If the breakage caused by this test case was confined to a single
  process I would probably consider to leave it alone, however I've
  noticed that in some cases the hang will cause other unrelated piglit
  tests that happen to be run in parallel to fail, causing some random
  noise in the results we get from our piglit system, what makes them
  rather difficult to interpret.
  ---
   tests/spec/arb_shader_image_load_store/invalid.c | 13 -
   1 file changed, 12 insertions(+), 1 deletion(-)
  
  diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
  b/tests/spec/arb_shader_image_load_store/invalid.c
  index a0981e4..52b3275 100644
  --- a/tests/spec/arb_shader_image_load_store/invalid.c
  +++ b/tests/spec/arb_shader_image_load_store/invalid.c
  @@ -292,6 +292,17 @@ invalidate_address_bounds(const struct image_info 
  img, GLuint prog)
   }
   
   static bool
  +can_test_index_bounds(void)
  +{
  +   /* This test is known to cause a GPU hang on Intel Ivybridge
  +* hardware due to a hardware bug.  Don't annoy users
  +* unnecessarily.
  +*/
  +   return !strstr((const char *)glGetString(GL_RENDERER),
  +  Intel(R) Ivybridge);
  +}
  +
  +static bool
   invalidate_index_bounds(const struct image_info img, GLuint prog)
   {
   return set_uniform_int(prog, u, 0xdeadcafe);
  @@ -444,7 +455,7 @@ piglit_init(int argc, char **argv)
*  element is negative or greater than or equal to
*  the size of the array [...]
*/
  -subtest(status, true,
  +subtest(status, can_test_index_bounds(),
   run_test(op, def_img, def_img,
invalidate_index_bounds, true),
   %s/index bounds test, op-name);
  -- 
  2.4.3
  
  ___
  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 2/2] arb_shader_image_load_store/invalid: Skip the index bounds test on Intel Ivybridge hardware.

2015-07-24 Thread Jordan Justen
I don't know of any other cases where we skip a test based on the
render name. I don't think this is a good practice to start.

-Jordan

On 2015-07-24 11:01:47, Francisco Jerez wrote:
 This test is known to cause a GPU hang on IVB due to a hardware bug.
 The reason is that the hardware seems to be unable to cope with
 binding table indices mapping to an invalid surface, which is
 sometimes the case when a shader accesses an array of images out of
 bounds.
 
 According to the ARB_shader_image_load_store spec if the index used
 to select an individual element [of an array of images] is negative or
 greater than or equal to the size of the array, the results of the
 operation are undefined but may not lead to termination. -- Which is
 precisely one of the typical outcomes of the GPU hang caused by this
 test.
 
 In theory this could be fixed by implementing array bounds checking in
 software, but it doesn't seem worth doing because on the one hand it
 would punish well-behaved applications unnecessarily, and on the other
 hand there doesn't seem to be any reasonable use-case for the
 behaviour required by the spec [the implementation may set the
 computer on fire as long as it somehow manages not to terminate the
 program ;)].
 
 If the breakage caused by this test case was confined to a single
 process I would probably consider to leave it alone, however I've
 noticed that in some cases the hang will cause other unrelated piglit
 tests that happen to be run in parallel to fail, causing some random
 noise in the results we get from our piglit system, what makes them
 rather difficult to interpret.
 ---
  tests/spec/arb_shader_image_load_store/invalid.c | 13 -
  1 file changed, 12 insertions(+), 1 deletion(-)
 
 diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
 b/tests/spec/arb_shader_image_load_store/invalid.c
 index a0981e4..52b3275 100644
 --- a/tests/spec/arb_shader_image_load_store/invalid.c
 +++ b/tests/spec/arb_shader_image_load_store/invalid.c
 @@ -292,6 +292,17 @@ invalidate_address_bounds(const struct image_info img, 
 GLuint prog)
  }
  
  static bool
 +can_test_index_bounds(void)
 +{
 +   /* This test is known to cause a GPU hang on Intel Ivybridge
 +* hardware due to a hardware bug.  Don't annoy users
 +* unnecessarily.
 +*/
 +   return !strstr((const char *)glGetString(GL_RENDERER),
 +  Intel(R) Ivybridge);
 +}
 +
 +static bool
  invalidate_index_bounds(const struct image_info img, GLuint prog)
  {
  return set_uniform_int(prog, u, 0xdeadcafe);
 @@ -444,7 +455,7 @@ piglit_init(int argc, char **argv)
   *  element is negative or greater than or equal to
   *  the size of the array [...]
   */
 -subtest(status, true,
 +subtest(status, can_test_index_bounds(),
  run_test(op, def_img, def_img,
   invalidate_index_bounds, true),
  %s/index bounds test, op-name);
 -- 
 2.4.3
 
 ___
 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] arb_shader_storage_buffer_object/maxblocks: fail test if glGetIntegerv() gives an error

2015-07-10 Thread Jordan Justen
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On 2015-07-10 00:12:04, Samuel Iglesias Gonsalvez wrote:
 Signed-off-by: Samuel Iglesias Gonsalvez sigles...@igalia.com
 ---
  tests/spec/arb_shader_storage_buffer_object/maxblocks.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/tests/spec/arb_shader_storage_buffer_object/maxblocks.c 
 b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
 index 74c95fe..d87b58c 100644
 --- a/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
 +++ b/tests/spec/arb_shader_storage_buffer_object/maxblocks.c
 @@ -284,6 +284,9 @@ piglit_display(void)
 glGetIntegerv(GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS, max_combined);
 glGetIntegerv(GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES, 
 max_combined_out);
  
 +   if (!piglit_check_gl_error(GL_NO_ERROR))
 + return PIGLIT_FAIL;
 +
 printf(Max VS shader storage blocks: %d\n, max_vs);
 printf(Max FS shader storage blocks: %d\n, max_fs);
 printf(Max combined shader storage blocks: %d\n, max_combined);
 -- 
 2.1.4
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] shader_runner: Check return value on sscanf (clip plane / draw arrays)

2015-06-17 Thread Jordan Justen
sscanf returns EOF if not all values are scanned. This can be
interpreted as 'true' in these cases leading to the clip plane command
being incorrectly requested.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 tests/shaders/shader_runner.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 38a0fcf..7e5b7b4 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2339,7 +2339,7 @@ piglit_display(void)
glClear(clear_bits);
} else if (sscanf(line,
  clip plane %d %lf %lf %lf %lf,
- x, d[0], d[1], d[2], d[3])) {
+ x, d[0], d[1], d[2], d[3]) == 5) {
if (x  0 || x = gl_max_clip_planes) {
printf(clip plane id %d out of range\n, x);
piglit_report_result(PIGLIT_FAIL);
@@ -2381,7 +2381,7 @@ piglit_display(void)
   primcount,
   c + 0, c + 1, c + 2, c + 3);
draw_instanced_rect(primcount, c[0], c[1], c[2], c[3]);
-   } else if (sscanf(line, draw arrays %31s %d %d, s, x, y)) {
+   } else if (sscanf(line, draw arrays %31s %d %d, s, x, y) == 
3) {
GLenum mode = decode_drawing_mode(s);
int first = x;
size_t count = (size_t) y;
-- 
2.1.4

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


Re: [Piglit] [PATCH v2 1/4] shader_runner: Use strndup to get a null-terminated string for 'line'

2015-06-17 Thread Jordan Justen
On 2015-06-16 04:07:35, Francisco Jerez wrote:
 Jordan Justen jordan.l.jus...@intel.com writes:
 
  In order to use sscanf with optional parameters, the string needs to
  be null terminated. Otherwise, sscanf will treat the newline as
  whitespace and continue to look for matches on the following lines.
 
  v2:
   * Call strndup before skipping newline char in next_line
 
  Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
  ---
   tests/shaders/shader_runner.c | 25 +
   1 file changed, 17 insertions(+), 8 deletions(-)
 
  diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
  index 1827e08..41024cd 100644
  --- a/tests/shaders/shader_runner.c
  +++ b/tests/shaders/shader_runner.c
  @@ -2294,7 +2294,7 @@ probe_atomic_counter(GLint counter_num, const char 
  *op, uint32_t value)
   enum piglit_result
   piglit_display(void)
   {
  - const char *line;
  + const char *line, *next_line;
bool pass = true;
GLbitfield clear_bits = 0;
bool link_error_expected = false;
  @@ -2303,16 +2303,27 @@ piglit_display(void)
if (test_start == NULL)
return PIGLIT_PASS;
   
  - line = test_start;
  - while (line[0] != '\0') {
  + next_line = test_start;
  + while (next_line[0] != '\0') {
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
char s[32];
   
  - line = eat_whitespace(line);
   
  - if (sscanf(line, atomic counters %d, x) == 1) {
  + line = eat_whitespace(next_line);
  +
  + next_line = strchrnul(next_line, '\n');
  +
  + /* Duplicate the line to make it null terminated */
  + line = strndup(line, next_line - line);
  +
  + /* If strchrnul found a newline, then skip it */
  + if (next_line[0] != '\0')
  + next_line++;
  +
  + if (line[0] == '\0') {
 
 Hmm.  Isn't this already handled in the last block of the else-if chain?

True, it should skip all portions of the if-else block (including the
last), except sscanf was being incorrectly used by two commands,
meaning another command was being hit. I'll reply to this email with a
new patch to fix that issue, but I still think we should add the null
string check up top to be safer.

-Jordan

  + } else if (sscanf(line, atomic counters %d, x) == 1) {
GLuint *atomics_buf = calloc(x, sizeof(GLuint));
glGenBuffers(1, atomics_bo);
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, 
  atomics_bo);
  @@ -2701,9 +2712,7 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
   
  - line = strchrnul(line, '\n');
  - if (line[0] != '\0')
  - line++;
  + free((void*) line);
}
   
if (!link_ok  !link_error_expected) {
  -- 
  2.1.4
 
  ___
  Piglit mailing list
  Piglit@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH v2 3/4] arb_compute_shader: Use GL_RGBA8 for image_load_store internal format

2015-06-12 Thread Jordan Justen
The motivation for this is that (as noted by curro)
ARB_shader_image_load_store doesn't support images with an internal
format of GL_RGBA.

See 'Table X.2' in
https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt

Therefore, in order to use image load/store in shader runner tests, we
must override the default internal format when creating the image.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Francisco Jerez curroje...@riseup.net
---
 generated_tests/gen_builtin_uniform_tests.py| 2 +-
 .../arb_compute_shader/execution/basic-uniform-access.shader_test   | 2 +-
 .../execution/multiple-texture-reading.shader_test  | 6 +++---
 .../arb_compute_shader/execution/multiple-workgroups.shader_test| 2 +-
 tests/spec/arb_compute_shader/execution/simple-barrier.shader_test  | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/generated_tests/gen_builtin_uniform_tests.py 
b/generated_tests/gen_builtin_uniform_tests.py
index b0c2e7b..c88add5 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -705,7 +705,7 @@ class ComputeShaderTest(ShaderTest):
 
 def make_test_init(self):
 return '''uniform int tex 0
-texture rgbw 0 ({0}, 1)
+texture rgbw 0 ({0}, 1) GL_RGBA8
 image texture 0
 fb tex 2d 0
 '''.format(len(self._test_vectors))
diff --git 
a/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
index 26b9220..ad6f82d 100644
--- a/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
+++ b/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
@@ -24,7 +24,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
diff --git 
a/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test 
b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
index c1c06d4..b13f4df 100644
--- 
a/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
+++ 
b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
@@ -33,7 +33,7 @@ void main()
 
 [test]
 # Setup src0 image
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 uniform int src0 0
 image texture 0
 fb tex 2d 0
@@ -41,7 +41,7 @@ clear color 1.0 0.0 1.0 0.0
 clear
 
 # Setup src1 image
-texture rgbw 1 (16, 16)
+texture rgbw 1 (16, 16) GL_RGBA8
 uniform int src1 1
 image texture 1
 fb tex 2d 1
@@ -49,7 +49,7 @@ clear color 0.0 1.0 0.0 1.0
 clear
 
 # Setup dst image
-texture rgbw 2 (16, 16)
+texture rgbw 2 (16, 16) GL_RGBA8
 uniform int dst 2
 image texture 2
 fb tex 2d 2
diff --git 
a/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test 
b/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
index 82d3e9f..eeb3233 100644
--- a/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
+++ b/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
@@ -24,7 +24,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
diff --git a/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test 
b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
index 665b381..3f09c34 100644
--- a/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
+++ b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
@@ -48,7 +48,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
-- 
2.1.4

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


[Piglit] [PATCH v2 1/4] shader_runner: Use strndup to get a null-terminated string for 'line'

2015-06-12 Thread Jordan Justen
In order to use sscanf with optional parameters, the string needs to
be null terminated. Otherwise, sscanf will treat the newline as
whitespace and continue to look for matches on the following lines.

v2:
 * Call strndup before skipping newline char in next_line

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 tests/shaders/shader_runner.c | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 1827e08..41024cd 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2294,7 +2294,7 @@ probe_atomic_counter(GLint counter_num, const char *op, 
uint32_t value)
 enum piglit_result
 piglit_display(void)
 {
-   const char *line;
+   const char *line, *next_line;
bool pass = true;
GLbitfield clear_bits = 0;
bool link_error_expected = false;
@@ -2303,16 +2303,27 @@ piglit_display(void)
if (test_start == NULL)
return PIGLIT_PASS;
 
-   line = test_start;
-   while (line[0] != '\0') {
+   next_line = test_start;
+   while (next_line[0] != '\0') {
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
char s[32];
 
-   line = eat_whitespace(line);
 
-   if (sscanf(line, atomic counters %d, x) == 1) {
+   line = eat_whitespace(next_line);
+
+   next_line = strchrnul(next_line, '\n');
+
+   /* Duplicate the line to make it null terminated */
+   line = strndup(line, next_line - line);
+
+   /* If strchrnul found a newline, then skip it */
+   if (next_line[0] != '\0')
+   next_line++;
+
+   if (line[0] == '\0') {
+   } else if (sscanf(line, atomic counters %d, x) == 1) {
GLuint *atomics_buf = calloc(x, sizeof(GLuint));
glGenBuffers(1, atomics_bo);
glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, 
atomics_bo);
@@ -2701,9 +2712,7 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   line = strchrnul(line, '\n');
-   if (line[0] != '\0')
-   line++;
+   free((void*) line);
}
 
if (!link_ok  !link_error_expected) {
-- 
2.1.4

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


[Piglit] [PATCH v2 4/4] arb_shader_image_load_store: Use GL_RGBA8 for image internal format

2015-06-12 Thread Jordan Justen
The motivation for this is that (as noted by curro)
ARB_shader_image_load_store doesn't support images with an internal
format of GL_RGBA.

See 'Table X.2' in
https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt

Therefore, in order to use image load/store in shader runner tests, we
must override the default internal format when creating the image.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 .../execution/basic-imageStore-from-uniform.shader_test   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/tests/spec/arb_shader_image_load_store/execution/basic-imageStore-from-uniform.shader_test
 
b/tests/spec/arb_shader_image_load_store/execution/basic-imageStore-from-uniform.shader_test
index 802eda0..500fdb1 100644
--- 
a/tests/spec/arb_shader_image_load_store/execution/basic-imageStore-from-uniform.shader_test
+++ 
b/tests/spec/arb_shader_image_load_store/execution/basic-imageStore-from-uniform.shader_test
@@ -31,11 +31,11 @@ void main()
 [test]
 # Texture 0 is the imageStore output.
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 
 # Texture 1 is the rendering output. We don't care about this.
-texture rgbw 1 (16, 16)
+texture rgbw 1 (16, 16) GL_RGBA8
 
 # Store red using imageStore
 uniform vec4 color 1.0 0.0 0.0 1.0
-- 
2.1.4

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


[Piglit] [PATCH v2 2/4] shader_runner: Support optional internal format for 'texture rgbw'

2015-06-12 Thread Jordan Justen
The motivation for this is that (as noted by curro)
ARB_shader_image_load_store doesn't support images with an internal
format of GL_RGBA.

See 'Table X.2' in
https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt

Therefore, in order to use image load/store in shader runner tests, we
must override the default internal format when creating the image.

We retain the default internal format of GL_RGBA when the optional
parameter is not given.

Now an internal format can optionally be added as a new parameter when
creating the image. For example:

  texture rgbw 0 (16, 16) GL_RGBA8

v2:
 * Drop 'base type' parameter

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 tests/shaders/shader_runner.c | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 41024cd..74cc9d9 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2572,11 +2572,23 @@ piglit_display(void)
glShadeModel(GL_SMOOTH);
} else if (string_match(shade model flat, line)) {
glShadeModel(GL_FLAT);
-   } else if (sscanf(line,
- texture rgbw %d ( %d , %d ),
- tex, w, h) == 3) {
+   } else if (string_match(texture rgbw , line)) {
+   int num_scanned;
+   GLenum int_fmt = GL_RGBA;
+   num_scanned = sscanf(line, texture rgbw %d ( %d , %d ) 
%31s,
+tex, w, h, s);
+   if (num_scanned  3) {
+   printf(invalid texture rgbw command!\n);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (num_scanned = 4) {
+   int_fmt = piglit_get_gl_enum_from_name(s);
+   }
+
glActiveTexture(GL_TEXTURE0 + tex);
-   piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, GL_FALSE, 
GL_UNSIGNED_NORMALIZED);
+   piglit_rgbw_texture(int_fmt, w, h, GL_FALSE, GL_FALSE,
+   GL_UNSIGNED_NORMALIZED);
if (!piglit_is_core_profile)
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line, texture miptree %d, tex) == 1) {
-- 
2.1.4

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


Re: [Piglit] [PATCH 00/13] Add more arb_shader_storage_buffer_object tests

2015-06-05 Thread Jordan Justen
 100644 
 tests/spec/arb_shader_storage_buffer_object/linker/shader-storage-block-different-size.shader_test
  create mode 100644 tests/spec/arb_shader_storage_buffer_object/maxblocks.c
  create mode 100644 
 tests/spec/arb_shader_storage_buffer_object/maxshaderstorageblocksize.c

seems a bit run-on name wise. max-ssbo-size.c?

  create mode 100644 
 tests/spec/arb_shader_storage_buffer_object/preprocessor/define.frag
  create mode 100644 
 tests/spec/arb_shader_storage_buffer_object/preprocessor/define.vert
  create mode 100644 
 tests/spec/arb_shader_storage_buffer_object/program-interface-query.c
  create mode 100644 tests/spec/arb_shader_storage_buffer_object/rendering.c
  create mode 100644 
 tests/spec/arb_shader_storage_buffer_object/shaderstorageblockbinding.c

similar?

These patches seemed to have survived past the 2-weeks with no naks
rule. Thus, you could just push them if you feel pretty good about
them.

Did you test these on a driver that already implements ssbos? (Other
than your mesa work. :)

If so,
Acked-by: Jordan Justen jordan.l.jus...@intel.com
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/3] shader_runner: Support optional format paramters for 'texture rgbw'

2015-05-26 Thread Jordan Justen
On 2015-05-26 05:12:08, Francisco Jerez wrote:
 Jordan Justen jordan.l.jus...@intel.com writes:
 
  The motivation for this is that (as noted by curro)
  ARB_shader_image_load_store doesn't support images with an internal
  format of GL_RGBA.
 
  See 'Table X.2' in
  https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt
 
  Therefore, in order to use image load/store in shader runner tests, we
  must override the default internal format when creating the image.
 
  We retain the default internal format of GL_RGBA and base type of
  GL_UNSIGNED_NORMALIZED for the image creation.
 
  Now an internal format can optionally be added as a new parameter when
  creating the image. For example:
 
texture rgbw 0 (16, 16) GL_RGBA8
 
  Additionally, an optional fifth paramter can be added. This will
  specify the base type for the image. For example:
 
texture rgbw 0 (16, 16) GL_RGBA8 GL_UNSIGNED_NORMALIZED
 
 What exactly does the fifth parameter do?  Does it make sense to change
 the base type independently of the internal format or couldn't
 shader_runner infer one from the other?

It is the other configurable 'format' parameter to
piglit_rgbw_texture. I added it because it was easy, but I don't think
we really need it. I'll update the patch to only add the internal
format param.

-Jordan

  Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
  Cc: Francisco Jerez curroje...@riseup.net
  ---
   tests/shaders/shader_runner.c | 26 +-
   1 file changed, 21 insertions(+), 5 deletions(-)
 
  diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
  index 2df9e78..fe59b1d 100644
  --- a/tests/shaders/shader_runner.c
  +++ b/tests/shaders/shader_runner.c
  @@ -2308,7 +2308,7 @@ piglit_display(void)
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
  - char s[32];
  + char s[32], s2[32];
   
   
line = eat_whitespace(next_line);
  @@ -2570,11 +2570,27 @@ piglit_display(void)
glShadeModel(GL_SMOOTH);
} else if (string_match(shade model flat, line)) {
glShadeModel(GL_FLAT);
  - } else if (sscanf(line,
  -   texture rgbw %d ( %d , %d ),
  -   tex, w, h) == 3) {
  + } else if (string_match(texture rgbw , line)) {
  + int num_scanned;
  + GLenum int_fmt = GL_RGBA, base_type = 
  GL_UNSIGNED_NORMALIZED;
  + num_scanned = sscanf(line, texture rgbw %d ( %d , %d 
  ) %31s %31s,
  +  tex, w, h, s, s2);
  + if (num_scanned  3) {
  + printf(invalid texture rgbw command!\n);
  + piglit_report_result(PIGLIT_FAIL);
  + }
  +
  + if (num_scanned = 5) {
  + base_type = piglit_get_gl_enum_from_name(s2);
  + }
  +
  + if (num_scanned = 4) {
  + int_fmt = piglit_get_gl_enum_from_name(s);
  + }
  +
glActiveTexture(GL_TEXTURE0 + tex);
  - piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, 
  GL_FALSE, GL_UNSIGNED_NORMALIZED);
  + piglit_rgbw_texture(int_fmt, w, h, GL_FALSE, GL_FALSE,
  + base_type);
if (!piglit_is_core_profile)
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line, texture miptree %d, tex) == 1) {
  -- 
  2.1.4
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] shader_runner: Support optional format paramters for 'texture rgbw'

2015-05-25 Thread Jordan Justen
The motivation for this is that (as noted by curro)
ARB_shader_image_load_store doesn't support images with an internal
format of GL_RGBA.

See 'Table X.2' in
https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt

Therefore, in order to use image load/store in shader runner tests, we
must override the default internal format when creating the image.

We retain the default internal format of GL_RGBA and base type of
GL_UNSIGNED_NORMALIZED for the image creation.

Now an internal format can optionally be added as a new parameter when
creating the image. For example:

  texture rgbw 0 (16, 16) GL_RGBA8

Additionally, an optional fifth paramter can be added. This will
specify the base type for the image. For example:

  texture rgbw 0 (16, 16) GL_RGBA8 GL_UNSIGNED_NORMALIZED

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 tests/shaders/shader_runner.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 2df9e78..fe59b1d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2308,7 +2308,7 @@ piglit_display(void)
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
-   char s[32];
+   char s[32], s2[32];
 
 
line = eat_whitespace(next_line);
@@ -2570,11 +2570,27 @@ piglit_display(void)
glShadeModel(GL_SMOOTH);
} else if (string_match(shade model flat, line)) {
glShadeModel(GL_FLAT);
-   } else if (sscanf(line,
- texture rgbw %d ( %d , %d ),
- tex, w, h) == 3) {
+   } else if (string_match(texture rgbw , line)) {
+   int num_scanned;
+   GLenum int_fmt = GL_RGBA, base_type = 
GL_UNSIGNED_NORMALIZED;
+   num_scanned = sscanf(line, texture rgbw %d ( %d , %d ) 
%31s %31s,
+tex, w, h, s, s2);
+   if (num_scanned  3) {
+   printf(invalid texture rgbw command!\n);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   if (num_scanned = 5) {
+   base_type = piglit_get_gl_enum_from_name(s2);
+   }
+
+   if (num_scanned = 4) {
+   int_fmt = piglit_get_gl_enum_from_name(s);
+   }
+
glActiveTexture(GL_TEXTURE0 + tex);
-   piglit_rgbw_texture(GL_RGBA, w, h, GL_FALSE, GL_FALSE, 
GL_UNSIGNED_NORMALIZED);
+   piglit_rgbw_texture(int_fmt, w, h, GL_FALSE, GL_FALSE,
+   base_type);
if (!piglit_is_core_profile)
glEnable(GL_TEXTURE_2D);
} else if (sscanf(line, texture miptree %d, tex) == 1) {
-- 
2.1.4

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


[Piglit] [PATCH 3/3] cs: Use GL_RGBA8 for image_load_store internal format

2015-05-25 Thread Jordan Justen
The motivation for this is that (as noted by curro)
ARB_shader_image_load_store doesn't support images with an internal
format of GL_RGBA.

See 'Table X.2' in
https://www.opengl.org/registry/specs/ARB/shader_image_load_store.txt

Therefore, in order to use image load/store in shader runner tests, we
must override the default internal format when creating the image.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
Cc: Francisco Jerez curroje...@riseup.net
---
 generated_tests/gen_builtin_uniform_tests.py| 2 +-
 .../arb_compute_shader/execution/basic-uniform-access.shader_test   | 2 +-
 .../execution/multiple-texture-reading.shader_test  | 6 +++---
 .../arb_compute_shader/execution/multiple-workgroups.shader_test| 2 +-
 tests/spec/arb_compute_shader/execution/simple-barrier.shader_test  | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/generated_tests/gen_builtin_uniform_tests.py 
b/generated_tests/gen_builtin_uniform_tests.py
index b0c2e7b..c88add5 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -705,7 +705,7 @@ class ComputeShaderTest(ShaderTest):
 
 def make_test_init(self):
 return '''uniform int tex 0
-texture rgbw 0 ({0}, 1)
+texture rgbw 0 ({0}, 1) GL_RGBA8
 image texture 0
 fb tex 2d 0
 '''.format(len(self._test_vectors))
diff --git 
a/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test 
b/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
index 26b9220..ad6f82d 100644
--- a/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
+++ b/tests/spec/arb_compute_shader/execution/basic-uniform-access.shader_test
@@ -24,7 +24,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
diff --git 
a/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test 
b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
index c1c06d4..b13f4df 100644
--- 
a/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
+++ 
b/tests/spec/arb_compute_shader/execution/multiple-texture-reading.shader_test
@@ -33,7 +33,7 @@ void main()
 
 [test]
 # Setup src0 image
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 uniform int src0 0
 image texture 0
 fb tex 2d 0
@@ -41,7 +41,7 @@ clear color 1.0 0.0 1.0 0.0
 clear
 
 # Setup src1 image
-texture rgbw 1 (16, 16)
+texture rgbw 1 (16, 16) GL_RGBA8
 uniform int src1 1
 image texture 1
 fb tex 2d 1
@@ -49,7 +49,7 @@ clear color 0.0 1.0 0.0 1.0
 clear
 
 # Setup dst image
-texture rgbw 2 (16, 16)
+texture rgbw 2 (16, 16) GL_RGBA8
 uniform int dst 2
 image texture 2
 fb tex 2d 2
diff --git 
a/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test 
b/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
index 82d3e9f..eeb3233 100644
--- a/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
+++ b/tests/spec/arb_compute_shader/execution/multiple-workgroups.shader_test
@@ -24,7 +24,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
diff --git a/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test 
b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
index 665b381..3f09c34 100644
--- a/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
+++ b/tests/spec/arb_compute_shader/execution/simple-barrier.shader_test
@@ -48,7 +48,7 @@ void main()
 
 [test]
 uniform int tex 0
-texture rgbw 0 (16, 16)
+texture rgbw 0 (16, 16) GL_RGBA8
 image texture 0
 fb tex 2d 0
 
-- 
2.1.4

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


[Piglit] [PATCH 1/3] shader_runner: Use strndup to get a null-terminated string for 'line'

2015-05-25 Thread Jordan Justen
In order to use sscanf with optional parameters, the string needs to
be null terminated. Otherwise, sscanf will treat the newline as
whitespace and continue to look for matches on the following lines.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 tests/shaders/shader_runner.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 1827e08..2df9e78 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2294,7 +2294,7 @@ probe_atomic_counter(GLint counter_num, const char *op, 
uint32_t value)
 enum piglit_result
 piglit_display(void)
 {
-   const char *line;
+   const char *line, *next_line;
bool pass = true;
GLbitfield clear_bits = 0;
bool link_error_expected = false;
@@ -2303,14 +2303,23 @@ piglit_display(void)
if (test_start == NULL)
return PIGLIT_PASS;
 
-   line = test_start;
-   while (line[0] != '\0') {
+   next_line = test_start;
+   while (next_line[0] != '\0') {
float c[32];
double d[4];
int x, y, z, w, h, l, tex, level;
char s[32];
 
-   line = eat_whitespace(line);
+
+   line = eat_whitespace(next_line);
+
+   next_line = strchrnul(next_line, '\n');
+
+   if (next_line[0] != '\0')
+   next_line++;
+
+   /* Duplicate the line to make it null terminated */
+   line = strndup(line, next_line - line);
 
if (sscanf(line, atomic counters %d, x) == 1) {
GLuint *atomics_buf = calloc(x, sizeof(GLuint));
@@ -2701,9 +2710,7 @@ piglit_display(void)
piglit_report_result(PIGLIT_FAIL);
}
 
-   line = strchrnul(line, '\n');
-   if (line[0] != '\0')
-   line++;
+   free((void*) line);
}
 
if (!link_ok  !link_error_expected) {
-- 
2.1.4

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


Re: [Piglit] [PATCH 2/2] util: Add a -png option to dump PNG files on piglit_present_results().

2015-05-15 Thread Jordan Justen
On 2015-05-14 12:25:41, Kenneth Graunke wrote:
 This makes it easy to dump images containing the window contents of
 any Piglit test, even when running with GBM or ssh'd in to headless
 systems.
 
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 Cc: b...@bwidawsk.net
 ---
  tests/util/piglit-framework-gl.c | 40 
 
  1 file changed, 40 insertions(+)
 
 diff --git a/tests/util/piglit-framework-gl.c 
 b/tests/util/piglit-framework-gl.c
 index b9ab2f8..1f489bf 100644
 --- a/tests/util/piglit-framework-gl.c
 +++ b/tests/util/piglit-framework-gl.c
 @@ -21,7 +21,9 @@
   * IN THE SOFTWARE.
   */
  
 +#define _GNU_SOURCE

I think this is always defined in CMakeLists.txt.

  #include assert.h
 +#include ctype.h
  #include string.h
  #include stdio.h
  #include stdlib.h
 @@ -32,6 +34,8 @@
  
  struct piglit_gl_framework *gl_fw;
  
 +const char *piglit_binary_name;
 +bool piglit_dump_png = false;
  bool piglit_use_fbo = false;
  int piglit_automatic = 0;
  unsigned piglit_winsys_fbo = 0;
 @@ -100,6 +104,8 @@ process_args(int *argc, char *argv[], unsigned 
 *force_samples,
  {
 int j;
  
 +   piglit_binary_name = argv[0];
 +
 piglit_parse_subtest_args(argc, argv, config-subtests,
   config-selected_subtests,
   config-num_selected_subtests);
 @@ -115,6 +121,10 @@ process_args(int *argc, char *argv[], unsigned 
 *force_samples,
 piglit_use_fbo = true;
 delete_arg(argv, *argc, j--);
 *argc -= 1;
 +   } else if (!strcmp(argv[j], -png)) {
 +   piglit_dump_png = true;
 +   delete_arg(argv, *argc, j--);
 +   *argc -= 1;
 } else if (!strcmp(argv[j], -rlimit)) {
 char *ptr;
 unsigned long lim;
 @@ -207,6 +217,36 @@ piglit_swap_buffers(void)
  void
  piglit_present_results(void)
  {
 +   if (piglit_dump_png) {
 +   static char *fileprefix = NULL;
 +   static int frame = 0;
 +   char *filename;
 +   GLenum base_format = GL_RGBA;
 +   GLubyte *image;
 +   if (fileprefix == NULL) {
 +   int i;
 +   fileprefix = strdup(piglit_binary_name);
 +   fileprefix = basename(fileprefix);
 +   /* Strip potentially bad characters */
 +   for (i = 0; fileprefix[i]; i++) {
 +   if (!isalnum(fileprefix[i])  fileprefix[i] 
 != '-')
 +   fileprefix[i] = '_';
 +   }
 +   }
 +   image = malloc(4 * piglit_width * piglit_height);
 +   glReadPixels(0, 0, piglit_width, piglit_height,
 +base_format, GL_UNSIGNED_BYTE, image);
 +   assert(glGetError() == GL_NO_ERROR);
 +
 +   asprintf(filename, %s%03d.png, fileprefix, frame++);
 +
 +   printf(Writing %s...\n, filename);
 +   piglit_write_png(filename, base_format, piglit_width,
 +piglit_height, image, true);

I think Ben grumbled something about overwriting files, without
warning, but it seems fine to me.

Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

 +   free(filename);
 +   free(image);
 +   }
 +
 if (!piglit_automatic)
 piglit_swap_buffers();
  }
 -- 
 2.4.0
 
 ___
 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] Delete redundant condition-07.vert test.

2015-03-06 Thread Jordan Justen
Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On 2015-03-05 23:22:52, Kenneth Graunke wrote:
 This test is redundant with:
 glsl-1.20/compiler/structure-and-array-operations/array-selection.vert
 
 Both contain the same shader code and the same spec citation - the only
 difference is variable names and the exact portion of the text quoted.
 
 The other one has a better name, so keep it and delete condition-07.
 ---
  tests/glslparsertest/glsl2/condition-07.vert | 26 --
  1 file changed, 26 deletions(-)
  delete mode 100644 tests/glslparsertest/glsl2/condition-07.vert
 
 diff --git a/tests/glslparsertest/glsl2/condition-07.vert 
 b/tests/glslparsertest/glsl2/condition-07.vert
 deleted file mode 100644
 index 189c493..000
 --- a/tests/glslparsertest/glsl2/condition-07.vert
 +++ /dev/null
 @@ -1,26 +0,0 @@
 -// [config]
 -// expect_result: pass
 -// glsl_version: 1.20
 -//
 -// [end config]
 -
 -/* PASS
 - *
 - * From page 38 (page 44 of the PDF) of the GLSL 1.20 spec:
 - *
 - *The second and third expressions can be any type, as long their types
 - *match, or there is a conversion in Section 4.1.10 Implicit 
 Conversions
 - *that can be applied to one of the expressions to make their types
 - *match.
 - */
 -#version 120
 -
 -uniform bool selector;
 -uniform vec4 a[2];
 -uniform vec4 b[2];
 -uniform int idx;
 -
 -void main()
 -{
 -  gl_Position = (selector ? a : b)[idx];
 -}
 -- 
 2.2.2
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 08/34] generators: python2/3 hybridize gen_outerproduct_tests.py

2015-02-21 Thread Jordan Justen
On 2015-02-20 18:17:55, Dylan Baker wrote:
 This uses six in both the mako templates and in the main python script
 to create a generator that runs under both python2.7 and python 3.2, and
 this produces not differences when run with python2 or python3.

not = no

This patch let me learn some new git magic. :)

git show --word-diff-regex=. dcbaker/submit/python3~26

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

 Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
 ---
  generated_tests/gen_outerproduct_tests.py  |  4 +++-
  .../gen_outerproduct_tests/template.shader_test.mako   | 18 
 +++---
  2 files changed, 14 insertions(+), 8 deletions(-)
 
 diff --git a/generated_tests/gen_outerproduct_tests.py 
 b/generated_tests/gen_outerproduct_tests.py
 index 42c527b..7fd6eb2 100644
 --- a/generated_tests/gen_outerproduct_tests.py
 +++ b/generated_tests/gen_outerproduct_tests.py
 @@ -25,6 +25,8 @@ import os
  import itertools
  import collections
  
 +from six.moves import range
 +
  from templates import template_file
  from modules import utils
  
 @@ -41,7 +43,7 @@ def main():
  utils.safe_makedirs(dirname)
  
  
 -for c, r in itertools.product(xrange(2, 5), repeat=2):
 +for c, r in itertools.product(range(2, 5), repeat=2):
  vecs = [
  Parameters(c, r, 'vec', 'mat{0}x{1}'.format(r, c)),
  Parameters(c, r, 'ivec', 'mat{0}x{1}'.format(r, c))
 diff --git 
 a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako 
 b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
 index 5d7561a..8c2d6c9 100644
 --- 
 a/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
 +++ 
 b/generated_tests/templates/gen_outerproduct_tests/template.shader_test.mako
 @@ -18,6 +18,10 @@
  ## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
 THE
  ## SOFTWARE.
  
 +%!
 +  from six.moves import range
 +%
 +
  %def name=spec()
  /* From page 43 (page 49 of the PDF) of the GLSL 1.20 spec:
   *
 @@ -42,9 +46,9 @@
  /%def
  
  %def name=const_shader_data()
 -const ${params.vec_type}${params.columns} c = 
 ${params.vec_type}${params.columns}(${, .join(str(i + 1) for i in xrange(1, 
 params.columns + 1))});
 -const ${params.vec_type}${params.rows} r = 
 ${params.vec_type}${params.rows}(${, .join(str(i + 1 + params.columns) for 
 i in xrange(1, params.rows + 1))});
 -uniform ${params.matrix} expected = ${params.matrix}(${, .join(str((i + 1 
 + params.columns) * (j + 1)) for i in xrange(1, params.rows + 1) for j in 
 xrange(1, params.columns + 1))});
 +const ${params.vec_type}${params.columns} c = 
 ${params.vec_type}${params.columns}(${, .join(str(i + 1) for i in range(1, 
 params.columns + 1))});
 +const ${params.vec_type}${params.rows} r = 
 ${params.vec_type}${params.rows}(${, .join(str(i + 1 + params.columns) for 
 i in range(1, params.rows + 1))});
 +uniform ${params.matrix} expected = ${params.matrix}(${, .join(str((i + 1 
 + params.columns) * (j + 1)) for i in range(1, params.rows + 1) for j in 
 range(1, params.columns + 1))});
  /%def
  
  %def name=uniform_shader_data()
 @@ -109,10 +113,10 @@ clear
  ortho
  
  %if type == 'uniform':
 -% for x in xrange(1, 5):
 -uniform ${params.vec_type}${params.columns} c ${ .join(str(i + x) for i in 
 xrange(1, params.columns + 1))}
 -uniform ${params.vec_type}${params.rows} r ${ .join(str(i + x + 
 params.columns) for i in xrange(1, params.rows + 1))}
 -uniform mat${params.rows}x${params.columns} expected ${ .join(str((i + x + 
 params.columns) * (j + x)) for i in xrange(1, params.rows + 1) for j in 
 xrange(1, params.columns + 1))}
 +% for x in range(1, 5):
 +uniform ${params.vec_type}${params.columns} c ${ .join(str(i + x) for i in 
 range(1, params.columns + 1))}
 +uniform ${params.vec_type}${params.rows} r ${ .join(str(i + x + 
 params.columns) for i in range(1, params.rows + 1))}
 +uniform mat${params.rows}x${params.columns} expected ${ .join(str((i + x + 
 params.columns) * (j + x)) for i in range(1, params.rows + 1) for j in 
 range(1, params.columns + 1))}
  draw rect ${20 * x - 10} 10 10 10
  probe rgb ${20 * x - 5} 15 0.0 1.0 0.0
  
 -- 
 2.3.0
 
 ___
 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 07/34] Add dependency on Python six

2015-02-21 Thread Jordan Justen
Update the README?

1-7 Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On 2015-02-20 18:17:54, Dylan Baker wrote:
 Six is a module that provides a clean, standardized interface for
 handling python2 and python3 from the same code base. This adds a
 requirement on six as a build-time dependency, the plan is to use it
 only for python generators (those called during build time)
 
 While it certainly is possible to reimplement much of what six does
 scratch and not add another python dependency, I think it's better to
 just use six. For one thing a large number of python modules already
 depend on six, so the chances are good that most people already have it
 installed. Second, it's the de facto standard for supporting complex
 code bases in 2 and 3, so it's familiar and many of the corner cases
 have already been addressed.
 
 This adds the necessary cmake boilerplate to ensure that six is
 available. At this time I don't know of a specific version being
 required, but I am currently using 1.9.0
 ---
  CMakeLists.txt|  1 +
  cmake/Modules/FindPythonSix.cmake | 22 ++
  2 files changed, 23 insertions(+)
  create mode 100644 cmake/Modules/FindPythonSix.cmake
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
 index db5f718..1a81eed 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
 @@ -192,6 +192,7 @@ ENDIF()
  find_package(PythonInterp 2.7 REQUIRED)
  find_package(PythonNumpy 1.6.2 REQUIRED)
  find_package(PythonMako 0.7.3 REQUIRED)
 +find_package(PythonSix REQUIRED)
  
  # Default to compiling with debug information (`gcc -g`):
  if(NOT CMAKE_BUILD_TYPE)
 diff --git a/cmake/Modules/FindPythonSix.cmake 
 b/cmake/Modules/FindPythonSix.cmake
 new file mode 100644
 index 000..96b9a0c
 --- /dev/null
 +++ b/cmake/Modules/FindPythonSix.cmake
 @@ -0,0 +1,22 @@
 +# Copyright (C) 2015 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 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(PythonModule)
 +basic_python_module(six PythonSix)
 -- 
 2.3.0
 
 ___
 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 13/34] gen_shader_precision_tests.py: python2/3 hybridize

2015-02-21 Thread Jordan Justen
On 2015-02-20 18:18:00, Dylan Baker wrote:
 This produces no changes in output.
 
 Signed-off-by: Dylan Baker dylanx.c.ba...@intel.com
 ---
  generated_tests/gen_shader_precision_tests.py  | 14 
 --
  .../templates/gen_shader_precision_tests/fs.mako   | 11 +++
  .../templates/gen_shader_precision_tests/gs.mako   | 11 +++
  .../templates/gen_shader_precision_tests/vs.mako   | 11 +++
  4 files changed, 29 insertions(+), 18 deletions(-)
 
 diff --git a/generated_tests/gen_shader_precision_tests.py 
 b/generated_tests/gen_shader_precision_tests.py
 index 0d24a80..e2d2381 100644
 --- a/generated_tests/gen_shader_precision_tests.py
 +++ b/generated_tests/gen_shader_precision_tests.py
 @@ -46,10 +46,12 @@
   This program outputs, to stdout, the name of each file it generates.
  
  
 -from builtin_function import * 
 -import mako.template 

Seems unrelated, but meh...

9-13 Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

 +from builtin_function import *
  import os 
  
 +import six
 +from six.moves import range
 +
  from templates import template_file
  
  tolerances = {'pow': 16.0, 
 @@ -76,11 +78,11 @@ def make_indexers(signature):
 if signature.rettype.num_cols == 1:
col_indexers = ['']
 else:
 -  col_indexers = ['[{0}]'.format(i) for i in 
 xrange(signature.rettype.num_cols)]
 +  col_indexers = ['[{0}]'.format(i) for i in 
 range(signature.rettype.num_cols)]
 if signature.rettype.num_rows == 1:
row_indexers = ['']
 else:
 -  row_indexers = ['[{0}]'.format(i) for i in 
 xrange(signature.rettype.num_rows)]
 +  row_indexers = ['[{0}]'.format(i) for i in 
 range(signature.rettype.num_rows)]
 return [col_indexer + row_indexer 
 for col_indexer in col_indexers for row_indexer in row_indexers]
  
 @@ -122,7 +124,7 @@ def shader_runner_format(values):
  def main():
   Main function 
  
 -for signature, test_vectors in sorted(test_suite.iteritems()):
 +for signature, test_vectors in sorted(six.iteritems(test_suite)):
  arg_float_check = tuple(
  arg.base_type == glsl_float for arg in 
 signature.argtypes)
  # Filter the test vectors down to only those which deal exclusively 
 in float types
 @@ -130,7 +132,7 @@ def main():
  indexers = make_indexers(signature)
  num_elements = signature.rettype.num_cols*signature.rettype.num_rows
  invocation = signature.template.format( *['arg{0}'.format(i) 
 -for i in 
 xrange(len(signature.argtypes))])
 +for i in 
 range(len(signature.argtypes))])
  if (signature.rettype.base_type == glsl_float and
  arg_float_check and
  all(arg_float_check) and
 diff --git a/generated_tests/templates/gen_shader_precision_tests/fs.mako 
 b/generated_tests/templates/gen_shader_precision_tests/fs.mako
 index 4ea5e50..19ec737 100644
 --- a/generated_tests/templates/gen_shader_precision_tests/fs.mako
 +++ b/generated_tests/templates/gen_shader_precision_tests/fs.mako
 @@ -1,3 +1,6 @@
 +%!
 +  from six.moves import range
 +%
  [require]
  GLSL = 4.00
  
 @@ -45,13 +48,13 @@ ${', '.join('floatBitsToInt(expected{0})'.format(i) for i 
 in indexers)}\
## check for differences in the sign bit for each result
##
bool signerr = \
 -${' || '.join('(resultbits[{0}]31 != expectedbits[{0}]31)'.format(i) for 
 i in xrange(0, num_elements))}\
 +${' || '.join('(resultbits[{0}]31 != expectedbits[{0}]31)'.format(i) for 
 i in range(0, num_elements))}\
  ;
##
## calculate the difference between the generated value and the expected 
 value in ulps
##
${signature.rettype} ulps = ${signature.rettype}(\
 -${', '.join('abs(resultbits[{0}] - expectedbits[{0}])'.format(i) for i in 
 xrange(0, num_elements))}\
 +${', '.join('abs(resultbits[{0}] - expectedbits[{0}])'.format(i) for i in 
 range(0, num_elements))}\
  );
##
## find the maximum error in ulps of all the calculations using a nested 
 max() sort
 @@ -72,7 +75,7 @@ max(\
  % endfor
  max(ulps${indexers[len(indexers)-2]}, ulps${indexers[len(indexers)-1]})\
  ## fill in completing parens
 -% for i in xrange(0, num_elements-2):
 +% for i in range(0, num_elements-2):
  )\
  % endfor
  ;
 @@ -110,7 +113,7 @@ piglit_vertex/float/2
  
  [test]
  % for test_num, test_vector in enumerate(test_vectors):
 -  % for i in xrange(len(test_vector.arguments)):
 +  % for i in range(len(test_vector.arguments)):
  uniform ${shader_runner_type(signature.argtypes[i])} arg${i} 
 ${shader_runner_format( column_major_values(test_vector.arguments[i]))}
% endfor
  uniform ${shader_runner_type(signature.rettype)} expected 
 ${shader_runner_format(column_major_values(test_vector.result))}
 diff --git a/generated_tests/templates/gen_shader_precision_tests/gs.mako 
 b/generated_tests/templates

Re: [Piglit] [PATCH 00/34] Hybridize build system for python2 and python3

2015-02-21 Thread Jordan Justen
Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

except 31 (add MIT header) which I think you should get confirmation
from the authors.

I responded to a few patches with notes, but nothing critical.

-Jordan

On 2015-02-20 18:17:47, Dylan Baker wrote:
 This series hybridizes the python generator framework (both for tests
 and for dispatch) to work with both python2 and python3.
 
 This makes use of the six module (which is a new dependency that you
 probably already have installed, a lot of python modules depend on it),
 to craft code that produces as close to the same output as is possible.
 There are limitations, python3 numeric types have limitless precision,
 unlike their python2 counterparts, and there isn't anything sane that
 can be done about it except to use numpy, which is a bigger project than
 I want to take on at the moment.
 
 The goal here is that we can get everything except the test framework to
 be hybridized, and then make a python2 branch, with the assumption that
 cherry-picking anything that isn't a framework change will be safe. To
 that end I'm willing to ensure that any changes to the output format
 that are relevant get ported to the python2 framework, as do bug fixes.
 
 This is motivated by three things. First, we really want a reliable
 timeout mechanism, and python3 provides that (see my
 wip/python3-complete branch at my github) Second, linux distros are
 starting to make the transition toward python3. And finally, python3.3
 (the version we're targeting) starts to add new features that are useful
 for us, and has added more in python 3.4, and will continue to do so in
 later versions of python3.x. Finally, the code is generally clean enough
 at this point that we can make the transition with very little pain, the
 code is largely in a shape to make the jump.
 
 This series does not turn on python3 (even with a switch), it simply
 lays the groundwork. The second series I mentioned (which still needs
 cleanup) finishes out the transition and begins to make use of python3
 features. Since this doesn't impede the use of python2, I don't think
 it's a problem to land, there are maybe 5 lines of code that are dead
 without python3 support. You can manually turn it on with a one line
 change to CMakeList.txt, as explained later in this message.
 
 I have tested quick.py and there is no difference in results if the
 output is generated with python3 or with python2. I cannot get a machine
 with OpenCL running (but I did modify the generators), and they same to
 produce the same out put when diffed, but I would really appreciate if
 one of the OpenCL guys could give them a whirl and make sure that they
 don't change the results.
 
 If you want to test this out you'll likely need to clear the piglit mako
 cache it's located in system tmp directory/piglit-username
 
 To use python3 you'll also need to change find_package(PythonInterp 2.7
 REQUIRED) in root/CMakeList.txt to find_package(PythonInterp 3.3
 REQUIRED). I don't think that any of the cl generators use mako, so I
 don't think you'll need to clear that cache, but you will need to delete
 the cmake cache to get the new python version. This will not affect the
 runner version, just the python build version.
 
 This is available at my github:
 https://github.com/dcbaker/piglit submit/python3
 
 Dylan Baker (34):
   gen_builtin_packing_tests.py: use __future__ division
   gen_builtin_uniform_tests.py: use __future__ functions
   gen_builtin_uniform_tests_fp64.py: use __future__ functions
   gen_constant_array_size_tests.py: use __future__ functions
   gen_constant_array_size_tests_fp64.py: use __future__ functions.
   generated_tests: use future division in mako templates
   Add dependency on Python six
   generators: python2/3 hybridize gen_outerproduct_tests.py
   gen_non-lvalue_tests.py: make python2/3 compatible
   gen_texture_query_lod_tests.py: make pyhthon2/3 hybrid
   generators: interpolation-qualifier... python2/3 hybridize
   builtin_function*py: convert to python3
   gen_shader_precision_tests.py: python2/3 hybridize
   gen_uniform_initializer_tests.py: hybridize for python2 and python3
   gen_constant_array_size_tests.py: python2/3 hybridize
   gen_constant_array_size_tests_fp64.py: python2/3 hybridize
   gen_interpolation_tests.py: hybridize python 2/3
   gen_builtin_uniform_tests_fp64: hybridize python2/3
   gen_builtin_uniform_tests.py: python2/3 hybridize
   gen_builtin_packing_tests.py: python2/3 hybridize
   gen_shader_bit_encoding_tests.py: python 2/3 hybridize
   registry/gl.py: drop 2.6 support
   registry/gl.py: Don't try to compare None and not-None
   registry/gl.py: add hash methods for classes that need to be hashed
   registry generation: Finish hybridizing
   generators: rename cl generators so they can be imported
   generators: use if __name__ == __main__ pattern in cl generators
   gen_cl_int_builtins.py: Replace use of Long type
   cl tests: move non-generated tests out of the generated

Re: [Piglit] [PATCH 25/34] registry generation: Finish hybridizing

2015-02-21 Thread Jordan Justen
On 2015-02-20 18:18:12, Dylan Baker wrote:
 registry/gl.py and tests/util/gen_dispatch.py and pretty much
 indistinguishable in purpose, so it makes sense to finsih porting them
 together.
 
 This is actually not very invasive, a few calls to six, and a few cases
 of using forward compatible functions (functools.reduce instead of the
 builtin reduce, which was removed in python3)
 
 The resulting output is exactly the same.
 ---
  registry/gl.py | 16 +++-
  tests/util/gen_dispatch.py | 14 --
  2 files changed, 23 insertions(+), 7 deletions(-)
 
 diff --git a/registry/gl.py b/registry/gl.py
 index f85e393..a22e920 100644
 --- a/registry/gl.py
 +++ b/registry/gl.py
 @@ -30,9 +30,9 @@ import os.path
  import re
  import sys
  import functools
 -
  from copy import copy, deepcopy
  
 +import six
  
  # Export 'debug' so other Piglit modules can easily enable it.
  debug = False
 @@ -261,13 +261,13 @@ class OrderedKeyedSet(object):
  return node[3]
  
  def sort_by_key(self):
 -sorted_items = sorted(self.__map.iteritems())
 +sorted_items = sorted(six.iteritems(self.__map))
  self.clear()
  for item in sorted_items:
  self.add(item[1])
  
  def sort_by_value(self):
 -sorted_values = sorted(self.__map.itervalues())
 +sorted_values = sorted(six.itervalues(self.__map))
  self.clear()
  for value in sorted_values:
  self.add(value)
 @@ -909,7 +909,7 @@ class CommandAliasMap(object):
  def __iter__(self):
  A sorted iterator over the map's unique CommandAliasSet values.
  if self.__sorted_unique_values is None:
 -self.__sorted_unique_values = 
 sorted(set(self.__map.itervalues()))
 +self.__sorted_unique_values = 
 sorted(set(six.itervalues(self.__map)))
  
  return iter(self.__sorted_unique_values)
  
 @@ -,7 +,13 @@ class Enum(object):
  base = 16
  else:
  base = 10
 -self.num_value = long(self.str_value, base)
 +
 +if six.PY2:
 +# long is undefined in python3, and we are aware of that
 +# pylint: disable=undefined-variable
 +self.num_value = long(self.str_value, base)
 +elif six.PY3:

How about?

else:
assert six.PY3

14-25 Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

 +self.num_value = int(self.str_value, base)
  
  _log_debug('parsed {0}'.format(self))
  
 diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
 index 4d7d756..98d63fd 100644
 --- a/tests/util/gen_dispatch.py
 +++ b/tests/util/gen_dispatch.py
 @@ -30,8 +30,10 @@ import argparse
  import os.path
  import re
  import sys
 +import functools
  from collections import namedtuple
  
 +import six
  import mako.runtime
  import mako.template
  
 @@ -105,7 +107,15 @@ def render_template(filename, out_dir, **context_vars):
  def fake_whitespace(proto_text):
  if debug:
  print('fake whitespace: before: {0!r}'.format(proto_text))
 -text = unicode(proto_text)
 +
 +if six.PY2:
 +# the unicode function was removed in python3, this will raise a
 +# pylint error, but not in python2
 +# pylint: disable=undefined-variable
 +text = unicode(proto_text)
 +elif six.PY3:
 +text = proto_text
 +
  text = fake_alignment.sub('', text)
  text = fake_tab.sub('', text)
  if debug:
 @@ -152,7 +162,7 @@ class EnumCode(object):
  for enum in enum_group.enums
  )
  enums = sorted(enums)
 -enums = reduce(append_enum_if_new_value, enums[1:], [enums[0]])
 +enums = functools.reduce(append_enum_if_new_value, enums[1:], 
 [enums[0]])
  return enums
  
  
 -- 
 2.3.0
 
 ___
 Piglit mailing list
 Piglit@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/piglit
___
Piglit mailing list
Piglit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH] ARB_shader_atomic_counters: Add simple VS test with inc/dec/read

2015-02-17 Thread Jordan Justen
Simple test of atomicCounterIncrement, atomicCounterDecrement and
atomicCounter being used in the VS.

Signed-off-by: Jordan Justen jordan.l.jus...@intel.com
---
 tests/all.py   |  3 +
 .../execution/vs-simple-inc-dec-read.shader_test   | 70 ++
 2 files changed, 73 insertions(+)
 create mode 100644 
tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test

diff --git a/tests/all.py b/tests/all.py
index d2ae5ea..dc6e60d 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4383,6 +4383,9 @@ spec['ARB_shader_atomic_counters'] = 
arb_shader_atomic_counters
 import_glsl_parser_tests(spec['ARB_shader_atomic_counters'],
  os.path.join(TESTS_DIR, 'spec', 
'arb_shader_atomic_counters'),
  [''])
+add_shader_test_dir(spec['ARB_shader_atomic_counters'],
+os.path.join(TESTS_DIR, 'spec', 
'arb_shader_atomic_counters'),
+recursive=True)
 arb_shader_atomic_counters['active-counters'] = 
PiglitGLTest(['arb_shader_atomic_counters-active-counters'], 
run_concurrent=True)
 arb_shader_atomic_counters['array-indexing'] = 
PiglitGLTest(['arb_shader_atomic_counters-array-indexing'], run_concurrent=True)
 arb_shader_atomic_counters['buffer-binding'] = 
PiglitGLTest(['arb_shader_atomic_counters-buffer-binding'], run_concurrent=True)
diff --git 
a/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test
 
b/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test
new file mode 100644
index 000..4a8f50e
--- /dev/null
+++ 
b/tests/spec/arb_shader_atomic_counters/execution/vs-simple-inc-dec-read.shader_test
@@ -0,0 +1,70 @@
+# Simple test of atomicCounterIncrement, atomicCounterDecrement and
+# atomicCounter being used in the VS.
+
+[require]
+GL CORE = 3.1
+GLSL = 1.40
+
+[vertex shader]
+#version 140
+#extension GL_ARB_shader_atomic_counters: require
+
+layout(binding = 0) uniform atomic_uint a0;
+layout(binding = 0) uniform atomic_uint a1;
+
+in vec4 piglit_vertex;
+out vec4 vcolor;
+
+void main()
+{
+   bool passed = true;
+   uint v0, v1;
+
+   /* Test that incrementing, followed by a read of an atomic
+* counter results in a larger value.
+*
+* Note: atomicCounterIncrement return the old value
+*/
+   v0 = atomicCounterIncrement(a0);
+   v1 = atomicCounter(a0);
+   if (v1 = v0)
+   passed = false;
+
+   /* Skip one decrement since it may be the 0 = 0x
+* transition.
+*/
+   atomicCounterDecrement(a1);
+
+   /* Test that a read, followed by a decrement of an atomic
+* counter results in a smaller value.
+*
+* Note: atomicCounterDecrement return the new value
+*/
+   v0 = atomicCounter(a1);
+   v1 = atomicCounterDecrement(a1);
+   if (v1 = v0)
+   passed = false;
+
+   if (passed)
+   vcolor = vec4(0.0, 1.0, 0.0, 1.0);
+   else
+   vcolor = vec4(1.0, 0.0, 0.0, 1.0);
+
+   gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+#version 140
+in vec4 vcolor;
+out vec4 fcolor;
+
+void main()
+{
+   fcolor = vcolor;
+}
+
+[test]
+atomic counters 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
\ No newline at end of file
-- 
2.1.4

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


  1   2   3   >