ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / khr_texture_compression_astc / void-extent-dl-bug.c
blob2a9423906375a0cbd2f4761cf0aea09dbed56a2a
1 /*
2 * Copyright © 2018 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #include "piglit-util-gl.h"
25 #include "common.h"
27 PIGLIT_GL_TEST_CONFIG_BEGIN
29 config.supports_gl_compat_version = 11;
30 config.supports_gl_es_version = 20;
31 config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
33 PIGLIT_GL_TEST_CONFIG_END
35 void
36 piglit_init(int argc, char **argv)
38 piglit_require_extension("GL_KHR_texture_compression_astc_ldr");
41 enum piglit_result
42 piglit_display(void)
44 /* Mesa commit 710b1d2e665ed654fb8d52b146fa22469e1dc3a7 introduced a
45 * bug with void-extent blocks that have channel values between 0 and
46 * 4. Test this case.
48 const short void_extent_block_upload[8] = {0x0DFC, // ve header
49 0x0000, // don't care
50 0x0000, // don't care
51 0x0000, // don't care
52 0x0001, // r channel
53 0x0002, // g channel
54 0x0003, // b channel
55 0x0004,}; // a channel
56 short void_extent_block_download[8] = {0,};
58 bool pass = true;
59 for (int i = 0; i < ARRAY_SIZE(formats); i++) {
60 GLuint tex;
61 glGenTextures(1, &tex);
62 glBindTexture(GL_TEXTURE_2D, tex);
64 glCompressedTexImage2D(GL_TEXTURE_2D, 0, formats[i].fmt,
65 formats[i].bw, formats[i].bh, 0,
66 formats[i].bb, void_extent_block_upload);
67 glGetCompressedTexImage(GL_TEXTURE_2D, 0,
68 void_extent_block_download);
69 if (memcmp(void_extent_block_upload,
70 void_extent_block_download, 16) != 0) {
71 pass = false;
72 printf("Failed case %d\n", i);
75 glDeleteTextures(1, &tex);
78 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);