Exemplo n.º 1
0
static TrajectoryStruct *TrajectoryCreate(OpenCL::Program *pProgram, 
										  const float nTimeMax, 
										  const float nTimeDelta)
{
	TrajectoryStruct *pTrajectory = new TrajectoryStruct;
	
	if( pTrajectory != NULL )
	{
		// Maximum length of time for the simulation
		
		pTrajectory->mnTimeMax = nTimeMax;
		
		// Initialize parameters for this trajectory
		
		pTrajectory->maKFParam[0] = 0.0f;
		pTrajectory->maKFParam[1] = nTimeDelta;
		pTrajectory->maKFParam[2] = 0.0f;
		pTrajectory->maKFParam[3] = 0.0f;
		
		// Acquire an OpenCL program from an instantiated program object
		
		if( pProgram->Acquire() )
		{
			TrajectoryKernelsCreate(pProgram, pTrajectory);
			TrajectoryBuffersCreate(pProgram, pTrajectory);
			TrajectoryArraysCreate(pTrajectory);
			TrajectorySetGlobalWorkSize(pTrajectory);
		} // if
	} // if
	
	return( pTrajectory );
} // TrajectoryCreate
Exemplo n.º 2
0
static TrajectoryStruct *TrajectoryCreate(OpenCL::Program *pProgram,
        const float nTimeMax,
        const float nTimeDelta)
{
    TrajectoryStruct *pSTrajectory = new TrajectoryStruct;

    if( pSTrajectory != NULL )
    {
        // Maximum length of time for the simulation

        pSTrajectory->mnTimeMax = nTimeMax;

        // Initialize parameters for this trajectory

        pSTrajectory->maKFParam[0] = 0.0f;
        pSTrajectory->maKFParam[1] = nTimeDelta;
        pSTrajectory->maKFParam[2] = 0.0f;
        pSTrajectory->maKFParam[3] = 0.0f;

#if _OPENCL_CPU_BOUND_
        // On ATI you need to do this for now.

        pProgram->SetDeviceType( CL_DEVICE_TYPE_CPU );
#endif

        // Acquire an OpenCL program from an instantiated program object

        if( pProgram->Acquire() )
        {
            TrajectoryKernelsCreate(pProgram, pSTrajectory);
            TrajectoryBuffersCreate(pProgram, pSTrajectory);
            TrajectoryArraysCreate(pSTrajectory);
            TrajectorySetGlobalWorkSize(pSTrajectory);
        } // if
    } // if

    return( pSTrajectory );
} // TrajectoryCreate