├── todo ├── README.md ├── LICENSE ├── v1.0 ├── headers │ ├── opencl.h │ ├── cl_gl_ext.h │ ├── cl_gl.h │ ├── cl_ext.h │ └── cl.h └── cl │ └── convertion.go ├── v1.1 ├── headers │ ├── opencl.h │ ├── cl_gl_ext.h │ ├── cl_gl.h │ └── cl_ext.h └── cl │ └── convertion.go ├── v1.2 ├── headers │ ├── opencl.h │ ├── cl_gl_ext.h │ ├── cl_gl.h │ └── cl_ext.h └── cl │ ├── convertion.go │ └── package_test.go ├── v2.0 └── headers │ ├── opencl.h │ ├── cl_gl_ext.h │ ├── cl_gl.h │ └── cl_ext.h └── sample ├── statinfo └── statinfo.go └── square └── square.go /todo: -------------------------------------------------------------------------------- 1 | Finish coding all function pointer functions 2 | Check for Context pointer method signature 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CL 2 | Robust cross platform opencl bindings for go 3 | 4 | #Examples 5 | see sample/ 6 | 7 | #Compile optimisation 8 | for better performance (less overhead) compile with 4 `-l` flag: 9 | `go install -gcflags="-l -l -l -l" github.com/go-gl/cl/v1.2/cl` 10 | This will inline most functions in the package. 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 the go-gl-cl authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /v1.0/headers/opencl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_H 27 | #define __OPENCL_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #ifdef __APPLE__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __OPENCL_H */ 54 | -------------------------------------------------------------------------------- /v1.1/headers/opencl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_H 27 | #define __OPENCL_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #ifdef __APPLE__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __OPENCL_H */ 54 | -------------------------------------------------------------------------------- /v1.2/headers/opencl.h: -------------------------------------------------------------------------------- 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_H 27 | #define __OPENCL_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #ifdef __APPLE__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __OPENCL_H */ 54 | -------------------------------------------------------------------------------- /v2.0/headers/opencl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2013 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_H 27 | #define __OPENCL_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #ifdef __APPLE__ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #endif 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __OPENCL_H */ 54 | -------------------------------------------------------------------------------- /sample/statinfo/statinfo.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/go-gl/cl/v1.2/cl" 5 | "log" 6 | "unsafe" 7 | ) 8 | 9 | const ( 10 | // DataSize is the size of the buffer for the string we're going to get back 11 | // from the CL device. 12 | DataSize = 1024 13 | ) 14 | 15 | func main() { 16 | StatInfo() 17 | } 18 | 19 | // StatInfo prints a bunch of usefull information about the currently available 20 | // CL devices 21 | func StatInfo() { 22 | ids := make([]cl.PlatformID, 100) 23 | actual := uint32(0) 24 | cl.GetPlatformIDs(uint32(len(ids)), &ids[0], &actual) 25 | for x := 0; x < int(actual); x++ { 26 | data := make([]byte, DataSize) 27 | size := uint64(0) 28 | cl.GetPlatformInfo(ids[x], cl.PLATFORM_PROFILE, DataSize, unsafe.Pointer(&data[0]), &size) 29 | profilestring := string(data[0:size]) 30 | cl.GetPlatformInfo(ids[x], cl.PLATFORM_VERSION, DataSize, unsafe.Pointer(&data[0]), &size) 31 | versionstring := string(data[0:size]) 32 | 33 | cl.GetPlatformInfo(ids[x], cl.PLATFORM_NAME, DataSize, unsafe.Pointer(&data[0]), &size) 34 | namestring := string(data[0:size]) 35 | cl.GetPlatformInfo(ids[x], cl.PLATFORM_VENDOR, DataSize, unsafe.Pointer(&data[0]), &size) 36 | vendorstring := string(data[0:size]) 37 | cl.GetPlatformInfo(ids[x], cl.PLATFORM_EXTENSIONS, DataSize, unsafe.Pointer(&data[0]), &size) 38 | extensionsstring := string(data[0:size]) 39 | log.Print("PLATFORM_PROFILE:\t\t", profilestring) 40 | log.Print("PLATFORM_VERSION:\t\t", versionstring) 41 | log.Print("PLATFORM_NAME:\t\t", namestring) 42 | log.Print("PLATFORM_VENDOR:\t\t", vendorstring) 43 | log.Print("PLATFORM_EXTENSIONS:\t", extensionsstring) 44 | 45 | devices := make([]cl.DeviceId, 100) 46 | actualDid := uint32(0) 47 | cl.GetDeviceIDs(ids[x], cl.DEVICE_TYPE_ALL, uint32(len(devices)), &devices[0], &actualDid) 48 | log.Println("Devices: ") 49 | for y := 0; y < int(actualDid); y++ { 50 | cl.GetDeviceInfo(devices[y], cl.DEVICE_NAME, DataSize, unsafe.Pointer(&data[0]), &size) 51 | deviceName := string(data[0:size]) 52 | log.Print("\tname: "+deviceName+" @ ", &devices[y]) 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /v1.0/headers/cl_gl_ext.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ 27 | /* OpenGL dependencies. */ 28 | 29 | #ifndef __OPENCL_CL_GL_EXT_H 30 | #define __OPENCL_CL_GL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | /* 43 | * For each extension, follow this template 44 | * /* cl_VEN_extname extension */ 45 | /* #define cl_VEN_extname 1 46 | * ... define new types, if any 47 | * ... define new tokens, if any 48 | * ... define new APIs, if any 49 | * 50 | * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header 51 | * This allows us to avoid having to decide whether to include GL headers or GLES here. 52 | */ 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __OPENCL_CL_GL_EXT_H */ -------------------------------------------------------------------------------- /v1.1/headers/cl_gl_ext.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ 27 | /* OpenGL dependencies. */ 28 | 29 | #ifndef __OPENCL_CL_GL_EXT_H 30 | #define __OPENCL_CL_GL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | /* 43 | * For each extension, follow this template 44 | * /* cl_VEN_extname extension */ 45 | /* #define cl_VEN_extname 1 46 | * ... define new types, if any 47 | * ... define new tokens, if any 48 | * ... define new APIs, if any 49 | * 50 | * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header 51 | * This allows us to avoid having to decide whether to include GL headers or GLES here. 52 | */ 53 | 54 | /* 55 | * cl_khr_gl_event extension 56 | * See section 9.9 in the OpenCL 1.1 spec for more information 57 | */ 58 | #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D 59 | 60 | extern CL_API_ENTRY cl_event CL_API_CALL 61 | clCreateEventFromGLsyncKHR(cl_context /* context */, 62 | cl_GLsync /* cl_GLsync */, 63 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* __OPENCL_CL_GL_EXT_H */ -------------------------------------------------------------------------------- /v1.2/headers/cl_gl_ext.h: -------------------------------------------------------------------------------- 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ 27 | /* OpenGL dependencies. */ 28 | 29 | #ifndef __OPENCL_CL_GL_EXT_H 30 | #define __OPENCL_CL_GL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | /* 43 | * For each extension, follow this template 44 | * cl_VEN_extname extension */ 45 | /* #define cl_VEN_extname 1 46 | * ... define new types, if any 47 | * ... define new tokens, if any 48 | * ... define new APIs, if any 49 | * 50 | * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header 51 | * This allows us to avoid having to decide whether to include GL headers or GLES here. 52 | */ 53 | 54 | /* 55 | * cl_khr_gl_event extension 56 | * See section 9.9 in the OpenCL 1.1 spec for more information 57 | */ 58 | #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D 59 | 60 | extern CL_API_ENTRY cl_event CL_API_CALL 61 | clCreateEventFromGLsyncKHR(cl_context /* context */, 62 | cl_GLsync /* cl_GLsync */, 63 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* __OPENCL_CL_GL_EXT_H */ -------------------------------------------------------------------------------- /v2.0/headers/cl_gl_ext.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008-2013 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ 27 | /* OpenGL dependencies. */ 28 | 29 | #ifndef __OPENCL_CL_GL_EXT_H 30 | #define __OPENCL_CL_GL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | /* 43 | * For each extension, follow this template 44 | * cl_VEN_extname extension */ 45 | /* #define cl_VEN_extname 1 46 | * ... define new types, if any 47 | * ... define new tokens, if any 48 | * ... define new APIs, if any 49 | * 50 | * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header 51 | * This allows us to avoid having to decide whether to include GL headers or GLES here. 52 | */ 53 | 54 | /* 55 | * cl_khr_gl_event extension 56 | * See section 9.9 in the OpenCL 1.1 spec for more information 57 | */ 58 | #define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D 59 | 60 | extern CL_API_ENTRY cl_event CL_API_CALL 61 | clCreateEventFromGLsyncKHR(cl_context /* context */, 62 | cl_GLsync /* cl_GLsync */, 63 | cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /* __OPENCL_CL_GL_EXT_H */ -------------------------------------------------------------------------------- /sample/square/square.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/go-gl/cl/v1.2/cl" 5 | "log" 6 | "math" 7 | "math/rand" 8 | "unsafe" 9 | ) 10 | 11 | const ( 12 | // DataSize is the size of the data we're going to pass to the CL device. 13 | DataSize = 1024 14 | ) 15 | 16 | // KernelSource is the source code of the program we're going to run. 17 | var KernelSource = ` 18 | __kernel void square( 19 | __global float* input, 20 | __global float* output, 21 | const unsigned int count) 22 | { 23 | int i = get_global_id(0); 24 | if(i < count) 25 | output[i] = input[i] * input[i]; 26 | }` + "\x00" 27 | 28 | func main() { 29 | 30 | data := make([]float32, DataSize) 31 | for x := 0; x < len(data); x++ { 32 | data[x] = rand.Float32()*99 + 1 33 | } 34 | 35 | //Get Device 36 | var device cl.DeviceId 37 | err := cl.GetDeviceIDs(nil, cl.DEVICE_TYPE_GPU, 1, &device, nil) 38 | if err != cl.SUCCESS { 39 | log.Fatal("Failed to create device group") 40 | } 41 | var errptr *cl.ErrorCode 42 | 43 | //Create Computer Context 44 | context := cl.CreateContext(nil, 1, &device, nil, nil, errptr) 45 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 46 | log.Fatal("couldnt create context") 47 | } 48 | defer cl.ReleaseContext(context) 49 | 50 | //Create Command Queue 51 | cq := cl.CreateCommandQueue(context, device, 0, errptr) 52 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 53 | log.Fatal("couldnt create command queue") 54 | } 55 | defer cl.ReleaseCommandQueue(cq) 56 | 57 | //Create program 58 | srcptr := cl.Str(KernelSource) 59 | program := cl.CreateProgramWithSource(context, 1, &srcptr, nil, errptr) 60 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 61 | log.Fatal("couldnt create program") 62 | } 63 | defer cl.ReleaseProgram(program) 64 | 65 | err = cl.BuildProgram(program, 1, &device, nil, nil, nil) 66 | if err != cl.SUCCESS { 67 | var length uint64 68 | buffer := make([]byte, DataSize) 69 | 70 | log.Println("Error: Failed to build program executable!") 71 | cl.GetProgramBuildInfo(program, device, cl.PROGRAM_BUILD_LOG, uint64(len(buffer)), unsafe.Pointer(&buffer[0]), &length) 72 | log.Fatal(string(buffer[0:length])) 73 | } 74 | 75 | //Get Kernel 76 | kernel := cl.CreateKernel(program, cl.Str("square"+"\x00"), errptr) 77 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 78 | log.Fatal("couldnt create compute kernel") 79 | } 80 | defer cl.ReleaseKernel(kernel) 81 | 82 | //Create buffers 83 | input := cl.CreateBuffer(context, cl.MEM_READ_ONLY, 4*DataSize, nil, errptr) 84 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 85 | log.Fatal("couldnt create input buffer") 86 | } 87 | defer cl.ReleaseMemObject(input) 88 | 89 | output := cl.CreateBuffer(context, cl.MEM_WRITE_ONLY, 4*DataSize, nil, errptr) 90 | if errptr != nil && cl.ErrorCode(*errptr) != cl.SUCCESS { 91 | log.Fatal("couldnt create output buffer") 92 | } 93 | defer cl.ReleaseMemObject(output) 94 | 95 | //Write data 96 | err = cl.EnqueueWriteBuffer(cq, input, cl.TRUE, 0, 4*DataSize, unsafe.Pointer(&data[0]), 0, nil, nil) 97 | if err != cl.SUCCESS { 98 | log.Fatal("Failed to write to source array") 99 | } 100 | 101 | //Set kernel args 102 | count := uint32(DataSize) 103 | err = cl.SetKernelArg(kernel, 0, 8, unsafe.Pointer(&input)) 104 | if err != cl.SUCCESS { 105 | log.Fatal("Failed to write kernel arg 0") 106 | } 107 | err = cl.SetKernelArg(kernel, 1, 8, unsafe.Pointer(&output)) 108 | if err != cl.SUCCESS { 109 | log.Fatal("Failed to write kernel arg 1") 110 | } 111 | err = cl.SetKernelArg(kernel, 2, 4, unsafe.Pointer(&count)) 112 | if err != cl.SUCCESS { 113 | log.Fatal("Failed to write kernel arg 2") 114 | } 115 | 116 | local := uint64(0) 117 | err = cl.GetKernelWorkGroupInfo(kernel, device, cl.KERNEL_WORK_GROUP_SIZE, 8, unsafe.Pointer(&local), nil) 118 | if err != cl.SUCCESS { 119 | log.Fatal("Failed to get kernel work group info") 120 | } 121 | 122 | global := local 123 | err = cl.EnqueueNDRangeKernel(cq, kernel, 1, nil, &global, &local, 0, nil, nil) 124 | if err != cl.SUCCESS { 125 | log.Fatal("Failed to execute kernel!") 126 | } 127 | 128 | cl.Finish(cq) 129 | 130 | results := make([]float32, DataSize) 131 | err = cl.EnqueueReadBuffer(cq, output, cl.TRUE, 0, 4*1024, unsafe.Pointer(&results[0]), 0, nil, nil) 132 | if err != cl.SUCCESS { 133 | log.Fatal("Failed to read buffer!") 134 | } 135 | 136 | success := 0 137 | notzero := 0 138 | for i, x := range data { 139 | if math.Abs(float64(x*x-results[i])) < 0.5 { 140 | success++ 141 | } 142 | if results[i] > 0 { 143 | notzero++ 144 | } 145 | log.Printf("I/O: %f\t%f", x, results[i]) 146 | } 147 | 148 | log.Printf("%d/%d success", success, DataSize) 149 | log.Printf("values not zero: %d", notzero) 150 | } 151 | -------------------------------------------------------------------------------- /v1.0/cl/convertion.go: -------------------------------------------------------------------------------- 1 | package cl 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | "unsafe" 7 | ) 8 | 9 | // #include 10 | import ( 11 | "C" 12 | ) 13 | 14 | var errormap = map[ErrorCode]string{ 15 | SUCCESS: "SUCCESS", 16 | DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND", 17 | DEVICE_NOT_AVAILABLE: "DEVICE_NOT_AVAILABLE", 18 | COMPILER_NOT_AVAILABLE: "COMPILER_NOT_AVAILABLE", 19 | MEM_OBJECT_ALLOCATION_FAILURE: "MEM_OBJECT_ALLOCATION_FAILURE", 20 | OUT_OF_RESOURCES: "OUT_OF_RESOURCES", 21 | OUT_OF_HOST_MEMORY: "OUT_OF_HOST_MEMORY", 22 | PROFILING_INFO_NOT_AVAILABLE: "PROFILING_INFO_NOT_AVAILABLE", 23 | MEM_COPY_OVERLAP: "MEM_COPY_OVERLAP", 24 | IMAGE_FORMAT_MISMATCH: "IMAGE_FORMAT_MISMATCH", 25 | IMAGE_FORMAT_NOT_SUPPORTED: "IMAGE_FORMAT_NOT_SUPPORTED", 26 | BUILD_PROGRAM_FAILURE: "BUILD_PROGRAM_FAILURE", 27 | MAP_FAILURE: "MAP_FAILURE", 28 | INVALID_VALUE: "INVALID_VALUE", 29 | INVALID_DEVICE_TYPE: "INVALID_DEVICE_TYPE", 30 | INVALID_PLATFORM: "INVALID_PLATFORM", 31 | INVALID_DEVICE: "INVALID_DEVICE", 32 | INVALID_CONTEXT: "INVALID_CONTEXT", 33 | INVALID_QUEUE_PROPERTIES: "INVALID_QUEUE_PROPERTIES", 34 | INVALID_COMMAND_QUEUE: "INVALID_COMMAND_QUEUE", 35 | INVALID_HOST_PTR: "INVALID_HOST_PTR", 36 | INVALID_MEM_OBJECT: "INVALID_MEM_OBJECT", 37 | INVALID_IMAGE_FORMAT_DESCRIPTOR: "INVALID_IMAGE_FORMAT_DESCRIPTOR", 38 | INVALID_IMAGE_SIZE: "INVALID_IMAGE_SIZE", 39 | INVALID_SAMPLER: "INVALID_SAMPLER", 40 | INVALID_BINARY: "INVALID_BINARY", 41 | INVALID_BUILD_OPTIONS: "INVALID_BUILD_OPTIONS", 42 | INVALID_PROGRAM: "INVALID_PROGRAM", 43 | INVALID_PROGRAM_EXECUTABLE: "INVALID_PROGRAM_EXECUTABLE", 44 | INVALID_KERNEL_NAME: "INVALID_KERNEL_NAME", 45 | INVALID_KERNEL_DEFINITION: "INVALID_KERNEL_DEFINITION", 46 | INVALID_KERNEL: "INVALID_KERNEL", 47 | INVALID_ARG_INDEX: "INVALID_ARG_INDEX", 48 | INVALID_ARG_VALUE: "INVALID_ARG_VALUE", 49 | INVALID_ARG_SIZE: "INVALID_ARG_SIZE", 50 | INVALID_KERNEL_ARGS: "INVALID_KERNEL_ARGS", 51 | INVALID_WORK_DIMENSION: "INVALID_WORK_DIMENSION", 52 | INVALID_WORK_GROUP_SIZE: "INVALID_WORK_GROUP_SIZE", 53 | INVALID_WORK_ITEM_SIZE: "INVALID_WORK_ITEM_SIZE", 54 | INVALID_GLOBAL_OFFSET: "INVALID_GLOBAL_OFFSET", 55 | INVALID_EVENT_WAIT_LIST: "INVALID_EVENT_WAIT_LIST", 56 | INVALID_EVENT: "INVALID_EVENT", 57 | INVALID_OPERATION: "INVALID_OPERATION", 58 | INVALID_GL_OBJECT: "INVALID_GL_OBJECT", 59 | INVALID_BUFFER_SIZE: "INVALID_BUFFER_SIZE", 60 | INVALID_MIP_LEVEL: "INVALID_MIP_LEVEL", 61 | INVALID_GLOBAL_WORK_SIZE: "INVALID_GLOBAL_WORK_SIZE", 62 | } 63 | 64 | // Str takes a null-terminated Go string and returns its GL-compatible address. 65 | // This function reaches into Go string storage in an unsafe way so the caller 66 | // must ensure the string is not garbage collected. 67 | func Str(str string) *uint8 { 68 | if !strings.HasSuffix(str, "\x00") { 69 | panic("str argument missing null terminator: " + str) 70 | } 71 | header := (*reflect.StringHeader)(unsafe.Pointer(&str)) 72 | return (*uint8)(unsafe.Pointer(header.Data)) 73 | } 74 | 75 | // ErrToStr returns a string that represents this error code. 76 | func ErrToStr(e ErrorCode) string { 77 | return errormap[e] 78 | } 79 | 80 | // Strs takes a list of Go strings (with or without null-termination) and 81 | // returns their C counterpart. 82 | // 83 | // The returned free function must be called once you are done using the strings 84 | // in order to free the memory. 85 | // 86 | // If no strings are provided as a parameter this function will panic. 87 | func Strs(strs ...string) (cstrs **uint8, free func()) { 88 | if len(strs) == 0 { 89 | panic("Strs: expected at least 1 string") 90 | } 91 | 92 | // Allocate a contiguous array large enough to hold all the strings' contents. 93 | n := 0 94 | for i := range strs { 95 | n += len(strs[i]) 96 | } 97 | data := C.malloc(C.size_t(n)) 98 | 99 | // Copy all the strings into data. 100 | dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 101 | Data: uintptr(data), 102 | Len: n, 103 | Cap: n, 104 | })) 105 | css := make([]*uint8, len(strs)) // Populated with pointers to each string. 106 | offset := 0 107 | for i := range strs { 108 | copy(dataSlice[offset:offset+len(strs[i])], strs[i][:]) // Copy strs[i] into proper data location. 109 | css[i] = (*uint8)(unsafe.Pointer(&dataSlice[offset])) // Set a pointer to it. 110 | offset += len(strs[i]) 111 | } 112 | 113 | return (**uint8)(&css[0]), func() { C.free(data) } 114 | } 115 | -------------------------------------------------------------------------------- /v1.1/cl/convertion.go: -------------------------------------------------------------------------------- 1 | package cl 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | "unsafe" 7 | ) 8 | 9 | // #include 10 | import ( 11 | "C" 12 | ) 13 | 14 | var errormap = map[ErrorCode]string{ 15 | SUCCESS: "SUCCESS", 16 | DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND", 17 | DEVICE_NOT_AVAILABLE: "DEVICE_NOT_AVAILABLE", 18 | COMPILER_NOT_AVAILABLE: "COMPILER_NOT_AVAILABLE", 19 | MEM_OBJECT_ALLOCATION_FAILURE: "MEM_OBJECT_ALLOCATION_FAILURE", 20 | OUT_OF_RESOURCES: "OUT_OF_RESOURCES", 21 | OUT_OF_HOST_MEMORY: "OUT_OF_HOST_MEMORY", 22 | PROFILING_INFO_NOT_AVAILABLE: "PROFILING_INFO_NOT_AVAILABLE", 23 | MEM_COPY_OVERLAP: "MEM_COPY_OVERLAP", 24 | IMAGE_FORMAT_MISMATCH: "IMAGE_FORMAT_MISMATCH", 25 | IMAGE_FORMAT_NOT_SUPPORTED: "IMAGE_FORMAT_NOT_SUPPORTED", 26 | BUILD_PROGRAM_FAILURE: "BUILD_PROGRAM_FAILURE", 27 | MAP_FAILURE: "MAP_FAILURE", 28 | MISALIGNED_SUB_BUFFER_OFFSET: "MISALIGNED_SUB_BUFFER_OFFSET", 29 | EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: "EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST", 30 | INVALID_VALUE: "INVALID_VALUE", 31 | INVALID_DEVICE_TYPE: "INVALID_DEVICE_TYPE", 32 | INVALID_PLATFORM: "INVALID_PLATFORM", 33 | INVALID_DEVICE: "INVALID_DEVICE", 34 | INVALID_CONTEXT: "INVALID_CONTEXT", 35 | INVALID_QUEUE_PROPERTIES: "INVALID_QUEUE_PROPERTIES", 36 | INVALID_COMMAND_QUEUE: "INVALID_COMMAND_QUEUE", 37 | INVALID_HOST_PTR: "INVALID_HOST_PTR", 38 | INVALID_MEM_OBJECT: "INVALID_MEM_OBJECT", 39 | INVALID_IMAGE_FORMAT_DESCRIPTOR: "INVALID_IMAGE_FORMAT_DESCRIPTOR", 40 | INVALID_IMAGE_SIZE: "INVALID_IMAGE_SIZE", 41 | INVALID_SAMPLER: "INVALID_SAMPLER", 42 | INVALID_BINARY: "INVALID_BINARY", 43 | INVALID_BUILD_OPTIONS: "INVALID_BUILD_OPTIONS", 44 | INVALID_PROGRAM: "INVALID_PROGRAM", 45 | INVALID_PROGRAM_EXECUTABLE: "INVALID_PROGRAM_EXECUTABLE", 46 | INVALID_KERNEL_NAME: "INVALID_KERNEL_NAME", 47 | INVALID_KERNEL_DEFINITION: "INVALID_KERNEL_DEFINITION", 48 | INVALID_KERNEL: "INVALID_KERNEL", 49 | INVALID_ARG_INDEX: "INVALID_ARG_INDEX", 50 | INVALID_ARG_VALUE: "INVALID_ARG_VALUE", 51 | INVALID_ARG_SIZE: "INVALID_ARG_SIZE", 52 | INVALID_KERNEL_ARGS: "INVALID_KERNEL_ARGS", 53 | INVALID_WORK_DIMENSION: "INVALID_WORK_DIMENSION", 54 | INVALID_WORK_GROUP_SIZE: "INVALID_WORK_GROUP_SIZE", 55 | INVALID_WORK_ITEM_SIZE: "INVALID_WORK_ITEM_SIZE", 56 | INVALID_GLOBAL_OFFSET: "INVALID_GLOBAL_OFFSET", 57 | INVALID_EVENT_WAIT_LIST: "INVALID_EVENT_WAIT_LIST", 58 | INVALID_EVENT: "INVALID_EVENT", 59 | INVALID_OPERATION: "INVALID_OPERATION", 60 | INVALID_GL_OBJECT: "INVALID_GL_OBJECT", 61 | INVALID_BUFFER_SIZE: "INVALID_BUFFER_SIZE", 62 | INVALID_MIP_LEVEL: "INVALID_MIP_LEVEL", 63 | INVALID_GLOBAL_WORK_SIZE: "INVALID_GLOBAL_WORK_SIZE", 64 | INVALID_PROPERTY: "INVALID_PROPERTY", 65 | } 66 | 67 | // Str takes a null-terminated Go string and returns its GL-compatible address. 68 | // This function reaches into Go string storage in an unsafe way so the caller 69 | // must ensure the string is not garbage collected. 70 | func Str(str string) *uint8 { 71 | if !strings.HasSuffix(str, "\x00") { 72 | panic("str argument missing null terminator: " + str) 73 | } 74 | header := (*reflect.StringHeader)(unsafe.Pointer(&str)) 75 | return (*uint8)(unsafe.Pointer(header.Data)) 76 | } 77 | 78 | // ErrToStr returns a string that represents this error code. 79 | func ErrToStr(e ErrorCode) string { 80 | return errormap[e] 81 | } 82 | 83 | // Strs takes a list of Go strings (with or without null-termination) and 84 | // returns their C counterpart. 85 | // 86 | // The returned free function must be called once you are done using the strings 87 | // in order to free the memory. 88 | // 89 | // If no strings are provided as a parameter this function will panic. 90 | func Strs(strs ...string) (cstrs **uint8, free func()) { 91 | if len(strs) == 0 { 92 | panic("Strs: expected at least 1 string") 93 | } 94 | 95 | // Allocate a contiguous array large enough to hold all the strings' contents. 96 | n := 0 97 | for i := range strs { 98 | n += len(strs[i]) 99 | } 100 | data := C.malloc(C.size_t(n)) 101 | 102 | // Copy all the strings into data. 103 | dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 104 | Data: uintptr(data), 105 | Len: n, 106 | Cap: n, 107 | })) 108 | css := make([]*uint8, len(strs)) // Populated with pointers to each string. 109 | offset := 0 110 | for i := range strs { 111 | copy(dataSlice[offset:offset+len(strs[i])], strs[i][:]) // Copy strs[i] into proper data location. 112 | css[i] = (*uint8)(unsafe.Pointer(&dataSlice[offset])) // Set a pointer to it. 113 | offset += len(strs[i]) 114 | } 115 | 116 | return (**uint8)(&css[0]), func() { C.free(data) } 117 | } 118 | -------------------------------------------------------------------------------- /v1.2/cl/convertion.go: -------------------------------------------------------------------------------- 1 | package cl 2 | 3 | import ( 4 | "reflect" 5 | "strings" 6 | "unsafe" 7 | ) 8 | 9 | // #include 10 | import ( 11 | "C" 12 | ) 13 | 14 | var errormap = map[ErrorCode]string{ 15 | SUCCESS: "SUCCESS", 16 | DEVICE_NOT_FOUND: "DEVICE_NOT_FOUND", 17 | DEVICE_NOT_AVAILABLE: "DEVICE_NOT_AVAILABLE", 18 | COMPILER_NOT_AVAILABLE: "COMPILER_NOT_AVAILABLE", 19 | MEM_OBJECT_ALLOCATION_FAILURE: "MEM_OBJECT_ALLOCATION_FAILURE", 20 | OUT_OF_RESOURCES: "OUT_OF_RESOURCES", 21 | OUT_OF_HOST_MEMORY: "OUT_OF_HOST_MEMORY", 22 | PROFILING_INFO_NOT_AVAILABLE: "PROFILING_INFO_NOT_AVAILABLE", 23 | MEM_COPY_OVERLAP: "MEM_COPY_OVERLAP", 24 | IMAGE_FORMAT_MISMATCH: "IMAGE_FORMAT_MISMATCH", 25 | IMAGE_FORMAT_NOT_SUPPORTED: "IMAGE_FORMAT_NOT_SUPPORTED", 26 | BUILD_PROGRAM_FAILURE: "BUILD_PROGRAM_FAILURE", 27 | MAP_FAILURE: "MAP_FAILURE", 28 | MISALIGNED_SUB_BUFFER_OFFSET: "MISALIGNED_SUB_BUFFER_OFFSET", 29 | EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: "EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST", 30 | COMPILE_PROGRAM_FAILURE: "COMPILE_PROGRAM_FAILURE", 31 | LINKER_NOT_AVAILABLE: "LINKER_NOT_AVAILABLE", 32 | LINK_PROGRAM_FAILURE: "LINK_PROGRAM_FAILURE", 33 | DEVICE_PARTITION_FAILED: "DEVICE_PARTITION_FAILED", 34 | KERNEL_ARG_INFO_NOT_AVAILABLE: "KERNEL_ARG_INFO_NOT_AVAILABLE", 35 | INVALID_VALUE: "INVALID_VALUE", 36 | INVALID_DEVICE_TYPE: "INVALID_DEVICE_TYPE", 37 | INVALID_PLATFORM: "INVALID_PLATFORM", 38 | INVALID_DEVICE: "INVALID_DEVICE", 39 | INVALID_CONTEXT: "INVALID_CONTEXT", 40 | INVALID_QUEUE_PROPERTIES: "INVALID_QUEUE_PROPERTIES", 41 | INVALID_COMMAND_QUEUE: "INVALID_COMMAND_QUEUE", 42 | INVALID_HOST_PTR: "INVALID_HOST_PTR", 43 | INVALID_MEM_OBJECT: "INVALID_MEM_OBJECT", 44 | INVALID_IMAGE_FORMAT_DESCRIPTOR: "INVALID_IMAGE_FORMAT_DESCRIPTOR", 45 | INVALID_IMAGE_SIZE: "INVALID_IMAGE_SIZE", 46 | INVALID_SAMPLER: "INVALID_SAMPLER", 47 | INVALID_BINARY: "INVALID_BINARY", 48 | INVALID_BUILD_OPTIONS: "INVALID_BUILD_OPTIONS", 49 | INVALID_PROGRAM: "INVALID_PROGRAM", 50 | INVALID_PROGRAM_EXECUTABLE: "INVALID_PROGRAM_EXECUTABLE", 51 | INVALID_KERNEL_NAME: "INVALID_KERNEL_NAME", 52 | INVALID_KERNEL_DEFINITION: "INVALID_KERNEL_DEFINITION", 53 | INVALID_KERNEL: "INVALID_KERNEL", 54 | INVALID_ARG_INDEX: "INVALID_ARG_INDEX", 55 | INVALID_ARG_VALUE: "INVALID_ARG_VALUE", 56 | INVALID_ARG_SIZE: "INVALID_ARG_SIZE", 57 | INVALID_KERNEL_ARGS: "INVALID_KERNEL_ARGS", 58 | INVALID_WORK_DIMENSION: "INVALID_WORK_DIMENSION", 59 | INVALID_WORK_GROUP_SIZE: "INVALID_WORK_GROUP_SIZE", 60 | INVALID_WORK_ITEM_SIZE: "INVALID_WORK_ITEM_SIZE", 61 | INVALID_GLOBAL_OFFSET: "INVALID_GLOBAL_OFFSET", 62 | INVALID_EVENT_WAIT_LIST: "INVALID_EVENT_WAIT_LIST", 63 | INVALID_EVENT: "INVALID_EVENT", 64 | INVALID_OPERATION: "INVALID_OPERATION", 65 | INVALID_GL_OBJECT: "INVALID_GL_OBJECT", 66 | INVALID_BUFFER_SIZE: "INVALID_BUFFER_SIZE", 67 | INVALID_MIP_LEVEL: "INVALID_MIP_LEVEL", 68 | INVALID_GLOBAL_WORK_SIZE: "INVALID_GLOBAL_WORK_SIZE", 69 | INVALID_PROPERTY: "INVALID_PROPERTY", 70 | INVALID_IMAGE_DESCRIPTOR: "INVALID_IMAGE_DESCRIPTOR", 71 | INVALID_COMPILER_OPTIONS: "INVALID_COMPILER_OPTIONS", 72 | INVALID_LINKER_OPTIONS: "INVALID_LINKER_OPTIONS", 73 | INVALID_DEVICE_PARTITION_COUNT: "INVALID_DEVICE_PARTITION_COUNT", 74 | } 75 | 76 | // Str takes a null-terminated Go string and returns its GL-compatible address. 77 | // This function reaches into Go string storage in an unsafe way so the caller 78 | // must ensure the string is not garbage collected. 79 | func Str(str string) *uint8 { 80 | if !strings.HasSuffix(str, "\x00") { 81 | panic("str argument missing null terminator: " + str) 82 | } 83 | header := (*reflect.StringHeader)(unsafe.Pointer(&str)) 84 | return (*uint8)(unsafe.Pointer(header.Data)) 85 | } 86 | 87 | // ErrToStr returns a string that represents this error code. 88 | func ErrToStr(e ErrorCode) string { 89 | return errormap[e] 90 | } 91 | 92 | // Strs takes a list of Go strings (with or without null-termination) and 93 | // returns their C counterpart. 94 | // 95 | // The returned free function must be called once you are done using the strings 96 | // in order to free the memory. 97 | // 98 | // If no strings are provided as a parameter this function will panic. 99 | func Strs(strs ...string) (cstrs **uint8, free func()) { 100 | if len(strs) == 0 { 101 | panic("Strs: expected at least 1 string") 102 | } 103 | 104 | // Allocate a contiguous array large enough to hold all the strings' contents. 105 | n := 0 106 | for i := range strs { 107 | n += len(strs[i]) 108 | } 109 | data := C.malloc(C.size_t(n)) 110 | 111 | // Copy all the strings into data. 112 | dataSlice := *(*[]byte)(unsafe.Pointer(&reflect.SliceHeader{ 113 | Data: uintptr(data), 114 | Len: n, 115 | Cap: n, 116 | })) 117 | css := make([]*uint8, len(strs)) // Populated with pointers to each string. 118 | offset := 0 119 | for i := range strs { 120 | copy(dataSlice[offset:offset+len(strs[i])], strs[i][:]) // Copy strs[i] into proper data location. 121 | css[i] = (*uint8)(unsafe.Pointer(&dataSlice[offset])) // Set a pointer to it. 122 | offset += len(strs[i]) 123 | } 124 | 125 | return (**uint8)(&css[0]), func() { C.free(data) } 126 | } 127 | -------------------------------------------------------------------------------- /v1.0/headers/cl_gl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* 27 | * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have 28 | * OpenGL dependencies. The application is responsible for #including 29 | * OpenGL or OpenGL ES headers before #including cl_gl.h. 30 | */ 31 | 32 | #ifndef __OPENCL_CL_GL_H 33 | #define __OPENCL_CL_GL_H 34 | 35 | #ifdef __APPLE__ 36 | #include 37 | #else 38 | #include 39 | #endif 40 | 41 | #ifdef __cplusplus 42 | extern "C" { 43 | #endif 44 | 45 | typedef cl_uint cl_gl_object_type; 46 | typedef cl_uint cl_gl_texture_info; 47 | typedef cl_uint cl_gl_platform_info; 48 | 49 | /* cl_gl_object_type */ 50 | #define CL_GL_OBJECT_BUFFER 0x2000 51 | #define CL_GL_OBJECT_TEXTURE2D 0x2001 52 | #define CL_GL_OBJECT_TEXTURE3D 0x2002 53 | #define CL_GL_OBJECT_RENDERBUFFER 0x2003 54 | 55 | /* cl_gl_texture_info */ 56 | #define CL_GL_TEXTURE_TARGET 0x2004 57 | #define CL_GL_MIPMAP_LEVEL 0x2005 58 | 59 | extern CL_API_ENTRY cl_mem CL_API_CALL 60 | clCreateFromGLBuffer(cl_context /* context */, 61 | cl_mem_flags /* flags */, 62 | cl_GLuint /* bufobj */, 63 | int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 64 | 65 | extern CL_API_ENTRY cl_mem CL_API_CALL 66 | clCreateFromGLTexture2D(cl_context /* context */, 67 | cl_mem_flags /* flags */, 68 | cl_GLenum /* target */, 69 | cl_GLint /* miplevel */, 70 | cl_GLuint /* texture */, 71 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 72 | 73 | extern CL_API_ENTRY cl_mem CL_API_CALL 74 | clCreateFromGLTexture3D(cl_context /* context */, 75 | cl_mem_flags /* flags */, 76 | cl_GLenum /* target */, 77 | cl_GLint /* miplevel */, 78 | cl_GLuint /* texture */, 79 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 80 | 81 | extern CL_API_ENTRY cl_mem CL_API_CALL 82 | clCreateFromGLRenderbuffer(cl_context /* context */, 83 | cl_mem_flags /* flags */, 84 | cl_GLuint /* renderbuffer */, 85 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 86 | 87 | extern CL_API_ENTRY cl_int CL_API_CALL 88 | clGetGLObjectInfo(cl_mem /* memobj */, 89 | cl_gl_object_type * /* gl_object_type */, 90 | cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; 91 | 92 | extern CL_API_ENTRY cl_int CL_API_CALL 93 | clGetGLTextureInfo(cl_mem /* memobj */, 94 | cl_gl_texture_info /* param_name */, 95 | size_t /* param_value_size */, 96 | void * /* param_value */, 97 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 98 | 99 | extern CL_API_ENTRY cl_int CL_API_CALL 100 | clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */, 101 | cl_uint /* num_objects */, 102 | const cl_mem * /* mem_objects */, 103 | cl_uint /* num_events_in_wait_list */, 104 | const cl_event * /* event_wait_list */, 105 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 106 | 107 | extern CL_API_ENTRY cl_int CL_API_CALL 108 | clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, 109 | cl_uint /* num_objects */, 110 | const cl_mem * /* mem_objects */, 111 | cl_uint /* num_events_in_wait_list */, 112 | const cl_event * /* event_wait_list */, 113 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 114 | 115 | /* cl_khr_gl_sharing extension */ 116 | 117 | #define cl_khr_gl_sharing 1 118 | 119 | typedef cl_uint cl_gl_context_info; 120 | 121 | /* Additional Error Codes */ 122 | #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 123 | 124 | /* cl_gl_context_info */ 125 | #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 126 | #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 127 | 128 | /* Additional cl_context_properties */ 129 | #define CL_GL_CONTEXT_KHR 0x2008 130 | #define CL_EGL_DISPLAY_KHR 0x2009 131 | #define CL_GLX_DISPLAY_KHR 0x200A 132 | #define CL_WGL_HDC_KHR 0x200B 133 | #define CL_CGL_SHAREGROUP_KHR 0x200C 134 | 135 | extern CL_API_ENTRY cl_int CL_API_CALL 136 | clGetGLContextInfoKHR(const cl_context_properties * /* properties */, 137 | cl_gl_context_info /* param_name */, 138 | size_t /* param_value_size */, 139 | void * /* param_value */, 140 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 141 | 142 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( 143 | const cl_context_properties * properties, 144 | cl_gl_context_info param_name, 145 | size_t param_value_size, 146 | void * param_value, 147 | size_t * param_value_size_ret); 148 | 149 | #ifdef __cplusplus 150 | } 151 | #endif 152 | 153 | #endif /* __OPENCL_CL_GL_H */ -------------------------------------------------------------------------------- /v1.1/headers/cl_gl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | /* 27 | * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have 28 | * OpenGL dependencies. The application is responsible for #including 29 | * OpenGL or OpenGL ES headers before #including cl_gl.h. 30 | */ 31 | 32 | #ifndef __OPENCL_CL_GL_H 33 | #define __OPENCL_CL_GL_H 34 | 35 | #ifdef __APPLE__ 36 | #include 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | typedef cl_uint cl_gl_object_type; 47 | typedef cl_uint cl_gl_texture_info; 48 | typedef cl_uint cl_gl_platform_info; 49 | typedef struct __GLsync *cl_GLsync; 50 | 51 | /* cl_gl_object_type */ 52 | #define CL_GL_OBJECT_BUFFER 0x2000 53 | #define CL_GL_OBJECT_TEXTURE2D 0x2001 54 | #define CL_GL_OBJECT_TEXTURE3D 0x2002 55 | #define CL_GL_OBJECT_RENDERBUFFER 0x2003 56 | 57 | /* cl_gl_texture_info */ 58 | #define CL_GL_TEXTURE_TARGET 0x2004 59 | #define CL_GL_MIPMAP_LEVEL 0x2005 60 | 61 | extern CL_API_ENTRY cl_mem CL_API_CALL 62 | clCreateFromGLBuffer(cl_context /* context */, 63 | cl_mem_flags /* flags */, 64 | cl_GLuint /* bufobj */, 65 | int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 66 | 67 | extern CL_API_ENTRY cl_mem CL_API_CALL 68 | clCreateFromGLTexture2D(cl_context /* context */, 69 | cl_mem_flags /* flags */, 70 | cl_GLenum /* target */, 71 | cl_GLint /* miplevel */, 72 | cl_GLuint /* texture */, 73 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 74 | 75 | extern CL_API_ENTRY cl_mem CL_API_CALL 76 | clCreateFromGLTexture3D(cl_context /* context */, 77 | cl_mem_flags /* flags */, 78 | cl_GLenum /* target */, 79 | cl_GLint /* miplevel */, 80 | cl_GLuint /* texture */, 81 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 82 | 83 | extern CL_API_ENTRY cl_mem CL_API_CALL 84 | clCreateFromGLRenderbuffer(cl_context /* context */, 85 | cl_mem_flags /* flags */, 86 | cl_GLuint /* renderbuffer */, 87 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 88 | 89 | extern CL_API_ENTRY cl_int CL_API_CALL 90 | clGetGLObjectInfo(cl_mem /* memobj */, 91 | cl_gl_object_type * /* gl_object_type */, 92 | cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; 93 | 94 | extern CL_API_ENTRY cl_int CL_API_CALL 95 | clGetGLTextureInfo(cl_mem /* memobj */, 96 | cl_gl_texture_info /* param_name */, 97 | size_t /* param_value_size */, 98 | void * /* param_value */, 99 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 100 | 101 | extern CL_API_ENTRY cl_int CL_API_CALL 102 | clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */, 103 | cl_uint /* num_objects */, 104 | const cl_mem * /* mem_objects */, 105 | cl_uint /* num_events_in_wait_list */, 106 | const cl_event * /* event_wait_list */, 107 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 108 | 109 | extern CL_API_ENTRY cl_int CL_API_CALL 110 | clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, 111 | cl_uint /* num_objects */, 112 | const cl_mem * /* mem_objects */, 113 | cl_uint /* num_events_in_wait_list */, 114 | const cl_event * /* event_wait_list */, 115 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 116 | 117 | /* cl_khr_gl_sharing extension */ 118 | 119 | #define cl_khr_gl_sharing 1 120 | 121 | typedef cl_uint cl_gl_context_info; 122 | 123 | /* Additional Error Codes */ 124 | #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 125 | 126 | /* cl_gl_context_info */ 127 | #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 128 | #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 129 | 130 | /* Additional cl_context_properties */ 131 | #define CL_GL_CONTEXT_KHR 0x2008 132 | #define CL_EGL_DISPLAY_KHR 0x2009 133 | #define CL_GLX_DISPLAY_KHR 0x200A 134 | #define CL_WGL_HDC_KHR 0x200B 135 | #define CL_CGL_SHAREGROUP_KHR 0x200C 136 | 137 | extern CL_API_ENTRY cl_int CL_API_CALL 138 | clGetGLContextInfoKHR(const cl_context_properties * /* properties */, 139 | cl_gl_context_info /* param_name */, 140 | size_t /* param_value_size */, 141 | void * /* param_value */, 142 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 143 | 144 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( 145 | 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); 150 | 151 | #ifdef __cplusplus 152 | } 153 | #endif 154 | 155 | #endif /* __OPENCL_CL_GL_H */ -------------------------------------------------------------------------------- /v1.0/headers/cl_ext.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11702 $ on $Date: 2010-06-11 19:44:29 -0700 (Fri, 11 Jun 2010) $ */ 25 | 26 | /* cl_ext.h contains OpenCL extensions which don't have external */ 27 | /* (OpenGL, D3D) dependencies. */ 28 | 29 | #ifndef __CL_EXT_H 30 | #define __CL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #else 39 | #include 40 | #endif 41 | 42 | /* cl_khr_fp64 extension - no extension #define since it has no functions */ 43 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 44 | 45 | 46 | /* cl_khr_fp16 extension - no extension #define since it has no functions */ 47 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 48 | 49 | 50 | /* cl_khr_icd extension */ 51 | #define cl_khr_icd 1 52 | 53 | /* cl_platform_info */ 54 | #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 55 | 56 | /* Additional Error Codes */ 57 | #define CL_PLATFORM_NOT_FOUND_KHR -1001 58 | 59 | extern CL_API_ENTRY cl_int CL_API_CALL 60 | clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, 61 | cl_platform_id * /* platforms */, 62 | cl_uint * /* num_platforms */); 63 | 64 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( 65 | cl_uint num_entries, 66 | cl_platform_id * platforms, 67 | cl_uint * num_platforms); 68 | 69 | /* cl_amd_device_attribute_query - no extension #define since it has no functions */ 70 | #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 71 | 72 | /*********************************** 73 | * cl_ext_device_fission extension * 74 | ***********************************/ 75 | #ifndef cl_ext_device_fission 76 | #define cl_ext_device_fission 1 77 | 78 | extern CL_API_ENTRY cl_int CL_API_CALL 79 | clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXTENSION_WEAK_LINK; 80 | 81 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clReleaseDeviceEXT_fn)( 82 | cl_device_id /*device*/ ) CL_EXTENSION_WEAK_LINK; 83 | 84 | extern CL_API_ENTRY cl_int CL_API_CALL 85 | clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXTENSION_WEAK_LINK; 86 | 87 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clRetainDeviceEXT_fn)( 88 | cl_device_id /*device*/ ) CL_EXTENSION_WEAK_LINK; 89 | 90 | typedef cl_ulong cl_device_partition_property_ext; 91 | 92 | extern CL_API_ENTRY cl_int CL_API_CALL 93 | clCreateSubDevicesEXT( 94 | cl_device_id /*in_device*/, 95 | const cl_device_partition_property_ext * /* properties */, 96 | cl_uint /*num_entries*/, 97 | cl_device_id * /*out_devices*/, 98 | cl_uint * /*num_devices*/ ) CL_EXTENSION_WEAK_LINK; 99 | 100 | typedef CL_API_ENTRY cl_int (CL_API_CALL * clCreateSubDevicesEXT_fn)( 101 | cl_device_id /*in_device*/, 102 | const cl_device_partition_property_ext * /* properties */, 103 | cl_uint /*num_entries*/, 104 | cl_device_id * /*out_devices*/, 105 | cl_uint * /*num_devices*/ ) CL_EXTENSION_WEAK_LINK; 106 | 107 | /* cl_device_partition_property_ext */ 108 | #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 109 | #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 110 | #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 111 | #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 112 | 113 | /* clDeviceGetInfo selectors */ 114 | #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 115 | #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 116 | #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 117 | #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 118 | #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 119 | 120 | /* error codes */ 121 | #define CL_DEVICE_PARTITION_FAILED_EXT -1057 122 | #define CL_INVALID_PARTITION_COUNT_EXT -1058 123 | #define CL_INVALID_PARTITION_NAME_EXT -1059 124 | 125 | /* CL_AFFINITY_DOMAINs */ 126 | #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 127 | #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 128 | #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 129 | #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 130 | #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 131 | #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 132 | 133 | /* cl_device_partition_property_ext list terminators */ 134 | #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) 135 | #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) 136 | #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) 137 | 138 | #endif /* cl_ext_device_fission */ 139 | 140 | /*********************************** 141 | * cl_ext_migrate_memobject extension definitions 142 | ***********************************/ 143 | #ifndef cl_ext_migrate_memobject 144 | #define cl_ext_migrate_memobject 1 145 | 146 | typedef cl_bitfield cl_mem_migration_flags_ext; 147 | 148 | #define CL_MIGRATE_MEM_OBJECT_HOST_EXT 0x1 149 | 150 | #define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040 151 | 152 | extern CL_API_ENTRY cl_int CL_API_CALL 153 | clEnqueueMigrateMemObjectEXT( 154 | cl_command_queue /* command_queue */, 155 | cl_uint /* num_mem_objects */, 156 | const cl_mem * /* mem_objects */, 157 | cl_mem_migration_flags_ext /* flags */, 158 | cl_uint /* num_events_in_wait_list */, 159 | const cl_event * /* event_wait_list */, 160 | cl_event * /* event */); 161 | 162 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)( 163 | cl_command_queue /* command_queue */, 164 | cl_uint /* num_mem_objects */, 165 | const cl_mem * /* mem_objects */, 166 | cl_mem_migration_flags_ext /* flags */, 167 | cl_uint /* num_events_in_wait_list */, 168 | const cl_event * /* event_wait_list */, 169 | cl_event * /* event */); 170 | 171 | #endif /* cl_ext_migrate_memobject */ 172 | 173 | #ifdef __cplusplus 174 | } 175 | #endif 176 | 177 | 178 | #endif /* __CL_EXT_H */ -------------------------------------------------------------------------------- /v1.2/headers/cl_gl.h: -------------------------------------------------------------------------------- 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 29 | #else 30 | #include 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef cl_uint cl_gl_object_type; 38 | typedef cl_uint cl_gl_texture_info; 39 | typedef cl_uint cl_gl_platform_info; 40 | typedef 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 | 58 | extern CL_API_ENTRY cl_mem CL_API_CALL 59 | clCreateFromGLBuffer(cl_context /* context */, 60 | cl_mem_flags /* flags */, 61 | cl_GLuint /* bufobj */, 62 | int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 63 | 64 | extern CL_API_ENTRY cl_mem CL_API_CALL 65 | clCreateFromGLTexture(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 | 72 | extern CL_API_ENTRY cl_mem CL_API_CALL 73 | clCreateFromGLRenderbuffer(cl_context /* context */, 74 | cl_mem_flags /* flags */, 75 | cl_GLuint /* renderbuffer */, 76 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 77 | 78 | extern CL_API_ENTRY cl_int CL_API_CALL 79 | clGetGLObjectInfo(cl_mem /* memobj */, 80 | cl_gl_object_type * /* gl_object_type */, 81 | cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; 82 | 83 | extern CL_API_ENTRY cl_int CL_API_CALL 84 | clGetGLTextureInfo(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 | 90 | extern CL_API_ENTRY cl_int CL_API_CALL 91 | clEnqueueAcquireGLObjects(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 | 98 | extern CL_API_ENTRY cl_int CL_API_CALL 99 | clEnqueueReleaseGLObjects(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 */ 108 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 109 | clCreateFromGLTexture2D(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 | 116 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 117 | clCreateFromGLTexture3D(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 | 128 | typedef 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 | 144 | extern CL_API_ENTRY cl_int CL_API_CALL 145 | clGetGLContextInfoKHR(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 | 151 | typedef 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 */ -------------------------------------------------------------------------------- /v2.0/headers/cl_gl.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * Copyright (c) 2008 - 2013 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 29 | #else 30 | #include 31 | #endif 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | typedef cl_uint cl_gl_object_type; 38 | typedef cl_uint cl_gl_texture_info; 39 | typedef cl_uint cl_gl_platform_info; 40 | typedef 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 | 58 | extern CL_API_ENTRY cl_mem CL_API_CALL 59 | clCreateFromGLBuffer(cl_context /* context */, 60 | cl_mem_flags /* flags */, 61 | cl_GLuint /* bufobj */, 62 | int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 63 | 64 | extern CL_API_ENTRY cl_mem CL_API_CALL 65 | clCreateFromGLTexture(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 | 72 | extern CL_API_ENTRY cl_mem CL_API_CALL 73 | clCreateFromGLRenderbuffer(cl_context /* context */, 74 | cl_mem_flags /* flags */, 75 | cl_GLuint /* renderbuffer */, 76 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 77 | 78 | extern CL_API_ENTRY cl_int CL_API_CALL 79 | clGetGLObjectInfo(cl_mem /* memobj */, 80 | cl_gl_object_type * /* gl_object_type */, 81 | cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; 82 | 83 | extern CL_API_ENTRY cl_int CL_API_CALL 84 | clGetGLTextureInfo(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 | 90 | extern CL_API_ENTRY cl_int CL_API_CALL 91 | clEnqueueAcquireGLObjects(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 | 98 | extern CL_API_ENTRY cl_int CL_API_CALL 99 | clEnqueueReleaseGLObjects(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 */ 108 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 109 | clCreateFromGLTexture2D(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 | 116 | extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL 117 | clCreateFromGLTexture3D(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 | 128 | typedef 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 | 144 | extern CL_API_ENTRY cl_int CL_API_CALL 145 | clGetGLContextInfoKHR(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 | 151 | typedef 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 */ -------------------------------------------------------------------------------- /v1.2/cl/package_test.go: -------------------------------------------------------------------------------- 1 | package cl 2 | 3 | import ( 4 | "log" 5 | "testing" 6 | "unsafe" 7 | ) 8 | 9 | const ( 10 | PlatformInfoBufferSize = 1024 11 | DeviceInfoBufferSize = 1024 12 | ) 13 | 14 | func TestGetPlatformIDs(t *testing.T) { 15 | ids := make([]PlatformID, 100) 16 | actual := uint32(0) 17 | err := GetPlatformIDs(uint32(len(ids)), &ids[0], &actual) 18 | if err != SUCCESS { 19 | t.Fail() 20 | } 21 | } 22 | 23 | func getAnyPlatform() PlatformID { 24 | ids := make([]PlatformID, 1) 25 | actual := uint32(0) 26 | err := GetPlatformIDs(uint32(len(ids)), &ids[0], &actual) 27 | if err != SUCCESS { 28 | return nil 29 | } 30 | return ids[0] 31 | } 32 | 33 | func TestGetPlatformInfo(t *testing.T) { 34 | platform := getAnyPlatform() 35 | data := make([]byte, PlatformInfoBufferSize) 36 | dataptr := unsafe.Pointer(&data[0]) 37 | size := uint64(0) 38 | 39 | err := GetPlatformInfo(platform, PLATFORM_PROFILE, PlatformInfoBufferSize, dataptr, &size) 40 | if err != SUCCESS { 41 | t.Fail() 42 | } 43 | err = GetPlatformInfo(platform, PLATFORM_VERSION, PlatformInfoBufferSize, dataptr, &size) 44 | if err != SUCCESS { 45 | t.Fail() 46 | } 47 | err = GetPlatformInfo(platform, PLATFORM_NAME, PlatformInfoBufferSize, dataptr, &size) 48 | if err != SUCCESS { 49 | t.Fail() 50 | } 51 | err = GetPlatformInfo(platform, PLATFORM_VENDOR, PlatformInfoBufferSize, dataptr, &size) 52 | if err != SUCCESS { 53 | t.Fail() 54 | } 55 | err = GetPlatformInfo(platform, PLATFORM_EXTENSIONS, PlatformInfoBufferSize, dataptr, &size) 56 | if err != SUCCESS { 57 | t.Fail() 58 | } 59 | } 60 | 61 | func TestGetAndReleaseDeviceIDs(t *testing.T) { 62 | devices := make([]DeviceId, 100) 63 | actualDid := uint32(0) 64 | err := GetDeviceIDs(getAnyPlatform(), DEVICE_TYPE_ALL, uint32(len(devices)), &devices[0], &actualDid) 65 | if err != SUCCESS { 66 | t.Fail() 67 | } 68 | for x := 0; x < int(actualDid); x++ { 69 | err = ReleaseDevice(devices[x]) 70 | if err != SUCCESS { 71 | log.Println(err) 72 | t.Fail() 73 | } 74 | } 75 | } 76 | 77 | func getGPUDevice() DeviceId { 78 | devices := make([]DeviceId, 1) 79 | actualDid := uint32(0) 80 | err := GetDeviceIDs(getAnyPlatform(), DEVICE_TYPE_GPU, uint32(len(devices)), &devices[0], &actualDid) 81 | if err != SUCCESS { 82 | return nil 83 | } 84 | return devices[0] 85 | } 86 | 87 | func TestGetDeviceInfo(t *testing.T) { 88 | device := getGPUDevice() 89 | data := make([]byte, PlatformInfoBufferSize) 90 | dataptr := unsafe.Pointer(&data[0]) 91 | size := uint64(0) 92 | 93 | infos := [...]DeviceInfo{DEVICE_TYPE, DEVICE_VENDOR_ID, DEVICE_MAX_COMPUTE_UNITS, DEVICE_MAX_WORK_ITEM_DIMENSIONS, DEVICE_MAX_WORK_GROUP_SIZE, DEVICE_MAX_WORK_ITEM_SIZES, DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, DEVICE_PREFERRED_VECTOR_WIDTH_INT, DEVICE_PREFERRED_VECTOR_WIDTH_LONG, DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, DEVICE_MAX_CLOCK_FREQUENCY, DEVICE_ADDRESS_BITS, DEVICE_MAX_READ_IMAGE_ARGS, DEVICE_MAX_WRITE_IMAGE_ARGS, DEVICE_MAX_MEM_ALLOC_SIZE, DEVICE_IMAGE2D_MAX_WIDTH, DEVICE_IMAGE2D_MAX_HEIGHT, DEVICE_IMAGE3D_MAX_WIDTH, DEVICE_IMAGE3D_MAX_HEIGHT, DEVICE_IMAGE3D_MAX_DEPTH, DEVICE_IMAGE_SUPPORT, DEVICE_MAX_PARAMETER_SIZE, DEVICE_MAX_SAMPLERS, DEVICE_MEM_BASE_ADDR_ALIGN, DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, DEVICE_SINGLE_FP_CONFIG, DEVICE_GLOBAL_MEM_CACHE_TYPE, DEVICE_GLOBAL_MEM_CACHELINE_SIZE, DEVICE_GLOBAL_MEM_CACHE_SIZE, DEVICE_GLOBAL_MEM_SIZE, DEVICE_MAX_CONSTANT_BUFFER_SIZE, DEVICE_MAX_CONSTANT_ARGS, DEVICE_LOCAL_MEM_TYPE, DEVICE_LOCAL_MEM_SIZE, DEVICE_ERROR_CORRECTION_SUPPORT, DEVICE_PROFILING_TIMER_RESOLUTION, DEVICE_ENDIAN_LITTLE, DEVICE_AVAILABLE, DEVICE_COMPILER_AVAILABLE, DEVICE_EXECUTION_CAPABILITIES, DEVICE_QUEUE_PROPERTIES, DEVICE_NAME, DEVICE_VENDOR, DRIVER_VERSION, DEVICE_PROFILE, DEVICE_VERSION, DEVICE_EXTENSIONS, DEVICE_PLATFORM, DEVICE_DOUBLE_FP_CONFIG} 94 | 95 | for _, paramName := range infos { 96 | err := GetDeviceInfo(device, paramName, DeviceInfoBufferSize, dataptr, &size) 97 | if err != SUCCESS { 98 | log.Println(ErrToStr(err)) 99 | t.Fail() 100 | } 101 | } 102 | } 103 | 104 | func TestRetainDevice(t *testing.T) { 105 | device := getGPUDevice() 106 | err := RetainDevice(device) 107 | if err != SUCCESS { 108 | log.Println(ErrToStr(err)) 109 | t.Fail() 110 | } 111 | err = ReleaseDevice(device) 112 | if err != SUCCESS { 113 | log.Println(ErrToStr(err)) 114 | t.Fail() 115 | } 116 | } 117 | 118 | //from now on release your devices on every test 119 | 120 | /* 121 | //Not sure why this isn't valid. It might just be me that doesn't know how to use it 122 | func TestCreateSubDevices(t *testing.T) { 123 | device := getGPUDevice() 124 | defer ReleaseDevice(device) 125 | outdevices := make([]DeviceId, 2) 126 | prop := [...]DevicePartitionProperty{DEVICE_PARTITION_EQUALLY, DevicePartitionProperty(2)} 127 | ret := uint32(0) 128 | err := CreateSubDevices(device, &prop[0], uint32(len(outdevices)), &outdevices[0], &ret) 129 | if err != SUCCESS { 130 | log.Println(ErrToStr(err)) 131 | t.Fail() 132 | } 133 | }*/ 134 | 135 | func TestCreateAndReleaseContext(t *testing.T) { 136 | device := getGPUDevice() 137 | defer ReleaseDevice(device) 138 | var errptr ErrorCode 139 | context := CreateContext(nil, 1, &device, nil, nil, &errptr) 140 | defer ReleaseContext(context) 141 | if errptr != SUCCESS { 142 | log.Println(ErrToStr(errptr)) 143 | t.Fail() 144 | } 145 | } 146 | 147 | func getAnyContext() (DeviceId, Context) { 148 | device := getGPUDevice() 149 | defer ReleaseDevice(device) 150 | var errptr ErrorCode 151 | context := CreateContext(nil, 1, &device, nil, nil, &errptr) 152 | return device, context 153 | } 154 | 155 | func TestRetainContext(t *testing.T) { 156 | device, context := getAnyContext() 157 | defer ReleaseDevice(device) 158 | err := RetainContext(context) 159 | if err != SUCCESS { 160 | log.Println(ErrToStr(err)) 161 | t.Fail() 162 | } 163 | err = ReleaseContext(context) 164 | if err != SUCCESS { 165 | log.Println(ErrToStr(err)) 166 | t.Fail() 167 | } 168 | } 169 | 170 | func TestGetContextInfo(t *testing.T) { 171 | device, context := getAnyContext() 172 | defer ReleaseDevice(device) 173 | defer ReleaseContext(context) 174 | 175 | contextInfos := [...]ContextInfo{CONTEXT_REFERENCE_COUNT, CONTEXT_DEVICES, CONTEXT_PROPERTIES, CONTEXT_NUM_DEVICES} 176 | 177 | data := make([]byte, 1024) 178 | size := uint64(0) 179 | 180 | for _, info := range contextInfos { 181 | err := GetContextInfo(context, info, 1024, unsafe.Pointer(&data[0]), &size) 182 | if err != SUCCESS { 183 | t.Fail() 184 | } 185 | } 186 | } 187 | 188 | //Test left to write 189 | func TestCreateSubDevices(t *testing.T) { 190 | 191 | } 192 | 193 | func TestCreateContextFromType(t *testing.T) { 194 | 195 | } 196 | 197 | func TestCreateCommandQueue(t *testing.T) { 198 | 199 | } 200 | 201 | func TestRetainCommandQueue(t *testing.T) { 202 | 203 | } 204 | 205 | func TestReleaseCommandQueue(t *testing.T) { 206 | 207 | } 208 | 209 | func TestGetCommandQueueInfo(t *testing.T) { 210 | 211 | } 212 | 213 | func TestCreateBuffer(t *testing.T) { 214 | 215 | } 216 | 217 | func TestCreateSubBuffer(t *testing.T) { 218 | 219 | } 220 | 221 | func TestCreateImage(t *testing.T) { 222 | 223 | } 224 | 225 | func TestRetainMemObject(t *testing.T) { 226 | 227 | } 228 | 229 | func TestReleaseMemObject(t *testing.T) { 230 | 231 | } 232 | 233 | func TestGetSupportedImageFormats(t *testing.T) { 234 | 235 | } 236 | 237 | func TestGetMemObjectInfo(t *testing.T) { 238 | 239 | } 240 | 241 | func TestGetImageInfo(t *testing.T) { 242 | 243 | } 244 | 245 | func TestSetMemObjectDestructorCallback(t *testing.T) { 246 | 247 | } 248 | 249 | func TestCreateSampler(t *testing.T) { 250 | 251 | } 252 | 253 | func TestRetainSampler(t *testing.T) { 254 | 255 | } 256 | 257 | func TestReleaseSampler(t *testing.T) { 258 | 259 | } 260 | 261 | func TestGetSamplerInfo(t *testing.T) { 262 | 263 | } 264 | 265 | func TestCreateProgramWithSource(t *testing.T) { 266 | 267 | } 268 | 269 | func TestCreateProgramWithBinary(t *testing.T) { 270 | 271 | } 272 | 273 | func TestCreateProgramWithBuiltInKernels(t *testing.T) { 274 | 275 | } 276 | 277 | func TestRetainProgram(t *testing.T) { 278 | 279 | } 280 | 281 | func TestReleaseProgram(t *testing.T) { 282 | 283 | } 284 | 285 | func TestBuildProgram(t *testing.T) { 286 | 287 | } 288 | 289 | func TestCompileProgram(t *testing.T) { 290 | 291 | } 292 | 293 | func TestLinkProgram(t *testing.T) { 294 | 295 | } 296 | 297 | func TestUnloadPlatformCompiler(t *testing.T) { 298 | 299 | } 300 | 301 | func TestGetProgramInfo(t *testing.T) { 302 | 303 | } 304 | 305 | func TestGetProgramBuildInfo(t *testing.T) { 306 | 307 | } 308 | 309 | func TestCreateKernel(t *testing.T) { 310 | 311 | } 312 | 313 | func TestCreateKernelsInProgram(t *testing.T) { 314 | 315 | } 316 | 317 | func TestRetainKernel(t *testing.T) { 318 | 319 | } 320 | 321 | func TestReleaseKernel(t *testing.T) { 322 | 323 | } 324 | 325 | func TestSetKernelArg(t *testing.T) { 326 | 327 | } 328 | 329 | func TestGetKernelInfo(t *testing.T) { 330 | 331 | } 332 | 333 | func TestGetKernelArgInfo(t *testing.T) { 334 | 335 | } 336 | 337 | func TestGetKernelWorkGroupInfo(t *testing.T) { 338 | 339 | } 340 | 341 | func TestWaitForEvents(t *testing.T) { 342 | 343 | } 344 | 345 | func TestGetEventInfo(t *testing.T) { 346 | 347 | } 348 | 349 | func TestCreateUserEvent(t *testing.T) { 350 | 351 | } 352 | 353 | func TestRetainEvent(t *testing.T) { 354 | 355 | } 356 | 357 | func TestReleaseEvent(t *testing.T) { 358 | 359 | } 360 | 361 | func TestSetUserEventStatus(t *testing.T) { 362 | 363 | } 364 | 365 | func TestSetEventCallback(t *testing.T) { 366 | 367 | } 368 | 369 | func TestGetEventProfilingInfo(t *testing.T) { 370 | 371 | } 372 | 373 | func TestFlush(t *testing.T) { 374 | 375 | } 376 | 377 | func TestFinish(t *testing.T) { 378 | 379 | } 380 | 381 | func TestEnqueueReadBuffer(t *testing.T) { 382 | 383 | } 384 | 385 | func TestEnqueueReadBufferRect(t *testing.T) { 386 | 387 | } 388 | 389 | func TestEnqueueWriteBuffer(t *testing.T) { 390 | 391 | } 392 | 393 | func TestEnqueueWriteBufferRect(t *testing.T) { 394 | 395 | } 396 | 397 | func TestEnqueueFillBuffer(t *testing.T) { 398 | 399 | } 400 | 401 | func TestEnqueueCopyBuffer(t *testing.T) { 402 | 403 | } 404 | 405 | func TestEnqueueCopyBufferRect(t *testing.T) { 406 | 407 | } 408 | 409 | func TestEnqueueReadImage(t *testing.T) { 410 | 411 | } 412 | 413 | func TestEnqueueWriteImage(t *testing.T) { 414 | 415 | } 416 | 417 | func TestEnqueueFillImage(t *testing.T) { 418 | 419 | } 420 | 421 | func TestEnqueueCopyImage(t *testing.T) { 422 | 423 | } 424 | 425 | func TestEnqueueCopyImageToBuffer(t *testing.T) { 426 | 427 | } 428 | 429 | func TestEnqueueCopyBufferToImage(t *testing.T) { 430 | 431 | } 432 | 433 | func TestEnqueueMapBuffer(t *testing.T) { 434 | 435 | } 436 | 437 | func TestEnqueueMapImage(t *testing.T) { 438 | 439 | } 440 | 441 | func TestEnqueueUnmapMemObject(t *testing.T) { 442 | 443 | } 444 | 445 | func TestEnqueueMigrateMemObjects(t *testing.T) { 446 | 447 | } 448 | 449 | func TestEnqueueNDRangeKernel(t *testing.T) { 450 | 451 | } 452 | 453 | func TestEnqueueTask(t *testing.T) { 454 | 455 | } 456 | 457 | func TestEnqueueNativeKernel(t *testing.T) { 458 | 459 | } 460 | 461 | func TestEnqueueMarkerWithWaitList(t *testing.T) { 462 | 463 | } 464 | 465 | func TestEnqueueBarrierWithWaitList(t *testing.T) { 466 | 467 | } 468 | 469 | func TestGetExtensionFunctionAddressForPlatform(t *testing.T) { 470 | 471 | } 472 | -------------------------------------------------------------------------------- /v1.1/headers/cl_ext.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2013 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 | /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ 25 | 26 | /* cl_ext.h contains OpenCL extensions which don't have external */ 27 | /* (OpenGL, D3D) dependencies. */ 28 | 29 | #ifndef __CL_EXT_H 30 | #define __CL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | /* cl_khr_fp64 extension - no extension #define since it has no functions */ 44 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 45 | 46 | /* cl_khr_fp16 extension - no extension #define since it has no functions */ 47 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 48 | 49 | /* Memory object destruction 50 | * 51 | * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR 52 | * 53 | * Registers a user callback function that will be called when the memory object is deleted and its resources 54 | * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback 55 | * stack associated with memobj. The registered user callback functions are called in the reverse order in 56 | * which they were registered. The user callback functions are called and then the memory object is deleted 57 | * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be 58 | * notified when the memory referenced by host_ptr, specified when the memory object is created and used as 59 | * the storage bits for the memory object, can be reused or freed. 60 | * 61 | * The application may not call CL api's with the cl_mem object passed to the pfn_notify. 62 | * 63 | * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 64 | * before using. 65 | */ 66 | #define cl_APPLE_SetMemObjectDestructor 1 67 | cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, 68 | void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), 69 | void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 70 | 71 | 72 | /* Context Logging Functions 73 | * 74 | * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). 75 | * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 76 | * before using. 77 | * 78 | * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger 79 | */ 80 | #define cl_APPLE_ContextLoggingFunctions 1 81 | extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, 82 | const void * /* private_info */, 83 | size_t /* cb */, 84 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 85 | 86 | /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ 87 | extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, 88 | const void * /* private_info */, 89 | size_t /* cb */, 90 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 91 | 92 | /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ 93 | extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, 94 | const void * /* private_info */, 95 | size_t /* cb */, 96 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 97 | 98 | 99 | /************************ 100 | * cl_khr_icd extension * 101 | ************************/ 102 | #define cl_khr_icd 1 103 | 104 | /* cl_platform_info */ 105 | #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 106 | 107 | /* Additional Error Codes */ 108 | #define CL_PLATFORM_NOT_FOUND_KHR -1001 109 | 110 | extern CL_API_ENTRY cl_int CL_API_CALL 111 | clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, 112 | cl_platform_id * /* platforms */, 113 | cl_uint * /* num_platforms */); 114 | 115 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( 116 | cl_uint /* num_entries */, 117 | cl_platform_id * /* platforms */, 118 | cl_uint * /* num_platforms */); 119 | 120 | 121 | /****************************************** 122 | * cl_nv_device_attribute_query extension * 123 | ******************************************/ 124 | /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ 125 | #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 126 | #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 127 | #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 128 | #define CL_DEVICE_WARP_SIZE_NV 0x4003 129 | #define CL_DEVICE_GPU_OVERLAP_NV 0x4004 130 | #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 131 | #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 132 | 133 | /********************************* 134 | * cl_amd_device_attribute_query * 135 | *********************************/ 136 | #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 137 | 138 | /********************************* 139 | * cl_arm_printf extension 140 | *********************************/ 141 | #define CL_PRINTF_CALLBACK_ARM 0x40B0 142 | #define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 143 | 144 | #ifdef CL_VERSION_1_1 145 | /*********************************** 146 | * cl_ext_device_fission extension * 147 | ***********************************/ 148 | #define cl_ext_device_fission 1 149 | 150 | extern CL_API_ENTRY cl_int CL_API_CALL 151 | clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 152 | 153 | typedef CL_API_ENTRY cl_int 154 | (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 155 | 156 | extern CL_API_ENTRY cl_int CL_API_CALL 157 | clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 158 | 159 | typedef CL_API_ENTRY cl_int 160 | (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 161 | 162 | typedef cl_ulong cl_device_partition_property_ext; 163 | extern CL_API_ENTRY cl_int CL_API_CALL 164 | clCreateSubDevicesEXT( cl_device_id /*in_device*/, 165 | const cl_device_partition_property_ext * /* properties */, 166 | cl_uint /*num_entries*/, 167 | cl_device_id * /*out_devices*/, 168 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 169 | 170 | typedef CL_API_ENTRY cl_int 171 | ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, 172 | const cl_device_partition_property_ext * /* properties */, 173 | cl_uint /*num_entries*/, 174 | cl_device_id * /*out_devices*/, 175 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 176 | 177 | /* cl_device_partition_property_ext */ 178 | #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 179 | #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 180 | #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 181 | #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 182 | 183 | /* clDeviceGetInfo selectors */ 184 | #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 185 | #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 186 | #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 187 | #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 188 | #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 189 | 190 | /* error codes */ 191 | #define CL_DEVICE_PARTITION_FAILED_EXT -1057 192 | #define CL_INVALID_PARTITION_COUNT_EXT -1058 193 | #define CL_INVALID_PARTITION_NAME_EXT -1059 194 | 195 | /* CL_AFFINITY_DOMAINs */ 196 | #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 197 | #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 198 | #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 199 | #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 200 | #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 201 | #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 202 | 203 | /* cl_device_partition_property_ext list terminators */ 204 | #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) 205 | #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) 206 | #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) 207 | 208 | /********************************* 209 | * cl_qcom_ext_host_ptr extension 210 | *********************************/ 211 | 212 | #define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) 213 | 214 | #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 215 | #define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 216 | #define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 217 | #define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 218 | #define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 219 | #define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 220 | #define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 221 | #define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 222 | 223 | typedef cl_uint cl_image_pitch_info_qcom; 224 | 225 | extern CL_API_ENTRY cl_int CL_API_CALL 226 | clGetDeviceImageInfoQCOM(cl_device_id device, 227 | size_t image_width, 228 | size_t image_height, 229 | const cl_image_format *image_format, 230 | cl_image_pitch_info_qcom param_name, 231 | size_t param_value_size, 232 | void *param_value, 233 | size_t *param_value_size_ret); 234 | 235 | typedef struct _cl_mem_ext_host_ptr 236 | { 237 | /* Type of external memory allocation. */ 238 | /* Legal values will be defined in layered extensions. */ 239 | cl_uint allocation_type; 240 | 241 | /* Host cache policy for this external memory allocation. */ 242 | cl_uint host_cache_policy; 243 | 244 | } cl_mem_ext_host_ptr; 245 | 246 | /********************************* 247 | * cl_qcom_ion_host_ptr extension 248 | *********************************/ 249 | 250 | #define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 251 | 252 | typedef struct _cl_mem_ion_host_ptr 253 | { 254 | /* Type of external memory allocation. */ 255 | /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ 256 | cl_mem_ext_host_ptr ext_host_ptr; 257 | 258 | /* ION file descriptor */ 259 | int ion_filedesc; 260 | 261 | /* Host pointer to the ION allocated memory */ 262 | void* ion_hostptr; 263 | 264 | } cl_mem_ion_host_ptr; 265 | 266 | #endif /* CL_VERSION_1_1 */ 267 | 268 | #ifdef __cplusplus 269 | } 270 | #endif 271 | 272 | 273 | #endif /* __CL_EXT_H */ -------------------------------------------------------------------------------- /v1.2/headers/cl_ext.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2013 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 | /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ 25 | 26 | /* cl_ext.h contains OpenCL extensions which don't have external */ 27 | /* (OpenGL, D3D) dependencies. */ 28 | 29 | #ifndef __CL_EXT_H 30 | #define __CL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | /* cl_khr_fp16 extension - no extension #define since it has no functions */ 44 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 45 | 46 | /* Memory object destruction 47 | * 48 | * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR 49 | * 50 | * Registers a user callback function that will be called when the memory object is deleted and its resources 51 | * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback 52 | * stack associated with memobj. The registered user callback functions are called in the reverse order in 53 | * which they were registered. The user callback functions are called and then the memory object is deleted 54 | * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be 55 | * notified when the memory referenced by host_ptr, specified when the memory object is created and used as 56 | * the storage bits for the memory object, can be reused or freed. 57 | * 58 | * The application may not call CL api's with the cl_mem object passed to the pfn_notify. 59 | * 60 | * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 61 | * before using. 62 | */ 63 | #define cl_APPLE_SetMemObjectDestructor 1 64 | cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, 65 | void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), 66 | void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 67 | 68 | 69 | /* Context Logging Functions 70 | * 71 | * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). 72 | * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 73 | * before using. 74 | * 75 | * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger 76 | */ 77 | #define cl_APPLE_ContextLoggingFunctions 1 78 | extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, 79 | const void * /* private_info */, 80 | size_t /* cb */, 81 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 82 | 83 | /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ 84 | extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, 85 | const void * /* private_info */, 86 | size_t /* cb */, 87 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 88 | 89 | /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ 90 | extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, 91 | const void * /* private_info */, 92 | size_t /* cb */, 93 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 94 | 95 | 96 | /************************ 97 | * cl_khr_icd extension * 98 | ************************/ 99 | #define cl_khr_icd 1 100 | 101 | /* cl_platform_info */ 102 | #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 103 | 104 | /* Additional Error Codes */ 105 | #define CL_PLATFORM_NOT_FOUND_KHR -1001 106 | 107 | extern CL_API_ENTRY cl_int CL_API_CALL 108 | clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, 109 | cl_platform_id * /* platforms */, 110 | cl_uint * /* num_platforms */); 111 | 112 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( 113 | cl_uint /* num_entries */, 114 | cl_platform_id * /* platforms */, 115 | cl_uint * /* num_platforms */); 116 | 117 | 118 | /* Extension: cl_khr_image2D_buffer 119 | * 120 | * This extension allows a 2D image to be created from a cl_mem buffer without a copy. 121 | * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t. 122 | * Both the sampler and sampler-less read_image built-in functions are supported for 2D images 123 | * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported 124 | * for 2D images created from a buffer. 125 | * 126 | * When the 2D image from buffer is created, the client must specify the width, 127 | * height, image format (i.e. channel order and channel data type) and optionally the row pitch 128 | * 129 | * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels. 130 | * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels. 131 | */ 132 | 133 | /************************************* 134 | * cl_khr_initalize_memory extension * 135 | *************************************/ 136 | 137 | #define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E 138 | 139 | 140 | /************************************** 141 | * cl_khr_terminate_context extension * 142 | **************************************/ 143 | 144 | #define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F 145 | #define CL_CONTEXT_TERMINATE_KHR 0x2010 146 | 147 | #define cl_khr_terminate_context 1 148 | extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; 149 | 150 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; 151 | 152 | 153 | /* 154 | * Extension: cl_khr_spir 155 | * 156 | * This extension adds support to create an OpenCL program object from a 157 | * Standard Portable Intermediate Representation (SPIR) instance 158 | */ 159 | 160 | #define CL_DEVICE_SPIR_VERSIONS 0x40E0 161 | #define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 162 | 163 | 164 | /****************************************** 165 | * cl_nv_device_attribute_query extension * 166 | ******************************************/ 167 | /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ 168 | #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 169 | #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 170 | #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 171 | #define CL_DEVICE_WARP_SIZE_NV 0x4003 172 | #define CL_DEVICE_GPU_OVERLAP_NV 0x4004 173 | #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 174 | #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 175 | 176 | /********************************* 177 | * cl_amd_device_attribute_query * 178 | *********************************/ 179 | #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 180 | 181 | /********************************* 182 | * cl_arm_printf extension 183 | *********************************/ 184 | #define CL_PRINTF_CALLBACK_ARM 0x40B0 185 | #define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 186 | 187 | #ifdef CL_VERSION_1_1 188 | /*********************************** 189 | * cl_ext_device_fission extension * 190 | ***********************************/ 191 | #define cl_ext_device_fission 1 192 | 193 | extern CL_API_ENTRY cl_int CL_API_CALL 194 | clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 195 | 196 | typedef CL_API_ENTRY cl_int 197 | (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 198 | 199 | extern CL_API_ENTRY cl_int CL_API_CALL 200 | clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 201 | 202 | typedef CL_API_ENTRY cl_int 203 | (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 204 | 205 | typedef cl_ulong cl_device_partition_property_ext; 206 | extern CL_API_ENTRY cl_int CL_API_CALL 207 | clCreateSubDevicesEXT( cl_device_id /*in_device*/, 208 | const cl_device_partition_property_ext * /* properties */, 209 | cl_uint /*num_entries*/, 210 | cl_device_id * /*out_devices*/, 211 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 212 | 213 | typedef CL_API_ENTRY cl_int 214 | ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, 215 | const cl_device_partition_property_ext * /* properties */, 216 | cl_uint /*num_entries*/, 217 | cl_device_id * /*out_devices*/, 218 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 219 | 220 | /* cl_device_partition_property_ext */ 221 | #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 222 | #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 223 | #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 224 | #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 225 | 226 | /* clDeviceGetInfo selectors */ 227 | #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 228 | #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 229 | #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 230 | #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 231 | #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 232 | 233 | /* error codes */ 234 | #define CL_DEVICE_PARTITION_FAILED_EXT -1057 235 | #define CL_INVALID_PARTITION_COUNT_EXT -1058 236 | #define CL_INVALID_PARTITION_NAME_EXT -1059 237 | 238 | /* CL_AFFINITY_DOMAINs */ 239 | #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 240 | #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 241 | #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 242 | #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 243 | #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 244 | #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 245 | 246 | /* cl_device_partition_property_ext list terminators */ 247 | #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) 248 | #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) 249 | #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) 250 | 251 | /********************************* 252 | * cl_qcom_ext_host_ptr extension 253 | *********************************/ 254 | 255 | #define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) 256 | 257 | #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 258 | #define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 259 | #define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 260 | #define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 261 | #define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 262 | #define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 263 | #define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 264 | #define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 265 | 266 | typedef cl_uint cl_image_pitch_info_qcom; 267 | 268 | extern CL_API_ENTRY cl_int CL_API_CALL 269 | clGetDeviceImageInfoQCOM(cl_device_id device, 270 | size_t image_width, 271 | size_t image_height, 272 | const cl_image_format *image_format, 273 | cl_image_pitch_info_qcom param_name, 274 | size_t param_value_size, 275 | void *param_value, 276 | size_t *param_value_size_ret); 277 | 278 | typedef struct _cl_mem_ext_host_ptr 279 | { 280 | /* Type of external memory allocation. */ 281 | /* Legal values will be defined in layered extensions. */ 282 | cl_uint allocation_type; 283 | 284 | /* Host cache policy for this external memory allocation. */ 285 | cl_uint host_cache_policy; 286 | 287 | } cl_mem_ext_host_ptr; 288 | 289 | /********************************* 290 | * cl_qcom_ion_host_ptr extension 291 | *********************************/ 292 | 293 | #define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 294 | 295 | typedef struct _cl_mem_ion_host_ptr 296 | { 297 | /* Type of external memory allocation. */ 298 | /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ 299 | cl_mem_ext_host_ptr ext_host_ptr; 300 | 301 | /* ION file descriptor */ 302 | int ion_filedesc; 303 | 304 | /* Host pointer to the ION allocated memory */ 305 | void* ion_hostptr; 306 | 307 | } cl_mem_ion_host_ptr; 308 | 309 | #endif /* CL_VERSION_1_1 */ 310 | 311 | #ifdef __cplusplus 312 | } 313 | #endif 314 | 315 | 316 | #endif /* __CL_EXT_H */ -------------------------------------------------------------------------------- /v2.0/headers/cl_ext.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2013 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 | /* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ 25 | 26 | /* cl_ext.h contains OpenCL extensions which don't have external */ 27 | /* (OpenGL, D3D) dependencies. */ 28 | 29 | #ifndef __CL_EXT_H 30 | #define __CL_EXT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | #ifdef __APPLE__ 37 | #include 38 | #include 39 | #else 40 | #include 41 | #endif 42 | 43 | /* cl_khr_fp16 extension - no extension #define since it has no functions */ 44 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 45 | 46 | /* Memory object destruction 47 | * 48 | * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR 49 | * 50 | * Registers a user callback function that will be called when the memory object is deleted and its resources 51 | * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback 52 | * stack associated with memobj. The registered user callback functions are called in the reverse order in 53 | * which they were registered. The user callback functions are called and then the memory object is deleted 54 | * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be 55 | * notified when the memory referenced by host_ptr, specified when the memory object is created and used as 56 | * the storage bits for the memory object, can be reused or freed. 57 | * 58 | * The application may not call CL api's with the cl_mem object passed to the pfn_notify. 59 | * 60 | * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 61 | * before using. 62 | */ 63 | #define cl_APPLE_SetMemObjectDestructor 1 64 | cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, 65 | void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), 66 | void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 67 | 68 | 69 | /* Context Logging Functions 70 | * 71 | * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). 72 | * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) 73 | * before using. 74 | * 75 | * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger 76 | */ 77 | #define cl_APPLE_ContextLoggingFunctions 1 78 | extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, 79 | const void * /* private_info */, 80 | size_t /* cb */, 81 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 82 | 83 | /* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ 84 | extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, 85 | const void * /* private_info */, 86 | size_t /* cb */, 87 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 88 | 89 | /* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ 90 | extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, 91 | const void * /* private_info */, 92 | size_t /* cb */, 93 | void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; 94 | 95 | 96 | /************************ 97 | * cl_khr_icd extension * 98 | ************************/ 99 | #define cl_khr_icd 1 100 | 101 | /* cl_platform_info */ 102 | #define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 103 | 104 | /* Additional Error Codes */ 105 | #define CL_PLATFORM_NOT_FOUND_KHR -1001 106 | 107 | extern CL_API_ENTRY cl_int CL_API_CALL 108 | clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, 109 | cl_platform_id * /* platforms */, 110 | cl_uint * /* num_platforms */); 111 | 112 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( 113 | cl_uint /* num_entries */, 114 | cl_platform_id * /* platforms */, 115 | cl_uint * /* num_platforms */); 116 | 117 | 118 | /* Extension: cl_khr_image2D_buffer 119 | * 120 | * This extension allows a 2D image to be created from a cl_mem buffer without a copy. 121 | * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t. 122 | * Both the sampler and sampler-less read_image built-in functions are supported for 2D images 123 | * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported 124 | * for 2D images created from a buffer. 125 | * 126 | * When the 2D image from buffer is created, the client must specify the width, 127 | * height, image format (i.e. channel order and channel data type) and optionally the row pitch 128 | * 129 | * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels. 130 | * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels. 131 | */ 132 | 133 | /************************************* 134 | * cl_khr_initalize_memory extension * 135 | *************************************/ 136 | 137 | #define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030 138 | 139 | 140 | /************************************** 141 | * cl_khr_terminate_context extension * 142 | **************************************/ 143 | 144 | #define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031 145 | #define CL_CONTEXT_TERMINATE_KHR 0x2032 146 | 147 | #define cl_khr_terminate_context 1 148 | extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; 149 | 150 | typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; 151 | 152 | 153 | /* 154 | * Extension: cl_khr_spir 155 | * 156 | * This extension adds support to create an OpenCL program object from a 157 | * Standard Portable Intermediate Representation (SPIR) instance 158 | */ 159 | 160 | #define CL_DEVICE_SPIR_VERSIONS 0x40E0 161 | #define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1 162 | 163 | 164 | /****************************************** 165 | * cl_nv_device_attribute_query extension * 166 | ******************************************/ 167 | /* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ 168 | #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 169 | #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 170 | #define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 171 | #define CL_DEVICE_WARP_SIZE_NV 0x4003 172 | #define CL_DEVICE_GPU_OVERLAP_NV 0x4004 173 | #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 174 | #define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 175 | 176 | /********************************* 177 | * cl_amd_device_attribute_query * 178 | *********************************/ 179 | #define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 180 | 181 | /********************************* 182 | * cl_arm_printf extension 183 | *********************************/ 184 | #define CL_PRINTF_CALLBACK_ARM 0x40B0 185 | #define CL_PRINTF_BUFFERSIZE_ARM 0x40B1 186 | 187 | #ifdef CL_VERSION_1_1 188 | /*********************************** 189 | * cl_ext_device_fission extension * 190 | ***********************************/ 191 | #define cl_ext_device_fission 1 192 | 193 | extern CL_API_ENTRY cl_int CL_API_CALL 194 | clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 195 | 196 | typedef CL_API_ENTRY cl_int 197 | (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 198 | 199 | extern CL_API_ENTRY cl_int CL_API_CALL 200 | clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 201 | 202 | typedef CL_API_ENTRY cl_int 203 | (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; 204 | 205 | typedef cl_ulong cl_device_partition_property_ext; 206 | extern CL_API_ENTRY cl_int CL_API_CALL 207 | clCreateSubDevicesEXT( cl_device_id /*in_device*/, 208 | const cl_device_partition_property_ext * /* properties */, 209 | cl_uint /*num_entries*/, 210 | cl_device_id * /*out_devices*/, 211 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 212 | 213 | typedef CL_API_ENTRY cl_int 214 | ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, 215 | const cl_device_partition_property_ext * /* properties */, 216 | cl_uint /*num_entries*/, 217 | cl_device_id * /*out_devices*/, 218 | cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; 219 | 220 | /* cl_device_partition_property_ext */ 221 | #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 222 | #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 223 | #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 224 | #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 225 | 226 | /* clDeviceGetInfo selectors */ 227 | #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 228 | #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 229 | #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 230 | #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 231 | #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 232 | 233 | /* error codes */ 234 | #define CL_DEVICE_PARTITION_FAILED_EXT -1057 235 | #define CL_INVALID_PARTITION_COUNT_EXT -1058 236 | #define CL_INVALID_PARTITION_NAME_EXT -1059 237 | 238 | /* CL_AFFINITY_DOMAINs */ 239 | #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 240 | #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 241 | #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 242 | #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 243 | #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 244 | #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 245 | 246 | /* cl_device_partition_property_ext list terminators */ 247 | #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) 248 | #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) 249 | #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) 250 | 251 | /********************************* 252 | * cl_qcom_ext_host_ptr extension 253 | *********************************/ 254 | 255 | #define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29) 256 | 257 | #define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0 258 | #define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1 259 | #define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2 260 | #define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3 261 | #define CL_MEM_HOST_UNCACHED_QCOM 0x40A4 262 | #define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5 263 | #define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6 264 | #define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7 265 | 266 | typedef cl_uint cl_image_pitch_info_qcom; 267 | 268 | extern CL_API_ENTRY cl_int CL_API_CALL 269 | clGetDeviceImageInfoQCOM(cl_device_id device, 270 | size_t image_width, 271 | size_t image_height, 272 | const cl_image_format *image_format, 273 | cl_image_pitch_info_qcom param_name, 274 | size_t param_value_size, 275 | void *param_value, 276 | size_t *param_value_size_ret); 277 | 278 | typedef struct _cl_mem_ext_host_ptr 279 | { 280 | /* Type of external memory allocation. */ 281 | /* Legal values will be defined in layered extensions. */ 282 | cl_uint allocation_type; 283 | 284 | /* Host cache policy for this external memory allocation. */ 285 | cl_uint host_cache_policy; 286 | 287 | } cl_mem_ext_host_ptr; 288 | 289 | /********************************* 290 | * cl_qcom_ion_host_ptr extension 291 | *********************************/ 292 | 293 | #define CL_MEM_ION_HOST_PTR_QCOM 0x40A8 294 | 295 | typedef struct _cl_mem_ion_host_ptr 296 | { 297 | /* Type of external memory allocation. */ 298 | /* Must be CL_MEM_ION_HOST_PTR_QCOM for ION allocations. */ 299 | cl_mem_ext_host_ptr ext_host_ptr; 300 | 301 | /* ION file descriptor */ 302 | int ion_filedesc; 303 | 304 | /* Host pointer to the ION allocated memory */ 305 | void* ion_hostptr; 306 | 307 | } cl_mem_ion_host_ptr; 308 | 309 | #endif /* CL_VERSION_1_1 */ 310 | 311 | 312 | #ifdef CL_VERSION_2_0 313 | /********************************* 314 | * cl_khr_sub_groups extension 315 | *********************************/ 316 | #define cl_khr_sub_groups 1 317 | 318 | typedef cl_uint cl_kernel_sub_group_info; 319 | 320 | /* cl_khr_sub_group_info */ 321 | #define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033 322 | #define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034 323 | 324 | extern CL_API_ENTRY cl_int CL_API_CALL 325 | clGetKernelSubGroupInfoKHR(cl_kernel /* in_kernel */, 326 | cl_device_id /*in_device*/, 327 | cl_kernel_sub_group_info /* param_name */, 328 | size_t /*input_value_size*/, 329 | const void * /*input_value*/, 330 | size_t * /*param_value_size*/, 331 | void* /*param_value*/, 332 | size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0; 333 | 334 | typedef CL_API_ENTRY cl_int 335 | ( CL_API_CALL * clGetKernelSubGroupInfoKHR_fn)(cl_kernel /* in_kernel */, 336 | cl_device_id /*in_device*/, 337 | cl_kernel_sub_group_info /* param_name */, 338 | size_t /*input_value_size*/, 339 | const void * /*input_value*/, 340 | size_t * /*param_value_size*/, 341 | void* /*param_value*/, 342 | size_t* /*param_value_size_ret*/ ) CL_EXT_SUFFIX__VERSION_2_0; 343 | #endif /* CL_VERSION_2_0 */ 344 | 345 | #ifdef __cplusplus 346 | } 347 | #endif 348 | 349 | 350 | #endif /* __CL_EXT_H */ -------------------------------------------------------------------------------- /v1.0/headers/cl.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * Copyright (c) 2008-2010 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 | /* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ 25 | 26 | #ifndef __OPENCL_CL_H 27 | #define __OPENCL_CL_H 28 | 29 | #ifdef __APPLE__ 30 | #include 31 | #else 32 | #include 33 | #endif 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /******************************************************************************/ 40 | 41 | typedef struct _cl_platform_id * cl_platform_id; 42 | typedef struct _cl_device_id * cl_device_id; 43 | typedef struct _cl_context * cl_context; 44 | typedef struct _cl_command_queue * cl_command_queue; 45 | typedef struct _cl_mem * cl_mem; 46 | typedef struct _cl_program * cl_program; 47 | typedef struct _cl_kernel * cl_kernel; 48 | typedef struct _cl_event * cl_event; 49 | typedef struct _cl_sampler * cl_sampler; 50 | 51 | typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */ 52 | typedef cl_ulong cl_bitfield; 53 | typedef cl_bitfield cl_device_type; 54 | typedef cl_uint cl_platform_info; 55 | typedef cl_uint cl_device_info; 56 | typedef cl_bitfield cl_device_address_info; 57 | typedef cl_bitfield cl_device_fp_config; 58 | typedef cl_uint cl_device_mem_cache_type; 59 | typedef cl_uint cl_device_local_mem_type; 60 | typedef cl_bitfield cl_device_exec_capabilities; 61 | typedef cl_bitfield cl_command_queue_properties; 62 | 63 | typedef intptr_t cl_context_properties; 64 | typedef cl_uint cl_context_info; 65 | typedef cl_uint cl_command_queue_info; 66 | typedef cl_uint cl_channel_order; 67 | typedef cl_uint cl_channel_type; 68 | typedef cl_bitfield cl_mem_flags; 69 | typedef cl_uint cl_mem_object_type; 70 | typedef cl_uint cl_mem_info; 71 | typedef cl_uint cl_image_info; 72 | typedef cl_uint cl_addressing_mode; 73 | typedef cl_uint cl_filter_mode; 74 | typedef cl_uint cl_sampler_info; 75 | typedef cl_bitfield cl_map_flags; 76 | typedef cl_uint cl_program_info; 77 | typedef cl_uint cl_program_build_info; 78 | typedef cl_int cl_build_status; 79 | typedef cl_uint cl_kernel_info; 80 | typedef cl_uint cl_kernel_work_group_info; 81 | typedef cl_uint cl_event_info; 82 | typedef cl_uint cl_command_type; 83 | typedef cl_uint cl_profiling_info; 84 | 85 | typedef struct _cl_image_format { 86 | cl_channel_order image_channel_order; 87 | cl_channel_type image_channel_data_type; 88 | } cl_image_format; 89 | 90 | 91 | 92 | /******************************************************************************/ 93 | 94 | /* Error Codes */ 95 | #define CL_SUCCESS 0 96 | #define CL_DEVICE_NOT_FOUND -1 97 | #define CL_DEVICE_NOT_AVAILABLE -2 98 | #define CL_COMPILER_NOT_AVAILABLE -3 99 | #define CL_MEM_OBJECT_ALLOCATION_FAILURE -4 100 | #define CL_OUT_OF_RESOURCES -5 101 | #define CL_OUT_OF_HOST_MEMORY -6 102 | #define CL_PROFILING_INFO_NOT_AVAILABLE -7 103 | #define CL_MEM_COPY_OVERLAP -8 104 | #define CL_IMAGE_FORMAT_MISMATCH -9 105 | #define CL_IMAGE_FORMAT_NOT_SUPPORTED -10 106 | #define CL_BUILD_PROGRAM_FAILURE -11 107 | #define CL_MAP_FAILURE -12 108 | 109 | #define CL_INVALID_VALUE -30 110 | #define CL_INVALID_DEVICE_TYPE -31 111 | #define CL_INVALID_PLATFORM -32 112 | #define CL_INVALID_DEVICE -33 113 | #define CL_INVALID_CONTEXT -34 114 | #define CL_INVALID_QUEUE_PROPERTIES -35 115 | #define CL_INVALID_COMMAND_QUEUE -36 116 | #define CL_INVALID_HOST_PTR -37 117 | #define CL_INVALID_MEM_OBJECT -38 118 | #define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39 119 | #define CL_INVALID_IMAGE_SIZE -40 120 | #define CL_INVALID_SAMPLER -41 121 | #define CL_INVALID_BINARY -42 122 | #define CL_INVALID_BUILD_OPTIONS -43 123 | #define CL_INVALID_PROGRAM -44 124 | #define CL_INVALID_PROGRAM_EXECUTABLE -45 125 | #define CL_INVALID_KERNEL_NAME -46 126 | #define CL_INVALID_KERNEL_DEFINITION -47 127 | #define CL_INVALID_KERNEL -48 128 | #define CL_INVALID_ARG_INDEX -49 129 | #define CL_INVALID_ARG_VALUE -50 130 | #define CL_INVALID_ARG_SIZE -51 131 | #define CL_INVALID_KERNEL_ARGS -52 132 | #define CL_INVALID_WORK_DIMENSION -53 133 | #define CL_INVALID_WORK_GROUP_SIZE -54 134 | #define CL_INVALID_WORK_ITEM_SIZE -55 135 | #define CL_INVALID_GLOBAL_OFFSET -56 136 | #define CL_INVALID_EVENT_WAIT_LIST -57 137 | #define CL_INVALID_EVENT -58 138 | #define CL_INVALID_OPERATION -59 139 | #define CL_INVALID_GL_OBJECT -60 140 | #define CL_INVALID_BUFFER_SIZE -61 141 | #define CL_INVALID_MIP_LEVEL -62 142 | #define CL_INVALID_GLOBAL_WORK_SIZE -63 143 | 144 | /* OpenCL Version */ 145 | #define CL_VERSION_1_0 1 146 | 147 | /* cl_bool */ 148 | #define CL_FALSE 0 149 | #define CL_TRUE 1 150 | 151 | /* cl_platform_info */ 152 | #define CL_PLATFORM_PROFILE 0x0900 153 | #define CL_PLATFORM_VERSION 0x0901 154 | #define CL_PLATFORM_NAME 0x0902 155 | #define CL_PLATFORM_VENDOR 0x0903 156 | #define CL_PLATFORM_EXTENSIONS 0x0904 157 | 158 | /* cl_device_type - bitfield */ 159 | #define CL_DEVICE_TYPE_DEFAULT (1 << 0) 160 | #define CL_DEVICE_TYPE_CPU (1 << 1) 161 | #define CL_DEVICE_TYPE_GPU (1 << 2) 162 | #define CL_DEVICE_TYPE_ACCELERATOR (1 << 3) 163 | #define CL_DEVICE_TYPE_ALL 0xFFFFFFFF 164 | 165 | /* cl_device_info */ 166 | #define CL_DEVICE_TYPE 0x1000 167 | #define CL_DEVICE_VENDOR_ID 0x1001 168 | #define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002 169 | #define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003 170 | #define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004 171 | #define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005 172 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006 173 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007 174 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008 175 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009 176 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A 177 | #define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B 178 | #define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C 179 | #define CL_DEVICE_ADDRESS_BITS 0x100D 180 | #define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E 181 | #define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F 182 | #define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010 183 | #define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011 184 | #define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012 185 | #define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013 186 | #define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014 187 | #define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015 188 | #define CL_DEVICE_IMAGE_SUPPORT 0x1016 189 | #define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017 190 | #define CL_DEVICE_MAX_SAMPLERS 0x1018 191 | #define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019 192 | #define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A 193 | #define CL_DEVICE_SINGLE_FP_CONFIG 0x101B 194 | #define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C 195 | #define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D 196 | #define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E 197 | #define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F 198 | #define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020 199 | #define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021 200 | #define CL_DEVICE_LOCAL_MEM_TYPE 0x1022 201 | #define CL_DEVICE_LOCAL_MEM_SIZE 0x1023 202 | #define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024 203 | #define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025 204 | #define CL_DEVICE_ENDIAN_LITTLE 0x1026 205 | #define CL_DEVICE_AVAILABLE 0x1027 206 | #define CL_DEVICE_COMPILER_AVAILABLE 0x1028 207 | #define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029 208 | #define CL_DEVICE_QUEUE_PROPERTIES 0x102A 209 | #define CL_DEVICE_NAME 0x102B 210 | #define CL_DEVICE_VENDOR 0x102C 211 | #define CL_DRIVER_VERSION 0x102D 212 | #define CL_DEVICE_PROFILE 0x102E 213 | #define CL_DEVICE_VERSION 0x102F 214 | #define CL_DEVICE_EXTENSIONS 0x1030 215 | #define CL_DEVICE_PLATFORM 0x1031 216 | /* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */ 217 | /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */ 218 | 219 | /* cl_device_fp_config - bitfield */ 220 | #define CL_FP_DENORM (1 << 0) 221 | #define CL_FP_INF_NAN (1 << 1) 222 | #define CL_FP_ROUND_TO_NEAREST (1 << 2) 223 | #define CL_FP_ROUND_TO_ZERO (1 << 3) 224 | #define CL_FP_ROUND_TO_INF (1 << 4) 225 | #define CL_FP_FMA (1 << 5) 226 | 227 | /* cl_device_mem_cache_type */ 228 | #define CL_NONE 0x0 229 | #define CL_READ_ONLY_CACHE 0x1 230 | #define CL_READ_WRITE_CACHE 0x2 231 | 232 | /* cl_device_local_mem_type */ 233 | #define CL_LOCAL 0x1 234 | #define CL_GLOBAL 0x2 235 | 236 | /* cl_device_exec_capabilities - bitfield */ 237 | #define CL_EXEC_KERNEL (1 << 0) 238 | #define CL_EXEC_NATIVE_KERNEL (1 << 1) 239 | 240 | /* cl_command_queue_properties - bitfield */ 241 | #define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0) 242 | #define CL_QUEUE_PROFILING_ENABLE (1 << 1) 243 | 244 | /* cl_context_info */ 245 | #define CL_CONTEXT_REFERENCE_COUNT 0x1080 246 | #define CL_CONTEXT_DEVICES 0x1081 247 | #define CL_CONTEXT_PROPERTIES 0x1082 248 | 249 | /* cl_context_info + cl_context_properties */ 250 | #define CL_CONTEXT_PLATFORM 0x1084 251 | 252 | /* cl_command_queue_info */ 253 | #define CL_QUEUE_CONTEXT 0x1090 254 | #define CL_QUEUE_DEVICE 0x1091 255 | #define CL_QUEUE_REFERENCE_COUNT 0x1092 256 | #define CL_QUEUE_PROPERTIES 0x1093 257 | 258 | /* cl_mem_flags - bitfield */ 259 | #define CL_MEM_READ_WRITE (1 << 0) 260 | #define CL_MEM_WRITE_ONLY (1 << 1) 261 | #define CL_MEM_READ_ONLY (1 << 2) 262 | #define CL_MEM_USE_HOST_PTR (1 << 3) 263 | #define CL_MEM_ALLOC_HOST_PTR (1 << 4) 264 | #define CL_MEM_COPY_HOST_PTR (1 << 5) 265 | 266 | /* cl_channel_order */ 267 | #define CL_R 0x10B0 268 | #define CL_A 0x10B1 269 | #define CL_RG 0x10B2 270 | #define CL_RA 0x10B3 271 | #define CL_RGB 0x10B4 272 | #define CL_RGBA 0x10B5 273 | #define CL_BGRA 0x10B6 274 | #define CL_ARGB 0x10B7 275 | #define CL_INTENSITY 0x10B8 276 | #define CL_LUMINANCE 0x10B9 277 | 278 | /* cl_channel_type */ 279 | #define CL_SNORM_INT8 0x10D0 280 | #define CL_SNORM_INT16 0x10D1 281 | #define CL_UNORM_INT8 0x10D2 282 | #define CL_UNORM_INT16 0x10D3 283 | #define CL_UNORM_SHORT_565 0x10D4 284 | #define CL_UNORM_SHORT_555 0x10D5 285 | #define CL_UNORM_INT_101010 0x10D6 286 | #define CL_SIGNED_INT8 0x10D7 287 | #define CL_SIGNED_INT16 0x10D8 288 | #define CL_SIGNED_INT32 0x10D9 289 | #define CL_UNSIGNED_INT8 0x10DA 290 | #define CL_UNSIGNED_INT16 0x10DB 291 | #define CL_UNSIGNED_INT32 0x10DC 292 | #define CL_HALF_FLOAT 0x10DD 293 | #define CL_FLOAT 0x10DE 294 | 295 | /* cl_mem_object_type */ 296 | #define CL_MEM_OBJECT_BUFFER 0x10F0 297 | #define CL_MEM_OBJECT_IMAGE2D 0x10F1 298 | #define CL_MEM_OBJECT_IMAGE3D 0x10F2 299 | 300 | /* cl_mem_info */ 301 | #define CL_MEM_TYPE 0x1100 302 | #define CL_MEM_FLAGS 0x1101 303 | #define CL_MEM_SIZE 0x1102 304 | #define CL_MEM_HOST_PTR 0x1103 305 | #define CL_MEM_MAP_COUNT 0x1104 306 | #define CL_MEM_REFERENCE_COUNT 0x1105 307 | #define CL_MEM_CONTEXT 0x1106 308 | 309 | /* cl_image_info */ 310 | #define CL_IMAGE_FORMAT 0x1110 311 | #define CL_IMAGE_ELEMENT_SIZE 0x1111 312 | #define CL_IMAGE_ROW_PITCH 0x1112 313 | #define CL_IMAGE_SLICE_PITCH 0x1113 314 | #define CL_IMAGE_WIDTH 0x1114 315 | #define CL_IMAGE_HEIGHT 0x1115 316 | #define CL_IMAGE_DEPTH 0x1116 317 | 318 | /* cl_addressing_mode */ 319 | #define CL_ADDRESS_NONE 0x1130 320 | #define CL_ADDRESS_CLAMP_TO_EDGE 0x1131 321 | #define CL_ADDRESS_CLAMP 0x1132 322 | #define CL_ADDRESS_REPEAT 0x1133 323 | 324 | /* cl_filter_mode */ 325 | #define CL_FILTER_NEAREST 0x1140 326 | #define CL_FILTER_LINEAR 0x1141 327 | 328 | /* cl_sampler_info */ 329 | #define CL_SAMPLER_REFERENCE_COUNT 0x1150 330 | #define CL_SAMPLER_CONTEXT 0x1151 331 | #define CL_SAMPLER_NORMALIZED_COORDS 0x1152 332 | #define CL_SAMPLER_ADDRESSING_MODE 0x1153 333 | #define CL_SAMPLER_FILTER_MODE 0x1154 334 | 335 | /* cl_map_flags - bitfield */ 336 | #define CL_MAP_READ (1 << 0) 337 | #define CL_MAP_WRITE (1 << 1) 338 | 339 | /* cl_program_info */ 340 | #define CL_PROGRAM_REFERENCE_COUNT 0x1160 341 | #define CL_PROGRAM_CONTEXT 0x1161 342 | #define CL_PROGRAM_NUM_DEVICES 0x1162 343 | #define CL_PROGRAM_DEVICES 0x1163 344 | #define CL_PROGRAM_SOURCE 0x1164 345 | #define CL_PROGRAM_BINARY_SIZES 0x1165 346 | #define CL_PROGRAM_BINARIES 0x1166 347 | 348 | /* cl_program_build_info */ 349 | #define CL_PROGRAM_BUILD_STATUS 0x1181 350 | #define CL_PROGRAM_BUILD_OPTIONS 0x1182 351 | #define CL_PROGRAM_BUILD_LOG 0x1183 352 | 353 | /* cl_build_status */ 354 | #define CL_BUILD_SUCCESS 0 355 | #define CL_BUILD_NONE -1 356 | #define CL_BUILD_ERROR -2 357 | #define CL_BUILD_IN_PROGRESS -3 358 | 359 | /* cl_kernel_info */ 360 | #define CL_KERNEL_FUNCTION_NAME 0x1190 361 | #define CL_KERNEL_NUM_ARGS 0x1191 362 | #define CL_KERNEL_REFERENCE_COUNT 0x1192 363 | #define CL_KERNEL_CONTEXT 0x1193 364 | #define CL_KERNEL_PROGRAM 0x1194 365 | 366 | /* cl_kernel_work_group_info */ 367 | #define CL_KERNEL_WORK_GROUP_SIZE 0x11B0 368 | #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1 369 | #define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2 370 | 371 | /* cl_event_info */ 372 | #define CL_EVENT_COMMAND_QUEUE 0x11D0 373 | #define CL_EVENT_COMMAND_TYPE 0x11D1 374 | #define CL_EVENT_REFERENCE_COUNT 0x11D2 375 | #define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3 376 | 377 | /* cl_command_type */ 378 | #define CL_COMMAND_NDRANGE_KERNEL 0x11F0 379 | #define CL_COMMAND_TASK 0x11F1 380 | #define CL_COMMAND_NATIVE_KERNEL 0x11F2 381 | #define CL_COMMAND_READ_BUFFER 0x11F3 382 | #define CL_COMMAND_WRITE_BUFFER 0x11F4 383 | #define CL_COMMAND_COPY_BUFFER 0x11F5 384 | #define CL_COMMAND_READ_IMAGE 0x11F6 385 | #define CL_COMMAND_WRITE_IMAGE 0x11F7 386 | #define CL_COMMAND_COPY_IMAGE 0x11F8 387 | #define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9 388 | #define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA 389 | #define CL_COMMAND_MAP_BUFFER 0x11FB 390 | #define CL_COMMAND_MAP_IMAGE 0x11FC 391 | #define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD 392 | #define CL_COMMAND_MARKER 0x11FE 393 | #define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF 394 | #define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200 395 | 396 | /* command execution status */ 397 | #define CL_COMPLETE 0x0 398 | #define CL_RUNNING 0x1 399 | #define CL_SUBMITTED 0x2 400 | #define CL_QUEUED 0x3 401 | 402 | /* cl_profiling_info */ 403 | #define CL_PROFILING_COMMAND_QUEUED 0x1280 404 | #define CL_PROFILING_COMMAND_SUBMIT 0x1281 405 | #define CL_PROFILING_COMMAND_START 0x1282 406 | #define CL_PROFILING_COMMAND_END 0x1283 407 | 408 | /********************************************************************************************************/ 409 | 410 | /* Platform API */ 411 | extern CL_API_ENTRY cl_int CL_API_CALL 412 | clGetPlatformIDs(cl_uint /* num_entries */, 413 | cl_platform_id * /* platforms */, 414 | cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0; 415 | 416 | extern CL_API_ENTRY cl_int CL_API_CALL 417 | clGetPlatformInfo(cl_platform_id /* platform */, 418 | cl_platform_info /* param_name */, 419 | size_t /* param_value_size */, 420 | void * /* param_value */, 421 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 422 | 423 | /* Device APIs */ 424 | extern CL_API_ENTRY cl_int CL_API_CALL 425 | clGetDeviceIDs(cl_platform_id /* platform */, 426 | cl_device_type /* device_type */, 427 | cl_uint /* num_entries */, 428 | cl_device_id * /* devices */, 429 | cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0; 430 | 431 | extern CL_API_ENTRY cl_int CL_API_CALL 432 | clGetDeviceInfo(cl_device_id /* device */, 433 | cl_device_info /* param_name */, 434 | size_t /* param_value_size */, 435 | void * /* param_value */, 436 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 437 | 438 | /* Context APIs */ 439 | extern CL_API_ENTRY cl_context CL_API_CALL 440 | clCreateContext(const cl_context_properties * /* properties */, 441 | cl_uint /* num_devices */, 442 | const cl_device_id * /* devices */, 443 | void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), 444 | void * /* user_data */, 445 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 446 | 447 | extern CL_API_ENTRY cl_context CL_API_CALL 448 | clCreateContextFromType(const cl_context_properties * /* properties */, 449 | cl_device_type /* device_type */, 450 | void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *), 451 | void * /* user_data */, 452 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 453 | 454 | extern CL_API_ENTRY cl_int CL_API_CALL 455 | clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; 456 | 457 | extern CL_API_ENTRY cl_int CL_API_CALL 458 | clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; 459 | 460 | extern CL_API_ENTRY cl_int CL_API_CALL 461 | clGetContextInfo(cl_context /* context */, 462 | cl_context_info /* param_name */, 463 | size_t /* param_value_size */, 464 | void * /* param_value */, 465 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 466 | 467 | /* Command Queue APIs */ 468 | extern CL_API_ENTRY cl_command_queue CL_API_CALL 469 | clCreateCommandQueue(cl_context /* context */, 470 | cl_device_id /* device */, 471 | cl_command_queue_properties /* properties */, 472 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 473 | 474 | extern CL_API_ENTRY cl_int CL_API_CALL 475 | clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; 476 | 477 | extern CL_API_ENTRY cl_int CL_API_CALL 478 | clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; 479 | 480 | extern CL_API_ENTRY cl_int CL_API_CALL 481 | clGetCommandQueueInfo(cl_command_queue /* command_queue */, 482 | cl_command_queue_info /* param_name */, 483 | size_t /* param_value_size */, 484 | void * /* param_value */, 485 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 486 | 487 | extern CL_API_ENTRY cl_int CL_API_CALL 488 | clSetCommandQueueProperty(cl_command_queue /* command_queue */, 489 | cl_command_queue_properties /* properties */, 490 | cl_bool /* enable */, 491 | cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0; 492 | 493 | /* Memory Object APIs */ 494 | extern CL_API_ENTRY cl_mem CL_API_CALL 495 | clCreateBuffer(cl_context /* context */, 496 | cl_mem_flags /* flags */, 497 | size_t /* size */, 498 | void * /* host_ptr */, 499 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 500 | 501 | extern CL_API_ENTRY cl_mem CL_API_CALL 502 | clCreateImage2D(cl_context /* context */, 503 | cl_mem_flags /* flags */, 504 | const cl_image_format * /* image_format */, 505 | size_t /* image_width */, 506 | size_t /* image_height */, 507 | size_t /* image_row_pitch */, 508 | void * /* host_ptr */, 509 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 510 | 511 | extern CL_API_ENTRY cl_mem CL_API_CALL 512 | clCreateImage3D(cl_context /* context */, 513 | cl_mem_flags /* flags */, 514 | const cl_image_format * /* image_format */, 515 | size_t /* image_width */, 516 | size_t /* image_height */, 517 | size_t /* image_depth */, 518 | size_t /* image_row_pitch */, 519 | size_t /* image_slice_pitch */, 520 | void * /* host_ptr */, 521 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 522 | 523 | extern CL_API_ENTRY cl_int CL_API_CALL 524 | clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; 525 | 526 | extern CL_API_ENTRY cl_int CL_API_CALL 527 | clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; 528 | 529 | extern CL_API_ENTRY cl_int CL_API_CALL 530 | clGetSupportedImageFormats(cl_context /* context */, 531 | cl_mem_flags /* flags */, 532 | cl_mem_object_type /* image_type */, 533 | cl_uint /* num_entries */, 534 | cl_image_format * /* image_formats */, 535 | cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0; 536 | 537 | extern CL_API_ENTRY cl_int CL_API_CALL 538 | clGetMemObjectInfo(cl_mem /* memobj */, 539 | cl_mem_info /* param_name */, 540 | size_t /* param_value_size */, 541 | void * /* param_value */, 542 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 543 | 544 | extern CL_API_ENTRY cl_int CL_API_CALL 545 | clGetImageInfo(cl_mem /* image */, 546 | cl_image_info /* param_name */, 547 | size_t /* param_value_size */, 548 | void * /* param_value */, 549 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 550 | 551 | /* Sampler APIs */ 552 | extern CL_API_ENTRY cl_sampler CL_API_CALL 553 | clCreateSampler(cl_context /* context */, 554 | cl_bool /* normalized_coords */, 555 | cl_addressing_mode /* addressing_mode */, 556 | cl_filter_mode /* filter_mode */, 557 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 558 | 559 | extern CL_API_ENTRY cl_int CL_API_CALL 560 | clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; 561 | 562 | extern CL_API_ENTRY cl_int CL_API_CALL 563 | clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0; 564 | 565 | extern CL_API_ENTRY cl_int CL_API_CALL 566 | clGetSamplerInfo(cl_sampler /* sampler */, 567 | cl_sampler_info /* param_name */, 568 | size_t /* param_value_size */, 569 | void * /* param_value */, 570 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 571 | 572 | /* Program Object APIs */ 573 | extern CL_API_ENTRY cl_program CL_API_CALL 574 | clCreateProgramWithSource(cl_context /* context */, 575 | cl_uint /* count */, 576 | const char ** /* strings */, 577 | const size_t * /* lengths */, 578 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 579 | 580 | extern CL_API_ENTRY cl_program CL_API_CALL 581 | clCreateProgramWithBinary(cl_context /* context */, 582 | cl_uint /* num_devices */, 583 | const cl_device_id * /* device_list */, 584 | const size_t * /* lengths */, 585 | const unsigned char ** /* binaries */, 586 | cl_int * /* binary_status */, 587 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 588 | 589 | extern CL_API_ENTRY cl_int CL_API_CALL 590 | clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; 591 | 592 | extern CL_API_ENTRY cl_int CL_API_CALL 593 | clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; 594 | 595 | extern CL_API_ENTRY cl_int CL_API_CALL 596 | clBuildProgram(cl_program /* program */, 597 | cl_uint /* num_devices */, 598 | const cl_device_id * /* device_list */, 599 | const char * /* options */, 600 | void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), 601 | void * /* user_data */) CL_API_SUFFIX__VERSION_1_0; 602 | 603 | extern CL_API_ENTRY cl_int CL_API_CALL 604 | clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0; 605 | 606 | extern CL_API_ENTRY cl_int CL_API_CALL 607 | clGetProgramInfo(cl_program /* program */, 608 | cl_program_info /* param_name */, 609 | size_t /* param_value_size */, 610 | void * /* param_value */, 611 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 612 | 613 | extern CL_API_ENTRY cl_int CL_API_CALL 614 | clGetProgramBuildInfo(cl_program /* program */, 615 | cl_device_id /* device */, 616 | cl_program_build_info /* param_name */, 617 | size_t /* param_value_size */, 618 | void * /* param_value */, 619 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 620 | 621 | /* Kernel Object APIs */ 622 | extern CL_API_ENTRY cl_kernel CL_API_CALL 623 | clCreateKernel(cl_program /* program */, 624 | const char * /* kernel_name */, 625 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 626 | 627 | extern CL_API_ENTRY cl_int CL_API_CALL 628 | clCreateKernelsInProgram(cl_program /* program */, 629 | cl_uint /* num_kernels */, 630 | cl_kernel * /* kernels */, 631 | cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0; 632 | 633 | extern CL_API_ENTRY cl_int CL_API_CALL 634 | clRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; 635 | 636 | extern CL_API_ENTRY cl_int CL_API_CALL 637 | clReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0; 638 | 639 | extern CL_API_ENTRY cl_int CL_API_CALL 640 | clSetKernelArg(cl_kernel /* kernel */, 641 | cl_uint /* arg_index */, 642 | size_t /* arg_size */, 643 | const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0; 644 | 645 | extern CL_API_ENTRY cl_int CL_API_CALL 646 | clGetKernelInfo(cl_kernel /* kernel */, 647 | cl_kernel_info /* param_name */, 648 | size_t /* param_value_size */, 649 | void * /* param_value */, 650 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 651 | 652 | extern CL_API_ENTRY cl_int CL_API_CALL 653 | clGetKernelWorkGroupInfo(cl_kernel /* kernel */, 654 | cl_device_id /* device */, 655 | cl_kernel_work_group_info /* param_name */, 656 | size_t /* param_value_size */, 657 | void * /* param_value */, 658 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 659 | 660 | /* Event Object APIs */ 661 | extern CL_API_ENTRY cl_int CL_API_CALL 662 | clWaitForEvents(cl_uint /* num_events */, 663 | const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; 664 | 665 | extern CL_API_ENTRY cl_int CL_API_CALL 666 | clGetEventInfo(cl_event /* event */, 667 | cl_event_info /* param_name */, 668 | size_t /* param_value_size */, 669 | void * /* param_value */, 670 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 671 | 672 | extern CL_API_ENTRY cl_int CL_API_CALL 673 | clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; 674 | 675 | extern CL_API_ENTRY cl_int CL_API_CALL 676 | clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; 677 | 678 | /* Profiling APIs */ 679 | extern CL_API_ENTRY cl_int CL_API_CALL 680 | clGetEventProfilingInfo(cl_event /* event */, 681 | cl_profiling_info /* param_name */, 682 | size_t /* param_value_size */, 683 | void * /* param_value */, 684 | size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; 685 | 686 | /* Flush and Finish APIs */ 687 | extern CL_API_ENTRY cl_int CL_API_CALL 688 | clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; 689 | 690 | extern CL_API_ENTRY cl_int CL_API_CALL 691 | clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; 692 | 693 | /* Enqueued Commands APIs */ 694 | extern CL_API_ENTRY cl_int CL_API_CALL 695 | clEnqueueReadBuffer(cl_command_queue /* command_queue */, 696 | cl_mem /* buffer */, 697 | cl_bool /* blocking_read */, 698 | size_t /* offset */, 699 | size_t /* cb */, 700 | void * /* ptr */, 701 | cl_uint /* num_events_in_wait_list */, 702 | const cl_event * /* event_wait_list */, 703 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 704 | 705 | extern CL_API_ENTRY cl_int CL_API_CALL 706 | clEnqueueWriteBuffer(cl_command_queue /* command_queue */, 707 | cl_mem /* buffer */, 708 | cl_bool /* blocking_write */, 709 | size_t /* offset */, 710 | size_t /* cb */, 711 | const void * /* ptr */, 712 | cl_uint /* num_events_in_wait_list */, 713 | const cl_event * /* event_wait_list */, 714 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 715 | 716 | extern CL_API_ENTRY cl_int CL_API_CALL 717 | clEnqueueCopyBuffer(cl_command_queue /* command_queue */, 718 | cl_mem /* src_buffer */, 719 | cl_mem /* dst_buffer */, 720 | size_t /* src_offset */, 721 | size_t /* dst_offset */, 722 | size_t /* cb */, 723 | cl_uint /* num_events_in_wait_list */, 724 | const cl_event * /* event_wait_list */, 725 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 726 | 727 | extern CL_API_ENTRY cl_int CL_API_CALL 728 | clEnqueueReadImage(cl_command_queue /* command_queue */, 729 | cl_mem /* image */, 730 | cl_bool /* blocking_read */, 731 | const size_t * /* origin[3] */, 732 | const size_t * /* region[3] */, 733 | size_t /* row_pitch */, 734 | size_t /* slice_pitch */, 735 | void * /* ptr */, 736 | cl_uint /* num_events_in_wait_list */, 737 | const cl_event * /* event_wait_list */, 738 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 739 | 740 | extern CL_API_ENTRY cl_int CL_API_CALL 741 | clEnqueueWriteImage(cl_command_queue /* command_queue */, 742 | cl_mem /* image */, 743 | cl_bool /* blocking_write */, 744 | const size_t * /* origin[3] */, 745 | const size_t * /* region[3] */, 746 | size_t /* input_row_pitch */, 747 | size_t /* input_slice_pitch */, 748 | const void * /* ptr */, 749 | cl_uint /* num_events_in_wait_list */, 750 | const cl_event * /* event_wait_list */, 751 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 752 | 753 | extern CL_API_ENTRY cl_int CL_API_CALL 754 | clEnqueueCopyImage(cl_command_queue /* command_queue */, 755 | cl_mem /* src_image */, 756 | cl_mem /* dst_image */, 757 | const size_t * /* src_origin[3] */, 758 | const size_t * /* dst_origin[3] */, 759 | const size_t * /* region[3] */, 760 | cl_uint /* num_events_in_wait_list */, 761 | const cl_event * /* event_wait_list */, 762 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 763 | 764 | extern CL_API_ENTRY cl_int CL_API_CALL 765 | clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */, 766 | cl_mem /* src_image */, 767 | cl_mem /* dst_buffer */, 768 | const size_t * /* src_origin[3] */, 769 | const size_t * /* region[3] */, 770 | size_t /* dst_offset */, 771 | cl_uint /* num_events_in_wait_list */, 772 | const cl_event * /* event_wait_list */, 773 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 774 | 775 | extern CL_API_ENTRY cl_int CL_API_CALL 776 | clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */, 777 | cl_mem /* src_buffer */, 778 | cl_mem /* dst_image */, 779 | size_t /* src_offset */, 780 | const size_t * /* dst_origin[3] */, 781 | const size_t * /* region[3] */, 782 | cl_uint /* num_events_in_wait_list */, 783 | const cl_event * /* event_wait_list */, 784 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 785 | 786 | extern CL_API_ENTRY void * CL_API_CALL 787 | clEnqueueMapBuffer(cl_command_queue /* command_queue */, 788 | cl_mem /* buffer */, 789 | cl_bool /* blocking_map */, 790 | cl_map_flags /* map_flags */, 791 | size_t /* offset */, 792 | size_t /* cb */, 793 | cl_uint /* num_events_in_wait_list */, 794 | const cl_event * /* event_wait_list */, 795 | cl_event * /* event */, 796 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 797 | 798 | extern CL_API_ENTRY void * CL_API_CALL 799 | clEnqueueMapImage(cl_command_queue /* command_queue */, 800 | cl_mem /* image */, 801 | cl_bool /* blocking_map */, 802 | cl_map_flags /* map_flags */, 803 | const size_t * /* origin[3] */, 804 | const size_t * /* region[3] */, 805 | size_t * /* image_row_pitch */, 806 | size_t * /* image_slice_pitch */, 807 | cl_uint /* num_events_in_wait_list */, 808 | const cl_event * /* event_wait_list */, 809 | cl_event * /* event */, 810 | cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; 811 | 812 | extern CL_API_ENTRY cl_int CL_API_CALL 813 | clEnqueueUnmapMemObject(cl_command_queue /* command_queue */, 814 | cl_mem /* memobj */, 815 | void * /* mapped_ptr */, 816 | cl_uint /* num_events_in_wait_list */, 817 | const cl_event * /* event_wait_list */, 818 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 819 | 820 | extern CL_API_ENTRY cl_int CL_API_CALL 821 | clEnqueueNDRangeKernel(cl_command_queue /* command_queue */, 822 | cl_kernel /* kernel */, 823 | cl_uint /* work_dim */, 824 | const size_t * /* global_work_offset */, 825 | const size_t * /* global_work_size */, 826 | const size_t * /* local_work_size */, 827 | cl_uint /* num_events_in_wait_list */, 828 | const cl_event * /* event_wait_list */, 829 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 830 | 831 | extern CL_API_ENTRY cl_int CL_API_CALL 832 | clEnqueueTask(cl_command_queue /* command_queue */, 833 | cl_kernel /* kernel */, 834 | cl_uint /* num_events_in_wait_list */, 835 | const cl_event * /* event_wait_list */, 836 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 837 | 838 | extern CL_API_ENTRY cl_int CL_API_CALL 839 | clEnqueueNativeKernel(cl_command_queue /* command_queue */, 840 | void (*user_func)(void *), 841 | void * /* args */, 842 | size_t /* cb_args */, 843 | cl_uint /* num_mem_objects */, 844 | const cl_mem * /* mem_list */, 845 | const void ** /* args_mem_loc */, 846 | cl_uint /* num_events_in_wait_list */, 847 | const cl_event * /* event_wait_list */, 848 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 849 | 850 | extern CL_API_ENTRY cl_int CL_API_CALL 851 | clEnqueueMarker(cl_command_queue /* command_queue */, 852 | cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; 853 | 854 | extern CL_API_ENTRY cl_int CL_API_CALL 855 | clEnqueueWaitForEvents(cl_command_queue /* command_queue */, 856 | cl_uint /* num_events */, 857 | const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; 858 | 859 | extern CL_API_ENTRY cl_int CL_API_CALL 860 | clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; 861 | 862 | /* Extension function access 863 | * 864 | * Returns the extension function address for the given function name, 865 | * or NULL if a valid function can not be found. The client must 866 | * check to make sure the address is not NULL, before using or 867 | * calling the returned function address. 868 | */ 869 | extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0; 870 | 871 | #ifdef __cplusplus 872 | } 873 | #endif 874 | 875 | #endif /* __OPENCL_CL_H */ 876 | --------------------------------------------------------------------------------