[Piglit] [PATCH v2] arb_clear_texture: add a trivial test
Fabian Bieler
fabianbieler at fastmail.fm
Fri Mar 7 07:48:06 PST 2014
Reviewed-by: Fabian Bieler <fabianbieler at fastmail.fm>
On 2014-03-07 08:57, Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> v1 -> v2:
>
> - clear-simple -> simple
> - free the colors array
> - remove unnecessary texparameter settings
> - switch to probing the texels directly, avoiding the fbo dance
>
> glapi/gl.spec | 41 +++++++++++++
> tests/all.py | 4 ++
> tests/spec/CMakeLists.txt | 1 +
> tests/spec/arb_clear_texture/CMakeLists.gl.txt | 13 ++++
> tests/spec/arb_clear_texture/CMakeLists.txt | 1 +
> tests/spec/arb_clear_texture/simple.c | 85 ++++++++++++++++++++++++++
> 6 files changed, 145 insertions(+)
> create mode 100644 tests/spec/arb_clear_texture/CMakeLists.gl.txt
> create mode 100644 tests/spec/arb_clear_texture/CMakeLists.txt
> create mode 100644 tests/spec/arb_clear_texture/simple.c
>
> diff --git a/glapi/gl.spec b/glapi/gl.spec
> index a8fcc44..6a24f83 100644
> --- a/glapi/gl.spec
> +++ b/glapi/gl.spec
> @@ -16410,6 +16410,47 @@ TextureStorage3DMultisampleEXT(texture, target, samples, internalformat, width,
> glxflags ignore
> offset ?
>
> +###############################################################################
> +#
> +# Extension #ARB145
> +# ARB_clear_texture commands
> +#
> +###############################################################################
> +
> +ClearTexImage(texture, level, format, type, data)
> + return void
> + param texture UInt32 in value
> + param level Int32 in value
> + param format GLenum in value
> + param type GLenum in value
> + param data Void in array [COMPSIZE(format/type)]
> + category ARB_clear_texture
> + version 4.4
> + extension
> + glxropcode ?
> + glxflags ignore
> + offset ?
> +
> +ClearTexSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data)
> + return void
> + param texture UInt32 in value
> + param level Int32 in value
> + param xoffset Int32 in value
> + param yoffset Int32 in value
> + param zoffset Int32 in value
> + param width Int32 in value
> + param height Int32 in value
> + param depth Int32 in value
> + param format GLenum in value
> + param type GLenum in value
> + param data Void in array [COMPSIZE(format/type)]
> + category ARB_clear_texture
> + version 4.4
> + extension
> + glxropcode ?
> + glxflags ignore
> + offset ?
> +
>
> ###############################################################################
> ###############################################################################
> diff --git a/tests/all.py b/tests/all.py
> index d6daed2..490aafa 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -3075,6 +3075,10 @@ add_concurrent_test(arb_clear_buffer_object, 'arb_clear_buffer_object-sub-overla
> add_concurrent_test(arb_clear_buffer_object, 'arb_clear_buffer_object-sub-simple')
> add_concurrent_test(arb_clear_buffer_object, 'arb_clear_buffer_object-zero-size')
>
> +arb_clear_texture = Group()
> +spec['ARB_clear_texture'] = arb_clear_texture
> +add_concurrent_test(arb_clear_texture, 'arb_clear_texture-simple')
> +
> arb_copy_buffer = Group()
> spec['ARB_copy_buffer'] = arb_copy_buffer
> add_plain_test(arb_copy_buffer, 'copy_buffer_coherency')
> diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
> index 0a513c1..3ea6c1e 100644
> --- a/tests/spec/CMakeLists.txt
> +++ b/tests/spec/CMakeLists.txt
> @@ -2,6 +2,7 @@ add_subdirectory (amd_performance_monitor)
> add_subdirectory (arb_base_instance)
> add_subdirectory (arb_buffer_storage)
> add_subdirectory (arb_clear_buffer_object)
> +add_subdirectory (arb_clear_texture)
> add_subdirectory (arb_color_buffer_float)
> add_subdirectory (arb_compute_shader)
> add_subdirectory (arb_debug_output)
> diff --git a/tests/spec/arb_clear_texture/CMakeLists.gl.txt b/tests/spec/arb_clear_texture/CMakeLists.gl.txt
> new file mode 100644
> index 0000000..c77fd79
> --- /dev/null
> +++ b/tests/spec/arb_clear_texture/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 (arb_clear_texture-simple simple.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/arb_clear_texture/CMakeLists.txt b/tests/spec/arb_clear_texture/CMakeLists.txt
> new file mode 100644
> index 0000000..144a306
> --- /dev/null
> +++ b/tests/spec/arb_clear_texture/CMakeLists.txt
> @@ -0,0 +1 @@
> +piglit_include_target_api()
> diff --git a/tests/spec/arb_clear_texture/simple.c b/tests/spec/arb_clear_texture/simple.c
> new file mode 100644
> index 0000000..7cc8e4d
> --- /dev/null
> +++ b/tests/spec/arb_clear_texture/simple.c
> @@ -0,0 +1,85 @@
> +/*
> + * Copyright © 2014 Ilia Mirkin
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "piglit-util-gl-common.h"
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> + config.supports_gl_compat_version = 13;
> + config.supports_gl_core_version = 31;
> +
> + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +
> +void
> +piglit_init(int argc, char **argv)
> +{
> + int i;
> + float *color = malloc(sizeof(float) * 32 * 32 * 3);
> + float colors[3] = {1.0, 0.0, 0.0};
> + const float clearColor[3] = { 0.0, 1.0, 0.0 };
> + GLuint texture;
> +
> + piglit_require_extension("GL_ARB_clear_texture");
> +
> + /* Create color data for texture */
> + for(i = 0; i < 32 * 32; i++) {
> + color[i*3 + 0] = colors[0];
> + color[i*3 + 1] = colors[1];
> + color[i*3 + 2] = colors[2];
> + }
> +
> + glGenTextures(1, &texture);
> +
> + /* Create texture */
> + glBindTexture(GL_TEXTURE_2D, texture);
> + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 32, 32,
> + 0, GL_RGB, GL_FLOAT, color);
> +
> + free(color);
> +
> + if (!piglit_check_gl_error(GL_NO_ERROR))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + /* Clear texture with glClearTexImage() */
> + glClearTexImage(texture, 0, GL_RGB, GL_FLOAT, clearColor);
> +
> + if (!piglit_probe_texel_rect_rgb(GL_TEXTURE_2D, 0,
> + 0, 0, 32, 32,
> + clearColor))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + if (!piglit_check_gl_error(GL_NO_ERROR))
> + piglit_report_result(PIGLIT_FAIL);
> +
> + piglit_report_result(PIGLIT_PASS);
> +}
> +
> +
> +enum piglit_result
> +piglit_display(void)
> +{
> + return PIGLIT_FAIL;
> +}
>
More information about the Piglit
mailing list