Re: [Piglit] Spec justification for test_illegal_begin_mode?

2020-12-09 Thread Brian Paul

On 12/09/2020 11:19 AM, Ian Romanick wrote:

On 12/9/20 7:55 AM, Brian Paul wrote:

On 12/08/2020 05:47 PM, Ian Romanick wrote:

On 12/1/20 7:43 AM, Brian Paul wrote:

On 11/26/2020 09:22 AM, Brian Paul wrote:

On Wed, Nov 25, 2020 at 8:19 PM Ian Romanick mailto:i...@freedesktop.org>> wrote:

  I was looking at the dlist-beginend subtest
test_illegal_begin_mode.
  The test compiles a display list with GL_COMPILE_AND_EXECUTE
mode.  The
  glBegin in the test uses an invalid mode.  This should generate a
  GL_INVALID_OPERATION error immediately.  The test checks this, and
that


GL_INVALID_ENUM, actually, but anyway..


  seems correct.

  The test then tries to execute the display list and checks for
  GL_INVALID_OPERATION again.  I believe this is incorrect.  Section
5.4
  ("Display Lists") of the OpenGL 1.0 spec (this is a gl-1.0 test,
after
  all!) says:

       If mode is COMPILE_AND_EXECUTE then commands are executed as
they
       are encountered, then placed in the display list.

  Section 2.5 ("GL Errors") of the OpenGL 1.0 spec says:

       In other cases, the command generating the error is ignored
so that
       it has no effect on GL state or framebuffer contents.


Unfortunately, the spec doesn't clearly define what's meant by
"ignored" here.  That is, does it mean the command is not compiled
into the display list?  My intuition is that even if a command has
invalid args at compile time, the command should still be compiled
into the list.  If the spec doesn't spell out the answer, I'd opt to
do whatever other vendors do (hoping they're consistent).


  While the section numbers and titles have changed, every later
version
  of the GL (compatibility profile) spec says the exact same thing.

  To me, this indicates that the errant glBegin should not be
included in
  the display list.  Assuming this test passes on other
implementations, I
  think it does so only by luck.  The mis-matched glEnd in the
display
  list will generate the same error.  Am I missing some spec
language to
  justify this test?


I haven't searched, but I suspect the spec doesn't explicitly describe
this situation.


  I noticed this because I was adding a test that does

           glNewList(list, GL_COMPILE_AND_EXECUTE);
           glColor4fv(green);
           glBegin(GL_QUADS);
           glBegin(GL_QUADS);
           glVertex2f(-1, -1);
           glVertex2f( 1, -1);
           glVertex2f( 1, 0);
           glVertex2f(-1, 0);
           glEnd();
           glEndList();

  I expected an error while compiling the list, but I expected
glCallList
  to not generate an error.  Errors are generated in both places.


I guess my instinct is that errors should be generated both at list
compile and execute time.  I wonder if there's any API function /
argument combinations that would be errant at compile time but not at
execute time, depending on some other state.  If so, that would
indicate that calls should always be compiled into the list, even if
they generate an error at compile time.


  I think it gets worse.  There's a second part to this new subtest
that
  replaces the errant glBegin call with glReadPixels.  glReadPixels
is not
  allowed between glBegin and glEnd, so it should generate an
error in
  GL_COMPILE_AND_EXECUTE mode.  It does not.


Sound like a run of the mill bug.


  These changes are in the top commit of:


https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fidr%2Fpiglit%2F-%2Fcommits%2Fdisplay-list-helldata=04%7C01%7Cbrianp%40vmware.com%7C89be46b6a92e45dcdaf808d89c6ef860%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637431347717810649%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=1tCyEIgpPwDa2VAqxoTRKw93MONcaWEU00qFkL7b40Q%3Dreserved=0


<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fidr%2Fpiglit%2F-%2Fcommits%2Fdisplay-list-helldata=04%7C01%7Cbrianp%40vmware.com%7C89be46b6a92e45dcdaf808d89c6ef860%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637431347717810649%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=1tCyEIgpPwDa2VAqxoTRKw93MONcaWEU00qFkL7b40Q%3Dreserved=0>



  I don't have any systems currently available with closed-source
drivers,
  but I would be very interested to see the results of
  gl-1.0-dlist-beginend from that branch on any closed source
drivers (on
  any platform).


I can check on Nvidia next week when I'm back.  Maybe someone else can
test in the mean time.


Here's the results with Nvidia's 455.38 driver:

$  build-debug/bin/gl-1.0-dlist-beginend -auto
PIGLIT: {"enumerate subtests": ["glCallList inside glBegin-glEnd",
"nested glCallList inside glBegin-g

Re: [Piglit] Spec justification for test_illegal_begin_mode?

2020-12-09 Thread Brian Paul

On 12/08/2020 05:47 PM, Ian Romanick wrote:

On 12/1/20 7:43 AM, Brian Paul wrote:

On 11/26/2020 09:22 AM, Brian Paul wrote:

On Wed, Nov 25, 2020 at 8:19 PM Ian Romanick mailto:i...@freedesktop.org>> wrote:

     I was looking at the dlist-beginend subtest test_illegal_begin_mode.
     The test compiles a display list with GL_COMPILE_AND_EXECUTE
mode.  The
     glBegin in the test uses an invalid mode.  This should generate a
     GL_INVALID_OPERATION error immediately.  The test checks this, and
that


GL_INVALID_ENUM, actually, but anyway..


     seems correct.

     The test then tries to execute the display list and checks for
     GL_INVALID_OPERATION again.  I believe this is incorrect.  Section
5.4
     ("Display Lists") of the OpenGL 1.0 spec (this is a gl-1.0 test,
after
     all!) says:

      If mode is COMPILE_AND_EXECUTE then commands are executed as
they
      are encountered, then placed in the display list.

     Section 2.5 ("GL Errors") of the OpenGL 1.0 spec says:

      In other cases, the command generating the error is ignored
so that
      it has no effect on GL state or framebuffer contents.


Unfortunately, the spec doesn't clearly define what's meant by
"ignored" here.  That is, does it mean the command is not compiled
into the display list?  My intuition is that even if a command has
invalid args at compile time, the command should still be compiled
into the list.  If the spec doesn't spell out the answer, I'd opt to
do whatever other vendors do (hoping they're consistent).


     While the section numbers and titles have changed, every later
version
     of the GL (compatibility profile) spec says the exact same thing.

     To me, this indicates that the errant glBegin should not be
included in
     the display list.  Assuming this test passes on other
implementations, I
     think it does so only by luck.  The mis-matched glEnd in the display
     list will generate the same error.  Am I missing some spec
language to
     justify this test?


I haven't searched, but I suspect the spec doesn't explicitly describe
this situation.


     I noticed this because I was adding a test that does

          glNewList(list, GL_COMPILE_AND_EXECUTE);
          glColor4fv(green);
          glBegin(GL_QUADS);
          glBegin(GL_QUADS);
          glVertex2f(-1, -1);
          glVertex2f( 1, -1);
          glVertex2f( 1, 0);
          glVertex2f(-1, 0);
          glEnd();
          glEndList();

     I expected an error while compiling the list, but I expected
glCallList
     to not generate an error.  Errors are generated in both places.


I guess my instinct is that errors should be generated both at list
compile and execute time.  I wonder if there's any API function /
argument combinations that would be errant at compile time but not at
execute time, depending on some other state.  If so, that would
indicate that calls should always be compiled into the list, even if
they generate an error at compile time.


     I think it gets worse.  There's a second part to this new subtest
that
     replaces the errant glBegin call with glReadPixels.  glReadPixels
is not
     allowed between glBegin and glEnd, so it should generate an error in
     GL_COMPILE_AND_EXECUTE mode.  It does not.


Sound like a run of the mill bug.


     These changes are in the top commit of:


https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fidr%2Fpiglit%2F-%2Fcommits%2Fdisplay-list-helldata=04%7C01%7Cbrianp%40vmware.com%7C376ec4dc8fd44f30077408d89bdbf4d6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637430716301345623%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=T1KlHoWIe2v%2Fr6ok86UXE7VEUu6fM78ePhJ1PCjqu%2Bs%3Dreserved=0

<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fidr%2Fpiglit%2F-%2Fcommits%2Fdisplay-list-helldata=04%7C01%7Cbrianp%40vmware.com%7C376ec4dc8fd44f30077408d89bdbf4d6%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C1%7C637430716301355618%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=9Ud1G%2BEk8CnZm8Yv1YQcCes7dDwZnkDt8wbioWOtb9E%3Dreserved=0>


     I don't have any systems currently available with closed-source
drivers,
     but I would be very interested to see the results of
     gl-1.0-dlist-beginend from that branch on any closed source
drivers (on
     any platform).


I can check on Nvidia next week when I'm back.  Maybe someone else can
test in the mean time.


Here's the results with Nvidia's 455.38 driver:

$  build-debug/bin/gl-1.0-dlist-beginend -auto
PIGLIT: {"enumerate subtests": ["glCallList inside glBegin-glEnd",
"nested glCallList inside glBegin-glEnd", "illegal glRect inside
glBegin-glEnd", "illegal glDrawArrays inside glBegin-glEnd", "

Re: [Piglit] Spec justification for test_illegal_begin_mode?

2020-12-01 Thread Brian Paul

On 11/26/2020 09:22 AM, Brian Paul wrote:
On Wed, Nov 25, 2020 at 8:19 PM Ian Romanick <mailto:i...@freedesktop.org>> wrote:


I was looking at the dlist-beginend subtest test_illegal_begin_mode.
The test compiles a display list with GL_COMPILE_AND_EXECUTE mode.  The
glBegin in the test uses an invalid mode.  This should generate a
GL_INVALID_OPERATION error immediately.  The test checks this, and that


GL_INVALID_ENUM, actually, but anyway..


seems correct.

The test then tries to execute the display list and checks for
GL_INVALID_OPERATION again.  I believe this is incorrect.  Section 5.4
("Display Lists") of the OpenGL 1.0 spec (this is a gl-1.0 test, after
all!) says:

     If mode is COMPILE_AND_EXECUTE then commands are executed as they
     are encountered, then placed in the display list.

Section 2.5 ("GL Errors") of the OpenGL 1.0 spec says:

     In other cases, the command generating the error is ignored so that
     it has no effect on GL state or framebuffer contents.


Unfortunately, the spec doesn't clearly define what's meant by "ignored" 
here.  That is, does it mean the command is not compiled into the 
display list?  My intuition is that even if a command has invalid args 
at compile time, the command should still be compiled into the list.  If 
the spec doesn't spell out the answer, I'd opt to do whatever other 
vendors do (hoping they're consistent).



While the section numbers and titles have changed, every later version
of the GL (compatibility profile) spec says the exact same thing.

To me, this indicates that the errant glBegin should not be included in
the display list.  Assuming this test passes on other implementations, I
think it does so only by luck.  The mis-matched glEnd in the display
list will generate the same error.  Am I missing some spec language to
justify this test?


I haven't searched, but I suspect the spec doesn't explicitly describe 
this situation.



I noticed this because I was adding a test that does

         glNewList(list, GL_COMPILE_AND_EXECUTE);
         glColor4fv(green);
         glBegin(GL_QUADS);
         glBegin(GL_QUADS);
         glVertex2f(-1, -1);
         glVertex2f( 1, -1);
         glVertex2f( 1, 0);
         glVertex2f(-1, 0);
         glEnd();
         glEndList();

I expected an error while compiling the list, but I expected glCallList
to not generate an error.  Errors are generated in both places.


I guess my instinct is that errors should be generated both at list 
compile and execute time.  I wonder if there's any API function / 
argument combinations that would be errant at compile time but not at 
execute time, depending on some other state.  If so, that would indicate 
that calls should always be compiled into the list, even if they 
generate an error at compile time.



I think it gets worse.  There's a second part to this new subtest that
replaces the errant glBegin call with glReadPixels.  glReadPixels is not
allowed between glBegin and glEnd, so it should generate an error in
GL_COMPILE_AND_EXECUTE mode.  It does not.


Sound like a run of the mill bug.


These changes are in the top commit of:

https://gitlab.freedesktop.org/idr/piglit/-/commits/display-list-hell 
<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fidr%2Fpiglit%2F-%2Fcommits%2Fdisplay-list-hell=04%7C01%7Cbrianp%40vmware.com%7C1bece8f6bb15456a704108d892278cef%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637420045848819859%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000=CGW3oxTFndTrF4fVU8EADRhSr1ORAODexsSgl4pYsjc%3D=0>

I don't have any systems currently available with closed-source drivers,
but I would be very interested to see the results of
gl-1.0-dlist-beginend from that branch on any closed source drivers (on
any platform).


I can check on Nvidia next week when I'm back.  Maybe someone else can 
test in the mean time.


Here's the results with Nvidia's 455.38 driver:

$  build-debug/bin/gl-1.0-dlist-beginend -auto
PIGLIT: {"enumerate subtests": ["glCallList inside glBegin-glEnd", 
"nested glCallList inside glBegin-glEnd", "illegal glRect inside 
glBegin-glEnd", "illegal glDrawArrays inside glBegin-glEnd", "illegal 
glDrawArrays inside glBegin-glEnd (2)", "separate glBegin-glVertex-glEnd 
lists", "illegal glBegin mode in display list"]}

PIGLIT: {"subtest": {"glCallList inside glBegin-glEnd" : "pass"}}
PIGLIT: {"subtest": {"nested glCallList inside glBegin-glEnd" : "pass"}}
PIGLIT: {"subtest": {"illegal glRect inside glBegin-glEnd" : "pass"}}
Probe color at (80,80)
  Expe

Re: [Piglit] Spec justification for test_illegal_begin_mode?

2020-11-26 Thread Brian Paul
On Wed, Nov 25, 2020 at 8:19 PM Ian Romanick  wrote:

> I was looking at the dlist-beginend subtest test_illegal_begin_mode.
> The test compiles a display list with GL_COMPILE_AND_EXECUTE mode.  The
> glBegin in the test uses an invalid mode.  This should generate a
> GL_INVALID_OPERATION error immediately.  The test checks this, and that
>

GL_INVALID_ENUM, actually, but anyway..


seems correct.
>
> The test then tries to execute the display list and checks for
> GL_INVALID_OPERATION again.  I believe this is incorrect.  Section 5.4
> ("Display Lists") of the OpenGL 1.0 spec (this is a gl-1.0 test, after
> all!) says:
>
> If mode is COMPILE_AND_EXECUTE then commands are executed as they
> are encountered, then placed in the display list.
>
> Section 2.5 ("GL Errors") of the OpenGL 1.0 spec says:
>
> In other cases, the command generating the error is ignored so that
> it has no effect on GL state or framebuffer contents.
>

Unfortunately, the spec doesn't clearly define what's meant by "ignored"
here.  That is, does it mean the command is not compiled into the display
list?  My intuition is that even if a command has invalid args at compile
time, the command should still be compiled into the list.  If the spec
doesn't spell out the answer, I'd opt to do whatever other vendors do
(hoping they're consistent).


While the section numbers and titles have changed, every later version
> of the GL (compatibility profile) spec says the exact same thing.
>
> To me, this indicates that the errant glBegin should not be included in
> the display list.  Assuming this test passes on other implementations, I
> think it does so only by luck.  The mis-matched glEnd in the display
> list will generate the same error.  Am I missing some spec language to
> justify this test?
>

I haven't searched, but I suspect the spec doesn't explicitly describe this
situation.


> I noticed this because I was adding a test that does
>
> glNewList(list, GL_COMPILE_AND_EXECUTE);
> glColor4fv(green);
> glBegin(GL_QUADS);
> glBegin(GL_QUADS);
> glVertex2f(-1, -1);
> glVertex2f( 1, -1);
> glVertex2f( 1, 0);
> glVertex2f(-1, 0);
> glEnd();
> glEndList();
>
> I expected an error while compiling the list, but I expected glCallList
> to not generate an error.  Errors are generated in both places.
>

I guess my instinct is that errors should be generated both at list compile
and execute time.  I wonder if there's any API function / argument
combinations that would be errant at compile time but not at execute time,
depending on some other state.  If so, that would indicate that calls
should always be compiled into the list, even if they generate an error at
compile time.


I think it gets worse.  There's a second part to this new subtest that
> replaces the errant glBegin call with glReadPixels.  glReadPixels is not
> allowed between glBegin and glEnd, so it should generate an error in
> GL_COMPILE_AND_EXECUTE mode.  It does not.
>

Sound like a run of the mill bug.


> These changes are in the top commit of:
>
> https://gitlab.freedesktop.org/idr/piglit/-/commits/display-list-hell
>
> I don't have any systems currently available with closed-source drivers,
> but I would be very interested to see the results of
> gl-1.0-dlist-beginend from that branch on any closed source drivers (on
> any platform).
>
>
I can check on Nvidia next week when I'm back.  Maybe someone else can test
in the mean time.

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


Re: [Piglit] [PATCH] s3tc-errors: Fix GCC unused-variable warning.

2019-04-23 Thread Brian Paul

On 04/22/2019 04:59 PM, Vinson Lee wrote:

s3tc-errors.c: In function ‘test_format’:
s3tc-errors.c:175:9: warning: unused variable ‘format2’ [-Wunused-variable]
   GLenum format2;
  ^~~

Fixes: d433792407e7 ("s3tc-errors: port to gles31")
Signed-off-by: Vinson Lee 
---
  tests/texturing/s3tc-errors.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index ccc0be9a785f..6b2658c9a1d1 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -171,8 +171,8 @@ test_format(int width, int height, GLfloat *image, GLenum 
requested_format)
  {
  #ifdef PIGLIT_USE_OPENGL
GLubyte *compressed_image;
-#endif
GLenum format2;
+#endif
int x, y, w, h;
GLuint tex;
bool pass = true;




Reviewed-by: Brian Paul 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Re: [Piglit] [PATCH] appveyor: Update instructions for personal repositories.

2019-03-13 Thread Brian Paul

Both patches look OK to me.

Reviewed-by: Brian Paul 

On 03/13/2019 08:16 AM, Jose Fonseca wrote:

With GitLab is now much easier to setup.
---
  appveyor.yml | 22 --
  1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 1f8779187..56f0d5a57 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,22 +1,16 @@
-# http://www.appveyor.com/docs/appveyor-yml
+# https://www.appveyor.com/docs/appveyor-yml
  #
  # To setup AppVeyor for your own personal repositories do the following:
-# - Sign up
+# - Go to https://gitlab.freedesktop.org/profile/personal_access_tokens and
+#   create a new token with 'api' and 'read_repository' access.
+# - Sign up to AppVeyor
  # - Add a new project
-# - Select Git and fill in the Git clone URL
-# - Setup a Git hook as explained in
-#   https://github.com/appveyor/webhooks#installing-git-hook
-# - Check 'Settings > General > Skip branches without appveyor.yml'
-# - Check 'Settings > General > Rolling builds'
-# - Setup the global or project notifications to your liking
-#
-# Note that kicking (or restarting) a build via the web UI will not work, as it
-# will fail to find appveyor.yml .  The Git hook is the most practical way to
-# kick a build.
+# - Select GitLab EE
+# - Fill GitLab URL as https://gitlab.freedesktop.org/ and paste the token 
above.
+# - Enable for your personal repository.
  #
  # See also:
-# - 
http://help.appveyor.com/discussions/problems/2209-node-grunt-build-specify-a-project-or-solution-file-the-directory-does-not-contain-a-project-or-solution-file
-# - 
http://help.appveyor.com/discussions/questions/1184-build-config-vs-appveyoryaml
+# - 
https://help.appveyor.com/discussions/questions/1184-build-config-vs-appveyoryaml
  
  version: '{build}'
  



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

Re: [Piglit] [PATCH v2] piglit/vbo: memory leak

2018-10-24 Thread Brian Paul
On 10/24/2018 05:20 AM, Sergii Romantsov wrote:
> Trivial fix of memory leaking for test 'initialized-vbo'.
> 
> v2: Rb added.
> 
> Fixes: 6a467e00cfae (security/initialized-vbo: test contents of uninitialized 
> VBOs)
> CC: Brian Paul 
> Signed-off-by: Sergii Romantsov 
> Reviewed-by: Ian Romanick 
> ---
>   tests/security/initialized-vbo.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tests/security/initialized-vbo.c 
> b/tests/security/initialized-vbo.c
> index 20c8155..16656bc 100644
> --- a/tests/security/initialized-vbo.c
> +++ b/tests/security/initialized-vbo.c
> @@ -70,6 +70,7 @@ piglit_display(void)
>   
>   glDeleteBuffers(1, );
>   
> + free(tmp);
>   return pass ? PIGLIT_PASS : PIGLIT_WARN;
>   }
>   
> 


Reviewed-by: Brian Paul 

Need me to push this for you?
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] Add a test for GL_AMD_framebuffer_multisample_advanced

2018-08-02 Thread Brian Paul

One minor thing below.

Otherwise, Reviewed-by: Brian Paul 

On 08/01/2018 05:21 PM, Marek Olšák wrote:

From: Marek Olšák 

---
  tests/opengl.py   |   6 +
  tests/spec/CMakeLists.txt |   1 +
  .../CMakeLists.gl.txt |  13 +
  .../CMakeLists.gles3.txt  |   4 +
  .../CMakeLists.txt|   1 +
  .../api.c | 252 ++
  6 files changed, 277 insertions(+)
  create mode 100644 
tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gl.txt
  create mode 100644 
tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gles3.txt
  create mode 100644 
tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.txt
  create mode 100644 tests/spec/amd_framebuffer_multisample_advanced/api.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 3ca4ee74b..6e21e9df7 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2922,20 +2922,26 @@ with profile.test_list.group_manager(
  g(['ext_framebuffer_multisample-clear', sample_count, 
buffer_type],
'clear {} {}'.format(sample_count, buffer_type))
  
  for test_type in ('depth', 'depth-computed', 'stencil'):

  for buffer_config in ('combined', 'separate', 'single'):
  g(['ext_framebuffer_multisample-no-color', sample_count,
 test_type, buffer_config],
'no-color {} {} {}'.format(
sample_count, test_type, buffer_config))
  
+with profile.test_list.group_manager(

+PiglitGLTest,
+grouptools.join('spec', 'amd_framebuffer_multisample_advanced')) as g:
+g(['amd_framebuffer_multisample_advanced-api'], 'api-glcore')
+g(['amd_framebuffer_multisample_advanced-api-gles'], 'api-gles3')
+
  with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'ext_framebuffer_object')) as g:
  g(['fbo-generatemipmap-noimage'])
  g(['fbo-1d'])
  g(['fbo-3d'])
  g(['fbo-alphatest-formats'])
  g(['fbo-alphatest-nocolor'])
  g(['fbo-alphatest-nocolor-ff'])
  g(['fbo-blending-formats'])
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 6cf3f76ed..26ee3ebf0 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -1,10 +1,11 @@
+add_subdirectory (amd_framebuffer_multisample_advanced)
  add_subdirectory (amd_performance_monitor)
  add_subdirectory (amd_pinned_memory)
  add_subdirectory (arb_arrays_of_arrays)
  add_subdirectory (arb_base_instance)
  add_subdirectory (arb_bindless_texture)
  add_subdirectory (arb_buffer_storage)
  add_subdirectory (arb_clear_buffer_object)
  add_subdirectory (arb_clear_texture)
  add_subdirectory (arb_clip_control)
  add_subdirectory (arb_color_buffer_float)
diff --git a/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gl.txt 
b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gl.txt
new file mode 100644
index 0..4bf8451b0
--- /dev/null
+++ b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (amd_framebuffer_multisample_advanced-api api.c)
+
+# vim: ft=cmake:
diff --git 
a/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gles3.txt 
b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gles3.txt
new file mode 100644
index 0..8d1096431
--- /dev/null
+++ b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.gles3.txt
@@ -0,0 +1,4 @@
+link_libraries(piglitutil_${piglit_target_api})
+
+piglit_add_executable (amd_framebuffer_multisample_advanced-api-gles api.c)
+# vim: ft=cmake:
diff --git a/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.txt 
b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.txt
new file mode 100644
index 0..144a306f4
--- /dev/null
+++ b/tests/spec/amd_framebuffer_multisample_advanced/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/amd_framebuffer_multisample_advanced/api.c 
b/tests/spec/amd_framebuffer_multisample_advanced/api.c
new file mode 100644
index 0..a1243d0d2
--- /dev/null
+++ b/tests/spec/amd_framebuffer_multisample_advanced/api.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright © 2018 Advanced Micro Devices, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following 

[Piglit] [PATCH 2/2] polygon-mode: also test polygon culling

2018-07-20 Thread Brian Paul
Test polygon culling with glPolygonMode for better coverage.
---
 tests/general/polygon-mode.c | 87 +++-
 1 file changed, 54 insertions(+), 33 deletions(-)

diff --git a/tests/general/polygon-mode.c b/tests/general/polygon-mode.c
index c41c392..709c6db 100644
--- a/tests/general/polygon-mode.c
+++ b/tests/general/polygon-mode.c
@@ -217,7 +217,7 @@ identify_primitive(const GLfloat positions[4][2],
 
 
 static GLboolean
-test_combo(GLenum frontMode, GLenum backMode)
+test_combo(GLenum frontMode, GLenum backMode, GLenum cullMode)
 {
GLenum frontPrim = get_prim_mode(frontMode);
GLenum backPrim = get_prim_mode(backMode);
@@ -225,26 +225,49 @@ test_combo(GLenum frontMode, GLenum backMode)
GLenum expectedPrims[4];
int i;
 
+   glDisable(GL_CULL_FACE);
+
/* Draw reference image */
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-   glDrawArrays(frontPrim, 0, 4);
-   glDrawArrays(backPrim, 4, 4);
-   glDrawArrays(frontPrim, 8, 4);
-   glDrawArrays(backPrim, 12, 4);
+   if (cullMode == GL_NONE || cullMode == GL_BACK) {
+  glDrawArrays(frontPrim, 0, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+  glDrawArrays(backPrim, 4, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_BACK) {
+  glDrawArrays(frontPrim, 8, 4);
+   }
+   if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+  glDrawArrays(backPrim, 12, 4);
+   }
 
/* determine what kind of primitives were drawn */
for (i = 0; i < 4; i++) {
-  GLenum testMode = (i & 1) ? backMode : frontMode;
+  GLenum testMode = GL_NONE;
+
+  if (i & 1) {
+/* back-facing quad */
+if (cullMode == GL_NONE || cullMode == GL_FRONT) {
+   testMode = backMode;
+}
+  } else {
+/* front-facing quad */
+if (cullMode == GL_NONE || cullMode == GL_BACK) {
+   testMode = frontMode;
+}
+  }
 
   expectedPrims[i] = identify_primitive([4 * i], Colors[4 * i]);
 
   if (expectedPrims[i] != testMode) {
  /* we didn't get the expected reference primitive */
  fprintf(stderr,
- "%s: reference drawing failed for frontPrim=%s, 
backPrim=%s\n",
+ "%s: reference drawing failed for frontPrim=%s, backPrim=%s, 
cull=%s\n",
  TestName, piglit_get_gl_enum_name(frontMode),
-piglit_get_gl_enum_name(backMode));
+piglit_get_gl_enum_name(backMode),
+piglit_get_gl_enum_name(cullMode));
 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
 i, piglit_get_gl_enum_name(expectedPrims[i]),
 piglit_get_gl_enum_name(testMode));
@@ -256,15 +279,22 @@ test_combo(GLenum frontMode, GLenum backMode)
glClear(GL_COLOR_BUFFER_BIT);
glPolygonMode(GL_FRONT, frontMode);
glPolygonMode(GL_BACK, backMode);
+   if (cullMode == GL_NONE) {
+  glDisable(GL_CULL_FACE);
+   } else {
+  glEnable(GL_CULL_FACE);
+  glCullFace(cullMode);
+   }
glDrawArrays(GL_QUADS, 0, 16);
 
/* check that these prims match the reference prims */
for (i = 0; i < 4; i++) {
   GLenum prim = identify_primitive([4 * i], Colors[4 * i]);
   if (prim != expectedPrims[i]) {
- fprintf(stderr, "%s: glPolygonMode(front=%s, back=%s) failed\n",
+ fprintf(stderr, "%s: glPolygonMode(front=%s, back=%s), glCullMode(%s) 
failed\n",
  TestName, piglit_get_gl_enum_name(frontMode),
-piglit_get_gl_enum_name(backMode));
+piglit_get_gl_enum_name(backMode),
+piglit_get_gl_enum_name(cullMode));
 fprintf(stderr, "At position %d, found prim %s instead of %s\n",
 i, piglit_get_gl_enum_name(prim),
 piglit_get_gl_enum_name(expectedPrims[i]));
@@ -281,7 +311,12 @@ test_combo(GLenum frontMode, GLenum backMode)
 static GLboolean
 test_polygonmode(void)
 {
+   static const GLenum cullModes[] =
+  { GL_NONE, GL_FRONT, GL_BACK, GL_FRONT_AND_BACK };
+   static const GLenum fillModes[] =
+  { GL_FILL, GL_LINE, GL_POINT };
GLenum pass = GL_TRUE;
+   int i, j, k;
 
glVertexPointer(2, GL_FLOAT, 0, Positions);
glColorPointer(4, GL_FLOAT, 0, Colors);
@@ -289,29 +324,15 @@ test_polygonmode(void)
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
 
-   if (!test_combo(GL_FILL, GL_LINE))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_FILL, GL_POINT))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_POINT, GL_LINE))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_POINT, GL_FILL))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_LINE, GL_FILL))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_LINE, GL_POINT))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_LINE, GL_LINE))
-  pass = GL_FALSE;
-
-   if (!test_combo(GL_POINT, GL_POINT))
-  pass = GL_FALSE;
+   for (i = 0; i < ARRAY_SIZE(cullModes); 

[Piglit] [PATCH 1/2] Prevent loop unrolling in a shader test

2018-07-20 Thread Brian Paul
The GLSL compiler can easily unroll this loop and simplify the function
down to a single assignment.  That defeats the purpose of the test.
Replace literals with uniforms to prevent unrolling.
---
 tests/shaders/glsl-vs-loop-break.shader_test | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/shaders/glsl-vs-loop-break.shader_test 
b/tests/shaders/glsl-vs-loop-break.shader_test
index cb8dbee..66cfeb2 100644
--- a/tests/shaders/glsl-vs-loop-break.shader_test
+++ b/tests/shaders/glsl-vs-loop-break.shader_test
@@ -3,12 +3,14 @@ GLSL >= 1.10
 
 [vertex shader]
 varying vec4 color;
+uniform int iters;
+uniform int target;
 void main()
 {
gl_Position = gl_Vertex;
 
-   for (int i = 0; i < 8; i++) {
-   if (i > 4) {
+   for (int i = 0; i < iters; i++) {
+   if (i > target) {
color = vec4(0.0, 1.0, 0.0, 0.0);
break;
}
@@ -24,5 +26,7 @@ void main()
 }
 
 [test]
+uniform int iters 8
+uniform int target 4
 draw rect -1 -1 2 2
 relative probe rgb (0.03, 0.25) (0.0, 1.0, 0.0)
-- 
2.7.4

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


Re: [Piglit] [PATCH 6/9] tests/opengl: Add glx-swap-copy

2018-07-02 Thread Brian Paul

On 06/27/2018 11:32 AM, Dylan Baker wrote:

Fixes: 2a7047a32bb3a9a4fad5bea0a8185d63af6bddf3
("glx: Introduce a glx-swap-copy test v2")
CC: Thomas Hellstrom 
CC: Brian Paul 
---
  tests/opengl.py | 1 +
  1 file changed, 1 insertion(+)

diff --git a/tests/opengl.py b/tests/opengl.py
index 00bce15af..a83d235c1 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -401,6 +401,7 @@ with profile.test_list.group_manager(
  g(['glx-swap-pixmap'], run_concurrent=False)
  g(['glx-swap-pixmap-bad'], run_concurrent=False)
  g(['glx-swap-singlebuffer'], run_concurrent=False)
+g(['glx-swap-copy'], run_concurrent=False)
  g(['glx-make-current'], run_concurrent=False)
  g(['glx-make-glxdrawable-current'], run_concurrent=False)
  g(['glx-context-flush-control'], run_concurrent=False)




Reviewed-by: Brian Paul 
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] arb_provoking_vertex: Test flat shading with clipped geometry

2018-06-14 Thread Brian Paul
Does this test do anything that isn't already done by the existing 
clipflat.c test?


-Brian

On 06/14/2018 03:41 AM, Danylo Piliaiev wrote:

There is a hardware bug in i965/gen9+ with provoking vertices.
Test if workaround works correctly.

Ref: 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D103047=02%7C01%7Cbrianp%40vmware.com%7Cf6ec4bfb4928411d446708d5d1db05bf%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C1%7C636645660990175348=1XPX5QNMBxDkNPHQnH9ydaq5NjCqBdDmWId5pl0vnb8%3D=0

v2: - Vertices now have distinctive color
 - Update  message to reflect a nature of the bug which was
   clarified by Kenneth. He will also provide workaround later.

Signed-off-by: Danylo Piliaiev 
---
  tests/opengl.py|  1 +
  tests/spec/arb_provoking_vertex/CMakeLists.gl.txt  |  1 +
  .../clipped-geometry-flatshading.c | 81 ++
  3 files changed, 83 insertions(+)
  create mode 100644 
tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 3109a5e..313b22b 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -2205,6 +2205,7 @@ with profile.test_list.group_manager(
  g(['arb-provoking-vertex-control'], run_concurrent=False)
  g(['arb-provoking-vertex-initial'], run_concurrent=False)
  g(['arb-provoking-vertex-render'], run_concurrent=False)
+g(['arb-provoking-vertex-clipped-geometry-flatshading'], 
run_concurrent=False)
  g(['arb-quads-follow-provoking-vertex'], run_concurrent=False)
  g(['arb-xfb-before-flatshading'], run_concurrent=False)
  
diff --git a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt

index 6dd15bb..3acffc6 100644
--- a/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
+++ b/tests/spec/arb_provoking_vertex/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
  piglit_add_executable (arb-provoking-vertex-control 
provoking-vertex-control.c)
  piglit_add_executable (arb-provoking-vertex-initial 
provoking-vertex-initial.c)
  piglit_add_executable (arb-provoking-vertex-render render.c)
+piglit_add_executable (arb-provoking-vertex-clipped-geometry-flatshading 
clipped-geometry-flatshading.c)
  piglit_add_executable (arb-quads-follow-provoking-vertex 
quads-follow-provoking-vertex.c)
  piglit_add_executable (arb-xfb-before-flatshading xfb-before-flatshading.c)
  
diff --git a/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c

new file mode 100644
index 000..72acb4d
--- /dev/null
+++ b/tests/spec/arb_provoking_vertex/clipped-geometry-flatshading.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2018 Danylo Piliaiev
+ *
+ * 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.
+ */
+
+/**
+ * Test that provoking vertex works as expected when part of the geometry
+ * is clipped when flat shading is enabled.
+ *
+ * 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.freedesktop.org%2Fshow_bug.cgi%3Fid%3D103047=02%7C01%7Cbrianp%40vmware.com%7Cf6ec4bfb4928411d446708d5d1db05bf%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C1%7C636645660990175348=1XPX5QNMBxDkNPHQnH9ydaq5NjCqBdDmWId5pl0vnb8%3D=0
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_EXT_provoking_vertex");
+   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+
+   glShadeModel(GL_FLAT);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+   static const float red[3] = {1, 0, 0},
+   green[3] = {0, 1, 0},
+   blue[3] = {0, 0, 1},
+   yellow[3] = {1, 1, 0},
+   

Re: [Piglit] [PATCH v2] add GL_ARB_sample_locations

2018-05-24 Thread Brian Paul
I took a quick look and I'm OK with it.  If anyone else wants to review 
it more closely, please do so soon.


Reviewed-by: Brian Paul <bri...@vmware.com>


On 05/24/2018 12:55 PM, Rhys Perry wrote:

Ping I guess?

On Mon, May 7, 2018 at 5:19 PM, Rhys Perry <pendingchao...@gmail.com> wrote:

Changelog:
v2:
- Rebase to handle meta profiles.

---
  tests/opengl.py   |   6 +
  tests/quick_gl.py |   7 +
  tests/spec/CMakeLists.txt |   1 +
  tests/spec/arb_sample_locations/CMakeLists.gl.txt |  11 +
  tests/spec/arb_sample_locations/CMakeLists.txt|   1 +
  tests/spec/arb_sample_locations/test.c| 290 ++
  6 files changed, 316 insertions(+)
  create mode 100644 tests/spec/arb_sample_locations/CMakeLists.gl.txt
  create mode 100644 tests/spec/arb_sample_locations/CMakeLists.txt
  create mode 100644 tests/spec/arb_sample_locations/test.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 825e0bf83..46b26b2ac 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -4840,5 +4840,11 @@ with profile.test_list.group_manager(
  g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs')
  g(['arb_bindless_texture-uniform'], 'uniform')

+# Group ARB_sample_locations
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'ARB_sample_locations')) as g:
+g(['arb_sample_locations'], 'test')
+
  if platform.system() is 'Windows':
  profile.filters.append(lambda p, _: not p.startswith('glx'))
diff --git a/tests/quick_gl.py b/tests/quick_gl.py
index c6501904c..1f5d4d960 100644
--- a/tests/quick_gl.py
+++ b/tests/quick_gl.py
@@ -60,6 +60,13 @@ with profile.test_list.group_manager(
  with profile.test_list.allow_reassignment:
  g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func')

+# Set the --quick flag on the GL_ARB_sample_locations test
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_sample_locations')) as g:
+with profile.test_list.allow_reassignment:
+g(['arb_sample_locations', '--quick'], 'test')
+
  # Limit texture size to 512x512 for some texture_multisample tests.
  # The default (max supported size) can be pretty slow.
  with profile.test_list.group_manager(
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 405d35a53..941e56805 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -45,6 +45,7 @@ add_subdirectory (arb_point_parameters)
  add_subdirectory (arb_point_sprite)
  add_subdirectory (arb_provoking_vertex)
  add_subdirectory (arb_robustness)
+add_subdirectory (arb_sample_locations)
  add_subdirectory (arb_sample_shading)
  add_subdirectory (arb_sampler_objects)
  add_subdirectory (arb_seamless_cube_map)
diff --git a/tests/spec/arb_sample_locations/CMakeLists.gl.txt 
b/tests/spec/arb_sample_locations/CMakeLists.gl.txt
new file mode 100644
index 0..c4652699f
--- /dev/null
+++ b/tests/spec/arb_sample_locations/CMakeLists.gl.txt
@@ -0,0 +1,11 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_sample_locations test.c)
diff --git a/tests/spec/arb_sample_locations/CMakeLists.txt 
b/tests/spec/arb_sample_locations/CMakeLists.txt
new file mode 100644
index 0..144a306f4
--- /dev/null
+++ b/tests/spec/arb_sample_locations/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_sample_locations/test.c 
b/tests/spec/arb_sample_locations/test.c
new file mode 100644
index 0..f83b17894
--- /dev/null
+++ b/tests/spec/arb_sample_locations/test.c
@@ -0,0 +1,290 @@
+#include "piglit-util-gl.h"
+
+/**
+ * @file test.c
+ *
+ * This test verifies that GL_ARB_sample_locations is implemented correctly.
+ * It does so by retrieving the sample positions using gl_SamplePosition,
+ * interpolateAtSample() and a method described in
+ * 
https://urldefense.proofpoint.com/v2/url?u=https-3A__mynameismjp.wordpress.com_2010_07_07_msaa-2Dsample-2Dpattern-2Ddetector_=DwIBaQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=BjLC1YxlRyoT7nYPqsqgLQdA-EJksEam2pQ9fECOtW8=HTkf6lGUjxGK2QwYJuUdP4OvnMRNZnJY8Cg7exCfDkc=
+ * which draws a rectangle covering each possible sample location within a 
pixel.
+ * Each rectangle writes it's position within the pixel, which is then read
+ * through a shader.
+ *
+ * The retrieved sample locations are then tested against expectations. This is
+ * done with various MSAA levels and sample locations.
+ *
+ * The test can be rather slow by default, but it can be made less exhaustive 
by
+ * passing the argument --quick.
+ *
+ * Sample locations are typically represented in this test as 0.4 fixed point
+ * integers where 0 is the top.
+ */
+
+/* new_locations in do_test_set() nee

Re: [Piglit] [PATCH v2] util: provide way to read a texture in ES compatible way

2018-05-21 Thread Brian Paul

On 05/21/2018 05:53 AM, Tapani Pälli wrote:

Implementation supports GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY
and affects following functions:

- piglit_probe_texel_rect_rgba
- piglit_probe_texel_volume_rgba

v2: use read_texture only on GL ES
 fix indentation issues

Signed-off-by: Tapani Pälli 
---
  tests/util/piglit-util-gl.c | 121 +---
  1 file changed, 115 insertions(+), 6 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 2443be03e..271cca4a8 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1882,6 +1882,99 @@ piglit_probe_image_ubyte(int x, int y, int w, int h, 
GLenum format,
return 1;
  }
  
+static GLuint

+create_fbo_from_texture(GLenum target, GLint texture, GLint level, GLint layer)
+{
+   GLuint fbo;
+
+   glGenFramebuffers(1, );
+   glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+   if (layer > 0) {
+   glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ texture, level, layer);
+   } else {
+   glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+  target, texture, level);
+   }
+
+   assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) ==
+  GL_FRAMEBUFFER_COMPLETE);
+   return fbo;
+}
+
+static GLenum
+binding_from_target(GLenum target)
+{
+   switch (target) {
+   case GL_TEXTURE_2D:
+   return GL_TEXTURE_BINDING_2D;
+   case GL_TEXTURE_2D_ARRAY:
+   return GL_TEXTURE_BINDING_2D_ARRAY;
+   default:
+   fprintf(stderr, "%s: unsupported target 0x%x\n",
+   __func__, target);
+   return 0;
+   }
+}
+
+/**
+ * Read texels in OpenGL ES compatible way.
+ *
+ * Currently bound texture is attached to a framebuffer object and
+ * contents are read using glReadPixels. Supported targets are
+ * GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY.
+ */
+static GLfloat *
+read_texture(int target, int level, int x, int y, int layer, int w, int h)


Maybe read_texture_es() or read_texture_via_fbo() to be a bit less generic?



+{
+   GLint width, height, depth;
+   GLint current_read_fbo, current_draw_fbo, current_texture;
+   GLenum binding = binding_from_target(target);
+   unsigned char *buf;
+   GLfloat *buffer;
+   unsigned offset;
+
+   assert(binding != 0);
+
+   glGetIntegerv(binding, _texture);
+   glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, _read_fbo);
+   glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, _draw_fbo);
+
+   assert(target == GL_TEXTURE_2D || target == GL_TEXTURE_2D_ARRAY);
+
+   glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, );
+   glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, );
+   glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, );
+
+   buffer = malloc(width * height * depth * 4 * sizeof(GLfloat));
+   buf = malloc(width * height * depth * 4 * sizeof(unsigned char));


Aren't we always returning a 2D image?  If so, why 'depth' here?


+
+   GLuint fbo =
+   create_fbo_from_texture(target, current_texture, level, layer);
+   assert(fbo != 0);
+
+   /* Offset to the layer we are expected to read. */
+   offset = layer * (width * height * 4);


If we're always returning a 2D image, I don't think we need the offset.



+
+   glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
+buf + offset);
+
+   for (unsigned k = offset; k < offset + width * height * 4; k++)
+   buffer[k] = ((float) buf[k]) / 255.0;


Wondering about the offset here too.

At the very least, I think more comments are needed to explain what's 
going on if I'm misunderstanding this.


Thanks.

-Brian


+
+   free(buf);
+
+   glDeleteFramebuffers(1, );
+
+   /* Restore FBO state. */
+   glBindFramebuffer(GL_READ_FRAMEBUFFER, current_read_fbo);
+   glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current_draw_fbo);
+
+   return buffer;
+}
+
+
  /**
   * Read a texel rectangle from the given location and compare its RGB value to
   * the given expected values.
@@ -1957,10 +2050,18 @@ int piglit_probe_texel_rect_rgba(int target, int level, 
int x, int y,
  
  	glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, );

glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, );
-   buffer = malloc(width * height * 4 * sizeof(GLfloat));
-
-   glGetTexImage(target, level, GL_RGBA, GL_FLOAT, buffer);
  
+#ifndef PIGLIT_USE_OPENGL

+   if (target == GL_TEXTURE_2D) {
+   buffer = read_texture(target, level, x, y, 0, w, h);
+   } else {
+#else
+   buffer = malloc(width * height * 4 * sizeof(GLfloat));
+   glGetTexImage(target, level, GL_RGBA, GL_FLOAT, buffer);
+#endif
+#ifndef PIGLIT_USE_OPENGL
+   }
+#endif

Re: [Piglit] [PATCH 1/2] util: provide way to read a texture in ES compatible way

2018-05-18 Thread Brian Paul
It looks like this will bypass glGetTexImage even for desktop GL.  We 
may loose some test coverage because of that.  Could we do the 
fbo/ReadPixels work-around only on ES?


One indentation issue below.

-Brian


On 05/18/2018 02:29 AM, Tapani Pälli wrote:
Any comments? I'm planning to push this in soon to be able to push 
oes_texture_view changes to Mesa.


On 05/11/2018 01:17 PM, Tapani Pälli wrote:

Implementation supports GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY
and affects following functions:

    - piglit_probe_texel_rect_rgba
    - piglit_probe_texel_volume_rgba

Signed-off-by: Tapani Pälli 
---
  tests/util/piglit-util-gl.c | 109 
++--

  1 file changed, 105 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 2443be03e..f6a83e717 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1882,6 +1882,99 @@ piglit_probe_image_ubyte(int x, int y, int w, 
int h, GLenum format,

  return 1;
  }
+static GLuint
+create_fbo_from_texture(GLenum target, GLint texture, GLint level, 
GLint layer)

+{
+    GLuint fbo;
+
+    glGenFramebuffers(1, );
+    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+    if (layer > 0) {
+    glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+  texture, level, layer);
+    } else {
+    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+   target, texture, level);
+    }
+
+    assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) ==
+   GL_FRAMEBUFFER_COMPLETE);
+    return fbo;
+}
+
+static GLenum
+binding_from_target(GLenum target)
+{
+    switch (target)    {
+    case GL_TEXTURE_2D:
+    return GL_TEXTURE_BINDING_2D;
+    case GL_TEXTURE_2D_ARRAY:
+    return GL_TEXTURE_BINDING_2D_ARRAY;
+    default:
+    fprintf(stderr, "%s: unsupported target 0x%x\n",
+    __func__, target);
+    return 0;
+    }
+}
+
+/**
+ * Read texels in OpenGL ES compatible way.
+ *
+ * Currently bound texture is attached to a framebuffer object and
+ * contents are read using glReadPixels. Supported targets are
+ * GL_TEXTURE_2D, GL_TEXTURE_2D_ARRAY.
+ */
+static GLfloat *
+read_texture(int target, int level, int x, int y, int layer, int w, 
int h)

