enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0, 1, 0, 0};
	int count, i;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	for (count = 1; count <= max_targets; count++) {
		generate_and_display_drawbuffers(count);
	}

	for (count = 1; count <= max_targets; count++) {
		for (i = 0; i < count; i++) {
			pass = pass &&
				piglit_probe_pixel_rgb(16 * i + 8,
						       16 * (count - 1) + 8,
						       green);
		}
	}

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display(void)
{
	static const float red[3] = {1, 0, 0},
		green[3] = {0, 1, 0},
		blue[3] = {0, 0, 1},
		yellow[3] = {1, 1, 0},
		cyan[3] = {0, 1, 1};

	bool pass = true;

	glClear(GL_COLOR_BUFFER_BIT);
	glProvokingVertexEXT(GL_LAST_VERTEX_CONVENTION_EXT);

	const int y1 = piglit_height / 3;

	glBegin(GL_TRIANGLE_STRIP);
		glColor3fv(cyan);
		glVertex3i(piglit_width + 1, y1, 0);
		glColor3fv(yellow);
		glVertex3i(piglit_width + 2, y1, 0);
		glColor3fv(blue);
		glVertex3i(piglit_width + 3, y1, 0);
		glColor3fv(green);
		glVertex3i(piglit_width / 2, y1 * 2, 0);
		glColor3fv(red);
		glVertex3i(piglit_width - 1, y1 * 2, 0);
	glEnd();

	pass = pass && piglit_probe_pixel_rgb(piglit_width - 2, y1 * 3 / 2, red);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Exemple #3
0
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
	glClearColor(1.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glXDestroyContext(dpy, ctx);

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);

	glClearColor(0.0, 1.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	pass &= piglit_probe_pixel_rgb(1, 1, green);

	glXSwapBuffers(dpy, win);

	/* Free our resources when we're done. */
	glXMakeCurrent(dpy, None, NULL);
	glXDestroyContext(dpy, ctx);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
static int
test_etc1_rgb8_texture_8x8(const struct etc1_rgb8_texture_8x8 *tex)
{
    const GLenum format = GL_ETC1_RGB8_OES;
    const GLsizei width = 8, height = 8;
    unsigned x, y;
    int pass = GL_TRUE;

    glCompressedTexImage2D(GL_TEXTURE_2D, 0,
            format, width, height, 0, sizeof(tex->data), tex->data);
    pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

    glEnable(GL_TEXTURE_2D);

    piglit_draw_rect_tex(0, 0, width, height, 0.0f, 0.0f, 1.0f, 1.0f);

    glDisable(GL_TEXTURE_2D);

    for (y = 0; y < height; y++) {
        for (x = 0; x < width; x++) {
            const GLubyte *rgb = tex->rgb[y * width + x];
            float expected[3] = {
                rgb[0] / 255.0f,
                rgb[1] / 255.0f,
                rgb[2] / 255.0f
            };

            pass = piglit_probe_pixel_rgb(x, y, expected) && pass;
        }
    }

    return pass;
}
Exemple #5
0
/**
 * Test glDrawTex with non-zero z.
 */
static int
test_depth(void)
{
	const GLint crop[4] = {
		0, 0, TEXTURE_SIZE, TEXTURE_SIZE
	};
	const int x = piglit_width / 2 - 2;
	const int y = piglit_height / 2 - 2;
	int pass;

	glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop);

	glEnable(GL_DEPTH_TEST);

	/* draw at near plane */
	piglit_glDrawTexiOES(0, 0, 0, piglit_width, piglit_height);
	/* draw at far plane: should be no-op */
	piglit_glDrawTexiOES(0, 0, 1, piglit_width / 2, piglit_height / 2);

	glDisable(GL_DEPTH_TEST);

	pass = piglit_probe_pixel_rgb(x, y, red);

	if (!pass)
		fprintf(stderr, "non-zero depth failed\n");

	return pass;
}
Exemple #6
0
enum piglit_result
piglit_display(void)
{
	bool pass = true;
	GLuint tex;
	int i;

	tex = create_texture();

	clear_texture(tex);

	glBindTexture(GL_TEXTURE_CUBE_MAP, tex);

	draw_faces();

	glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

	glDeleteTextures(1, &tex);

	for (i = 0; i < 6; i++)
		pass &= piglit_probe_pixel_rgb(i, 0, faces[i].color);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int x, y;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	piglit_draw_rect(0, 0, piglit_width, piglit_height);

	for (y = 8; y < piglit_height && pass; y += 16) {
		for (x = 8; x < piglit_width; x += 16) {
			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;
}
Exemple #8
0
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	float red[] = {1,0,0,0};
	float green[] = {0,1,0,0};
	float *expected;
	int x;
	GLuint tex;

	glClearColor(1.0, 1.0, 1.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	tex = create_1d_fbo();

	draw_fbo_1d(10, 10);

	for (x = 0; x < BUF_WIDTH; x++) {
		if (x < BUF_WIDTH / 2)
			expected = red;
		else
			expected = green;

		pass &= piglit_probe_pixel_rgb(10 + x, 10, expected);
	}

	glDeleteTextures(1, &tex);

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display(void)
{
	static const float green[3] = { 0.0, 1.0, 0.0 };
	static const float blue[3]  = { 0.0, 0.0, 1.0 };
	enum piglit_result result = PIGLIT_PASS;

	glClear(GL_COLOR_BUFFER_BIT);
	glColor3fv(blue);

	/* Bind the separately linked vertex shader and the separately linked
	 * fragment shader using the new interfaces.  This should produce a
	 * green box.
	 */
	glUseShaderProgramEXT(GL_VERTEX_SHADER, prog[0]);
	glUseShaderProgramEXT(GL_FRAGMENT_SHADER, prog[1]);
	piglit_draw_rect(10, 10, 10, 10);
	if (!piglit_probe_pixel_rgb(15, 15, green))
		result = PIGLIT_FAIL;

	if (!piglit_automatic)
		piglit_present_results();

	return result;
}
Exemple #10
0
enum piglit_result
piglit_display(void)
{
	static const GLfloat color[4] = { 0.0, 1.0, 0.0, 1.0 };
	enum piglit_result result = PIGLIT_PASS;
	unsigned i;

	glClear(GL_COLOR_BUFFER_BIT);

	for (i = 0; i < ARRAY_SIZE(progs); i++) {
		const int x = 1 + (i * (BOX_SIZE + 1));

		glBindProgramARB(GL_VERTEX_PROGRAM_ARB, progs[i]);
		glEnable(GL_CLIP_PLANE0 + i);
		piglit_draw_rect_tex(x, 1, BOX_SIZE, BOX_SIZE,
				     1.0, 1.0, -2.0, 0.0);
		glDisable(GL_CLIP_PLANE0 + i);

		if (!piglit_probe_pixel_rgb(x + (BOX_SIZE / 2),
					    1 + (BOX_SIZE / 2),
					    color)) {
			result = PIGLIT_FAIL;
		}
	}

	piglit_present_results();
	return result;
}
Exemple #11
0
static GLboolean
check_red_box_surrounded_by_green(int x, int y, int w, int h)
{
	GLboolean pass = GL_TRUE;
	int probe_x, probe_y;
	const float red[] = {1.0, 0.0, 0.0, 0.0};
	const float green[] = {0.0, 1.0, 0.0, 0.0};

	for (probe_y = y - 1; probe_y <= y + h; probe_y++) {
		for (probe_x = x - 1; probe_x <= x + w; probe_x++) {
			const float *expected;

			if (probe_y < y || probe_y >= y + h ||
			    probe_x < x || probe_x >= x + w)
				expected = green;
			else
				expected = red;

			pass &= piglit_probe_pixel_rgb(probe_x, probe_y,
						       expected);
		}
	}

	return pass;
}
Exemple #12
0
enum piglit_result
piglit_display(void)
{
	static const GLfloat green[4] = { 0.0, 1.0, 0.0, 1.0 };
	static const GLfloat red[4] = { 1.0, 0.0, 0.0, 1.0 };
	enum piglit_result result = PIGLIT_PASS;

	glClear(GL_COLOR_BUFFER_BIT);

	glBegin(GL_TRIANGLES);
	glColor4fv(green);
	glVertex3f(-1.0,  1.0, 0.0);
	glColor4fv(red);
	glVertex3f( 2.0,  0.0, 1.0);
	glColor4fv(green);
	glVertex3f(-1.0, -1.0, 0.0);
	glEnd();

	if (!piglit_probe_pixel_rgb(piglit_width - 2,
				    piglit_height / 2,
				    clear_color)) {
		result = PIGLIT_FAIL;
	}

	piglit_present_results();
	return result;
}
Exemple #13
0
enum piglit_result
piglit_display(void)
{
    GLboolean pass = GL_TRUE;
    unsigned i;
    float x = 0, y = 0;

    glClear(GL_COLOR_BUFFER_BIT);
    glEnableClientState(GL_VERTEX_ARRAY);

    for (i = 0; tests[i].test; i++) {
        if (!user_va && tests[i].flag == USER)
            continue;

        glBindBuffer(GL_ARRAY_BUFFER, 0);

        printf("%s\n", tests[i].name);
        tests[i].test(x, y, x+20, y+20, tests[i].index);
        assert(glGetError() == 0);
        pass = piglit_probe_pixel_rgb(x+5, y+5, tests[i].expected_color) && pass;

        x += 20;
        if (x > 300) {
            x = 0;
            y += 20;
        }
    }

    glFinish();
    piglit_present_results();

    return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Exemple #14
0
enum piglit_result
piglit_display(void)
{
	static const GLfloat color[4] = { 0.0, 1.0, 0.0, 0.0 };
	enum piglit_result result = PIGLIT_PASS;
	unsigned i;

	glClear(GL_COLOR_BUFFER_BIT);
	glEnable(GL_FRAGMENT_PROGRAM_ARB);
	glEnable(GL_VERTEX_PROGRAM_ARB);

	glColor4f(1.0, 0.6, 0.3, 0.1);

	glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vert_prog);

	for (i = 0; i < ARRAY_SIZE(progs); i++) {
		const int x = 1 + (i * (BOX_SIZE + 1));

		glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, progs[i]);

		piglit_draw_rect(x, 1, BOX_SIZE, BOX_SIZE);

		if (!piglit_probe_pixel_rgb(x + (BOX_SIZE / 2),
					    1 + (BOX_SIZE / 2),
					    color)) {
			result = PIGLIT_FAIL;
		}
	}

	glutSwapBuffers();
	return result;
}
Exemple #15
0
static GLboolean test()
{
    GLint prog, location;
    GLboolean pass = GL_TRUE;
    int i;
    float color[4] = {0, 0, 0, 1};
    float DEGREES_30 = 0.523598776;

    prog = setup_shaders();
    location = glGetUniformLocation(prog, "a");

    for (i = 0; i <= 50; i++) {
        glUniform1f(location, (i - 25) * DEGREES_30);
        piglit_draw_rect((i % 10) * 10, (i / 10) * 10, 10, 10);
    }
    if (!piglit_check_gl_error(GL_NO_ERROR))
	     piglit_report_result(PIGLIT_FAIL);

    for (i = 0; i <= 50; i++) {
        color[0] = color[1] = sin((i - 25) * DEGREES_30) * 0.5 + 0.5;
        pass = piglit_probe_pixel_rgb((i % 10) * 10 + 5, (i / 10) * 10 + 5, color) && pass;
    }

    return pass;
}
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int count, i;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	
	for (count = 1; count <= max_targets; count++) {
		generate_and_display_drawbuffers(count);
	}

	/* walk over rows */
	for (count = 1; count <= max_targets; count++) {
		/* walk over columns */
		for (i = 0; i < count; i++) {
			pass = pass &&
				piglit_probe_pixel_rgb(16 * i + 8,
						       16 * (count - 1) + 8,
						       colors[i]);
		}
	}

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display(void)
{
#ifdef GL_ARB_ES2_compatibility
	GLboolean pass = GL_TRUE;
	float red[4] =   {1.0, 0.0, 0.0, 0.0};
	float green[4] = {0.0, 1.0, 0.0, 0.0};
	float blue[4] =  {0.0, 0.0, 1.0, 0.0};

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glClearColor(0.0, 0.0, 1.0, 0.0);

	glClearDepthf(0.5);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);

	/* Keep in mind that the ortho projection flips near and far's signs,
	 * so 1.0 to quad()'s z maps to glDepthRange's near, and -1.0 maps to
	 * glDepthRange's far.
	 */

	glColor4fv(green);
	glDepthRangef(0, 1);
	piglit_draw_rect_z(0.5,
			   0, 0,
			   piglit_width / 2, piglit_height);

	glColor4fv(red);
	glDepthRangef(1, 0);
	piglit_draw_rect_z(0.5,
			   piglit_width / 2, 0,
			   piglit_width, piglit_height);

	pass = piglit_probe_pixel_rgb(piglit_width * 1 / 4, piglit_height / 2,
				      green) && pass;
	pass = piglit_probe_pixel_rgb(piglit_width * 3 / 4, piglit_height / 2,
				      blue) && pass;

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
#else
	return PIGLIT_SKIP;
#endif /* GL_ARB_ES2_compatibility */
}
Exemple #18
0
static void probe_cell(const char* testname, int x, int y, const float* expected)
{
	if (!piglit_probe_pixel_rgb((2*x+1)*piglit_width/8, (2*y+1)*piglit_height/8, expected)) {
		fprintf(stderr, "%s: %i,%i failed\n", testname, x, y);
		if (piglit_automatic)
			piglit_report_result(PIGLIT_FAIL);
	}
}
Exemple #19
0
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	GLuint tex;
	int x1 = piglit_width / 4;
	int x2 = (piglit_width / 4) * 3;
	int y1 = piglit_height / 4;
	int y2 = (piglit_height / 4) * 3;
	float c1[3] = {0.25, 0.25, 0.25};
	float c2[3] = {0.75, 0.25, 0.25};
	float c3[3] = {0.25, 0.75, 0.75};
	float c4[3] = {0.75, 0.75, 0.75};

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	tex = create_fbo();
	glViewport(0, 0, piglit_width, piglit_height);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	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);

	draw_tex_sub_rect(x1, y1);
	draw_tex_sub_rect(x2, y1);
	draw_tex_sub_rect(x1, y2);
	draw_tex_sub_rect(x2, y2);

	pass &= piglit_probe_pixel_rgb(x1, y1, c1);
	pass &= piglit_probe_pixel_rgb(x2, y1, c2);
	pass &= piglit_probe_pixel_rgb(x1, y2, c3);
	pass &= piglit_probe_pixel_rgb(x2, y2, c4);

	glDeleteTextures(1, &tex);
	glDisable(GL_TEXTURE_2D);

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
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;

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	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);

	glRasterPos2i(10, 10);
	glDrawPixels(2, 2, GL_RGBA, GL_FLOAT, 0);

	glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, 0);
	glDeleteBuffersARB(1, &pbo);

	pass &= piglit_probe_pixel_rgb(10, 10, red);
	pass &= piglit_probe_pixel_rgb(11, 10, green);
	pass &= piglit_probe_pixel_rgb(10, 11, blue);
	pass &= piglit_probe_pixel_rgb(11, 11, red);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Exemple #21
