ext_texture_format_bgra8888: Add test for GL_BGRA format in Tex(Sub)Image calls

Submitted by Eduardo Lima Mitev on Oct. 15, 2015, 1:50 a.m.

Details

Message ID 1444873808-15719-1-git-send-email-elima@igalia.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Eduardo Lima Mitev Oct. 15, 2015, 1:50 a.m.
This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
format and internal format in Tex(Sub)Image2D calls, as specified by the
EXT_texture_format_BGRA8888 extension
<https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92265
---
 tests/all.py                                       |   6 ++
 tests/spec/CMakeLists.txt                          |   1 +
 .../CMakeLists.gles2.txt                           |   7 ++
 .../ext_texture_format_bgra8888/CMakeLists.txt     |   1 +
 tests/spec/ext_texture_format_bgra8888/teximage.c  | 103 +++++++++++++++++++++
 5 files changed, 118 insertions(+)
 create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
 create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
 create mode 100644 tests/spec/ext_texture_format_bgra8888/teximage.c

Patch hide | download patch | download mbox

diff --git a/tests/all.py b/tests/all.py
index 610d89f..144b51e 100644
--- a/tests/all.py
+++ b/tests/all.py
@@ -2226,6 +2226,12 @@  with profile.group_manager(
     g(['arb_occlusion_query2-api'], 'api')
     g(['arb_occlusion_query2-render'], 'render')
 
+# Group EXT_texture_format_BGRA8888 tests
+with profile.group_manager(
+        PiglitGLTest,
+        grouptools.join('spec', 'EXT_texture_format_BGRA8888')) as g:
+    g(['ext_texture_format_bgra8888-teximage'], 'teximage')
+
 with profile.group_manager(
         PiglitGLTest,
         grouptools.join('spec', 'ARB_pixel_buffer_object')) as g:
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 5dc37a1..bf22680 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -133,3 +133,4 @@  add_subdirectory (arb_texture_stencil8)
 add_subdirectory (arb_vertex_attrib_64bit)
 add_subdirectory (ext_framebuffer_blit)
 add_subdirectory (mesa_pack_invert)
+add_subdirectory (ext_texture_format_bgra8888)
diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
new file mode 100644
index 0000000..38edd70
--- /dev/null
+++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
@@ -0,0 +1,7 @@ 
+link_libraries (
+	piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable (ext_texture_format_bgra8888-teximage teximage.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
new file mode 100644
index 0000000..144a306
--- /dev/null
+++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
@@ -0,0 +1 @@ 
+piglit_include_target_api()
diff --git a/tests/spec/ext_texture_format_bgra8888/teximage.c b/tests/spec/ext_texture_format_bgra8888/teximage.c
new file mode 100644
index 0000000..cb40db2
--- /dev/null
+++ b/tests/spec/ext_texture_format_bgra8888/teximage.c
@@ -0,0 +1,103 @@ 
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * Tests glTex(Sub)Image functions for valid and invalid combinations of
+ * GL_BGRA_EXT format and internal format, as defined by the extension
+ * EXT_texture_format_BGRA888.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_es_version = 20;
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLboolean
+run_test(void)
+{
+   GLuint tex;
+
+   glGenTextures(1, &tex);
+   glBindTexture(GL_TEXTURE_2D, tex);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+      return false;
+
+   /* glTexImage2D */
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+      return false;
+
+   /* glTexImage2D, invalid internal format */
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+      return false;
+
+   /* glTexImage2D, invalid format */
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+      return false;
+
+   /* glTexImage2D, invalid type */
+   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_FLOAT, NULL);
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+      return false;
+
+   /* glTexSubImage2D */
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
+   if (!piglit_check_gl_error(GL_NO_ERROR))
+      return false;
+
+   /* glTexSubImage2D, invalid format */
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+      return false;
+
+   /* glTexSubImage2D, invalid type */
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_FLOAT, NULL);
+   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
+      return false;
+
+   glDeleteTextures(1, &tex);
+
+   return true;
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   GLboolean pass = run_test();
+
+   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+   piglit_require_extension("GL_EXT_texture_format_BGRA8888");
+}

Comments

On Wed, Oct 14, 2015 at 6:50 PM, Eduardo Lima Mitev <elima@igalia.com> wrote:
> This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
> format and internal format in Tex(Sub)Image2D calls, as specified by the
> EXT_texture_format_BGRA8888 extension
> <https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92265
> ---
>  tests/all.py                                       |   6 ++
>  tests/spec/CMakeLists.txt                          |   1 +
>  .../CMakeLists.gles2.txt                           |   7 ++
>  .../ext_texture_format_bgra8888/CMakeLists.txt     |   1 +
>  tests/spec/ext_texture_format_bgra8888/teximage.c  | 103 +++++++++++++++++++++
>  5 files changed, 118 insertions(+)
>  create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
>  create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
>  create mode 100644 tests/spec/ext_texture_format_bgra8888/teximage.c
>
> diff --git a/tests/all.py b/tests/all.py
> index 610d89f..144b51e 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -2226,6 +2226,12 @@ with profile.group_manager(
>      g(['arb_occlusion_query2-api'], 'api')
>      g(['arb_occlusion_query2-render'], 'render')
>
> +# Group EXT_texture_format_BGRA8888 tests
> +with profile.group_manager(
> +        PiglitGLTest,
> +        grouptools.join('spec', 'EXT_texture_format_BGRA8888')) as g:
> +    g(['ext_texture_format_bgra8888-teximage'], 'teximage')
> +
>  with profile.group_manager(
>          PiglitGLTest,
>          grouptools.join('spec', 'ARB_pixel_buffer_object')) as g:
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 5dc37a1..bf22680 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -133,3 +133,4 @@ add_subdirectory (arb_texture_stencil8)
>  add_subdirectory (arb_vertex_attrib_64bit)
>  add_subdirectory (ext_framebuffer_blit)
>  add_subdirectory (mesa_pack_invert)
> +add_subdirectory (ext_texture_format_bgra8888)
> diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
> new file mode 100644
> index 0000000..38edd70
> --- /dev/null
> +++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
> @@ -0,0 +1,7 @@
> +link_libraries (
> +       piglitutil_${piglit_target_api}
> +)
> +
> +piglit_add_executable (ext_texture_format_bgra8888-teximage teximage.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/ext_texture_format_bgra8888/teximage.c b/tests/spec/ext_texture_format_bgra8888/teximage.c
> new file mode 100644
> index 0000000..cb40db2
> --- /dev/null
> +++ b/tests/spec/ext_texture_format_bgra8888/teximage.c

Let's call this api-errors.c or something like that.  It really isn't
testing TexImage.  We should probably eventually have a test that
tests that the texture actually gets on the screen.  However, I'm not
too terribly worried about it since, as long as we don't error out, we
*probably* do the right thing there.

With it re-named to api-errors,

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>

> @@ -0,0 +1,103 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +/**
> + * @file
> + * Tests glTex(Sub)Image functions for valid and invalid combinations of
> + * GL_BGRA_EXT format and internal format, as defined by the extension
> + * EXT_texture_format_BGRA888.
> + */
> +
> +#include "piglit-util-gl.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_es_version = 20;
> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +static GLboolean
> +run_test(void)
> +{
> +   GLuint tex;
> +
> +   glGenTextures(1, &tex);
> +   glBindTexture(GL_TEXTURE_2D, tex);
> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +      return false;
> +
> +   /* glTexImage2D */
> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +      return false;
> +
> +   /* glTexImage2D, invalid internal format */
> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +      return false;
> +
> +   /* glTexImage2D, invalid format */
> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +      return false;
> +
> +   /* glTexImage2D, invalid type */
> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_FLOAT, NULL);
> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +      return false;
> +
> +   /* glTexSubImage2D */
> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +      return false;
> +
> +   /* glTexSubImage2D, invalid format */
> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +      return false;
> +
> +   /* glTexSubImage2D, invalid type */
> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_FLOAT, NULL);
> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
> +      return false;
> +
> +   glDeleteTextures(1, &tex);
> +
> +   return true;
> +}
> +
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> +   GLboolean pass = run_test();
> +
> +   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
> +}
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> +   piglit_require_extension("GL_EXT_texture_format_BGRA8888");
> +}
> --
> 2.5.3
>
Hi Eduardo,

