00001 #ifndef _MACHINE_H_NOU_ 00002 #define _MACHINE_H_NOU_ 00003 00004 #include <iostream> 00005 #include <vector> 00006 #include <CL/cl.h> 00007 #include <GL/gl.h> 00008 #include <GL/glx.h> 00009 #include "clutility.h" 00010 #include "model.h" 00011 00012 using namespace std; 00013 00014 typedef vector<cl_device_id> cl_device_v; 00015 typedef vector<cl_platform_id> cl_platform_v; 00019 class Machine 00020 { 00021 private: 00022 cl_context context; 00023 cl_device_v device; 00024 vector<cl_command_queue> queues; 00025 vector<Model*> models; 00026 size_t local_work_size; 00027 bool gl_interoperability; 00028 void init(cl_context_properties *cl_properties, cl_device_v &devices); 00029 public: 00030 Machine(int platform_index = 0, cl_device_v devices = cl_device_v()); 00031 Machine(cl_context_properties gl_context, cl_context_properties display, int platform_index = 0, cl_device_v devices = cl_device_v()); 00032 ~Machine(); 00033 static cl_platform_v getPlatforms(); 00034 static cl_device_v getDevices(cl_platform_id platform_id, cl_device_type type = CL_DEVICE_TYPE_ALL); 00035 void run(cl_kernel kernel, size_t w, size_t h); 00036 void addChild(Model *child); 00037 void removeChild(Model *child); 00038 void finish(); 00039 cl_context getContext(); 00041 bool GLinteroprability(){ return gl_interoperability; }; 00042 protected: 00043 }; 00044 00045 #endif