enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; int dim; GLuint tex; int x; glClearColor(0.5, 0.5, 0.5, 0.5); glClear(GL_COLOR_BUFFER_BIT); tex = create_fbo(); x = 1; for (dim = TEX_WIDTH; dim > 1; dim /= 2) { draw_mipmap(x, 1, dim); x += dim + 1; } x = 1; for (dim = TEX_WIDTH; dim > 1; dim /= 2) { pass &= test_mipmap_drawing(x, 1, dim); x += dim + 1; } glDeleteTextures(1, &tex); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; int dim; int x, i; glClearColor(0.5, 0.5, 0.5, 0.5); glClear(GL_COLOR_BUFFER_BIT); x = 1; for (dim = TEX_WIDTH; dim > 1; dim /= 2) { draw_mipmap(x, 1, dim); x += dim + 1; } x = 1; for (i = 0, dim = TEX_WIDTH; dim > 1; dim /= 2, i++) { pass &= test_mipmap_drawing(x, 1, dim, colors[i]); x += dim + 1; } glutSwapBuffers(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
enum piglit_result piglit_display(void) { GLboolean pass = GL_TRUE; GLuint tex; glClearColor(0.5, 0.5, 0.5, 0.5); glClear(GL_COLOR_BUFFER_BIT); tex = create_fbo(); draw_mipmap(1, 1, 32); pass &= test_mipmap_drawing(1, 1, 32); glDeleteTextures(1, &tex); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
static enum piglit_result test_format(const struct format_desc *format) { int dim; GLuint tex; int x; int level; GLboolean pass = GL_TRUE; printf("Testing %s", format->name); if (clear_stencil && format->base_internal_format != GL_DEPTH_STENCIL) { printf(" - no stencil.\n"); return PIGLIT_SKIP; } tex = create_tex(format->internalformat, format->base_internal_format); if (tex == 0) { printf(" - FBO incomplete\n"); piglit_report_subtest_result(PIGLIT_SKIP, "%s (fbo incomplete)", format->name); return PIGLIT_SKIP; } printf("\n"); if (clear_stencil) { glClearStencil(0x0); glClear(GL_STENCIL_BUFFER_BIT); } glViewport(0, 0, piglit_width, piglit_height); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); x = 1; level = 0; for (dim = TEX_WIDTH; dim > 1; dim /= 2) { if (clear_stencil) draw_stencil_mipmap(x, 1, dim, tex, level); else draw_mipmap(x, 1, dim); x += dim + 1; level++; } if (clear_stencil) visualize_stencil(); x = 1; level = 0; for (dim = TEX_WIDTH; dim > 1; dim /= 2) { pass = pass && test_mipmap_drawing(x, 1, dim, level, format->internalformat); x += dim + 1; level++; } glDeleteTextures(1, &tex); piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL, format->name); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }