From 7a33793cd0d8d366bfdbaa1a17c4253dff3cff0e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 17 Nov 2011 01:52:31 -0800 Subject: Add a new comprehensive test for textureSize(). This exhaustively tests all of GLSL 1.30's textureSize variants, both in the vertex and fragment shaders. It covers: - Sampler data type (floating point, signed integer, unsigned integer) - Dimensionality (1D, 2D, 3D, Cube, 1DArray, 2DArray) - Color and shadow samplers - Mipmapped textures - Non-power-of-two textures It doesn't cover texture format variations. In fact, the test never actually provides any content for the textures, because it should be irrelevant for textureSize(), is easier to program, and also extra mean. The new "textureSize" binary takes two arguments: shader stage and sampler type. For example: ./bin/textureSize fs sampler1DArrayShadow ./bin/textureSize vs usamplerCube Signed-off-by: Kenneth Graunke Reviewed-by: Eric Anholt --- tests/texturing/shaders/common.h | 101 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/texturing/shaders/common.h (limited to 'tests/texturing/shaders/common.h') diff --git a/tests/texturing/shaders/common.h b/tests/texturing/shaders/common.h new file mode 100644 index 000000000..c25bf2cd5 --- /dev/null +++ b/tests/texturing/shaders/common.h @@ -0,0 +1,101 @@ +/* + * Copyright © 2011 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** + * \file common.h + * + * Common structures and functions used for GLSL 1.30+ texturing tests. + */ +#pragma once +#define _GNU_SOURCE +#include "piglit-util.h" + +/** + * Texture miplevel info: + * @{ + * + * The total number of miplevels: + */ +int miplevels; + +/** Size of the base level */ +int base_size[3]; + +/** + * Multidimensional array containing the dimensions of each miplevel, indexed + * by miplevel and then x/y/z. For example, miplevel[0][1] is the height of + * miplevel 0, while miplevel[5][2] is the number of slices in miplevel 5. + */ +int **level_size; +/** @} */ + +struct sampler_info +{ + /** GLSL sampler name (such as "usampler2DArray"). */ + const char *name; + + /** GLSL sampler return type: vec4, ivec4, uvec4, or float. */ + const char *return_type; + + /** GL sampler type (such as GL_UNSIGNED_INT_SAMPLER_2D_ARRAY). */ + GLenum type; + + /** GL texture target (such as GL_TEXTURE_2D_ARRAY). */ + GLenum target; + + /** Texture format data type: GL_FLOAT, GL_INT, or GL_UNSIGNED_INT. */ + GLenum data_type; + + /** Texture format: GL_RGBA, GL_RGBA_INTEGER, or GL_DEPTH_COMPONENT */ + GLenum format; + + /** + * Texture internal format: GL_RGBA32F, GL_RGBA32I, GL_RGBA32UI, or + * GL_DEPTH_COMPONENT. + */ + GLenum internal_format; +} sampler; + +/** + * Which shader stage to test + */ +enum shader_target { + UNKNOWN, + VS, + FS, + GS +}; + +float max2(float x, float y); + +bool has_height(); +bool has_slices(); + +bool is_array_sampler(); +bool is_shadow_sampler(); + +void upload_miplevel_data(GLenum target, int level, void *level_image); +void compute_miplevel_info(); +void require_GL_features(enum shader_target test_stage); +bool select_sampler(const char *name); + -- cgit v1.2.3