+{
+    GLint width, height, depth;
+    GLint current_read_fbo, current_draw_fbo, current_texture;
+    GLenum binding = binding_from_target(target);
+    unsigned char *buf;
+    GLfloat *buffer;
+    unsigned offset;
+
+    assert(binding != 0);
+
+    glGetIntegerv(binding, _texture);
+    glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, _read_fbo);
+    glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, _draw_fbo);
+
+    assert(target == GL_TEXTURE_2D || target == GL_TEXTURE_2D_ARRAY);
+
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, );
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, );
+    glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, );
+
+    buffer = malloc(width * height * depth * 4 * sizeof(GLfloat));
+    buf = malloc(width * height * depth * 4 * sizeof(unsigned char));
+
+    GLuint fbo =
+    create_fbo_from_texture(target, current_texture, level, layer);
+    assert(fbo != 0);
+
+    /* Offset to the layer we are expected to read. */
+    offset = layer * (width * height * 4);
+
+    glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
+ buf + offset);
+
+    for (unsigned k = offset; k < offset + width * height * 4; k++)
+    buffer[k] = ((float) buf[k]) / 255.0;
+
+    free(buf);
+
+    glDeleteFramebuffers(1, );
+
+    /* Restore FBO state. */
+    glBindFramebuffer(GL_READ_FRAMEBUFFER, current_read_fbo);
+    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current_draw_fbo);
+
+    return buffer;
+}
+
+
  /**
   * Read a texel rectangle from the given location and compare its 
RGB value to

   * the given expected values.
@@ -1957,9 +2050,13 @@ int piglit_probe_texel_rect_rgba(int target, 
int level, int x, int y,

  glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, );
  glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, 
);

-    buffer = malloc(width * height * 4 * sizeof(GLfloat));
-    glGetTexImage(target, level, GL_RGBA, GL_FLOAT, buffer);
+    if (target == GL_TEXTURE_2D) {
+    buffer = read_texture(target, level, x, y, 0, w, h);
+    } else {
+    buffer = malloc(width * height * 4 * sizeof(GLfloat));
+    glGetTexImage(target, level, GL_RGBA, GL_FLOAT, buffer);
+    }
  assert(x >= 0);
  assert(y >= 0);
@@ -2021,9 +2118,13 @@ int piglit_probe_texel_volume_rgba(int target, 
int level, int x, int y, int z,

  glGetTexLevelParameteriv(target, level, GL_TEXTURE_WIDTH, );
  glGetTexLevelParameteriv(target, level, GL_TEXTURE_HEIGHT, 
);

  glGetTexLevelParameteriv(target, level, GL_TEXTURE_DEPTH, );
-    buffer = malloc(width * height * depth * 4 * sizeof(GLfloat));
-    glGetTexImage(target, 

Re: [Piglit] [PATCH v4] tests: add nvidia conservative rasterization tests

2018-05-10 Thread Brian Paul

Reviewed-by: Brian Paul <bri...@vmware.com>

Though, I can't help but think that we could do something better for the 
drawing test.


My first approach would be to draw a triangle with conservative 
rasterization on then off and compare how many pixels are written.  The 
conservative rasterization should generate more fragments than the 
normal rasterization.  And the difference should, I think, be 
proportional to the perimeter of the triangle.  As long as there's no 
vertical/horizontal edges exactly on pixel bounds.


Another approach would be to draw two adjacent gray triangles with 
blend-add mode and check that pixels along the shared edge are white 
(hit twice).


What do you think?

-Brian


On 05/09/2018 02:05 PM, Rhys Perry wrote:

Ping I guess?

On Fri, Mar 30, 2018 at 10:56 PM, Rhys Perry <pendingchao...@gmail.com> wrote:

Adds tests for GL_NV_conservative_raster, GL_NV_conservative_raster_dilate
and GL_NV_conservative_raster_pre_snap_triangles.

Changes in v2:
- cleanup the tests
- fix some test failures
- remove the gles version of the dilation test as the extension is not
   exposed in gl.xml
Changes in v3:
- fix accidently luck-based pre-snap-triangles test
Changes in v4:
- apply formatting changes
- elaborate on various comments describing the test source code files

Signed-off-by: Rhys Perry <pendingchao...@gmail.com>
---
I am new to this project and don't have commit access.

  tests/all.py   |  20 ++
  tests/spec/CMakeLists.txt  |   3 +
  .../spec/nv_conservative_raster/CMakeLists.gl.txt  |  13 +
  .../nv_conservative_raster/CMakeLists.gles2.txt|   3 +
  tests/spec/nv_conservative_raster/CMakeLists.txt   |   1 +
  tests/spec/nv_conservative_raster/attrib.c | 107 +++
  tests/spec/nv_conservative_raster/dlist.c  | 110 +++
  tests/spec/nv_conservative_raster/draw.c   | 338 +
  .../CMakeLists.gl.txt  |  11 +
  .../nv_conservative_raster_dilate/CMakeLists.txt   |   1 +
  tests/spec/nv_conservative_raster_dilate/draw.c| 151 +
  .../CMakeLists.gl.txt  |  11 +
  .../CMakeLists.gles2.txt   |   3 +
  .../CMakeLists.txt |   1 +
  .../draw.c | 148 +
  15 files changed, 921 insertions(+)
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.gl.txt
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.gles2.txt
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster/attrib.c
  create mode 100644 tests/spec/nv_conservative_raster/dlist.c
  create mode 100644 tests/spec/nv_conservative_raster/draw.c
  create mode 100644 tests/spec/nv_conservative_raster_dilate/CMakeLists.gl.txt
  create mode 100644 tests/spec/nv_conservative_raster_dilate/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster_dilate/draw.c
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.gl.txt
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.gles2.txt
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster_pre_snap_triangles/draw.c

diff --git a/tests/all.py b/tests/all.py
index 7c8580ef0..5fa219ca0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4995,5 +4995,25 @@ with profile.test_list.group_manager(
  g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs')
  g(['arb_bindless_texture-uniform'], 'uniform')

+# Group NV_conservative_raster
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster')) as g:
+g(['nv_conservative_raster-draw'], 'draw')
+g(['nv_conservative_raster-dlist'], 'dlist')
+g(['nv_conservative_raster-attrib'], 'attrib')
+
+# Group NV_conservative_raster_dilate
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster_dilate')) as g:
+g(['nv_conservative_raster_dilate-draw'], 'draw')
+
+# Group NV_conservative_raster_pre_snap_triangles
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster_pre_snap_triangles')) 
as g:
+g(['nv_conservative_raster_pre_snap_triangles-draw'], 'draw')
+
  if platform.system() is 'Windows':
  profile.filters.append(lambda p, _: not p.startswith('glx'))
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index dc14beb4e..a0bc845c5 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -101,6 +101,9 @@ add_subdirectory (ext_texture_swizzle)
  add_subdirectory (ext_timer_query)
  add_subdirectory (ext_transform_feedback)
  add_subdirectory (nv_conditional_render)

Re: [Piglit] [PATCH v2] ext_packed_float: Add a test that queries GL_RGBA_SIGNED_COMPONENTS_EXT

2018-05-09 Thread Brian Paul

Reviewed-by: Brian Paul <bri...@vmware.com>

Thanks, Timothy!


On 05/09/2018 05:52 PM, Timothy Arceri wrote:

From: Bruce Merry <bme...@gmail.com>

V2 (Timothy Arceri):
  - use piglit_get_gl_enum_name()
  - use ARRAY_SIZE()
  - set config.khr_no_error_support

Cc: Brian Paul <bri...@vmware.com>
Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D73096=DwIBAQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=sTpUQmyOGL91bvssjpEHJtUmlOt4TnqBYzGCTQ-2AjI=Uwftee8YPacZLs7kLj4tq-aSShze4d26ueEaOGzX5fg=
---
  tests/opengl.py   |   1 +
  tests/spec/ext_packed_float/CMakeLists.gl.txt |   1 +
  .../query-rgba-signed-components.c| 162 ++
  3 files changed, 164 insertions(+)
  create mode 100644 tests/spec/ext_packed_float/query-rgba-signed-components.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 825e0bf83..347e8c5d4 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -3175,6 +3175,7 @@ with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'ext_packed_float')) as g:
  g(['ext_packed_float-pack'], 'pack')
+g(['query-rgba-signed-components'], 'query-rgba-signed-components')
  g(['getteximage-invalid-format-for-packed-type'],
'getteximage-invalid-format-for-packed-type')
  add_msaa_formats_tests(g, 'GL_EXT_packed_float')
diff --git a/tests/spec/ext_packed_float/CMakeLists.gl.txt 
b/tests/spec/ext_packed_float/CMakeLists.gl.txt
index 44a8818c8..b061cb6b2 100644
--- a/tests/spec/ext_packed_float/CMakeLists.gl.txt
+++ b/tests/spec/ext_packed_float/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
  
  piglit_add_executable (ext_packed_float-pack pack.c)

  piglit_add_executable (getteximage-invalid-format-for-packed-type 
getteximage-invalid-format-for-packed-type.c)
+piglit_add_executable (query-rgba-signed-components 
query-rgba-signed-components.c)
  
  # vim: ft=cmake:

diff --git a/tests/spec/ext_packed_float/query-rgba-signed-components.c 
b/tests/spec/ext_packed_float/query-rgba-signed-components.c
new file mode 100644
index 0..f5c0047fa
--- /dev/null
+++ b/tests/spec/ext_packed_float/query-rgba-signed-components.c
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2013 Bruce Merry
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COYPRIGTH
+ * HOLDERS AND/OR THEIR SUPPLIERS 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"
+
+typedef struct {
+   GLenum format;
+   const char *extension;
+   int expected[4];
+   int buffer; /* Draw buffer to attach the renderbuffer to */
+} format_info;
+
+static const format_info formats[] = {
+   { GL_RGBA8, NULL, { 0, 0, 0, 0 } },
+   { GL_R8I, "GL_ARB_texture_rg", { 1, 0, 0, 0 } },
+   { GL_RG8I, "GL_ARB_texture_rg", { 1, 1, 0, 0 } },
+   { GL_R8_SNORM, "GL_EXT_texture_snorm", { 1, 0, 0, 0 } },
+   { GL_LUMINANCE8_SNORM, "GL_EXT_texture_snorm", { 1, 1, 1, 0 } },
+   { GL_RGBA8UI_EXT, "GL_EXT_texture_integer", { 0, 0, 0, 0 } },
+   { GL_RGBA16F_ARB, "GL_ARB_texture_float", { 1, 1, 1, 1 } },
+   { GL_LUMINANCE16F_ARB, "GL_ARB_texture_float", { 1, 1, 1, 0 } },
+   { GL_RGB9_E5_EXT, "GL_EXT_texture_shared_exponent", { 0, 0, 0, 0 } },
+   { GL_R11F_G11F_B10F_EXT, "GL_EXT_packed_float", { 0, 0, 0, 0 } },
+   { GL_RGBA16F_ARB, "GL_ARB_texture_float", { 0, 0, 0, 0 }, 1 }
+};
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+   /* Should never be reached */
+   return PIGLIT_FAIL;
+}
+
+/* Queries GL_RGBA_SIGNED_COMPONENTS_EXT

Re: [Piglit] [PATCH] ext_packed_float: Add a test that queries GL_RGBA_SIGNED_COMPONENTS_EXT

2018-05-09 Thread Brian Paul

Minor things below.

-Brian

On 05/09/2018 12:13 AM, Timothy Arceri wrote:

From: Bruce Merry <bme...@gmail.com>

Cc: Brian Paul <bri...@vmware.com>
Bugzilla: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D73096=DwIBAQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=K7EzhJILOr1w_DQt9GuR7_BVUkIV83zFlObLq3eo-Rk=av-uP6XeQB05-iaIJnhRtBPNizb9NRb-1e_J5oSQu94=
---

  I came across this test when cleaning up bugzilla. Seems we fixed
  Mesa but never pushed the piglit test.

  tests/all.py  |   1 +
  tests/spec/ext_packed_float/CMakeLists.gl.txt |   1 +
  .../query-rgba-signed-components.c| 167 ++
  3 files changed, 169 insertions(+)
  create mode 100644 tests/spec/ext_packed_float/query-rgba-signed-components.c

diff --git a/tests/all.py b/tests/all.py
index 26638cd82..db85f172e 100644
--- a/tests/all.py
+++ b/tests/all.py


This will need to be rebased on ToT since all.py is gone.



@@ -3331,6 +3331,7 @@ with profile.test_list.group_manager(
  PiglitGLTest,
  grouptools.join('spec', 'ext_packed_float')) as g:
  g(['ext_packed_float-pack'], 'pack')
+g(['query-rgba-signed-components'], 'query-rgba-signed-components')
  g(['getteximage-invalid-format-for-packed-type'],
'getteximage-invalid-format-for-packed-type')
  add_msaa_formats_tests(g, 'GL_EXT_packed_float')
diff --git a/tests/spec/ext_packed_float/CMakeLists.gl.txt 
b/tests/spec/ext_packed_float/CMakeLists.gl.txt
index 44a8818c8..b061cb6b2 100644
--- a/tests/spec/ext_packed_float/CMakeLists.gl.txt
+++ b/tests/spec/ext_packed_float/CMakeLists.gl.txt
@@ -10,5 +10,6 @@ link_libraries (
  
  piglit_add_executable (ext_packed_float-pack pack.c)

  piglit_add_executable (getteximage-invalid-format-for-packed-type 
getteximage-invalid-format-for-packed-type.c)
+piglit_add_executable (query-rgba-signed-components 
query-rgba-signed-components.c)
  
  # vim: ft=cmake:

diff --git a/tests/spec/ext_packed_float/query-rgba-signed-components.c 
b/tests/spec/ext_packed_float/query-rgba-signed-components.c
new file mode 100644
index 0..635d5bc5a
--- /dev/null
+++ b/tests/spec/ext_packed_float/query-rgba-signed-components.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2013 Bruce Merry
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COYPRIGTH
+ * HOLDERS AND/OR THEIR SUPPLIERS 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"
+
+#define MAKE_FORMAT_STR(x) x, #x
+
+typedef struct {
+   GLenum format;
+   const char *format_str;
+   const char *extension;
+   int expected[4];
+   int buffer; /* Draw buffer to attach the renderbuffer to */
+} format_info;
+
+static const format_info formats[] = {
+   { MAKE_FORMAT_STR(GL_RGBA8), NULL, { 0, 0, 0, 0 } },


We can rm the MAKE_FORMAT_STR stuff now and use piglit_get_gl_enum_name().



+   { MAKE_FORMAT_STR(GL_R8I), "GL_ARB_texture_rg", { 1, 0, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_RG8I), "GL_ARB_texture_rg", { 1, 1, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_R8_SNORM), "GL_EXT_texture_snorm", { 1, 0, 0, 0 } 
},
+   { MAKE_FORMAT_STR(GL_LUMINANCE8_SNORM), "GL_EXT_texture_snorm", { 1, 1, 
1, 0 } },
+   { MAKE_FORMAT_STR(GL_RGBA8UI_EXT), "GL_EXT_texture_integer", { 0, 0, 0, 
0 } },
+   { MAKE_FORMAT_STR(GL_RGBA16F_ARB), "GL_ARB_texture_float", { 1, 1, 1, 1 
} },
+   { MAKE_FORMAT_STR(GL_LUMINANCE16F_ARB), "GL_ARB_texture_float", { 1, 1, 
1, 0 } },
+   { MAKE_FORMAT_STR(GL_RGB9_E5_EXT), "GL_EXT_texture_shared_exponent", { 
0, 0, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_R11F_G11F_B10F_EXT), "GL_EXT_packed_float", { 0, 
0, 0, 0 } },
+   { MAKE_FORMAT_STR(GL_RGBA16F_ARB), "GL_ARB_texture_float", { 0, 0, 0, 0 
}, 1 }
+};
+
+PIGLIT_GL_TEST_CONF

[Piglit] [PATCH] gl-1.5-get-array-attribs: exercise glGetIntegerv, etc. with vertex arrays

2018-05-09 Thread Brian Paul
This new test checks that glGetInteger/Fload/Double/Booleanv() return the
right values when querying vertex array attributes.

Currently broken in Mesa.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106450
---
 tests/opengl.py   |   1 +
 tests/spec/gl-1.5/CMakeLists.gl.txt   |   1 +
 tests/spec/gl-1.5/get-array-attribs.c | 135 ++
 3 files changed, 137 insertions(+)
 create mode 100644 tests/spec/gl-1.5/get-array-attribs.c

