enum piglit_result piglit_display(void) { int i; bool pass = true; piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); glEnable(GL_LINE_STIPPLE); glPushMatrix(); glTranslatef(basex, basey, 0.0); for (i = 0; i < ARRAY_SIZE(Lines); ++i) { printf("Testing %s:\n", Lines[i].name); if (test_line(&Lines[i])) { piglit_report_subtest_result(PIGLIT_PASS, "%s", Lines[i].name); } else { piglit_report_subtest_result(PIGLIT_FAIL, "%s", Lines[i].name); pass = false; } } glPopMatrix(); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
/* Test subroutine uniform location query with vs, fs and gs. */ static bool test_subroutine_stages_vs_fs_gs() { GLuint prog, i; if (!piglit_is_extension_supported("GL_ARB_shader_subroutine")) { piglit_report_subtest_result(PIGLIT_SKIP, __func__); return true; } prog = piglit_build_simple_program_multiple_shaders( GL_VERTEX_SHADER, vs_subroutine_text, GL_GEOMETRY_SHADER, gs_subroutine_text, GL_FRAGMENT_SHADER, fs_subroutine_text, 0); glUseProgram(prog); /* Iterate through all valid subroutine enums passing invalid name. */ for (i = 0; i < (sizeof(valid_enums_sub)/sizeof(GLenum)); i++) { glGetProgramResourceLocation(prog, valid_enums_sub[i], "name"); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); } CHECK_SUB(VERTEX); CHECK_SUB(FRAGMENT); CHECK_SUB(GEOMETRY); piglit_report_subtest_result(PIGLIT_PASS, __func__); return true; }
enum piglit_result piglit_display(void) { bool pass = true; float buffer[2 + ARRAY_SIZE(vertex_array) + ARRAY_SIZE(color_array) + ARRAY_SIZE(texcoord_array)]; int i, j; piglit_ortho_projection(piglit_width, piglit_height, false); glClearColor(0.0, 1.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glVertexPointer(4, GL_FLOAT, 0, vertex_array); glColorPointer(4, GL_FLOAT, 0, color_array); glTexCoordPointer(4, GL_FLOAT, 0, texcoord_array); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); for (i = 0; i < ARRAY_SIZE(types); i++) { bool case_pass = true; int returned_count; printf("Testing %s\n", types[i].name); for (j = 0; j < ARRAY_SIZE(buffer); j++) buffer[j] = -1.0; glFeedbackBuffer(ARRAY_SIZE(buffer), types[i].type, buffer); glRenderMode(GL_FEEDBACK); glDrawArrays(GL_TRIANGLES, 0, 4); returned_count = glRenderMode(GL_RENDER); if (returned_count != types[i].count) { case_pass = false; } else { for (j = 0; j < types[i].count; j++) { if (fabs(buffer[j] - types[i].values[j]) > .01) case_pass = false; } } if (!case_pass) { pass = false; report_failure(&types[i], buffer, returned_count); piglit_report_subtest_result(PIGLIT_FAIL, types[i].name); } else { piglit_report_subtest_result(PIGLIT_PASS, types[i].name); } } piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
/* Test subroutine uniform location query with compute. */ static bool test_subroutine_stages_compute() { GLuint prog, i; if (!piglit_is_extension_supported("GL_ARB_shader_subroutine")) { piglit_report_subtest_result(PIGLIT_SKIP, __func__); return true; } if (!piglit_is_extension_supported("GL_ARB_compute_shader")) { piglit_report_subtest_result(PIGLIT_SKIP, __func__); return true; } prog = piglit_build_simple_program_multiple_shaders( GL_COMPUTE_SHADER, compute_subroutine_text, 0); glUseProgram(prog); /* Iterate through all valid subroutine enums passing invalid name. */ for (i = 0; i < (sizeof(valid_enums_sub_com)/sizeof(GLenum)); i++) { glGetProgramResourceLocation(prog, valid_enums_sub_com[i], "name"); if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); } CHECK_SUB(COMPUTE); piglit_report_subtest_result(PIGLIT_PASS, __func__); return true; }
bool test_exact() { int i, Bpp, channels; float *tmp_float; GLubyte *data, *observed; GLint tex_width, tex_height; bool pass = true; if (format->data_type == GL_NONE) { piglit_report_subtest_result(PIGLIT_SKIP, "Exact upload-download of %s", piglit_get_gl_enum_name(format->internal_format)); return true; } channels = num_channels(format->format); Bpp = bytes_per_pixel(format->format, format->data_type); if (format->data_type == GL_FLOAT) { /* Sanatize so we don't get invalid floating point values */ tmp_float = malloc(texture_size * texture_size * channels * sizeof(float)); for (i = 0; i < texture_size * texture_size * channels; ++i) tmp_float[i] = sn_to_float(32, ((GLint *)rand_data)[i]); data = (GLubyte *)tmp_float; } else { tmp_float = NULL; data = rand_data; } glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, format->internal_format, texture_size, texture_size, 0, format->format, format->data_type, data); pass &= piglit_check_gl_error(GL_NO_ERROR); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &tex_width); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &tex_height); glPixelStorei(GL_PACK_ALIGNMENT, 1); observed = malloc(tex_width * tex_height * Bpp); glGetTexImage(GL_TEXTURE_2D, 0, format->format, format->data_type, observed); pass &= piglit_check_gl_error(GL_NO_ERROR); for (i = 0; i < texture_size; ++i) pass &= memcmp(&data[i * texture_size * Bpp], &observed[i * tex_width * Bpp], texture_size * Bpp) == 0; free(observed); free(tmp_float); piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "Exact upload-download of %s", piglit_get_gl_enum_name(format->internal_format)); return pass; }
enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; size_t n; int layer; glViewport(0, 0, piglit_width, piglit_height); glClearColor(0.0, 0.0, 1.0, 1.0); for (n = 0; n < ARRAY_SIZE(testparams); n++) { GLboolean subtest_pass = GL_TRUE; for (layer = 0; layer < testparams[n].num_layers; layer++) { glClear(GL_COLOR_BUFFER_BIT); subtest_pass &= test_single_layer(&testparams[n], layer); } piglit_report_subtest_result(subtest_pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s", testparams[n].desc); pass &= subtest_pass; } piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
static bool test_pname(void) { GLuint name; const static GLfloat f = 1.0; const static GLuint u = 1; const static GLint i = -5; bool pass = true; /* Setup dsa. */ glCreateTextures(GL_TEXTURE_2D, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameterfv(name, GL_TEXTURE_1D, &f); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteriv(name, GL_TEXTURE_1D, &i); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameterIiv(name, GL_TEXTURE_1D, &i); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameterIuiv(name, GL_TEXTURE_1D, &u); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_ENUM on " "bad pname"); return pass; }
/* same as test_target_name, but for the getter functions */ static bool test_getter_target_name(void) { static const GLuint badname = 250; GLfloat f; GLuint u; GLint i; bool pass = true; glGetTextureParameterfv(badname, GL_TEXTURE_MAX_LEVEL, &f); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glGetTextureParameteriv(badname, GL_TEXTURE_MAX_LEVEL, &i); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glGetTextureParameterIiv(badname, GL_TEXTURE_MAX_LEVEL, &i); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glGetTextureParameterIuiv(badname, GL_TEXTURE_MAX_LEVEL, &u); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glGetTextureParameter: " "GL_INVALID_OPERATION on bad texture"); return pass; }
/* * The texture parameter must be an existing texture object as returned * by glCreateTextures */ static bool test_target_name(void) { static const GLuint badname = 250; static const GLfloat fvec[2] = { 1.0, 1.0 }; static const GLint ivec[2] = { -1, 1 }; static const GLuint uvec[2] = { 1, 1 }; bool pass = true; glTextureParameteri(badname, GL_TEXTURE_MAX_LEVEL, 4); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glTextureParameterf(badname, GL_TEXTURE_MAX_LEVEL, 4.0); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glTextureParameterfv(badname, GL_TEXTURE_MAX_LEVEL, fvec); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glTextureParameteriv(badname, GL_TEXTURE_MAX_LEVEL, ivec); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glTextureParameterIiv(badname, GL_TEXTURE_MAX_LEVEL, ivec); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glTextureParameterIuiv(badname, GL_TEXTURE_MAX_LEVEL, uvec); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_OPERATION " "on bad texture"); return pass; }
static bool check_textures_type(void) { bool check_pass = true; test_data *data = test_data_new(0, 1); unsigned i; int testing64; for (i = 0; i < ARRAY_SIZE(pnames); i++) { bool pass = true; for (testing64 = 0; testing64 <= 1; testing64++) { test_data_set_testing64(data, testing64); pass = try_textures_type(texture_targets, ARRAY_SIZE(texture_targets), valid_internalformats, ARRAY_SIZE(valid_internalformats), pnames[i], equivalent_pnames[i], data) && pass; } piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s", piglit_get_gl_enum_name(pnames[i])); check_pass = check_pass && pass; } test_data_clear(&data); return check_pass; }
/* GL_INVALID_ENUM is generated if the effective target is GL_TEXTURE_RECTANGLE * and either of pnames GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T is set to either * GL_MIRROR_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT or GL_REPEAT. */ static bool test_texture_rec(void) { bool pass = true; GLuint name; /* GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_MIRROR_CLAMP_TO_EDGE); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_MIRROR_CLAMP_TO_EDGE); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteri(name, GL_TEXTURE_WRAP_S, GL_REPEAT); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameteri(name, GL_TEXTURE_WRAP_T, GL_REPEAT); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_ENUM in " "texture_rectangle case"); return pass; }
static bool verify_contents(const struct fmt_test *test) { bool result = true; unsigned amount = piglit_width * piglit_height; void *pix = malloc(amount * 4); glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, GL_BYTE, pix); char value[4] = { 0, 0, 0, SCHAR_MAX }; value_for_format(test, value); char *p = pix; for (unsigned i = 0; i < amount; i++, p += 4) { if (memcmp(p, value, sizeof(value)) == 0) continue; fprintf(stderr, "value:\n%d % d %d %d\nexpect:\n%d %d %d %d", p[0], p[1], p[2], p[3], value[0], value[1], value[2], value[3]); piglit_report_subtest_result(PIGLIT_FAIL, "format 0x%x read fail", test->iformat); result = false; break; } free(pix); return result; }
enum piglit_result piglit_display(void) { glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glActiveTexture(GL_TEXTURE0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), vertex_data); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*) (vertex_data + (2 * sizeof(float)))); bool pass = true; const struct fmt_test *test = tests; /* Loop over each format. */ for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) { bool fmt_pass = test_format(test); piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass), "format 0x%x", test->iformat); pass &= fmt_pass; } if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); return PIGLIT_RESULT(pass); }
static bool verify_contents(const struct fmt_test *test) { bool result = true; unsigned amount = piglit_width * piglit_height; unsigned short *pix = malloc (amount * 8); glReadPixels(0, 0, piglit_width, piglit_height, GL_RGBA, test->type, pix); /* Setup expected value, alpha is always max in the test. */ unsigned short value[4] = { 0 }; value_for_format(test, value); value[3] = get_max_value(test->type); unsigned short *p = pix; for (unsigned i = 0; i < amount; i++, p += 4) { if (memcmp(p, value, sizeof(value)) == 0) continue; piglit_report_subtest_result(PIGLIT_FAIL, "format 0x%x read fail", test->iformat); result = false; break; } free(pix); return result; }
void piglit_init(int argc, char **argv) { bool test1; bool test2; test1 = run_subtest(gs_tmpl, varyings, ARRAY_SIZE(varyings)); piglit_report_subtest_result(test1 ? PIGLIT_PASS : PIGLIT_FAIL, "arb_gpu_shader5-xfb-streams"); test2 = run_subtest(gs_tmpl_blocks, varyings_blocks, ARRAY_SIZE(varyings_blocks)); piglit_report_subtest_result(test2 ? PIGLIT_PASS : PIGLIT_FAIL, "arb_gpu_shader5-xfb-streams-blocks"); piglit_report_result(test1 && test2 ? PIGLIT_PASS : PIGLIT_FAIL); }
static void validate_pipe(GLuint pipe, bool expected, const char *test_name) { GLint status; pass = piglit_check_gl_error(GL_NO_ERROR) && pass; status = piglit_program_pipeline_check_status_quiet(pipe); if (status != expected) { fprintf(stderr, "Wrong pipeline validation status. Got %d, but " "expected %d\n", status, expected); piglit_report_subtest_result(PIGLIT_FAIL, "%s", test_name); pass = false; } else { piglit_report_subtest_result(PIGLIT_PASS, "%s", test_name); } }
static bool test_copy_image(const struct fmt_test *test, GLuint src, GLuint *texture) { bool result = true; GLuint tex = create_texture(test); *texture = tex; glCopyImageSubData(src, GL_TEXTURE_2D, 0, 0, 0, 0, tex, GL_TEXTURE_2D, 0, 0, 0, 0, piglit_width, piglit_height, 0); if (!piglit_check_gl_error(GL_NO_ERROR)) { piglit_report_subtest_result(PIGLIT_FAIL, "format 0x%x copyimage fail", test->iformat); result = false; } return result; }
~incomplete_fbo_test() { if (target == GL_RENDERBUFFER) glBindRenderbuffer(target, 0); else glBindTexture(target, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo); glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo); glDeleteTextures(1, &tex); glDeleteRenderbuffers(1, &rb); glDeleteFramebuffers(1, &fbo); piglit_report_subtest_result(_pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s", name); }
/* GL_INVALID_OPERATION is generated if the effective target is * GL_TEXTURE_RECTANGLE and pname GL_TEXTURE_BASE_LEVEL is set to any value * other than zero. */ static bool test_texture_rec_texture_base(void) { bool pass = true; GLuint name; glCreateTextures(GL_TEXTURE_RECTANGLE, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_OPERATION " "for texture_rectangle+min_filter"); return pass; }
static void run_subtest(const struct subtest_t st, bool *pass) { enum piglit_result result; bool local_pass = true; int index, i = 0; if (*st.prog == -1 || !check_extensions(*st.prog, st.programInterface)) { result = PIGLIT_SKIP; goto report_result; } if (st.programInterface != GL_ATOMIC_COUNTER_BUFFER) { index = glGetProgramResourceIndex(*st.prog, st.programInterface, st.name); piglit_check_gl_error(GL_NO_ERROR); if (index < 0) { printf(" Could not find resource '%s' in program" " %u\n", st.name, *st.prog); result = PIGLIT_FAIL; goto report_result; } } else { /* As we cannot query the index of an atomic variable, let's * hardcode it to 0 and make sure the program only has ONE * atomic variable. In our case, we only use the fs_atom stage * which defines only one variable. */ index = 0; } while (st.props[i].prop != 0) { check_prop(*st.prog, st.programInterface, index, st.name, st.inputs, st.props[i], &local_pass); i++; } *pass = *pass && local_pass; result = local_pass ? PIGLIT_PASS : PIGLIT_FAIL; report_result: piglit_report_subtest_result(result, "%s on %s", st.name, piglit_get_gl_enum_name(st.programInterface)); }
enum piglit_result piglit_display(void) { glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glActiveTexture(GL_TEXTURE0); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), vertex_data); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void*) (vertex_data + (2 * sizeof(float)))); bool pass = true; struct fmt_test *test = tests; /* Toggle 'req_rend' for EXT_render_snorm compatible formats. */ if (piglit_is_extension_supported("GL_EXT_render_snorm")) { for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) { switch (test->iformat) { case GL_R16_SNORM_EXT: case GL_RG16_SNORM_EXT: case GL_RGBA16_SNORM_EXT: test->req_render = true; test->can_read = true; } } } /* Loop over each format. */ test = tests; for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) { bool fmt_pass = test_format(test); piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass), "format 0x%x", test->iformat); pass &= fmt_pass; } if (!piglit_check_gl_error(GL_NO_ERROR)) piglit_report_result(PIGLIT_FAIL); return PIGLIT_RESULT(pass); }
/* GL_INVALID_VALUE is generated if pname is GL_TEXTURE_BASE_LEVEL or * GL_TEXTURE_MAX_LEVEL, and param or params is negative. */ static bool test_texture_level_negative(void) { bool pass = true; GLuint name; glCreateTextures(GL_TEXTURE_2D, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, -1); pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; glTextureParameteri(name, GL_TEXTURE_MAX_LEVEL, -1); pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_VALUE for " "negative tex_*_level"); return pass; }
/** * Verify that attaching an invalid layer of a cube array texture results in * incompleteness. */ bool invalid_cube_array_layer(void) { static const char subtest_name[] = "invalid layer of a cube-array texture"; if (!piglit_is_extension_supported("GL_ARB_texture_cube_map_array") && piglit_get_gl_version() < 40) { piglit_report_subtest_result(PIGLIT_SKIP, "%s", subtest_name); return true; } incomplete_fbo_test t(subtest_name, GL_TEXTURE_CUBE_MAP_ARRAY); /* Create a texture with only 8 layers (0 through 7), but try to * attach layer 8 and layer 9 to the FBO. */ glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGBA, 8, 8, 8 * 6, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); return invalid_array_layer_common(t); }
enum piglit_result piglit_display(void) { static const GLenum result_types[] = { GL_INT, GL_UNSIGNED_INT, GL_UNSIGNED_INT64_ARB }; enum piglit_result r = PIGLIT_PASS; for (unsigned qnum = 0; qnum < num_query_types(); qnum++) { query_desc = &query_types[qnum]; bool supported = is_query_supported(query_desc); for (sync_mode = QBO_SYNC; sync_mode < NUM_QBO_SYNC_MODES; sync_mode++) { for (unsigned ridx = 0; ridx < ARRAY_SIZE(result_types); ++ridx) { enum piglit_result subtest_result = PIGLIT_SKIP; result_type = result_types[ridx]; if (supported) { subtest_result = run_subtest(); if (subtest_result != PIGLIT_PASS) r = subtest_result; } piglit_report_subtest_result(subtest_result, "query-%s-%s-%s", piglit_get_gl_enum_name(query_desc->type), sync_mode_names[sync_mode], piglit_get_gl_enum_name(result_type)); } } } return r; }
static bool check_filter() { bool pass = true; test_data *data = test_data_new(0, 1); int testing64; for (testing64 = 0; testing64 <= 1; testing64++) { test_data_set_testing64(data, testing64); pass = try_local(valid_targets, ARRAY_SIZE(valid_targets), valid_internalformats, ARRAY_SIZE(valid_internalformats), GL_FILTER, data) && pass; } piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s", piglit_get_gl_enum_name(GL_FILTER)); test_data_clear(&data); return pass; }
/* GL_INVALID_ENUM is generated if glTextureParamter{if} is called for a * non-scalar parameter */ static bool test_scalar_vector(void) { bool pass = true; const static GLfloat f = 1.0; const static GLint i = -1; GLuint name; /* Setup dsa. */ glCreateTextures(GL_TEXTURE_2D, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_BORDER_COLOR, i); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; glTextureParameterf(name, GL_TEXTURE_BORDER_COLOR, f); pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter{if}: GL_INVALID_ENUM " "for non-scalars"); return pass; }
/* GL_INVALID_OPERATION is generated if the effective target is either * GL_TEXTURE_2D_MULTISAMPLE or GL_TEXTURE_2D_MULTISAMPLE_ARRAY, and pname * GL_TEXTURE_BASE_LEVEL is set to a value other than zero. */ static bool test_multisample_texture_base(void) { bool pass = true; GLuint name; glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; glCreateTextures(GL_TEXTURE_2D_MULTISAMPLE_ARRAY, 1, &name); glBindTextureUnit(0, name); /* Since next command isn't bindless. */ glTextureParameteri(name, GL_TEXTURE_BASE_LEVEL, 1); pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass; piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "glTextureParameter: GL_INVALID_OPERATION " "for multisample+texture_base"); return pass; }
void piglit_init(int argc, char **argv) { struct test_info *info; enum piglit_result result = PIGLIT_PASS; int sample_count; int max_samples; if (argc != 2) usage(argc, argv); sample_count = atoi(argv[1]); glGetIntegerv(GL_MAX_SAMPLES, &max_samples); if (sample_count > max_samples) { printf("Sample count of %d not supported.\n", sample_count); piglit_report_result(PIGLIT_SKIP); } for (info = tests; info->name; info++) piglit_report_subtest_result(exec_test(info, sample_count), info->name); piglit_report_result(result); }
static bool check_textures_size(void) { bool check_pass = true; test_data *data = test_data_new(0, 1); unsigned i; int testing64; for (i = 0; i < ARRAY_SIZE(pnames); i++) { bool pass = true; if (!piglit_is_gles()) { if (pnames[i] == GL_INTERNALFORMAT_SHARED_SIZE || pnames[i] == GL_INTERNALFORMAT_STENCIL_SIZE) { continue; } } for (testing64 = 0; testing64 <= 1; testing64++) { test_data_set_testing64(data, testing64); pass = try_textures_size(texture_targets, ARRAY_SIZE(texture_targets), valid_internalformats, num_valid_internalformats, pnames[i], data) && pass; } piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, "%s", piglit_get_gl_enum_name(pnames[i])); check_pass = check_pass && pass; } test_data_clear(&data); return check_pass; }
static void check_subtest(struct subtest *t) { int limit; glGetIntegerv(t->limit, &limit); if (t->use_texture) { GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, texture); glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, limit+1, t->internalformat, 64, 64, GL_TRUE); } else { GLuint rb; glGenRenderbuffers(1, &rb); glBindRenderbuffer(GL_RENDERBUFFER, rb); glRenderbufferStorageMultisample(GL_RENDERBUFFER, limit + 1, t->internalformat, 64, 64); } piglit_report_subtest_result( piglit_check_gl_error(t->error) ? PIGLIT_PASS : PIGLIT_FAIL, "%s", t->name); }