1/********************************************************************************** 2 * Copyright (c) 2008 - 2012 The Khronos Group Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and/or associated documentation files (the 6 * "Materials"), to deal in the Materials without restriction, including 7 * without limitation the rights to use, copy, modify, merge, publish, 8 * distribute, sublicense, and/or sell copies of the Materials, and to 9 * permit persons to whom the Materials are furnished to do so, subject to 10 * the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included 13 * in all copies or substantial portions of the Materials. 14 * 15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 22 **********************************************************************************/ 23 24#ifndef __OPENCL_CL_GL_H 25#define __OPENCL_CL_GL_H 26 27#ifdef __APPLE__ 28#include <OpenCL/cl.h> 29#else 30#include <CL/cl.h> 31#endif 32 33#ifdef __cplusplus 34extern "C" { 35#endif 36 37typedef cl_uint cl_gl_object_type; 38typedef cl_uint cl_gl_texture_info; 39typedef cl_uint cl_gl_platform_info; 40typedef struct __GLsync *cl_GLsync; 41 42/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */ 43#define CL_GL_OBJECT_BUFFER 0x2000 44#define CL_GL_OBJECT_TEXTURE2D 0x2001 45#define CL_GL_OBJECT_TEXTURE3D 0x2002 46#define CL_GL_OBJECT_RENDERBUFFER 0x2003 47#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E 48#define CL_GL_OBJECT_TEXTURE1D 0x200F 49#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010 50#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011 51 52/* cl_gl_texture_info */ 53#define CL_GL_TEXTURE_TARGET 0x2004 54#define CL_GL_MIPMAP_LEVEL 0x2005 55#define CL_GL_NUM_SAMPLES 0x2012 56 57 58extern CL_API_ENTRY cl_mem CL_API_CALL 59clCreateFromGLBuffer(cl_context /* context */, 60 cl_mem_flags /* flags */, 61 cl_GLuint /* bufobj */, 62 int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 63 64extern CL_API_ENTRY cl_mem CL_API_CALL 65clCreateFromGLTexture(cl_context /* context */, 66 cl_mem_flags /* flags */, 67 cl_GLenum /* target */, 68 cl_GLint /* miplevel */, 69 cl_GLuint /* texture */, 70 cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; 71 72extern CL_API_ENTRY cl_mem CL_API_CALL 73clCreateFromGLRenderbuffer(cl_context /* context */, 74 cl_mem_flags /* flags */, 75 cl_GLuint /* renderbuffer */, 76 cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 77 78extern CL_API_ENTRY cl_int CL_API_CALL 79clGetGLObjectInfo(cl_mem /* memobj */, 80 cl_gl_object_type * /* gl_object_type */, 81 cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; 82 83extern CL_API_ENTRY cl_int CL_API_CALL 84clGetGLTextureInfo(cl_mem /* memobj */, 85 cl_gl_texture_info /* param_name */, 86 size_t /* param_value_size */, 87 void * /* param_value */, 88 size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 89 90extern CL_API_ENTRY cl_int CL_API_CALL 91clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */, 92 cl_uint /* num_objects */, 93 const cl_mem * /* mem_objects */, 94 cl_uint /* num_events_in_wait_list */, 95 const cl_event * /* event_wait_list */, 96 cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 97 98extern CL_API_ENTRY cl_int CL_API_CALL 99clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, 100 cl_uint /* num_objects */, 101 const cl_mem * /* mem_objects */, 102 cl_uint /* num_events_in_wait_list */, 103 const cl_event * /* event_wait_list */, 104 cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 105 106 107// Deprecated OpenCL 1.1 APIs 108extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 109clCreateFromGLTexture2D(cl_context /* context */, 110 cl_mem_flags /* flags */, 111 cl_GLenum /* target */, 112 cl_GLint /* miplevel */, 113 cl_GLuint /* texture */, 114 cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; 115 116extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 117clCreateFromGLTexture3D(cl_context /* context */, 118 cl_mem_flags /* flags */, 119 cl_GLenum /* target */, 120 cl_GLint /* miplevel */, 121 cl_GLuint /* texture */, 122 cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; 123 124/* cl_khr_gl_sharing extension */ 125 126#define cl_khr_gl_sharing 1 127 128typedef cl_uint cl_gl_context_info; 129 130/* Additional Error Codes */ 131#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 132 133/* cl_gl_context_info */ 134#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 135#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 136 137/* Additional cl_context_properties */ 138#define CL_GL_CONTEXT_KHR 0x2008 139#define CL_EGL_DISPLAY_KHR 0x2009 140#define CL_GLX_DISPLAY_KHR 0x200A 141#define CL_WGL_HDC_KHR 0x200B 142#define CL_CGL_SHAREGROUP_KHR 0x200C 143 144extern CL_API_ENTRY cl_int CL_API_CALL 145clGetGLContextInfoKHR(const cl_context_properties * /* properties */, 146 cl_gl_context_info /* param_name */, 147 size_t /* param_value_size */, 148 void * /* param_value */, 149 size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 150 151typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( 152 const cl_context_properties * properties, 153 cl_gl_context_info param_name, 154 size_t param_value_size, 155 void * param_value, 156 size_t * param_value_size_ret); 157 158#ifdef __cplusplus 159} 160#endif 161 162#endif /* __OPENCL_CL_GL_H */ 163