static int
create_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA,
			     dim, dim,
			     0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	assert(glGetError() == 0);

	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\n");
		goto done;
	}

	glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
	piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

	glColor4fv(red);
	piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
	glColor4fv(green);
	piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
	glColor4fv(blue);
	piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
	glColor4fv(white);
	piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);

	glScissor(10, 10, 10, 10);
	glEnable(GL_SCISSOR_TEST);
	glGenerateMipmapEXT(GL_TEXTURE_2D);
	glDisable(GL_SCISSOR_TEST);
done:
	glDeleteFramebuffersEXT(1, &fb);

	return tex;
}
Example #2
0
void
piglit_init(int argc, char **argv)
{

	printf("The test's expectation is that the implementation samples\n"
	       "at pixel centers to produce fragments, so the fourth\n"
	       "(subpixel offset = 0.6) rectangle in each axis will\n"
	       "be offset compared to the previous.\n\n");

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
static GLuint
create_array_fbo_2d(void)
{
	GLuint tex, fb;
	GLenum status;
	int i, dim;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	assert(glGetError() == 0);

	for (i = 0, dim = TEX_WIDTH; dim >0; i++, dim /= 2) {
		glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, i, format,
			     dim, dim, num_layers, 0,
			     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	}
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	for (layer = 0; layer < num_layers; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  tex,
					  0,
					  layer);
		assert(glGetError() == 0);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			load_texture_2d_array();
			goto done;
		}

		glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
		piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

		glColor4fv(layer_color[layer]);
		piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
		glColor4fv(green);
		piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
		glColor4fv(blue);
		piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
		glColor4fv(white);
		piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);
	}

done:
	glGenerateMipmapEXT(GL_TEXTURE_2D_ARRAY_EXT);
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
void
piglit_init(int argc, char **argv)
{
	if (piglit_get_gl_version() < 20) {
		printf("Requires OpenGL 2.0\n");
		piglit_report_result(PIGLIT_SKIP);
		exit(1);
	}

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Example #5
0
static int
create_3d_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int depth;
	pot_depth = piglit_is_extension_supported("GL_ARB_texture_non_power_of_two") ?
		NUM_DEPTHS: POT_DEPTHS;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_3D, tex);

	/* allocate empty 3D texture */
	glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
		     BUF_WIDTH, BUF_HEIGHT, pot_depth,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	assert(glGetError() == 0);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	/* draw something into each slice of the 3D texture */
	for (depth = 0; depth < NUM_DEPTHS; depth++) {
		glFramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT,
					  GL_COLOR_ATTACHMENT0_EXT,
					  GL_TEXTURE_3D,
					  tex,
					  0,
					  depth);

		assert(glGetError() == 0);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			fprintf(stderr, "FBO incomplete\n");
			goto done;
		}

		glViewport(0, 0, BUF_WIDTH, BUF_HEIGHT);
		piglit_ortho_projection(BUF_WIDTH, BUF_HEIGHT, GL_FALSE);

		/* solid color quad */
		glColor4fv(depth_color[depth]);
		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
	}


done:
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glDeleteFramebuffersEXT(1, &fb);

	return tex;
}
Example #6
0
static int
create_fbo(void)
{
	GLuint tex, copied_tex, fb;
	GLenum status;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);

	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
		     TEX_WIDTH, TEX_HEIGHT,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);

	assert(glGetError() == 0);

	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\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
	piglit_ortho_projection(TEX_WIDTH, TEX_HEIGHT, GL_FALSE);

	glColor4fv(red);
	piglit_draw_rect(0, 0, TEX_WIDTH / 2, TEX_HEIGHT / 2);
	glColor4fv(green);
	piglit_draw_rect(TEX_WIDTH / 2, 0, TEX_WIDTH, TEX_HEIGHT / 2);
	glColor4fv(blue);
	piglit_draw_rect(0, TEX_HEIGHT / 2, TEX_WIDTH/2, TEX_HEIGHT);
	glColor4fv(white);
	piglit_draw_rect(TEX_WIDTH / 2, TEX_HEIGHT / 2, TEX_WIDTH, TEX_HEIGHT);

	glGenTextures(1, &copied_tex);
	glBindTexture(GL_TEXTURE_2D, copied_tex);
	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, TEX_WIDTH, TEX_HEIGHT, 0);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glDeleteFramebuffersEXT(1, &fb);
	glDeleteTextures(1, &tex);

	return copied_tex;
}
Example #7
0
void piglit_init(int argc, char **argv)
{
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

    if (piglit_get_gl_version() < 15) {
        printf("Requires OpenGL 1.5\n");
        piglit_report_result(PIGLIT_SKIP);
    }

    glShadeModel(GL_FLAT);
    glClearColor(0.2, 0.2, 0.2, 1.0);
}
Example #8
0
PIGLIT_GL_TEST_CONFIG_END

