1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
|
/*
* 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.
*/
#include "piglit-util-gl.h"
static const GLenum valid_targets[] = {
GL_TEXTURE_1D,
GL_TEXTURE_1D_ARRAY,
GL_TEXTURE_2D,
GL_TEXTURE_2D_ARRAY,
GL_TEXTURE_3D,
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_CUBE_MAP_ARRAY,
GL_TEXTURE_RECTANGLE,
GL_TEXTURE_BUFFER,
GL_RENDERBUFFER,
GL_TEXTURE_2D_MULTISAMPLE,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
};
static const GLenum invalid_targets[] = {
GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3,
GL_COLOR_ATTACHMENT4,
GL_COLOR_ATTACHMENT5,
GL_COLOR_ATTACHMENT6,
GL_COLOR_ATTACHMENT7,
GL_COLOR_ATTACHMENT8,
GL_COLOR_ATTACHMENT9,
GL_COLOR_ATTACHMENT10,
GL_COLOR_ATTACHMENT11,
GL_COLOR_ATTACHMENT12,
GL_COLOR_ATTACHMENT13,
GL_COLOR_ATTACHMENT14,
GL_COLOR_ATTACHMENT15,
GL_DEPTH_ATTACHMENT,
GL_STENCIL_ATTACHMENT,
GL_TEXTURE_4D_SGIS,
GL_TEXTURE_RENDERBUFFER_NV,
};
static const GLenum texture_targets[] = {
GL_TEXTURE_1D,
GL_TEXTURE_1D_ARRAY,
GL_TEXTURE_2D,
GL_TEXTURE_2D_ARRAY,
GL_TEXTURE_3D,
GL_TEXTURE_CUBE_MAP,
GL_TEXTURE_CUBE_MAP_ARRAY,
GL_TEXTURE_RECTANGLE,
GL_TEXTURE_BUFFER,
GL_TEXTURE_2D_MULTISAMPLE,
GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
};
static const GLenum valid_pnames[] = {
GL_SAMPLES,
GL_NUM_SAMPLE_COUNTS,
GL_INTERNALFORMAT_SUPPORTED,
GL_INTERNALFORMAT_PREFERRED,
GL_INTERNALFORMAT_RED_SIZE,
GL_INTERNALFORMAT_GREEN_SIZE,
GL_INTERNALFORMAT_BLUE_SIZE,
GL_INTERNALFORMAT_ALPHA_SIZE,
GL_INTERNALFORMAT_DEPTH_SIZE,
GL_INTERNALFORMAT_STENCIL_SIZE,
GL_INTERNALFORMAT_SHARED_SIZE,
GL_INTERNALFORMAT_RED_TYPE,
GL_INTERNALFORMAT_GREEN_TYPE,
GL_INTERNALFORMAT_BLUE_TYPE,
GL_INTERNALFORMAT_ALPHA_TYPE,
GL_INTERNALFORMAT_DEPTH_TYPE,
GL_INTERNALFORMAT_STENCIL_TYPE,
GL_MAX_WIDTH,
GL_MAX_HEIGHT,
GL_MAX_DEPTH,
GL_MAX_LAYERS,
GL_MAX_COMBINED_DIMENSIONS,
GL_COLOR_COMPONENTS,
GL_DEPTH_COMPONENTS,
GL_STENCIL_COMPONENTS,
GL_COLOR_RENDERABLE,
GL_DEPTH_RENDERABLE,
GL_STENCIL_RENDERABLE,
GL_FRAMEBUFFER_RENDERABLE,
GL_FRAMEBUFFER_RENDERABLE_LAYERED,
GL_FRAMEBUFFER_BLEND,
GL_READ_PIXELS,
GL_READ_PIXELS_FORMAT,
GL_READ_PIXELS_TYPE,
GL_TEXTURE_IMAGE_FORMAT,
GL_TEXTURE_IMAGE_TYPE,
GL_GET_TEXTURE_IMAGE_FORMAT,
GL_GET_TEXTURE_IMAGE_TYPE,
GL_MIPMAP,
GL_MANUAL_GENERATE_MIPMAP,
GL_AUTO_GENERATE_MIPMAP,
GL_COLOR_ENCODING,
GL_SRGB_READ,
GL_SRGB_WRITE,
GL_SRGB_DECODE_ARB,
GL_FILTER,
GL_VERTEX_TEXTURE,
GL_TESS_CONTROL_TEXTURE,
GL_TESS_EVALUATION_TEXTURE,
GL_GEOMETRY_TEXTURE,
GL_FRAGMENT_TEXTURE,
GL_COMPUTE_TEXTURE,
GL_TEXTURE_SHADOW,
GL_TEXTURE_GATHER,
GL_TEXTURE_GATHER_SHADOW,
GL_SHADER_IMAGE_LOAD,
GL_SHADER_IMAGE_STORE,
GL_SHADER_IMAGE_ATOMIC,
GL_IMAGE_TEXEL_SIZE,
GL_IMAGE_COMPATIBILITY_CLASS,
GL_IMAGE_PIXEL_FORMAT,
GL_IMAGE_PIXEL_TYPE,
GL_IMAGE_FORMAT_COMPATIBILITY_TYPE,
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST,
GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST,
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE,
GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE,
GL_TEXTURE_COMPRESSED,
GL_TEXTURE_COMPRESSED_BLOCK_WIDTH,
GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT,
GL_TEXTURE_COMPRESSED_BLOCK_SIZE,
GL_CLEAR_BUFFER,
GL_TEXTURE_VIEW,
GL_VIEW_COMPATIBILITY_CLASS
};
static const GLenum invalid_pnames[] = {
GL_RED_BITS,
GL_GREEN_BITS,
GL_BLUE_BITS,
GL_ALPHA_BITS,
GL_DEPTH_BITS,
GL_STENCIL_BITS,
GL_MAX_3D_TEXTURE_SIZE,
GL_MAX_CUBE_MAP_TEXTURE_SIZE,
GL_TEXTURE_INTERNAL_FORMAT,
GL_TEXTURE_WIDTH,
GL_TEXTURE_HEIGHT,
GL_TEXTURE_COMPONENTS,
};
/*
* The following are the valid internalformats defined when the spec
* was written (at 4.2).
*
* From spec:
*
* "INTERNALFORMAT_SUPPORTED:
* <skip>
*
* <internalformats> that must be supported (in GL 4.2 or later)
* include the following:
* - "sized internal formats" from Table 3.12, 3.13, and 3.15,
* - any specific "compressed internal format" from Table 3.14,
* - any "image unit format" from Table 3.21.
* - any generic "compressed internal format" from Table 3.14, if
* the implementation accepts it for any texture specification
* commands, and
* - unsized or base internal format, if the implementation accepts
* it for texture or image specification."
*/
static const GLenum base_valid_internalformats[] = {
/* Base/unsized internal format (from Table 3.11) */
GL_DEPTH_COMPONENT,
GL_DEPTH_STENCIL,
GL_RED,
GL_RG,
GL_RGB,
GL_RGBA,
/* Table 3.12 (Table 3.15 and 3.21 included here) */
GL_R8,
GL_R8_SNORM,
GL_R16,
GL_R16_SNORM,
GL_RG8,
GL_RG8_SNORM,
GL_RG16,
GL_RG16_SNORM,
GL_R3_G3_B2,
GL_RGB4,
GL_RGB5,
GL_RGB8,
GL_RGB8_SNORM,
GL_RGB10,
GL_RGB12,
GL_RGB16,
GL_RGB16_SNORM,
GL_RGBA2,
GL_RGBA4,
GL_RGB5_A1,
GL_RGBA8,
GL_RGBA8_SNORM,
GL_RGB10_A2,
GL_RGB10_A2UI,
GL_RGBA12,
GL_RGBA16,
GL_RGBA16_SNORM,
GL_SRGB8,
GL_SRGB8_ALPHA8,
GL_R16F,
GL_RG16F,
GL_RGB16F,
GL_RGBA16F,
GL_R32F,
GL_RG32F,
GL_RGB32F,
GL_RGBA32F,
GL_R11F_G11F_B10F,
GL_RGB9_E5,
GL_R8I,
GL_R8UI,
GL_R16I,
GL_R16UI,
GL_R32I,
GL_R32UI,
GL_RG8I,
GL_RG16I,
GL_RG16UI,
GL_RG32I,
GL_RG32UI,
GL_RGB8I,
GL_RGB8UI,
GL_RGB16I,
GL_RGB16UI,
GL_RGB32I,
GL_RGB32UI,
GL_RGBA8I,
GL_RGBA8UI,
GL_RGBA16I,
GL_RGBA16UI,
GL_RGBA32I,
GL_RGBA32UI,
/* Table 3.13 */
GL_DEPTH_COMPONENT16,
GL_DEPTH_COMPONENT24,
GL_DEPTH_COMPONENT32,
GL_DEPTH_COMPONENT32F,
GL_DEPTH24_STENCIL8,
GL_DEPTH32F_STENCIL8,
/* Table 3.14 (both specific and generic) */
GL_COMPRESSED_RED,
GL_COMPRESSED_RG,
GL_COMPRESSED_RGB,
GL_COMPRESSED_RGBA,
GL_COMPRESSED_SRGB,
GL_COMPRESSED_SRGB_ALPHA,
GL_COMPRESSED_RED_RGTC1,
GL_COMPRESSED_SIGNED_RED_RGTC1,
GL_COMPRESSED_RG_RGTC2,
GL_COMPRESSED_SIGNED_RG_RGTC2,
GL_COMPRESSED_RGBA_BPTC_UNORM,
GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT,
GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
};
/*
* Below the new internalformats added by ARB_ES3_compatibility, core
* since 4.3. You can find those internalformats at Spec 4.3 Table
* 8.14
*/
static const GLenum arb_es3_compatibility_valid_internalformats[] = {
GL_COMPRESSED_RGB8_ETC2,
GL_COMPRESSED_SRGB8_ETC2,
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_RGBA8_ETC2_EAC,
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
GL_COMPRESSED_R11_EAC,
GL_COMPRESSED_SIGNED_R11_EAC,
GL_COMPRESSED_RG11_EAC,
GL_COMPRESSED_SIGNED_RG11_EAC,
};
extern GLenum *valid_internalformats;
extern unsigned num_valid_internalformats;
typedef struct _test_data test_data;
test_data* test_data_new(int testing64,
int params_size);
void test_data_clear(test_data **data);
void test_data_execute(test_data *data,
const GLenum target,
const GLenum internalformat,
const GLenum pname);
void
test_data_execute_with_size(test_data *data,
const GLenum target,
const GLenum internalformat,
const GLenum pname,
int size);
void test_data_set_testing64(test_data *data,
const int testing64);
void test_data_set_params_size(test_data *data,
const int params_size);
bool test_data_equal_at_index(test_data *data,
test_data *data_copy,
const unsigned index);
bool test_data_check_supported(const test_data *data,
const GLenum target,
const GLenum internalformat);
bool test_data_check_possible_values(test_data *data,
const GLint *possible_values,
const unsigned num_possible_values);
GLint64 test_data_value_at_index(test_data *data,
const int index);
void test_data_set_value_at_index(test_data *data,
const int index,
const GLint64 value);
test_data* test_data_clone(test_data *data);
int test_data_get_testing64(test_data *data);
int test_data_get_params_size(test_data *data);
bool try_basic(const GLenum *targets, unsigned num_targets,
const GLenum *internalformats, unsigned num_internalformats,
const GLenum pname,
const GLint *possible_values, unsigned num_possible_values,
test_data *data);
void print_failing_case(const GLenum target, const GLenum internalformat,
const GLenum pname, test_data *data);
void print_failing_case_full(const GLenum target, const GLenum internalformat,
const GLenum pname, GLint64 expected_value,
test_data *data);
bool value_on_set(const GLint *set,
const unsigned set_size,
GLint value);
bool check_query2_dependencies(const GLenum pname,
const GLenum target);
bool test_data_is_unsupported_response(test_data *data,
GLenum pname);
bool test_data_check_against_get_tex_level_parameter(test_data *data,
const GLenum target,
const GLenum pname,
const GLenum internalformat);
bool create_texture(const GLenum target,
const GLenum internalformat,
GLuint *tex_out,
GLuint *buffer_out);
void initialize_valid_internalformats();
|