diff --git a/tests/opengl.py b/tests/opengl.py
index 825e0bf..cbc4e39 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -801,6 +801,7 @@ with profile.test_list.group_manager(
 g(['draw-vertices', 'user'], 'draw-vertices-user')
 g(['isbufferobj'])
 g(['depth-tex-compare'])
+g(['gl-1.5-get-array-attribs'])
 g(['gl-1.5-normal3b3s-invariance', 'GL_BYTE'],
   'normal3b3s-invariance-byte')
 g(['gl-1.5-normal3b3s-invariance', 'GL_SHORT'],
diff --git a/tests/spec/gl-1.5/CMakeLists.gl.txt 
b/tests/spec/gl-1.5/CMakeLists.gl.txt
index e072757..6cc69f5 100644
--- a/tests/spec/gl-1.5/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.5/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (gl-1.5-get-array-attribs get-array-attribs.c)
 piglit_add_executable (gl-1.5-normal3b3s-invariance normal3b3s-invariance.c)
 piglit_add_executable (gl-1.5-vertex-buffer-offsets vertex-buffer-offsets.c)
 
diff --git a/tests/spec/gl-1.5/get-array-attribs.c 
b/tests/spec/gl-1.5/get-array-attribs.c
new file mode 100644
index 000..6aa3c78
--- /dev/null
+++ b/tests/spec/gl-1.5/get-array-attribs.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2018 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Test glGetInteger/Float/Double/Booleanv with vertex array attributes.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 15;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static bool
+test_get(GLenum pname, GLint expectedValue)
+{
+   GLint i;
+   GLfloat f;
+   GLdouble d;
+   GLboolean b;
+   bool pass = true;
+
+   glGetIntegerv(pname, );
+   glGetFloatv(pname, );
+   glGetDoublev(pname, );
+   glGetBooleanv(pname, );
+
+   if (i != expectedValue) {
+   printf("glGetIntegerv(%s) failed: expected %d, got %d\n",
+  piglit_get_gl_enum_name(pname),
+  expectedValue, i);
+   pass = false;
+   }
+
+   if (f != (GLfloat) expectedValue) {
+   printf("glGetFloatv(%s) failed: expected %f, got %f\n",
+  piglit_get_gl_enum_name(pname),
+  (GLfloat) expectedValue, f);
+   pass = false;
+   }
+
+   if (d != (GLdouble) expectedValue) {
+   printf("glGetDoublev(%s) failed: expected %f, got %f\n",
+  piglit_get_gl_enum_name(pname),
+  (GLdouble) expectedValue, f);
+   pass = false;
+   }
+
+   if (b != (GLboolean) !!expectedValue) {
+   printf("glGetBooleanv(%s) failed: expected %d, got %d\n",
+  piglit_get_gl_enum_name(pname),
+  !!expectedValue, b);
+   pass = false;
+   }
+
+   return pass;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   /* nothing */
+   return PIGLIT_PASS;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+   bool pass = true;
+   GLubyte dummy[100];
+
+   glVertexPointer(2, GL_FLOAT, 12, dummy);
+   glNormalPointer(GL_FLOAT, 0, dummy);
+   glColorPointer(4, GL_UNSIGNED_BYTE, 16, dummy);
+   glSecondaryColorPointer(3, GL_SHORT, 32, dummy);
+   glTexCoordPointer(3, GL_SHORT, 18, 

Re: [Piglit] [PATCH] add GL_ARB_sample_locations

2018-05-07 Thread Brian Paul

On 05/04/2018 06:08 AM, Rhys Perry wrote:

Signed-off-by: Rhys Perry 
---
  tests/all.py  |   6 +
  tests/quick.py|   7 +
  tests/spec/CMakeLists.txt |   1 +
  tests/spec/arb_sample_locations/CMakeLists.gl.txt |  11 +
  tests/spec/arb_sample_locations/CMakeLists.txt|   1 +
  tests/spec/arb_sample_locations/test.c| 290 ++
  6 files changed, 316 insertions(+)
  create mode 100644 tests/spec/arb_sample_locations/CMakeLists.gl.txt
  create mode 100644 tests/spec/arb_sample_locations/CMakeLists.txt
  create mode 100644 tests/spec/arb_sample_locations/test.c

diff --git a/tests/all.py b/tests/all.py


I think you'll have to rebase on ToT master since I think all.py is gone 
now.  When you post an updated patch, I'll test with NVIDIA's driver if 
you haven't already.


Otherwise, the test looks OK, though I didn't do a super detailed 
inspection.


Comment typo below...

-Brian



index 7c8580ef0..dbafe7dc0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4995,5 +4995,11 @@ with profile.test_list.group_manager(
  g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs')
  g(['arb_bindless_texture-uniform'], 'uniform')
  
+# Group ARB_sample_locations

+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'ARB_sample_locations')) as g:
+g(['arb_sample_locations'], 'test')
+
  if platform.system() is 'Windows':
  profile.filters.append(lambda p, _: not p.startswith('glx'))
diff --git a/tests/quick.py b/tests/quick.py
index 73c467852..81bcad68c 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -75,6 +75,13 @@ with profile.test_list.group_manager(
  with profile.test_list.allow_reassignment:
  g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func')
  
+# Set the --quick flag on the GL_ARB_sample_locations test

+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'arb_sample_locations')) as g:
+with profile.test_list.allow_reassignment:
+g(['arb_sample_locations', '--quick'], 'test')
+
  # Limit texture size to 512x512 for some texture_multisample tests.
  # The default (max supported size) can be pretty slow.
  with profile.test_list.group_manager(
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index dc14beb4e..25270e9ee 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -45,6 +45,7 @@ add_subdirectory (arb_point_parameters)
  add_subdirectory (arb_point_sprite)
  add_subdirectory (arb_provoking_vertex)
  add_subdirectory (arb_robustness)
+add_subdirectory (arb_sample_locations)
  add_subdirectory (arb_sample_shading)
  add_subdirectory (arb_sampler_objects)
  add_subdirectory (arb_seamless_cube_map)
diff --git a/tests/spec/arb_sample_locations/CMakeLists.gl.txt 
b/tests/spec/arb_sample_locations/CMakeLists.gl.txt
new file mode 100644
index 0..c4652699f
--- /dev/null
+++ b/tests/spec/arb_sample_locations/CMakeLists.gl.txt
@@ -0,0 +1,11 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (arb_sample_locations test.c)
diff --git a/tests/spec/arb_sample_locations/CMakeLists.txt 
b/tests/spec/arb_sample_locations/CMakeLists.txt
new file mode 100644
index 0..144a306f4
--- /dev/null
+++ b/tests/spec/arb_sample_locations/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/arb_sample_locations/test.c 
b/tests/spec/arb_sample_locations/test.c
new file mode 100644
index 0..50d9a1d00
--- /dev/null
+++ b/tests/spec/arb_sample_locations/test.c
@@ -0,0 +1,290 @@
+#include "piglit-util-gl.h"
+
+/**
+ * @file test.c
+ *
+ * This test verifies that GL_ARB_sample_locations is implemented correctly.
+ * It does so by retrieving the sample positions using gl_SamplePosition,
+ * interpolateAtSample() and a method described in
+ * https://mynameismjp.wordpress.com/2010/07/07/msaa-sample-pattern-detector/
+ * which draws a rectangle covering each possible sample location within a 
pixel.
+ * Each rectangle writes the it's position within the pixel, which is then read


"this it's" -> "its" ?



+ * through a shader.
+ *
+ * The retrieved sample locations are then tested against expectations. This is
+ * done with various MSAA levels and sample locations.
+ *
+ * The test can be rather slow by default, but it can be made less exhaustive 
by
+ * passing the argument --quick.
+ *
+ * Sample locations are typically represented in this test as 0.4 fixed point
+ * integers where 0 is the top.
+ */
+
+/* new_locations in do_test_set() needs to be expanded when this is */
+#define LOG2_MAX_SAMPLES 5
+#define MAX_SAMPLES (1<

Re: [Piglit] [PATCH] find_static_tests.py: fix python2 compatibility

2018-05-03 Thread Brian Paul

On 05/02/2018 11:52 AM, Dylan Baker wrote:

Because python2 uses bytes, but python3 uses unicode.

CC: Michel Dänzer <michel.daen...@amd.com>
Fixes: d42d909cd754d0e2c41eec60f3a1015f2d882b95
("tests: Add script to find all hand written test files")
---
  tests/find_static_tests.py | 11 ++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py
index 215273159..795a56dc9 100644
--- a/tests/find_static_tests.py
+++ b/tests/find_static_tests.py
@@ -28,6 +28,8 @@ import argparse
  import io
  import os
  
+import six

+
  
  def main():

  parser = argparse.ArgumentParser()
@@ -55,7 +57,14 @@ def main():
  for dirpath, _, filenames in os.walk(directory):
  for filename in filenames:
  if os.path.splitext(filename)[1] in exts:
-files.append(os.path.join(dirpath, filename))
+name = os.path.join(dirpath, filename)
+if six.PY2:
+# This might not be correct, but it's fine. As long as the
+# two files are the same it'll work, and utf-8 is what
+# everyone *should* be using, and as a superset of ascii
+# *should* cover most people
+name = name.decode('utf-8', 'replace')
+files.append(name)
  
  if os.path.exists(args.output):

  with io.open(args.output, 'rt', encoding='utf-8') as f:



This seems to fix the failure on MinGW.

Tested-by: Brian Paul <bri...@vmware.com>

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


Re: [Piglit] [PATCH] tests: fix unicode issue on MinGW in find_static_tests.py

2018-05-03 Thread Brian Paul

On 05/03/2018 06:23 AM, Ilia Mirkin wrote:

On Wed, May 2, 2018 at 10:04 PM, Brian Paul <bri...@vmware.com> wrote:

Explicity convert strings to unicode before writing.
This fixes an error when building with MinGW:
Traceback (most recent call last):
   File "/var/workspace/tests/find_static_tests.py", line 74, in 
 main()
   File "/var/workspace/tests/find_static_tests.py", line 69, in main
 f.write(filename)
TypeError: write() argument 1 must be unicode, not str
---
  tests/find_static_tests.py | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py
index 2152731..6ac1445 100644
--- a/tests/find_static_tests.py
+++ b/tests/find_static_tests.py
@@ -66,8 +66,8 @@ def main():
  if sorted(files) != sorted(existing):
  with io.open(args.output, 'wt', encoding='utf-8') as f:
  for filename in files:
-f.write(filename)
-f.write('\n')
+f.write(unicode(filename))
+f.write(unicode('\n'))


Can't you just use "wb" as the open type (and drop the encoding)? Or
something along those lines... That will allow you to operate the file
in a more intuitive way and not worry about all this unicode stuff.


That works too.  I'll let Dylan choose what he wants.  I'm just trying 
to get things working again and have no preference.




I'm not sure what just doing unicode() on a string will do. Normally
you specify a charset so that it can interpret the sequence of bytes
as unicode code points.


FWIW, I also tried filename.encode('utf-8') but that did not work.

-Brian

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


[Piglit] [PATCH] tests: fix unicode issue on MinGW in find_static_tests.py

2018-05-02 Thread Brian Paul
Explicity convert strings to unicode before writing.
This fixes an error when building with MinGW:
Traceback (most recent call last):
  File "/var/workspace/tests/find_static_tests.py", line 74, in 
main()
  File "/var/workspace/tests/find_static_tests.py", line 69, in main
f.write(filename)
TypeError: write() argument 1 must be unicode, not str
---
 tests/find_static_tests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/find_static_tests.py b/tests/find_static_tests.py
index 2152731..6ac1445 100644
--- a/tests/find_static_tests.py
+++ b/tests/find_static_tests.py
@@ -66,8 +66,8 @@ def main():
 if sorted(files) != sorted(existing):
 with io.open(args.output, 'wt', encoding='utf-8') as f:
 for filename in files:
-f.write(filename)
-f.write('\n')
+f.write(unicode(filename))
+f.write(unicode('\n'))
 
 
 if __name__ == '__main__':
-- 
2.7.4

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


Re: [Piglit] [PATCH v4] tests: add nvidia conservative rasterization tests

2018-03-31 Thread Brian Paul

On 03/30/2018 03:56 PM, Rhys Perry wrote:

Adds tests for GL_NV_conservative_raster, GL_NV_conservative_raster_dilate
and GL_NV_conservative_raster_pre_snap_triangles.

Changes in v2:
- cleanup the tests
- fix some test failures
- remove the gles version of the dilation test as the extension is not
   exposed in gl.xml
Changes in v3:
- fix accidently luck-based pre-snap-triangles test
Changes in v4:
- apply formatting changes
- elaborate on various comments describing the test source code files

Signed-off-by: Rhys Perry 
---
I am new to this project and don't have commit access.


The code looks good to me.  Though, I discovered one issue: if I run:

bin/nv_conservative_raster-draw -auto

the test fails.  But if I add -fbo, then it passes.  Do you know why 
that is?


I'm testing w/ NVIDIA's driver and a GTX1050.

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


Re: [Piglit] [PATCH v3] tests: add nvidia conservative rasterization tests

2018-03-30 Thread Brian Paul

The patch looks great overall.  Just minor nit-picks below.


On 03/28/2018 11:13 AM, Rhys Perry wrote:

Adds tests for GL_NV_conservative_raster, GL_NV_conservative_raster_dilate
and GL_NV_conservative_raster_pre_snap_triangles.

Changes in v2:
- cleanup the tests
- fix some test failures
- remove the gles version of the dilation test as the extension is not
   exposed in gl.xml
Changes in v3:
- fix accidently luck-based pre-snap-triangles test

Signed-off-by: Rhys Perry 
---
I am new to this project and don't have commit rights.

  tests/all.py   |  20 ++
  tests/spec/CMakeLists.txt  |   3 +
  .../spec/nv_conservative_raster/CMakeLists.gl.txt  |  13 +
  .../nv_conservative_raster/CMakeLists.gles2.txt|   3 +
  tests/spec/nv_conservative_raster/CMakeLists.txt   |   1 +
  tests/spec/nv_conservative_raster/attrib.c | 103 +++
  tests/spec/nv_conservative_raster/dlist.c  | 106 +++
  tests/spec/nv_conservative_raster/draw.c   | 323 +
  .../CMakeLists.gl.txt  |  11 +
  .../nv_conservative_raster_dilate/CMakeLists.txt   |   1 +
  tests/spec/nv_conservative_raster_dilate/draw.c| 143 +
  .../CMakeLists.gl.txt  |  11 +
  .../CMakeLists.gles2.txt   |   3 +
  .../CMakeLists.txt |   1 +
  .../draw.c | 140 +
  15 files changed, 882 insertions(+)
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.gl.txt
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.gles2.txt
  create mode 100644 tests/spec/nv_conservative_raster/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster/attrib.c
  create mode 100644 tests/spec/nv_conservative_raster/dlist.c
  create mode 100644 tests/spec/nv_conservative_raster/draw.c
  create mode 100644 tests/spec/nv_conservative_raster_dilate/CMakeLists.gl.txt
  create mode 100644 tests/spec/nv_conservative_raster_dilate/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster_dilate/draw.c
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.gl.txt
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.gles2.txt
  create mode 100644 
tests/spec/nv_conservative_raster_pre_snap_triangles/CMakeLists.txt
  create mode 100644 tests/spec/nv_conservative_raster_pre_snap_triangles/draw.c

diff --git a/tests/all.py b/tests/all.py
index 7c8580ef0..5fa219ca0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -4995,5 +4995,25 @@ with profile.test_list.group_manager(
  g(['arb_bindless_texture-uint64_attribs'], 'uint64_attribs')
  g(['arb_bindless_texture-uniform'], 'uniform')
  
+# Group NV_conservative_raster

+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster')) as g:
+g(['nv_conservative_raster-draw'], 'draw')
+g(['nv_conservative_raster-dlist'], 'dlist')
+g(['nv_conservative_raster-attrib'], 'attrib')
+
+# Group NV_conservative_raster_dilate
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster_dilate')) as g:
+g(['nv_conservative_raster_dilate-draw'], 'draw')
+
+# Group NV_conservative_raster_pre_snap_triangles
+with profile.test_list.group_manager(
+   PiglitGLTest,
+   grouptools.join('spec', 'NV_conservative_raster_pre_snap_triangles')) 
as g:
+g(['nv_conservative_raster_pre_snap_triangles-draw'], 'draw')
+
  if platform.system() is 'Windows':
  profile.filters.append(lambda p, _: not p.startswith('glx'))
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index dc14beb4e..a0bc845c5 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -101,6 +101,9 @@ add_subdirectory (ext_texture_swizzle)
  add_subdirectory (ext_timer_query)
  add_subdirectory (ext_transform_feedback)
  add_subdirectory (nv_conditional_render)
+add_subdirectory (nv_conservative_raster)
+add_subdirectory (nv_conservative_raster_dilate)
+add_subdirectory (nv_conservative_raster_pre_snap_triangles)
  add_subdirectory (nv_fill_rectangle)
  add_subdirectory (nv_image_formats)
  add_subdirectory (nv_texture_barrier)
diff --git a/tests/spec/nv_conservative_raster/CMakeLists.gl.txt 
b/tests/spec/nv_conservative_raster/CMakeLists.gl.txt
new file mode 100644
index 0..5f632c864
--- /dev/null
+++ b/tests/spec/nv_conservative_raster/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (nv_conservative_raster-draw draw.c)
+piglit_add_executable (nv_conservative_raster-dlist dlist.c)
+piglit_add_executable 

[Piglit] [PATCH] util: reorganize read_pixels_float()

2018-03-28 Thread Brian Paul
Use a simple if/else to organize the ES vs desktop GL code paths.
---
 tests/util/piglit-util-gl.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 3a41a5e..f851f82 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1017,27 +1017,27 @@ static GLfloat *
 read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height,
  GLenum format, GLfloat *pixels)
 {
-   GLubyte *pixels_b;
-   unsigned i, j, k;
int comps = piglit_num_components(format);
 
if (!pixels)
pixels = malloc(width * height * comps * sizeof(GLfloat));
 
-   if (!piglit_is_gles()) {
+   if (piglit_is_gles()) {
+   unsigned i, j, k;
+   GLubyte *pixels_b = malloc(width * height * 4 * 
sizeof(GLubyte));
+   glReadPixels(x, y, width, height,
+GL_RGBA, GL_UNSIGNED_BYTE, pixels_b);
+   k = 0;
+   for (i = 0; i < width * height; i++) {
+   for (j = 0; j < comps; j++) {
+   pixels[k++] = pixels_b[i*4+j] / 255.0f;
+   }
+   }
+   free(pixels_b);
+   } else {
glReadPixels(x, y, width, height, format, GL_FLOAT, pixels);
-   return pixels;
}
 
-   pixels_b = malloc(width * height * 4 * sizeof(GLubyte));
-   glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels_b);
-   k = 0;
-   for (i = 0; i < width * height; i++) {
-   for (j = 0; j < comps; j++) {
-   pixels[k++] = pixels_b[i*4+j] / 255.0f;
-   }
-   }
-   free(pixels_b);
return pixels;
 }
 
-- 
2.7.4

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


Re: [Piglit] [PATCH v3] fix read_pixels_float() on GLES2 when format is not GL_RGBA

2018-03-28 Thread Brian Paul

On 03/28/2018 10:44 AM, Rhys Perry wrote:

GLES2 requires GL_RGBA to be used with GL_UNSIGNED_BYTE in glReadPixels
---
  tests/util/piglit-util-gl.c | 18 +++---
  1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index df39c1c87..3a41a5eb0 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1018,21 +1018,25 @@ read_pixels_float(GLint x, GLint y, GLsizei width, 
GLsizei height,
  GLenum format, GLfloat *pixels)
  {
GLubyte *pixels_b;
-   unsigned i, ncomponents;
+   unsigned i, j, k;
+   int comps = piglit_num_components(format);
  
-	ncomponents = width * height * piglit_num_components(format);

if (!pixels)
-   pixels = malloc(ncomponents * sizeof(GLfloat));
+   pixels = malloc(width * height * comps * sizeof(GLfloat));
  
  	if (!piglit_is_gles()) {

glReadPixels(x, y, width, height, format, GL_FLOAT, pixels);
return pixels;
}
  
-	pixels_b = malloc(ncomponents * sizeof(GLubyte));

-   glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, pixels_b);
-   for (i = 0; i < ncomponents; i++)
-   pixels[i] = pixels_b[i] / 255.0;
+   pixels_b = malloc(width * height * 4 * sizeof(GLubyte));
+   glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels_b);
+   k = 0;
+   for (i = 0; i < width * height; i++) {
+   for (j = 0; j < comps; j++) {
+   pixels[k++] = pixels_b[i*4+j] / 255.0f;
+   }
+   }
free(pixels_b);
return pixels;
  }



Looks good.  Thanks!

Reviewed-by: Brian Paul <bri...@vmware.com>

Do you need me to push this for you?
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] fix read_pixels_float() on GLES2 when format is not GL_RGBA

2018-03-28 Thread Brian Paul

On 03/28/2018 05:37 AM, Rhys Perry wrote:

GLES2 requires GL_RGBA to be used with GL_UNSIGNED_BYTE in glReadPixels
---
  tests/util/piglit-util-gl.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index df39c1c87..0504be063 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1029,10 +1029,10 @@ read_pixels_float(GLint x, GLint y, GLsizei width, 
GLsizei height,
return pixels;
}
  
-	pixels_b = malloc(ncomponents * sizeof(GLubyte));

-   glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, pixels_b);
+   pixels_b = malloc(width * height * 4 * sizeof(GLubyte));
+   glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels_b);
for (i = 0; i < ncomponents; i++)
-   pixels[i] = pixels_b[i] / 255.0;
+   pixels[i] = pixels_b[i/ncomponents*4+i%ncomponents] / 255.0;


That looks a bit inefficient to me with all the divides and mods, and a 
little hard to follow at first glance.


How about something like this:

int comps = piglit_num_components(format);
int k = 0;
for (i = 0; i < width * height; i++) {
   for (j = 0; j < comps; j++) {
  pixels[k++] = pixels_b[i * 4 + j] / 255.0f;
   }
}

-Brian


free(pixels_b);
return pixels;
  }



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


Re: [Piglit] [PATCH 03/15] gl-3.2/adj-prims: fix expected vertex order for triangle strips with adjacency

2018-03-27 Thread Brian Paul

For 3&4,
Reviewed-by: Brian Paul <bri...@vmware.com>
Tested-by: Brian Paul <bri...@vmware.com>  (on NVIDIA)


On 03/26/2018 05:32 PM, Marek Olšák wrote:

From: Nicolai Hähnle <nicolai.haeh...@amd.com>

The first two vertices are swapped for triangle strips with adjacency; see
Table 10.1 of the OpenGL 4.5 (Compatibility Profile) spec.
---
  tests/spec/gl-3.2/adj-prims.c | 18 +-
  1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/spec/gl-3.2/adj-prims.c b/tests/spec/gl-3.2/adj-prims.c
index 794ab3dc9..f4479c708 100644
--- a/tests/spec/gl-3.2/adj-prims.c
+++ b/tests/spec/gl-3.2/adj-prims.c
@@ -167,23 +167,26 @@ provoking_vertex_index(GLenum prim_mode, GLenum pv_mode, 
unsigned prim_index)
if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
return prim_index + 1;
else
return prim_index + 2;
case GL_TRIANGLES_ADJACENCY:
if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
return prim_index * 6 + 0;
else
return prim_index * 6 + 4;
case GL_TRIANGLE_STRIP_ADJACENCY:
-   if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
-   return prim_index * 2;
-   else
+   if (pv_mode == GL_FIRST_VERTEX_CONVENTION) {
+   if (prim_index & 1)
+   return prim_index * 2 + 2;
+   else
+   return prim_index * 2;
+   } else
return prim_index * 2 + 4;
default:
assert(!"Unexpected prim_mode");
return 0;
}
  }
  
  
  /**

   * Given a primitive type and a primitive (line/triangle) index, return
@@ -206,22 +209,27 @@ compute_probe_location(GLenum prim_mode, unsigned 
prim_index,
i0 = prim_index + 1;
i1 = prim_index + 2;
break;
case GL_TRIANGLES_ADJACENCY:
i0 = prim_index * 6 + 0;
i1 = prim_index * 6 + 2;
if (polygon_mode != GL_LINE)
i2 = prim_index * 6 + 4;
break;
case GL_TRIANGLE_STRIP_ADJACENCY:
-   i0 = prim_index * 2;
-   i1 = prim_index * 2 + 2;
+   if (prim_index & 1) {
+   i0 = prim_index * 2;
+   i1 = prim_index * 2 + 2;
+   } else {
+   i0 = prim_index * 2 + 2;
+   i1 = prim_index * 2;
+   }
if (polygon_mode != GL_LINE)
i2 = prim_index * 2 + 4;
break;
default:
assert(!"Unexpected prim_mode");
*x = *y = 0;
return;
}
  
  	/* average of 2 or 3 points */




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


Re: [Piglit] [PATCH] Fix piglit_probe_pixel_rgb on GLES2

2018-03-26 Thread Brian Paul

On 03/25/2018 01:49 PM, Rhys Perry wrote:

GLES2 requires GL_RGBA to be used with GL_UNSIGNED_BYTE in glReadPixels
---
  tests/util/piglit-util-gl.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index df39c1c87..be060aae5 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1017,7 +1017,7 @@ static GLfloat *
  read_pixels_float(GLint x, GLint y, GLsizei width, GLsizei height,
  GLenum format, GLfloat *pixels)
  {
-   GLubyte *pixels_b;
+   uint8_t pixels_b[4];
unsigned i, ncomponents;
  
  	ncomponents = width * height * piglit_num_components(format);

@@ -1029,11 +1029,9 @@ read_pixels_float(GLint x, GLint y, GLsizei width, 
GLsizei height,
return pixels;
}
  
-	pixels_b = malloc(ncomponents * sizeof(GLubyte));

-   glReadPixels(x, y, width, height, format, GL_UNSIGNED_BYTE, pixels_b);
+   glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels_b);
for (i = 0; i < ncomponents; i++)
pixels[i] = pixels_b[i] / 255.0;
-   free(pixels_b);
return pixels;
  }
  



This doesn't look right.  The pixels_b buffer must be large enough to 
hold 'ncomponents' values, not 4.


Also, I'd prefer to keep read GL_RGB on non-ES.  Reading GL_RGB vs. 
GL_RGBA probably hits different code paths in the driver, which is a 
good thing.


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


[Piglit] [PATCH 1/2] fbo-drawbuffers2-blend: fix incorrect comments

2018-03-16 Thread Brian Paul
---
 tests/fbo/fbo-drawbuffers2-blend.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/fbo/fbo-drawbuffers2-blend.c 
b/tests/fbo/fbo-drawbuffers2-blend.c
index b97803b..2c16b8f 100644
--- a/tests/fbo/fbo-drawbuffers2-blend.c
+++ b/tests/fbo/fbo-drawbuffers2-blend.c
@@ -25,10 +25,9 @@
  *
  */
 
-/** @file fbo-drawbuffers2-colormask.c
+/** @file fbo-drawbuffers2-blend.c
  *
- * Tests that individual color masks per render target with
- * EXT_draw_buffers2 works.
+ * Tests per-buffer blend enable flags.
  */
 
 #include "piglit-util-gl.h"
-- 
2.7.4

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


[Piglit] [PATCH 2/2] piglit: fix some warnings about no return value from non-void function

2018-03-16 Thread Brian Paul
---
 tests/spec/arb_texture_multisample/large-float-texture.c | 1 +
 tests/spec/arb_vertex_program/property-bindings.c| 4 +++-
 tests/spec/glsl-1.10/execution/built-in-uniform-state.c  | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
index 2e05a6e..bbec551 100644
--- a/tests/spec/arb_texture_multisample/large-float-texture.c
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -456,6 +456,7 @@ texel_size(GLenum intFormat)
return 4 * sizeof(GLfloat);
default:
assert(!"Unexpected texture format");
+   return 0;
}
 }
 
diff --git a/tests/spec/arb_vertex_program/property-bindings.c 
b/tests/spec/arb_vertex_program/property-bindings.c
index f1a2b28..381ecab 100644
--- a/tests/spec/arb_vertex_program/property-bindings.c
+++ b/tests/spec/arb_vertex_program/property-bindings.c
@@ -158,8 +158,10 @@ enum2program(const GLenum pname)
return "r";
case GL_Q:
return "q";
+   default:
+   assert(!"unexpected state enum");
+   return "";
}
-   assert(!"unexpected state enum");
 }
 
 enum piglit_result
diff --git a/tests/spec/glsl-1.10/execution/built-in-uniform-state.c 
b/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
index ca7a3cf..5ab5ee8 100644
--- a/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
+++ b/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
@@ -191,8 +191,10 @@ enum2glsl(const GLenum pname)
return "R";
case GL_Q:
return "Q";
+   default:
+   assert(!"unexpected pname");
+   return "";
}
-   assert(0);
 }
 
 enum piglit_result
-- 
2.7.4

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


Re: [Piglit] [PATCH] gl-3.0: Basic tests of glTexParameterIiv and friends

2018-03-08 Thread Brian Paul

On 03/08/2018 02:24 PM, Ian Romanick wrote:

From: Ian Romanick <ian.d.roman...@intel.com>

Some GCC compiler warnings led me to find some bugs in Mesa's
implementation of glGetTexParameterIuiv.  I then discovered that piglit
had zero tests for any of these functions.

This test currently fails on Mesa.

Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>
---
  tests/all.py|   1 +
  tests/spec/gl-3.0/CMakeLists.gl.txt |   2 +-
  tests/spec/gl-3.0/texparameteri.c   | 184 
  3 files changed, 186 insertions(+), 1 deletion(-)
  create mode 100644 tests/spec/gl-3.0/texparameteri.c

diff --git a/tests/all.py b/tests/all.py
index 85a8108..7fe618b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1181,6 +1181,7 @@ with profile.test_list.group_manager(
'forward-compatible-bit yes')
  g(['gl-3.0-forward-compatible-bit', 'no'],
'forward-compatible-bit no')
+g(['gl-3.0-texparameteri'])
  g(['gl-3.0-texture-integer'])
  g(['gl-3.0-vertexattribipointer'])
  g(['gl30basic'], run_concurrent=False)
diff --git a/tests/spec/gl-3.0/CMakeLists.gl.txt 
b/tests/spec/gl-3.0/CMakeLists.gl.txt
index 9dc732b..6e9635c 100644
--- a/tests/spec/gl-3.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-3.0/CMakeLists.gl.txt
@@ -15,7 +15,7 @@ piglit_add_executable (gl-3.0-render-integer render-integer.c)
  piglit_add_executable (gl-3.0-required-sized-texture-formats 
required-sized-texture-formats.c)
  piglit_add_executable (gl-3.0-required-renderbuffer-attachment-formats 
required-renderbuffer-attachment-formats.c)
  piglit_add_executable (gl-3.0-required-texture-attachment-formats 
required-texture-attachment-formats.c)
+piglit_add_executable (gl-3.0-texparameteri texparameteri.c)
  piglit_add_executable (gl-3.0-texture-integer texture-integer.c)
  piglit_add_executable (gl-3.0-vertexattribipointer vertexattribipointer.c)
-
  # vim: ft=cmake:
diff --git a/tests/spec/gl-3.0/texparameteri.c 
b/tests/spec/gl-3.0/texparameteri.c
new file mode 100644
index 000..9a14572
--- /dev/null
+++ b/tests/spec/gl-3.0/texparameteri.c
@@ -0,0 +1,184 @@
+/*
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * 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
+ * Basic tests of OpenGL 3.0 gl{Get,}TexParameterI{iv,uiv} functions
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;


30

With that, Reviewed-by: Brian Paul <bri...@vmware.com>



+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#ifndef GL_TEXTURE_CROP_RECT_OES
+#define GL_TEXTURE_CROP_RECT_OES  0x8B9D
+#endif
+
+enum piglit_result
+piglit_display(void)
+{
+   return PIGLIT_FAIL;
+}
+
+static bool
+check_values(const char *msg, const unsigned *expected, const unsigned *got)
+{
+   if (memcmp(expected, got, 4 * sizeof(*expected)) != 0) {
+   fprintf(stderr, "%s.\n"
+   " Got: 0x%08x 0x%08x 0x%08x 0x%08x\n"
+   "Expected: 0x%08x 0x%08x 0x%08x 0x%08x\n",
+   msg,
+   got[0],
+   got[1],
+   got[2],
+   got[3],
+   expected[0],
+   expected[1],
+   expected[2],
+   expected[3]);
+   return false;
+   }
+
+   return true;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   static const GLuint uint_border[4] = {
+   0x80706050, 0x40302010,
+   0x08070605, 0x04030201
+   };
+   static const GLint int_border[4] = { -1, -2, -3, -4 };
+   static const GLuint bad[4] = {
+   0x0badc0de, 0x0badc0de, 0x0badc0de, 0

Re: [Piglit] [PATCH] glsl-fs-pointcoord: add additional FS inputs

2018-02-26 Thread Brian Paul


Reviewed-by: Brian Paul <bri...@vmware.com>


On 02/26/2018 04:15 AM, Iago Toral Quiroga wrote:

We have recently found a regression in the i965 driver related to
gl_PointCoord which was not being caught by this test. This patch
changes the test slightly so that we can expose the problem for
future regression testing.

The problem occured because the driver was not using the correct
number of FS inputs to to program a certain piece of HW state, as
it did not account for some inputs that require special treatment,
such as gl_PointCoord.

However, this test was not able to find this because the hardware
also has a restriction by which it needs to program, at least,
2 FS inputs, so if we only have gl_PointCoord as input, which is
what we had here, it would still work.

This patch adds a couple of additional varyings so we have 3
inputs in total, ensuring that we trigger the problem.

Besides this, it also removes a sampler uniform that was not used
in the fragment shader, and includes the GLSL version that was
missing in the vertex shader.
---
  tests/shaders/glsl-fs-pointcoord.frag | 7 ++-
  tests/shaders/glsl-fs-pointcoord.vert | 8 
  2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/shaders/glsl-fs-pointcoord.frag 
b/tests/shaders/glsl-fs-pointcoord.frag
index 4e242f01d..138f25883 100644
--- a/tests/shaders/glsl-fs-pointcoord.frag
+++ b/tests/shaders/glsl-fs-pointcoord.frag
@@ -1,7 +1,12 @@
  #version 120
-uniform sampler2D tex;
+
+varying vec4 var0;
+varying vec4 var1;
  
  void main()

  {
gl_FragColor = vec4(gl_PointCoord.xy * 1.1 - 0.05, 0, 0);
+
+   if (var0 != vec4(0, 1, 2, 3) || var1 != vec4(4, 5, 6, 7))
+   gl_FragColor.z = 1; /* something is wrong */
  }
