Beispiel #1
0
static int 
Initialize(int gpu)
{
    int err;
    err = SetupGraphics();
    if (err != GL_NO_ERROR)
    {
        printf ("Failed to setup OpenGL state!");
        exit (err);
    }

    err = SetupComputeDevices(gpu);
    if(err != CL_SUCCESS)
    {
        printf ("Failed to connect to compute device! Error %d\n", err);
        exit (err);
    }

    err = SetupComputeKernels();
    if (err != CL_SUCCESS)
    {
        printf ("Failed to setup compute kernel! Error %d\n", err);
        exit (err);
    }
    printf(SEPARATOR);
    printf("Starting event loop...\n");

    return CL_SUCCESS;
}
Beispiel #2
0
static int 
Initialize(int gpu)
{
	int err;
	err = SetupGraphics();
	if (err != GL_NO_ERROR)
	{
		printf ("Failed to setup OpenGL state!");
		exit (err);
	}

	err = SetupComputeDevices(gpu);
	if(err != CL_SUCCESS)
	{
		printf ("Failed to connect to compute device! Error %d\n", err);
		exit (err);
	}

	err = SetupGLProgram();
	if (err != 1)
	{
		printf ("Failed to setup OpenGL Shader! Error %d\n", err);
		exit (err);
	}

	err = InitData();
	if (err != 1)
	{
		printf ("Failed to Init FFT Data! Error %d\n", err);
		exit (err);
	}

	err = CreateGLResouce();
	if (err != 1)
	{
		printf ("Failed to create GL resource! Error %d\n", err);
		exit (err);
	}

	glFinish();

	err = SetupComputeKernel();
	if (err != CL_SUCCESS)
	{
		printf ("Failed to setup compute kernel! Error %d\n", err);
		exit (err);
	}

	err = CreateComputeResource();
	if(err != CL_SUCCESS)
	{
		printf ("Failed to create compute result! Error %d\n", err);
		exit (err);
	}

	clFlush(ComputeCommands);

	return CL_SUCCESS;
}