A few humble suggestions.

On 15 October 2015 at 02:50, Eduardo Lima Mitev <elima@igalia.com> wrote:
> This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
> format and internal format in Tex(Sub)Image2D calls, as specified by the
> EXT_texture_format_BGRA8888 extension
> <https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.
There is no need to provide a link to the spec in commit messages.

[snip]
> +static GLboolean
Please use bool.

> +run_test(void)
> +{
> +   GLuint tex;
> +
> +   glGenTextures(1, &tex);
> +   glBindTexture(GL_TEXTURE_2D, tex);
> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +      return false;
> +
> +   /* glTexImage2D */
> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
Wrap the last three arguments to the next line ? Here and below.

> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> +      return false;
Most places in piglit continue running all (sub)tests, even if there
is a failure midway. One common pattern is

bool pass = true;

...

glFoo()
if (!piglit_check_gl_error...)
   pass = false;

...
return pass;


Cheers,
Emil

P.S. piglit tries to use tabs for indentation, albeit some tests use spaces.
On Thu, Oct 15, 2015 at 06:25:26PM +0100, Emil Velikov wrote:
> Hi Eduardo,
> 
> A few humble suggestions.
> 
> On 15 October 2015 at 02:50, Eduardo Lima Mitev <elima@igalia.com> wrote:
> > This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
> > format and internal format in Tex(Sub)Image2D calls, as specified by the
> > EXT_texture_format_BGRA8888 extension
> > <https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.
> There is no need to provide a link to the spec in commit messages.
> 
> [snip]
> > +static GLboolean
> Please use bool.
> 
> > +run_test(void)
> > +{
> > +   GLuint tex;
> > +
> > +   glGenTextures(1, &tex);
> > +   glBindTexture(GL_TEXTURE_2D, tex);
> > +   if (!piglit_check_gl_error(GL_NO_ERROR))
> > +      return false;
> > +
> > +   /* glTexImage2D */
> > +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> Wrap the last three arguments to the next line ? Here and below.
> 
> > +   if (!piglit_check_gl_error(GL_NO_ERROR))
> > +      return false;
> Most places in piglit continue running all (sub)tests, even if there
> is a failure midway. One common pattern is
> 
> bool pass = true;

Yes please. Not running all of the subtests (or at least returning
values for them) breaks assumptions made by the framework.

Dylan

> 
> ...
> 
> glFoo()
> if (!piglit_check_gl_error...)
>    pass = false;
> 
> ...
> return pass;
> 
> 
> Cheers,
> Emil
> 
> P.S. piglit tries to use tabs for indentation, albeit some tests use spaces.
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
Hi Emil,

I will update the test to address all your suggestions. I left some
comments inline.

On 10/15/2015 07:25 PM, Emil Velikov wrote:
> Hi Eduardo,
> 
> A few humble suggestions.
> 
> On 15 October 2015 at 02:50, Eduardo Lima Mitev <elima@igalia.com> wrote:
>> This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
>> format and internal format in Tex(Sub)Image2D calls, as specified by the
>> EXT_texture_format_BGRA8888 extension
>> <https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.
> There is no need to provide a link to the spec in commit messages.
> 
> [snip]
>> +static GLboolean
> Please use bool.
> 

Ok.

>> +run_test(void)
>> +{
>> +   GLuint tex;
>> +
>> +   glGenTextures(1, &tex);
>> +   glBindTexture(GL_TEXTURE_2D, tex);
>> +   if (!piglit_check_gl_error(GL_NO_ERROR))
>> +      return false;
>> +
>> +   /* glTexImage2D */
>> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> Wrap the last three arguments to the next line ? Here and below.
> 
>> +   if (!piglit_check_gl_error(GL_NO_ERROR))
>> +      return false;
> Most places in piglit continue running all (sub)tests, even if there
> is a failure midway. One common pattern is
> 
> bool pass = true;
> 

Yes, this is common practice in tests. A foolish mistake.

> ...
> 
> glFoo()
> if (!piglit_check_gl_error...)
>    pass = false;
> 
> ...
> return pass;
> 
> 
> Cheers,
> Emil
> 
> P.S. piglit tries to use tabs for indentation, albeit some tests use spaces.
> 

About indentation, I see that newly added files seem to have freedom
choosing between a tab and 3-space (like Mesa). So I chose the latter
for consistency with Mesa. Do you think I should use tab for indentation
instead?

Thanks!

Eduardo
On 10/15/2015 05:10 PM, Jason Ekstrand wrote:
> On Wed, Oct 14, 2015 at 6:50 PM, Eduardo Lima Mitev <elima@igalia.com> wrote:
>> This is a new test that checks valid and invalid combinations of GL_BGRA_EXT
>> format and internal format in Tex(Sub)Image2D calls, as specified by the
>> EXT_texture_format_BGRA8888 extension
>> <https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt>.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92265
>> ---
>>  tests/all.py                                       |   6 ++
>>  tests/spec/CMakeLists.txt                          |   1 +
>>  .../CMakeLists.gles2.txt                           |   7 ++
>>  .../ext_texture_format_bgra8888/CMakeLists.txt     |   1 +
>>  tests/spec/ext_texture_format_bgra8888/teximage.c  | 103 +++++++++++++++++++++
>>  5 files changed, 118 insertions(+)
>>  create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
>>  create mode 100644 tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
>>  create mode 100644 tests/spec/ext_texture_format_bgra8888/teximage.c
>>
>> diff --git a/tests/all.py b/tests/all.py
>> index 610d89f..144b51e 100644
>> --- a/tests/all.py
>> +++ b/tests/all.py
>> @@ -2226,6 +2226,12 @@ with profile.group_manager(
>>      g(['arb_occlusion_query2-api'], 'api')
>>      g(['arb_occlusion_query2-render'], 'render')
>>
>> +# Group EXT_texture_format_BGRA8888 tests
>> +with profile.group_manager(
>> +        PiglitGLTest,
>> +        grouptools.join('spec', 'EXT_texture_format_BGRA8888')) as g:
>> +    g(['ext_texture_format_bgra8888-teximage'], 'teximage')
>> +
>>  with profile.group_manager(
>>          PiglitGLTest,
>>          grouptools.join('spec', 'ARB_pixel_buffer_object')) as g:
>> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
>> index 5dc37a1..bf22680 100644
>> --- a/tests/spec/CMakeLists.txt
>> +++ b/tests/spec/CMakeLists.txt
>> @@ -133,3 +133,4 @@ add_subdirectory (arb_texture_stencil8)
>>  add_subdirectory (arb_vertex_attrib_64bit)
>>  add_subdirectory (ext_framebuffer_blit)
>>  add_subdirectory (mesa_pack_invert)
>> +add_subdirectory (ext_texture_format_bgra8888)
>> diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
>> new file mode 100644
>> index 0000000..38edd70
>> --- /dev/null
>> +++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.gles2.txt
>> @@ -0,0 +1,7 @@
>> +link_libraries (
>> +       piglitutil_${piglit_target_api}
>> +)
>> +
>> +piglit_add_executable (ext_texture_format_bgra8888-teximage teximage.c)
>> +
>> +# vim: ft=cmake:
>> diff --git a/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
>> new file mode 100644
>> index 0000000..144a306
>> --- /dev/null
>> +++ b/tests/spec/ext_texture_format_bgra8888/CMakeLists.txt
>> @@ -0,0 +1 @@
>> +piglit_include_target_api()
>> diff --git a/tests/spec/ext_texture_format_bgra8888/teximage.c b/tests/spec/ext_texture_format_bgra8888/teximage.c
>> new file mode 100644
>> index 0000000..cb40db2
>> --- /dev/null
>> +++ b/tests/spec/ext_texture_format_bgra8888/teximage.c
> 
> Let's call this api-errors.c or something like that.  It really isn't
> testing TexImage.  We should probably eventually have a test that
> tests that the texture actually gets on the screen.  However, I'm not
> too terribly worried about it since, as long as we don't error out, we
> *probably* do the right thing there.
> 

Agree. Honestly, my initial idea was to write a more complete test
including actually checking for pixels. But then I decided to break it
into API checks now (to avoid the specific regression we had), and then
actual functionality check in the future.

I will rename it to api-errors and re-submit (also addressing Emil's
comments).

> With it re-named to api-errors,
> 
> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
> 

Thanks!

Eduardo

>> @@ -0,0 +1,103 @@
>> +/*
>> + * Copyright © 2015 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the "Software"),
>> + * to deal in the Software without restriction, including without limitation
>> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the next
>> + * paragraph) shall be included in all copies or substantial portions of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
>> + * IN THE SOFTWARE.
>> + */
>> +
>> +/**
>> + * @file
>> + * Tests glTex(Sub)Image functions for valid and invalid combinations of
>> + * GL_BGRA_EXT format and internal format, as defined by the extension
>> + * EXT_texture_format_BGRA888.
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +   config.supports_gl_es_version = 20;
>> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +static GLboolean
>> +run_test(void)
>> +{
>> +   GLuint tex;
>> +
>> +   glGenTextures(1, &tex);
>> +   glBindTexture(GL_TEXTURE_2D, tex);
>> +   if (!piglit_check_gl_error(GL_NO_ERROR))
>> +      return false;
>> +
>> +   /* glTexImage2D */
>> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
>> +   if (!piglit_check_gl_error(GL_NO_ERROR))
>> +      return false;
>> +
>> +   /* glTexImage2D, invalid internal format */
>> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
>> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +      return false;
>> +
>> +   /* glTexImage2D, invalid format */
>> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
>> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +      return false;
>> +
>> +   /* glTexImage2D, invalid type */
>> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT, GL_FLOAT, NULL);
>> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +      return false;
>> +
>> +   /* glTexSubImage2D */
>> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
>> +   if (!piglit_check_gl_error(GL_NO_ERROR))
>> +      return false;
>> +
>> +   /* glTexSubImage2D, invalid format */
>> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
>> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +      return false;
>> +
>> +   /* glTexSubImage2D, invalid type */
>> +   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, GL_BGRA_EXT, GL_FLOAT, NULL);
>> +   if (!piglit_check_gl_error(GL_INVALID_OPERATION))
>> +      return false;
>> +
>> +   glDeleteTextures(1, &tex);
>> +
>> +   return true;
>> +}
>> +
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +   GLboolean pass = run_test();
>> +
>> +   return pass ? PIGLIT_PASS : PIGLIT_FAIL;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +   piglit_require_extension("GL_EXT_texture_format_BGRA8888");
>> +}
>> --
>> 2.5.3
>>
>
On Oct 16, 2015 01:02, "Eduardo Lima Mitev" <elima@igalia.com> wrote:
>
> Hi Emil,
>
> I will update the test to address all your suggestions. I left some
> comments inline.
>
> On 10/15/2015 07:25 PM, Emil Velikov wrote:
> > Hi Eduardo,
> >
> > A few humble suggestions.
> >
> > On 15 October 2015 at 02:50, Eduardo Lima Mitev <elima@igalia.com>
wrote:
> >> This is a new test that checks valid and invalid combinations of
GL_BGRA_EXT
> >> format and internal format in Tex(Sub)Image2D calls, as specified by
the
> >> EXT_texture_format_BGRA8888 extension
> >> <
https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt
>.
> > There is no need to provide a link to the spec in commit messages.
> >
> > [snip]
> >> +static GLboolean
> > Please use bool.
> >
>
> Ok.
>
> >> +run_test(void)
> >> +{
> >> +   GLuint tex;
> >> +
> >> +   glGenTextures(1, &tex);
> >> +   glBindTexture(GL_TEXTURE_2D, tex);
> >> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> >> +      return false;
> >> +
> >> +   /* glTexImage2D */
> >> +   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, 2, 2, 0, GL_BGRA_EXT,
GL_UNSIGNED_BYTE, NULL);
> > Wrap the last three arguments to the next line ? Here and below.
> >
> >> +   if (!piglit_check_gl_error(GL_NO_ERROR))
> >> +      return false;
> > Most places in piglit continue running all (sub)tests, even if there
> > is a failure midway. One common pattern is
> >
> > bool pass = true;
> >
>
> Yes, this is common practice in tests. A foolish mistake.
>
> > ...
> >
> > glFoo()
> > if (!piglit_check_gl_error...)
> >    pass = false;
> >
> > ...
> > return pass;
> >
> >
> > Cheers,
> > Emil
> >
> > P.S. piglit tries to use tabs for indentation, albeit some tests use
spaces.
> >
>
> About indentation, I see that newly added files seem to have freedom
> choosing between a tab and 3-space (like Mesa). So I chose the latter
> for consistency with Mesa. Do you think I should use tab for indentation
> instead?
>