diff --git a/tests/shaders/glsl-fs-pointcoord.vert 
b/tests/shaders/glsl-fs-pointcoord.vert
index 92f5bde9c..66855544f 100644
--- a/tests/shaders/glsl-fs-pointcoord.vert
+++ b/tests/shaders/glsl-fs-pointcoord.vert
@@ -1,5 +1,13 @@
+#version 120
+
+varying vec4 var0;
+varying vec4 var1;
+
  void main()
  {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+   var0 = vec4(0, 1, 2, 3);
+   var1 = vec4(4, 5, 6, 7);
  }
  



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


[Piglit] [PATCH] degenerate-prims: fix incorrect return value from test_prim()

2018-02-13 Thread Brian Paul
The function is supposed to return a piglit_result, not true/false.
Fixes incorrect 'fail' results.
---
 tests/general/degenerate-prims.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/general/degenerate-prims.c b/tests/general/degenerate-prims.c
index 0eed99c..3001d34 100644
--- a/tests/general/degenerate-prims.c
+++ b/tests/general/degenerate-prims.c
@@ -72,7 +72,7 @@ test_prim(void *_data)
piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
 "Primitive: %s", 
piglit_get_prim_name(data->prim));
 
-   return pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
 
-- 
2.7.4

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


[Piglit] [PATCH] gl-4.3-get_glsl_versions: new tests of GL_NUM_SHADING_LANGUAGE_VERSIONS

2018-02-13 Thread Brian Paul
and glGetStringi(GL_SHADING_LANGUAGE_VERSION, i) queries in GL 4.3.
Until recently, these queries were not implemented in Mesa.
---
 tests/all.py  |  5 +++
 tests/spec/CMakeLists.txt |  1 +
 tests/spec/gl-4.3/CMakeLists.gl.txt   | 13 ++
 tests/spec/gl-4.3/CMakeLists.txt  |  1 +
 tests/spec/gl-4.3/get_glsl_versions.c | 76 +++
 5 files changed, 96 insertions(+)
 create mode 100644 tests/spec/gl-4.3/CMakeLists.gl.txt
 create mode 100644 tests/spec/gl-4.3/CMakeLists.txt
 create mode 100644 tests/spec/gl-4.3/get_glsl_versions.c

