diff options
Diffstat (limited to 'tests/spec')
-rw-r--r-- | tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c | 237 | ||||
-rw-r--r-- | tests/spec/ext_texture_array/CMakeLists.gl.txt | 1 | ||||
-rw-r--r-- | tests/spec/ext_texture_array/CMakeLists.gles3.txt | 8 | ||||
-rw-r--r-- | tests/spec/ext_texture_array/compressed.c | 307 | ||||
-rw-r--r-- | tests/spec/gl-3.0/api/bindfragdata-link-error.c | 6 | ||||
-rw-r--r-- | tests/spec/gles-2.0/CMakeLists.gles2.txt | 3 | ||||
-rw-r--r-- | tests/spec/gles-2.0/minmax.c | 78 | ||||
-rw-r--r-- | tests/spec/glsl-es-1.00/execution/sanity.shader_test | 42 |
9 files changed, 679 insertions, 4 deletions
diff --git a/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt b/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt index b2a5b445..b088ab46 100644 --- a/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt +++ b/tests/spec/arb_uniform_buffer_object/CMakeLists.gl.txt @@ -30,6 +30,7 @@ add_executable (arb_uniform_buffer_object-layout-std140 layout-std140.c) add_executable (arb_uniform_buffer_object-layout-std140-base-size-and-alignment layout-std140-base-size-and-alignment.c uniform-types.c) add_executable (arb_uniform_buffer_object-link-mismatch-blocks link-mismatch-blocks.c) add_executable (arb_uniform_buffer_object-maxblocks maxblocks.c) +add_executable (arb_uniform_buffer_object-maxuniformblocksize maxuniformblocksize.c) add_executable (arb_uniform_buffer_object-minmax minmax.c) add_executable (arb_uniform_buffer_object-negative-bindbuffer-index negative-bindbuffer-index.c) add_executable (arb_uniform_buffer_object-negative-bindbuffer-target negative-bindbuffer-target.c) diff --git a/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c new file mode 100644 index 00000000..d29b0f75 --- /dev/null +++ b/tests/spec/arb_uniform_buffer_object/maxuniformblocksize.c @@ -0,0 +1,237 @@ +/* + * Copyright © 2012 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 maxblocks.c + * + * Tests linking and drawing with uniform buffer objects of size + * MAX_UNIFORM_BLOCK_SIZE and MAX_UNIFORM_BLOCK_SIZE + 4. + * + * We test the max size + 4 because implementations are allowed to + * link and draw beyond the exposed limits, but at that point there + * are no guarantees it will link. Those tests are the "vsexceed" and + * "fsexceed" arguments. + */ + +#define _GNU_SOURCE +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_ALPHA; + +PIGLIT_GL_TEST_CONFIG_END + +static enum { + VS, + VS_EXCEED, + FS, + FS_EXCEED, +} mode; + +static void +usage(const char *name) +{ + fprintf(stderr, "usage: %s <vs | vs_exceed | fs | fs_exceed>\n", + name); + piglit_report_result(PIGLIT_FAIL); +} + +enum piglit_result +piglit_display(void) +{ + const char *vs_ubo_template = + "#extension GL_ARB_uniform_buffer_object : enable\n" + "\n" + "varying vec4 vary;" + "\n" + "layout(std140) uniform ubo {\n" + " vec4 v[%d];\n" + "};\n" + "uniform int i;\n" + "\n" + "void main() {\n" + " gl_Position = gl_Vertex;\n" + " vary = v[i];\n" + "}\n"; + + const char *fs_template = + "#extension GL_ARB_uniform_buffer_object : enable\n" + "\n" + "varying vec4 vary;" + "\n" + "void main() {\n" + " gl_FragColor = vary;\n" + "}\n"; + + const char *vs_template = + "#extension GL_ARB_uniform_buffer_object : enable\n" + "\n" + "void main() {\n" + " gl_Position = gl_Vertex;\n" + "}\n"; + + const char *fs_ubo_template = + "#extension GL_ARB_uniform_buffer_object : enable\n" + "\n" + "layout(std140) uniform ubo {\n" + " vec4 v[%d];\n" + "};\n" + "uniform int i;\n" + "\n" + "void main() {\n" + " gl_FragColor = v[i];\n" + "}\n"; + + char *vs_source, *fs_source; + GLint max_size, vec4s, i_location; + GLuint vs, fs, prog, bo; + GLenum target; + float *data; + size_t size; + bool pass = true; + bool may_link_fail; + const float green[4] = { 0, 1, 0, 0 }; + + piglit_require_extension("GL_ARB_uniform_buffer_object"); + + glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &max_size); + printf("Max uniform block size: %d\n", max_size); + vec4s = max_size / 4 / 4; + + switch (mode) { + case VS: + target = GL_VERTEX_SHADER; + may_link_fail = false; + break; + case VS_EXCEED: + target = GL_VERTEX_SHADER; + may_link_fail = true; + vec4s++; + break; + case FS: + target = GL_FRAGMENT_SHADER; + may_link_fail = false; + break; + case FS_EXCEED: + target = GL_FRAGMENT_SHADER; + may_link_fail = true; + vec4s++; + break; + } + + switch (target) { + case GL_VERTEX_SHADER: + asprintf(&vs_source, vs_ubo_template, vec4s); + asprintf(&fs_source, fs_template); + printf("Testing VS with uniform block vec4 v[%d]\n", vec4s); + break; + case GL_FRAGMENT_SHADER: + asprintf(&vs_source, vs_template); + asprintf(&fs_source, fs_ubo_template, vec4s); + printf("Testing FS with uniform block vec4 v[%d]\n", vec4s); + break; + default: + piglit_report_result(PIGLIT_FAIL); + } + + vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source); + if (!vs) { + fprintf(stderr, "Failed to compile VS:\n%s", vs_source); + piglit_report_result(PIGLIT_FAIL); + } + + fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source); + if (!fs) { + fprintf(stderr, "Failed to compile FS:\n%s", fs_source); + piglit_report_result(PIGLIT_FAIL); + } + + prog = glCreateProgram(); + glAttachShader(prog, vs); + glAttachShader(prog, fs); + glLinkProgram(prog); + + if (may_link_fail) { + if (!piglit_link_check_status_quiet(prog)) { + printf("Failed to link with uniform block vec4 " + "v[%d]\n", vec4s); + piglit_report_result(PIGLIT_PASS); + } + } else { + if (!piglit_link_check_status_quiet(prog)) { + fprintf(stderr, + "Failed to link with uniform block vec4 " + "v[%d]\n", vec4s); + return PIGLIT_FAIL; + } + } + + size = vec4s * 4 * sizeof(float); + glGenBuffers(1, &bo); + glBindBuffer(GL_UNIFORM_BUFFER, bo); + glBufferData(GL_UNIFORM_BUFFER, size, NULL, GL_DYNAMIC_DRAW); + data = glMapBuffer(GL_UNIFORM_BUFFER, GL_READ_WRITE); + memset(data, 0, size); + + data[(vec4s - 1) * 4 + 0] = 0.0; + data[(vec4s - 1) * 4 + 1] = 1.0; + data[(vec4s - 1) * 4 + 2] = 0.0; + data[(vec4s - 1) * 4 + 3] = 0.0; + + glUseProgram(prog); + i_location = glGetUniformLocation(prog, "i"); + glUniform1i(i_location, vec4s - 1); + + glUniformBlockBinding(prog, 0, 0); + glBindBufferBase(GL_UNIFORM_BUFFER, 0, bo); + piglit_draw_rect(-1, -1, 2, 2); + + pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green); + + glDeleteProgram(prog); + + piglit_present_results(); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + + +void +piglit_init(int argc, char **argv) +{ + if (argc < 2) + usage(argv[0]); + + if (strcmp(argv[1], "vs") == 0) + mode = VS; + else if (strcmp(argv[1], "vsexceed") == 0) + mode = VS_EXCEED; + else if (strcmp(argv[1], "fs") == 0) + mode = FS; + else if (strcmp(argv[1], "fsexceed") == 0) + mode = FS_EXCEED; + else + usage(argv[0]); +} diff --git a/tests/spec/ext_texture_array/CMakeLists.gl.txt b/tests/spec/ext_texture_array/CMakeLists.gl.txt index 0bf4a7db..5b109622 100644 --- a/tests/spec/ext_texture_array/CMakeLists.gl.txt +++ b/tests/spec/ext_texture_array/CMakeLists.gl.txt @@ -10,3 +10,4 @@ link_libraries ( ) piglit_add_executable (ext_texture_array-maxlayers maxlayers.c) +piglit_add_executable (ext_texture_array-compressed compressed.c) diff --git a/tests/spec/ext_texture_array/CMakeLists.gles3.txt b/tests/spec/ext_texture_array/CMakeLists.gles3.txt new file mode 100644 index 00000000..2e4da1bc --- /dev/null +++ b/tests/spec/ext_texture_array/CMakeLists.gles3.txt @@ -0,0 +1,8 @@ +link_libraries( + piglitutil_${piglit_target_api} + ${OPENGL_gles2_LIBRARY} + ) + +piglit_add_executable (ext_texture_array-compressed_${piglit_target_api} compressed.c) + +# vim: ft=cmake: diff --git a/tests/spec/ext_texture_array/compressed.c b/tests/spec/ext_texture_array/compressed.c new file mode 100644 index 00000000..7739f1e8 --- /dev/null +++ b/tests/spec/ext_texture_array/compressed.c @@ -0,0 +1,307 @@ +/* + * Copyright © 2012 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 compressed.c + * + * Confirm that the functions glCompressedTexImage3D and + * glCompressedTexSubImage3D work properly for 2D array textures. + * + * This test performs the following operations: + * + * - Create a 2D array texture with a width of 8 texture blocks, a + * height of 8 texture blocks, and a depth of 4. + * + * - If the test is operating in "teximage" mode, use a single call to + * glCompressedTexImage3D to upload a single array texture where + * each compressed block has a different grayscale value. + * + * - If the test is operating in "texsubimage" mode, use multiple + * calls to glCompressedTexSubImage3D to upload the texture in + * pieces. + * + * - Draw each layer of the texture to a separate region on the + * screen. + * + * - Verify that each portion of the drawn image matches the expected + * grayscale intensity. + * + * On GLES3, this test is performed using either ETC2 textures. On + * desktop GL, it is performed using S3TC textures. + */ + +#include "piglit-util-gl-common.h" +#include "piglit-util-compressed-grays.h" + +#ifdef PIGLIT_USE_OPENGL +#define GRAYSCALE_BLOCKS piglit_s3tc_grayscale_blocks +#define COMPRESSED_FORMAT GL_COMPRESSED_RGB_S3TC_DXT1_EXT +#define BLOCK_WIDTH 4 +#define BLOCK_HEIGHT 4 +#define BLOCK_BYTES 8 +#else // PIGLIT_USE_OPENGL_ES3 +#define GRAYSCALE_BLOCKS piglit_etc1_grayscale_blocks +#define COMPRESSED_FORMAT GL_COMPRESSED_RGB8_ETC2 +#define BLOCK_WIDTH 4 +#define BLOCK_HEIGHT 4 +#define BLOCK_BYTES 8 +#endif + +PIGLIT_GL_TEST_CONFIG_BEGIN + +#ifdef PIGLIT_USE_OPENGL + config.supports_gl_compat_version = 10; +#else // PIGLIT_USE_OPENGL_ES3 + config.supports_gl_es_version = 30; +#endif + + if (config.window_width < 4 * 8 * BLOCK_WIDTH) + config.window_width = 4 * 8 * BLOCK_WIDTH; + if (config.window_height < 8 * BLOCK_HEIGHT) + config.window_height = 8 * BLOCK_HEIGHT; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char vs_text[] = +#ifdef PIGLIT_USE_OPENGL + "#version 120\n" + "#define piglit_Vertex gl_Vertex\n" + "#define piglit_MultiTexCoord0 gl_MultiTexCoord0\n" + "#define piglit_in attribute\n" + "#define piglit_out varying\n" +#else // PIGLIT_USE_OPENGL_ES3 + "#version 300 es\n" + "#define piglit_in in\n" + "#define piglit_out out\n" + "piglit_in vec4 piglit_Vertex;\n" + "piglit_in vec4 piglit_MultiTexCoord0;\n" +#endif + "piglit_out vec3 texcoord;\n" + "uniform mat4 proj;\n" + "uniform int layer;\n" + "void main()\n" + "{\n" + " gl_Position = proj * piglit_Vertex;\n" + " texcoord = vec3(piglit_MultiTexCoord0.xy, float(layer));\n" + "}\n"; + +static const char fs_text[] = +#ifdef PIGLIT_USE_OPENGL + "#version 120\n" + "#extension GL_EXT_texture_array : require\n" + "#define piglit_FragColor gl_FragColor\n" + "#define piglit_in varying\n" + "#define piglit_texture2DArray texture2DArray\n" +#else // PIGLIT_USE_OPENGL_ES3 + "#version 300 es\n" + "#define piglit_in in\n" + "#define piglit_texture2DArray texture\n" + "out vec4 piglit_FragColor;\n" +#endif + "piglit_in vec3 texcoord;\n" + "uniform sampler2DArray samp;\n" + "void main()\n" + "{\n" + " piglit_FragColor = piglit_texture2DArray(samp, texcoord);\n" + "}\n"; + +static bool test_texsubimage; +static GLuint tex; +static GLuint prog; +static GLint proj_loc; +static GLint layer_loc; +static unsigned expected_gray_levels[8][8][4]; /* x, y, z */ + + +static void +print_usage_and_exit(const char *prog_name) +{ + printf("Usage: %s <test_mode>\n" + " where <test_mode> is one of the following:\n" + " teximage: test glCompressedTexImage3D\n" + " texsubimage: test glCompressedTexSubImage3D\n", + prog_name); + piglit_report_result(PIGLIT_FAIL); +} + + +static void +compute_expected_gray_levels(unsigned width, unsigned height, unsigned depth, + unsigned xoffset, unsigned yoffset, + unsigned zoffset, unsigned gray_level) +{ + unsigned x, y, z; + for (z = 0; z < depth; z++) { + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + expected_gray_levels + [x + xoffset] + [y + yoffset] + [z + zoffset] + = gray_level++; + } + } + } +} + + +void +piglit_init(int argc, char **argv) +{ + /* Parse args */ + if (argc != 2) + print_usage_and_exit(argv[0]); + if (strcmp(argv[1], "teximage") == 0) + test_texsubimage = false; + else if (strcmp(argv[1], "texsubimage") == 0) + test_texsubimage = true; + else + print_usage_and_exit(argv[0]); + + /* Make sure required GL features are present */ +#ifdef PIGLIT_USE_OPENGL + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_texture_compression"); + piglit_require_extension("GL_EXT_texture_compression_s3tc"); +#endif + + /* We're using texture unit 0 for this entire test */ + glActiveTexture(GL_TEXTURE0); + + /* Create the texture */ + glGenTextures(1, &tex); + glBindTexture(GL_TEXTURE_2D_ARRAY, tex); + glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, 0); + glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + /* Upload the image */ + if (!test_texsubimage) { + glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, + COMPRESSED_FORMAT, + 8 * BLOCK_WIDTH, + 8 * BLOCK_HEIGHT, + 4, + 0 /* border */, + 256 * BLOCK_BYTES, + GRAYSCALE_BLOCKS); + compute_expected_gray_levels(8, 8, 4, 0, 0, 0, 0); + } else { + unsigned xoffset, yoffset, zoffset; + unsigned gray_level = 0; + glCompressedTexImage3D(GL_TEXTURE_2D_ARRAY, 0, + COMPRESSED_FORMAT, + 8 * BLOCK_WIDTH, + 8 * BLOCK_HEIGHT, + 4, + 0 /* border */, + 8 * 8 * 4 * BLOCK_BYTES, + NULL); + for (xoffset = 0; xoffset < 8; xoffset += 4) { + for (yoffset = 0; yoffset < 8; yoffset += 4) { + for (zoffset = 0; zoffset < 4; zoffset += 2) { + glCompressedTexSubImage3D( + GL_TEXTURE_2D_ARRAY, 0, + xoffset * BLOCK_WIDTH, + yoffset * BLOCK_HEIGHT, + zoffset, + 4 * BLOCK_WIDTH, + 4 * BLOCK_HEIGHT, + 2, + COMPRESSED_FORMAT, + 4 * 4 * 2 * BLOCK_BYTES, + GRAYSCALE_BLOCKS[gray_level]); + compute_expected_gray_levels( + 4, 4, 2, + xoffset, yoffset, zoffset, + gray_level); + gray_level += 4 * 4 * 2; + } + } + } + } + + /* Create the shaders */ + prog = glCreateProgram(); + glAttachShader(prog, piglit_compile_shader_text(GL_VERTEX_SHADER, + vs_text)); + glAttachShader(prog, piglit_compile_shader_text(GL_FRAGMENT_SHADER, + fs_text)); + glBindAttribLocation(prog, PIGLIT_ATTRIB_POS, "piglit_Vertex"); + glBindAttribLocation(prog, PIGLIT_ATTRIB_TEX, "piglit_MultiTexCoord0"); + glLinkProgram(prog); + if (!piglit_link_check_status(prog)) + piglit_report_result(PIGLIT_FAIL); + proj_loc = glGetUniformLocation(prog, "proj"); + layer_loc = glGetUniformLocation(prog, "layer"); + if (!piglit_check_gl_error(GL_NO_ERROR)) + piglit_report_result(PIGLIT_FAIL); +} + + +bool +check_result(unsigned x, unsigned y, unsigned z) +{ + float f = expected_gray_levels[x][y][z] / 255.0; + float expected[] = { f, f, f, 1.0 }; + return piglit_probe_rect_rgba((z * 8 + x) * BLOCK_WIDTH, + y * BLOCK_HEIGHT, + BLOCK_WIDTH, + BLOCK_HEIGHT, + expected); +} + + +enum piglit_result +piglit_display(void) +{ + unsigned x, y, z; + bool pass = true; + + /* Draw each texture level */ + glClear(GL_COLOR_BUFFER_BIT); + glUseProgram(prog); + piglit_ortho_uniform(proj_loc, piglit_width, piglit_height); + for (z = 0; z < 4; z++) { + glUniform1i(layer_loc, z); + piglit_draw_rect_tex(z * 8 * BLOCK_WIDTH, 0, + 8 * BLOCK_WIDTH, 8 * BLOCK_HEIGHT, + 0, 0, 1, 1); + } + if (!piglit_check_gl_error(GL_NO_ERROR)) + pass = false; + + /* Check results */ + for (z = 0; z < 4; z++) { + for (y = 0; y < 8; y++) { + for (x = 0; x < 8; x++) { + pass = check_result(x, y, z) && pass; + } + } + } + + piglit_present_results(); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} diff --git a/tests/spec/gl-3.0/api/bindfragdata-link-error.c b/tests/spec/gl-3.0/api/bindfragdata-link-error.c index b074bd7a..52ee78e9 100644 --- a/tests/spec/gl-3.0/api/bindfragdata-link-error.c +++ b/tests/spec/gl-3.0/api/bindfragdata-link-error.c @@ -130,7 +130,7 @@ void piglit_init(int argc, char **argv) if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); - if (piglit_link_check_status(prog)) { + if (piglit_link_check_status_quiet(prog)) { fprintf(stderr, "Linking was successful when it should have failed.\n"); piglit_report_result(PIGLIT_FAIL); @@ -161,7 +161,7 @@ void piglit_init(int argc, char **argv) if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); - if (piglit_link_check_status(prog)) { + if (piglit_link_check_status_quiet(prog)) { fprintf(stderr, "Linking was successful when it should have failed.\n"); piglit_report_result(PIGLIT_FAIL); @@ -180,7 +180,7 @@ void piglit_init(int argc, char **argv) if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); - if (piglit_link_check_status(prog)) { + if (piglit_link_check_status_quiet(prog)) { fprintf(stderr, "Linking was successful when it should have failed.\n"); piglit_report_result(PIGLIT_FAIL); diff --git a/tests/spec/gles-2.0/CMakeLists.gles2.txt b/tests/spec/gles-2.0/CMakeLists.gles2.txt index 4d06a02a..cf91a71b 100644 --- a/tests/spec/gles-2.0/CMakeLists.gles2.txt +++ b/tests/spec/gles-2.0/CMakeLists.gles2.txt @@ -2,6 +2,7 @@ link_libraries( piglitutil_${piglit_target_api} ) -piglit_add_executable(gles2-invalid-es3-queries invalid-es3-queries.c) +piglit_add_executable(invalid-es3-queries_gles2 invalid-es3-queries.c) +piglit_add_executable(minmax_gles2 minmax.c) # vim: ft=cmake: diff --git a/tests/spec/gles-2.0/minmax.c b/tests/spec/gles-2.0/minmax.c new file mode 100644 index 00000000..72b8bf25 --- /dev/null +++ b/tests/spec/gles-2.0/minmax.c @@ -0,0 +1,78 @@ +/* Copyright © 2013 Linaro + * + * 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" +#include "minmax-test.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_es_version = 20; + +PIGLIT_GL_TEST_CONFIG_END + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + /* Taken from es_full_spec_2.0.25, Chapture 6.2 + * If the value's type is listed as Z in a spec table, then consider + * its type to be a signed int (that is, GLint). If the + * value's type is listed as Z^+, then consider its type to be + * unsigned (that is, GLuint). + */ + + piglit_print_minmax_header(); + + /* Table 6.18 */ + piglit_test_min_uint(GL_SUBPIXEL_BITS, 4); + piglit_test_min_uint(GL_MAX_TEXTURE_SIZE, 64); + piglit_test_min_uint(GL_MAX_CUBE_MAP_TEXTURE_SIZE, 16); + piglit_test_min_viewport_dimensions(); + piglit_test_range_float(GL_ALIASED_POINT_SIZE_RANGE, 1, 1); + piglit_test_range_float(GL_ALIASED_LINE_WIDTH_RANGE, 1, 1); + piglit_test_min_uint(GL_SAMPLE_BUFFERS, 0); + piglit_test_min_uint(GL_SAMPLES, 0); + piglit_test_min_int(GL_NUM_COMPRESSED_TEXTURE_FORMATS, 0); + + /* Table 6.19 */ + piglit_test_min_int(GL_NUM_SHADER_BINARY_FORMATS, 0); + + /* Table 6.20 */ + piglit_test_min_uint(GL_MAX_VERTEX_ATTRIBS, 8); + piglit_test_min_uint(GL_MAX_VERTEX_UNIFORM_VECTORS, 128); + piglit_test_min_uint(GL_MAX_VARYING_VECTORS, 8); + piglit_test_min_uint(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 8); + piglit_test_min_uint(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0); + piglit_test_min_uint(GL_MAX_TEXTURE_IMAGE_UNITS, 8); + piglit_test_min_uint(GL_MAX_FRAGMENT_UNIFORM_VECTORS, 16); + piglit_test_min_uint(GL_MAX_RENDERBUFFER_SIZE, 1); + + if (!piglit_check_gl_error(GL_NO_ERROR)) + piglit_report_result(PIGLIT_FAIL); + + piglit_report_result(piglit_minmax_pass ? PIGLIT_PASS : PIGLIT_FAIL); +} diff --git a/tests/spec/glsl-es-1.00/execution/sanity.shader_test b/tests/spec/glsl-es-1.00/execution/sanity.shader_test new file mode 100644 index 00000000..a1dc07a0 --- /dev/null +++ b/tests/spec/glsl-es-1.00/execution/sanity.shader_test @@ -0,0 +1,42 @@ +# Fill the window with red, then green, then blue. + +[require] +GL >= 2.0 es + +[vertex shader] +#version 100 + +attribute vec4 vertex; + +void main() { + gl_Position = vertex; +} + +[fragment shader] +#version 100 + +uniform vec4 u_color; + +void main() { + gl_FragColor = u_color; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform vec4 u_color 1.0 0.0 0.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 1.0 0.0 0.0 1.0 + +uniform vec4 u_color 0.0 1.0 0.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 + +uniform vec4 u_color 0.0 0.0 1.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 0.0 1.0 1.0 |