Mercurial > hg > Game > Cerium
view TaskManager/Gpu/GpuScheduler.h @ 1555:096412ad80fb draft
add opencl example
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 04 Mar 2013 20:20:58 +0900 |
parents | 68200bc3ab6b |
children | e8c9a7099bcc |
line wrap: on
line source
#ifndef INCLUDED_GPU_SCHEDULER #define INCLUDED_GPU_SCHEDULER #include "Scheduler.h" #include "FifoDmaManager.h" #include "GpuThreads.h" #include "HTask.h" #ifdef __APPLE__ #include <OpenCL/opencl.h> #else #include <CL/cl.h> #endif typedef struct nd_range { cl_uint dimension; size_t gws[3]; size_t lws[3]; } ND_RANGE_T, *ND_RANGE_T_PTR; class GpuScheduler : public Scheduler { public: GpuScheduler(); virtual ~GpuScheduler(); void init_impl(int useRefDma); void init_gpu(); void run(); void mail_write_from_host(memaddr data) { fifoDmaManager->mail_write_from_host(data); } memaddr mail_read_from_host() { return fifoDmaManager->mail_read_from_host(); } int has_mail_from_host() { return fifoDmaManager->has_mail_from_host(); } cl_platform_id platform_id; cl_device_id device_id; cl_uint ret_num_platforms; cl_uint ret_num_devices; cl_context context; cl_command_queue command_queue; cl_int ret; private: FifoDmaManager *fifoDmaManager; void load_kernel(int cmd); }; #define GpuSchedRegister(str, filename, functionname) \ gpu_register_task(str, filename, functionname); #endif extern void gpu_register_task(int cmd,const char* filename,const char* functionname);