diff --git a/tests/all.py b/tests/all.py
index 310161a..8236d5a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1208,6 +1208,11 @@ with profile.test_list.group_manager(
 
 with profile.test_list.group_manager(
 PiglitGLTest,
+grouptools.join('spec', '!opengl 4.3')) as g:
+g(['get_glsl_versions'])
+
+with profile.test_list.group_manager(
+PiglitGLTest,
 grouptools.join('spec', '!opengl 4.4')) as g:
 g(['tex-errors'])
 
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 1f9d810..e57e8d7 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -134,6 +134,7 @@ add_subdirectory (gl-3.0)
 add_subdirectory (gl-3.1)
 add_subdirectory (gl-3.2)
 add_subdirectory (gl-3.3)
+add_subdirectory (gl-4.3)
 add_subdirectory (gl-4.4)
 add_subdirectory (gl-4.5)
 add_subdirectory (gles-2.0)
diff --git a/tests/spec/gl-4.3/CMakeLists.gl.txt 
b/tests/spec/gl-4.3/CMakeLists.gl.txt
new file mode 100644
index 000..4d81c84
--- /dev/null
+++ b/tests/spec/gl-4.3/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+   ${GLEXT_INCLUDE_DIR}
+   ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+   piglitutil_${piglit_target_api}
+   ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (gl-4.3-get_glsl_versions get_glsl_versions.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/gl-4.3/CMakeLists.txt b/tests/spec/gl-4.3/CMakeLists.txt
new file mode 100644
index 000..144a306
--- /dev/null
+++ b/tests/spec/gl-4.3/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/gl-4.3/get_glsl_versions.c 
b/tests/spec/gl-4.3/get_glsl_versions.c
new file mode 100644
index 000..4a6d42d
--- /dev/null
+++ b/tests/spec/gl-4.3/get_glsl_versions.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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
+ * NON-INFRINGEMENT.  IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS
+ * 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 "minmax-test.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_core_version = 43;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+void
+piglit_init(int argc, char *argv[])
+{
+   GLint num = -1;
+   GLint i;
+
+   glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, );
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   if (num < 1) {
+   printf("Invalid number of shading language versions\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   for (i = 0; i < num; i++) {
+   const GLubyte *v = glGetStringi(GL_SHADING_LANGUAGE_VERSION, i);
+   if (!v) {
+   printf("Invalid glGetStringi(index=%d) result\n", i);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   if (v[0] != 0 && !(v[0] >= '1' && v[0] <= '9')) {
+   printf("Invalid GLSL version string: %s\n", v);
+   piglit_report_result(PIGLIT_FAIL);
+   }
+   //printf("%d: %s\n", i, (const char *) v);
+   }
+
+   if (!piglit_check_gl_error(GL_NO_ERROR)) {
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   piglit_report_result(PIGLIT_PASS);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   

Re: [Piglit] [PATCH 1/2] arb_viewport_array/viewport_indices: allow float precision instead of double

2018-02-12 Thread Brian Paul

On 02/08/2018 05:59 PM, Marek Olšák wrote:

From: Marek Olšák <marek.ol...@amd.com>

Mesa will not use doubles for this state.
---
  tests/spec/arb_viewport_array/viewport_indices.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_viewport_array/viewport_indices.c 
b/tests/spec/arb_viewport_array/viewport_indices.c
index 0088828..567f83d 100644
--- a/tests/spec/arb_viewport_array/viewport_indices.c
+++ b/tests/spec/arb_viewport_array/viewport_indices.c
@@ -194,21 +194,23 @@ test_preserve_invalid_index(GLint maxVP)
|| vpGet[3] != vp[3]) {
printf("Viewport index %d got erroneously changed\n",
   i);
pass = false;
}
  #ifdef PIGLIT_USE_OPENGL
glGetDoublei_v(GL_DEPTH_RANGE, i, drGet);
  #else
glGetFloati_vOES(GL_DEPTH_RANGE, i, drGet);
  #endif
-   if (drGet[0] != dr[0] || drGet[1] != dr[1]) {
+   /* Allow float precisions instead of double for desktop GL. */
+   if ((float)drGet[0] != (float)dr[0] ||
+   (float)drGet[1] != (float)dr[1]) {
printf("DepthRange index %d got erroneously changed\n",
   i);
pass = false;
}
glGetIntegeri_v(GL_SCISSOR_BOX, i, scGet);
if (scGet[0] != sc[0] || scGet[1] != sc[1] || scGet[2] != sc[2]
|| scGet[3] != sc[3]) {
printf("Scissor Box for index %d got erroneously 
changed\n",
   i);
    pass = false;



Reviewed-by: Brian Paul <bri...@vmware.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH 2/2] texunits: don't test glTexEnv with unusable texture units

2018-02-08 Thread Brian Paul
Reviewed-by: Brian Paul <bri...@vmware.com>


On Thu, Feb 8, 2018 at 5:59 PM, Marek Olšák <mar...@gmail.com> wrote:

> From: Marek Olšák <marek.ol...@amd.com>
>
> The GL limit is MaxTextureCombinedUnits, but the real usable limit is
> MaxTextureCoordUnits. This is probably a spec bug.
>
> Mesa will ignore glTexEnv calls where unit >= MaxTextureCoordUnits.
> ---
>  tests/general/texunits.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/general/texunits.c b/tests/general/texunits.c
> index b68dcf7..c6fbcb1 100644
> --- a/tests/general/texunits.c
> +++ b/tests/general/texunits.c
> @@ -276,30 +276,30 @@ test_texture_params(void)
>
>  static GLboolean
>  test_texture_env(void)
>  {
> /* Texture Environment state is fixed-function; not used by shaders */
> int i;
>
> clear_errors();
>
> /* set per-unit state */
> -   for (i = 0; i < MaxTextureCombinedUnits; i++) {
> +   for (i = 0; i < MaxTextureCoordUnits; i++) {
>glActiveTexture(GL_TEXTURE0 + i);
>glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, Random[i]);
>if (!piglit_check_gl_error(GL_NO_ERROR)) {
>   return GL_FALSE;
>}
> }
>
> /* check per-unit state */
> -   for (i = 0; i < MaxTextureCombinedUnits; i++) {
> +   for (i = 0; i < MaxTextureCoordUnits; i++) {
>GLfloat v[4];
>glActiveTexture(GL_TEXTURE0 + i);
>glGetTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, v);
>if (!equal4v(v, Random[i])) {
>   printf("Setting per-unit env state failed for unit %d\n", i);
>   report4v(Random[i], v);
>   return GL_FALSE;
>}
> }
>
> --
> 2.7.4
>
> ___
> 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_sample_shading: Add gl_SampleMaskIn subtest with msaa disabled, fix test

2018-02-05 Thread Brian Paul
s_ifbo.color_tex[0]);
  
  	piglit_draw_rect(-1, -1, 2, 2);

@@ -364,12 +439,17 @@ piglit_display()
  
  	if (all || !strcmp(testname, "fix")) {

run = true;
-   pass = iterate_sample_rates(testname, test_fix) && pass;
+   pass = iterate_sample_rates("fix", test_fix) && pass;
+   }
+
+   if (all || !strcmp(testname, "mask_in_one")) {
+   run = true;
+   pass = iterate_sample_rates("mask_in_one", test_mask_in_one) && 
pass;
}
  
  	if (all || !strcmp(testname, "partition")) {

run = true;
-   pass = iterate_sample_rates(testname, test_partition) && pass;
+   pass = iterate_sample_rates("partition", test_partition) && 
pass;
}
  
  	if (!run)

@@ -408,6 +488,9 @@ piglit_init(int argc, char **argv)
piglit_is_extension_supported("GL_ARB_gpu_shader5") &&
piglit_is_extension_supported("GL_ARB_shader_atomic_counters");
  
+	mask_in_one_supported =

+   piglit_is_extension_supported("GL_ARB_gpu_shader5");
+
/* Skip the test if num_samples > GL_MAX_SAMPLES */
GLint max_samples;
glGetIntegerv(GL_MAX_SAMPLES, _samples);



Looks OK to me, though I didn't closely study this.

I ran the GL_ARB_sample_shading tests on my NVIDIA card before/after 
your patch.  Of the new mask_in_one test cases, 24 passed while 48 
failed.  I haven't investigated.  Is that a concern?


Reviewed-by: Brian Paul <bri...@vmware.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH] all.py: fix extension/version testing when wflinfo fails

2018-02-02 Thread Brian Paul

On 02/02/2018 11:57 AM, Dylan Baker wrote:

Quoting Brian Paul (2018-02-02 09:35:21)

If wflinfo is not installed or fails, the wfl_info.gl_extensions value
will be the empty set.  Similarly, the gl_version, glsl_version, etc.
will be None.

In those cases, return True from the gl_extension_supported() and
is_feature_directory_supported() functions so that we don't skip any
subdirs.

This is only relevant when PIGLIT_FILTER_DIRECTORIES is set.
---
  tests/all.py | 15 +++
  1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 6d4e887..eece906 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -217,6 +217,10 @@ wfl_info = wflinfo.WflInfo()
  
  def gl_extension_supported(ext_name):

  """Is the named OpenGL extension supported?"""
+if wfl_info.gl_extensions == set():


I think we should just do 'if not wfl_info.gl_extensions' here.


That doesn't work since we set return set() in WflInfo.gl_extensions().





+# Don't know what extensions are supported.  Return true so we don't
+# skip anything.
+return True
  return ext_name in wfl_info.gl_extensions
  
  
@@ -227,6 +231,9 @@ def is_feature_directory_supported(dir_name):

  it means the extension/version is possibly suppported.  We're a little
  fuzzy because we don't yet parse all the directory name possibilities
  (like ES tests).
+
+Also, if the 'wflinfo' program is not installed or fails (i.e. we can't
+determine the GL version/extension) we return True.
  """
  if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
  # The directory is a GL extension name, but of the format 
"arb_foo_bar"
@@ -237,19 +244,19 @@ def is_feature_directory_supported(dir_name):
  elif dir_name[:5] == "gles-":
  # OpenGL ES test
  version = float(dir_name[5:])
-return wfl_info.gles_version != None and version <= 
wfl_info.gles_version
+return wfl_info.gles_version == None or version <= 
wfl_info.gles_version


I know this uses != with None, but we really should be using `is` and `is not`
with None.


OK.





  elif dir_name[:8] == "glsl-es-":
  # OpenGL ES shader test
  version = float(dir_name[8:])
-return wfl_info.glsl_es_version != None and version <= 
wfl_info.glsl_es_version
+return wfl_info.glsl_es_version == None or version <= 
wfl_info.glsl_es_version
  elif dir_name[:3] == "gl-":
  # The directory is a GL version
  version = float(dir_name[3:])
-return version <= wfl_info.gl_version
+return wfl_info.gl_version == None or version <= wfl_info.gl_version
  elif dir_name[:5] == "glsl-":
  # The directory is a GLSL version
  version = float(dir_name[5:])
-return version <= wfl_info.glsl_version
+return wfl_info.glsl_version == None or version <= 
wfl_info.glsl_version
  else:
  # The directory is something else.  Don't skip it.
  return True


With  the nits above fixed,
Reviewed-by: Dylan Baker <dy...@pnwbakers.com>



Thanks!

-Brian


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


[Piglit] [PATCH] all.py: fix extension/version testing when wflinfo fails

2018-02-02 Thread Brian Paul
If wflinfo is not installed or fails, the wfl_info.gl_extensions value
will be the empty set.  Similarly, the gl_version, glsl_version, etc.
will be None.

In those cases, return True from the gl_extension_supported() and
is_feature_directory_supported() functions so that we don't skip any
subdirs.

This is only relevant when PIGLIT_FILTER_DIRECTORIES is set.
---
 tests/all.py | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 6d4e887..eece906 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -217,6 +217,10 @@ wfl_info = wflinfo.WflInfo()
 
 def gl_extension_supported(ext_name):
 """Is the named OpenGL extension supported?"""
+if wfl_info.gl_extensions == set():
+# Don't know what extensions are supported.  Return true so we don't
+# skip anything.
+return True
 return ext_name in wfl_info.gl_extensions
 
 
@@ -227,6 +231,9 @@ def is_feature_directory_supported(dir_name):
 it means the extension/version is possibly suppported.  We're a little
 fuzzy because we don't yet parse all the directory name possibilities
 (like ES tests).
+
+Also, if the 'wflinfo' program is not installed or fails (i.e. we can't
+determine the GL version/extension) we return True.
 """
 if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
 # The directory is a GL extension name, but of the format "arb_foo_bar"
@@ -237,19 +244,19 @@ def is_feature_directory_supported(dir_name):
 elif dir_name[:5] == "gles-":
 # OpenGL ES test
 version = float(dir_name[5:])
-return wfl_info.gles_version != None and version <= 
wfl_info.gles_version
+return wfl_info.gles_version == None or version <= 
wfl_info.gles_version
 elif dir_name[:8] == "glsl-es-":
 # OpenGL ES shader test
 version = float(dir_name[8:])
-return wfl_info.glsl_es_version != None and version <= 
wfl_info.glsl_es_version
+return wfl_info.glsl_es_version == None or version <= 
wfl_info.glsl_es_version
 elif dir_name[:3] == "gl-":
 # The directory is a GL version
 version = float(dir_name[3:])
-return version <= wfl_info.gl_version
+return wfl_info.gl_version == None or version <= wfl_info.gl_version
 elif dir_name[:5] == "glsl-":
 # The directory is a GLSL version
 version = float(dir_name[5:])
-return version <= wfl_info.glsl_version
+return wfl_info.glsl_version == None or version <= 
wfl_info.glsl_version
 else:
 # The directory is something else.  Don't skip it.
 return True
-- 
2.7.4

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


Re: [Piglit] [PATCH] util-gl: use num_components when available when printing bad pixel ubyte

2018-02-02 Thread Brian Paul

On 02/02/2018 04:11 AM, Alejandro Piñeiro wrote:

Instead of a hardcoded 3.
---
  tests/util/piglit-util-gl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index e9c20385ee..df39c1c877 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1249,7 +1249,7 @@ probe_rect_ubyte(int x, int y, int w, int h, int 
num_components,
  
  			if (!silent) {

print_bad_pixel_ubyte(
-   x + i, y + j, 3,
+   x + i, y + j, num_components,
expected, probe);
}
free(pixels);



I posted the same patch a few days ago.  It was reviewed but I forgot to 
push it.  I'll do that now.


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


[Piglit] [PATCH] arb_texture_compression: test set/get of GL_TEXTURE_COMPRESSION_HINT

2018-02-01 Thread Brian Paul
Seems overkill to write a brand new test just for this so add it to
the existing invalid-formats.c test.

See Bugzilla https://bugs.freedesktop.org/show_bug.cgi?id=104908
---
 .../spec/arb_texture_compression/invalid-formats.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/tests/spec/arb_texture_compression/invalid-formats.c 
b/tests/spec/arb_texture_compression/invalid-formats.c
index a201f8f..cca35cc 100644
--- a/tests/spec/arb_texture_compression/invalid-formats.c
+++ b/tests/spec/arb_texture_compression/invalid-formats.c
@@ -412,6 +412,30 @@ try_formats(const struct format_list *t, GLenum 
*compressed_formats,
return pass;
 }
 
+
+static bool
+test_hint(void)
+{
+   GLint hint = 0;
+   glGetIntegerv(GL_TEXTURE_COMPRESSION_HINT, );
+   if (hint != GL_DONT_CARE) {
+   printf("Unexpected default GL_TEXTURE_COMPRESSION_HINT"
+  " value: %s\n", piglit_get_gl_enum_name(hint));
+   return false;
+   }
+
+   glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
+   glGetIntegerv(GL_TEXTURE_COMPRESSION_HINT, );
+   if (hint != GL_NICEST) {
+   printf("Unexpected GL_TEXTURE_COMPRESSION_HINT"
+  " value: %s\n", piglit_get_gl_enum_name(hint));
+   return false;
+   }
+
+   return true;
+}
+
+
 void
 piglit_init(int argc, char **argv)
 {
@@ -593,5 +617,7 @@ piglit_init(int argc, char **argv)
}
}
 
+   pass = test_hint() && pass;
+
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
 }
-- 
2.7.4

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


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

2018-01-31 Thread Brian Paul

On 01/31/2018 05:02 PM, Jordan Justen wrote:

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, );
  



For the series,
Reviewed-by: Brian Paul <bri...@vmware.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


[Piglit] [PATCH 2/3] gl-1.1-color-material-array: test GL_COLOR_MATERIAL with vertex color array

2018-01-24 Thread Brian Paul
Both with and without display lists.
---
 tests/all.py |   1 +
 tests/spec/gl-1.1/CMakeLists.gl.txt  |   1 +
 tests/spec/gl-1.1/color-material-array.c | 118 +++
 3 files changed, 120 insertions(+)
 create mode 100644 tests/spec/gl-1.1/color-material-array.c

diff --git a/tests/all.py b/tests/all.py
index 85e1bb0..54257c1 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -767,6 +767,7 @@ with profile.test_list.group_manager(
 g(['max-texture-size-level'])
 g(['copyteximage', '1D'])
 g(['copyteximage', '2D'])
+g(['gl-1.1-color-material-array'])
 g(['gl-1.1-draw-arrays-start'])
 g(['gl-1.1-read-pixels-after-display-list'])
 g(['gl-1.1-set-vertex-color-after-draw'])
diff --git a/tests/spec/gl-1.1/CMakeLists.gl.txt 
b/tests/spec/gl-1.1/CMakeLists.gl.txt
index 3fe7e93..9ed7ec9 100644
--- a/tests/spec/gl-1.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.1/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (gl-1.1-color-material-array color-material-array.c)
 piglit_add_executable (gl-1.1-draw-arrays-start draw-arrays-start.c)
 piglit_add_executable (gl-1.1-read-pixels-after-display-list 
read-pixels-after-display-list.c)
 piglit_add_executable (gl-1.1-set-vertex-color-after-draw 
set-vertex-color-after-draw.c)
diff --git a/tests/spec/gl-1.1/color-material-array.c 
b/tests/spec/gl-1.1/color-material-array.c
new file mode 100644
index 000..d752699
--- /dev/null
+++ b/tests/spec/gl-1.1/color-material-array.c
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2018 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Test GL_COLOR_MATERIAL with vertex arrays
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 11;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float white[] = {1.0, 1.0, 1.0, 1.0};
+static const float black[] = {0.0, 0.0, 0.0, 0.0};
+
+
+static bool
+test(bool use_dlist)
+{
+   static const float almost_green[] = {0.0, 0.8, 0.0, 0.8};
+   static const float pos[4][2] = {
+   { -1, -1 },
+   { 1, -1 },
+   { 1, 1 },
+   { -1, 1 }
+   };
+   static const float color[4][4] = {
+   { 0.0, 0.4, 0.0, 0.8 },
+   { 0.0, 0.4, 0.0, 0.8 },
+   { 0.0, 0.4, 0.0, 0.8 },
+   { 0.0, 0.4, 0.0, 0.8 }
+   };
+   GLuint list = 0;
+   bool pass = true;
+
+   glClearColor(0.5, 0.5, 0.5, 0.5);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   if (use_dlist) {
+   list = glGenLists(1);
+   glNewList(1, GL_COMPILE);
+   }
+
+   /* Change material per vertex */
+   glColorPointer(4, GL_FLOAT, 0, color);
+   glEnable(GL_COLOR_ARRAY);
+   glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
+   glEnable(GL_COLOR_MATERIAL);
+
+   glVertexPointer(2, GL_FLOAT, 0, pos);
+   glEnable(GL_VERTEX_ARRAY);
+
+   glNormal3f(0, 0, 1);
+
+   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+   if (use_dlist) {
+   glEndList();
+   glCallList(list);
+   glDeleteLists(list, 1);
+   }
+
+   pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
+ almost_green);
+   piglit_present_results();
+
+   if (!pass) {
+   printf("Fail while testing %s\n",
+  use_dlist ? "display list" : "immediate mode");
+   }
+
+   return pass;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = test(false);
+   pass = test(true) && pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int argc, char **argv)

[Piglit] [PATCH 1/3] gl-1.1-draw-arrays-start: exercise glDrawArrays with non-zero 'start'

2018-01-24 Thread Brian Paul
Both with and without display lists.
---
 tests/all.py  |   1 +
 tests/spec/gl-1.1/CMakeLists.gl.txt   |   1 +
 tests/spec/gl-1.1/draw-arrays-start.c | 121 ++
 3 files changed, 123 insertions(+)
 create mode 100644 tests/spec/gl-1.1/draw-arrays-start.c

diff --git a/tests/all.py b/tests/all.py
index 2a2c31a..85e1bb0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -767,6 +767,7 @@ with profile.test_list.group_manager(
 g(['max-texture-size-level'])
 g(['copyteximage', '1D'])
 g(['copyteximage', '2D'])
+g(['gl-1.1-draw-arrays-start'])
 g(['gl-1.1-read-pixels-after-display-list'])
 g(['gl-1.1-set-vertex-color-after-draw'])
 g(['array-stride'])
diff --git a/tests/spec/gl-1.1/CMakeLists.gl.txt 
b/tests/spec/gl-1.1/CMakeLists.gl.txt
index a4c9ac0..3fe7e93 100644
--- a/tests/spec/gl-1.1/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.1/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (gl-1.1-draw-arrays-start draw-arrays-start.c)
 piglit_add_executable (gl-1.1-read-pixels-after-display-list 
read-pixels-after-display-list.c)
 piglit_add_executable (gl-1.1-set-vertex-color-after-draw 
set-vertex-color-after-draw.c)
 piglit_add_executable (gl-1.1-xor xor.c)
diff --git a/tests/spec/gl-1.1/draw-arrays-start.c 
b/tests/spec/gl-1.1/draw-arrays-start.c
new file mode 100644
index 000..bf1290b
--- /dev/null
+++ b/tests/spec/gl-1.1/draw-arrays-start.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2018 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Test glDrawArrays with non-zero start parameter, with and without
+ * display lists.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 14;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const float verts[][2] = {
+   { -0.75, -0.25 },
+   { -0.25, -0.25 },
+   { -0.25,  0.25 },
+   { -0.75,  0.25 },
+   {  0.1f, -0.9f },
+   {  0.9f, -0.9f },
+   {  0.9f,  0.9f },
+   {  0.1f,  0.9f }
+};
+
+
+static const float white[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+static const float black[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+
+
+static bool
+test(bool use_dlist)
+{
+   GLuint list1 = 0, list2 = 0;
+   bool pass;
+
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   if (use_dlist) {
+   list1 = glGenLists(1);
+   glNewList(list1, GL_COMPILE);
+   }
+
+   glEnableClientState(GL_VERTEX_ARRAY);
+   glVertexPointer(2, GL_FLOAT, 0, verts);
+   glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+   if (use_dlist) {
+   glEndList();
+
+   list2 = glGenLists(1);
+   glNewList(list2, GL_COMPILE);
+   }
+
+   glDrawArrays(GL_TRIANGLE_FAN, 4, 4);
+
+   if (use_dlist) {
+   glEndList();
+
+   glCallList(list1);
+   glCallList(list2);
+
+   glDeleteLists(list1, 1);
+   glDeleteLists(list2, 1);
+   }
+
+   pass = piglit_probe_pixel_rgba(piglit_width*1/4, piglit_height/2,
+  white);
+   pass = piglit_probe_pixel_rgba(piglit_width*3/4, piglit_height/2,
+  white) && pass;
+   pass = piglit_probe_pixel_rgba(piglit_width*3/4, 2, black) && pass;
+
+   piglit_present_results();
+
+   if (!pass) {
+   printf("Fail while testing %s\n",
+  use_dlist ? "display list" : "immediate mode");
+   }
+
+   return true;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = test(false);
+   pass = test(true) && pass;
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+
+void
+piglit_init(int 

[Piglit] [PATCH 3/3] gl-2.0-shader-materials: test vertex shader with material attributes

2018-01-24 Thread Brian Paul
Both with and without display lists.
---
 tests/all.py |   1 +
 tests/spec/gl-2.0/CMakeLists.gl.txt  |   1 +
 tests/spec/gl-2.0/shader-materials.c | 141 +++
 3 files changed, 143 insertions(+)
 create mode 100644 tests/spec/gl-2.0/shader-materials.c

diff --git a/tests/all.py b/tests/all.py
index 54257c1..249a85c 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -966,6 +966,7 @@ with profile.test_list.group_manager(
 g(['gl-2.0-vertex-attr-0'])
 g(['gl-2.0-vertex-const-attr'])
 g(['gl-2.0-reuse_fragment_shader'])
+g(['gl-2.0-shader-materials'])
 g(['attrib-assignments'])
 g(['getattriblocation-conventional'])
 g(['clip-flag-behavior'])
diff --git a/tests/spec/gl-2.0/CMakeLists.gl.txt 
b/tests/spec/gl-2.0/CMakeLists.gl.txt
index ce62799..71aa7aa 100644
--- a/tests/spec/gl-2.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-2.0/CMakeLists.gl.txt
@@ -14,6 +14,7 @@ piglit_add_executable (gl-2.0-edgeflag edgeflag.c)
 piglit_add_executable (gl-2.0-edgeflag-immediate edgeflag-immediate.c)
 piglit_add_executable (gl-2.0-large-point-fs large-point-fs.c)
 piglit_add_executable (gl-2.0-link-empty-prog glsl-link-empty-prog.c)
+piglit_add_executable (gl-2.0-shader-materials shader-materials.c)
 piglit_add_executable (gl-2.0-two-sided-stencil two-sided-stencil.c)
 piglit_add_executable (gl-2.0-vertexattribpointer vertexattribpointer.c)
 piglit_add_executable (gl-2.0-vertexattribpointer-size-3 
vertexattribpointer-size-3.c)
diff --git a/tests/spec/gl-2.0/shader-materials.c 
b/tests/spec/gl-2.0/shader-materials.c
new file mode 100644
index 000..e1f8074
--- /dev/null
+++ b/tests/spec/gl-2.0/shader-materials.c
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2018 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Test vertex shader with gl_FrontMaterial and per-vertex materials.
+ *
+ * When using a VS, per-vertex materials are not used.  Instead, the global
+ * material coefficients are the ones accessed via the gl_Front/BackMaterial
+ * built-in uniforms.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+/* VS: color = front ambient + front diffuse + two generic attributes */
+static const char *vs =
+   "attribute vec4 generic1, generic2; \n"
+   "void main()\n"
+   "{\n"
+   "   gl_FrontColor = gl_FrontMaterial.ambient + \n"
+   "   gl_FrontMaterial.diffuse + \n"
+   "   generic1 + generic2; \n"
+   "   gl_Position = ftransform(); \n"
+   "}\n";
+
+static const char *fs =
+   "uniform bool draw_secondary;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = gl_Color;\n"
+   "}\n";
+
+
+static int generic1_attr, generic2_attr;
+
+
+static bool
+test(bool use_dlist)
+{
+   static const float red[] = {1.0, 0.0, 0.0, 1.0};
+   static const float green[] = {0.0, 1.0, 0.0, 1.0};
+   static const float ambient[] = {0.0, 0.3, 0.5, 1.0};
+   static const float diffuse[] = {0.0, 0.2, 0.3, 1.0};
+   static const float generic1[] = { 0.2, 0.3, -0.4, 0.0};
+   static const float generic2[] = {-0.2, 0.2, -0.4, 0.0};
+   static const float pos[4][2] = {
+   { -1, -1 },
+   { 1, -1 },
+   { 1, 1 },
+   { -1, 1 }
+   };
+   GLuint list = 0;
+   bool pass = true;
+
+   glClearColor(0.5, 0.5, 0.5, 0.5);
+   glClear(GL_COLOR_BUFFER_BIT);
+
+   if (use_dlist) {
+   list = glGenLists(1);
+   glNewList(1, GL_COMPILE);
+   }
+
+   /* These are the values picked up by gl_FrontMaterial.ambient, diffuse
+*/
+   glMaterialfv(GL_FRONT, 

[Piglit] [PATCH] util: s/3/num_components/ in probe_rect_ubyte()

2018-01-24 Thread Brian Paul
---
 tests/util/piglit-util-gl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index e9c2038..df39c1c 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -1249,7 +1249,7 @@ probe_rect_ubyte(int x, int y, int w, int h, int 
num_components,
 
if (!silent) {
print_bad_pixel_ubyte(
-   x + i, y + j, 3,
+   x + i, y + j, num_components,
expected, probe);
}
free(pixels);
-- 
2.7.4

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


Re: [Piglit] [PATCH] gl-1.0-blend-func: skip some blend tests when using LLVM 3.8

2018-01-18 Thread Brian Paul

On 01/18/2018 01:27 PM, Eric Anholt wrote:

Brian Paul <bri...@vmware.com> writes:


To avoid an infinite loop.  See code comments for details.


Skipping a failing test and returning pass is wrong to me.


It's not ideal.  But the bug is in LLVM and cannot readily be fixed in 
llvmpipe.


I could have the test return a WARN result in this situation.  Would 
that be better?


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


Re: [Piglit] [PATCH] gl-1.0-blend-func: skip some blend tests when using LLVM 3.8

2018-01-18 Thread Brian Paul

On 01/18/2018 12:38 PM, Roland Scheidegger wrote:

Am 18.01.2018 um 20:07 schrieb Brian Paul:

To avoid an infinite loop.  See code comments for details.
---
  tests/spec/gl-1.0/blend.c | 39 +++
  1 file changed, 39 insertions(+)

diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 35e940f..e69ed31 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -76,6 +76,9 @@ static int test_stride = 1;
  #define img_width drawing_size
  #define img_height drawing_size
  
+static bool using_llvm_3_8 = false;

+
+
  PIGLIT_GL_TEST_CONFIG_BEGIN
  
  	config.supports_gl_compat_version = 10;

@@ -177,6 +180,10 @@ image_init(struct image *image)
 GL_RGBA, GL_FLOAT, image->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+   if (strstr("LLVM 3.8", (const char *) glGetString(GL_RENDERER)) == 0) {
+   using_llvm_3_8 = true;
+   }
  } /* image_init */

FWIW I think this might mistakenly catch other drivers which use llvm
(radeonsi).


I'll fix that by also testing for "llvmpipe".




I am not really sure it's worth the trouble. Personally, I couldn't care
less about llvm 3.8 causing a hang here (distros which updated llvm 3.8
with the fixes from the 3.8 stable branch won't have a problem).


As I mentioned in my other email, I recently updated to Mint 18.3 
(latest version) and this version of LLVM is the default.  Mint 18 is 
based on Ubuntu 16.04 which has LLVM 3.8 also (but I haven't tested it 
to see if has this bug or is fixed).  Same story with Ubuntu 16.10.  So 
this buggy LLVM may be common.




So all
the trouble just for avoiding a bug with some old-ish llvm version seems
a bit overkill to me. I am not sure anymore if it actually was an issue
both on AVX(2) and non-AVX path neither.
Plus an actual app using the affected blend factor combinations will
just hang too, so hiding it here doesn't really seem helpful. (IIRC I
thought about trying to work around it in llvmpipe code, but there was
no trivial solution (for not just avoiding the hang but still correctly
rendering) and I didn't care enough about that particular llvm version,
even more so since it was fixed in the stable branch...)

But in any case if you really think it's worthwile, I am not opposing it
neither, so
Reviewed-by: Roland Scheidegger <srol...@vmware.com>


It'll probably save me some grief so I'd like to push it.

-Brian





  
@@ -532,6 +539,32 @@ apply_blend(GLenum src_factor_rgb, GLenum src_factor_a,

  } /* apply_blend */
  
  
+/**

+ * With unpactched LLVM 3.8, llvmpipe can hit an bug in LLVM which results
+ * in an infinite loop.  See https://bugs.llvm.org/show_bug.cgi?id=27689
+ * This function tries to determine if the test case will hit that bug so
+ * we can skip the test.
+ */
+bool
+skip_on_llvmpipe(GLenum src_factor_rgb, GLenum src_factor_a,
+GLenum dst_factor_rgb, GLenum dst_factor_a)
+{
+   if (!using_llvm_3_8)
+   return false;
+
+   /* This could probably be a bit tighter, but this seems to catch
+* the troublesome cases.
+*/
+   if (src_factor_rgb == GL_CONSTANT_COLOR ||
+   dst_factor_rgb == GL_CONSTANT_COLOR ||
+   dst_factor_a == GL_CONSTANT_COLOR ||
+   dst_factor_a == GL_CONSTANT_ALPHA)
+   return true;
+
+   return false;
+}
+
+
  /* Test for one set of factor levels */
  bool
  run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
@@ -542,6 +575,12 @@ run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
int i, j;
bool pass = true, p;
  
+	if (skip_on_llvmpipe(src_factor_rgb, src_factor_a,

+dst_factor_rgb, dst_factor_a)) 
{
+   /*printf("Skipping Blend test to avoid LLVM bug\n");*/
+   return true;
+   }
+
glDisable(GL_DITHER);
glClear(GL_COLOR_BUFFER_BIT);
  



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


[Piglit] [PATCH] gl-1.0-blend-func: skip some blend tests when using LLVM 3.8

2018-01-18 Thread Brian Paul
To avoid an infinite loop.  See code comments for details.
---
 tests/spec/gl-1.0/blend.c | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 35e940f..e69ed31 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -76,6 +76,9 @@ static int test_stride = 1;
 #define img_width drawing_size
 #define img_height drawing_size
 
+static bool using_llvm_3_8 = false;
+
+
 PIGLIT_GL_TEST_CONFIG_BEGIN
 
config.supports_gl_compat_version = 10;
@@ -177,6 +180,10 @@ image_init(struct image *image)
 GL_RGBA, GL_FLOAT, image->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+   if (strstr("LLVM 3.8", (const char *) glGetString(GL_RENDERER)) == 0) {
+   using_llvm_3_8 = true;
+   }
 } /* image_init */
 
 
@@ -532,6 +539,32 @@ apply_blend(GLenum src_factor_rgb, GLenum src_factor_a,
 } /* apply_blend */
 
 
+/**
+ * With unpactched LLVM 3.8, llvmpipe can hit an bug in LLVM which results
+ * in an infinite loop.  See https://bugs.llvm.org/show_bug.cgi?id=27689
+ * This function tries to determine if the test case will hit that bug so
+ * we can skip the test.
+ */
+bool
+skip_on_llvmpipe(GLenum src_factor_rgb, GLenum src_factor_a,
+GLenum dst_factor_rgb, GLenum dst_factor_a)
+{
+   if (!using_llvm_3_8)
+   return false;
+
+   /* This could probably be a bit tighter, but this seems to catch
+* the troublesome cases.
+*/
+   if (src_factor_rgb == GL_CONSTANT_COLOR ||
+   dst_factor_rgb == GL_CONSTANT_COLOR ||
+   dst_factor_a == GL_CONSTANT_COLOR ||
+   dst_factor_a == GL_CONSTANT_ALPHA)
+   return true;
+
+   return false;
+}
+
+
 /* Test for one set of factor levels */
 bool
 run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
@@ -542,6 +575,12 @@ run_factor_set(GLenum src_factor_rgb, GLenum src_factor_a,
int i, j;
bool pass = true, p;
 
+   if (skip_on_llvmpipe(src_factor_rgb, src_factor_a,
+dst_factor_rgb, dst_factor_a)) 
{
+   /*printf("Skipping Blend test to avoid LLVM bug\n");*/
+   return true;
+   }
+
glDisable(GL_DITHER);
glClear(GL_COLOR_BUFFER_BIT);
 
-- 
2.7.4

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


Re: [Piglit] [PATCH 2/3] gl-1.0-blend-func: add --quick option

2018-01-18 Thread Brian Paul
1.0/blend.c:798
#34 0x00403930 in piglit_display () at 
/home/brianp/pig/tests/spec/gl-1.0/blend.c:822
#35 0x77b3566c in process_next_event (x11_fw=0x62ebd0) at 
/home/brianp/pig/tests/util/piglit-framework-gl/piglit_x11_framework.c:137
#36 0x77b3572c in enter_event_loop (winsys_fw=0x62ebd0) at 
/home/brianp/pig/tests/util/piglit-framework-gl/piglit_x11_framework.c:153
#37 0x77b34cbd in run_test (gl_fw=0x62ebd0, argc=2, 
argv=0x7fffe3a8) at 
/home/brianp/pig/tests/util/piglit-framework-gl/piglit_winsys_framework.c:88
#38 0x77b18f96 in piglit_gl_test_run (argc=2, 
argv=0x7fffe3a8, config=0x7fffe260) at 
/home/brianp/pig/tests/util/piglit-framework-gl.c:229
#39 0x004016a6 in main (argc=2, argv=0x7fffe3a8) at 
/home/brianp/pig/tests/spec/gl-1.0/blend.c:87


test_number = 15740 at this point.

srcRGB = GL_SRC_ALPHA_SATURATE
srcA = GL_ONE_MINUS_SRC_ALPHA
dstRGB =  GL_ONE_MINUS_SRC_COLOR
dstA = GL_CONSTANT_COLOR
opRGB = GL_FUNC_ADD
opA = GL_FUNC_ADD


I'll have to test a newer version of LLVM tomorrow.  Have you run 
gl-1.0-blend-func yourself, Roland?


-Brian



Either way,
for 1-2/3
Reviewed-by: Roland Scheidegger <srol...@vmware.com>

Am 17.01.2018 um 23:54 schrieb Brian Paul:

The test normally runs about 27,000 tests and takes quite a long time
with some drivers. With the --quick option, only 1% of the tests are run.

And update tests/quick.py to run the test with --quick.
---
  tests/quick.py|  7 +++
  tests/spec/gl-1.0/blend.c | 23 ++-
  2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tests/quick.py b/tests/quick.py
index 53774e4..73c4678 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,13 @@ with profile.test_list.group_manager(
  with profile.test_list.allow_reassignment:
  g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')
  
+# Set the --quick flag on the gl-1.0 blending test

+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', '!opengl 1.0')) as g:
+with profile.test_list.allow_reassignment:
+g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func')
+
  # Limit texture size to 512x512 for some texture_multisample tests.
  # The default (max supported size) can be pretty slow.
  with profile.test_list.group_manager(
diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 769339f..192b271 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -64,6 +64,8 @@
  
  #define HUGE_STEP 1000
  
+static int test_stride = 1;

+
  /*
   * We will check each pair of blend factors
   * for each pixel in a square image of this
@@ -187,6 +189,13 @@ piglit_init(int argc, char **argv)
const char* blend_rgb_tol = getenv("PIGLIT_BLEND_RGB_TOLERANCE");
const char* blend_alpha_tol = getenv("PIGLIT_BLEND_ALPHA_TOLERANCE");
  
+	if (argc > 1 && strcmp(argv[1], "--quick") == 0) {

+   /* By default we run 27552 tests which is time consuming.
+* With --quick we run only 1% of the tests.
+*/
+   test_stride = 100;
+   }
+
/*
 * Hack: Make driver tests on incorrect hardware feasible
 * We want to be able to perform meaningful tests
@@ -687,6 +696,7 @@ run_all_factor_sets(void)
bool pass = true;
int gl_version = piglit_get_gl_version();
int counter = 0; /* Number of tests we have done. */
+   int test_number = 0;
int step;
int op, opa;
int sf, sfa, df, dfa;
@@ -784,11 +794,14 @@ run_all_factor_sets(void)
for (dfa = 0; dfa <
 num_dst_factors_sep;
 dfa += step) {
-   pass &= proc_factors(
-   sf, sfa,
-   df, dfa,
-   op, opa);
-   counter++;
+   if (test_number % 
test_stride == 0) {
+   pass &= 
proc_factors(
+   sf, sfa,
+   df, dfa,
+   op, 
opa);
+   counter++;
+   }
+   test_number++;
}
}
 

[Piglit] [PATCH 2/3] gl-1.0-blend-func: add --quick option

2018-01-18 Thread Brian Paul
The test normally runs about 27,000 tests and takes quite a long time
with some drivers. With the --quick option, only 1% of the tests are run.

And update tests/quick.py to run the test with --quick.
---
 tests/quick.py|  7 +++
 tests/spec/gl-1.0/blend.c | 23 ++-
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tests/quick.py b/tests/quick.py
index 53774e4..73c4678 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,13 @@ with profile.test_list.group_manager(
 with profile.test_list.allow_reassignment:
 g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')
 
+# Set the --quick flag on the gl-1.0 blending test
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', '!opengl 1.0')) as g:
+with profile.test_list.allow_reassignment:
+g(['gl-1.0-blend-func', '--quick'], 'gl-1.0-blend-func')
+
 # Limit texture size to 512x512 for some texture_multisample tests.
 # The default (max supported size) can be pretty slow.
 with profile.test_list.group_manager(
diff --git a/tests/spec/gl-1.0/blend.c b/tests/spec/gl-1.0/blend.c
index 769339f..192b271 100644
--- a/tests/spec/gl-1.0/blend.c
+++ b/tests/spec/gl-1.0/blend.c
@@ -64,6 +64,8 @@
 
 #define HUGE_STEP 1000
 
+static int test_stride = 1;
+
 /*
  * We will check each pair of blend factors
  * for each pixel in a square image of this
@@ -187,6 +189,13 @@ piglit_init(int argc, char **argv)
const char* blend_rgb_tol = getenv("PIGLIT_BLEND_RGB_TOLERANCE");
const char* blend_alpha_tol = getenv("PIGLIT_BLEND_ALPHA_TOLERANCE");
 
+   if (argc > 1 && strcmp(argv[1], "--quick") == 0) {
+   /* By default we run 27552 tests which is time consuming.
+* With --quick we run only 1% of the tests.
+*/
+   test_stride = 100;
+   }
+
/* 
 * Hack: Make driver tests on incorrect hardware feasible
 * We want to be able to perform meaningful tests
@@ -687,6 +696,7 @@ run_all_factor_sets(void)
bool pass = true;
int gl_version = piglit_get_gl_version();
int counter = 0; /* Number of tests we have done. */
+   int test_number = 0;
int step;
int op, opa;
int sf, sfa, df, dfa;
@@ -784,11 +794,14 @@ run_all_factor_sets(void)
for (dfa = 0; dfa < 
 num_dst_factors_sep;
 dfa += step) {
-   pass &= proc_factors(
-   sf, sfa, 
-   df, dfa,
-   op, opa);
-   counter++;
+   if (test_number % 
test_stride == 0) {
+   pass &= 
proc_factors(
+   sf, 
sfa, 
+   df, dfa,
+   op, 
opa);
+   counter++;
+   }
+   test_number++;
}
}
}
-- 
2.7.4

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


[Piglit] [PATCH 3/3] gl-1.0-dlist-materials: new test of materials in display lists

2018-01-18 Thread Brian Paul
This exercises two code paths in Mesa's display list VBO code.
---
 tests/all.py|   1 +
 tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
 tests/spec/gl-1.0/dlist-materials.c | 164 
 3 files changed, 166 insertions(+)
 create mode 100644 tests/spec/gl-1.0/dlist-materials.c

diff --git a/tests/all.py b/tests/all.py
index eb496a6..ef8c01b 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -717,6 +717,7 @@ with profile.test_list.group_manager(
 g(['gl-1.0-beginend-coverage'])
 g(['gl-1.0-dlist-beginend'])
 g(['gl-1.0-dlist-bitmap'])
+g(['gl-1.0-dlist-materials'])
 g(['gl-1.0-dlist-shademodel'])
 g(['gl-1.0-drawpixels-color-index'])
 g(['gl-1.0-drawpixels-depth-test'])
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index fcb1d1d..f1d4d93 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ piglit_add_executable (gl-1.0-beginend-coverage 
beginend-coverage.c)
 piglit_add_executable (gl-1.0-blend-func blend.c)
 piglit_add_executable (gl-1.0-dlist-beginend dlist-beginend.c)
 piglit_add_executable (gl-1.0-dlist-bitmap dlist-bitmap.c)
+piglit_add_executable (gl-1.0-dlist-materials dlist-materials.c)
 piglit_add_executable (gl-1.0-dlist-shademodel dlist-shademodel.c)
 piglit_add_executable (gl-1.0-drawbuffer-modes drawbuffer-modes.c)
 piglit_add_executable (gl-1.0-drawpixels-color-index drawpixels-color-index.c)
diff --git a/tests/spec/gl-1.0/dlist-materials.c 
b/tests/spec/gl-1.0/dlist-materials.c
new file mode 100644
index 000..1e61825
--- /dev/null
+++ b/tests/spec/gl-1.0/dlist-materials.c
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2018 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * Test glMaterial calls in a display list.
+ */
+
+#include "piglit-util-gl.h"
+
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 10;
+   config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+PIGLIT_GL_TEST_CONFIG_END
+
+
+static const GLfloat red[] = {1.0, 0.0, 0.0, 1.0};
+static const GLfloat green[] = {0.0, 1.0, 0.0, 1.0};
+static const GLfloat black[] = {0.0, 0.0, 0.0, 1.0};
+static const GLfloat white[] = {1.0, 1.0, 1.0, 1.0};
+
+
+/**
+ * Build display list to draw two quads with a triangle strip
+ * using glMaterial calls to set vertex colors.
+ * \param set_all  If true, set the material attribs for all vertices.
+ * Otherwise, just set the material attribs for two
+ * provoking vertices.
+ *
+ * Note: the set_all parameter controls whether Mesa hits the "loopback" code.
+ */
+static GLuint
+make_list(GLenum mat, bool set_all)
+{
+   GLuint list;
+
+   list = glGenLists(1);
+   glNewList(list, GL_COMPILE);
+
+   /*
+* Draw tri strip drawing two quads- left=red, right=green.
+*/
+   glShadeModel(GL_FLAT);
+   glBegin(GL_TRIANGLE_STRIP);
+   glNormal3f(0, 0, 1);
+
+   /* v0 */
+   if (set_all)
+   glMaterialfv(GL_FRONT_AND_BACK, mat, red);
+   glVertex2f(-1, -1);
+
+   /* v1 */
+   if (set_all)
+   glMaterialfv(GL_FRONT_AND_BACK, mat, red);
+   glVertex2f(-1, 1);
+
+   /* v2 */
+   glMaterialfv(GL_FRONT_AND_BACK, mat, red);
+   glVertex2f( 0, -1);
+
+   /* v3 */
+   if (set_all)
+   glMaterialfv(GL_FRONT_AND_BACK, mat, red);
+   glVertex2f( 0, 1);
+
+   /* v4 */
+   glMaterialfv(GL_FRONT_AND_BACK, mat, green);
+   glVertex2f( 1, -1);
+
+   /* v5 */
+   if (set_all)
+   glMaterialfv(GL_FRONT_AND_BACK, mat, green);
+   glVertex2f( 1, 1);
+
+   glEnd();
+
+   glEndList();
+
+   return list;
+}
+
+
+static bool
+test_material(GLenum mat, bool set_all)
+{
+   

Re: [Piglit] [PATCH] teximage-colors: accept -127 instead of -128 for exact snorm up/download

2018-01-11 Thread Brian Paul

On 01/11/2018 02:45 PM, Roland Scheidegger wrote:

ping?

Am 08.01.2018 um 01:20 schrieb srol...@vmware.com:

From: Roland Scheidegger <srol...@vmware.com>

-128 and -127 represent exactly the same value (-1.0) for snorm8 values,
as do -32768/-32767 for snorm16. Therefore it seems quite reasonable that an
implementation would return the other representation (in particular r600 will
do this with a blit, and the snorm->float->snorm conversion implied by this
will never return the -128/-32768 values).
---
  tests/texturing/teximage-colors.c | 39 +++
  1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/tests/texturing/teximage-colors.c 
b/tests/texturing/teximage-colors.c
index de2024644..61a3c5d15 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -833,10 +833,41 @@ test_exact()
  observed);
pass &= piglit_check_gl_error(GL_NO_ERROR);
  
-	for (i = 0; i < texture_size; ++i)

-   pass &= memcmp([i * texture_size * Bpp],
-  [i * tex_width * Bpp],
-  texture_size * Bpp) == 0;
+   /*
+* For snorm formats, -127/-128 and -32767/-32768 represent the exact
+* same value (-1.0). Therefore, it is quite reasonable to expect
+* an implementation could return the other representation.
+* (We'll assume it will happen only one way the other way seems rather
+* unlikely.)
+*/
+   if (format->data_type == GL_BYTE) {
+   int j;
+   for (j = 0; j < texture_size; ++j) {
+   for (i = 0; i < tex_width * channels; i++) {
+   if (!(data[i] == observed[i] ||
+ (data[i] == 128 && observed[i] == 129))) {


This might be more obvious if you you'd cast the data and observed 
pointers to GLbyte types (like you do for GLshort below) and then test 
for the -127 and -128 values directly.


In any case, Reviewed-by: Brian Paul <bri...@vmware.com>



+   pass = GL_FALSE;
+   }
+   }
+   }
+   } else if (format->data_type == GL_SHORT) {
+   int j;
+   for (j = 0; j < texture_size; ++j) {
+   for (i = 0; i < tex_width * channels; i++) {
+   GLshort datas = ((GLshort *)data)[i];
+   GLshort obss = ((GLshort *)observed)[i];
+   if (!(datas == obss ||
+ (datas == -32768 && obss == -32767))) {
+   pass = GL_FALSE;
+   }
+   }
+   }
+   } else {
+   for (i = 0; i < texture_size; ++i)
+   pass &= memcmp([i * texture_size * Bpp],
+   [i * tex_width * Bpp],
+   texture_size * Bpp) == 0; >> +}
  
  	free(observed);

free(tmp_float);



___
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] gl 1.0: Stress test GL_LINE_LOOP.

2018-01-11 Thread Brian Paul


Reviewed-by: Brian Paul <bri...@vmware.com>


On 01/11/2018 12:54 PM, Fabian Bieler wrote:

Draw circles with long line loops and check the result.

In particular, check that the last line segment is drawn and that no
additional segments in between arbitrary vertices are drawn.

V2: Increase vertex size and count to exhaust Mesa's vbo buffer and Gallium's
 auxiliary draw buffer.
 Add command line argument to set vertex count.
---


I fixed some long line loop issues in Mesa/gallium a few years ago.  I _think_ 
0x2000 (8192) is enough, but you might want to check more (Note that Mesa 
llvmpipe reports GL_MAX_ELEMENTS_VERTICES = 3000).



Also, I see you're stepping the vertex count by <<=2 in the test loop below.  
That _might_ skip some magic vertex counts which tickle bugs. Off-hand I don't have a 
good suggesting for how to be thorough about this without being really slow.

I toyed and dismissed the idea of additional tests with random vertex counts as 
I don't think the occasional failure of this test would be investigated. I did 
add a command line option to manually set the vertex count for easier 
debugging, though.


There's (at least) two places where the vertex buffer limits (the VBO module 
and draw/vbuf code) will trigger splitting/continuing long line loops.  This 
test should try to exceed both those buffer limits.  You might set some 
breakpoints in the Mesa/gallium code to see if they're getting hit.

Mesa's VBO buffer is 1MB. Gallium's auxiliary draw code buffer size varies from 
driver to driver, but it's never bigger than 1MB.
I increased the vertex size and count so that the vertex array is at least 3MB 
in size.

  tests/all.py|   1 +
  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
  tests/spec/gl-1.0/long-line-loop.c  | 199 
  3 files changed, 201 insertions(+)
  create mode 100644 tests/spec/gl-1.0/long-line-loop.c

diff --git a/tests/all.py b/tests/all.py
index 32ab2b610..6abcb3aa8 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -727,6 +727,7 @@ with profile.test_list.group_manager(
  g(['gl-1.0-edgeflag-quads'])
  g(['gl-1.0-empty-begin-end-clause'])
  g(['gl-1.0-long-dlist'])
+g(['gl-1.0-long-line-loop'])
  g(['gl-1.0-readpixels-oob'])
  g(['gl-1.0-rendermode-feedback'])
  g(['gl-1.0-front-invalidate-back'], run_concurrent=False)
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 355df7472..2df3a8cf4 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -26,6 +26,7 @@ piglit_add_executable (gl-1.0-fpexceptions fpexceptions.c)
  piglit_add_executable (gl-1.0-front-invalidate-back front-invalidate-back.c)
  piglit_add_executable (gl-1.0-logicop logicop.c)
  piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
+piglit_add_executable (gl-1.0-long-line-loop long-line-loop.c)
  piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
  piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
  piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
diff --git a/tests/spec/gl-1.0/long-line-loop.c 
b/tests/spec/gl-1.0/long-line-loop.c
new file mode 100644
index 0..02b756caa
--- /dev/null
+++ b/tests/spec/gl-1.0/long-line-loop.c
@@ -0,0 +1,199 @@
+/*
+ * Copyright © 2017 Fabian Bieler
+ *
+ * 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 long-line-loop.c
+ * Draw cricles with line loops and a line strips blended on top of each
+ * other and check that the renderings match.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_width = 1024;
+   config.window_height = 1024;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_

Re: [Piglit] [PATCH 01/18] util/gl: Print numeric value of unrecognized enums.

2018-01-09 Thread Brian Paul

On 01/07/2018 03:13 PM, Fabian Bieler wrote:

Use a static cyclic buffer of 4096 bytes. This should give returned
strings a long enough lifetime.
---
  tests/util/piglit-util-gl-enum-gen.c.mako | 14 +-
  1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-util-gl-enum-gen.c.mako 
b/tests/util/piglit-util-gl-enum-gen.c.mako
index 1a878c945..3e07b9d69 100644
--- a/tests/util/piglit-util-gl-enum-gen.c.mako
+++ b/tests/util/piglit-util-gl-enum-gen.c.mako
@@ -38,7 +38,19 @@ piglit_get_gl_enum_name(GLenum param)
  >---case ${enum.c_num_literal}: return "${enum.name}";
  % endif
  % endfor
->---default: return "(unrecognized enum)";
+>---default: {
+>--->---static const char *format = "(unrecognized enum: 0x%X)";
+>--->---static char buffer[4096];
+>--->---static char *position = buffer;
+>--->---const ptrdiff_t size_left = 4096 - (position - buffer);
+>--->---const size_t size_needed = strlen(format) + 8 - 2 + 1;
+>--->---if (size_left < size_needed)
+>--->--->---position = buffer;
+>--->---const int len = sprintf(position, format, param);
+>--->---const char *old_position = position;
+>--->---position += len + 1;
+>--->---return old_position;
+>--->---}
  >---}
  }
  



I didn't do a super detailed review, but the series looks good.

Reviewed-by: Brian Paul <bri...@vmware.com>

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


Re: [Piglit] [PATCH 12/18] gl 1.0: Stress test GL_LINE_LOOP.

2018-01-09 Thread Brian Paul

On 01/07/2018 03:14 PM, Fabian Bieler wrote:

Draw circles with long line loops and check the result.

In particular, check that the last line segment is drawn and that no
additional segments in between arbitrary vertices are drawn.
---
  tests/all.py|   1 +
  tests/spec/gl-1.0/CMakeLists.gl.txt |   1 +
  tests/spec/gl-1.0/long-line-loop.c  | 151 
  3 files changed, 153 insertions(+)
  create mode 100644 tests/spec/gl-1.0/long-line-loop.c

diff --git a/tests/all.py b/tests/all.py
index 32ab2b610..6abcb3aa8 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -727,6 +727,7 @@ with profile.test_list.group_manager(
  g(['gl-1.0-edgeflag-quads'])
  g(['gl-1.0-empty-begin-end-clause'])
  g(['gl-1.0-long-dlist'])
+g(['gl-1.0-long-line-loop'])
  g(['gl-1.0-readpixels-oob'])
  g(['gl-1.0-rendermode-feedback'])
  g(['gl-1.0-front-invalidate-back'], run_concurrent=False)
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt 
b/tests/spec/gl-1.0/CMakeLists.gl.txt
index 355df7472..2df3a8cf4 100644
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt
@@ -26,6 +26,7 @@ piglit_add_executable (gl-1.0-fpexceptions fpexceptions.c)
  piglit_add_executable (gl-1.0-front-invalidate-back front-invalidate-back.c)
  piglit_add_executable (gl-1.0-logicop logicop.c)
  piglit_add_executable (gl-1.0-long-dlist long-dlist.c)
+piglit_add_executable (gl-1.0-long-line-loop long-line-loop.c)
  piglit_add_executable (gl-1.0-ortho-pos orthpos.c)
  piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)
  piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)
diff --git a/tests/spec/gl-1.0/long-line-loop.c 
b/tests/spec/gl-1.0/long-line-loop.c
new file mode 100644
index 0..768e1aa85
--- /dev/null
+++ b/tests/spec/gl-1.0/long-line-loop.c
@@ -0,0 +1,151 @@
+/*
+ * Copyright © 2017 Fabian Bieler
+ *
+ * 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 long-line-loop.c
+ * Draw cricles with line loops and a line strips blended on top of each
+ * other and check that the renderings match.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+   config.window_width = 1024;
+   config.window_height = 1024;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static int max_vertices;
+static int probe_location[2];
+static const float radius = 0.9;
+
+void
+piglit_init(int argc, char **argv)
+{
+   /* This isn't a hard limit, but staying below should help performance.
+*
+* XXX: It could be interesting to go beyond this limit to test a
+* different code path in the GL implementation.
+*/
+   glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, _vertices);
+   max_vertices = CLAMP(max_vertices, 0x2000, 0x4);


I fixed some long line loop issues in Mesa/gallium a few years ago.  I 
_think_ 0x2000 (8192) is enough, but you might want to check more (Note 
that Mesa llvmpipe reports GL_MAX_ELEMENTS_VERTICES = 3000).


Also, I see you're stepping the vertex count by <<=2 in the test loop 
below.  That _might_ skip some magic vertex counts which tickle bugs. 
Off-hand I don't have a good suggesting for how to be thorough about 
this without being really slow.


There's (at least) two places where the vertex buffer limits (the VBO 
module and draw/vbuf code) will trigger splitting/continuing long line 
loops.  This test should try to exceed both those buffer limits.  You 
might set some breakpoints in the Mesa/gallium code to see if they're 
getting hit.


For reference, see Mesa  bdf6cef0333bf7278, b48e16fa2f8b96bb36a6e0, 
d79595bf0230824b2


I wish I'd have had this test back then!

-Brian



+
+   glBlendFunc(GL_ONE, GL_ONE);
+
+   

Re: [Piglit] [PATCH] fbo-formats: Remove GLenum stringification macros.

2017-12-29 Thread Brian Paul


On 12/29/2017 05:16 PM, Fabian Bieler wrote:

Replace GLenum stringification macros with calls to piglit_get_gl_enum_name.

V2: Make sure GL 1.0 legacy internal formats '3' and '4' are logged
correctly.


Reviewed-by: Brian Paul <bri...@vmware.com>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] Remove GLenum names from tests.

2017-12-29 Thread Brian Paul

On 12/28/2017 08:57 AM, Fabian Bieler wrote:

This series replaces hard-coded GLenum names with calls to 
piglit_get_gl_enum_name.


Nice.  I guess I didn't realise how many tests needed this fix.



Notes:

Some of the removed, hard-coded Glenum names had vendor, ARB, or EXT suffixes 
where piglit_get_gl_enum_name returns the suffix-less name.
This means that some subtests are renamed by this series.

In some cases string comparisons of command line arguments and GLenum names are 
replaced by integer comparison of piglit_get_gl_enum_from_name(cmd_line_arg) 
and GLenums.
This is to ensure that future updates to gl.xml don't necessitate updates to 
all.py.
However, these tests now abort on unknown command line arguments which were 
silently ignored, previously. I hope this is acceptable.


As long as we don't have aborts when running tests/all.py I think that's OK.

Reviewed-by: Brian Paul <bri...@vmware.com>

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


Re: [Piglit] [PATCH] arb_texture_multisample: stress test of very large textures (v3)

2017-12-27 Thread Brian Paul

On 12/26/2017 11:57 PM, Arthur Huillet wrote:

On Sun, 24 Dec 2017 15:41:38 -0700
Brian Paul <bri...@vmware.com> wrote:


+ * Some drivers/GPUs may fail this test.  NVIDIA, for example, appears to
+ * only store the MSAA coverage info, not the sample colors, for samples
+ * beyond the 8th sample.  We may tune the way this test operates over time
+ * to be more useful.  Maybe we should test all MSAA samples/pixels (2x,
+ * 4x, 8x, etc).


If you believe the NVIDIA driver is wrong, please let us know what needs to be 
fixed and we'll look into it.


Just to be clear, I'm referring to the NVIDIA proprietary driver, not 
the gallium driver.




If on the other hand you can't prove that the NVIDIA driver is wrong,
then please don't write a test that "fails" when you have no evidence
that it isn't the test that is incorrect. Otherwise this tends to
claim "this is required OpenGL driver behavior" and confuse everyone.


I haven't done an exhaustive search of the specifications, but so far I 
haven't found any language that permits "tricks" like NVIDIAs CSAA 
technique for "standard" MSAA textures.  That is, the spec seems to 
expect that if a texture stores N samples per texel, then there are N 
distinct colors stored per texel.  It's a different story with the 
GL_NV_framebuffer_multisample_coverage extension, though.


If you have more insight into this, I'm all ears.

FWIW, from Googling it sounds like more recent NVIDIA GPUs (Kepler and 
later) no longer advertise 16x and 32x MSAA so those devices would 
probably pass this test.


-Brian

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


[Piglit] [PATCH] arb_texture_multisample: stress test of very large textures (v3)

2017-12-24 Thread Brian Paul
Create the largest possible 2D GL_RGBA_32F multisampled texture, load it
with known values the read it back and see if the values match up.

The --array option runs the test with a 2D texture array instead of an
MSAA texture.  There are other options to specify texture size, number of
samples, fp16 and a texel value scale.

Fails with NVIDIA's driver.  See code comments.

Note: The entry in all.py limits the texture size to 512x512 so it runs
in a reasonable amount of time.  Ideally, the texture size should be set
in quick.py instead but I've been unable to make that work.

v2:
* Fix a few code issues raised by Fabian Bieler, fix all.py, quick.py code.
* Update comments about NVIDIA driver, per Roland.
v3:
* remove config.khr_no_error_support line.
---
 tests/all.py   |   8 +
 tests/quick.py |  17 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |   1 +
 .../arb_texture_multisample/large-float-texture.c  | 727 +
 4 files changed, 753 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/large-float-texture.c

diff --git a/tests/all.py b/tests/all.py
index 5d90e8f..d55cca9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1651,6 +1651,14 @@ with profile.test_list.group_manager(
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
+g(['arb_texture_multisample-large-float-texture'], 'large-float-texture',
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'],
+  'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'],
+  'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'],
+  'large-float-texture-array-fp16', run_concurrent=False)
 g(['arb_texture_multisample-minmax'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/quick.py b/tests/quick.py
index 1a7d674..53774e4 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,23 @@ with profile.test_list.group_manager(
 with profile.test_list.allow_reassignment:
 g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')
 
+# Limit texture size to 512x512 for some texture_multisample tests.
+# The default (max supported size) can be pretty slow.
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'ARB_texture_multisample')) as g:
+with profile.test_list.allow_reassignment:
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  'large-float-texture', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] +
+  size_arg, 'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] +
+  size_arg, 'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array',
+   '--fp16'] + size_arg,
+  'large-float-texture-array-fp16', run_concurrent=False)
+
 # These take too long
 profile.filters.append(lambda n, _: '-explosion' not in n)
 profile.filters.append(FilterVsIn())
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index a347143..31965c4 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_multisample-large-float-texture 
large-float-texture.c)
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)
 piglit_add_executable (arb_texture_multisample-errors errors.c)
 piglit_add_executable (arb_texture_multisample-fb-completeness 
fb-completeness.c)
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
new file mode 100644
index 000..2e05a6e
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -0,0 +1,727 @@
+/*
+ * Copyright (c) 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 

Re: [Piglit] [PATCH] squash! arb_texture_multisample: stress test of very large textures

2017-12-23 Thread Brian Paul

On 12/22/2017 05:05 PM, Fabian Bieler wrote:

Only limit texture size to 512x512 in quick.py.
---
If you squash this into your test it should only limit the texture size in the 
'quick' profile.

Two nitpicks:

+   config.khr_no_error_support = PIGLIT_NO_ERRORS;

Isn't it possible for this test to generate GL errors during its attempts to 
create the largest possible texture?


Yes, I'll rm that.





+   while (width > 1 && height > 1) {
+   tex = create_texture_max_size(target, intFormat,
+ , , samples);
+
+   if (!tex) {
+   printf("Failed to create MSAA texture\n");
+   piglit_report_result(PIGLIT_FAIL);
+   }
+
+   fbo = create_fbo(tex, target);
+   if (!fbo) {
+   /* texture creation worked, but FBO failed.
+* Try smaller texture.
+*/
+   glDeleteTextures(1, );
+   if (height >= width) {
+   height /= 2;
+   }
+   else {
+   width /= 2;
+   }
+   }
+   else {
+   break;
+   }
+   }

