Ejemplo n.º 1
0
enum piglit_result
piglit_display()
{
	bool pass = true;
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	allocate_data_arrays();

	draw_reference_image(false /* sample_alpha_to_coverage */,
			     true /* sample_alpha_to_one */);

	draw_test_image(false /* sample_alpha_to_coverage */,
			true /* sample_alpha_to_one */);

	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

        glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
        pass = piglit_probe_rect_halves_equal_rgba(0, 0,
						   piglit_width,
						   piglit_height)
	       && pass;

	/* Free the memory allocated for data arrays */
	free_data_arrays();

	if (!piglit_automatic)
		piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
enum piglit_result
piglit_display()
{
	bool pass = true;
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	allocate_data_arrays();

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC1_ALPHA);

	/* Reference image drawn when sample_alpha_to_coverage is enabled,
	 * doesn't represent an expected image. Reference image is drawn only
	 * to visualize the image difference caused by enabling
	 * sample_alpha_to_coverage
	 */
	draw_reference_image(true /* sample_alpha_to_coverage */,
			     false /* sample_alpha_to_one */);

	draw_test_image(true /* sample_alpha_to_coverage */,
			false /* sample_alpha_to_one */);

	glDisable(GL_BLEND);
	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

	/* Probe test images of all the draw_buffers blitted to resolve fbo
	 * and compare with expected color values.  This method of verification
	 * is appropriate for tests with sample-alpha-to-coverage enabled.
	 * Possibility of dithering effect when the coverage value is not a
	 * strict multiple of 1 / num_samples makes image compare (test /
	 * reference image) unsuitable for this test.
	 */
	pass = probe_framebuffer_color() && pass;

	/* Free the memory allocated for data arrays */
	free_data_arrays();

	if (!piglit_automatic)
		piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Ejemplo n.º 3
0
enum piglit_result
piglit_display()
{
	bool pass = true;
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, piglit_winsys_fbo);
	glClearColor(0.0, 0.0, 0.0, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);
	allocate_data_arrays();

	/* Set sample_alpha_to_one = false to generate the reference image */
	draw_reference_image(false /* sample_alpha_to_coverage */,
			     false /* sample_alpha_to_one */);

	/* Test multisample fbo with GL_SAMPLE_ALPHA_TO_ONE enabled but
	 * GL_MULTISAMPLE disabled */
	glDisable(GL_MULTISAMPLE);

	draw_test_image(false /* sample_alpha_to_coverage */,
			true /* sample_alpha_to_one */);

	glEnable(GL_MULTISAMPLE);

	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

	glBindFramebuffer(GL_READ_FRAMEBUFFER, piglit_winsys_fbo);
	pass = piglit_probe_rect_halves_equal_rgba(0, 0,
						   piglit_width,
						   piglit_height)
	       && pass;
	/* Free the memory allocated for data arrays */
	free_data_arrays();

	if (!piglit_automatic)
		piglit_present_results();

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}