0
static GLboolean
check_resulting_mipmaps(int x, int y)
{
	GLboolean pass = GL_TRUE;
	int size;

	for (size = SIZE; size > 0; size /= 2) {
		if (size == 4)
			pass = pass && piglit_probe_pixel_rgb(x + 2, y + 2,
							      red);
		else if (size == 2)
			pass = pass && piglit_probe_pixel_rgb(x + 1, y + 1,
							      green);
		else if (size == 1)
			pass = pass && piglit_probe_pixel_rgb(x, y,
							      blue);
		else {
			pass = pass && piglit_probe_pixel_rgb(x + size / 4,
							      y + size / 4,
							      red);
			pass = pass && piglit_probe_pixel_rgb(x + size * 3 / 4,
							      y + size / 4,
							      green);
			pass = pass && piglit_probe_pixel_rgb(x + size / 4,
							      y + size * 3 / 4,
							      blue);
			pass = pass && piglit_probe_pixel_rgb(x + size * 3 / 4,
							      y + size * 3 / 4,
							      white);
		}
		x += size + 5;
	}

	return pass;
}
Exemple #22
0
enum piglit_result
piglit_display(void)
{
	GLfloat white[4] = {1.0, 1.0, 1.0, 0.0};
	GLboolean pass = GL_TRUE;
	GLfloat varray1[12] = {175, 125, 0,
			       175, 175, 0,
			       125, 125, 0,
			       125, 175, 0};
	GLfloat varray2[12] = {275, 125, 0,
			       275, 175, 0,
			       225, 125, 0,
			       225, 175, 0};
	GLenum err;

	glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);

	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(3, GL_FLOAT, 0, 0);

	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 12 * sizeof(GLfloat),
			varray1, GL_DYNAMIC_DRAW);

	glClear(GL_COLOR_BUFFER_BIT);
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 12 * sizeof(GLfloat),
			varray2, GL_DYNAMIC_DRAW);

	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

	if ((err = glGetError()) != 0) {
		printf("gl error: 0x%08x\n", err);
		pass = GL_FALSE;
	}

	pass = pass && piglit_probe_pixel_rgb(250, 150, white);
	pass = pass && piglit_probe_pixel_rgb(150, 150, white);

	piglit_present_results();

	glDisableClientState(GL_VERTEX_ARRAY);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Exemple #23