In theory it's possible to exit this loop without an fbo. I have no idea if 
there are GL implementations that can't create float fbos, so this might be 
pathological.


I suppose that could fail if something's not working properly.  I'll 
check for fbo==0 and report PIGLIT_FAIL in that case.




Reviewed-by: Fabian Bieler 


Thanks!

I have some comment updates coming in v2 too.

-Brian



  tests/all.py   | 18 +++---
  tests/quick.py | 17 +
  .../spec/arb_texture_multisample/large-float-texture.c |  6 +-
  3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index 330bd138e..7306e39e6 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1653,18 +1653,14 @@ with profile.test_list.group_manager(
  # Group ARB_texture_multisample
  with profile.test_list.group_manager(
  PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as 
g:
-# XXX limit texture size to 512x512.  The default (max supported size)
-# can be pretty slow.  Ideally, we should set --texsize in quick.py but
-# I haven't figured out how to make that work.
-size_arg = ['--texsize', '512']
-g(['arb_texture_multisample-large-float-texture'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--array'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--fp16'] + size_arg,
-  run_concurrent=False)
-g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'] + 
size_arg,
+g(['arb_texture_multisample-large-float-texture'], 'large-float-texture',
run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'],
+  'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'],
+  'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'],
+  'large-float-texture-array-fp16', run_concurrent=False)
  g(['arb_texture_multisample-minmax'])
  g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
  g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/quick.py b/tests/quick.py
index 1a7d674d0..53774e4db 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,23 @@ with profile.test_list.group_manager(
  with profile.test_list.allow_reassignment:
  g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')

+# Limit texture size to 512x512 for some texture_multisample tests.
+# The default (max supported size) can be pretty slow.
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'ARB_texture_multisample')) as g:
+with profile.test_list.allow_reassignment:
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  'large-float-texture', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] +
+  size_arg, 'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] +
+  size_arg, 'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array',
+   '--fp16'] + size_arg,
+  'large-float-texture-array-fp16', run_concurrent=False)
+
  # These take too long
  profile.filters.append(lambda n, _: 

[Piglit] [PATCH] arb_texture_multisample: stress test of very large textures (v2)

2017-12-23 Thread Brian Paul
Create the largest possible 2D GL_RGBA_32F multisampled texture, load it
with known values the read it back and see if the values match up.

The --array option runs the test with a 2D texture array instead of an
MSAA texture.  There are other options to specify texture size, number of
samples, fp16 and a texel value scale.

Fails with NVIDIA's driver.  See code comments.

Note: The entry in all.py limits the texture size to 512x512 so it runs
in a reasonable amount of time.  Ideally, the texture size should be set
in quick.py instead but I've been unable to make that work.

v2:
* Fix a few code issues raised by Fabian Bieler, fix all.py, quick.py code.
* Update comments about NVIDIA driver, per Roland.
---
 tests/all.py   |   8 +
 tests/quick.py |  17 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |   1 +
 .../arb_texture_multisample/large-float-texture.c  | 728 +
 4 files changed, 754 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/large-float-texture.c

diff --git a/tests/all.py b/tests/all.py
index 5d90e8f..d55cca9 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1651,6 +1651,14 @@ with profile.test_list.group_manager(
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
+g(['arb_texture_multisample-large-float-texture'], 'large-float-texture',
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'],
+  'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'],
+  'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'],
+  'large-float-texture-array-fp16', run_concurrent=False)
 g(['arb_texture_multisample-minmax'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/quick.py b/tests/quick.py
index 1a7d674..53774e4 100644
--- a/tests/quick.py
+++ b/tests/quick.py
@@ -68,6 +68,23 @@ with profile.test_list.group_manager(
 with profile.test_list.allow_reassignment:
 g(['ext_texture_env_combine-combine', '--quick'], 
'texture-env-combine')
 
+# Limit texture size to 512x512 for some texture_multisample tests.
+# The default (max supported size) can be pretty slow.
+with profile.test_list.group_manager(
+PiglitGLTest,
+grouptools.join('spec', 'ARB_texture_multisample')) as g:
+with profile.test_list.allow_reassignment:
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  'large-float-texture', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] +
+  size_arg, 'large-float-texture-array', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] +
+  size_arg, 'large-float-texture-fp16', run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array',
+   '--fp16'] + size_arg,
+  'large-float-texture-array-fp16', run_concurrent=False)
+
 # These take too long
 profile.filters.append(lambda n, _: '-explosion' not in n)
 profile.filters.append(FilterVsIn())
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index a347143..31965c4 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_multisample-large-float-texture 
large-float-texture.c)
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)
 piglit_add_executable (arb_texture_multisample-errors errors.c)
 piglit_add_executable (arb_texture_multisample-fb-completeness 
fb-completeness.c)
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
new file mode 100644
index 000..3a77d43
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -0,0 +1,728 @@
+/*
+ * Copyright (c) 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial 

[Piglit] [PATCH] arb_texture_multisample: stress test of very large textures

2017-12-22 Thread Brian Paul
Create the largest possible 2D GL_RGBA_32F multisampled texture, load it
with known values the read it back and see if the values match up.

The --array option runs the test with a 2D texture array instead of an
MSAA texture.  There are other options to specify texture size, number of
samples, fp16 and a texel value scale.

Fails with NVIDIA's driver.  See code comments.

Note: The entry in all.py limits the texture size to 512x512 so it runs
in a reasonable amount of time.  Ideally, the texture size should be set
in quick.py instead but I've been unable to make that work.
---
 tests/all.py   |  12 +
 .../spec/arb_texture_multisample/CMakeLists.gl.txt |   1 +
 .../arb_texture_multisample/large-float-texture.c  | 723 +
 3 files changed, 736 insertions(+)
 create mode 100644 tests/spec/arb_texture_multisample/large-float-texture.c

diff --git a/tests/all.py b/tests/all.py
index 5d90e8f..681e3a0 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1651,6 +1651,18 @@ with profile.test_list.group_manager(
 # Group ARB_texture_multisample
 with profile.test_list.group_manager(
 PiglitGLTest, grouptools.join('spec', 'ARB_texture_multisample')) as g:
+# XXX limit texture size to 512x512.  The default (max supported size)
+# can be pretty slow.  Ideally, we should set --texsize in quick.py but
+# I haven't figured out how to make that work.
+size_arg = ['--texsize', '512']
+g(['arb_texture_multisample-large-float-texture'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--fp16'] + size_arg,
+  run_concurrent=False)
+g(['arb_texture_multisample-large-float-texture', '--array', '--fp16'] + 
size_arg,
+  run_concurrent=False)
 g(['arb_texture_multisample-minmax'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x71-501x71'])
 g(['texelFetch', 'fs', 'sampler2DMS', '4', '1x130-501x130'])
diff --git a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt 
b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
index a347143..31965c4 100644
--- a/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
+++ b/tests/spec/arb_texture_multisample/CMakeLists.gl.txt
@@ -9,6 +9,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
 )
 
+piglit_add_executable (arb_texture_multisample-large-float-texture 
large-float-texture.c)
 piglit_add_executable (arb_texture_multisample-minmax minmax.c)
 piglit_add_executable (arb_texture_multisample-errors errors.c)
 piglit_add_executable (arb_texture_multisample-fb-completeness 
fb-completeness.c)
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c 
b/tests/spec/arb_texture_multisample/large-float-texture.c
new file mode 100644
index 000..7e2db1a
--- /dev/null
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -0,0 +1,723 @@
+/*
+ * Copyright (c) 2017 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** @file large-float-texture.c
+ *
+ * Test large MSAA float textures.  In particular, create/load a multisample
+ * texture then read it back and compare returned values.
+ * Also support array textures instead of MSAA as a sanity check / debug
+ * option.
+ *
+ * With some GPUs/drivers it appears that some sort of texture compression
+ * is used with MSAA textures which cross a certain threshold of sample/pixel
+ * or total memory size.  NVIDIA, for example fails this test for 16 or 32
+ * samples or textures > approx 2GB.  Perhaps the test tolerance should be
+ * loosened up.
+ *
+ * See code for command line arguments.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+   config.supports_gl_compat_version = 30;
+   config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+   

Re: [Piglit] [PATCH 0/6] Set of little documentation and code cleanups

2017-12-21 Thread Brian Paul

On 12/20/2017 11:49 PM, Rhys Kidd wrote:

Have been carrying these patches locally for a little while, but rebased to get
them readdy for upstream given the cleaning up of bugs/ recently.

Rhys Kidd (6):
   ext_framebuffer_object: Fix typo in two copyright blocks
   completions/bash: Fix spelling mistakes
   completions/bash: Update list of profile completions to match on
   README: Fix spelling mistakes
   README: Document deqp_gles3.py configuration deprecation
   framework: Correct comment typo in piglit.conf.example

  README | 10 --
  completions/bash/piglit| 23 +++---
  piglit.conf.example|  2 +-
  tests/spec/ext_framebuffer_object/error-handling.c |  2 +-
  tests/spec/ext_framebuffer_object/mipmap.c |  2 +-
  5 files changed, 19 insertions(+), 20 deletions(-)



For the series, Reviewed-by: Brian Paul <bri...@vmware.com>

Do you need me to push these for you?

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


[Piglit] [PATCH] ext_transform_feedback-max-varyings: reduce output upon failures

2017-12-18 Thread Brian Paul
Stop running the test after 10 failures.  As it was, a failure could
lead to nearly 9MB of output.
---
 tests/spec/ext_transform_feedback/max-varyings.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/tests/spec/ext_transform_feedback/max-varyings.c 
b/tests/spec/ext_transform_feedback/max-varyings.c
index 4a5086c..1f83b60 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -249,6 +249,7 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
int vertex, varying, i;
float (*buffer)[4] = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,
 GL_READ_ONLY);
+   int numFail = 0;
 
for (vertex = 0; vertex < 6; ++vertex) {
for (varying = 0; varying < num_xfb_varyings; ++varying) {
@@ -273,10 +274,14 @@ check_xfb_output(int max_varyings, int num_xfb_varyings,
   actual[0], actual[1], actual[2],
   actual[3]);
pass = GL_FALSE;
+   if (++numFail >= 10) {
+   goto end;
+   }
}
}
}
 
+end:
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER);
 
return pass;
@@ -322,9 +327,12 @@ draw(GLuint vs, GLuint fs, int num_xfb_varyings,
 
glEndTransformFeedback();
pass = check_xfb_output(max_varyings, num_xfb_varyings,
- offset, xfb_varyings) && pass;
+ offset, xfb_varyings);
 
glDeleteProgram(prog);
+   if (!pass) {
+   break;
+   }
}
 
return pass;
@@ -341,8 +349,10 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
glClear(GL_COLOR_BUFFER_BIT);
 
for (row = 0; row < max_xfb_varyings; row++) {
-   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings) &&
-  pass;
+   pass = draw(vs, fs, row + 1, max_varyings, xfb_varyings);
+   if (!pass) {
+   goto end;
+   }
}
 
for (row = 0; row < max_xfb_varyings; row++) {
@@ -359,10 +369,11 @@ run_subtest(GLuint vs, GLuint fs, int max_xfb_varyings,
   " captured and offset %d\n",
   row + 1, col);
pass = GL_FALSE;
-   break;
+   goto end;
}
}
}
+end:
return pass;
 }
 
-- 
1.9.1

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


[Piglit] [PATCH] ext_transform_feedback-interleaved: disable unneeded printfs()

2017-12-18 Thread Brian Paul
No need to print passing cases.  Reduced log noise.
---
 tests/spec/ext_transform_feedback/interleaved.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/spec/ext_transform_feedback/interleaved.c 
b/tests/spec/ext_transform_feedback/interleaved.c
index a52474c..0d237d7 100644
--- a/tests/spec/ext_transform_feedback/interleaved.c
+++ b/tests/spec/ext_transform_feedback/interleaved.c
@@ -189,7 +189,8 @@ enum piglit_result piglit_display(void)
if (fabs(ptr[i] - expected[i]) > 0.01) {
printf("Buffer[%i]: %f,  Expected: %f\n", i, ptr[i], 
expected[i]);
pass = GL_FALSE;
-   } else {
+   } else if (0) {
+   /* debug */
printf("Buffer[%i]: %f,  Expected: %f -- OK\n", i, 
ptr[i], expected[i]);
}
}
-- 
1.9.1

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


Re: [Piglit] Move and rename tests from bugs/ to spec/ directory.

2017-12-18 Thread Brian Paul

On 12/16/2017 12:20 PM, Fabian Bieler wrote:

Also includes some formatting fixes,

updated some comments (particularly added license comments) and

corrected value of config.supports_gl_compat_version in some cases.



Some tests were moved to different profiles in all.py (noted in commit
msg).


Otherwise no changes.


Looks good.  Thanks!

Reviewed-by: Brian Paul <bri...@vmware.com>







Nicolai Hähnle, Vinson Lee, Wiktor Janas: Do any of you take issue with
the addition of the MIT copyright notice?
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_piglit=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=X1F6hpmEs_mJ476uE9u_Ipd37Jd6yAVrarcS-VFYYLw=_ygqJCgOCtw8Y0JIyzR1IWylr0ibLgnRE6KGBkvg8i0=



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


Re: [Piglit] [PATCH 1/2] tox: use six >= 1.10.0

2017-12-15 Thread Brian Paul

On 12/15/2017 03:57 AM, Juan A. Suarez Romero wrote:

---
  tox.ini | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tox.ini b/tox.ini
index c1b7a0104..2bd99f544 100644
--- a/tox.ini
+++ b/tox.ini
@@ -27,7 +27,7 @@ deps =
  pytest-warnings
  pytest-timeout
  py{27,33,34}: mako==0.8.0
-six==1.5.2
+six>=1.10.0
  {accel,noaccel,streams}: jsonschema
  streams: jsonstreams>=0.4.1
  commands =



The change looks fine, but the commit message should say why the change 
is being made.


-Brian

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


[Piglit] [PATCH] arb_texture_view: fix order of vertices in draw_3d_depth()

2017-12-13 Thread Brian Paul
The vertices are drawn with a GL_TRIANGLE_STRIP.  As it was, the
order of the 3rd and 4th vertices caused us to render a "twisted"
quad.  With this change, a true quad is drawn.

llvmpipe passes as it did before.  NVIDIA's driver still fails the test.
---
 tests/spec/arb_texture_view/common.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
index fc18bbc..f2453f5 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -105,13 +105,13 @@ void
 draw_3d_depth(float x, float y, float w, float h, int depth)
 {
const GLfloat vertices[16] =  {x, y, depth, 0.0,
-x+w, y, depth, 0.0,
-x+w, y+h, depth, 0.0,
-x, y+h, depth, 0.0};
+  x+w, y, depth, 0.0,
+  x, y+h, depth, 0.0,
+  x+w, y+h, depth, 0.0};
const GLfloat texcoords[8] = {0.0, 0.0,
-1.0, 0.0,
-1.0, 1.0,
-0.0, 1.0};
+ 1.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 1.0};
 
piglit_draw_rect_from_arrays(vertices, texcoords, false, 1);
 }
-- 
1.9.1

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


Re: [Piglit] Remove remaing Glean tests.

2017-12-11 Thread Brian Paul

The series looks good to me.  Thanks for doing this.

Reviewed-by: Brian Paul <bri...@vmware.com>

On 12/09/2017 05:52 AM, Fabian Bieler wrote:

This series removes the remaing Glean tests from Piglit.

3 subtests were cherry-picked and ported to Piglit.

These test were removed without replacement:
api2no real value
vertattrib  GL_NV_vertex_program not supported by mesa (anymore)
makeCurrent glX api n/a to piglit

Locations for the replacing Piglit tests ('*' indicates new tests):
fbo:
fbo/fbo-1d.c, fbo-3d.c, fbo/fbo-cubemap.c, fbo/fbo-drawbuffers-maxtargets.c, 
fbo/fbo-depthtex.c, spec/ext_framebuffer_object/mipmap.c*, 
fbo/fbo-incomplete.cpp, spec/ext_framebuffer_object/error-handling.c*

fragProg1:
shaders/fp-*, spec/arb_fragment_program/*

pixelFormats:
texturing/texture-packed-formats.c

shaderAPI:
shaders/getuniform-0[23].c, general/getactiveattrib.c, 
shaders/glsl-uniform-out-of-bounds*.c, shaders/getuniform-0?.c, 
spec/gl-2.0/api/uniform-neg-location.c*, 
shaders/glsl-fs-uniform-bool-?.shader_test

texCube:
texturing/cubemap.c

texture_srgb:
texturing/tex-srgb.c

vertArrayBGRA:
general/bgra-sec-color-pointer.c, general/bgra-vert-attrib-pointer.c

See also:
https://bugs.freedesktop.org/show_bug.cgi?id=65676
https://bugs.freedesktop.org/attachment.cgi?id=107443

___
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] textureGather: add new options for testing mirror address modes

2017-12-11 Thread Brian Paul

On 12/09/2017 09:48 PM, srol...@vmware.com wrote:

From: Roland Scheidegger <srol...@vmware.com>

The existing repeat and clamp modes are easy to implement. The
mirror_repeat (GL_MIRRORED_REPEAT) and mirror_clamp
(GL_MIRROR_CLAMP_TO_EDGE) modes however have some very interesting
differences to "gather is just the same as bilinear filtering without
the actual filtering". In particular, a bilinear filter implementation
can cut a lot of corners wrt texel selection as it doesn't need to
maintain texel order (as long as the weights follow the same order) and
can even pick different samples (as long as they have weight 0).
So, test these modes too. I used this for fixing llvmpipe, passes with
nvidia blob too (the test actually always hits exactly the cases where
one texel would have weight 0).
---
  tests/texturing/shaders/textureGather.c | 21 -
  1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/tests/texturing/shaders/textureGather.c 
b/tests/texturing/shaders/textureGather.c
index f364c5c..8ea94b6 100644
--- a/tests/texturing/shaders/textureGather.c
+++ b/tests/texturing/shaders/textureGather.c
@@ -135,6 +135,23 @@ pixel_value(int i, int j, int offset_sel)
if (i > texture_width - 1) i = texture_width - 1;
if (j > texture_height - 1) j = texture_height - 1;
}
+   else if (address_mode == GL_MIRRORED_REPEAT) {
+   bool isOdd;
+   if (i < 0) i = -i - 1;


One nit-pick:  I realize you're following the style above, but I think 
putting this on two lines is better.  That is:


if (i < 0)
i = -i - 1;

Just in case someone ever needs to set a breakpoint when debugging.

Reviewed-by: Brian Paul <bri...@vmware.com>


+   isOdd = (i / texture_width) & 1;
+   i = i % texture_width;
+   if (isOdd) i = texture_width - i - 1;
+   if (j < 0) j = -j - 1;
+   isOdd = (j / texture_height) & 1;
+   j = j % texture_height;
+   if (isOdd) j = texture_height - j - 1;
+   }
+   else if (address_mode == GL_MIRROR_CLAMP_TO_EDGE) {
+   if (i < 0) i = -i - 1;
+   if (j < 0) j = -j - 1;
+   if (i > texture_width - 1) i = texture_width - 1;
+   if (j > texture_height - 1) j = texture_height - 1;
+   }

return i + j * texture_width;
  }
@@ -555,7 +572,7 @@ fail_with_usage(void)
   "   comptype = unorm|float|uint|int|shadow\n"
   "   sampler = 2D|2DArray|Cube|CubeArray|2DRect\n"
   "   compselect = 0|1|2|3\n"
-  "   addressmode = repeat|clamp\n");
+  "   addressmode = repeat|clamp|mirror_repeat|mirror_clamp\n");
piglit_report_result(PIGLIT_SKIP);
  }

@@ -596,6 +613,8 @@ piglit_init(int argc, char **argv)
else if (!strcmp(opt, "3")) comp_select = 3;
else if (!strcmp(opt, "repeat")) address_mode = GL_REPEAT;
else if (!strcmp(opt, "clamp")) address_mode = GL_CLAMP_TO_EDGE;
+   else if (!strcmp(opt, "mirror_repeat")) address_mode = 
GL_MIRRORED_REPEAT;
+   else if (!strcmp(opt, "mirror_clamp")) address_mode = 
GL_MIRROR_CLAMP_TO_EDGE;
}

if (stage == NOSTAGE) fail_with_usage();



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


[Piglit] [PATCH] arb_texture_view: fix order of vertices in draw_3d_depth()

2017-12-07 Thread Brian Paul
The vertices are drawn with a GL_TRIANGLE_STRIP.  As it was, the
order of the 3rd and 4th vertices caused us to render a "twisted"
quad.  With this change, a true quad is drawn.

llvmpipe passes as it did before.  NVIDIA's driver still fails the test.
---
 tests/spec/arb_texture_view/common.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/spec/arb_texture_view/common.c 
b/tests/spec/arb_texture_view/common.c
index fc18bbc..f2453f5 100644
--- a/tests/spec/arb_texture_view/common.c
+++ b/tests/spec/arb_texture_view/common.c
@@ -105,13 +105,13 @@ void
 draw_3d_depth(float x, float y, float w, float h, int depth)
 {
const GLfloat vertices[16] =  {x, y, depth, 0.0,
-x+w, y, depth, 0.0,
-x+w, y+h, depth, 0.0,
-x, y+h, depth, 0.0};
+  x+w, y, depth, 0.0,
+  x, y+h, depth, 0.0,
+  x+w, y+h, depth, 0.0};
const GLfloat texcoords[8] = {0.0, 0.0,
-1.0, 0.0,
-1.0, 1.0,
-0.0, 1.0};
+ 1.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 1.0};
 
piglit_draw_rect_from_arrays(vertices, texcoords, false, 1);
 }
-- 
1.9.1

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


Re: [Piglit] [PATCH 1/3] arb_texture_multisample: don't use hard-coded sample counts

2017-12-05 Thread Brian Paul

On 12/05/2017 10:19 AM, Roland Scheidegger wrote:

Am 05.12.2017 um 17:43 schrieb Brian Paul:

Instead of using a fixed number of samples, query the
GL_MAX_COLOR_TEXTURE_SAMPLES or GL_MAX_DEPTH_TEXTURE_SAMPLES value
and use those.

Fixes failures with llvmpipe and VMware driver when MSAA is disabled.
---
  tests/spec/arb_texture_multisample/errors.c| 10 +-
  tests/spec/arb_texture_multisample/sample-depth.c  | 12 +++
  tests/spec/arb_texture_multisample/stencil-clear.c | 23 +-
  .../teximage-2d-multisample.c  | 13 
  .../teximage-3d-multisample.c  | 13 
  5 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/tests/spec/arb_texture_multisample/errors.c 
b/tests/spec/arb_texture_multisample/errors.c
index 42cc2c1..08e1696 100644
--- a/tests/spec/arb_texture_multisample/errors.c
+++ b/tests/spec/arb_texture_multisample/errors.c
@@ -44,6 +44,14 @@ piglit_init(int argc, char **argv)

  GLuint fbo;
  GLuint tex[2];
+GLint max_samples;
+
+glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _samples);
+if (max_samples < 1) {
+   printf("GL_MAX_COLOR_TEXTURE_SAMPLES must be at least one\n");
+   piglit_report_result(PIGLIT_FAIL);
+}

Do you want to use the maximum possible or restrict that to something
smaller (in case the value returned is large)?


Whatever value is returned, it should work.  If not, either the driver 
is broken or perhaps the surface is too large (but all these tests use 
small textures).




(Same below, and in the other patches.)
Either way, for the series:
Reviewed-by: Roland Scheidegger <srol...@vmware.com>


Thanks.

-Brian





+
  glGenFramebuffers(1, );

  glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -51,7 +59,7 @@ piglit_init(int argc, char **argv)
  glGenTextures(2, tex);
  glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex[0]);
  glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
-4, GL_RGBA, 64, 64, 2, GL_TRUE);
+max_samples, GL_RGBA, 64, 64, 2, GL_TRUE);

  if (!piglit_check_gl_error(GL_NO_ERROR)) {
  printf("should be no error so far\n");
diff --git a/tests/spec/arb_texture_multisample/sample-depth.c 
b/tests/spec/arb_texture_multisample/sample-depth.c
index ef2be19..94bc63d 100644
--- a/tests/spec/arb_texture_multisample/sample-depth.c
+++ b/tests/spec/arb_texture_multisample/sample-depth.c
@@ -38,7 +38,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN

  PIGLIT_GL_TEST_CONFIG_END

-#define NUM_SAMPLES 4
  #define TEX_WIDTH 64
  #define TEX_HEIGHT 64

@@ -93,16 +92,21 @@ void
  piglit_init(int argc, char **argv)
  {
GLuint tex;
+   int num_samples;
+
piglit_require_extension("GL_ARB_texture_multisample");

+   /* Use the max number of samples for testing */
+   glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _samples);
+
/* setup an fbo with multisample depth texture */

glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
-   NUM_SAMPLES, GL_DEPTH_COMPONENT24,
-   TEX_WIDTH, TEX_HEIGHT,
-   GL_TRUE);
+   num_samples, GL_DEPTH_COMPONENT24,
+   TEX_WIDTH, TEX_HEIGHT,
+   GL_TRUE);

glGenFramebuffers(1, );
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
diff --git a/tests/spec/arb_texture_multisample/stencil-clear.c 
b/tests/spec/arb_texture_multisample/stencil-clear.c
index ca0fd81..413aa41 100644
--- a/tests/spec/arb_texture_multisample/stencil-clear.c
+++ b/tests/spec/arb_texture_multisample/stencil-clear.c
@@ -108,7 +108,7 @@ piglit_display(void)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
  }

-GLuint create_fbo(unsigned num_samples)
+GLuint create_fbo(unsigned num_color_samples, unsigned num_depth_samples)
  {
GLenum tex_target;
GLuint texColor;
@@ -119,17 +119,17 @@ GLuint create_fbo(unsigned num_samples)
glGenTextures(1, );
glGenTextures(1, );

-   if (num_samples != 0) {
+   if (num_color_samples != 0) {
tex_target = GL_TEXTURE_2D_MULTISAMPLE;

glBindTexture(tex_target, texZS);
glTexImage2DMultisample(
-   tex_target, num_samples, GL_DEPTH32F_STENCIL8,
+   tex_target, num_depth_samples, GL_DEPTH32F_STENCIL8,
TEX_WIDTH, TEX_HEIGHT, GL_TRUE);

glBindTexture(tex_target, texColor);
glTexImage2DMultisample(
-   tex_target, num_samples, GL_RGBA8,
+   tex_target, num_color_samples, GL_RGBA8,
TEX_WIDTH, TEX_HEIGHT, GL_TRUE);
} else {
tex_target = GL_TEXTURE_2D;
@@ -167,22 +167,27 @@ GLuint create_fbo(unsigned num

[Piglit] [PATCH 1/3] arb_texture_multisample: don't use hard-coded sample counts

2017-12-05 Thread Brian Paul
Instead of using a fixed number of samples, query the
GL_MAX_COLOR_TEXTURE_SAMPLES or GL_MAX_DEPTH_TEXTURE_SAMPLES value
and use those.

Fixes failures with llvmpipe and VMware driver when MSAA is disabled.
---
 tests/spec/arb_texture_multisample/errors.c| 10 +-
 tests/spec/arb_texture_multisample/sample-depth.c  | 12 +++
 tests/spec/arb_texture_multisample/stencil-clear.c | 23 +-
 .../teximage-2d-multisample.c  | 13 
 .../teximage-3d-multisample.c  | 13 
 5 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/tests/spec/arb_texture_multisample/errors.c 
b/tests/spec/arb_texture_multisample/errors.c
index 42cc2c1..08e1696 100644
--- a/tests/spec/arb_texture_multisample/errors.c
+++ b/tests/spec/arb_texture_multisample/errors.c
@@ -44,6 +44,14 @@ piglit_init(int argc, char **argv)
 
 GLuint fbo;
 GLuint tex[2];
+GLint max_samples;
+
+glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _samples);
+if (max_samples < 1) {
+   printf("GL_MAX_COLOR_TEXTURE_SAMPLES must be at least one\n");
+   piglit_report_result(PIGLIT_FAIL);
+}
+
 glGenFramebuffers(1, );
 
 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -51,7 +59,7 @@ piglit_init(int argc, char **argv)
 glGenTextures(2, tex);
 glBindTexture(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, tex[0]);
 glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
-4, GL_RGBA, 64, 64, 2, GL_TRUE);
+max_samples, GL_RGBA, 64, 64, 2, GL_TRUE);
 
 if (!piglit_check_gl_error(GL_NO_ERROR)) {
 printf("should be no error so far\n");
diff --git a/tests/spec/arb_texture_multisample/sample-depth.c 
b/tests/spec/arb_texture_multisample/sample-depth.c
index ef2be19..94bc63d 100644
--- a/tests/spec/arb_texture_multisample/sample-depth.c
+++ b/tests/spec/arb_texture_multisample/sample-depth.c
@@ -38,7 +38,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
 
 PIGLIT_GL_TEST_CONFIG_END
 
-#define NUM_SAMPLES 4
 #define TEX_WIDTH 64
 #define TEX_HEIGHT 64
 
@@ -93,16 +92,21 @@ void
 piglit_init(int argc, char **argv)
 {
GLuint tex;
+   int num_samples;
+
piglit_require_extension("GL_ARB_texture_multisample");
 
+   /* Use the max number of samples for testing */
+   glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _samples);
+
/* setup an fbo with multisample depth texture */
 
glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
-   NUM_SAMPLES, GL_DEPTH_COMPONENT24,
-   TEX_WIDTH, TEX_HEIGHT,
-   GL_TRUE);
+   num_samples, GL_DEPTH_COMPONENT24,
+   TEX_WIDTH, TEX_HEIGHT,
+   GL_TRUE);
 
glGenFramebuffers(1, );
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
diff --git a/tests/spec/arb_texture_multisample/stencil-clear.c 
b/tests/spec/arb_texture_multisample/stencil-clear.c
index ca0fd81..413aa41 100644
--- a/tests/spec/arb_texture_multisample/stencil-clear.c
+++ b/tests/spec/arb_texture_multisample/stencil-clear.c
@@ -108,7 +108,7 @@ piglit_display(void)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
 }
 
