1 // 2 // Copyright (c) 2017 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef _setup_h 17 #define _setup_h 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <string.h> 22 #include "gl_headers.h" 23 #ifdef __APPLE__ 24 #include <OpenCL/opencl.h> 25 #else 26 #include <CL/opencl.h> 27 #endif 28 29 30 // Note: the idea here is to have every platform define their own setup.cpp file that implements a GLEnvironment 31 // subclass internally, then return it as a definition for GLEnvironment::Create 32 33 class GLEnvironment 34 { 35 public: GLEnvironment()36 GLEnvironment() {} ~GLEnvironment()37 virtual ~GLEnvironment() {} 38 39 virtual int Init( int *argc, char **argv, int use_opengl_32 ) = 0; 40 virtual cl_context CreateCLContext( void ) = 0; 41 virtual int SupportsCLGLInterop( cl_device_type device_type) = 0; 42 43 static GLEnvironment * Instance( void ); 44 45 46 }; 47 48 #endif // _setup_h 49