0
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;
}
Exemple #24
0
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;

	glClear(GL_COLOR_BUFFER_BIT);

	piglit_draw_rect(-1.0, -1.0, 1.0, 2.0);

	pass &= piglit_probe_pixel_rgb(piglit_width / 4, piglit_height / 2,
				       green);
	pass &= piglit_probe_pixel_rgb(piglit_width * 3 / 4, piglit_height / 2,
				       blue);

	assert(!glGetError());

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;

	glColor4fv(green);
	piglit_draw_rect_tex(0.0, 0.0,
			     (float) piglit_width, (float) piglit_height,
			     0.0, 0.0, 1.0, 1.0);

	pass &= piglit_probe_pixel_rgb(0, 0, black);
	pass &= piglit_probe_pixel_rgb(piglit_width - 1, 0, green);
	pass &= piglit_probe_pixel_rgb(0, piglit_height - 1, green);
	pass &= piglit_probe_pixel_rgb(piglit_width - 1, piglit_height - 1,
				       black);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
draw(Display *dpy)
{
	GLboolean pass = GL_TRUE;
	float green[] = {0.0, 1.0, 0.0, 0.0};
	pthread_t thread1, thread2;
	void *retval;
	int ret;
	int x1 = 10, x2 = 30;
	GLXContext ctx;

	ctx = piglit_get_glx_context(dpy, visinfo);
	glXMakeCurrent(dpy, win, ctx);
	piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);

	/* Clear background to gray */
	glClearColor(0.5, 0.5, 0.5, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	glFinish();

	pthread_mutex_init(&mutex, NULL);
	/* Now, spawn some threads that do some drawing, both with this
	 * context
	 */
	pthread_create(&thread1, NULL, thread_func, &x1);
	pthread_create(&thread2, NULL, thread_func, &x2);

	ret = pthread_join(thread1, &retval);
	assert(ret == 0);
	ret = pthread_join(thread2, &retval);
	assert(ret == 0);

	pthread_mutex_destroy(&mutex);

	pass &= piglit_probe_pixel_rgb(15, 15, green);
	pass &= piglit_probe_pixel_rgb(35, 15, green);

	glXSwapBuffers(dpy, win);

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Exemple #27
0
enum piglit_result
piglit_display(void)
{
	piglit_draw_rect(-0.01, -0.01, 0.02, 0.02);
	bool pass = piglit_probe_pixel_rgb(piglit_width / 2,
					   piglit_height / 2,
					   green_with_a_smitch_of_red);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
static bool
check_rendering(void)
{
   const GLfloat x0 = 0.0, x1 = piglit_width - 10.0, dx = 20.0;
   const GLint iy = piglit_height / 2;
   bool draw = true;
   GLfloat x;

   if (!piglit_probe_pixel_rgb(0, 0, black)) {
      return false;
   }

   for (x = x0 + 0.5 * dx; x < x1; x += dx) {
      bool pass;
      const int ix = (int) x;

      if (draw) {
         /* there should be triangle drawing here */
         pass = piglit_probe_pixel_rgb(ix, iy, green);
      }
      else {
         /* there should not be triangle drawing here */
         pass = piglit_probe_pixel_rgb(ix, iy, black);
      }

      /* debug */
      if (0) {
         glWindowPos2i(ix, iy);
         glDrawPixels(1, 1, GL_RGBA, GL_FLOAT, red);
      }

      if (!pass) {
         return false;
      }

      draw = !draw;
   }

   return true;
}
static GLboolean check_resulting_mipmaps(int x, int y, const GLfloat *color)
{
	GLboolean pass = GL_TRUE;
	int i;

	for (i = SIZE; i > 0; i /= 2) {
		pass = pass && piglit_probe_pixel_rgb(x + i / 2, y + i / 2,
						      color);
		x += i;
	}

	return pass;
}
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	static const float red[] = {1.0, 0.0, 0.0, 0.0};
	static const float green[] = {0.0, 1.0, 0.0, 0.0};

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	glUniform1i(red_location, 1);
	piglit_draw_rect(10, 10, 10, 10);
	glUniform1i(red_location, 0);
	piglit_draw_rect(30, 10, 10, 10);

	pass &= piglit_probe_pixel_rgb(15, 15, red);
	pass &= piglit_probe_pixel_rgb(35, 15, green);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}