-GLuint create_fbo(unsigned num_samples)
+GLuint create_fbo(unsigned num_color_samples, unsigned num_depth_samples)
 {
GLenum tex_target;
GLuint texColor;
@@ -119,17 +119,17 @@ GLuint create_fbo(unsigned num_samples)
glGenTextures(1, );
glGenTextures(1, );
 
-   if (num_samples != 0) {
+   if (num_color_samples != 0) {
tex_target = GL_TEXTURE_2D_MULTISAMPLE;
 
glBindTexture(tex_target, texZS);
glTexImage2DMultisample(
-   tex_target, num_samples, GL_DEPTH32F_STENCIL8,
+   tex_target, num_depth_samples, GL_DEPTH32F_STENCIL8,
TEX_WIDTH, TEX_HEIGHT, GL_TRUE);
 
glBindTexture(tex_target, texColor);
glTexImage2DMultisample(
-   tex_target, num_samples, GL_RGBA8,
+   tex_target, num_color_samples, GL_RGBA8,
TEX_WIDTH, TEX_HEIGHT, GL_TRUE);
} else {
tex_target = GL_TEXTURE_2D;
@@ -167,22 +167,27 @@ GLuint create_fbo(unsigned num_samples)
 void
 piglit_init(int argc, char **argv)
 {
-   unsigned num_samples = 4;
+   GLint num_color_samples, num_depth_samples;
 
piglit_require_extension("GL_ARB_texture_multisample");
 
+   /* By default, se the max number of samples for testing */
+   glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _color_samples);
+   glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, _depth_samples);
+
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "samples")) {
++i;
if (i >= argc)

[Piglit] [PATCH 2/3] arb_texture_storage_multisample: don't use fixed sample count

2017-12-05 Thread Brian Paul
---
 tests/spec/arb_texture_storage_multisample/tex-param.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_texture_storage_multisample/tex-param.c 
b/tests/spec/arb_texture_storage_multisample/tex-param.c
index 8aa3df3..bc40ecc 100644
--- a/tests/spec/arb_texture_storage_multisample/tex-param.c
+++ b/tests/spec/arb_texture_storage_multisample/tex-param.c
@@ -149,11 +149,15 @@ piglit_display(void)
struct subtest *t;
enum piglit_result result = PIGLIT_PASS;
enum piglit_result subtest_result;
+   GLint num_samples;
+
+   /* Use the max number of samples for testing */
+   glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, _samples);
 
glGenTextures(1, );
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, tex);
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE,
-   4, GL_RGBA, 64, 64, GL_TRUE);
+   num_samples, GL_RGBA, 64, 64, GL_TRUE);
 