I believing the readme (or is it hacking?) file specifies the style as 8
space tabs.

> Thanks!
>
> Eduardo
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
On 15 October 2015 at 19:25, Dylan Baker <baker.dylan.c@gmail.com> wrote:
> Yes please. Not running all of the subtests (or at least returning
> values for them) breaks assumptions made by the framework.
>
How exactly doesn't the framework count the subtests ? Does it
detect/parse piglit_report_subtest_result() usage or does it use some
other method ? Afaict the former is not that commonly used as it
should have :'(

Thanks
Emil
On Fri, Oct 16, 2015 at 4:08 AM, Emil Velikov <emil.l.velikov@gmail.com>
wrote:

> On 15 October 2015 at 19:25, Dylan Baker <baker.dylan.c@gmail.com> wrote:
> > Yes please. Not running all of the subtests (or at least returning
> > values for them) breaks assumptions made by the framework.
> >
> How exactly doesn't the framework count the subtests ? Does it
> detect/parse piglit_report_subtest_result() usage or does it use some
> other method ? Afaict the former is not that commonly used as it
> should have :'(
>
> Thanks
> Emil
>

Well, the framework doesn't consider a test a subtest unless it uses the
piglit_report_subtest_result helper (or rolls the same functionality by
hand). Basically the framework treats tests with subtests as groups, and
the subtests as full tests, so leaving out subtests will push a crash into
the enabled/disabled page instead of the regressions/fixes page.