[Piglit] [PATCH] arb_texture_view/gles3: Test TEXTURE_IMMUTABLE_LEVELS parameter.

Ken Phillis Jr kphillisjr at gmail.com
Wed Mar 13 21:59:19 PDT 2013


This overall extension should probably use
piglit_report_subtest_result to provide a faster way to pinpoint
problems/errors.


And based on some of the previous messages, the subsequent results
reporting are... ( if passed )
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_1D - Initial value")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_1D - Error Code")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_1D - Initial
Value (GL_RGB32UI)")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_1D - Error Code
(GL_RGB32UI)")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_2D - Error Code")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_2D - Initial value")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_3D - Error Code")
piglit_report_subtest_result(PIGLIT_PASS, "GL_TEXTURE_3D - Initial Value")


On Tue, Mar 12, 2013 at 2:12 PM, Brian Paul <brianp at vmware.com> wrote:
> On 03/12/2013 12:16 PM, Matt Turner wrote:
>>
>> ---
>>   tests/spec/CMakeLists.txt                          |    1 +
>>   tests/spec/arb_texture_view/CMakeLists.gl.txt      |    4 +
>>   tests/spec/arb_texture_view/CMakeLists.gles3.txt   |    7 ++
>>   tests/spec/arb_texture_view/CMakeLists.txt         |    1 +
>>   .../arb_texture_view/texture-immutable-levels.c    |  111
>> ++++++++++++++++++++
>>   5 files changed, 124 insertions(+), 0 deletions(-)
>>   create mode 100644 tests/spec/arb_texture_view/CMakeLists.gl.txt
>>   create mode 100644 tests/spec/arb_texture_view/CMakeLists.gles3.txt
>>   create mode 100644 tests/spec/arb_texture_view/CMakeLists.txt
>>   create mode 100644
>> tests/spec/arb_texture_view/texture-immutable-levels.c
>>
>> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
>> index 18b1d37..05f1784 100644
>> --- a/tests/spec/CMakeLists.txt
>> +++ b/tests/spec/CMakeLists.txt
>> @@ -28,6 +28,7 @@ add_subdirectory (arb_texture_float)
>>   add_subdirectory (arb_texture_rectangle)
>>   add_subdirectory (arb_texture_multisample)
>>   add_subdirectory (arb_texture_storage)
>> +add_subdirectory (arb_texture_view)
>>   add_subdirectory (arb_timer_query)
>>   add_subdirectory (arb_transform_feedback2)
>>   add_subdirectory (ati_envmap_bumpmap)
>> diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt
>> b/tests/spec/arb_texture_view/CMakeLists.gl.txt
>> new file mode 100644
>> index 0000000..9e47bb4
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt
>> @@ -0,0 +1,4 @@
>> +link_libraries (
>> +       piglitutil_${piglit_target_api}
>> +)
>> +piglit_add_executable(arb_texture_view-immutable-levels
>> texture-immutable-levels.c)
>> diff --git a/tests/spec/arb_texture_view/CMakeLists.gles3.txt
>> b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
>> new file mode 100644
>> index 0000000..aada4e8
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_view/CMakeLists.gles3.txt
>> @@ -0,0 +1,7 @@
>> +link_libraries(
>> +       piglitutil_${piglit_target_api}
>> +       )
>> +
>> +piglit_add_executable(texture-immutable-levels_${piglit_target_api}
>> texture-immutable-levels.c)
>> +
>> +# vim: ft=cmake:
>> diff --git a/tests/spec/arb_texture_view/CMakeLists.txt
>> b/tests/spec/arb_texture_view/CMakeLists.txt
>> new file mode 100644
>> index 0000000..144a306
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_view/CMakeLists.txt
>> @@ -0,0 +1 @@
>> +piglit_include_target_api()
>> diff --git a/tests/spec/arb_texture_view/texture-immutable-levels.c
>> b/tests/spec/arb_texture_view/texture-immutable-levels.c
>> new file mode 100644
>> index 0000000..82e7cd6
>> --- /dev/null
>> +++ b/tests/spec/arb_texture_view/texture-immutable-levels.c
>> @@ -0,0 +1,111 @@
>> +/* Copyright © 2013 Intel Corporation
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining
>> a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * 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.
>> + */
>> +
>> +/**
>> + * Tests the TEXTURE_IMMUTABLE_LEVELS parameter.
>> + *
>> + * The GL ES 3.0 spec says:
>> + *
>> + *     "If the command is successful, TEXTURE_IMMUTABLE_FORMAT becomes
>> + *      TRUE and TEXTURE_IMMUTABLE_LEVELS becomes levels."
>> + *
>> + * where<command>  is either glTexStorage2D or glTexStorage3D. Desktop GL
>> + * with ARB_texture_view (part of GL 4.3) also allows glTexStorage1D.
>> + *
>> + * Test by calling glTexStorage*D with<levels>  = 3,<width>,<height>, and
>> + *<depth>  = 32; and then confirming that TEXTURE_IMMUTABLE_FORMAT
>
>
> s/FORMAT/LEVELS/
>
>
>  was
>>
>> + * correctly set to<levels>.
>> + */
>> +
>> +#include "piglit-util-gl-common.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +       /* ARB_texture_view requires GL 4.2 or ARB_texture_storage, which
>> +        * requires GL 1.2.
>> +        */
>> +       config.supports_gl_compat_version = 12;
>> +       config.supports_gl_es_version = 30;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +       GLuint tex[3];
>> +       GLsizei level;
>
>
> GLint level, since that's what glGetTexParameteriv() returns.
>
>
>
>> +
>> +       /* The GL ES 3.0 spec says:
>> +        *
>> +        *     "The [initial] value of TEXTURE_IMMUTABLE_LEVELS is 0."
>> +        */
>> +       glGetTexParameteriv(GL_TEXTURE_2D,
>> GL_TEXTURE_IMMUTABLE_LEVELS,&level);
>
>
> Also, maybe check that glGetError()==GL_NO_ERROR on this query?
>
>
>
>> +       if (level != 0) {
>> +               printf("Expected 0 levels initially, but
>> glGetTexParameteriv "
>> +                      "returned %d for GL_TEXTURE_1D.\n", level);
>> +               piglit_report_result(PIGLIT_FAIL);
>> +       }
>> +
>> +       glGenTextures(3, tex);
>> +#if defined(PIGLIT_USE_OPENGL)
>> +       glBindTexture(GL_TEXTURE_1D, tex[0]);
>> +       glTexStorage1D(GL_TEXTURE_1D, 3, GL_RGB32UI, 32);
>
>
> How about using a non-integer internal format so that we don't depend on
> GL_EXT_texture_integer?
>
>
>> +       glGetTexParameteriv(GL_TEXTURE_1D,
>> GL_TEXTURE_IMMUTABLE_LEVELS,&level);
>>
>> +       if (level != 3) {
>> +               printf("Expected 3 levels, but glGetTexParameteriv
>> returned "
>> +                      "%d for GL_TEXTURE_1D.\n", level);
>> +               piglit_report_result(PIGLIT_FAIL);
>> +       }
>> +#endif
>> +
>> +       glBindTexture(GL_TEXTURE_2D, tex[1]);
>> +       glTexStorage2D(GL_TEXTURE_2D, 3, GL_RGB32UI, 32, 32);
>> +       glGetTexParameteriv(GL_TEXTURE_2D,
>> GL_TEXTURE_IMMUTABLE_LEVELS,&level);
>> +       if (level != 3) {
>> +               printf("Expected 3 levels, but glGetTexParameteriv
>> returned "
>> +                      "%d for GL_TEXTURE_2D.\n", level);
>> +               piglit_report_result(PIGLIT_FAIL);
>> +       }
>> +
>> +       glBindTexture(GL_TEXTURE_3D, tex[2]);
>> +       glTexStorage3D(GL_TEXTURE_3D, 3, GL_RGB32UI, 32, 32, 32);
>> +       glGetTexParameteriv(GL_TEXTURE_3D,
>> GL_TEXTURE_IMMUTABLE_LEVELS,&level);
>
>
> Maybe use glGetTexParameterfv() for one of these to exercise that function.
>
>
>
>> +       if (level != 3) {
>> +               printf("Expected 3 levels, but glGetTexParameteriv
>> returned "
>> +                      "%d for GL_TEXTURE_3D.\n", level);
>> +               piglit_report_result(PIGLIT_FAIL);
>> +       }
>
>
> Also, maybe try quering GL_TEXTURE_IMMUTABLE_LEVELS after creating a texture
> with regular glTexImage2D() to make sure the value is zero.
>
>
>> +
>> +       glDeleteTextures(3, tex);
>> +
>> +       piglit_report_result(PIGLIT_PASS);
>> +       return 0;
>> +}
>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +#if defined(PIGLIT_USE_OPENGL)
>> +       piglit_require_extension("GL_ARB_texture_view");
>> +#endif
>> +}
>
>
> Looks good otherwise.
>
> Reviewed-by: Brian Paul <brianp at vmware.com>
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list