for (t = subtests; t->param; t++) {
subtest_result = check_subtest(t);
-- 
1.9.1

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


Re: [Piglit] [PATCH 1/6] arb_vertex_program: Test property bindings.

2017-12-03 Thread Brian Paul
asprintf(_text, vp_template, val[0], val[1], val[2], val[3], name);
+   GLuint prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, vp_text);
+   free(vp_text);
+   glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog);
+
+   glClear(GL_COLOR_BUFFER_BIT);
+   piglit_draw_rect(-1, -1, 2, 2);
+
+   glDeleteProgramsARB(1, );
+
+   if (piglit_probe_pixel_rgb_silent(piglit_width / 2, piglit_height / 2,
+ green, NULL))
+   return true;
+   printf("Failed parameter: '%s'.\n", name);
+   return false;
+}
+
+/**
+ * printf-like version of function above.
+ */
+static bool
+check_prg_param(const float *val, const char *format, ...) PRINTFLIKE(2, 3);
+static bool
+check_prg_param(const float *val, const char *format, ...)
+{
+   char *name;
+   va_list ap;
+
+   va_start(ap, format);
+   vasprintf(, format, ap);
+   va_end(ap);
+
+   const bool r = check_prg_param_(val, name);
+   free(name);
+   return r;
+}
+
+static void
+normalize(float *v)
+{
+   const float norm = sqrtf(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+   for (int i = 0; i < 3; ++i)
+   v[i] /= norm;
+}
+
+static void
+random_vec4(float *v)
+{
+   for (int i = 0; i < 4; ++i)
+   v[i] = DRAND();
+}
+
+/**
+ * Get name fragment used in ARB program for GLenum \pname.
+ */
+static const char *
+enum2program(const GLenum pname)
+{
+   switch (pname) {
+   case GL_EMISSION:
+   return "emission";
+   case GL_AMBIENT:
+   return "ambient";
+   case GL_DIFFUSE:
+   return "diffuse";
+   case GL_SPECULAR:
+   return "specular";
+   case GL_POSITION:
+   return "position";
+   case GL_S:
+   return "s";
+   case GL_T:
+   return "t";
+   case GL_R:
+   return "r";
+   case GL_Q:
+   return "q";
+   }
+   assert(0);


how about

default:
assert(!"unexpected state enum");


The rest of the series looks OK (though I didn't do a detailed review of 
everything.)


Reviewed-by: Brian Paul <bri...@vmware.com>



+}
+
+enum piglit_result
+piglit_display(void)
+{
+   bool pass = true;
+   float val[4];
+
+   /* Material Property Bindings */
+   for (int s = 0; s < 2; ++s) {
+   for (int p = 0; p < 4; ++p) {
+   const GLenum pname[] = {GL_EMISSION, GL_AMBIENT,
+   GL_DIFFUSE, GL_SPECULAR};
+
+   random_vec4(val);
+   glMaterialfv(GL_FRONT + s, pname[p], val);
+   pass = check_prg_param(val, "state.material.%s.%s",
+  s ? "back" : "front",
+  enum2program(pname[p])) &&
+  pass;
+
+   /* The front material bindings are also accessible
+* without ".front.".
+*/
+   if (s == 0)
+   pass = check_prg_param(
+  val, "state.material.%s",
+  enum2program(pname[p])) &&
+  pass;
+   }
+
+   val[0] = DRAND();
+   val[1] = 0;
+   val[2] = 0;
+   val[3] = 1;
+   glMaterialf(GL_FRONT + s, GL_SHININESS, val[0]);
+   pass = check_prg_param(val, "state.material.%s.shininess",
+  s ? "back" : "front") && pass;
+
+   if (s == 0)
+   pass = check_prg_param(val,
+  "state.material.shininess") &&
+  pass;
+   }
+
+   /* Light Property Bindings */
+   int max_lights;
+   glGetIntegerv(GL_MAX_LIGHTS, _lights);
+   for (int l = 0; l < max_lights; ++l) {
+   for (int p = 0; p < 4; ++p) {
+   const GLenum pname[] = {GL_AMBIENT, GL_DIFFUSE,
+   GL_SPECULAR, GL_POSITION};
+   random_vec4(val);
+   glLightfv(GL_LIGHT0 + l, pname[p], val);
+   pass = check_prg_param(val, "state.light[%d].%s", l,
+  enum2program(pname[p])) &&
+  pass;
+   }
+
+   random_vec4(val);
+   glLightf(GL_LIGHT0 + l, GL_CONSTANT_ATTENUATION, val[0]);
+   glLightf(GL_LIGHT0 +

Re: [Piglit] [PATCH] gl-1.2: Test normal rescaling with fixed function pipeline.

2017-11-29 Thread Brian Paul

On 11/29/2017 04:28 PM, Fabian Bieler wrote:

Set up scene with diffuse lighting and an isotropic modelview scale of 100.
Set the light color to 1% red, 100% green, 0% blue.
If the normal is incorectly scaled in either direction, the sampled color


"incorrectly"


would be black or yellow, respectively, instead of green.
---
  tests/all.py|  1 +
  tests/spec/gl-1.2/CMakeLists.gl.txt |  1 +
  tests/spec/gl-1.2/rescale-normal.c  | 76 +
  3 files changed, 78 insertions(+)
  create mode 100644 tests/spec/gl-1.2/rescale-normal.c

diff --git a/tests/all.py b/tests/all.py
index cf15640..155ee2a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1103,6 +1103,7 @@ with profile.test_list.group_manager(
  g(['lodclamp-between'])
  g(['lodclamp-between-max'])
  g(['mipmap-setup'])
+g(['gl-1.2-rescale_normal'])
  g(['tex-skipped-unit'])
  g(['tex3d'])
  g(['tex3d-maxsize'], run_concurrent=False)
diff --git a/tests/spec/gl-1.2/CMakeLists.gl.txt 
b/tests/spec/gl-1.2/CMakeLists.gl.txt
index 029c54b..ce291da 100644
--- a/tests/spec/gl-1.2/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.2/CMakeLists.gl.txt
@@ -8,6 +8,7 @@ link_libraries (
${OPENGL_gl_LIBRARY}
  )

+piglit_add_executable (gl-1.2-rescale-normal rescale-normal.c)
  piglit_add_executable (gl-1.2-texture-base-level texture-base-level.c)

  # vim: ft=cmake:
diff --git a/tests/spec/gl-1.2/rescale-normal.c 
b/tests/spec/gl-1.2/rescale-normal.c
new file mode 100644
index 000..c011018
--- /dev/null
+++ b/tests/spec/gl-1.2/rescale-normal.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright © 2017 Fabian Bieler
+ *
+ * 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 rescale-normal.c:  Rescale normals with fixed function pipeline.
+ *
+ * Set up scene with diffuse lighting and an isotropic modelview scale of 100.
+ * Set the light color to 1% red, 100% green, 0% blue.
+ * If the normal is incorectly scaled in either direction, the sampled color
+ * would be black or yellow, respectively, instead of green.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 12;
+   config.window_visual = (PIGLIT_GL_VISUAL_RGB);


parens not needed there.  I noticed that in your other patches too, but 
not a big deal.



+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const float green_with_a_smitch_of_red[] = {0.01, 1, 0, 1};


:)



+
+enum piglit_result
+piglit_display(void)
+{
+   piglit_draw_rect(-0.01, -0.01, 0.02, 0.02);
+   bool pass = piglit_probe_pixel_rgb(piglit_width / 2,
+  piglit_height / 2,
+  green_with_a_smitch_of_red);
+
+   piglit_present_results();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   const float black[] = {0, 0, 0, 1};
+   const float white[] = {1, 1, 1, 1};
+
+   glEnable(GL_LIGHTING);
+   glEnable(GL_LIGHT0);
+
+   glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, black);
+   glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, white);
+
+   glLightfv(GL_LIGHT0, GL_DIFFUSE, green_with_a_smitch_of_red);
+
+   glScalef(100.0, 100.0, 100.0);
+   glEnable(GL_RESCALE_NORMAL);
+
+   glNormal3f(0, 0, 1);
+}



Reviewed-by: Brian Paul <bri...@vmware.com>



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


Re: [Piglit] [PATCH 0/23] Port glsl1 Glean test to Piglit

2017-11-29 Thread Brian Paul

On 11/29/2017 02:26 PM, Fabian Bieler wrote:

On 2017-11-29 04:53, Brian Paul wrote:

On 11/23/2017 01:44 PM, Fabian Bieler wrote:

This series replaces the "glsl1" Glean test with some Piglit tests.

Most tests were replaced by shader_runner tests.

The tests for built-in-uniform state were extended.

Some of the preprocessor tests were modified to make them stricter.

To port some texture tests shader_runner had to be extended with
"texture rgbw 1D" and "texture rgbw 3D" commands.
These (and the underlying piglit-util-functions) are very basic and
don't allow for variable texture size or pixel format. If desired, I can
remedy that.

Some tests ("Global vars and initializers", "Global vars and
initializers (2)", "Swizzle", "Writemask") are pretty trivial. I doubt
they would break without some existing, more complex Piglit test
failing, too. However, I opted to port them regardless since I couldn't
find an existing simple Piglit test for the feature in question.

Attached is a list of all Glean GLSL subtests with the location of the
new or existing Piglit test that replaces it.

Patch 23 fixes an unrelated test.




Thanks for the review.


I did a quick read-through and the series looks OK to me.  I presume
there's no compiler warnings and all the tests pass/fail as the glean
tests did.


I found no compiler warnings with gcc 4, 5, 7 and clang 3.8.

"glsl-1.10-built-in-uniform-state" currently fails on Mesa because the
values of gl_SpotExponent and gl_SpotCosCutoff are swapped (Glean didn't
test those uniforms)

"glsl-1.10-built-in-matrix-state" currently fails on Mesa because
gl_NormalScale is the reciprocal of the desired value (at least for
drivers that use mesa's modelspace-lighting optimization (Glean didn't
test gl_NormalScale).

I have posted patches for both issues to mesa-dev.
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_archives_mesa-2Ddev_2017-2DNovember_177977.html=DwIDaQ=uilaK90D4TOVoH58JNXRgQ=Ie7_encNUsqxbSRbqbNgofw0ITcfE8JKfaUjIQhncGA=8oe2QGJRLsBm_JiD7iUuZyin6B6XPbEJkG1lo7JKvu4=hr5OoX1SLzO_8DB8fD-yTvJsEfP43HwybACc2i-HHDE=
The first of those is pretty straightforward, though my commit message
could have been clearer. The second patch could use a Piglit test for
GL_RESCALE_NORMAL with the fixed-function pipeline to make sure it
introduces no regressions...


I've reviewed both of those patches now.



Otherwise all tests pass.


If there's no other comments in a few days, I can push the series.

If it hasn't bee revoked due to inactivity I still should have commit
access to Piglit. I'll try pushing the series at the end of the week and
report back if that fails.


OK, sounds good.  I didn't know if you had git permission.

-Brian



Reviewed-by: Brian Paul <bri...@vmware.com>



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


Re: [Piglit] [PATCH 0/23] Port glsl1 Glean test to Piglit

2017-11-28 Thread Brian Paul

On 11/23/2017 01:44 PM, Fabian Bieler wrote:

This series replaces the "glsl1" Glean test with some Piglit tests.

Most tests were replaced by shader_runner tests.

The tests for built-in-uniform state were extended.

Some of the preprocessor tests were modified to make them stricter.

To port some texture tests shader_runner had to be extended with
"texture rgbw 1D" and "texture rgbw 3D" commands.
These (and the underlying piglit-util-functions) are very basic and
don't allow for variable texture size or pixel format. If desired, I can
remedy that.

Some tests ("Global vars and initializers", "Global vars and
initializers (2)", "Swizzle", "Writemask") are pretty trivial. I doubt
they would break without some existing, more complex Piglit test
failing, too. However, I opted to port them regardless since I couldn't
find an existing simple Piglit test for the feature in question.

Attached is a list of all Glean GLSL subtests with the location of the
new or existing Piglit test that replaces it.

Patch 23 fixes an unrelated test.


I did a quick read-through and the series looks OK to me.  I presume 
there's no compiler warnings and all the tests pass/fail as the glean 
tests did.


If there's no other comments in a few days, I can push the series.

Reviewed-by: Brian Paul <bri...@vmware.com>

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


Re: [Piglit] [PATCH] glsl-fs-discard-mrt: Fix binding the winsys framebuffer in -fbo mode.

2017-11-17 Thread Brian Paul

On 11/17/2017 05:26 PM, Eric Anholt wrote:

Fixes failure on vc5 where the alpha was forced to 1 due to an rgbx
window system buffer.
---
  tests/shaders/glsl-fs-discard-mrt.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/glsl-fs-discard-mrt.c 
b/tests/shaders/glsl-fs-discard-mrt.c
index 8447cf270b96..68955fa06488 100644
--- a/tests/shaders/glsl-fs-discard-mrt.c
+++ b/tests/shaders/glsl-fs-discard-mrt.c
@@ -141,7 +141,7 @@ draw_fbo_to_screen_and_test(void)
float magenta[4] = {1, 0, 1, 0};

glUseProgram(0);
-   glBindFramebuffer(GL_FRAMEBUFFER, 0);
+   glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);

glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);



Reviewed-by: Brian Paul <bri...@vmware.com>

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


[Piglit] [PATCH] generators: fix incorrect generated_tests/spec/glsl-110, etc. dir names

2017-11-17 Thread Brian Paul
We were generating tests both in spec/glsl-1.10/ and spec/glsl-110/.
This changes the later to match the former.
---
 generated_tests/gen_variable_index_write_tests.py | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/generated_tests/gen_variable_index_write_tests.py 
b/generated_tests/gen_variable_index_write_tests.py
index 0c06dcd..2615d9a 100644
--- a/generated_tests/gen_variable_index_write_tests.py
+++ b/generated_tests/gen_variable_index_write_tests.py
@@ -198,6 +198,11 @@ class TestParams(object):
 ret += ' '
 return ret
 
+@utils.lazy_property
+def formated_version(self):
+# Note: GLSLVersion::float() does the division by 100
+return '{:.2f}'.format(float(self.version))
+
 
 class ParamsFactory(object):  # pylint: disable=too-few-public-methods
 """A factory class that provides TestParam objects.
@@ -220,7 +225,7 @@ class ParamsFactory(object):  # pylint: 
disable=too-few-public-methods
 
 def make_vs(name, params):
 """Create a vertex shader test."""
-dirname = _DIRNAME.format(params.version)
+dirname = _DIRNAME.format(params.formated_version)
 utils.safe_makedirs(dirname)
 with open(os.path.join(dirname, name), 'w') as f:
 f.write(_VS_TEMPLATE.render_unicode(params=params))
@@ -229,7 +234,7 @@ def make_vs(name, params):
 
 def make_fs(name, params):
 """Create a fragment shader test."""
-dirname = _DIRNAME.format(params.version)
+dirname = _DIRNAME.format(params.formated_version)
 utils.safe_makedirs(dirname)
 with open(os.path.join(dirname, name), 'w') as f:
 f.write(_FS_TEMPLATE.render_unicode(params=params))
-- 
1.9.1

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


Re: [Piglit] [PATCH] unittests: test WflInfo in its own module and correct depending ones

2017-11-15 Thread Brian Paul


Reviewed-by: Brian Paul <bri...@vmware.com>

On 11/15/2017 02:21 AM, Andres Gomez wrote:

Fixes: edc41a1db ("framework: move WflInfo class into new wflinfo.py module")

Cc: Brian Paul <bri...@vmware.com>
Cc: Dylan Baker <dylanx.c.ba...@intel.com>
Signed-off-by: Andres Gomez <ago...@igalia.com>
---
  unittests/framework/test/test_glsl_parser_test.py |   2 +-
  unittests/framework/test/test_opengl.py   | 363 +---
  unittests/framework/test_wflinfo.py   | 389 ++
  3 files changed, 395 insertions(+), 359 deletions(-)
  create mode 100644 unittests/framework/test_wflinfo.py

diff --git a/unittests/framework/test/test_glsl_parser_test.py 
b/unittests/framework/test/test_glsl_parser_test.py
index 124f3e9e9..d252e27bc 100644
--- a/unittests/framework/test/test_glsl_parser_test.py
+++ b/unittests/framework/test/test_glsl_parser_test.py
@@ -55,7 +55,7 @@ class _Setup(object):
  self.patchers = [
  mock.patch('framework.test.glsl_parser_test._HAS_GL_BIN', True),
  mock.patch('framework.test.glsl_parser_test._HAS_GLES_BIN', True),
-mock.patch.dict('framework.test.opengl.OPTIONS.env',
+mock.patch.dict('framework.wflinfo.OPTIONS.env',
  {'PIGLIT_PLATFORM': 'foo'}),
  ]

diff --git a/unittests/framework/test/test_opengl.py 
b/unittests/framework/test/test_opengl.py
index a3974081a..59024edf1 100644
--- a/unittests/framework/test/test_opengl.py
+++ b/unittests/framework/test/test_opengl.py
@@ -23,8 +23,6 @@
  from __future__ import (
  absolute_import, division, print_function, unicode_literals
  )
-import subprocess
-import textwrap
  try:
  from unittest import mock
  except ImportError:
@@ -32,6 +30,7 @@ except ImportError:

  import pytest

+from framework import wflinfo
  from framework.test import opengl
  from framework.test.base import TestIsSkip as _TestIsSkip

@@ -40,365 +39,13 @@ from .. import utils
  # pylint: disable=no-self-use,attribute-defined-outside-init,protected-access


-def _has_wflinfo():
-"""Return True if wflinfo is available in PATH."""
-try:
-subprocess.check_call(['wflinfo', '--help'])
-except subprocess.CalledProcessError:
-return False
-except OSError as e:
-if e.errno != 2:
-raise
-return False
-return True
-
-
-@pytest.mark.skipif(not _has_wflinfo(), reason="Tests require wflinfo binary.")
-class TestWflInfo(object):
-"""Tests for the WflInfo class."""
-
-class TestAttributes(object):
-"""test for attribute assignments."""
-
-@pytest.yield_fixture(autouse=True)
-def patch(self):
-"""Mock a few things for testing purposes."""
-# This is pretty ugly, but as a Borb with a private shared state,
-# the only way to test this module is to actually replace the
-# shared_state with a mock value so it's reset after each test
-with mock.patch.dict('framework.test.opengl.OPTIONS.env',
- {'PIGLIT_PLATFORM': 'foo'}), \
-mock.patch(
-'framework.test.opengl.WflInfo._WflInfo__shared_state',
-{}):
-yield
-
-def setup(self):
-"""Setup each instance, patching necissary bits."""
-self._test = opengl.WflInfo()
-
-def test_gl_extension(self):
-"""test.opengl.WflInfo.gl_extensions: Provides list of gl
-extensions.
-"""
-rv = (b'foo\nbar\nboink\nOpenGL extensions: '
-  b'GL_foobar GL_ham_sandwhich\n')
-expected = set(['GL_foobar', 'GL_ham_sandwhich'])
-
-with mock.patch('framework.test.opengl.subprocess.check_output',
-mock.Mock(return_value=rv)):
-assert self._test.gl_extensions == expected
-
-def test_gl_version(self):
-"""test.opengl.WflInfo.gl_version: Provides a version number."""
-rv = textwrap.dedent("""\
-Waffle platform: gbm
-Waffle api: gl
-OpenGL vendor string: Intel Open Source Technology Center
-OpenGL renderer string: Mesa DRI Intel(R) Haswell Mobile
-OpenGL version string: 18 (Core Profile) Mesa 11.0.4
-OpenGL context flags: 0x0
-""").encode('utf-8')
-with mock.patch('framework.test.opengl.subprocess.check_output',
-mock.Mock(return_value=rv)):
-assert self._test.gl_version == 18.0
-
-def test_gles_version(self):
-&q

Re: [Piglit] [PATCH 05/12] Port texture env test from Glean to Piglit

2017-11-14 Thread Brian Paul

I'm getting a few compiler warnings from this test:

/home/brianp/piglit/tests/spec/gl-1.3/texture-env.c: In function 
‘piglit_display’:
/home/brianp/piglit/tests/spec/gl-1.3/texture-env.c:474:17: warning: 
passing argument 4 of ‘matrix_test’ from incompatible pointer type

 COLORS, colors,
 ^
/home/brianp/piglit/tests/spec/gl-1.3/texture-env.c:384:1: note: 
expected ‘const float (*)[4]’ but argument is of type ‘float (*)[4]’

 matrix_test(GLenum env_mode, GLenum tex_format, int num_colors,
 ^
/home/brianp/piglit/tests/spec/gl-1.3/texture-env.c:483:8: warning: 
passing argument 4 of ‘matrix_test’ from incompatible pointer type

colors, colors[0])) {
^
/home/brianp/piglit/tests/spec/gl-1.3/texture-env.c:384:1: note: 
expected ‘const float (*)[4]’ but argument is of type ‘float (*)[4]’

 matrix_test(GLenum env_mode, GLenum tex_format, int num_colors,
 ^

Can you try to fix those?

-Brian

On 11/14/2017 02:47 PM, Fabian Bieler wrote:

Note: 3 texture environment functions (modulate, decal and blend) were
introduces with OpenGL 1.0.  GL 1.1 and 1.3 added the replace and add
functions, respectively.  As this test tests all 5 functions it is classified
as OpenGL 1.3.
---
  tests/all.py|   1 +
  tests/spec/gl-1.3/CMakeLists.gl.txt |   1 +
  tests/spec/gl-1.3/texture-env.c | 526 
  3 files changed, 528 insertions(+)
  create mode 100644 tests/spec/gl-1.3/texture-env.c

diff --git a/tests/all.py b/tests/all.py
index 7754dbe..48b8a51 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -1116,6 +1116,7 @@ with profile.test_list.group_manager(
  grouptools.join('spec', '!opengl 1.3')) as g:
  g(['texunits'])
  g(['tex-border-1'])
+g(['gl-1.3-texture-env'])
  g(['tex3d-depth1'])

  with profile.test_list.group_manager(
diff --git a/tests/spec/gl-1.3/CMakeLists.gl.txt 
b/tests/spec/gl-1.3/CMakeLists.gl.txt
index 607d2c1..8eaa94d 100644
--- a/tests/spec/gl-1.3/CMakeLists.gl.txt
+++ b/tests/spec/gl-1.3/CMakeLists.gl.txt
@@ -9,5 +9,6 @@ link_libraries (
  )

  piglit_add_executable (gl-1.3-alpha_to_coverage_nop alpha_to_coverage_nop.c)
+piglit_add_executable (gl-1.3-texture-env texture-env.c)

  # vim: ft=cmake:
diff --git a/tests/spec/gl-1.3/texture-env.c b/tests/spec/gl-1.3/texture-env.c
new file mode 100644
index 000..7b43507
--- /dev/null
+++ b/tests/spec/gl-1.3/texture-env.c
@@ -0,0 +1,526 @@
+/*
+ * Copyright (C) 1999  Allen Akin   All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/**
+ * @file tex-env.c:  Test the basic texture env modes
+ * Author: Brian Paul (bri...@valinux.com)  April 2001
+ *
+ * Test procedure:
+ *   Setup a texture with 81 columns of unique RGBA colors, 3 texels each.
+ *   Draw a 81 uniquely-colored flat-shaded quads as wide horizontal bands,
+ *   with the above texture.  This makes a matrix of 81*81 colored squares
+ *   for which we test that the current texture environment mode and texture
+ *   format produced the correct color.
+ *   Finally, we blend over a gray background in order to verify that the
+ *   post-texture alpha value is correct.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 13;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+   config.window_width = 256;
+   config.window_height = 256;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define BLEND_WITH_BACKGROUND 1
+
+#define COLORS (3 * 3 * 3 * 3)
+
+static float colors[COLORS][4];
+
+static float bg_color[4] = {0.5, 0.5, 0.5, 0.5};
+
+static const GLenum format_enums[] = {
+   GL_ALPHA,
+   GL_LUMINANCE,
+   GL_LUMINANCE_ALPHA,
+   GL_INTENSITY,
+   GL_RGB,
+   GL_RGBA
+};
+
+static const GLenum env_mode_enums[] = {
+   GL_REPLACE,
+   GL_MODULATE,
+   

Re: [Piglit] [PATCH] isinf-and-isnan: add clamp / min / max tests

2017-11-14 Thread Brian Paul

On 11/13/2017 07:12 PM, Roland Scheidegger wrote:

Ping?

Am 09.11.2017 um 19:11 schrieb srol...@vmware.com:

From: Roland Scheidegger <srol...@vmware.com>

We expect non-nan results for these (according to d3d10 rules, and at least
for min/max, also according to ieee rules). The tests will not actually fail
with other results (since GL's NaN behavior is all undefined), albeit some
apps may rely on this.
(We'll use clamp to 0/1 on purpose, which may get optimized to a saturate
modifier on some hw, and ideally we'd see a non-nan result there too. The
expected result there is really zero (d3d10 would require this), so if
it gets decomposed into min/max combo the order is actually important.)
On r600, right now all 3 give undesired (NaN) results (pending fixes),
albeit all legal.
---
  tests/spec/glsl-1.30/execution/isinf-and-isnan.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c 
b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
index 099b5c2..77a7591 100644
--- a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
+++ b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c
@@ -340,6 +340,7 @@ enum behavior
B_FINITE = 1, /* Expected to evaluate to a finite value */
B_POSINF = 2, /* Expected to evaluate to +Infinity */
B_NEGINF = 3, /* Expected to evaluate to -Infinity */
+   B_FINITE_NANOK = 4, /* Expected finite value, but NaN ok */


My only nit-pick is to change that to NAN_OK.

Reviewed-by: Brian Paul <bri...@vmware.com>


  };

  struct expression_table_element
@@ -369,6 +370,10 @@ static struct expression_table_element expressions[] = {
{ "log(-1.0+z)", B_NAN },
{ "sqrt(-1.0)", B_NAN },
{ "sqrt(-1.0+z)", B_NAN },
+   { "clamp(u_nan, 0.0, 1.0)", B_FINITE_NANOK },
+   { "min(u_two, u_nan)", B_FINITE_NANOK },
+   { "max(u_two, u_nan)", B_FINITE_NANOK },
+
  };

  /**
@@ -446,6 +451,7 @@ test_expr(char *expression, int expected_behavior)
"uniform float u_inf;\n" /* Always == +infinity */
"uniform float u_minus_inf;\n" /* Always == -infinity */
"uniform float u_nan;\n" /* Always == NaN */
+   "uniform float u_two = 2.0;\n" /* To defeat constant folding */
"float compute_value() {\n"
"  return %s;\n"
"}\n",
@@ -523,6 +529,9 @@ test_expr(char *expression, int expected_behavior)
pass = false;
}
break;
+   case B_FINITE_NANOK:
+   expected_behavior_string = "finite";
+   break;
default:
expected_behavior_string = "NaN";
break;



___
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 2/2] framework: fix wflinfo GL shading language parsing code

2017-11-13 Thread Brian Paul
With NVIDIA's driver, wflinfo reports a GLSL version line like this:
"OpenGL shading language version string: 4.40 NVIDIA via Cg compiler"
The existing parsing code didn't expect the text after the version
number and generated an exception.  Change the parsing to handle this.
---
 framework/wflinfo.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index a346003..8c7da08 100644
--- a/framework/wflinfo.py
+++ b/framework/wflinfo.py
@@ -255,9 +255,8 @@ class WflInfo(object):
 else:
 try:
 # GLSL versions are M.mm formatted
-ret = float(self.__getline(
-raw.split('\n'),
-'OpenGL shading language').split()[-1][:4])
+line = self.__getline(raw.split('\n'), 'OpenGL shading 
language')
+ret = float(line.split(":")[1][:5])
 except (IndexError, ValueError):
 # This is caused by wflinfo returning an error
 pass
-- 
1.9.1

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


[Piglit] [PATCH 1/2] all.py: fix version checks in is_feature_directory_supported()

2017-11-13 Thread Brian Paul
The wflinfo versions should be floats already, so don't call float() again.
If querying the ES api/version fails, we'll get None for the version number
so check for that.
---
 tests/all.py | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tests/all.py b/tests/all.py
index c322232..70f8efd 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -236,20 +236,20 @@ def is_feature_directory_supported(dir_name):
 return gl_extension_supported(ext_name)
 elif dir_name[:5] == "gles-":
 # OpenGL ES test
-version = dir_name[5:]
-return float(version) <= float(wfl_info.gles_version)
+version = float(dir_name[5:])
+return wfl_info.gles_version != None and version <= 
wfl_info.gles_version
 elif dir_name[:8] == "glsl-es-":
 # OpenGL ES shader test
-version = dir_name[8:]
-return float(version) <= float(wfl_info.glsl_es_version)
+version = float(dir_name[8:])
+return wfl_info.glsl_es_version != None and version <= 
wfl_info.glsl_es_version
 elif dir_name[:3] == "gl-":
 # The directory is a GL version
-version = dir_name[3:]
-return float(version) <= float(wfl_info.gl_version)
+version = float(dir_name[3:])
+return version <= wfl_info.gl_version
 elif dir_name[:5] == "glsl-":
 # The directory is a GLSL version
-version = dir_name[5:]
-return float(version) <= float(wfl_info.glsl_version)
+version = float(dir_name[5:])
+return version <= wfl_info.glsl_version
 else:
 # The directory is something else.  Don't skip it.
 return True
-- 
1.9.1

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


[Piglit] [PATCH 4/4] arb_sample_shading: don't use gl_FragColor/Data in fragment shaders

2017-11-10 Thread Brian Paul
NVIDIA's driver fails to compile the fragment shaders with "Failed to
compile fragment shader: 0(4) : error C7533: global variable gl_FragData
is deprecated after version 120".

Use 'out fragdata' or 'out fragcolor' instead.

Tested with Mesa too.
---
 .../execution/ignore-centroid-qualifier.cpp |  9 ++---
 .../execution/interpolate-at-sample-position.cpp| 13 -
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git 
a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp 
b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
index c286c5c..105f837 100644
--- a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
+++ b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
@@ -147,8 +147,9 @@ piglit_init(int argc, char**argv)
"#version 130\n"
"#extension GL_ARB_sample_shading: require\n"
"centroid in vec2 test;\n"
+   "out vec4 fragcolor;\n"
"void main() {\n"
-   "   gl_FragColor = vec4(abs(test), 0, 1);\n"
+   "   fragcolor = vec4(abs(test), 0, 1);\n"
"}\n");
 
draw_prog_right = piglit_build_simple_program(
@@ -169,8 +170,9 @@ piglit_init(int argc, char**argv)
 
"#version 130\n"
"in vec2 ref;\n"
+   "out vec4 fragcolor;\n"
"void main() {\n"
-   "   gl_FragColor = vec4(abs(ref), 0, 1);\n"
+   "   fragcolor = vec4(abs(ref), 0, 1);\n"
"}\n");
sample_pos_loc = glGetUniformLocation(draw_prog_right, "sample_pos");
 
@@ -185,8 +187,9 @@ piglit_init(int argc, char**argv)
"#extension GL_ARB_texture_multisample: require\n"
"uniform int sample_id;\n"
"uniform sampler2DMS tex;\n"
+   "out vec4 fragcolor;\n"
"void main() {\n"
-   "   gl_FragColor =  texelFetch(tex, 
ivec2(gl_FragCoord.xy),\n"
+   "   fragcolor =  texelFetch(tex, ivec2(gl_FragCoord.xy),\n"
"  sample_id);\n"
"}\n");
 
diff --git 
a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp 
b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
index 6d0123b..36ede0d 100644
--- a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
+++ b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
@@ -162,9 +162,10 @@ piglit_init(int argc, char**argv)
"#extension GL_ARB_sample_shading: require\n"
"in vec2 test_center;\n"
"centroid in vec2 test_centroid;\n"
+   "out vec4 fragdata[2];\n"
"void main() {\n"
-   "   gl_FragData[0] = vec4(abs(test_center), 0, 1);\n"
-   "   gl_FragData[1] = vec4(abs(test_centroid), 0, 1);\n"
+   "   fragdata[0] = vec4(abs(test_center), 0, 1);\n"
+   "   fragdata[1] = vec4(abs(test_centroid), 0, 1);\n"
"}\n");
 
draw_prog_right = piglit_build_simple_program(
@@ -185,9 +186,10 @@ piglit_init(int argc, char**argv)
 
"#version 130\n"
"in vec2 ref;\n"
+   "out vec4 fragdata[2];\n"
"void main() {\n"
-   "   gl_FragData[0] = vec4(abs(ref), 0, 1);\n"
-   "   gl_FragData[1] = vec4(abs(ref), 0, 1);\n"
+   "   fragdata[0] = vec4(abs(ref), 0, 1);\n"
+   "   fragdata[1] = vec4(abs(ref), 0, 1);\n"
"}\n");
sample_pos_loc = glGetUniformLocation(draw_prog_right, "sample_pos");
 
@@ -203,9 +205,10 @@ piglit_init(int argc, char**argv)
"uniform int sample_id;\n"
"uniform sampler2DMS tex_center;\n"
"uniform sampler2DMS tex_centroid;\n"
+   "out vec4 fragcolor;\n"
"void main() {\n"
"   ivec2 coord = ivec2(gl_FragCoord.xy);\n"
-   "   gl_FragColor = coord.y < 128 ? \n"
+   "   fragcolor = coord.y < 128 ? \n"
"   texelFetch(tex_center, coord, sample_id) :\n"
"   texelFetch(tex_centroid, coord - ivec2(0, 128), 
sample_id);\n"
"}\n");
-- 
1.9.1

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


[Piglit] [PATCH 2/4] util: const-qualify data parameter to piglit_multisample_texture()

2017-11-10 Thread Brian Paul
---
 tests/util/piglit-util-gl.c | 2 +-
 tests/util/piglit-util-gl.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 041427d..43b38e5 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -2967,7 +2967,7 @@ GLuint
 piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
   unsigned width, unsigned height,
   unsigned depth, unsigned samples,
-  GLenum format, GLenum type, void *data)
+  GLenum format, GLenum type, const void *data)
 {
static GLuint prog = 0;
static GLint tex_loc, tex_depth_loc, z_loc;
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 00b5a35..e8728d0 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -308,7 +308,7 @@ GLuint piglit_multisample_texture(GLenum target, GLuint tex,
  GLenum internalFormat,
  unsigned width, unsigned height,
  unsigned depth, unsigned samples,
- GLenum format, GLenum type, void *data);
+ GLenum format, GLenum type, const void *data);
 extern float piglit_tolerance[4];
 void piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits);
 extern void piglit_require_transform_feedback(void);
-- 
1.9.1

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


[Piglit] [PATCH 3/4] arb_indirect_parameters: add cast to silence compiler warnings

2017-11-10 Thread Brian Paul
---
 tests/spec/arb_indirect_parameters/tf-count-arrays.c   | 2 +-
 tests/spec/arb_indirect_parameters/tf-count-elements.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/spec/arb_indirect_parameters/tf-count-arrays.c 
b/tests/spec/arb_indirect_parameters/tf-count-arrays.c
index f70209c..7f64d8f 100644
--- a/tests/spec/arb_indirect_parameters/tf-count-arrays.c
+++ b/tests/spec/arb_indirect_parameters/tf-count-arrays.c
@@ -194,7 +194,7 @@ piglit_display(void)
/* Overdraw with the red quad, except count = 0 */
glMultiDrawArraysIndirectCountARB(
GL_TRIANGLE_FAN,
-   (2 * 4 * 4), 4, 1, 0);
+   (const void *) (2 * 4 * 4), 4, 1, 0);
 
pass &= piglit_probe_rect_rgba(0, 0, piglit_width / 2, piglit_height,
   g);
diff --git a/tests/spec/arb_indirect_parameters/tf-count-elements.c 
b/tests/spec/arb_indirect_parameters/tf-count-elements.c
index b8ea084..8cd7944 100644
--- a/tests/spec/arb_indirect_parameters/tf-count-elements.c
+++ b/tests/spec/arb_indirect_parameters/tf-count-elements.c
@@ -203,7 +203,7 @@ piglit_display(void)
/* Overdraw with the red quad, except count = 0 */
glMultiDrawElementsIndirectCountARB(
GL_TRIANGLES, GL_UNSIGNED_INT,
-   (2 * 5 * 4), 4, 1, 0);
+   (const void *) (2 * 5 * 4), 4, 1, 0);
 
pass &= piglit_probe_rect_rgba(0, 0, piglit_width / 2, piglit_height,
   g);
-- 
1.9.1

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


[Piglit] [PATCH 1/4] util: fix piglit_multisample_texture() parameter type

2017-11-10 Thread Brian Paul
Texture IDs are GLuint, not GLenum.
---
 tests/util/piglit-util-gl.c | 3 ++-
 tests/util/piglit-util-gl.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index d8b8f85..041427d 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -2949,6 +2949,7 @@ static const char multisample_texture_fs_source[] =
  *
  * \param target either GL_TEXTURE_2D_MULTISAMPLE or
  *   GL_TEXTURE2D_MULTISAMPLE_ARRAY
+ * \param textexture ID for existing texture, or zero
  * \param internalformat a renderable color format accepted by
  *   glTexImage2DMultisample
  * \param width  texture width
@@ -2963,7 +2964,7 @@ static const char multisample_texture_fs_source[] =
  * \return the new texture object id
  */
 GLuint
-piglit_multisample_texture(GLenum target, GLenum tex, GLenum internalFormat,
+piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
   unsigned width, unsigned height,
   unsigned depth, unsigned samples,
   GLenum format, GLenum type, void *data)
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 3bb0ee8..00b5a35 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -304,7 +304,7 @@ GLuint piglit_rgbw_texture(GLenum internalFormat, int w, 
int h, GLboolean mip,
 GLuint piglit_integer_texture(GLenum internalFormat, int w, int h, int b, int 
a);
 GLuint piglit_depth_texture(GLenum target, GLenum format, int w, int h, int d, 
GLboolean mip);
 GLuint piglit_array_texture(GLenum target, GLenum format, int w, int h, int d, 
GLboolean mip);
-GLuint piglit_multisample_texture(GLenum target, GLenum tex,
+GLuint piglit_multisample_texture(GLenum target, GLuint tex,
  GLenum internalFormat,
  unsigned width, unsigned height,
  unsigned depth, unsigned samples,
-- 
1.9.1

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


Re: [Piglit] [PATCH] gl-1.0-logicop: allow testing single mode on the command line

2017-11-10 Thread Brian Paul

On 11/10/2017 12:16 PM, Charmaine Lee wrote:



From: Brian Paul <bri...@vmware.com>
Sent: Thursday, November 9, 2017 12:52 PM
To: piglit@lists.freedesktop.org
Cc: Charmaine Lee; Brian Paul
Subject: [PATCH] gl-1.0-logicop: allow testing single mode on the command line



And require GL 1.1 since that's when color logicops were introduced.
Technically, we should move/rename the test, but it's hardly worth it.
---
tests/spec/gl-1.0/logicop.c | 90 +
1 file changed, 58 insertions(+), 32 deletions(-)



diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c
index 9ff80be..d415335 100644
--- a/tests/spec/gl-1.0/logicop.c
+++ b/tests/spec/gl-1.0/logicop.c
@@ -46,7 +46,7 @@



PIGLIT_GL_TEST_CONFIG_BEGIN



-   config.supports_gl_compat_version = 10;
+   config.supports_gl_compat_version = 11;



config.window_visual = PIGLIT_GL_VISUAL_RGBA |
PIGLIT_GL_VISUAL_DOUBLE;
@@ -54,12 +54,28 @@ PIGLIT_GL_TEST_CONFIG_BEGIN



PIGLIT_GL_TEST_CONFIG_END



-void
-piglit_init(int argc, char **argv)
-{
-   srand(0);
-   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
+
+static const GLenum logicop_modes[] = {
+   GL_CLEAR,
+   GL_SET,
+   GL_COPY,
+   GL_COPY_INVERTED,
+   GL_NOOP,
+   GL_INVERT,
+   GL_AND,
+   GL_NAND,
+   GL_OR,
+   GL_NOR,
+   GL_XOR,
+   GL_EQUIV,
+   GL_AND_REVERSE,
+   GL_AND_INVERTED,
+   GL_OR_REVERSE,
+   GL_OR_INVERTED
+};
+
+static GLenum test_single = 0;  /* 0 = test all logicop modes */
+



static GLubyte*
random_image_data(void)
@@ -67,7 +83,7 @@ random_image_data(void)
int i;
GLubyte *img = malloc(4 * img_width * img_height * sizeof(GLubyte));
for (i = 0; i < 4 * img_width * img_height; ++i) {
-   img[i] = rand() % 256;
+   img[i] = /*rand()*/ (100+i) % 256;


Is this change intentional or just a left over from debugging?



Oops, left-over from debugging.  Thanks for catching that.

-Brian




Other than that,
Reviewed-by: Charmaine Lee <charmai...@vmware.com>



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


Re: [Piglit] [PATCH 2/2] all.py: filter directories traversed to find shader tests

2017-11-09 Thread Brian Paul

On 11/09/2017 05:29 PM, Dylan Baker wrote:

Quoting Brian Paul (2017-11-09 15:16:33)

The script searches all files under tests/ and generated_tests/ for
files ending in ".shader_test".  For each match, a ShaderTest() object
is created and added to the test list.

For GL extensions or versions not supported by the driver, this is
wasted effort.

This patch looks for directories under spec/ and tries to determine if
the extension/feature is actually supported by the current driver.  If
not, it's skipped.

This somewhat reduces Piglit start up time, but substantially more
time is spent in the ShaderTest() constructor which actually opens
and parses each file to determine its GL/ES dependencies.  I'll try
to address that in the future.

v2:
- replace os.path.walk() with my own walk_dir_tree() which avoids
   decending into subdirs when the parent directory/feature is not supported.
- Use env var to enable/disable shader directory filtering
- Also, fix naming conventions and minor formatting issues.
---
  tests/all.py | 73 +++-
  1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index ae4a995..93f66cf 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -8,12 +8,15 @@ import collections
  import itertools
  import os
  import platform
+import re

  import six
  from six.moves import range

  from framework import grouptools
+from framework.test import opengl
  from framework import options
+from framework import wflinfo
  from framework.profile import TestProfile
  from framework.driver_classifier import DriverClassifier
  from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest,
@@ -210,9 +213,77 @@ profile = TestProfile()  # pylint: disable=invalid-name

  shader_tests = collections.defaultdict(list)

+wfl_info = wflinfo.WflInfo()
+
+
+def gl_extension_supported(ext_name):
+"""Is the named OpenGL extension supported?"""
+return ext_name in wfl_info.gl_extensions


There should be one extra newline here.


+
+def is_feature_directory_supported(dir_name):
+"""Determine if dir_name specifies an OpenGL feature (extension or GL
+version) which is supported by the host.  If we return False, it means
+the extension/version is definitely not supported.  If we return True,
+it means the extension/version is possibly suppported.  We're a little
+fuzzy because we don't yet parse all the directory name possibilities
+(like ES tests).
+"""
+if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
+# The directory is a GL extension name, but of the format "arb_foo_bar"
+# instead of "GL_ARB_foo_bar".  We convert the former into the later
+# and check if the extension is supported.
+ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:]
+return gl_extension_supported(ext_name)
+elif re.match("gl-\d\.\d+", dir_name):


You're using `re` here because you're not checking gl[sl]-es, right? Does it
make more sense to handle ES before desktop GL so you don't need to use re?


Yeah, I can flesh out the ES cases and get rid of re.





+# The directory is a GL version
+version = dir_name[3:]
+return float(version) <= float(wfl_info.gl_version)
+elif re.match("glsl-\d\.\d+", dir_name):
+# The directory is a GLSL version
+version = dir_name[5:]
+return float(version) <= float(wfl_info.glsl_version)
+else:
+# The directory is something else.  Don't skip it.
+return True
+
+
+def walk_filter_dir_tree(root):
+"""Recursively walk the directory tree rooted at 'root'.
+If we find a directory path of the form ".../spec/foo/" we'll check if
+'foo' is a supported extension/feature/version.  If not, we do not
+traverse foo/.  Otherwise, we add continue traversing.
+The return value is a list of (dirpath, filename) tuples.
+"""
+curdir = os.path.split(root)[1]
+files = []
+retval = []
+
+for entry in os.listdir(root):
+full_path = os.path.join(root, entry)
+if os.path.isdir(full_path):
+# Check if we're in a "spec/" direcotry
+if curdir == "spec" and not is_feature_directory_supported(entry):
+# The directory's tests aren't supported by the driver.
+print("Skipping spec/{}".format(entry))
+else:
+# recursively walk the subdirectory
+retval += walk_filter_dir_tree(full_path)
+elif os.path.isfile(full_path):
+# Add the file to the files list
+files += [entry]
+
+retval += [(root, None, files)]


It wont affect anything in our use, but 

[Piglit] [PATCH] framework: decrement argc in delete_arg()

2017-11-09 Thread Brian Paul
So it doesn't have to be done after every call to delete_arg().
---
 tests/util/piglit-framework-gl.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 22aadc5..1b2078d 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -87,13 +87,14 @@ piglit_gl_test_config_init(struct piglit_gl_test_config 
*config)
 }
 
 static void
-delete_arg(char *argv[], int argc, int arg)
+delete_arg(char *argv[], int *argc, int arg)
 {
int i;
 
-   for (i = arg + 1; i < argc; i++) {
+   for (i = arg + 1; i < *argc; i++) {
argv[i - 1] = argv[i];
}
+   (*argc)--;
 }
 
 /**
@@ -117,16 +118,13 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
for (j = 1; j < *argc; j++) {
if (!strcmp(argv[j], "-auto")) {
piglit_automatic = 1;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-fbo")) {
piglit_use_fbo = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-png")) {
piglit_dump_png = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-rlimit")) {
char *ptr;
unsigned long lim;
@@ -158,12 +156,10 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
j -= 2;
} else if (!strncmp(argv[j], "-samples=", 9)) {
*force_samples = atoi(argv[j]+9);
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
} else if (!strcmp(argv[j], "-khr_no_error")) {
piglit_khr_no_error = true;
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
if (config->khr_no_error_support ==
PIGLIT_UNKNOWN_ERROR_STATUS) {
fprintf(stderr,
@@ -186,8 +182,7 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
config->supports_gl_compat_version = 10;
config->supports_gl_core_version = 0;
puts("The compatibility profile forced.");
-   delete_arg(argv, *argc, j--);
-   *argc -= 1;
+   delete_arg(argv, argc, j--);
}
}
 }
-- 
1.9.1

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


[Piglit] [PATCH] all.py: filter directories traversed to find shader tests

2017-11-09 Thread Brian Paul
The script searches all files under tests/ and generated_tests/ for
files ending in ".shader_test".  For each match, a ShaderTest() object
is created and added to the test list.

For GL extensions or versions not supported by the driver, this is
wasted effort.

This patch looks for directories under spec/ and tries to determine if
the extension/feature is actually supported by the current driver.  If
not, it's skipped.

This, with other recent optimizations, reduces Piglit startup time for a
Windows VM from nearly 5 minutes to 45 seconds.

v2:
- replace os.path.walk() with my own walk_dir_tree() which avoids
  decending into subdirs when the parent directory/feature is not supported.
- Use env var to enable/disable shader directory filtering
- Also, fix naming conventions and minor formatting issues.
v3:
- minor Piglit style changes, per Dylan
- handle ES cases in is_feature_directory_supported()
---
 tests/all.py | 81 +++-
 1 file changed, 80 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index ae4a995..6c89d7a 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -13,7 +13,9 @@ import six
 from six.moves import range
 
 from framework import grouptools
+from framework.test import opengl
 from framework import options
+from framework import wflinfo
 from framework.profile import TestProfile
 from framework.driver_classifier import DriverClassifier
 from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest,
@@ -210,9 +212,86 @@ profile = TestProfile()  # pylint: disable=invalid-name
 
 shader_tests = collections.defaultdict(list)
 
+wfl_info = wflinfo.WflInfo()
+
+
+def gl_extension_supported(ext_name):
+"""Is the named OpenGL extension supported?"""
+return ext_name in wfl_info.gl_extensions
+
+
+def is_feature_directory_supported(dir_name):
+"""Determine if dir_name specifies an OpenGL feature (extension or GL
+version) which is supported by the host.  If we return False, it means
+the extension/version is definitely not supported.  If we return True,
+it means the extension/version is possibly suppported.  We're a little
+fuzzy because we don't yet parse all the directory name possibilities
+(like ES tests).
+"""
+if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
+# The directory is a GL extension name, but of the format "arb_foo_bar"
+# instead of "GL_ARB_foo_bar".  We convert the former into the later
+# and check if the extension is supported.
+ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:]
+return gl_extension_supported(ext_name)
+elif dir_name[:5] == "gles-":
+# OpenGL ES test
+version = dir_name[5:]
+return float(version) <= float(wfl_info.gles_version)
+elif dir_name[:8] == "glsl-es-":
+# OpenGL ES shader test
+version = dir_name[8:]
+return float(version) <= float(wfl_info.glsl_es_version)
+elif dir_name[:3] == "gl-":
+# The directory is a GL version
+version = dir_name[3:]
+return float(version) <= float(wfl_info.gl_version)
+elif dir_name[:5] == "glsl-":
+# The directory is a GLSL version
+version = dir_name[5:]
+return float(version) <= float(wfl_info.glsl_version)
+else:
+# The directory is something else.  Don't skip it.
+return True
+
+
+def walk_filter_dir_tree(root):
+"""Recursively walk the directory tree rooted at 'root'.
+If we find a directory path of the form ".../spec/foo/" we'll check if
+'foo' is a supported extension/feature/version.  If not, we do not
+traverse foo/.  Otherwise, we add continue traversing.
+The return value is a list of (dirpath, filename) tuples.
+"""
+curdir = os.path.split(root)[1]
+files = []
+retval = []
+
+for entry in os.listdir(root):
+full_path = os.path.join(root, entry)
+if os.path.isdir(full_path):
+# Check if we're in a "spec/" direcotry
+if curdir == "spec" and not is_feature_directory_supported(entry):
+# The directory's tests aren't supported by the driver.
+print("Skipping spec/{}".format(entry))
+else:
+# recursively walk the subdirectory
+retval += walk_filter_dir_tree(full_path)
+elif os.path.isfile(full_path):
+# Add the file to the files list
+files += [entry]
+
+retval += [(root, [], files)]
+
+return retval
+
+
 # Find and add all shader tests.
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
-for dirpath, _, filenames in os.walk(basedir):
+if os.environ.get("PIGLIT_FILTER_DIRECTORIES"):
+files = walk_filter_dir_tree(basedir)
+else:
+files = os.walk(basedir)
+for dirpath, _, filenames in files:
 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 for filename in 

[Piglit] [PATCH 1/2] framework: fix wflinfo issues in opengl module

2017-11-09 Thread Brian Paul
1. If the PIGLIT_PLATFORM string is 'mixed_glx_egl' we need to convert
it to 'glx' so that wflinfo understands it.

2. Look in the piglit bin/ directory for the wflinfo.exe program.
When we build piglit, we copy wflinfo.exe into the bin/ directory for
packaging to avoid having to install waffle on target machines.  If
it's not found there, assume it's in our PATH just like before.

v2: Pass env argument to subprocess.check_output() instead of using
the find_wflinfo() function, per Dylan.
---
 framework/wflinfo.py | 31 +--
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/framework/wflinfo.py b/framework/wflinfo.py
index b9a05f8..3849838 100644
--- a/framework/wflinfo.py
+++ b/framework/wflinfo.py
@@ -24,11 +24,13 @@ from __future__ import (
 import errno
 import os
 import subprocess
+import sys
 
 import six
 
 from framework import exceptions, core
 from framework.options import OPTIONS
+from framework.test import piglit_test
 
 
 class StopWflinfo(exceptions.PiglitException):
@@ -77,16 +79,34 @@ class WflInfo(object):
 """
 with open(os.devnull, 'w') as d:
 try:
-raw = subprocess.check_output(
-['wflinfo',
- '--platform', OPTIONS.env['PIGLIT_PLATFORM']] + opts,
-stderr=d)
+# Get the piglit platform string and, if needed, convert it
+# to something that wflinfo understands.
+platform = OPTIONS.env['PIGLIT_PLATFORM']
+if platform == "mixed_glx_egl":
+platform = "glx"
+
+if sys.platform in ['windows', 'cygwin']:
+bin = 'wflinfo.exe'
+else:
+bin = 'wflinfo'
+
+cmd = [bin, '--platform', platform] + opts
+
+# setup execution environment where we extend the PATH env var
+# to include the piglit TEST_BIN_DIR
+new_env = os.environ
+new_env['PATH'] = ':'.join([piglit_test.TEST_BIN_DIR,
+os.environ['PATH']])
+
+raw = subprocess.check_output(cmd, env=new_env, stderr=d)
+
 except subprocess.CalledProcessError:
 # When we hit this error it usually going to be because we have
 # an incompatible platform/profile combination
 raise StopWflinfo('Called')
 except OSError as e:
 # If we get a 'no wflinfo' warning then just return
+print("wflinfo utility not found.")
 if e.errno == errno.ENOENT:
 raise StopWflinfo('OSError')
 raise
@@ -122,8 +142,7 @@ class WflInfo(object):
 try:
 ret = self.__call_wflinfo(const + [var])
 except StopWflinfo as e:
-# This means tat the particular api or profile is
-# unsupported
+# This means the particular api or profile is unsupported
 if e.reason == 'Called':
 continue
 else:
-- 
1.9.1

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


[Piglit] [PATCH 2/2] all.py: filter directories traversed to find shader tests

2017-11-09 Thread Brian Paul
The script searches all files under tests/ and generated_tests/ for
files ending in ".shader_test".  For each match, a ShaderTest() object
is created and added to the test list.

For GL extensions or versions not supported by the driver, this is
wasted effort.

This patch looks for directories under spec/ and tries to determine if
the extension/feature is actually supported by the current driver.  If
not, it's skipped.

This somewhat reduces Piglit start up time, but substantially more
time is spent in the ShaderTest() constructor which actually opens
and parses each file to determine its GL/ES dependencies.  I'll try
to address that in the future.

v2:
- replace os.path.walk() with my own walk_dir_tree() which avoids
  decending into subdirs when the parent directory/feature is not supported.
- Use env var to enable/disable shader directory filtering
- Also, fix naming conventions and minor formatting issues.
---
 tests/all.py | 73 +++-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/tests/all.py b/tests/all.py
index ae4a995..93f66cf 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -8,12 +8,15 @@ import collections
 import itertools
 import os
 import platform
+import re
 
 import six
 from six.moves import range
 
 from framework import grouptools
+from framework.test import opengl
 from framework import options
+from framework import wflinfo
 from framework.profile import TestProfile
 from framework.driver_classifier import DriverClassifier
 from framework.test import (PiglitGLTest, GleanTest, PiglitBaseTest,
@@ -210,9 +213,77 @@ profile = TestProfile()  # pylint: disable=invalid-name
 
 shader_tests = collections.defaultdict(list)
 
+wfl_info = wflinfo.WflInfo()
+
+
+def gl_extension_supported(ext_name):
+"""Is the named OpenGL extension supported?"""
+return ext_name in wfl_info.gl_extensions
+
+def is_feature_directory_supported(dir_name):
+"""Determine if dir_name specifies an OpenGL feature (extension or GL
+version) which is supported by the host.  If we return False, it means
+the extension/version is definitely not supported.  If we return True,
+it means the extension/version is possibly suppported.  We're a little
+fuzzy because we don't yet parse all the directory name possibilities
+(like ES tests).
+"""
+if dir_name[:4] in {"amd_", "arb_", "ati_", "ext_", "khr_", "oes_"}:
+# The directory is a GL extension name, but of the format "arb_foo_bar"
+# instead of "GL_ARB_foo_bar".  We convert the former into the later
+# and check if the extension is supported.
+ext_name = "GL_" + dir_name[0:4].upper() + dir_name[4:]
+return gl_extension_supported(ext_name)
+elif re.match("gl-\d\.\d+", dir_name):
+# The directory is a GL version
+version = dir_name[3:]
+return float(version) <= float(wfl_info.gl_version)
+elif re.match("glsl-\d\.\d+", dir_name):
+# The directory is a GLSL version
+version = dir_name[5:]
+return float(version) <= float(wfl_info.glsl_version)
+else:
+# The directory is something else.  Don't skip it.
+return True
+
+
+def walk_filter_dir_tree(root):
+"""Recursively walk the directory tree rooted at 'root'.
+If we find a directory path of the form ".../spec/foo/" we'll check if
+'foo' is a supported extension/feature/version.  If not, we do not
+traverse foo/.  Otherwise, we add continue traversing.
+The return value is a list of (dirpath, filename) tuples.
+"""
+curdir = os.path.split(root)[1]
+files = []
+retval = []
+
+for entry in os.listdir(root):
+full_path = os.path.join(root, entry)
+if os.path.isdir(full_path):
+# Check if we're in a "spec/" direcotry
+if curdir == "spec" and not is_feature_directory_supported(entry):
+# The directory's tests aren't supported by the driver.
+print("Skipping spec/{}".format(entry))
+else:
+# recursively walk the subdirectory
+retval += walk_filter_dir_tree(full_path)
+elif os.path.isfile(full_path):
+# Add the file to the files list
+files += [entry]
+
+retval += [(root, None, files)]
+
+return retval
+
+
 # Find and add all shader tests.
 for basedir in [TESTS_DIR, GENERATED_TESTS_DIR]:
-for dirpath, _, filenames in os.walk(basedir):
+if os.environ.get("PIGLIT_FILTER_DIRECTORIES"):
+files = walk_filter_dir_tree(basedir)
+else:
+files = os.walk(basedir)
+for dirpath, _, filenames in files:
 groupname = grouptools.from_path(os.path.relpath(dirpath, basedir))
 for filename in filenames:
 testname, ext = os.path.splitext(filename)
-- 
1.9.1

___
Piglit mailing list
Piglit@lists.freedesktop.org

Re: [Piglit] [PATCH] util: remove -compat from arguments so as not to confuse tests

2017-11-09 Thread Brian Paul

On 11/09/2017 03:49 PM, Marek Olšák wrote:

From: Marek Olšák <marek.ol...@amd.com>

---
  tests/util/piglit-framework-gl.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 29e0e3a..22aadc5 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned 
*force_samples,
}
} else if (!strcmp(argv[j], "-compat")) {
if (config->supports_gl_es_version) {
fprintf(stderr,
"-compat isn't allowed with ES 
tests!\n");
piglit_report_result(PIGLIT_FAIL);
}
config->supports_gl_compat_version = 10;
config->supports_gl_core_version = 0;
puts("The compatibility profile forced.");
+   delete_arg(argv, *argc, j--);
+   *argc -= 1;
}
}
  }

  void
  piglit_gl_process_args(int *argc, char *argv[],
   struct piglit_gl_test_config *config)
  {
unsigned force_samples = 0;




Reviewed-by: Brian Paul <bri...@vmware.com>

IMO, the delete_arg() function should take care of decrementing argc. 
Want to do that too?


-Brian

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


Re: [Piglit] [PATCH 10/12] Remove text coord generation Glean test

2017-11-09 Thread Brian Paul

In subject line: s/text/texture/

-Brian

On 11/09/2017 02:27 PM, Fabian Bieler wrote:

---
  tests/all.py  |   1 -
  tests/glean/CMakeLists.gl.txt |   1 -
  tests/glean/ttexgen.cpp   | 376 --
  tests/glean/ttexgen.h |  67 
  4 files changed, 445 deletions(-)
  delete mode 100644 tests/glean/ttexgen.cpp
  delete mode 100644 tests/glean/ttexgen.h

diff --git a/tests/all.py b/tests/all.py
index a89efb0..c8b02b7 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -304,7 +304,6 @@ with profile.test_list.group_manager(GleanTest, 'glean') as 
g:
  # the equivalent functionality is covered by other tests
  g('shaderAPI')
  g('texCube')
-g('texgen')
  g('texture_srgb')
  g('texUnits')
  g('vertArrayBGRA')
diff --git a/tests/glean/CMakeLists.gl.txt b/tests/glean/CMakeLists.gl.txt
index 569faaf..16a0d46 100644
--- a/tests/glean/CMakeLists.gl.txt
+++ b/tests/glean/CMakeLists.gl.txt
@@ -37,7 +37,6 @@ piglit_add_executable (glean
tpixelformats.cpp
tshaderapi.cpp
ttexcube.cpp
-   ttexgen.cpp
ttexture_srgb.cpp
ttexunits.cpp
tvertarraybgra.cpp
diff --git a/tests/glean/ttexgen.cpp b/tests/glean/ttexgen.cpp
deleted file mode 100644
index f44cb9a..000
--- a/tests/glean/ttexgen.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-// BEGIN_COPYRIGHT -*- glean -*-
-//
-// Copyright (C) 1999  Allen Akin   All Rights Reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the
-// Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-// KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-// PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ALLEN AKIN BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
-// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-// END_COPYRIGHT
-
-
-// ttexgen.cpp:  Basic test of GL texture coordinate generation.
-// This test does a basic test of the glTexGen functions, including
-// object_linear, eye_linear, and sphere_map.  We use the Sphere3D with
-// a GeomRenderer to draw a sphere, and map a check texture onto it.  We
-// use an ortho projection to keep it simple.  The result should be a 1:1
-// mapping of the check texture for all three modes (sphere map maps 1:1
-// because mapping it onto a sphere inverts the spheremap math).
-//
-// Note that accuracy issues might cause this test to fail if the
-// texcoords near the center are a little warped; I've specifically tried
-// to keep the matrices as "pure" as possible (no rotations) to
-// keep the numerical precision high.  So far it seems to work fine.
-// Introducing a rotation by 90 degrees about the x axis resulted,
-// on one driver, in a warping at the center of the sphere which caused
-// the test to fail.
-//
-// For the second test of the three, we offset the texture by 0.5,
-// so that each test's rendering is visually distinct from the
-// previous.
-//
-// To test for pass/fail we examine the color buffer for red and blue,
-// (the check colors) in the appropriate places.
-//
-// Author: Brian Sharp (br...@maniacal.org) December 2000
-
-#include "ttexgen.h"
-#include 
-#include "geomutil.h"
-
-
-const GLuint viewSize=50;
-
-
-namespace GLEAN {
-
-void
-TexgenTest::FailMessage(BasicResult , const std::string& texgenMode,
-   GeomRenderer::DrawMethod method, bool arraysCompiled,
-   int retainedMode,
-   const std::string& colorMismatch) const {
-   env->log << name << ":  FAIL "
- << r.config->conciseDescription() << '\n';
-   env->log << "\t" << "during mode " << texgenMode << ", ";
-switch(method)
-{
-case GeomRenderer::GLVERTEX_MODE: env->log << "glVertex-style rendering, 
"; break;
-case GeomRenderer::GLARRAYELEMENT_MODE: env->log << "glArrayElement-style 
rendering, "; break;
-case GeomRenderer::GLDRAWELEMENTS_MODE: env->log << "glDrawElements-style 
rendering, "; break;
-case GeomRenderer::GLDRAWARRAYS_MODE: env->log << "glDrawArrays-style 
rendering, "; break;
-}
-if (arraysCompiled) env->log << "arrays locked, ";
-else env->log << "arrays not locked, ";
-
-if (retainedMode) env->log << "built into a display 

  1   2   3   4   5   6   7   8   9   10   >