Exemplo n.º 1
0
int
main(int argc, char **argv)
{
    INIT();

    if (argc == 2 && strcmp(argv[1], "help") == 0) {
        usage(argv[0]);
        return (-1);
    }

    if (argc == 1) {
        print("full suite run\n");
        buffer_test("stack");
        buffer_test("heap");
        buffer_test("newheap");
#ifndef X64
        /* disabling b/c messes up the print: "success" comes out as "Ðuccess" */
        buffer_test("crtheap");
#endif
        buffer_test("virtual");
        buffer_test("virtual_x");
        buffer_test(".data");
        /* TODO:  .text, TEB */
    }
}
Exemplo n.º 2
0
enum piglit_result
piglit_cl_test(const int argc,
               const char **argv,
               const struct piglit_cl_custom_test_config *config,
               const struct piglit_cl_custom_test_env *env)
{

    piglit_cl_context context = NULL;
    cl_program program = NULL;

    unsigned i, j;

    static const cl_mem_flags possibilities[] = {
#ifdef CL_VERSION_1_2
        0,
#endif
        CL_MEM_USE_HOST_PTR,
        CL_MEM_COPY_HOST_PTR,
        CL_MEM_ALLOC_HOST_PTR,
        CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR,
    };

    const size_t nump = ARRAY_SIZE(possibilities);
    enum piglit_result part_ret, ret = PIGLIT_PASS;
    float data = 10;

    context = piglit_cl_create_context(env->platform_id, &env->device_id, 1);

    program = piglit_cl_build_program_with_source(context, 1, &source, NULL);

    for (i = 0; i < nump; ++i)
        for (j = 0; j < nump; ++j) {
            part_ret = buffer_test(&context, &program,
                                   possibilities[i], possibilities[j], ++data);
            piglit_merge_result(&ret, part_ret);
        }

    clReleaseProgram(program);
    piglit_cl_release_context(context);
    return ret;
}
Exemplo n.º 3
0
int main()
{
  buffer_test();
}
Exemplo n.º 4
0
static bool
test_format(const struct fmt_test *test)
{
	bool pass = true;

	if (piglit_is_extension_supported("GL_OES_texture_buffer") &&
	    test->can_texbuf) {
		bool buf_test = buffer_test(test);
		piglit_report_subtest_result(PIGLIT_RESULT(buf_test),
					     "format 0x%x TBO test",
					     test->iformat);
		pass &= buf_test;
	}

	glUseProgram(prog);
	glUniform1i(0 /* explicit loc */, 0);

	/* Create a texture, upload data */
	const GLuint texture = create_texture(test);

	glBindTexture(GL_TEXTURE_2D, texture);

	/* Can only texture from. */
	if (!test->req_render) {
		/* Render texture to window and verify contents. */
		render_texture(texture, GL_TEXTURE_2D, 0);
		bool render_test = verify_contents_float(test);
		piglit_present_results();
		piglit_report_subtest_result(PIGLIT_RESULT(render_test),
					     "format 0x%x",
					     test->iformat);
		glDeleteTextures(1, &texture);
		pass &= render_test;
		return pass;
	}

	/* Test glRenderbufferStorage. */
	GLuint rbo = create_rbo(test);
	if (!rbo || !piglit_check_gl_error(GL_NO_ERROR)) {
		piglit_report_subtest_result(PIGLIT_FAIL,
					     "format 0x%x RBO test",
					     test->iformat);
		pass &= false;
	} else {
		piglit_report_subtest_result(PIGLIT_PASS,
					     "format 0x%x RBO test",
					     test->iformat);
	}
	glDeleteRenderbuffers(1, &rbo);

	/* Create framebuffer object. */
	GLuint fbo_tex;
	const GLuint fbo = create_fbo(test, &fbo_tex);

	if (glCheckFramebufferStatus(GL_FRAMEBUFFER) !=
		GL_FRAMEBUFFER_COMPLETE) {
		piglit_report_subtest_result(PIGLIT_FAIL,
					     "format 0x%x fbo fail",
					     test->iformat);
		pass &= false;
	}

	render_texture(texture, GL_TEXTURE_2D, fbo);

	/* Test glCopyTexImage2D by copying current fbo content to
	 * a texture, rendering copy back to fbo and verifying fbo contents.
	 */
	GLuint tmp_tex = create_empty_texture();
	glCopyTexImage2D(GL_TEXTURE_2D, 0, test->iformat, 0, 0, piglit_width,
			 piglit_height, 0);

	render_texture(tmp_tex, GL_TEXTURE_2D, fbo);

	/* If format can be read, verify contents. */
	if (test->can_read)
		pass &= verify_contents(test);

	glDeleteTextures(1, &tmp_tex);

	/* If GL_EXT_copy_image is supported then create another
	 * texture, copy contents and render result to fbo.
	 */
	GLuint texture_copy = 0;
	if (piglit_is_extension_supported("GL_EXT_copy_image")) {
		bool copy_pass =
			test_copy_image(test, texture, &texture_copy);
		pass &= copy_pass;
		piglit_report_subtest_result(PIGLIT_RESULT(copy_pass),
					     "copy image format 0x%x",
					     test->iformat);
		render_texture(texture_copy, GL_TEXTURE_2D, fbo);
	}

	/* If format can be read, verify contents. */
	if (test->can_read)
		pass &= verify_contents(test);

	/* Render fbo contents to window. */
	render_texture(fbo_tex, GL_TEXTURE_2D, 0);

	piglit_present_results();

	glDeleteFramebuffers(1, &fbo);
	glDeleteTextures(1, &texture);
	glDeleteTextures(1, &texture_copy);

	return pass;
}