enum piglit_result
piglit_display(void)
{
	bool pass = true;
	float green[] = {0, 1, 0, 0};
	float clear[] = {0, 0, 0, 0};

	piglit_ortho_projection(piglit_width, piglit_height, false);

	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

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

	glColor4f(0, 1, 0, 0);

	/* Draw a rectangle, but set the flag to false for the verticals. */
	glBegin(GL_QUADS);
	glEdgeFlag(GL_TRUE);
	glVertex2f(1.5, 1.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(5.5, 1.5);
	glEdgeFlag(GL_TRUE);
	glVertex2f(5.5, 5.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(1.5, 5.5);

	glEdgeFlag(GL_TRUE);
	glVertex2f(11.5, 1.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(15.5, 1.5);
	glEdgeFlag(GL_TRUE);
	glVertex2f(15.5, 5.5);
	glEdgeFlag(GL_FALSE);
	glVertex2f(11.5, 5.5);
	glEnd();

	pass = piglit_probe_pixel_rgba(3, 1, green) && pass;
	pass = piglit_probe_pixel_rgba(3, 5, green) && pass;
	pass = piglit_probe_pixel_rgba(1, 3, clear) && pass;
	pass = piglit_probe_pixel_rgba(5, 3, clear) && pass;

	pass = piglit_probe_pixel_rgba(13, 1, green) && pass;
	pass = piglit_probe_pixel_rgba(13, 5, green) && pass;
	pass = piglit_probe_pixel_rgba(11, 3, clear) && pass;
	pass = piglit_probe_pixel_rgba(15, 3, clear) && pass;

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #9
0
void
piglit_init(int argc, char**argv)
{
   piglit_require_extension("GL_EXT_framebuffer_object");

   HaveExtension[0] = GL_TRUE;
   HaveExtension[EXT_packed_depth_stencil] = glutExtensionSupported("GL_EXT_packed_depth_stencil");
   HaveExtension[ARB_framebuffer_object] = glutExtensionSupported("GL_ARB_framebuffer_object");
   HaveExtension[ARB_texture_rg] = glutExtensionSupported("GL_ARB_texture_rg");

   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Example #10
0
void
piglit_init(int argc, char **argv)
{
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	piglit_require_extension("GL_ARB_vertex_buffer_object");

	glGenBuffersARB(1, &vbo);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo);
	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 12 * sizeof(GLfloat),
			NULL, GL_DYNAMIC_DRAW);
}
Example #11
0
static GLboolean
framebuffer_srgb_non_fbo(void)
{
	GLboolean pass;

	glViewport(0, 0, piglit_width, piglit_height);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	pass = test_srgb();
	piglit_present_results();
	return pass;
}
Example #12
0
static int
create_array_fbo(void)
{
	GLuint tex, fb;
	GLenum status;
	int layer;

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, tex);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	/* allocate empty array texture */
	glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGBA,
		     BUF_WIDTH, BUF_HEIGHT, num_layers,
		     0,
		     GL_RGBA, GL_UNSIGNED_BYTE, NULL);
	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	glGenFramebuffersEXT(1, &fb);
	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);

	/* draw something into each layer of the array texture */
	for (layer = 0; layer < NUM_LAYERS; layer++) {
		glFramebufferTextureLayer(GL_FRAMEBUFFER_EXT,
					     GL_COLOR_ATTACHMENT0_EXT,
					     tex,
					     0,
					     layer);

		if (!piglit_check_gl_error(GL_NO_ERROR))
			piglit_report_result(PIGLIT_FAIL);

		status = glCheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT);
		if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
			fprintf(stderr, "FBO incomplete\n");
			goto done;
		}

		glViewport(0, 0, BUF_WIDTH, BUF_HEIGHT);
		piglit_ortho_projection(BUF_WIDTH, BUF_HEIGHT, GL_FALSE);

		/* solid color quad */
		glColor4fv(layer_color[layer]);
		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
	}


