本文整理汇总了C++中piglit_present_results函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_present_results函数的具体用法?C++ piglit_present_results怎么用?C++ piglit_present_results使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了piglit_present_results函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
GLfloat *v;
int i;
GLuint q, num_prims;
glClear(GL_COLOR_BUFFER_BIT);
glGenQueries(1, &q);
glBeginQuery(GL_PRIMITIVES_GENERATED_EXT, q);
glBeginTransformFeedback(GL_POINTS);
glBindBuffer(GL_ARRAY_BUFFER, vert_buf);
glVertexPointer(3, GL_FLOAT, 0, 0);
glEnable(GL_VERTEX_ARRAY);
glDrawArrays(GL_POINTS, 0, 3);
glEndTransformFeedback();
glEndQuery(GL_PRIMITIVES_GENERATED);
glGetQueryObjectuiv(q, GL_QUERY_RESULT, &num_prims);
glDeleteQueries(1, &q);
printf("%u primitives generated:\n", num_prims);
if (num_prims != NUM_VERTS) {
printf("Incorrect number of prims generated.\n");
printf("Found %u, expected %u\n", num_prims, NUM_VERTS);
pass = false;
}
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, xfb_buf);
v = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, GL_READ_ONLY);
for (i = 0; i < num_prims; i++) {
printf("vertex %2d: pos %5.2g, %5.2g, %5.2g, %5.2g "
"color %5.2g, %5.2g, %5.2g, %5.2g\n", i,
v[i*8+0], v[i*8+1], v[i*8+2], v[i*8+3],
v[i*8+4], v[i*8+5], v[i*8+6], v[i*8+7]);
/* spot-check results */
if (!equal(v[i*8+1], 0.1)) {
printf("Incorrect Y coord for point %d: %f\n",
i, v[i*8+1]);
pass = false;
}
if (!equal(v[i*8+4], 0.9)) {
printf("Incorrect red value for point %d: %f\n",
i, v[i*8+4]);
pass = false;
}
}
glUnmapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER_EXT);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例2: piglit_display
enum piglit_result
piglit_display()
{
enum piglit_result result = test->run() ? PIGLIT_PASS : PIGLIT_FAIL;
piglit_present_results();
return result;
}
示例3: piglit_display
enum piglit_result
piglit_display(void)
{
enum piglit_result ret = do_query(queries, ARRAY_SIZE(queries));
#ifdef DISPLAY
piglit_present_results();
#endif
return ret;
}
示例4: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
static const char *vs_source =
"#version 140\n"
"in vec4 piglit_vertex;\n"
"void main()\n"
"{\n"
" gl_Position = piglit_vertex;\n"
"}\n";
static const char *fs_source =
"#version 140\n"
"uniform samplerBuffer s;\n"
"void main()\n"
"{\n"
" gl_FragColor = texelFetch(s, 0);\n"
"}\n";
bool pass = true;
GLuint tex, bo;
GLuint prog;
float green[] = {0, 1, 0, 0};
float blue[] = {0, 0, 1, 0};
uint8_t g_rgba8[] = {0x00, 0xff, 0x00, 0x00};
uint8_t b_rgba8[] = {0x00, 0x00, 0xff, 0x00};
prog = piglit_build_simple_program(vs_source, fs_source);
glUseProgram(prog);
glGenBuffers(1, &bo);
glBindBuffer(GL_TEXTURE_BUFFER, bo);
glBufferData(GL_TEXTURE_BUFFER, sizeof(g_rgba8), g_rgba8,
GL_STREAM_DRAW);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_BUFFER, tex);
glTexBuffer(GL_TEXTURE_BUFFER, GL_RGBA8, bo);
piglit_draw_rect(-1, -1, 1, 2);
glBufferData(GL_TEXTURE_BUFFER, sizeof(b_rgba8), b_rgba8,
GL_STREAM_DRAW);
piglit_draw_rect(0, -1, 1, 2);
pass = pass && piglit_probe_rect_rgba(0, 0,
piglit_width / 2, piglit_height,
green);
pass = pass && piglit_probe_rect_rgba(piglit_width / 2, 0,
piglit_width / 2, piglit_height,
blue);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例5: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
GLint max_vs, max_fs, max_combined;
piglit_require_extension("GL_ARB_uniform_buffer_object");
glGetIntegerv(GL_MAX_VERTEX_UNIFORM_BLOCKS, &max_vs);
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_BLOCKS, &max_fs);
glGetIntegerv(GL_MAX_COMBINED_UNIFORM_BLOCKS, &max_combined);
printf("Max VS uniform blocks: %d\n", max_vs);
printf("Max FS uniform blocks: %d\n", max_fs);
printf("Max combined uniform blocks: %d\n", max_combined);
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
pass = fail_link_test("vs", max_vs + 1,
"vs", 0) && pass;
pass = fail_link_test("fs", 0,
"fs", max_fs + 1) && pass;
if (max_vs + max_fs > max_combined) {
pass = fail_link_test("vs",
max_vs,
"fs",
max_combined + 1 - max_vs) && pass;
pass = fail_link_test("shared",
max_vs,
"shared",
max_combined + 1 - max_vs) && pass;
}
pass = pass_link_test(0,
"vs", max_vs,
"vs", 0) && pass;
pass = pass_link_test(1,
"fs", 0,
"fs", max_fs) && pass;
pass = pass_link_test(2,
"vs", max_vs,
"fs", MIN2(max_fs,
max_combined - max_vs)) && pass;
pass = pass_link_test(3,
"shared", max_vs,
"shared", MIN2(max_fs,
max_combined - max_vs)) && pass;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例6: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0.0, 0.0};
static float green[] = {0.0, 1.0, 0.0, 0.0};
static float blue[] = {0.0, 0.0, 1.0, 0.0};
float *pixels;
GLuint pbo, tex;
glClearColor(0.5, 0.5, 0.5, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glGenBuffersARB(1, &pbo);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, pbo);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER, 4 * 4 * sizeof(float),
NULL, GL_STREAM_DRAW_ARB);
pixels = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY_ARB);
memcpy(pixels + 0, red, sizeof(red));
memcpy(pixels + 4, green, sizeof(green));
memcpy(pixels + 8, blue, sizeof(blue));
memcpy(pixels + 12, red, sizeof(red));
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0,
GL_RGBA,
2, 2, 0,
GL_RGBA, GL_FLOAT, 0);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
glDeleteBuffersARB(1, &pbo);
glEnable(GL_TEXTURE_2D);
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(0.0, 0.0); glVertex2f(10, 10);
glTexCoord2f(1.0, 0.0); glVertex2f(20, 10);
glTexCoord2f(1.0, 1.0); glVertex2f(20, 20);
glTexCoord2f(0.0, 1.0); glVertex2f(10, 20);
glEnd();
glDeleteTextures(1, &tex);
pass &= piglit_probe_pixel_rgb(12, 12, red);
pass &= piglit_probe_pixel_rgb(18, 12, green);
pass &= piglit_probe_pixel_rgb(12, 18, blue);
pass &= piglit_probe_pixel_rgb(18, 18, red);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例7: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
static float red[] = {1.0, 0.0, 0.0, 0.0};
static float green[] = {0.0, 1.0, 0.0, 0.0};
static float blue[] = {0.0, 0.0, 1.0, 0.0};
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
glClearColor(0.5, 0.0, 0.0, 0.0);
glColor4fv(red);
/* Make a list containing a clear and a rectangle. It'll draw
* colors we don't expect to see, due to COMPILE_AND_EXECUTE.
*/
glNewList(1, GL_COMPILE_AND_EXECUTE);
/* Even though we don't use depth, GL_DEPTH_BUFFER_BIT is what
* triggered the metaops clear path which messed up the display list.
*/
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_QUADS);
glVertex2f(10, 10);
glVertex2f(20, 10);
glVertex2f(20, 20);
glVertex2f(10, 20);
glEnd();
glEndList();
/* Now, set up our expected colors, translate the dlist's rectangle
* over a little, and do the draw we actually expect to see.
*/
glClearColor(0.0, 1.0, 0.0, 0.0);
glColor4fv(blue);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(20, 0, 0);
glCallList(1);
pass &= piglit_probe_rect_rgb(0, 0, piglit_width, 10, green);
pass &= piglit_probe_rect_rgb(0, 10, 30, 10, green);
pass &= piglit_probe_rect_rgb(30, 10, 10, 10, blue);
pass &= piglit_probe_rect_rgb(40, 10, piglit_width-40, 10, green);
pass &= piglit_probe_rect_rgb(0, 20, piglit_width, piglit_height - 20,
green);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例8: piglit_display
enum piglit_result
piglit_display(void)
{
int x0 = piglit_width * 1 / 4;
int x1 = piglit_width * 3 / 4;
int y0 = piglit_height * 1 / 4;
int y1 = piglit_height * 3 / 4;
GLboolean pass = GL_TRUE;
glClear(GL_COLOR_BUFFER_BIT);
glFrontFace(GL_CCW); /* the default winding */
glBegin(GL_QUADS);
/* counter-clockwise / front-facing */
glNormal3f(0, 0, 1);
glVertex2f(-1.0, -1.0);
glVertex2f( 0.0, -1.0);
glVertex2f( 0.0, 0.0);
glVertex2f(-1.0, 0.0);
/* clockwise / back-facing */
glNormal3f(0, 0, -1);
glVertex2f( 0.0, -1.0);
glVertex2f( 0.0, 0.0);
glVertex2f( 1.0, 0.0);
glVertex2f( 1.0, -1.0);
glEnd();
glFrontFace(GL_CW); /* reverse winding */
glBegin(GL_QUADS);
/* counter-clockwise / back-facing */
glNormal3f(0, 0, -1);
glVertex2f(-1.0, 0.0);
glVertex2f( 0.0, 0.0);
glVertex2f( 0.0, 1.0);
glVertex2f(-1.0, 1.0);
/* clockwise / front-facing */
glNormal3f(0, 0, 1);
glVertex2f( 0.0, 0.0);
glVertex2f( 0.0, 1.0);
glVertex2f( 1.0, 1.0);
glVertex2f( 1.0, 0.0);
glEnd();
pass = piglit_probe_pixel_rgb(x0, y0, green) && pass;
pass = piglit_probe_pixel_rgb(x1, y0, blue) && pass;
pass = piglit_probe_pixel_rgb(x0, y1, blue) && pass;
pass = piglit_probe_pixel_rgb(x1, y1, green) && pass;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例9: piglit_display
enum piglit_result
piglit_display(void)
{
GLuint vs, fs;
bool pass = true;
GLuint prog;
float green[] = {0.0, 1.0, 0.0, 0.0};
GLint status;
/* Initial buffer clear. */
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
prog = piglit_link_simple_program(vs, fs);
if (!vs || !fs || !prog)
piglit_report_result(PIGLIT_FAIL);
piglit_DeleteShader(vs);
piglit_DeleteShader(fs);
piglit_UseProgram(prog);
piglit_DeleteProgram(prog);
/* Try to blow out the refcount */
piglit_DeleteProgram(prog);
piglit_DeleteProgram(prog);
piglit_DeleteProgram(prog);
/* Sanity check: deleting didn't already unbind our shader program. */
piglit_draw_rect(-1, -1, 2, 2);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
green) && pass;
/* The program should still report being deleted. */
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
if (!piglit_check_gl_error(0))
piglit_report_result(PIGLIT_FAIL);
if (status != GL_TRUE) {
fprintf(stderr,
"GL_DELETE_STATUS after a clear reported non-true %d\n",
status);
pass = false;
}
/* Now, disable the program and it should be finally deleted. */
piglit_UseProgram(0);
piglit_GetProgramiv(prog, GL_DELETE_STATUS, &status);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例10: piglit_display
enum piglit_result
piglit_display(void)
{
int x, y;
bool pass = true;
float expected[64 * 64 * 4];
glClearColor(0.0, 1.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
for (x = 0; x < 8; x++) {
for (y = 0; y < 8; y++) {
piglit_Uniform2i(coord1_location, x * 9, y * 9);
piglit_Uniform2i(coord2_location, x * 9, y * 9);
piglit_draw_rect(-1.0 + 0.25 * x,
-1.0 + 0.25 * y,
0.25,
0.25);
}
}
for (x = 0; x < 64; x++) {
for (y = 0; y < 64; y++) {
int sx = x % 8;
int sy = y % 8;
int dx = fabs(sx - x / 8);
int dy = fabs(sy - y / 8);
float pixel[4];
if (dx == 0 && dy == 0) {
pixel[0] = 0.0;
pixel[1] = 1.0;
pixel[2] = 0.0;
pixel[3] = 0.0;
} else {
int i;
pixel[0] = 0.0;
pixel[1] = 0.0;
pixel[2] = 0.0;
pixel[3] = 0.0;
for (i = 0; i < 10; i += (dx + dy))
pixel[2] += 0.1;
}
memcpy(expected + (y * 64 + x) * 4, pixel, 4 * 4);
}
}
pass = piglit_probe_image_rgba(0, 0, 64, 64, expected);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例11: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
const float clearColor[3] = { 1, 1, 0 };
/* Clear Defualt Framebuffer */
glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
glClearColor(1,1,0,1);
glClear(GL_COLOR_BUFFER_BIT);
/* Clear texture[0] with glClear() */
glBindFramebuffer(GL_FRAMEBUFFER, fbo[0]);
glClearColor(clearColor[0], clearColor[1], clearColor[2], 1);
glClear(GL_COLOR_BUFFER_BIT);
/* Clear texture[1] with glClearBuffer() */
glBindFramebuffer(GL_FRAMEBUFFER, fbo[1]);
glClearBufferfv(GL_COLOR, 0, clearColor);
/* Display glClear texture */
if(!display_layered_texture(0, 0, piglit_width/2, piglit_height,
piglit_width, piglit_height, GL_TEXTURE_2D_ARRAY,
texture[0], layers)) {
printf("Failed to display layered texture for glClear\n");
pass = false;
}
/* Display glClearBuffer texture */
if(!display_layered_texture(piglit_width/2, 0, piglit_width/2,
piglit_height, piglit_width, piglit_height,
GL_TEXTURE_2D_ARRAY, texture[1], layers)) {
printf("Failed to display layered texture for glClearBuffer\n");
pass = false;
}
/* Check for passing conditions for glClear*/
if(!piglit_probe_rect_rgb(0, 0, piglit_width/2, piglit_height,
clearColor)) {
printf("Incorrect probe value for glClear test.\n");
pass = false;
}
/* Check for passing conditions for glClearBuffer*/
if(!piglit_probe_rect_rgb(piglit_width/2, 0, piglit_width/2,
piglit_height, clearColor)) {
printf("Incorrect probe value for glClearBuffer test.\n");
pass = false;
}
if(!piglit_check_gl_error(GL_NO_ERROR))
pass = false;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例12: piglit_display
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
int x, y;
GLuint fb, tex;
/* Draw the shader to the fbo. */
fb = create_fbo(WIDTH, HEIGHT, &tex);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glUseProgram(prog);
piglit_draw_rect(-1, -1, 2, 2);
/* Draw the FBO to the screen. */
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glViewport(0, 0, piglit_width, piglit_height);
glClearColor(0.0, 0.0, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, tex);
glEnable(GL_TEXTURE_2D);
glUseProgram(0);
piglit_draw_rect_tex(-1, -1, 2, 2,
0, 0, 1, 1);
glDisable(GL_TEXTURE_2D);
glDeleteTextures(1, &tex);
glDeleteFramebuffersEXT(1, &fb);
assert(glGetError() == 0);
for (y = 0; y < piglit_height; y++) {
for (x = 0; x < piglit_width; x++) {
float color[3];
color[0] = x / 256.0;
color[1] = y / 256.0;
color[2] = 0;
pass &= piglit_probe_pixel_rgb(x, y, color);
if (!pass)
break;
}
}
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例13: piglit_display
enum piglit_result
piglit_display(void)
{
bool pass = true;
float red[4] = {1.0, 0.0, 0.0, 0.0};
float green[4] = {0.0, 1.0, 0.0, 0.0};
GLuint q, texture;
glClearColor(0.5, 0.5, 0.5, 0.5);
glClear(GL_COLOR_BUFFER_BIT);
/* Draw bottom half of window to green. */
glColor4fv(green);
piglit_draw_rect(-1, -1, 2, 1);
glColor4f(1, 1, 1, 1);
/* Set up a red texture. */
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
fill_tex(0, piglit_width, piglit_height / 2, red);
glGenQueries(1, &q);
/* Generate query fail. */
glBeginQuery(GL_SAMPLES_PASSED, q);
glEndQuery(GL_SAMPLES_PASSED);
/* This should not be affected by conditional rendering. */
glBeginConditionalRenderNV(q, GL_QUERY_WAIT_NV);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, piglit_width, piglit_height / 2, 0);
glEndConditionalRenderNV();
/* Draw the texture. */
glEnable(GL_TEXTURE_2D);
piglit_draw_rect_tex(-1, 0, 2, 1,
0, 0, 1, 1);
glDisable(GL_TEXTURE_2D);
pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
green);
piglit_present_results();
glDeleteQueries(1, &q);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例14: piglit_display
enum piglit_result
piglit_display(void)
{
static const float black[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
bool pass = true;
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearDepth(0.0f);
glClearStencil(0);
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo_copy);
/* This blit is there on purpose to trigger a bug in stencil decompress
* on Radeon. The blit destination is not used.
*/
glBlitFramebuffer(0, 0, TEX_WIDTH, TEX_WIDTH, 0, 0, TEX_WIDTH, TEX_WIDTH, GL_STENCIL_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glEnable(GL_STENCIL_TEST);
glStencilMask(255);
glStencilFunc(GL_LEQUAL, 1, 255);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glColor4f(1.0, 1.0, 1.0, 1.0);
glBegin(GL_TRIANGLE_FAN);
glVertex3f( 0.0174f, -0.00413f, 1.0f);
glVertex3f(-1.0f, -1.0f, 1.0f);
glVertex3f( 1.0f, -1.0f, -1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, -1.0f);
glVertex3f(-1.0f, -1.0f, -1.0f);
glEnd();
glDisable(GL_STENCIL_TEST);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
glClearColor(1.0, 0.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glBlitFramebuffer(0, 0, TEX_WIDTH, TEX_HEIGHT, 0, 0, TEX_WIDTH, TEX_HEIGHT,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
pass = piglit_probe_rect_rgb(0, 0, TEX_WIDTH, TEX_HEIGHT, black) && pass;
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
示例15: piglit_display
PIGLIT_GL_TEST_CONFIG_END
enum piglit_result
piglit_display(void)
{
GLboolean pass = GL_TRUE;
GLuint tex, fb;
GLenum status;
float green[] = {0, 1, 0, 0};
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
piglit_width, piglit_height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glGenFramebuffersEXT(1, &fb);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
tex,
0);
assert(glGetError() == 0);
status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
fprintf(stderr, "fbo incomplete (status = 0x%04x)\n", status);
piglit_report_result(PIGLIT_SKIP);
}
glClearColor(1.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_NEVER);
glColor4fv(green);
piglit_draw_rect(0, 0, piglit_width, piglit_height);
pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green);
glDisable(GL_DEPTH_TEST);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
piglit_draw_rect_tex(0, 0, piglit_width, piglit_height,
0, 0, 1, 1);
glDisable(GL_TEXTURE_2D);
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}