done:
	glDeleteFramebuffersEXT(1, &fb);
	return tex;
}
Example #13
0
void
piglit_init(int argc, char**argv)
{
	enum piglit_result result;
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	piglit_require_extension("GL_ARB_blend_func_extended");

	glGetIntegerv(GL_MAX_DUAL_SOURCE_DRAW_BUFFERS, &max_ds_buffers);

	result = test();
	piglit_report_result(result);
}
void
piglit_init(int argc, char **argv)
{
	glClearColor(0.0, 0.2, 0.3, 0.0);
	glClearDepth(1.0);

	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);

	piglit_require_extension("GL_ARB_occlusion_query");
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
Example #15
0
enum piglit_result
piglit_display(void)
{
	GLboolean pass = GL_TRUE;
	int x, y;
	static float red[]   = {1.0, 0.0, 0.0, 0.0};
	static float green[] = {0.0, 1.0, 0.0, 0.0};

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glEnable(GL_DEPTH_TEST);

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

	glColor4fv(red);

	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	draw_rect_set(10);

	glDepthRange(0.5, 1.0);
	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	glDepthRange(0.0, 1.0);
	draw_rect_set(30);

	glDepthRange(0.0, 0.5);
	glClearDepth(0.5);
	glClear(GL_DEPTH_BUFFER_BIT);
	glDepthRange(0.0, 1.0);
	draw_rect_set(50);

	for (y = 0; y < 3; y++) {
		for (x = 0; x < 4; x++) {
			float *expected;

			if (x < 2)
				expected = green;
			else
				expected = red;

			pass &= piglit_probe_pixel_rgb(15 + x * 20, 15 + y * 20,
						       expected);
		}
	}

	glutSwapBuffers();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #16
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;
	int cx = piglit_width / 2;
	int cy = piglit_height / 2;
	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};
	float white[3] = {1.0, 1.0, 1.0};

	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);
	draw_tex_sub_rect(cx, cy);

	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);
	pass &= piglit_probe_pixel_rgb(cx, cy, white);

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

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #17
0
void
piglit_init(int argc, char **argv)
{
    piglit_require_gl_version(20);

    compileLinkProg();

    loadTex();

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

    glEnable(GL_TEXTURE_2D);
    glClearColor(0.6, 0.6, 0.6, 1.0);
}
Example #18
0
enum piglit_result
piglit_display(void)
{
	bool pass = true;

	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	/* Clear the whole first texture with green */
	glClearTexImage(texture[0], 0, GL_RGB, GL_FLOAT, green);
	pass &= piglit_check_gl_error(GL_NO_ERROR);

	/* Clear the left half of the second texture with blue */
	glClearTexSubImage(texture[1], 0,
			   0, 0, 0,
			   32, 64, 1,
			   GL_RGB, GL_FLOAT, blue);
	pass &= piglit_check_gl_error(GL_NO_ERROR);
	/* And the right half with yellow */
	glClearTexSubImage(texture[1], 0,
			   32, 0, 0,
			   32, 64, 1,
			   GL_RGB, GL_FLOAT, yellow);
	pass &= piglit_check_gl_error(GL_NO_ERROR);

	/* Render both textures to the screen */
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

	glBindTexture(GL_TEXTURE_2D, texture[0]);
	piglit_draw_rect_tex(0, 0, 64, 64, 0, 0, 1, 1);

	glBindTexture(GL_TEXTURE_2D, texture[1]);
	piglit_draw_rect_tex(64, 0, 64, 64, 0, 0, 1, 1);

	glDisable(GL_TEXTURE_2D);
	glDeleteTextures(2, texture);

	/* Check for the 3 separate regions */
	pass &= piglit_probe_rect_rgb(0, 0, 64, 64, green);
	pass &= piglit_probe_rect_rgb(64, 0, 32, 64, blue);
	pass &= piglit_probe_rect_rgb(96, 0, 32, 64, yellow);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #19
0
/**
 * Common functionality needed by hiz_run_test_stencil_test_fbo() and
 * hiz_run_test_stencil_test_window().
 */
static bool
hiz_run_test_stencil_test_common()
{
	static const float *expected_colors[9] = {
		hiz_grey,  hiz_blue,  hiz_grey,
		hiz_green, hiz_blue,  hiz_grey,
		hiz_green, hiz_green, hiz_grey,
	};

	const float dx = piglit_width / 3.0;
	const float dy = piglit_height / 3.0;

	/* Set up depth state. */
	glDisable(GL_DEPTH_TEST);
	glClearDepth(hiz_clear_z);

	/* Set up stencil state. */
	glEnable(GL_STENCIL_TEST);
	glClearStencil(3); /* 3 is a good canary. */
	glStencilFunc(GL_LESS, 3, ~0);
	glStencilOp(GL_INCR, GL_INCR, GL_INCR);

	glClearColor(hiz_grey[0], hiz_grey[1], hiz_grey[2], hiz_grey[3]);
	glClear(GL_COLOR_BUFFER_BIT
		| GL_DEPTH_BUFFER_BIT
		| GL_STENCIL_BUFFER_BIT);

	glViewport(0, 0, piglit_width, piglit_height);
	piglit_ortho_projection(piglit_width, piglit_height, false);

	/* Draw rect 1. */
	glColor4fv(hiz_grey);
	piglit_draw_rect(0 * dx, 0 * dy, /* x, y */
			 2 * dx, 3 * dy); /* w, h */

	/* Draw rect 2. */
	glColor4fv(hiz_green);
	piglit_draw_rect(0 * dx, 0 * dy,  /* x, y */
			 2 * dx, 2 * dy); /* w, h */

	/* Draw rect 3. */
	glColor4fv(hiz_blue);
	piglit_draw_rect(1 * dx, 1 * dy,   /* x, y */
		         2 * dx, 2 * dy);  /* w, h */

	if (!piglit_check_gl_error(0))
		return false;

	return hiz_probe_color_buffer(expected_colors);
}
void
piglit_init(int argc, char **argv)
{
	piglit_require_gl_version(14);

	piglit_require_extension("GL_EXT_vertex_array_bgra");

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glEnable(GL_COLOR_SUM);
	glColor3f(0.0, 0.0, 0.0);

	glClearColor(0.6, 0.6, 0.6, 1.0);
}
Example #21
0
enum piglit_result
piglit_display(void)
{
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	test_matrix();

	test_vector("float", ", 0, 0, 0", glUniform1fvARB);
	test_vector("vec2", ", 0, 0", glUniform2fvARB);
	test_vector("vec3", ", 0", glUniform3fvARB);
	test_vector("vec4", "", glUniform4fvARB);

	return PIGLIT_PASS;
}
Example #22
0
void
piglit_init(int argc, char**argv)
{
	enumerate_subtests();

	piglit_require_extension("GL_EXT_framebuffer_object");

	have_extension[0] = GL_TRUE;
	have_extension[EXT_packed_depth_stencil] = piglit_is_extension_supported("GL_EXT_packed_depth_stencil");
	have_extension[ARB_framebuffer_object] = piglit_is_extension_supported("GL_ARB_framebuffer_object");
	have_extension[ARB_texture_rg] = piglit_is_extension_supported("GL_ARB_texture_rg");

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Example #23
0
enum piglit_result
piglit_display(void)
{
	int dim;
	GLboolean pass = GL_TRUE;
	int level, min_lod, max_lod, x_offset, y_offset;
	GLuint tex;

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

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

	/* Create the texture. */
	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
			GL_NEAREST_MIPMAP_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

	/* Fill in each level */
	for (level = 0, dim = MAX_SIZE; dim > 0; level++, dim /= 2) {
		set_level_color(level, dim, level);
	}

	/* Draw all the levels with varying clamp ranges. */
	glEnable(GL_TEXTURE_2D);
	y_offset = 10;
	for (min_lod = 0; min_lod <= MAX_LOD; min_lod++) {
		x_offset = 10;

		for (max_lod = MAX_LOD; max_lod >= min_lod; max_lod--) {
			pass = draw_and_test(x_offset, y_offset,
					     min_lod, max_lod) && pass;
			x_offset += MAX_SIZE + PAD;
		}

		y_offset += (MAX_SIZE * 2 + PAD * 7);
	}

	glDeleteTextures(1, &tex);

	piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #24
0
void
piglit_init(int argc, char **argv)
{
    unsigned i;
    float v[TEST_COLS * 3 ];

    (void) argc;
    (void) argv;

    piglit_require_fragment_program();
    piglit_require_extension("GL_NV_fragment_program_option");
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

    reference_prog = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB,
                                            reference_shader_source);

    glClearColor(1.0, 1.0, 1.0, 1.0);

    for (i = 0; i < ARRAY_SIZE(types); i++) {
        generate_shader(types[i]);
        progs[i] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB,
                                          shader_source);
    }


    /* Generate the possible color values.
     */
    for (i = 0; i <= 127; i++) {
        v[i] = ((float) i) / 127.0;
    }

    for (/* empty */; i < ARRAY_SIZE(v); i++) {
        v[i] = 0.5;
    }


    /* Shuffle the values into random order.  Generate the color data
     * used by the tests from the shuffled values.
     */
    shuffle(v, 128);
    for (i = 0; i < TEST_COLS; i++) {
        assert((i * 3) + 2 < ARRAY_SIZE(v));

        colors[i][0] = v[(i * 3) + 0];
        colors[i][1] = v[(i * 3) + 1];
        colors[i][2] = v[(i * 3) + 2];
        colors[i][3] = 1.0;
    }
}
Example #25
0
void
piglit_init(int argc, char **argv)
{
	GLint num;

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	piglit_require_extension("GL_EXT_framebuffer_object");
	piglit_require_extension("GL_ARB_draw_buffers");
	piglit_require_extension("GL_EXT_draw_buffers2");

	glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
	if (num < 2)
		piglit_report_result(PIGLIT_SKIP);
}
Example #26
0
File: select.c Project: RAOF/piglit
enum piglit_result
do_blit_test(void)
{
	GLuint buff[64] = {0};
	glSelectBuffer(64, buff);

	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
	glClearColor(0.5, 0.5, 0.5, 0.0);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glRenderMode(GL_SELECT);
	draw_objects();

	return validate_select_buffer(buff) ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #27
0
PIGLIT_GL_TEST_CONFIG_END

#define width (10)
#define height (12)
#define depth (3)

void piglit_init(int argc, char **argv)
{
    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

   if (!piglit_is_extension_supported("GL_ARB_robustness"))
      piglit_report_result(PIGLIT_SKIP);

    glClearColor(0.2, 0.2, 0.2, 1.0);
}
void
piglit_init(int argc, char **argv)
{
    piglit_require_extension("GL_EXT_texture_integer");
    piglit_require_GLSL_version(130);

    PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
                            PassthroughFragShaderText);
    assert(PassthroughFragShader);
    PassthroughProgram = piglit_link_simple_program(0, PassthroughFragShader);

    (void) check_error(__FILE__, __LINE__);

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
Example #29
0
enum piglit_result piglit_display(void)
{
    GLboolean pass;

    piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

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

    pass = test();

    glutSwapBuffers();

    return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Example #30
0
static void
draw_mipmap(int x, int y, int dim)
{
	glViewport(0, 0, piglit_width, piglit_height);
	piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);

	glEnable(GL_TEXTURE_2D);
	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	piglit_draw_rect_tex(x, y, dim, dim,
			     0, 0, 1, 1);
	glDisable(GL_TEXTURE_2D);
}