diff --git a/README.md b/README.md
index d0eedde..b2d56bf 100644
--- a/README.md
+++ b/README.md
@@ -69,7 +69,9 @@ The **performance measurement tool** can be compiled with:
````g++ -std=c++20 -mavx -Ofast tiny_bvh_speedtest.cpp -o tiny_bvh_speedtest````
-# Version 1.2.5
+# Version 1.3.2
+
+Version 1.3.0 changed the names of vector math functions, which are now prepended with ````tinybvh_````, e.g. ````tinybvh_cross````, ````tinybvh_normalize````. This avoids name clashes in applications that override the vector types with their own. Basically tinybvh evades these so you don't have to.
Version 1.1.0 introduced a change to the API. The single BVH class with multiple layouts has been replaced with a BVH class per layout. You can simply instantiate the desired layout; conversion (and data ownership) is then handled properly by the library. Examples:
@@ -112,13 +114,16 @@ This version of the library includes the following functionality:
* Fast binned SAH BVH builder using NEON intrinsices, by [wuyakuma](https://github.com/wuyakuma)
* TLAS builder with instancing and TLAS/BLAS traversal
* Double-precision binned SAH BVH builder
+* Support for custom geometry and mixed scenes
* Example code for GPU TLAS/BLAS traversal (dragon invasion demo, tiny_bvh_gpu2.cpp)
+* Example TLAS/BLAS application using OpenGL interop (windows only)
* Spatial Splits ([SBVH](https://www.nvidia.in/docs/IO/77714/sbvh.pdf), Stich et al., 2009) builder, including "unsplitting"
* 'Compressed Wide BVH' (CWBVH) data structure
* BVH optimizer: reduces SAH cost and improves ray tracing performance ([Bittner et al., 2013](https://dspace.cvut.cz/bitstream/handle/10467/15603/2013-Fast-Insertion-Based-Optimization-of-Bounding-Volume-Hierarchies.pdf))
* Collapse to N-wide MBVH using templated code
* Conversion of 4-wide BVH to GPU-friendly 64-byte quantized format
* Single-ray and packet traversal
+* Sphere/BVH collision detection via BVH::IntersectSphere(..)
* Fast triangle intersection: Implements the 2016 paper by [Baldwin & Weber](https://jcgt.org/published/0005/03/03/paper.pdf)
* OpenCL traversal: Aila & Laine, 4-way quantized, CWBVH
* Support for WASM / EMSCRIPTEN, g++, clang, Visual Studio
@@ -128,7 +133,8 @@ This version of the library includes the following functionality:
* Custom primitives can be intersected via callbacks (new in 1.2.2)
* Clear data ownership and intuitive management via the new and simplified API, with lots of help from David Peicho
* You can now also BYOVT ('bring your own vector types'), thanks [Tijmen Verhoef](https://github.com/nemjit001)
-* 'SpeedTest' tool that times and validates all (well, most) traversal kernels.
+* 'SpeedTest' tool that times and validates all (well, most) traversal kernels
+* A [manual](https://jacco.ompf2.com/2025/01/24/tinybvh-manual-basic-use) is now available.
The current version of the library is rapidly gaining functionality. Please expect changes to the interface.
diff --git a/external/OpenCL/inc/cl_ext.h b/external/OpenCL/inc/cl_ext.h
new file mode 100644
index 0000000..8e3875b
--- /dev/null
+++ b/external/OpenCL/inc/cl_ext.h
@@ -0,0 +1,4227 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_EXT_H_
+#define OPENCL_CL_EXT_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_command_buffer
+***************************************************************/
+#define cl_khr_command_buffer 1
+#define CL_KHR_COMMAND_BUFFER_EXTENSION_NAME \
+ "cl_khr_command_buffer"
+
+
+#define CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 6)
+
+typedef cl_bitfield cl_device_command_buffer_capabilities_khr;
+typedef struct _cl_command_buffer_khr* cl_command_buffer_khr;
+typedef cl_uint cl_sync_point_khr;
+typedef cl_uint cl_command_buffer_info_khr;
+typedef cl_uint cl_command_buffer_state_khr;
+typedef cl_properties cl_command_buffer_properties_khr;
+typedef cl_bitfield cl_command_buffer_flags_khr;
+typedef cl_properties cl_command_properties_khr;
+typedef struct _cl_mutable_command_khr* cl_mutable_command_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR 0x12A9
+#define CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR 0x129A
+#define CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR 0x12AA
+
+/* cl_device_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR (1 << 0)
+#define CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR (1 << 1)
+#define CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR (1 << 2)
+
+/* cl_command_buffer_properties_khr */
+#define CL_COMMAND_BUFFER_FLAGS_KHR 0x1293
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR (1 << 0)
+
+/* Error codes */
+#define CL_INVALID_COMMAND_BUFFER_KHR -1138
+#define CL_INVALID_SYNC_POINT_WAIT_LIST_KHR -1139
+#define CL_INCOMPATIBLE_COMMAND_QUEUE_KHR -1140
+
+/* cl_command_buffer_info_khr */
+#define CL_COMMAND_BUFFER_QUEUES_KHR 0x1294
+#define CL_COMMAND_BUFFER_NUM_QUEUES_KHR 0x1295
+#define CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR 0x1296
+#define CL_COMMAND_BUFFER_STATE_KHR 0x1297
+#define CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR 0x1298
+#define CL_COMMAND_BUFFER_CONTEXT_KHR 0x1299
+
+/* cl_command_buffer_state_khr */
+#define CL_COMMAND_BUFFER_STATE_RECORDING_KHR 0
+#define CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR 1
+#define CL_COMMAND_BUFFER_STATE_PENDING_KHR 2
+
+/* cl_command_type */
+#define CL_COMMAND_COMMAND_BUFFER_KHR 0x12A8
+
+
+typedef cl_command_buffer_khr CL_API_CALL
+clCreateCommandBufferKHR_t(
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ const cl_command_buffer_properties_khr* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandBufferKHR_t *
+clCreateCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clFinalizeCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clFinalizeCommandBufferKHR_t *
+clFinalizeCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clRetainCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clRetainCommandBufferKHR_t *
+clRetainCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clReleaseCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clReleaseCommandBufferKHR_t *
+clReleaseCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueCommandBufferKHR_t(
+ cl_uint num_queues,
+ cl_command_queue* queues,
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCommandBufferKHR_t *
+clEnqueueCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandBarrierWithWaitListKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandBarrierWithWaitListKHR_t *
+clCommandBarrierWithWaitListKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferKHR_t *
+clCommandCopyBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferRectKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferRectKHR_t *
+clCommandCopyBufferRectKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferToImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferToImageKHR_t *
+clCommandCopyBufferToImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyImageKHR_t *
+clCommandCopyImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyImageToBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* region,
+ size_t dst_offset,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyImageToBufferKHR_t *
+clCommandCopyImageToBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandFillBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem buffer,
+ const void* pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandFillBufferKHR_t *
+clCommandFillBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandFillImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem image,
+ const void* fill_color,
+ const size_t* origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandFillImageKHR_t *
+clCommandFillImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandNDRangeKernelKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ const size_t* local_work_size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandNDRangeKernelKHR_t *
+clCommandNDRangeKernelKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clGetCommandBufferInfoKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_buffer_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetCommandBufferInfoKHR_t *
+clGetCommandBufferInfoKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL
+clCreateCommandBufferKHR(
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ const cl_command_buffer_properties_khr* properties,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFinalizeCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCommandBufferKHR(
+ cl_uint num_queues,
+ cl_command_queue* queues,
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandBarrierWithWaitListKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferRectKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferToImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyImageToBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* region,
+ size_t dst_offset,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandFillBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem buffer,
+ const void* pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandFillImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem image,
+ const void* fill_color,
+ const size_t* origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandNDRangeKernelKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ const size_t* local_work_size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetCommandBufferInfoKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_buffer_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/* From version 0.9.4 of the extension */
+
+typedef cl_int CL_API_CALL
+clCommandSVMMemcpyKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandSVMMemcpyKHR_t *
+clCommandSVMMemcpyKHR_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL
+clCommandSVMMemFillKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandSVMMemFillKHR_t *
+clCommandSVMMemFillKHR_fn CL_API_SUFFIX__VERSION_2_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandSVMMemcpyKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandSVMMemFillKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_command_buffer_multi_device
+***************************************************************/
+#define cl_khr_command_buffer_multi_device 1
+#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_NAME \
+ "cl_khr_command_buffer_multi_device"
+
+
+#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 1)
+
+typedef cl_bitfield cl_platform_command_buffer_capabilities_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_COMMAND_BUFFER_CAPABILITIES_KHR 0x0908
+
+/* cl_platform_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_PLATFORM_UNIVERSAL_SYNC_KHR (1 << 0)
+#define CL_COMMAND_BUFFER_PLATFORM_REMAP_QUEUES_KHR (1 << 1)
+#define CL_COMMAND_BUFFER_PLATFORM_AUTOMATIC_REMAP_KHR (1 << 2)
+
+/* cl_device_info */
+#define CL_DEVICE_COMMAND_BUFFER_NUM_SYNC_DEVICES_KHR 0x12AB
+#define CL_DEVICE_COMMAND_BUFFER_SYNC_DEVICES_KHR 0x12AC
+
+/* cl_device_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR (1 << 4)
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR (1 << 2)
+
+
+typedef cl_command_buffer_khr CL_API_CALL
+clRemapCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_bool automatic,
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ cl_uint num_handles,
+ const cl_mutable_command_khr* handles,
+ cl_mutable_command_khr* handles_ret,
+ cl_int* errcode_ret);
+
+typedef clRemapCommandBufferKHR_t *
+clRemapCommandBufferKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL
+clRemapCommandBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_bool automatic,
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ cl_uint num_handles,
+ const cl_mutable_command_khr* handles,
+ cl_mutable_command_khr* handles_ret,
+ cl_int* errcode_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_command_buffer_mutable_dispatch
+***************************************************************/
+#define cl_khr_command_buffer_mutable_dispatch 1
+#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_NAME \
+ "cl_khr_command_buffer_mutable_dispatch"
+
+
+#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 3)
+
+typedef cl_uint cl_command_buffer_update_type_khr;
+typedef cl_bitfield cl_mutable_dispatch_fields_khr;
+typedef cl_uint cl_mutable_command_info_khr;
+typedef struct _cl_mutable_dispatch_arg_khr {
+ cl_uint arg_index;
+ size_t arg_size;
+ const void* arg_value;
+} cl_mutable_dispatch_arg_khr;
+typedef struct _cl_mutable_dispatch_exec_info_khr {
+ cl_uint param_name;
+ size_t param_value_size;
+ const void* param_value;
+} cl_mutable_dispatch_exec_info_khr;
+typedef struct _cl_mutable_dispatch_config_khr {
+ cl_mutable_command_khr command;
+ cl_uint num_args;
+ cl_uint num_svm_args;
+ cl_uint num_exec_infos;
+ cl_uint work_dim;
+ const cl_mutable_dispatch_arg_khr* arg_list;
+ const cl_mutable_dispatch_arg_khr* arg_svm_list;
+ const cl_mutable_dispatch_exec_info_khr* exec_info_list;
+ const size_t* global_work_offset;
+ const size_t* global_work_size;
+ const size_t* local_work_size;
+} cl_mutable_dispatch_config_khr;
+typedef cl_bitfield cl_mutable_dispatch_asserts_khr;
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_MUTABLE_KHR (1 << 1)
+
+/* Error codes */
+#define CL_INVALID_MUTABLE_COMMAND_KHR -1141
+
+/* cl_device_info */
+#define CL_DEVICE_MUTABLE_DISPATCH_CAPABILITIES_KHR 0x12B0
+
+/* cl_command_properties_khr */
+#define CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR 0x12B1
+
+/* cl_mutable_dispatch_fields_khr - bitfield */
+#define CL_MUTABLE_DISPATCH_GLOBAL_OFFSET_KHR (1 << 0)
+#define CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR (1 << 1)
+#define CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR (1 << 2)
+#define CL_MUTABLE_DISPATCH_ARGUMENTS_KHR (1 << 3)
+#define CL_MUTABLE_DISPATCH_EXEC_INFO_KHR (1 << 4)
+
+/* cl_mutable_command_info_khr */
+#define CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR 0x12A0
+#define CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR 0x12A1
+#define CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR 0x12AD
+#define CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR 0x12A2
+#define CL_MUTABLE_DISPATCH_KERNEL_KHR 0x12A3
+#define CL_MUTABLE_DISPATCH_DIMENSIONS_KHR 0x12A4
+#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR 0x12A5
+#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR 0x12A6
+#define CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR 0x12A7
+
+/* cl_command_buffer_update_type_khr */
+#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 0
+
+/* cl_command_buffer_properties_khr */
+#define CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B7
+
+/* cl_command_properties_khr */
+#define CL_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B8
+
+/* cl_mutable_dispatch_asserts_khr - bitfield */
+#define CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR (1 << 0)
+
+
+typedef cl_int CL_API_CALL
+clUpdateMutableCommandsKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_configs,
+ const cl_command_buffer_update_type_khr* config_types,
+ const void** configs);
+
+typedef clUpdateMutableCommandsKHR_t *
+clUpdateMutableCommandsKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clGetMutableCommandInfoKHR_t(
+ cl_mutable_command_khr command,
+ cl_mutable_command_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetMutableCommandInfoKHR_t *
+clGetMutableCommandInfoKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clUpdateMutableCommandsKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_configs,
+ const cl_command_buffer_update_type_khr* config_types,
+ const void** configs) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMutableCommandInfoKHR(
+ cl_mutable_command_khr command,
+ cl_mutable_command_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_fp64
+***************************************************************/
+#define cl_khr_fp64 1
+#define CL_KHR_FP64_EXTENSION_NAME \
+ "cl_khr_fp64"
+
+
+#define CL_KHR_FP64_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_1_2)
+/* cl_device_info - defined in CL.h for OpenCL 1.2 and newer */
+#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
+
+#endif /* !defined(CL_VERSION_1_2) */
+
+/***************************************************************
+* cl_khr_fp16
+***************************************************************/
+#define cl_khr_fp16 1
+#define CL_KHR_FP16_EXTENSION_NAME \
+ "cl_khr_fp16"
+
+
+#define CL_KHR_FP16_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_HALF_FP_CONFIG 0x1033
+
+/***************************************************************
+* cl_APPLE_SetMemObjectDestructor
+***************************************************************/
+#define cl_APPLE_SetMemObjectDestructor 1
+#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_NAME \
+ "cl_APPLE_SetMemObjectDestructor"
+
+
+#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clSetMemObjectDestructorAPPLE_t(
+ cl_mem memobj,
+ void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
+ void* user_data);
+
+typedef clSetMemObjectDestructorAPPLE_t *
+clSetMemObjectDestructorAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetMemObjectDestructorAPPLE(
+ cl_mem memobj,
+ void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_APPLE_ContextLoggingFunctions
+***************************************************************/
+#define cl_APPLE_ContextLoggingFunctions 1
+#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_NAME \
+ "cl_APPLE_ContextLoggingFunctions"
+
+
+#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef void CL_API_CALL
+clLogMessagesToSystemLogAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToSystemLogAPPLE_t *
+clLogMessagesToSystemLogAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void CL_API_CALL
+clLogMessagesToStdoutAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToStdoutAPPLE_t *
+clLogMessagesToStdoutAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void CL_API_CALL
+clLogMessagesToStderrAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToStderrAPPLE_t *
+clLogMessagesToStderrAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToSystemLogAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToStdoutAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToStderrAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_icd
+***************************************************************/
+#define cl_khr_icd 1
+#define CL_KHR_ICD_EXTENSION_NAME \
+ "cl_khr_icd"
+
+
+#define CL_KHR_ICD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_platform_info */
+#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
+
+/* Error codes */
+#define CL_PLATFORM_NOT_FOUND_KHR -1001
+
+
+typedef cl_int CL_API_CALL
+clIcdGetPlatformIDsKHR_t(
+ cl_uint num_entries,
+ cl_platform_id* platforms,
+ cl_uint* num_platforms);
+
+typedef clIcdGetPlatformIDsKHR_t *
+clIcdGetPlatformIDsKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clIcdGetPlatformIDsKHR(
+ cl_uint num_entries,
+ cl_platform_id* platforms,
+ cl_uint* num_platforms) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_il_program
+***************************************************************/
+#define cl_khr_il_program 1
+#define CL_KHR_IL_PROGRAM_EXTENSION_NAME \
+ "cl_khr_il_program"
+
+
+#define CL_KHR_IL_PROGRAM_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_IL_VERSION_KHR 0x105B
+
+/* cl_program_info */
+#define CL_PROGRAM_IL_KHR 0x1169
+
+
+typedef cl_program CL_API_CALL
+clCreateProgramWithILKHR_t(
+ cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithILKHR_t *
+clCreateProgramWithILKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithILKHR(
+ cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_image2d_from_buffer
+***************************************************************/
+#define cl_khr_image2d_from_buffer 1
+#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_NAME \
+ "cl_khr_image2d_from_buffer"
+
+
+#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR 0x104A
+#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR 0x104B
+
+/***************************************************************
+* cl_khr_initialize_memory
+***************************************************************/
+#define cl_khr_initialize_memory 1
+#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_NAME \
+ "cl_khr_initialize_memory"
+
+
+#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_context_memory_initialize_khr;
+
+/* cl_context_properties */
+#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030
+
+/* cl_context_memory_initialize_khr */
+#define CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR (1 << 0)
+#define CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR (1 << 1)
+
+/***************************************************************
+* cl_khr_terminate_context
+***************************************************************/
+#define cl_khr_terminate_context 1
+#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_NAME \
+ "cl_khr_terminate_context"
+
+
+#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_device_terminate_capability_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031
+
+/* cl_context_properties */
+#define CL_CONTEXT_TERMINATE_KHR 0x2032
+
+/* cl_device_terminate_capability_khr */
+#define CL_DEVICE_TERMINATE_CAPABILITY_CONTEXT_KHR (1 << 0)
+
+/* Error codes */
+#define CL_CONTEXT_TERMINATED_KHR -1121
+
+
+typedef cl_int CL_API_CALL
+clTerminateContextKHR_t(
+ cl_context context);
+
+typedef clTerminateContextKHR_t *
+clTerminateContextKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clTerminateContextKHR(
+ cl_context context) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_spir
+***************************************************************/
+#define cl_khr_spir 1
+#define CL_KHR_SPIR_EXTENSION_NAME \
+ "cl_khr_spir"
+
+
+#define CL_KHR_SPIR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SPIR_VERSIONS 0x40E0
+
+/* cl_program_binary_type */
+#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
+
+/***************************************************************
+* cl_khr_create_command_queue
+***************************************************************/
+#define cl_khr_create_command_queue 1
+#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_NAME \
+ "cl_khr_create_command_queue"
+
+
+#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_properties cl_queue_properties_khr;
+
+
+typedef cl_command_queue CL_API_CALL
+clCreateCommandQueueWithPropertiesKHR_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_queue_properties_khr* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandQueueWithPropertiesKHR_t *
+clCreateCommandQueueWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_queue CL_API_CALL
+clCreateCommandQueueWithPropertiesKHR(
+ cl_context context,
+ cl_device_id device,
+ const cl_queue_properties_khr* properties,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_nv_device_attribute_query
+***************************************************************/
+#define cl_nv_device_attribute_query 1
+#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_nv_device_attribute_query"
+
+
+#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
+#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
+#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
+#define CL_DEVICE_WARP_SIZE_NV 0x4003
+#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
+#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
+#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
+
+/***************************************************************
+* cl_amd_device_attribute_query
+***************************************************************/
+#define cl_amd_device_attribute_query 1
+#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_amd_device_attribute_query"
+
+
+#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
+#define CL_DEVICE_TOPOLOGY_AMD 0x4037
+#define CL_DEVICE_BOARD_NAME_AMD 0x4038
+#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
+#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
+#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
+#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
+#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
+#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
+#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
+#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
+#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
+#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
+#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
+#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
+#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
+#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
+#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031
+#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033
+#define CL_DEVICE_PCIE_ID_AMD 0x4034
+
+/***************************************************************
+* cl_arm_printf
+***************************************************************/
+#define cl_arm_printf 1
+#define CL_ARM_PRINTF_EXTENSION_NAME \
+ "cl_arm_printf"
+
+
+#define CL_ARM_PRINTF_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_context_properties */
+#define CL_PRINTF_CALLBACK_ARM 0x40B0
+#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
+
+/***************************************************************
+* cl_ext_device_fission
+***************************************************************/
+#define cl_ext_device_fission 1
+#define CL_EXT_DEVICE_FISSION_EXTENSION_NAME \
+ "cl_ext_device_fission"
+
+
+#define CL_EXT_DEVICE_FISSION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_ulong cl_device_partition_property_ext;
+
+/* Error codes */
+#define CL_DEVICE_PARTITION_FAILED_EXT -1057
+#define CL_INVALID_PARTITION_COUNT_EXT -1058
+#define CL_INVALID_PARTITION_NAME_EXT -1059
+
+/* cl_device_info */
+#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
+#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
+#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
+#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
+#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
+
+/* cl_device_partition_property_ext */
+#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
+#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
+#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
+#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
+
+/* cl_device_partition_property_ext - affinity domains */
+#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
+#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
+#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
+#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
+#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
+#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
+
+/* cl_device_partition_property_ext - list terminators */
+#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext)0)
+#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext)0)
+#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext)0 - 1)
+
+
+typedef cl_int CL_API_CALL
+clReleaseDeviceEXT_t(
+ cl_device_id device);
+
+typedef clReleaseDeviceEXT_t *
+clReleaseDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clRetainDeviceEXT_t(
+ cl_device_id device);
+
+typedef clRetainDeviceEXT_t *
+clRetainDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clCreateSubDevicesEXT_t(
+ cl_device_id in_device,
+ const cl_device_partition_property_ext* properties,
+ cl_uint num_entries,
+ cl_device_id* out_devices,
+ cl_uint* num_devices);
+
+typedef clCreateSubDevicesEXT_t *
+clCreateSubDevicesEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseDeviceEXT(
+ cl_device_id device) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainDeviceEXT(
+ cl_device_id device) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateSubDevicesEXT(
+ cl_device_id in_device,
+ const cl_device_partition_property_ext* properties,
+ cl_uint num_entries,
+ cl_device_id* out_devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_migrate_memobject
+***************************************************************/
+#define cl_ext_migrate_memobject 1
+#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_NAME \
+ "cl_ext_migrate_memobject"
+
+
+#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_mem_migration_flags_ext;
+
+/* cl_mem_migration_flags_ext */
+#define CL_MIGRATE_MEM_OBJECT_HOST_EXT (1 << 0)
+
+/* cl_command_type */
+#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040
+
+
+typedef cl_int CL_API_CALL
+clEnqueueMigrateMemObjectEXT_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_mem_migration_flags_ext flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMigrateMemObjectEXT_t *
+clEnqueueMigrateMemObjectEXT_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMigrateMemObjectEXT(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_mem_migration_flags_ext flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_cxx_for_opencl
+***************************************************************/
+#define cl_ext_cxx_for_opencl 1
+#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_NAME \
+ "cl_ext_cxx_for_opencl"
+
+
+#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230
+
+/***************************************************************
+* cl_qcom_ext_host_ptr
+***************************************************************/
+#define cl_qcom_ext_host_ptr 1
+#define CL_QCOM_EXT_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_ext_host_ptr"
+
+
+#define CL_QCOM_EXT_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_image_pitch_info_qcom;
+typedef struct _cl_mem_ext_host_ptr {
+ cl_uint allocation_type;
+ cl_uint host_cache_policy;
+} cl_mem_ext_host_ptr;
+
+/* cl_mem_flags */
+#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
+
+/* cl_device_info */
+#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
+#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
+
+/* cl_image_pitch_info_qcom */
+#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
+#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
+
+/* cl_uint host_cache_policy */
+#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
+#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
+#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
+#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceImageInfoQCOM_t(
+ cl_device_id device,
+ size_t image_width,
+ size_t image_height,
+ const cl_image_format* image_format,
+ cl_image_pitch_info_qcom param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetDeviceImageInfoQCOM_t *
+clGetDeviceImageInfoQCOM_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceImageInfoQCOM(
+ cl_device_id device,
+ size_t image_width,
+ size_t image_height,
+ const cl_image_format* image_format,
+ cl_image_pitch_info_qcom param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_qcom_ext_host_ptr_iocoherent
+***************************************************************/
+#define cl_qcom_ext_host_ptr_iocoherent 1
+#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_NAME \
+ "cl_qcom_ext_host_ptr_iocoherent"
+
+
+#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_uint host_cache_policy */
+#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9
+
+/***************************************************************
+* cl_qcom_ion_host_ptr
+***************************************************************/
+#define cl_qcom_ion_host_ptr 1
+#define CL_QCOM_ION_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_ion_host_ptr"
+
+
+#define CL_QCOM_ION_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_ext_host_ptr */
+typedef struct _cl_mem_ion_host_ptr {
+ cl_mem_ext_host_ptr ext_host_ptr;
+ int ion_filedesc;
+ void* ion_hostptr;
+} cl_mem_ion_host_ptr;
+
+/* cl_uint allocation_type */
+#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
+
+/***************************************************************
+* cl_qcom_android_native_buffer_host_ptr
+***************************************************************/
+#define cl_qcom_android_native_buffer_host_ptr 1
+#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_android_native_buffer_host_ptr"
+
+
+#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_ext_host_ptr */
+typedef struct _cl_mem_android_native_buffer_host_ptr {
+ cl_mem_ext_host_ptr ext_host_ptr;
+ void* anb_ptr;
+} cl_mem_android_native_buffer_host_ptr;
+
+/* cl_uint allocation_type */
+#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6
+
+/***************************************************************
+* cl_img_yuv_image
+***************************************************************/
+#define cl_img_yuv_image 1
+#define CL_IMG_YUV_IMAGE_EXTENSION_NAME \
+ "cl_img_yuv_image"
+
+
+#define CL_IMG_YUV_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_NV21_IMG 0x40D0
+#define CL_YV12_IMG 0x40D1
+
+/***************************************************************
+* cl_img_cached_allocations
+***************************************************************/
+#define cl_img_cached_allocations 1
+#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_NAME \
+ "cl_img_cached_allocations"
+
+
+#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_flags */
+#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
+#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
+
+/***************************************************************
+* cl_img_use_gralloc_ptr
+***************************************************************/
+#define cl_img_use_gralloc_ptr 1
+#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_NAME \
+ "cl_img_use_gralloc_ptr"
+
+
+#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Error codes */
+#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
+#define CL_INVALID_GRALLOC_OBJECT_IMG 0x40D5
+
+/* cl_mem_flags */
+#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
+#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
+
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireGrallocObjectsIMG_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireGrallocObjectsIMG_t *
+clEnqueueAcquireGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseGrallocObjectsIMG_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseGrallocObjectsIMG_t *
+clEnqueueReleaseGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGrallocObjectsIMG(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGrallocObjectsIMG(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_img_generate_mipmap
+***************************************************************/
+#define cl_img_generate_mipmap 1
+#define CL_IMG_GENERATE_MIPMAP_EXTENSION_NAME \
+ "cl_img_generate_mipmap"
+
+
+#define CL_IMG_GENERATE_MIPMAP_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_mipmap_filter_mode_img;
+
+/* cl_mipmap_filter_mode_img */
+#define CL_MIPMAP_FILTER_ANY_IMG 0x0
+#define CL_MIPMAP_FILTER_BOX_IMG 0x1
+
+/* cl_command_type */
+#define CL_COMMAND_GENERATE_MIPMAP_IMG 0x40D6
+
+
+typedef cl_int CL_API_CALL
+clEnqueueGenerateMipmapIMG_t(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ cl_mipmap_filter_mode_img mipmap_filter_mode,
+ const size_t* array_region,
+ const size_t* mip_region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueGenerateMipmapIMG_t *
+clEnqueueGenerateMipmapIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueGenerateMipmapIMG(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ cl_mipmap_filter_mode_img mipmap_filter_mode,
+ const size_t* array_region,
+ const size_t* mip_region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_img_mem_properties
+***************************************************************/
+#define cl_img_mem_properties 1
+#define CL_IMG_MEM_PROPERTIES_EXTENSION_NAME \
+ "cl_img_mem_properties"
+
+
+#define CL_IMG_MEM_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties */
+#define CL_MEM_ALLOC_FLAGS_IMG 0x40D7
+
+/* cl_mem_alloc_flags_img */
+#define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0)
+#define CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG (1 << 1)
+#define CL_MEM_ALLOC_GPU_CACHED_IMG (1 << 2)
+#define CL_MEM_ALLOC_CPU_LOCAL_IMG (1 << 3)
+#define CL_MEM_ALLOC_GPU_LOCAL_IMG (1 << 4)
+#define CL_MEM_ALLOC_GPU_PRIVATE_IMG (1 << 5)
+
+/* cl_device_info */
+#define CL_DEVICE_MEMORY_CAPABILITIES_IMG 0x40D8
+
+/***************************************************************
+* cl_khr_subgroups
+***************************************************************/
+#define cl_khr_subgroups 1
+#define CL_KHR_SUBGROUPS_EXTENSION_NAME \
+ "cl_khr_subgroups"
+
+
+#define CL_KHR_SUBGROUPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_2_1)
+/* defined in CL.h for OpenCL 2.1 and newer */
+typedef cl_uint cl_kernel_sub_group_info;
+
+#endif /* !defined(CL_VERSION_2_1) */
+
+/* cl_kernel_sub_group_info */
+#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033
+#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034
+
+
+typedef cl_int CL_API_CALL
+clGetKernelSubGroupInfoKHR_t(
+ cl_kernel in_kernel,
+ cl_device_id in_device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelSubGroupInfoKHR_t *
+clGetKernelSubGroupInfoKHR_fn CL_API_SUFFIX__VERSION_2_0_DEPRECATED;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelSubGroupInfoKHR(
+ cl_kernel in_kernel,
+ cl_device_id in_device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_0_DEPRECATED;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_mipmap_image
+***************************************************************/
+#define cl_khr_mipmap_image 1
+#define CL_KHR_MIPMAP_IMAGE_EXTENSION_NAME \
+ "cl_khr_mipmap_image"
+
+
+#define CL_KHR_MIPMAP_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_sampler_properties */
+#define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155
+#define CL_SAMPLER_LOD_MIN_KHR 0x1156
+#define CL_SAMPLER_LOD_MAX_KHR 0x1157
+
+/***************************************************************
+* cl_khr_priority_hints
+***************************************************************/
+#define cl_khr_priority_hints 1
+#define CL_KHR_PRIORITY_HINTS_EXTENSION_NAME \
+ "cl_khr_priority_hints"
+
+
+#define CL_KHR_PRIORITY_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* To be used by clGetEventInfo */
+typedef cl_uint cl_queue_priority_khr;
+
+/* cl_queue_properties */
+#define CL_QUEUE_PRIORITY_KHR 0x1096
+
+/* cl_queue_priority_khr */
+#define CL_QUEUE_PRIORITY_HIGH_KHR (1 << 0)
+#define CL_QUEUE_PRIORITY_MED_KHR (1 << 1)
+#define CL_QUEUE_PRIORITY_LOW_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_throttle_hints
+***************************************************************/
+#define cl_khr_throttle_hints 1
+#define CL_KHR_THROTTLE_HINTS_EXTENSION_NAME \
+ "cl_khr_throttle_hints"
+
+
+#define CL_KHR_THROTTLE_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* To be used by clGetEventInfo */
+typedef cl_uint cl_queue_throttle_khr;
+
+/* cl_queue_properties */
+#define CL_QUEUE_THROTTLE_KHR 0x1097
+
+/* cl_queue_throttle_khr */
+#define CL_QUEUE_THROTTLE_HIGH_KHR (1 << 0)
+#define CL_QUEUE_THROTTLE_MED_KHR (1 << 1)
+#define CL_QUEUE_THROTTLE_LOW_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_subgroup_named_barrier
+***************************************************************/
+#define cl_khr_subgroup_named_barrier 1
+#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_NAME \
+ "cl_khr_subgroup_named_barrier"
+
+
+#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035
+
+/***************************************************************
+* cl_khr_extended_versioning
+***************************************************************/
+#define cl_khr_extended_versioning 1
+#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_NAME \
+ "cl_khr_extended_versioning"
+
+
+#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#define CL_VERSION_MAJOR_BITS_KHR 10
+#define CL_VERSION_MINOR_BITS_KHR 10
+#define CL_VERSION_PATCH_BITS_KHR 12
+
+#define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1)
+#define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1)
+#define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1)
+
+#define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR))
+#define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR)
+#define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR)
+
+#define CL_MAKE_VERSION_KHR(major, minor, patch) \
+ ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \
+ (((minor) & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \
+ ((patch) & CL_VERSION_PATCH_MASK_KHR))
+
+#define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64
+
+typedef cl_uint cl_version_khr;
+typedef struct _cl_name_version_khr {
+ cl_version_khr version;
+ char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR];
+} cl_name_version_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_NUMERIC_VERSION_KHR 0x0906
+#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR 0x0907
+
+/* cl_device_info */
+#define CL_DEVICE_NUMERIC_VERSION_KHR 0x105E
+#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR 0x105F
+#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR 0x1060
+#define CL_DEVICE_ILS_WITH_VERSION_KHR 0x1061
+#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR 0x1062
+
+/***************************************************************
+* cl_khr_device_uuid
+***************************************************************/
+#define cl_khr_device_uuid 1
+#define CL_KHR_DEVICE_UUID_EXTENSION_NAME \
+ "cl_khr_device_uuid"
+
+
+#define CL_KHR_DEVICE_UUID_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* Size Constants */
+#define CL_UUID_SIZE_KHR 16
+#define CL_LUID_SIZE_KHR 8
+
+/* cl_device_info */
+#define CL_DEVICE_UUID_KHR 0x106A
+#define CL_DRIVER_UUID_KHR 0x106B
+#define CL_DEVICE_LUID_VALID_KHR 0x106C
+#define CL_DEVICE_LUID_KHR 0x106D
+#define CL_DEVICE_NODE_MASK_KHR 0x106E
+
+/***************************************************************
+* cl_khr_pci_bus_info
+***************************************************************/
+#define cl_khr_pci_bus_info 1
+#define CL_KHR_PCI_BUS_INFO_EXTENSION_NAME \
+ "cl_khr_pci_bus_info"
+
+
+#define CL_KHR_PCI_BUS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef struct _cl_device_pci_bus_info_khr {
+ cl_uint pci_domain;
+ cl_uint pci_bus;
+ cl_uint pci_device;
+ cl_uint pci_function;
+} cl_device_pci_bus_info_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_PCI_BUS_INFO_KHR 0x410F
+
+/***************************************************************
+* cl_khr_suggested_local_work_size
+***************************************************************/
+#define cl_khr_suggested_local_work_size 1
+#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_NAME \
+ "cl_khr_suggested_local_work_size"
+
+
+#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clGetKernelSuggestedLocalWorkSizeKHR_t(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ size_t* suggested_local_work_size);
+
+typedef clGetKernelSuggestedLocalWorkSizeKHR_t *
+clGetKernelSuggestedLocalWorkSizeKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelSuggestedLocalWorkSizeKHR(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_integer_dot_product
+***************************************************************/
+#define cl_khr_integer_dot_product 1
+#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_NAME \
+ "cl_khr_integer_dot_product"
+
+
+#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_VERSION CL_MAKE_VERSION(2, 0, 0)
+
+typedef cl_bitfield cl_device_integer_dot_product_capabilities_khr;
+typedef struct _cl_device_integer_dot_product_acceleration_properties_khr {
+ cl_bool signed_accelerated;
+ cl_bool unsigned_accelerated;
+ cl_bool mixed_signedness_accelerated;
+ cl_bool accumulating_saturating_signed_accelerated;
+ cl_bool accumulating_saturating_unsigned_accelerated;
+ cl_bool accumulating_saturating_mixed_signedness_accelerated;
+} cl_device_integer_dot_product_acceleration_properties_khr;
+
+/* cl_device_integer_dot_product_capabilities_khr */
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR (1 << 0)
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR (1 << 1)
+
+/* cl_device_info */
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR 0x1073
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR 0x1074
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR 0x1075
+
+/***************************************************************
+* cl_khr_external_memory
+***************************************************************/
+#define cl_khr_external_memory 1
+#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_NAME \
+ "cl_khr_external_memory"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1)
+
+typedef cl_uint cl_external_memory_handle_type_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x2044
+
+/* cl_device_info */
+#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x204F
+#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR 0x2052
+
+/* cl_mem_properties */
+#define CL_MEM_DEVICE_HANDLE_LIST_KHR 0x2051
+#define CL_MEM_DEVICE_HANDLE_LIST_END_KHR 0
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR 0x2047
+#define CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR 0x2048
+
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireExternalMemObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireExternalMemObjectsKHR_t *
+clEnqueueAcquireExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseExternalMemObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseExternalMemObjectsKHR_t *
+clEnqueueReleaseExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireExternalMemObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_3_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseExternalMemObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_memory_dma_buf
+***************************************************************/
+#define cl_khr_external_memory_dma_buf 1
+#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME \
+ "cl_khr_external_memory_dma_buf"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR 0x2067
+
+/***************************************************************
+* cl_khr_external_memory_opaque_fd
+***************************************************************/
+#define cl_khr_external_memory_opaque_fd 1
+#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_NAME \
+ "cl_khr_external_memory_opaque_fd"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR 0x2060
+
+/***************************************************************
+* cl_khr_external_memory_win32
+***************************************************************/
+#define cl_khr_external_memory_win32 1
+#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME \
+ "cl_khr_external_memory_win32"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(1, 1, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR 0x2061
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2062
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2069
+
+/***************************************************************
+* cl_khr_external_semaphore
+***************************************************************/
+#define cl_khr_external_semaphore 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME \
+ "cl_khr_external_semaphore"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1)
+
+typedef struct _cl_semaphore_khr * cl_semaphore_khr;
+typedef cl_uint cl_external_semaphore_handle_type_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x2037
+#define CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x2038
+
+/* cl_device_info */
+#define CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x204D
+#define CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x204E
+
+/* cl_semaphore_properties_khr */
+#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x203F
+#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR 0
+
+/* cl_semaphore_info_khr */
+#define CL_SEMAPHORE_EXPORTABLE_KHR 0x2054
+
+
+typedef cl_int CL_API_CALL
+clGetSemaphoreHandleForTypeKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_device_id device,
+ cl_external_semaphore_handle_type_khr handle_type,
+ size_t handle_size,
+ void* handle_ptr,
+ size_t* handle_size_ret);
+
+typedef clGetSemaphoreHandleForTypeKHR_t *
+clGetSemaphoreHandleForTypeKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSemaphoreHandleForTypeKHR(
+ cl_semaphore_khr sema_object,
+ cl_device_id device,
+ cl_external_semaphore_handle_type_khr handle_type,
+ size_t handle_size,
+ void* handle_ptr,
+ size_t* handle_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_semaphore_opaque_fd
+***************************************************************/
+#define cl_khr_external_semaphore_opaque_fd 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_NAME \
+ "cl_khr_external_semaphore_opaque_fd"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR 0x2055
+
+/***************************************************************
+* cl_khr_external_semaphore_sync_fd
+***************************************************************/
+#define cl_khr_external_semaphore_sync_fd 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_NAME \
+ "cl_khr_external_semaphore_sync_fd"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_properties cl_semaphore_reimport_properties_khr;
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_SYNC_FD_KHR 0x2058
+
+
+typedef cl_int CL_API_CALL
+clReImportSemaphoreSyncFdKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_reimport_properties_khr* reimport_props,
+ int fd);
+
+typedef clReImportSemaphoreSyncFdKHR_t *
+clReImportSemaphoreSyncFdKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReImportSemaphoreSyncFdKHR(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_reimport_properties_khr* reimport_props,
+ int fd) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_semaphore_win32
+***************************************************************/
+#define cl_khr_external_semaphore_win32 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME \
+ "cl_khr_external_semaphore_win32"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 1)
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR 0x2056
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2057
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2068
+
+/***************************************************************
+* cl_khr_semaphore
+***************************************************************/
+#define cl_khr_semaphore 1
+#define CL_KHR_SEMAPHORE_EXTENSION_NAME \
+ "cl_khr_semaphore"
+
+
+#define CL_KHR_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* type cl_semaphore_khr */
+typedef cl_properties cl_semaphore_properties_khr;
+typedef cl_uint cl_semaphore_info_khr;
+typedef cl_uint cl_semaphore_type_khr;
+typedef cl_ulong cl_semaphore_payload_khr;
+
+/* cl_semaphore_type */
+#define CL_SEMAPHORE_TYPE_BINARY_KHR 1
+
+/* cl_platform_info */
+#define CL_PLATFORM_SEMAPHORE_TYPES_KHR 0x2036
+
+/* cl_device_info */
+#define CL_DEVICE_SEMAPHORE_TYPES_KHR 0x204C
+
+/* cl_semaphore_info_khr */
+#define CL_SEMAPHORE_CONTEXT_KHR 0x2039
+#define CL_SEMAPHORE_REFERENCE_COUNT_KHR 0x203A
+#define CL_SEMAPHORE_PROPERTIES_KHR 0x203B
+#define CL_SEMAPHORE_PAYLOAD_KHR 0x203C
+
+/* cl_semaphore_info_khr or cl_semaphore_properties_khr */
+#define CL_SEMAPHORE_TYPE_KHR 0x203D
+#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR 0x2053
+#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR 0
+
+/* cl_command_type */
+#define CL_COMMAND_SEMAPHORE_WAIT_KHR 0x2042
+#define CL_COMMAND_SEMAPHORE_SIGNAL_KHR 0x2043
+
+/* Error codes */
+#define CL_INVALID_SEMAPHORE_KHR -1142
+
+
+typedef cl_semaphore_khr CL_API_CALL
+clCreateSemaphoreWithPropertiesKHR_t(
+ cl_context context,
+ const cl_semaphore_properties_khr* sema_props,
+ cl_int* errcode_ret);
+
+typedef clCreateSemaphoreWithPropertiesKHR_t *
+clCreateSemaphoreWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueWaitSemaphoresKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWaitSemaphoresKHR_t *
+clEnqueueWaitSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSignalSemaphoresKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSignalSemaphoresKHR_t *
+clEnqueueSignalSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clGetSemaphoreInfoKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetSemaphoreInfoKHR_t *
+clGetSemaphoreInfoKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clReleaseSemaphoreKHR_t(
+ cl_semaphore_khr sema_object);
+
+typedef clReleaseSemaphoreKHR_t *
+clReleaseSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clRetainSemaphoreKHR_t(
+ cl_semaphore_khr sema_object);
+
+typedef clRetainSemaphoreKHR_t *
+clRetainSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_semaphore_khr CL_API_CALL
+clCreateSemaphoreWithPropertiesKHR(
+ cl_context context,
+ const cl_semaphore_properties_khr* sema_props,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWaitSemaphoresKHR(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSignalSemaphoresKHR(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSemaphoreInfoKHR(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseSemaphoreKHR(
+ cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainSemaphoreKHR(
+ cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_import_memory
+***************************************************************/
+#define cl_arm_import_memory 1
+#define CL_ARM_IMPORT_MEMORY_EXTENSION_NAME \
+ "cl_arm_import_memory"
+
+
+#define CL_ARM_IMPORT_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef intptr_t cl_import_properties_arm;
+
+/* cl_import_properties_arm */
+#define CL_IMPORT_TYPE_ARM 0x40B2
+#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
+#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
+#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5
+#define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2
+#define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3
+#define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX
+#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM 0x41EF
+#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM 0x41F0
+
+
+typedef cl_mem CL_API_CALL
+clImportMemoryARM_t(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_import_properties_arm* properties,
+ void* memory,
+ size_t size,
+ cl_int* errcode_ret);
+
+typedef clImportMemoryARM_t *
+clImportMemoryARM_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clImportMemoryARM(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_import_properties_arm* properties,
+ void* memory,
+ size_t size,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_shared_virtual_memory
+***************************************************************/
+#define cl_arm_shared_virtual_memory 1
+#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_NAME \
+ "cl_arm_shared_virtual_memory"
+
+
+#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_svm_mem_flags_arm;
+typedef cl_uint cl_kernel_exec_info_arm;
+typedef cl_bitfield cl_device_svm_capabilities_arm;
+
+/* cl_device_info */
+#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
+
+/* cl_mem_info */
+#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
+
+/* cl_kernel_exec_info_arm */
+#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
+#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
+
+/* cl_command_type */
+#define CL_COMMAND_SVM_FREE_ARM 0x40BA
+#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
+#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
+#define CL_COMMAND_SVM_MAP_ARM 0x40BD
+#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
+
+/* cl_device_svm_capabilities_arm */
+#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
+#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
+#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
+#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
+
+/* cl_svm_mem_flags_arm */
+#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
+#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
+
+
+typedef void* CL_API_CALL
+clSVMAllocARM_t(
+ cl_context context,
+ cl_svm_mem_flags_arm flags,
+ size_t size,
+ cl_uint alignment);
+
+typedef clSVMAllocARM_t *
+clSVMAllocARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef void CL_API_CALL
+clSVMFreeARM_t(
+ cl_context context,
+ void* svm_pointer);
+
+typedef clSVMFreeARM_t *
+clSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMFreeARM_t(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void* svm_pointers[],
+ void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void * svm_pointers[], void *user_data),
+ void* user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMFreeARM_t *
+clEnqueueSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMemcpyARM_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemcpyARM_t *
+clEnqueueSVMMemcpyARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMemFillARM_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemFillARM_t *
+clEnqueueSVMMemFillARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMapARM_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void* svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMapARM_t *
+clEnqueueSVMMapARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMUnmapARM_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMUnmapARM_t *
+clEnqueueSVMUnmapARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clSetKernelArgSVMPointerARM_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value);
+
+typedef clSetKernelArgSVMPointerARM_t *
+clSetKernelArgSVMPointerARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clSetKernelExecInfoARM_t(
+ cl_kernel kernel,
+ cl_kernel_exec_info_arm param_name,
+ size_t param_value_size,
+ const void* param_value);
+
+typedef clSetKernelExecInfoARM_t *
+clSetKernelExecInfoARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void* CL_API_CALL
+clSVMAllocARM(
+ cl_context context,
+ cl_svm_mem_flags_arm flags,
+ size_t size,
+ cl_uint alignment) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY void CL_API_CALL
+clSVMFreeARM(
+ cl_context context,
+ void* svm_pointer) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMFreeARM(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void* svm_pointers[],
+ void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void * svm_pointers[], void *user_data),
+ void* user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemcpyARM(
+ cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemFillARM(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMapARM(
+ cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void* svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMUnmapARM(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArgSVMPointerARM(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelExecInfoARM(
+ cl_kernel kernel,
+ cl_kernel_exec_info_arm param_name,
+ size_t param_value_size,
+ const void* param_value) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_get_core_id
+***************************************************************/
+#if defined(CL_VERSION_1_2)
+
+#define cl_arm_get_core_id 1
+#define CL_ARM_GET_CORE_ID_EXTENSION_NAME \
+ "cl_arm_get_core_id"
+
+
+#define CL_ARM_GET_CORE_ID_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/***************************************************************
+* cl_arm_job_slot_selection
+***************************************************************/
+#define cl_arm_job_slot_selection 1
+#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_NAME \
+ "cl_arm_job_slot_selection"
+
+
+#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_JOB_SLOTS_ARM 0x41E0
+
+/* cl_queue_properties */
+#define CL_QUEUE_JOB_SLOT_ARM 0x41E1
+
+/***************************************************************
+* cl_arm_scheduling_controls
+***************************************************************/
+#define cl_arm_scheduling_controls 1
+#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_NAME \
+ "cl_arm_scheduling_controls"
+
+
+#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Types */
+typedef cl_bitfield cl_device_scheduling_controls_capabilities_arm;
+
+/* cl_device_scheduling_controls_capabilities_arm */
+#define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM (1 << 0)
+#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM (1 << 1)
+#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2)
+#define CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM (1 << 3)
+#define CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM (1 << 4)
+#define CL_DEVICE_SCHEDULING_WARP_THROTTLING_ARM (1 << 5)
+#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_BATCH_QUEUE_SIZE_ARM (1 << 6)
+#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_LIMIT_ARM (1 << 7)
+
+/* cl_device_info */
+#define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM 0x41E4
+#define CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM 0x41EB
+#define CL_DEVICE_MAX_WARP_COUNT_ARM 0x41EA
+
+/* cl_kernel_exec_info */
+#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM 0x41E5
+#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM 0x41E6
+#define CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM 0x41E8
+#define CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM 0x41F1
+
+/* cl_kernel_info */
+#define CL_KERNEL_MAX_WARP_COUNT_ARM 0x41E9
+
+/* cl_queue_properties */
+#define CL_QUEUE_KERNEL_BATCHING_ARM 0x41E7
+#define CL_QUEUE_DEFERRED_FLUSH_ARM 0x41EC
+#define CL_QUEUE_COMPUTE_UNIT_LIMIT_ARM 0x41F3
+
+/***************************************************************
+* cl_arm_controlled_kernel_termination
+***************************************************************/
+#define cl_arm_controlled_kernel_termination 1
+#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_NAME \
+ "cl_arm_controlled_kernel_termination"
+
+
+#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Types */
+typedef cl_bitfield cl_device_controlled_termination_capabilities_arm;
+
+/* Error codes */
+#define CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM -1108
+
+/* cl_device_controlled_termination_capabilities_arm */
+#define CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM (1 << 0)
+#define CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM (1 << 1)
+#define CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM (1 << 2)
+
+/* cl_device_info */
+#define CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM 0x41EE
+
+/* cl_event_info */
+#define CL_EVENT_COMMAND_TERMINATION_REASON_ARM 0x41ED
+
+/* cl_command_termination_reason_arm */
+#define CL_COMMAND_TERMINATION_COMPLETION_ARM 0
+#define CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM 1
+#define CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM 2
+#define CL_COMMAND_TERMINATION_ERROR_ARM 3
+
+/***************************************************************
+* cl_arm_protected_memory_allocation
+***************************************************************/
+#define cl_arm_protected_memory_allocation 1
+#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_NAME \
+ "cl_arm_protected_memory_allocation"
+
+
+#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+#define CL_MEM_PROTECTED_ALLOC_ARM ((cl_bitfield)1 << 36)
+
+/***************************************************************
+* cl_intel_exec_by_local_thread
+***************************************************************/
+#define cl_intel_exec_by_local_thread 1
+#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_NAME \
+ "cl_intel_exec_by_local_thread"
+
+
+#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_command_queue_properties - bitfield */
+#define CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL ((cl_bitfield)1 << 31)
+
+/***************************************************************
+* cl_intel_device_attribute_query
+***************************************************************/
+#define cl_intel_device_attribute_query 1
+#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_intel_device_attribute_query"
+
+
+#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_device_feature_capabilities_intel;
+
+/* cl_device_feature_capabilities_intel */
+#define CL_DEVICE_FEATURE_FLAG_DP4A_INTEL (1 << 0)
+#define CL_DEVICE_FEATURE_FLAG_DPAS_INTEL (1 << 1)
+
+/* cl_device_info */
+#define CL_DEVICE_IP_VERSION_INTEL 0x4250
+#define CL_DEVICE_ID_INTEL 0x4251
+#define CL_DEVICE_NUM_SLICES_INTEL 0x4252
+#define CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL 0x4253
+#define CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL 0x4254
+#define CL_DEVICE_NUM_THREADS_PER_EU_INTEL 0x4255
+#define CL_DEVICE_FEATURE_CAPABILITIES_INTEL 0x4256
+
+/***************************************************************
+* cl_intel_device_partition_by_names
+***************************************************************/
+#define cl_intel_device_partition_by_names 1
+#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_NAME \
+ "cl_intel_device_partition_by_names"
+
+
+#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+#define CL_DEVICE_PARTITION_BY_NAMES_INTEL 0x4052
+#define CL_PARTITION_BY_NAMES_LIST_END_INTEL -1
+
+/***************************************************************
+* cl_intel_accelerator
+***************************************************************/
+#define cl_intel_accelerator 1
+#define CL_INTEL_ACCELERATOR_EXTENSION_NAME \
+ "cl_intel_accelerator"
+
+
+#define CL_INTEL_ACCELERATOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef struct _cl_accelerator_intel* cl_accelerator_intel;
+typedef cl_uint cl_accelerator_type_intel;
+typedef cl_uint cl_accelerator_info_intel;
+
+/* cl_accelerator_info_intel */
+#define CL_ACCELERATOR_DESCRIPTOR_INTEL 0x4090
+#define CL_ACCELERATOR_REFERENCE_COUNT_INTEL 0x4091
+#define CL_ACCELERATOR_CONTEXT_INTEL 0x4092
+#define CL_ACCELERATOR_TYPE_INTEL 0x4093
+
+/* Error codes */
+#define CL_INVALID_ACCELERATOR_INTEL -1094
+#define CL_INVALID_ACCELERATOR_TYPE_INTEL -1095
+#define CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL -1096
+#define CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL -1097
+
+
+typedef cl_accelerator_intel CL_API_CALL
+clCreateAcceleratorINTEL_t(
+ cl_context context,
+ cl_accelerator_type_intel accelerator_type,
+ size_t descriptor_size,
+ const void* descriptor,
+ cl_int* errcode_ret);
+
+typedef clCreateAcceleratorINTEL_t *
+clCreateAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clGetAcceleratorInfoINTEL_t(
+ cl_accelerator_intel accelerator,
+ cl_accelerator_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetAcceleratorInfoINTEL_t *
+clGetAcceleratorInfoINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clRetainAcceleratorINTEL_t(
+ cl_accelerator_intel accelerator);
+
+typedef clRetainAcceleratorINTEL_t *
+clRetainAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clReleaseAcceleratorINTEL_t(
+ cl_accelerator_intel accelerator);
+
+typedef clReleaseAcceleratorINTEL_t *
+clReleaseAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_accelerator_intel CL_API_CALL
+clCreateAcceleratorINTEL(
+ cl_context context,
+ cl_accelerator_type_intel accelerator_type,
+ size_t descriptor_size,
+ const void* descriptor,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetAcceleratorInfoINTEL(
+ cl_accelerator_intel accelerator,
+ cl_accelerator_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainAcceleratorINTEL(
+ cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseAcceleratorINTEL(
+ cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_motion_estimation
+***************************************************************/
+#define cl_intel_motion_estimation 1
+#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_motion_estimation"
+
+
+#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef struct _cl_motion_estimation_desc_intel {
+ cl_uint mb_block_type;
+ cl_uint subpixel_mode;
+ cl_uint sad_adjust_mode;
+ cl_uint search_path_type;
+} cl_motion_estimation_desc_intel;
+
+/* cl_accelerator_type_intel */
+#define CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL 0x0
+
+/* cl_uint mb_block_type */
+#define CL_ME_MB_TYPE_16x16_INTEL 0x0
+#define CL_ME_MB_TYPE_8x8_INTEL 0x1
+#define CL_ME_MB_TYPE_4x4_INTEL 0x2
+
+/* cl_uint subpixel_mode */
+#define CL_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
+#define CL_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
+#define CL_ME_SUBPIXEL_MODE_QPEL_INTEL 0x2
+
+/* cl_uint sad_adjust_mode */
+#define CL_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
+#define CL_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x1
+
+/* cl_uint search_path_type */
+#define CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL 0x0
+#define CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL 0x1
+#define CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL 0x5
+
+/***************************************************************
+* cl_intel_advanced_motion_estimation
+***************************************************************/
+#define cl_intel_advanced_motion_estimation 1
+#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_advanced_motion_estimation"
+
+
+#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_ME_VERSION_INTEL 0x407E
+
+#define CL_ME_VERSION_LEGACY_INTEL 0x0
+#define CL_ME_VERSION_ADVANCED_VER_1_INTEL 0x1
+#define CL_ME_VERSION_ADVANCED_VER_2_INTEL 0x2
+
+#define CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL 0x1
+#define CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL 0x2
+
+#define CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL 0x0
+#define CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL 0x4
+
+#define CL_ME_COST_PENALTY_NONE_INTEL 0x0
+#define CL_ME_COST_PENALTY_LOW_INTEL 0x1
+#define CL_ME_COST_PENALTY_NORMAL_INTEL 0x2
+#define CL_ME_COST_PENALTY_HIGH_INTEL 0x3
+
+#define CL_ME_COST_PRECISION_QPEL_INTEL 0x0
+#define CL_ME_COST_PRECISION_HPEL_INTEL 0x1
+#define CL_ME_COST_PRECISION_PEL_INTEL 0x2
+#define CL_ME_COST_PRECISION_DPEL_INTEL 0x3
+
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
+#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
+#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
+#define CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
+
+#define CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
+#define CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
+#define CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
+
+#define CL_ME_FORWARD_INPUT_MODE_INTEL 0x1
+#define CL_ME_BACKWARD_INPUT_MODE_INTEL 0x2
+#define CL_ME_BIDIRECTION_INPUT_MODE_INTEL 0x3
+
+#define CL_ME_BIDIR_WEIGHT_QUARTER_INTEL 16
+#define CL_ME_BIDIR_WEIGHT_THIRD_INTEL 21
+#define CL_ME_BIDIR_WEIGHT_HALF_INTEL 32
+#define CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 43
+#define CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 48
+
+/***************************************************************
+* cl_intel_simultaneous_sharing
+***************************************************************/
+#define cl_intel_simultaneous_sharing 1
+#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_NAME \
+ "cl_intel_simultaneous_sharing"
+
+
+#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL 0x4104
+#define CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL 0x4105
+
+/***************************************************************
+* cl_intel_egl_image_yuv
+***************************************************************/
+#define cl_intel_egl_image_yuv 1
+#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_NAME \
+ "cl_intel_egl_image_yuv"
+
+
+#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_egl_image_properties_khr */
+#define CL_EGL_YUV_PLANE_INTEL 0x4107
+
+/***************************************************************
+* cl_intel_packed_yuv
+***************************************************************/
+#define cl_intel_packed_yuv 1
+#define CL_INTEL_PACKED_YUV_EXTENSION_NAME \
+ "cl_intel_packed_yuv"
+
+
+#define CL_INTEL_PACKED_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_YUYV_INTEL 0x4076
+#define CL_UYVY_INTEL 0x4077
+#define CL_YVYU_INTEL 0x4078
+#define CL_VYUY_INTEL 0x4079
+
+/***************************************************************
+* cl_intel_required_subgroup_size
+***************************************************************/
+#define cl_intel_required_subgroup_size 1
+#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME \
+ "cl_intel_required_subgroup_size"
+
+
+#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SUB_GROUP_SIZES_INTEL 0x4108
+
+/* cl_kernel_work_group_info */
+#define CL_KERNEL_SPILL_MEM_SIZE_INTEL 0x4109
+
+/* cl_kernel_sub_group_info */
+#define CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL 0x410A
+
+/***************************************************************
+* cl_intel_driver_diagnostics
+***************************************************************/
+#define cl_intel_driver_diagnostics 1
+#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_NAME \
+ "cl_intel_driver_diagnostics"
+
+
+#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_diagnostic_verbose_level_intel;
+
+/* cl_context_properties */
+#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
+
+/* cl_diagnostic_verbose_level_intel */
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL 0xff
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL (1 << 0)
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL (1 << 1)
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL (1 << 2)
+
+/***************************************************************
+* cl_intel_planar_yuv
+***************************************************************/
+#define cl_intel_planar_yuv 1
+#define CL_INTEL_PLANAR_YUV_EXTENSION_NAME \
+ "cl_intel_planar_yuv"
+
+
+#define CL_INTEL_PLANAR_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_NV12_INTEL 0x410E
+
+/* cl_mem_flags */
+#define CL_MEM_NO_ACCESS_INTEL (1 << 24)
+#define CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL (1 << 25)
+
+/* cl_device_info */
+#define CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL 0x417E
+#define CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL 0x417F
+
+/***************************************************************
+* cl_intel_device_side_avc_motion_estimation
+***************************************************************/
+#define cl_intel_device_side_avc_motion_estimation 1
+#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_device_side_avc_motion_estimation"
+
+
+#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_AVC_ME_VERSION_INTEL 0x410B
+#define CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL 0x410C
+#define CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL 0x410D
+
+/* returned by CL_DEVICE_AVC_ME_VERSION_INTEL */
+#define CL_AVC_ME_VERSION_0_INTEL 0x0
+#define CL_AVC_ME_VERSION_1_INTEL 0x1
+
+/* Inter macro-block major shape values */
+#define CL_AVC_ME_MAJOR_16x16_INTEL 0x0
+#define CL_AVC_ME_MAJOR_16x8_INTEL 0x1
+#define CL_AVC_ME_MAJOR_8x16_INTEL 0x2
+#define CL_AVC_ME_MAJOR_8x8_INTEL 0x3
+
+/* Inter macro-block minor shape values */
+#define CL_AVC_ME_MINOR_8x8_INTEL 0x0
+#define CL_AVC_ME_MINOR_8x4_INTEL 0x1
+#define CL_AVC_ME_MINOR_4x8_INTEL 0x2
+#define CL_AVC_ME_MINOR_4x4_INTEL 0x3
+
+/* Inter macro-block major direction values */
+#define CL_AVC_ME_MAJOR_FORWARD_INTEL 0x0
+#define CL_AVC_ME_MAJOR_BACKWARD_INTEL 0x1
+#define CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2
+
+/* Inter (IME) partition mask values */
+#define CL_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0
+#define CL_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E
+#define CL_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D
+#define CL_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B
+#define CL_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77
+#define CL_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F
+#define CL_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F
+#define CL_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F
+
+/* Search window configuration */
+#define CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0
+#define CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1
+#define CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2
+#define CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3
+#define CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4
+#define CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5
+#define CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6
+#define CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7
+#define CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8
+#define CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL 0x9
+#define CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL 0x2
+#define CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL 0xa
+
+/* SAD adjustment mode */
+#define CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
+#define CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2
+
+/* Pixel resolution */
+#define CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
+#define CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
+#define CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3
+
+/* Cost precision values */
+#define CL_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0
+#define CL_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1
+#define CL_AVC_ME_COST_PRECISION_PEL_INTEL 0x2
+#define CL_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3
+
+/* Inter bidirectional weights */
+#define CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10
+#define CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15
+#define CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20
+#define CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B
+#define CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30
+
+/* Inter border reached values */
+#define CL_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0
+#define CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2
+#define CL_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4
+#define CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8
+
+/* Inter skip block partition type */
+#define CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0
+#define CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000
+
+/* Inter skip motion vector mask */
+#define CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30)
+
+/* Block based skip type values */
+#define CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00
+#define CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80
+
+/* cl_intel_device_side_avc_motion_estimation.?? */
+#define CL_AVC_ME_INTRA_16x16_INTEL 0x0
+#define CL_AVC_ME_INTRA_8x8_INTEL 0x1
+#define CL_AVC_ME_INTRA_4x4_INTEL 0x2
+
+/* Luma intra partition mask values */
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3
+
+/* Intra neighbor availability mask values */
+#define CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4
+
+/* Luma intra modes */
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
+
+/* Chroma intra modes */
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
+
+/* Reference image select values */
+#define CL_AVC_ME_FRAME_FORWARD_INTEL 0x1
+#define CL_AVC_ME_FRAME_BACKWARD_INTEL 0x2
+#define CL_AVC_ME_FRAME_DUAL_INTEL 0x3
+
+/* Slice type values */
+#define CL_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0
+#define CL_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1
+#define CL_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2
+
+/* Interlaced image field polarity values */
+#define CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0
+#define CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1
+
+/***************************************************************
+* cl_intel_unified_shared_memory
+***************************************************************/
+#define cl_intel_unified_shared_memory 1
+#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_NAME \
+ "cl_intel_unified_shared_memory"
+
+
+#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_device_unified_shared_memory_capabilities_intel;
+typedef cl_properties cl_mem_properties_intel;
+typedef cl_bitfield cl_mem_alloc_flags_intel;
+typedef cl_uint cl_mem_info_intel;
+typedef cl_uint cl_unified_shared_memory_type_intel;
+typedef cl_uint cl_mem_advice_intel;
+
+/* cl_device_info */
+#define CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL 0x4190
+#define CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL 0x4191
+#define CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4192
+#define CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4193
+#define CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL 0x4194
+
+/* cl_unified_shared_memory_capabilities_intel - bitfield */
+#define CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL (1 << 0)
+#define CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL (1 << 1)
+#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL (1 << 2)
+#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL (1 << 3)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_ALLOC_FLAGS_INTEL 0x4195
+
+/* cl_mem_alloc_flags_intel - bitfield */
+#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0)
+#define CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL (1 << 1)
+#define CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL (1 << 2)
+
+/* cl_mem_alloc_info_intel */
+#define CL_MEM_ALLOC_TYPE_INTEL 0x419A
+#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B
+#define CL_MEM_ALLOC_SIZE_INTEL 0x419C
+#define CL_MEM_ALLOC_DEVICE_INTEL 0x419D
+
+/* cl_unified_shared_memory_type_intel */
+#define CL_MEM_TYPE_UNKNOWN_INTEL 0x4196
+#define CL_MEM_TYPE_HOST_INTEL 0x4197
+#define CL_MEM_TYPE_DEVICE_INTEL 0x4198
+#define CL_MEM_TYPE_SHARED_INTEL 0x4199
+
+/* cl_kernel_exec_info */
+#define CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL 0x4200
+#define CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL 0x4201
+#define CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL 0x4202
+#define CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL 0x4203
+
+/* cl_command_type */
+#define CL_COMMAND_MEMFILL_INTEL 0x4204
+#define CL_COMMAND_MEMCPY_INTEL 0x4205
+#define CL_COMMAND_MIGRATEMEM_INTEL 0x4206
+#define CL_COMMAND_MEMADVISE_INTEL 0x4207
+
+
+typedef void* CL_API_CALL
+clHostMemAllocINTEL_t(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clHostMemAllocINTEL_t *
+clHostMemAllocINTEL_fn ;
+
+typedef void* CL_API_CALL
+clDeviceMemAllocINTEL_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clDeviceMemAllocINTEL_t *
+clDeviceMemAllocINTEL_fn ;
+
+typedef void* CL_API_CALL
+clSharedMemAllocINTEL_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clSharedMemAllocINTEL_t *
+clSharedMemAllocINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clMemFreeINTEL_t(
+ cl_context context,
+ void* ptr);
+
+typedef clMemFreeINTEL_t *
+clMemFreeINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clMemBlockingFreeINTEL_t(
+ cl_context context,
+ void* ptr);
+
+typedef clMemBlockingFreeINTEL_t *
+clMemBlockingFreeINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clGetMemAllocInfoINTEL_t(
+ cl_context context,
+ const void* ptr,
+ cl_mem_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetMemAllocInfoINTEL_t *
+clGetMemAllocInfoINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clSetKernelArgMemPointerINTEL_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value);
+
+typedef clSetKernelArgMemPointerINTEL_t *
+clSetKernelArgMemPointerINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemFillINTEL_t(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemFillINTEL_t *
+clEnqueueMemFillINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemcpyINTEL_t(
+ cl_command_queue command_queue,
+ cl_bool blocking,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemcpyINTEL_t *
+clEnqueueMemcpyINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemAdviseINTEL_t(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_advice_intel advice,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemAdviseINTEL_t *
+clEnqueueMemAdviseINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void* CL_API_CALL
+clHostMemAllocINTEL(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY void* CL_API_CALL
+clDeviceMemAllocINTEL(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY void* CL_API_CALL
+clSharedMemAllocINTEL(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clMemFreeINTEL(
+ cl_context context,
+ void* ptr) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clMemBlockingFreeINTEL(
+ cl_context context,
+ void* ptr) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMemAllocInfoINTEL(
+ cl_context context,
+ const void* ptr,
+ cl_mem_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArgMemPointerINTEL(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemFillINTEL(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemcpyINTEL(
+ cl_command_queue command_queue,
+ cl_bool blocking,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemAdviseINTEL(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_advice_intel advice,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#if defined(CL_VERSION_1_2)
+/* Requires OpenCL 1.2 for cl_mem_migration_flags: */
+
+typedef cl_int CL_API_CALL
+clEnqueueMigrateMemINTEL_t(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMigrateMemINTEL_t *
+clEnqueueMigrateMemINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMigrateMemINTEL(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/* deprecated, use clEnqueueMemFillINTEL instead */
+
+typedef cl_int CL_API_CALL
+clEnqueueMemsetINTEL_t(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ cl_int value,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemsetINTEL_t *
+clEnqueueMemsetINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemsetINTEL(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ cl_int value,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_mem_alloc_buffer_location
+***************************************************************/
+#define cl_intel_mem_alloc_buffer_location 1
+#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_NAME \
+ "cl_intel_mem_alloc_buffer_location"
+
+
+#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_ALLOC_BUFFER_LOCATION_INTEL 0x419E
+
+/* cl_mem_alloc_info_intel */
+/* enum CL_MEM_ALLOC_BUFFER_LOCATION_INTEL */
+
+/***************************************************************
+* cl_intel_create_buffer_with_properties
+***************************************************************/
+#define cl_intel_create_buffer_with_properties 1
+#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_NAME \
+ "cl_intel_create_buffer_with_properties"
+
+
+#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_properties_intel */
+
+
+typedef cl_mem CL_API_CALL
+clCreateBufferWithPropertiesINTEL_t(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateBufferWithPropertiesINTEL_t *
+clCreateBufferWithPropertiesINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBufferWithPropertiesINTEL(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_program_scope_host_pipe
+***************************************************************/
+#define cl_intel_program_scope_host_pipe 1
+#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_NAME \
+ "cl_intel_program_scope_host_pipe"
+
+
+#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* clGetEventInfo response when param_name is CL_EVENT_COMMAND_TYPE */
+#define CL_COMMAND_READ_HOST_PIPE_INTEL 0x4214
+#define CL_COMMAND_WRITE_HOST_PIPE_INTEL 0x4215
+
+/* clGetProgramInfo param_name */
+#define CL_PROGRAM_NUM_HOST_PIPES_INTEL 0x4216
+#define CL_PROGRAM_HOST_PIPE_NAMES_INTEL 0x4217
+
+
+typedef cl_int CL_API_CALL
+clEnqueueReadHostPipeINTEL_t(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_read,
+ void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReadHostPipeINTEL_t *
+clEnqueueReadHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueWriteHostPipeINTEL_t(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_write,
+ const void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWriteHostPipeINTEL_t *
+clEnqueueWriteHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadHostPipeINTEL(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_read,
+ void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteHostPipeINTEL(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_write,
+ const void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_mem_channel_property
+***************************************************************/
+#define cl_intel_mem_channel_property 1
+#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_NAME \
+ "cl_intel_mem_channel_property"
+
+
+#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_CHANNEL_INTEL 0x4213
+
+/***************************************************************
+* cl_intel_mem_force_host_memory
+***************************************************************/
+#define cl_intel_mem_force_host_memory 1
+#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_NAME \
+ "cl_intel_mem_force_host_memory"
+
+
+#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_flags */
+#define CL_MEM_FORCE_HOST_MEMORY_INTEL (1 << 20)
+
+/***************************************************************
+* cl_intel_command_queue_families
+***************************************************************/
+#define cl_intel_command_queue_families 1
+#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_NAME \
+ "cl_intel_command_queue_families"
+
+
+#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_command_queue_capabilities_intel;
+
+#define CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL 64
+
+typedef struct _cl_queue_family_properties_intel {
+ cl_command_queue_properties properties;
+ cl_command_queue_capabilities_intel capabilities;
+ cl_uint count;
+ char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL];
+} cl_queue_family_properties_intel;
+
+/* cl_device_info */
+#define CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL 0x418B
+
+/* cl_queue_properties */
+#define CL_QUEUE_FAMILY_INTEL 0x418C
+#define CL_QUEUE_INDEX_INTEL 0x418D
+
+/* cl_command_queue_capabilities_intel */
+#define CL_QUEUE_DEFAULT_CAPABILITIES_INTEL 0
+#define CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL (1 << 0)
+#define CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL (1 << 1)
+#define CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 2)
+#define CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 3)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL (1 << 8)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL (1 << 9)
+#define CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL (1 << 10)
+#define CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL (1 << 11)
+#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL (1 << 12)
+#define CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL (1 << 13)
+#define CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL (1 << 14)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL (1 << 15)
+#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL (1 << 16)
+#define CL_QUEUE_CAPABILITY_MARKER_INTEL (1 << 24)
+#define CL_QUEUE_CAPABILITY_BARRIER_INTEL (1 << 25)
+#define CL_QUEUE_CAPABILITY_KERNEL_INTEL (1 << 26)
+
+/***************************************************************
+* cl_intel_queue_no_sync_operations
+***************************************************************/
+#define cl_intel_queue_no_sync_operations 1
+#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_NAME \
+ "cl_intel_queue_no_sync_operations"
+
+
+#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_command_queue_properties */
+#define CL_QUEUE_NO_SYNC_OPERATIONS_INTEL (1 << 29)
+
+/***************************************************************
+* cl_intel_sharing_format_query
+***************************************************************/
+#define cl_intel_sharing_format_query 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_NAME \
+ "cl_intel_sharing_format_query"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/***************************************************************
+* cl_ext_image_requirements_info
+***************************************************************/
+#if defined(CL_VERSION_3_0)
+
+#define cl_ext_image_requirements_info 1
+#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_NAME \
+ "cl_ext_image_requirements_info"
+
+
+#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(0, 5, 0)
+
+/* Types */
+typedef cl_uint cl_image_requirements_info_ext;
+
+/* cl_image_requirements_info_ext */
+#define CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT 0x1292
+#define CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT 0x1290
+#define CL_IMAGE_REQUIREMENTS_SIZE_EXT 0x12B2
+#define CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT 0x12B3
+#define CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT 0x12B4
+#define CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT 0x12B5
+#define CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT 0x12B6
+
+/* Enqueued Commands APIs */
+
+typedef cl_int CL_API_CALL
+clGetImageRequirementsInfoEXT_t(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ cl_image_requirements_info_ext param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetImageRequirementsInfoEXT_t *
+clGetImageRequirementsInfoEXT_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetImageRequirementsInfoEXT(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ cl_image_requirements_info_ext param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_3_0) */
+
+/***************************************************************
+* cl_ext_image_from_buffer
+***************************************************************/
+#if defined(CL_VERSION_3_0)
+
+#define cl_ext_image_from_buffer 1
+#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_NAME \
+ "cl_ext_image_from_buffer"
+
+
+#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_image_requirements_info_ext */
+#define CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT 0x1291
+
+#endif /* defined(CL_VERSION_3_0) */
+
+/***************************************************************
+* cl_loader_info
+***************************************************************/
+#define cl_loader_info 1
+#define CL_LOADER_INFO_EXTENSION_NAME \
+ "cl_loader_info"
+
+
+#define CL_LOADER_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_icdl_info;
+
+/* cl_icdl_info */
+#define CL_ICDL_OCL_VERSION 1
+#define CL_ICDL_VERSION 2
+#define CL_ICDL_NAME 3
+#define CL_ICDL_VENDOR 4
+
+
+typedef cl_int CL_API_CALL
+clGetICDLoaderInfoOCLICD_t(
+ cl_icdl_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetICDLoaderInfoOCLICD_t *
+clGetICDLoaderInfoOCLICD_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetICDLoaderInfoOCLICD(
+ cl_icdl_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_depth_images
+***************************************************************/
+#define cl_khr_depth_images 1
+#define CL_KHR_DEPTH_IMAGES_EXTENSION_NAME \
+ "cl_khr_depth_images"
+
+
+#define CL_KHR_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_2_0)
+/* cl_channel_order - defined in CL.h for OpenCL 2.0 and newer */
+#define CL_DEPTH 0x10BD
+
+#endif /* !defined(CL_VERSION_2_0) */
+
+/***************************************************************
+* cl_ext_float_atomics
+***************************************************************/
+#define cl_ext_float_atomics 1
+#define CL_EXT_FLOAT_ATOMICS_EXTENSION_NAME \
+ "cl_ext_float_atomics"
+
+
+#define CL_EXT_FLOAT_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_device_fp_atomic_capabilities_ext;
+
+/* cl_device_fp_atomic_capabilities_ext */
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 0)
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT (1 << 1)
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT (1 << 2)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 16)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT (1 << 17)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT (1 << 18)
+
+/* cl_device_info */
+#define CL_DEVICE_SINGLE_FP_ATOMIC_CAPABILITIES_EXT 0x4231
+#define CL_DEVICE_DOUBLE_FP_ATOMIC_CAPABILITIES_EXT 0x4232
+#define CL_DEVICE_HALF_FP_ATOMIC_CAPABILITIES_EXT 0x4233
+
+/***************************************************************
+* cl_intel_create_mem_object_properties
+***************************************************************/
+#define cl_intel_create_mem_object_properties 1
+#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_NAME \
+ "cl_intel_create_mem_object_properties"
+
+
+#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties */
+#define CL_MEM_LOCALLY_UNCACHED_RESOURCE_INTEL 0x4218
+#define CL_MEM_DEVICE_ID_INTEL 0x4219
+
+/***************************************************************
+* cl_pocl_content_size
+***************************************************************/
+#define cl_pocl_content_size 1
+#define CL_POCL_CONTENT_SIZE_EXTENSION_NAME \
+ "cl_pocl_content_size"
+
+
+#define CL_POCL_CONTENT_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clSetContentSizeBufferPoCL_t(
+ cl_mem buffer,
+ cl_mem content_size_buffer);
+
+typedef clSetContentSizeBufferPoCL_t *
+clSetContentSizeBufferPoCL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetContentSizeBufferPoCL(
+ cl_mem buffer,
+ cl_mem content_size_buffer) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_image_raw10_raw12
+***************************************************************/
+#define cl_ext_image_raw10_raw12 1
+#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_NAME \
+ "cl_ext_image_raw10_raw12"
+
+
+#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_type */
+#define CL_UNSIGNED_INT_RAW10_EXT 0x10E3
+#define CL_UNSIGNED_INT_RAW12_EXT 0x10E4
+
+/***************************************************************
+* cl_khr_3d_image_writes
+***************************************************************/
+#define cl_khr_3d_image_writes 1
+#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_3d_image_writes"
+
+
+#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_async_work_group_copy_fence
+***************************************************************/
+#define cl_khr_async_work_group_copy_fence 1
+#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_NAME \
+ "cl_khr_async_work_group_copy_fence"
+
+
+#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_byte_addressable_store
+***************************************************************/
+#define cl_khr_byte_addressable_store 1
+#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_NAME \
+ "cl_khr_byte_addressable_store"
+
+
+#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_device_enqueue_local_arg_types
+***************************************************************/
+#define cl_khr_device_enqueue_local_arg_types 1
+#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_NAME \
+ "cl_khr_device_enqueue_local_arg_types"
+
+
+#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_expect_assume
+***************************************************************/
+#define cl_khr_expect_assume 1
+#define CL_KHR_EXPECT_ASSUME_EXTENSION_NAME \
+ "cl_khr_expect_assume"
+
+
+#define CL_KHR_EXPECT_ASSUME_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_extended_async_copies
+***************************************************************/
+#define cl_khr_extended_async_copies 1
+#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_NAME \
+ "cl_khr_extended_async_copies"
+
+
+#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_extended_bit_ops
+***************************************************************/
+#define cl_khr_extended_bit_ops 1
+#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_NAME \
+ "cl_khr_extended_bit_ops"
+
+
+#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_global_int32_base_atomics
+***************************************************************/
+#define cl_khr_global_int32_base_atomics 1
+#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_global_int32_base_atomics"
+
+
+#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_global_int32_extended_atomics
+***************************************************************/
+#define cl_khr_global_int32_extended_atomics 1
+#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_global_int32_extended_atomics"
+
+
+#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_int64_base_atomics
+***************************************************************/
+#define cl_khr_int64_base_atomics 1
+#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_int64_base_atomics"
+
+
+#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_int64_extended_atomics
+***************************************************************/
+#define cl_khr_int64_extended_atomics 1
+#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_int64_extended_atomics"
+
+
+#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_kernel_clock
+***************************************************************/
+#define cl_khr_kernel_clock 1
+#define CL_KHR_KERNEL_CLOCK_EXTENSION_NAME \
+ "cl_khr_kernel_clock"
+
+
+#define CL_KHR_KERNEL_CLOCK_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR 0x1076
+
+typedef cl_bitfield cl_device_kernel_clock_capabilities_khr;
+
+/* cl_device_kernel_clock_capabilities_khr */
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR (1 << 0)
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR (1 << 1)
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_local_int32_base_atomics
+***************************************************************/
+#define cl_khr_local_int32_base_atomics 1
+#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_local_int32_base_atomics"
+
+
+#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_local_int32_extended_atomics
+***************************************************************/
+#define cl_khr_local_int32_extended_atomics 1
+#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_local_int32_extended_atomics"
+
+
+#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_mipmap_image_writes
+***************************************************************/
+#define cl_khr_mipmap_image_writes 1
+#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_mipmap_image_writes"
+
+
+#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_select_fprounding_mode
+***************************************************************/
+#define cl_khr_select_fprounding_mode 1
+#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_NAME \
+ "cl_khr_select_fprounding_mode"
+
+
+#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_extended_debug_info
+***************************************************************/
+#define cl_khr_spirv_extended_debug_info 1
+#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_NAME \
+ "cl_khr_spirv_extended_debug_info"
+
+
+#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_linkonce_odr
+***************************************************************/
+#define cl_khr_spirv_linkonce_odr 1
+#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_NAME \
+ "cl_khr_spirv_linkonce_odr"
+
+
+#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_no_integer_wrap_decoration
+***************************************************************/
+#define cl_khr_spirv_no_integer_wrap_decoration 1
+#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_NAME \
+ "cl_khr_spirv_no_integer_wrap_decoration"
+
+
+#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_srgb_image_writes
+***************************************************************/
+#define cl_khr_srgb_image_writes 1
+#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_srgb_image_writes"
+
+
+#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_ballot
+***************************************************************/
+#define cl_khr_subgroup_ballot 1
+#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_NAME \
+ "cl_khr_subgroup_ballot"
+
+
+#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_clustered_reduce
+***************************************************************/
+#define cl_khr_subgroup_clustered_reduce 1
+#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_NAME \
+ "cl_khr_subgroup_clustered_reduce"
+
+
+#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_extended_types
+***************************************************************/
+#define cl_khr_subgroup_extended_types 1
+#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME \
+ "cl_khr_subgroup_extended_types"
+
+
+#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_non_uniform_arithmetic
+***************************************************************/
+#define cl_khr_subgroup_non_uniform_arithmetic 1
+#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_NAME \
+ "cl_khr_subgroup_non_uniform_arithmetic"
+
+
+#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_non_uniform_vote
+***************************************************************/
+#define cl_khr_subgroup_non_uniform_vote 1
+#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_NAME \
+ "cl_khr_subgroup_non_uniform_vote"
+
+
+#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_rotate
+***************************************************************/
+#define cl_khr_subgroup_rotate 1
+#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_NAME \
+ "cl_khr_subgroup_rotate"
+
+
+#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_shuffle
+***************************************************************/
+#define cl_khr_subgroup_shuffle 1
+#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_NAME \
+ "cl_khr_subgroup_shuffle"
+
+
+#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_shuffle_relative
+***************************************************************/
+#define cl_khr_subgroup_shuffle_relative 1
+#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_NAME \
+ "cl_khr_subgroup_shuffle_relative"
+
+
+#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_work_group_uniform_arithmetic
+***************************************************************/
+#define cl_khr_work_group_uniform_arithmetic 1
+#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_NAME \
+ "cl_khr_work_group_uniform_arithmetic"
+
+
+#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_ext_image_unorm_int_2_101010
+***************************************************************/
+#define cl_ext_image_unorm_int_2_101010 1
+#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_NAME \
+ "cl_ext_image_unorm_int_2_101010"
+
+
+#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_type */
+#define CL_UNORM_INT_2_101010_EXT 0x10E5
+
+/***************************************************************
+* cl_img_cancel_command
+***************************************************************/
+#define cl_img_cancel_command 1
+#define CL_IMG_CANCEL_COMMAND_EXTENSION_NAME \
+ "cl_img_cancel_command"
+
+
+#define CL_IMG_CANCEL_COMMAND_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Error codes */
+#define CL_CANCELLED_IMG -1126
+
+
+typedef cl_int CL_API_CALL
+clCancelCommandsIMG_t(
+ const cl_event* event_list,
+ size_t num_events_in_list);
+
+typedef clCancelCommandsIMG_t *
+clCancelCommandsIMG_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCancelCommandsIMG(
+ const cl_event* event_list,
+ size_t num_events_in_list) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_EXT_H_ */
diff --git a/external/OpenCL/inc/cl_gl.h b/external/OpenCL/inc/cl_gl.h
new file mode 100644
index 0000000..0a5e6c4
--- /dev/null
+++ b/external/OpenCL/inc/cl_gl.h
@@ -0,0 +1,421 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_GL_H_
+#define OPENCL_CL_GL_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_gl_sharing
+***************************************************************/
+#define cl_khr_gl_sharing 1
+#define CL_KHR_GL_SHARING_EXTENSION_NAME \
+ "cl_khr_gl_sharing"
+
+
+#define CL_KHR_GL_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef int cl_GLint;
+typedef unsigned int cl_GLenum;
+typedef unsigned int cl_GLuint;
+
+typedef cl_uint cl_gl_context_info;
+
+/* Error codes */
+#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
+
+/* cl_gl_context_info */
+#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
+#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
+
+/* Additional cl_context_properties */
+#define CL_GL_CONTEXT_KHR 0x2008
+#define CL_EGL_DISPLAY_KHR 0x2009
+#define CL_GLX_DISPLAY_KHR 0x200A
+#define CL_WGL_HDC_KHR 0x200B
+#define CL_CGL_SHAREGROUP_KHR 0x200C
+
+typedef cl_uint cl_gl_object_type;
+typedef cl_uint cl_gl_texture_info;
+typedef cl_uint cl_gl_platform_info;
+
+/* cl_gl_object_type */
+#define CL_GL_OBJECT_BUFFER 0x2000
+#define CL_GL_OBJECT_TEXTURE2D 0x2001
+#define CL_GL_OBJECT_TEXTURE3D 0x2002
+#define CL_GL_OBJECT_RENDERBUFFER 0x2003
+
+#if defined(CL_VERSION_1_2)
+/* cl_gl_object_type */
+#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
+#define CL_GL_OBJECT_TEXTURE1D 0x200F
+#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
+#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/* cl_gl_texture_info */
+#define CL_GL_TEXTURE_TARGET 0x2004
+#define CL_GL_MIPMAP_LEVEL 0x2005
+
+
+typedef cl_int CL_API_CALL
+clGetGLContextInfoKHR_t(
+ const cl_context_properties* properties,
+ cl_gl_context_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetGLContextInfoKHR_t *
+clGetGLContextInfoKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLBuffer_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLBuffer_t *
+clCreateFromGLBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLContextInfoKHR(
+ const cl_context_properties* properties,
+ cl_gl_context_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLBuffer(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#if defined(CL_VERSION_1_2)
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture_t *
+clCreateFromGLTexture_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_1_2) */
+
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint renderbuffer,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLRenderbuffer_t *
+clCreateFromGLRenderbuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clGetGLObjectInfo_t(
+ cl_mem memobj,
+ cl_gl_object_type* gl_object_type,
+ cl_GLuint* gl_object_name);
+
+typedef clGetGLObjectInfo_t *
+clGetGLObjectInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clGetGLTextureInfo_t(
+ cl_mem memobj,
+ cl_gl_texture_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetGLTextureInfo_t *
+clGetGLTextureInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireGLObjects_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireGLObjects_t *
+clEnqueueAcquireGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseGLObjects_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseGLObjects_t *
+clEnqueueReleaseGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint renderbuffer,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLObjectInfo(
+ cl_mem memobj,
+ cl_gl_object_type* gl_object_type,
+ cl_GLuint* gl_object_name) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLTextureInfo(
+ cl_mem memobj,
+ cl_gl_texture_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGLObjects(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGLObjects(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/* OpenCL 1.0 APIs that were deprecated in OpenCL 1.2 */
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture2D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture2D_t *
+clCreateFromGLTexture2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture3D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture3D_t *
+clCreateFromGLTexture3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture2D(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture3D(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_gl_event
+***************************************************************/
+#define cl_khr_gl_event 1
+#define CL_KHR_GL_EVENT_EXTENSION_NAME \
+ "cl_khr_gl_event"
+
+
+#define CL_KHR_GL_EVENT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef struct __GLsync * cl_GLsync;
+
+/* cl_command_type */
+#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
+
+
+typedef cl_event CL_API_CALL
+clCreateEventFromGLsyncKHR_t(
+ cl_context context,
+ cl_GLsync sync,
+ cl_int* errcode_ret);
+
+typedef clCreateEventFromGLsyncKHR_t *
+clCreateEventFromGLsyncKHR_fn CL_API_SUFFIX__VERSION_1_1;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateEventFromGLsyncKHR(
+ cl_context context,
+ cl_GLsync sync,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_gl_depth_images
+***************************************************************/
+#define cl_khr_gl_depth_images 1
+#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_NAME \
+ "cl_khr_gl_depth_images"
+
+
+#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_order */
+#define CL_DEPTH_STENCIL 0x10BE
+
+/* cl_channel_type */
+#define CL_UNORM_INT24 0x10DF
+
+/***************************************************************
+* cl_khr_gl_msaa_sharing
+***************************************************************/
+#define cl_khr_gl_msaa_sharing 1
+#define CL_KHR_GL_MSAA_SHARING_EXTENSION_NAME \
+ "cl_khr_gl_msaa_sharing"
+
+
+#define CL_KHR_GL_MSAA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_gl_texture_info */
+#define CL_GL_NUM_SAMPLES 0x2012
+
+/***************************************************************
+* cl_intel_sharing_format_query_gl
+***************************************************************/
+#define cl_intel_sharing_format_query_gl 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_gl"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_khr_gl_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedGLTextureFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_GLenum* gl_formats,
+ cl_uint* num_texture_formats);
+
+typedef clGetSupportedGLTextureFormatsINTEL_t *
+clGetSupportedGLTextureFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedGLTextureFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_GLenum* gl_formats,
+ cl_uint* num_texture_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_GL_H_ */
diff --git a/tiny_bvh.h b/tiny_bvh.h
index c9462c8..3b87b1a 100644
--- a/tiny_bvh.h
+++ b/tiny_bvh.h
@@ -50,6 +50,14 @@ THE SOFTWARE.
// #define TINYBVH_USE_CUSTOM_VECTOR_TYPES
// #include
+// tinybvh can be further configured using #defines, to be specified before the #include:
+// #define BVHBINS 8 - the number of bins to use in regular BVH construction. Default is 8.
+// #define HQBVHBINS 32 - the number of bins to use in SBVH construction. Default is 8.
+// #define INST_IDX_BITS 10 - the number of bits to use for the instance index. Default is 32,
+// which stores the bits in a separate field in tinybvh::Intersection.
+// #define C_INT 1 - the estimated cost of a primitive intersection test. Default is 1.
+// #define C_TRAV 1 - the estimated cost of a traversal step. Default is 1.
+
// See tiny_bvh_test.cpp for basic usage. In short:
// instantiate a BVH: tinybvh::BVH bvh;
// build it: bvh.Build( (tinybvh::bvhvec4*)triangleData, TRIANGLE_COUNT );
@@ -81,24 +89,37 @@ THE SOFTWARE.
// #define PARANOID
// Binned BVH building: bin count.
+#ifndef BVHBINS
#define BVHBINS 8
-#define HQBVHBINS 32
+#endif
+#ifndef HQBVHBINS
+#define HQBVHBINS 8
+#endif
#define AVXBINS 8 // must stay at 8.
// TLAS setting
// Note: Instance index is encoded in the top bits of the prim idx field.
-// Max number of instances in TLAS: 2 ^ TLAS_BITS
-// Max number of primitives per BLAS: 2 ^ (32 - TLAS_BITS)
-#define TLAS_BITS 10 // max 1024 instances of 4M triangles each
+// Max number of instances in TLAS: 2 ^ INST_IDX_BITS
+// Max number of primitives per BLAS: 2 ^ (32 - INST_IDX_BITS)
+#ifndef INST_IDX_BITS
+#define INST_IDX_BITS 32 // Use 4..~12 to use prim field bits for instance id, or set to 32 to store index in separate field.
+#endif
// Derived; for convenience:
-#define INST_IDX_SHFT (32 - TLAS_BITS)
-#define PRIM_IDX_MASK ((1 << INST_IDX_SHFT) - 1)
-#define PRIM_IDX_MASK_DBL 0x00000000ffffffff
+#define INST_IDX_SHFT (32 - INST_IDX_BITS)
+#if INST_IDX_BITS == 32
+#define PRIM_IDX_MASK 0xffffffff // instance index stored separately.
+#else
+#define PRIM_IDX_MASK ((1 << INST_IDX_SHFT) - 1) // instance index stored in top bits of hit.prim.
+#endif
// SAH BVH building: Heuristic parameters
-// CPU builds: C_INT = 1, C_TRAV = 1 seems optimal.
+// CPU traversal: C_INT = 1, C_TRAV = 1 seems optimal.
+#ifndef C_INT
#define C_INT 1
+#endif
+#ifndef C_TRAV
#define C_TRAV 1
+#endif
// SBVH: "Unsplitting"
#define SBVH_UNSPLITTING
@@ -108,7 +129,9 @@ THE SOFTWARE.
#define BVH_DBL_FAR 1e300 // actual valid ieee range: 1.797693134862315E+308
// Features
+#ifndef NO_DOUBLE_PRECISION_SUPPORT
#define DOUBLE_PRECISION_SUPPORT
+#endif
// #define TINYBVH_USE_CUSTOM_VECTOR_TYPES
// #define TINYBVH_NO_SIMD
#define ENABLE_INDEXED_GEOMETRY
@@ -135,8 +158,8 @@ THE SOFTWARE.
// library version
#define TINY_BVH_VERSION_MAJOR 1
-#define TINY_BVH_VERSION_MINOR 2
-#define TINY_BVH_VERSION_SUB 5
+#define TINY_BVH_VERSION_MINOR 3
+#define TINY_BVH_VERSION_SUB 2
// ============================================================================
//
@@ -205,6 +228,7 @@ inline void free64( void* ptr, void* = nullptr ) { free( ptr ); }
#endif
namespace tinybvh {
+
#ifdef _MSC_VER
// Suppress a warning caused by the union of x,y,.. and cell[..] in vectors.
// We need this union to address vector components either by name or by index.
@@ -293,10 +317,6 @@ struct bvhvec4slice
uint32_t count, stride;
};
-#ifdef _MSC_VER
-#pragma warning ( pop )
-#endif
-
// Math operations.
// Note: Since this header file is expected to be included in a source file
// of a separate project, the static keyword doesn't provide sufficient
@@ -315,8 +335,8 @@ static inline bvhvec3 tinybvh_min( const bvhvec3& a, const bvhvec3& b ) { return
static inline bvhvec4 tinybvh_min( const bvhvec4& a, const bvhvec4& b ) { return bvhvec4( tinybvh_min( a.x, b.x ), tinybvh_min( a.y, b.y ), tinybvh_min( a.z, b.z ), tinybvh_min( a.w, b.w ) ); }
static inline bvhvec3 tinybvh_max( const bvhvec3& a, const bvhvec3& b ) { return bvhvec3( tinybvh_max( a.x, b.x ), tinybvh_max( a.y, b.y ), tinybvh_max( a.z, b.z ) ); }
static inline bvhvec4 tinybvh_max( const bvhvec4& a, const bvhvec4& b ) { return bvhvec4( tinybvh_max( a.x, b.x ), tinybvh_max( a.y, b.y ), tinybvh_max( a.z, b.z ), tinybvh_max( a.w, b.w ) ); }
-static inline float tinybvh_clamp( const float x, const float a, const float b ) { return x < a ? a : (x > b ? b : x); }
-static inline int32_t tinybvh_clamp( const int32_t x, const int32_t a, const int32_t b ) { return x < a ? a : (x > b ? b : x); }
+static inline float tinybvh_clamp( const float x, const float a, const float b ) { return x > a ? (x < b ? x : b) : a; /* NaN safe */ }
+static inline int32_t tinybvh_clamp( const int32_t x, const int32_t a, const int32_t b ) { return x > a ? (x < b ? x : b) : a; /* NaN safe */ }
template inline static void tinybvh_swap( T& a, T& b ) { T t = a; a = b; b = t; }
// Operator overloads.
@@ -353,21 +373,35 @@ inline void operator*=( bvhvec3& a, const float b ) { a.x *= b; a.y *= b; a.z *=
#endif // TINYBVH_USE_CUSTOM_VECTOR_TYPES
// Vector math: cross and dot.
-static inline bvhvec3 cross( const bvhvec3& a, const bvhvec3& b )
+static inline bvhvec3 tinybvh_cross( const bvhvec3& a, const bvhvec3& b )
{
return bvhvec3( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x );
}
-static inline float dot( const bvhvec2& a, const bvhvec2& b ) { return a.x * b.x + a.y * b.y; }
-static inline float dot( const bvhvec3& a, const bvhvec3& b ) { return a.x * b.x + a.y * b.y + a.z * b.z; }
-static inline float dot( const bvhvec4& a, const bvhvec4& b ) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
+static inline float tinybvh_dot( const bvhvec2& a, const bvhvec2& b ) { return a.x * b.x + a.y * b.y; }
+static inline float tinybvh_dot( const bvhvec3& a, const bvhvec3& b ) { return a.x * b.x + a.y * b.y + a.z * b.z; }
+static inline float tinybvh_dot( const bvhvec4& a, const bvhvec4& b ) { return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; }
// Vector math: common operations.
-static float length( const bvhvec3& a ) { return sqrtf( a.x * a.x + a.y * a.y + a.z * a.z ); }
-static bvhvec3 normalize( const bvhvec3& a )
+static float tinybvh_length( const bvhvec3& a ) { return sqrtf( a.x * a.x + a.y * a.y + a.z * a.z ); }
+static bvhvec3 tinybvh_normalize( const bvhvec3& a )
{
- float l = length( a ), rl = l == 0 ? 0 : (1.0f / l);
+ float l = tinybvh_length( a ), rl = l == 0 ? 0 : (1.0f / l);
return a * rl;
}
+bvhvec3 tinybvh_transform_point( const bvhvec3& v, const float* T )
+{
+ const bvhvec3 res(
+ T[0] * v.x + T[1] * v.y + T[2] * v.z + T[3],
+ T[4] * v.x + T[5] * v.y + T[6] * v.z + T[7],
+ T[8] * v.x + T[9] * v.y + T[10] * v.z + T[11] );
+ const float w = T[12] * v.x + T[13] * v.y + T[14] * v.z + T[15];
+ if (w == 1) return res; else return res * (1.f / w);
+}
+bvhvec3 tinybvh_transform_vector( const bvhvec3& v, const float* T )
+{
+ return bvhvec3( T[0] * v.x + T[1] * v.y + T[2] * v.z, T[4] * v.x +
+ T[5] * v.y + T[6] * v.z, T[8] * v.x + T[9] * v.y + T[10] * v.z );
+}
#ifdef DOUBLE_PRECISION_SUPPORT
// Double-precision math
@@ -380,13 +414,17 @@ struct bvhdbl3
bvhdbl3( const double a, const double b, const double c ) : x( a ), y( b ), z( c ) {}
bvhdbl3( const double a ) : x( a ), y( a ), z( a ) {}
bvhdbl3( const bvhvec3 a ) : x( (double)a.x ), y( (double)a.y ), z( (double)a.z ) {}
- double halfArea() { return x < -BVH_FAR ? 0 : (x * y + y * z + z * x); } // for SAH calculations
+ double halfArea() { return x < -BVH_DBL_FAR ? 0 : (x * y + y * z + z * x); } // for SAH calculations
double& operator [] ( const int32_t i ) { return cell[i]; }
union { struct { double x, y, z; }; double cell[3]; };
};
#endif // TINYBVH_USE_CUSTOM_VECTOR_TYPES
+#ifdef _MSC_VER
+#pragma warning ( pop )
+#endif
+
static inline bvhdbl3 tinybvh_min( const bvhdbl3& a, const bvhdbl3& b ) { return bvhdbl3( tinybvh_min( a.x, b.x ), tinybvh_min( a.y, b.y ), tinybvh_min( a.z, b.z ) ); }
static inline bvhdbl3 tinybvh_max( const bvhdbl3& a, const bvhdbl3& b ) { return bvhdbl3( tinybvh_max( a.x, b.x ), tinybvh_max( a.y, b.y ), tinybvh_max( a.z, b.z ) ); }
@@ -402,13 +440,34 @@ inline bvhdbl3 operator*( double b, const bvhdbl3& a ) { return bvhdbl3( b * a.x
inline bvhdbl3 operator/( double b, const bvhdbl3& a ) { return bvhdbl3( b / a.x, b / a.y, b / a.z ); }
inline bvhdbl3 operator*=( bvhdbl3& a, const double b ) { return bvhdbl3( a.x * b, a.y * b, a.z * b ); }
+static double tinybvh_length( const bvhdbl3& a ) { return sqrt( a.x * a.x + a.y * a.y + a.z * a.z ); }
+static bvhdbl3 tinybvh_normalize( const bvhdbl3& a )
+{
+ double l = tinybvh_length( a ), rl = l == 0 ? 0 : (1.0 / l);
+ return a * rl;
+}
+bvhdbl3 tinybvh_transform_point( const bvhdbl3& v, const double* T )
+{
+ const bvhdbl3 res(
+ T[0] * v.x + T[1] * v.y + T[2] * v.z + T[3],
+ T[4] * v.x + T[5] * v.y + T[6] * v.z + T[7],
+ T[8] * v.x + T[9] * v.y + T[10] * v.z + T[11] );
+ const double w = T[12] * v.x + T[13] * v.y + T[14] * v.z + T[15];
+ if (w == 1) return res; else return res * (1. / w);
+}
+bvhdbl3 tinybvh_transform_vector( const bvhdbl3& v, const double* T )
+{
+ return bvhdbl3( T[0] * v.x + T[1] * v.y + T[2] * v.z, T[4] * v.x +
+ T[5] * v.y + T[6] * v.z, T[8] * v.x + T[9] * v.y + T[10] * v.z );
+}
+
#endif // TINYBVH_USE_CUSTOM_VECTOR_TYPES
-static inline bvhdbl3 cross( const bvhdbl3& a, const bvhdbl3& b )
+static inline bvhdbl3 tinybvh_cross( const bvhdbl3& a, const bvhdbl3& b )
{
return bvhdbl3( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x );
}
-static inline double dot( const bvhdbl3& a, const bvhdbl3& b ) { return a.x * b.x + a.y * b.y + a.z * b.z; }
+static inline double tinybvh_dot( const bvhdbl3& a, const bvhdbl3& b ) { return a.x * b.x + a.y * b.y + a.z * b.z; }
#endif
@@ -460,6 +519,9 @@ struct Intersection
// squeezing this in the 'prim' field in some way.
// Using this data and the original triangle data, all other info for
// shading (such as normal, texture color etc.) can be reconstructed.
+#if INST_IDX_BITS == 32
+ uint32_t inst; // instance index. Stored in top bits of prim if INST_IDX_BITS != 32.
+#endif
float t, u, v; // distance along ray & barycentric coordinates of the intersection
uint32_t prim; // primitive index
};
@@ -473,13 +535,16 @@ struct Ray
Ray( bvhvec3 origin, bvhvec3 direction, float t = BVH_FAR )
{
memset( this, 0, sizeof( Ray ) );
- O = origin, D = normalize( direction ), rD = tinybvh_safercp( D );
+ O = origin, D = tinybvh_normalize( direction ), rD = tinybvh_safercp( D );
hit.t = t;
}
ALIGNED( 16 ) bvhvec3 O; uint32_t dummy1;
- ALIGNED( 16 ) bvhvec3 D; uint32_t dummy2;
- ALIGNED( 16 ) bvhvec3 rD; uint32_t instIdx = 0;
- ALIGNED( 16 ) Intersection hit;
+ ALIGNED( 16 ) bvhvec3 D; uint32_t instIdx = 0;
+ ALIGNED( 16 ) bvhvec3 rD;
+#if INST_IDX_BITS != 32
+ uint32_t dummy2; // align to 16 bytes if field 'hit' is 16 bytes; otherwise don't.
+#endif
+ Intersection hit;
};
#ifdef DOUBLE_PRECISION_SUPPORT
@@ -488,7 +553,7 @@ struct IntersectionEx
{
// Double-precision hit record.
double t, u, v; // distance along ray & barycentric coordinates of the intersection
- uint64_t prim; // primitive index
+ uint64_t inst, prim; // instance and primitive index
};
struct RayEx
@@ -523,6 +588,23 @@ enum TraceDevice : uint32_t { USE_CPU = 1, USE_GPU };
class BVHBase
{
public:
+ enum BVHType : uint32_t
+ {
+ // Every BVHJ class is derived from BVHBase, but we don't use virtual functions, for
+ // performance reasons. For a TLAS over a mix of BVH layouts we do however need this
+ // kind of behavior when transitioning from a TLAS leaf to a BLAS root node.
+ UNDEFINED = 0,
+ LAYOUT_BVH = 1,
+ LAYOUT_BVH_VERBOSE,
+ LAYOUT_BVH_DOUBLE,
+ LAYOUT_BVH_SOA,
+ LAYOUT_BVH_GPU,
+ LAYOUT_MBVH,
+ LAYOUT_BVH4_CPU,
+ LAYOUT_BVH4_GPU,
+ LAYOUT_MBVH8,
+ LAYOUT_CWBVH
+ };
struct ALIGNED( 32 ) Fragment
{
// A fragment stores the bounds of an input primitive. The name 'Fragment' is from
@@ -541,6 +623,7 @@ class BVHBase
bool bvh_over_aabbs = false; // a BVH over AABBs is useful for e.g. TLAS traversal.
bool bvh_over_indices = false; // a BVH over indices cannot translate primitive index to vertex index.
BVHContext context; // context used to provide user-defined allocation functions
+ BVHType layout = UNDEFINED; // BVH layout identifier
// Keep track of allocated buffer size to avoid repeated allocation during layout conversion.
uint32_t allocatedNodes = 0; // number of nodes allocated for the BVH.
uint32_t usedNodes = 0; // number of nodes used for the BVH.
@@ -553,7 +636,7 @@ class BVHBase
// Common methods
void CopyBasePropertiesFrom( const BVHBase& original ); // copy flags from one BVH to another
protected:
- __FORCEINLINE void IntersectTri( Ray& ray, const bvhvec4slice& verts, const uint32_t triIdx ) const;
+ __FORCEINLINE void IntersectTri( Ray& ray, const bvhvec4slice& verts, const uint32_t primIdx ) const;
__FORCEINLINE void IntersectTriIndexed( Ray& ray, const bvhvec4slice& verts, const uint32_t* indices, const uint32_t idx ) const;
__FORCEINLINE bool TriOccludes( const Ray& ray, const bvhvec4slice& verts, const uint32_t idx ) const;
__FORCEINLINE bool IndexedTriOccludes( const Ray& ray, const bvhvec4slice& verts, const uint32_t* indices, const uint32_t idx ) const;
@@ -570,7 +653,8 @@ class BVH : public BVHBase
friend class BVH_GPU;
friend class BVH_SoA;
template friend class MBVH;
- enum BuildFlags : uint32_t {
+ enum BuildFlags : uint32_t
+ {
NONE = 0, // Default building behavior (binned, SAH-driven).
FULLSPLIT = 1 // Split as far as possible, even when SAH doesn't agree.
};
@@ -582,12 +666,13 @@ class BVH : public BVHBase
bvhvec3 aabbMax; uint32_t triCount; // 16 bytes, total: 32 bytes
bool isLeaf() const { return triCount > 0; /* empty BVH leaves do not exist */ }
float Intersect( const Ray& ray ) const { return BVH::IntersectAABB( ray, aabbMin, aabbMax ); }
+ bool Intersect( const bvhvec3& bmin, const bvhvec3& bmax ) const;
float SurfaceArea() const { return BVH::SA( aabbMin, aabbMax ); }
};
- BVH( BVHContext ctx = {} ) { context = ctx; }
- BVH( const BVH_Verbose& original ) { ConvertFrom( original ); }
- BVH( const bvhvec4* vertices, const uint32_t primCount ) { Build( vertices, primCount ); }
- BVH( const bvhvec4slice& vertices ) { Build( vertices ); }
+ BVH( BVHContext ctx = {} ) { layout = LAYOUT_BVH; context = ctx; }
+ BVH( const BVH_Verbose& original ) { layout = LAYOUT_BVH; ConvertFrom( original ); }
+ BVH( const bvhvec4* vertices, const uint32_t primCount ) { layout = LAYOUT_BVH; Build( vertices, primCount ); }
+ BVH( const bvhvec4slice& vertices ) { layout = LAYOUT_BVH; Build( vertices ); }
~BVH();
void ConvertFrom( const BVH_Verbose& original, bool compact = true );
float SAHCost( const uint32_t nodeIdx = 0 ) const;
@@ -601,6 +686,7 @@ class BVH : public BVHBase
void Build( const bvhvec4* vertices, const uint32_t* indices, const uint32_t primCount );
void Build( const bvhvec4slice& vertices, const uint32_t* indices, const uint32_t primCount );
void Build( BLASInstance* instances, const uint32_t instCount, BVHBase** blasses, const uint32_t blasCount );
+ void Build( void (*customGetAABB)(const unsigned, bvhvec3&, bvhvec3&), const uint32_t primCount );
void BuildHQ( const bvhvec4* vertices, const uint32_t primCount );
void BuildHQ( const bvhvec4slice& vertices );
void BuildHQ( const bvhvec4* vertices, const uint32_t* indices, const uint32_t primCount );
@@ -610,12 +696,10 @@ class BVH : public BVHBase
void BuildAVX( const bvhvec4slice& vertices );
void BuildAVX( const bvhvec4* vertices, const uint32_t* indices, const uint32_t primCount );
void BuildAVX( const bvhvec4slice& vertices, const uint32_t* indices, const uint32_t primCount );
-#elif defined BVH_USENEON
- void BuildNEON( const bvhvec4* vertices, const uint32_t primCount );
- void BuildNEON( const bvhvec4slice& vertices );
#endif
void Refit( const uint32_t nodeIdx = 0 );
int32_t Intersect( Ray& ray ) const;
+ bool IntersectSphere( const bvhvec3& pos, const float r ) const;
bool IsOccluded( const Ray& ray ) const;
void Intersect256Rays( Ray* first ) const;
void Intersect256RaysSSE( Ray* packet ) const; // requires BVH_USEAVX
@@ -629,6 +713,7 @@ class BVH : public BVHBase
void PrepareHQBuild( const bvhvec4slice& vertices, const uint32_t* indices, const uint32_t prims );
void BuildHQ();
bool ClipFrag( const Fragment& orig, Fragment& newFrag, bvhvec3 bmin, bvhvec3 bmax, bvhvec3 minDim, const uint32_t splitAxis );
+ void SplitFrag( const Fragment& orig, Fragment& left, Fragment& right, const bvhvec3& minDim, const uint32_t splitAxis, const float splitPos, bool& leftOK, bool& rightOK );
void RefitUpVerbose( uint32_t nodeIdx );
uint32_t FindBestNewPosition( const uint32_t Lid );
void ReinsertNodeVerbose( const uint32_t Lid, const uint32_t Nid, const uint32_t origin );
@@ -648,7 +733,7 @@ class BVH : public BVHBase
// Basic BVH data
bvhvec4slice verts = {}; // pointer to input primitive array: 3x16 bytes per tri.
uint32_t* vertIdx = 0; // vertex indices, only used in case the BVH is built over indexed prims.
- uint32_t* triIdx = 0; // primitive index array.
+ uint32_t* primIdx = 0; // primitive index array.
BLASInstance* instList = 0; // instance array, for top-level acceleration structure.
BVHBase** blasList = 0; // blas array, for TLAS traversal.
uint32_t blasCount = 0; // number of blasses in blasList.
@@ -656,8 +741,8 @@ class BVH : public BVHBase
uint32_t newNodePtr = 0; // used during build to keep track of next free node in pool.
Fragment* fragment = 0; // input primitive bounding boxes.
// Custom geometry intersection callback
- void (*customIntersect)(Ray&, unsigned) = 0;
- bool (*customIsOccluded)(const Ray&, unsigned) = 0;
+ bool (*customIntersect)(Ray&, const unsigned) = 0;
+ bool (*customIsOccluded)(const Ray&, const unsigned) = 0;
};
#ifdef DOUBLE_PRECISION_SUPPORT
@@ -684,10 +769,11 @@ class BVH_Double : public BVHBase
bvhdbl3 bmin, bmax; // AABB
uint64_t primIdx; // index of the original primitive
};
- BVH_Double( BVHContext ctx = {} ) { context = ctx; }
+ BVH_Double( BVHContext ctx = {} ) { layout = LAYOUT_BVH_DOUBLE; context = ctx; }
~BVH_Double();
void Build( const bvhdbl3* vertices, const uint64_t primCount );
void Build( BLASInstanceEx* bvhs, const uint64_t instCount, BVH_Double** blasses, const uint64_t blasCount );
+ void Build( void (*customGetAABB)(const uint64_t, bvhdbl3&, bvhdbl3&), const uint64_t primCount );
void PrepareBuild( const bvhdbl3* vertices, const uint64_t primCount );
void Build();
double SAHCost( const uint64_t nodeIdx = 0 ) const;
@@ -698,7 +784,7 @@ class BVH_Double : public BVHBase
bvhdbl3* verts = 0; // pointer to input primitive array, double-precision, 3x24 bytes per tri.
Fragment* fragment = 0; // input primitive bounding boxes, double-precision.
BVHNode* bvhNode = 0; // BVH node, double precision format.
- uint64_t* triIdx = 0; // primitive index array for double-precision bvh.
+ uint64_t* primIdx = 0; // primitive index array for double-precision bvh.
BLASInstanceEx* instList = 0; // instance array, for top-level acceleration structure.
BVH_Double** blasList = 0; // blas array, for TLAS traversal.
uint64_t blasCount = 0; // number of blasses in blasList.
@@ -710,7 +796,7 @@ class BVH_Double : public BVHBase
uint64_t idxCount = 0; // number of primitive indices.
bvhdbl3 aabbMin, aabbMax; // bounds of the root node of the BVH.
// Custom geometry intersection callback
- void (*customIntersect)(RayEx&, uint64_t) = 0;
+ bool (*customIntersect)(RayEx&, uint64_t) = 0;
bool (*customIsOccluded)(const RayEx&, uint64_t) = 0;
};
@@ -730,7 +816,7 @@ class BVH_GPU : public BVHBase
bvhvec3 rmax; uint32_t firstTri; // total: 64 bytes
bool isLeaf() const { return triCount > 0; }
};
- BVH_GPU( BVHContext ctx = {} ) { context = ctx; }
+ BVH_GPU( BVHContext ctx = {} ) { layout = LAYOUT_BVH_GPU; context = ctx; }
BVH_GPU( const BVH& original ) { /* DEPRICATED */ ConvertFrom( original ); }
~BVH_GPU();
void Build( const bvhvec4* vertices, const uint32_t primCount );
@@ -762,8 +848,8 @@ class BVH_SoA : public BVHBase
uint32_t left, right, triCount, firstTri; // total: 64 bytes
bool isLeaf() const { return triCount > 0; }
};
- BVH_SoA( BVHContext ctx = {} ) { context = ctx; }
- BVH_SoA( const BVH& original ) { /* DEPRICATED */ ConvertFrom( original ); }
+ BVH_SoA( BVHContext ctx = {} ) { layout = LAYOUT_BVH_SOA; context = ctx; }
+ BVH_SoA( const BVH& original ) { /* DEPRICATED */ layout = LAYOUT_BVH_SOA; ConvertFrom( original ); }
~BVH_SoA();
void Build( const bvhvec4* vertices, const uint32_t primCount );
void Build( const bvhvec4slice& vertices );
@@ -795,8 +881,8 @@ class BVH_Verbose : public BVHBase
uint32_t triCount, firstTri, parent, dummy;
bool isLeaf() const { return triCount > 0; }
};
- BVH_Verbose( BVHContext ctx = {} ) { context = ctx; }
- BVH_Verbose( const BVH& original ) { /* DEPRECATED */ ConvertFrom( original ); }
+ BVH_Verbose( BVHContext ctx = {} ) { layout = LAYOUT_BVH_VERBOSE; context = ctx; }
+ BVH_Verbose( const BVH& original ) { /* DEPRECATED */ layout = LAYOUT_BVH_VERBOSE; ConvertFrom( original ); }
~BVH_Verbose() { AlignedFree( bvhNode ); }
void ConvertFrom( const BVH& original, bool compact = true );
float SAHCost( const uint32_t nodeIdx = 0 ) const;
@@ -817,7 +903,7 @@ class BVH_Verbose : public BVHBase
// BVH data
bvhvec4slice verts = {}; // pointer to input primitive array: 3x16 bytes per tri.
Fragment* fragment = 0; // input primitive bounding boxes, double-precision.
- uint32_t* triIdx = 0; // primitive index array - pointer copied from original.
+ uint32_t* primIdx = 0; // primitive index array - pointer copied from original.
BVHNode* bvhNode = 0; // BVH node with additional info, for BVH optimizer.
};
@@ -834,8 +920,8 @@ template class MBVH : public BVHBase
uint32_t dummy[((30 - M) & 3) + 1]; // dummies are for alignment.
bool isLeaf() const { return triCount > 0; }
};
- MBVH( BVHContext ctx = {} ) { context = ctx; }
- MBVH( const BVH& original ) { /* DEPRECATED */ ConvertFrom( original ); }
+ MBVH( BVHContext ctx = {} ) { layout = LAYOUT_MBVH; context = ctx; }
+ MBVH( const BVH& original ) { /* DEPRECATED */ layout = LAYOUT_MBVH; ConvertFrom( original ); }
~MBVH();
void Build( const bvhvec4* vertices, const uint32_t primCount );
void Build( const bvhvec4slice& vertices );
@@ -876,8 +962,8 @@ class BVH4_GPU : public BVHBase
// there is no way we can shave off a full 16 bytes, unless aabbExt is stored
// as chars as well, as in CWBVH.
};
- BVH4_GPU( BVHContext ctx = {} ) { context = ctx; }
- BVH4_GPU( const MBVH<4>& original ) { /* DEPRECATED */ ConvertFrom( bvh4 ); }
+ BVH4_GPU( BVHContext ctx = {} ) { layout = LAYOUT_BVH4_GPU; context = ctx; }
+ BVH4_GPU( const MBVH<4>& bvh4 ) { /* DEPRECATED */ layout = LAYOUT_BVH4_GPU; ConvertFrom( bvh4 ); }
~BVH4_GPU();
void Build( const bvhvec4* vertices, const uint32_t primCount );
void Build( const bvhvec4slice& vertices );
@@ -911,8 +997,8 @@ class BVH4_CPU : public BVHBase
uint32_t childFirst[4];
uint32_t triCount[4];
};
- BVH4_CPU( BVHContext ctx = {} ) { context = ctx; }
- BVH4_CPU( const MBVH<4>& original ) { /* DEPRECATED */ ConvertFrom( bvh4 ); }
+ BVH4_CPU( BVHContext ctx = {} ) { layout = LAYOUT_BVH4_CPU; context = ctx; }
+ BVH4_CPU( const MBVH<4>& bvh4 ) { /* DEPRECATED */ layout = LAYOUT_BVH4_CPU; ConvertFrom( bvh4 ); }
~BVH4_CPU();
void Build( const bvhvec4* vertices, const uint32_t primCount );
void Build( const bvhvec4slice& vertices );
@@ -935,8 +1021,8 @@ class BVH4_CPU : public BVHBase
class BVH8_CWBVH : public BVHBase
{
public:
- BVH8_CWBVH( BVHContext ctx = {} ) { context = ctx; }
- BVH8_CWBVH( MBVH<8>& original ) { /* DEPRECATED */ ConvertFrom( bvh8 ); }
+ BVH8_CWBVH( BVHContext ctx = {} ) { layout = LAYOUT_CWBVH; context = ctx; }
+ BVH8_CWBVH( MBVH<8>& bvh8 ) { /* DEPRECATED */ layout = LAYOUT_CWBVH; ConvertFrom( bvh8 ); }
~BVH8_CWBVH();
void Save( const char* fileName );
bool Load( const char* fileName, const uint32_t expectedTris );
@@ -975,11 +1061,11 @@ class ALIGNED( 64 ) BLASInstance
bvhvec3 aabbMax = bvhvec3( -BVH_FAR );
uint32_t dummy[9]; // pad struct to 64 byte
void Update( BVHBase * blas );
- bvhvec3 TransformPoint( const bvhvec3 & v, const float* T ) const;
- bvhvec3 TransformVector( const bvhvec3 & v, const float* T ) const;
void InvertTransform();
};
+#ifdef DOUBLE_PRECISION_SUPPORT
+
// BLASInstanceEx: Double-precision version of BLASInstance.
class BLASInstanceEx
{
@@ -993,11 +1079,11 @@ class BLASInstanceEx
bvhdbl3 aabbMax = bvhdbl3( -BVH_DBL_FAR );
uint64_t dummy = 0;
void Update( BVH_Double* blas );
- bvhdbl3 TransformPoint( const bvhdbl3& v, const double* T ) const;
- bvhdbl3 TransformVector( const bvhdbl3& v, const double* T ) const;
void InvertTransform();
};
+#endif
+
// Experimental & 'under construction' structs
class BVH4_WiVe : public BVHBase
@@ -1024,7 +1110,7 @@ class BVH4_WiVe : public BVHBase
bool IsOccluded( const Ray& ray ) const;
// BVH4 data
bvhvec4slice verts = {}; // pointer to input primitive array: 3x16 bytes per tri.
- uint32_t* triIdx = 0; // primitive index array - pointer copied from original.
+ uint32_t* primIdx = 0; // primitive index array - pointer copied from original.
BVHNode* bvh4Node = 0; // 128-byte 4-wide BVH node for efficient CPU rendering.
};
@@ -1053,8 +1139,11 @@ class QBVH6
uint8_t upper_z[6]; // the quantized upper bounds in z-dimension
};
};
+
} // namespace tinybvh
+#endif // TINY_BVH_H_
+
// ============================================================================
//
// I M P L E M E N T A T I O N
@@ -1159,7 +1248,7 @@ void BVHBase::CopyBasePropertiesFrom( const BVHBase& original )
BVH::~BVH()
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
}
@@ -1185,14 +1274,9 @@ void BVH::BuildDefault( const bvhvec4slice& vertices )
// if AVX is supported, BuildAVX is the optimal option. Tree quality is
// identical to the reference builder, but speed is much better.
BuildAVX( vertices );
-#elif defined(BVH_USENEON)
- // on NEON, we should use the specialized NEON builder, but sadly it is
- // currently broken. We need a NEON expert. :)
- Build( vertices );
- // BuildNEON( vertices ); // TODO: currently not working correctly.
#else
- // fallback option, in case neither NEON nor AVX is supported: the reference
- // builder, which should work on all platforms.
+ // fallback option, in case AVX is not supported: the reference builder, which
+ // should work on all platforms.
Build( vertices );
#endif
}
@@ -1201,9 +1285,6 @@ void BVH::BuildDefault( const bvhvec4slice& vertices, const uint32_t* indices, c
// default builder for indexed vertices. See notes above.
#if defined(BVH_USEAVX)
BuildAVX( vertices, indices, primCount );
-#elif defined(BVH_USENEON)
- Build( vertices, indices, primCount );
- // BuildNEON( vertices ); // TODO: currently not working correctly.
#else
Build( vertices, indices, primCount );
#endif
@@ -1222,9 +1303,10 @@ void BVH::ConvertFrom( const BVH_Verbose& original, bool compact )
memset( bvhNode, 0, sizeof( BVHNode ) * spaceNeeded );
CopyBasePropertiesFrom( original );
this->verts = original.verts;
- this->triIdx = original.triIdx;
+ this->primIdx = original.primIdx;
// start conversion
- uint32_t srcNodeIdx = 0, dstNodeIdx = 0, newNodePtr = 2;
+ uint32_t srcNodeIdx = 0, dstNodeIdx = 0;
+ newNodePtr = 2;
uint32_t srcStack[64], dstStack[64], stackPtr = 0;
while (1)
{
@@ -1287,19 +1369,19 @@ void BVH::BuildQuick( const bvhvec4slice& vertices )
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
memset( &bvhNode[1], 0, 32 ); // node 1 remains unused, for cache line alignment.
- triIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
+ primIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
}
else FATAL_ERROR_IF( !rebuildable, "BVH::BuildQuick( .. ), bvh not rebuildable." );
verts = vertices; // note: we're not copying this data; don't delete.
idxCount = triCount = primCount;
// reset node pool
- uint32_t newNodePtr = 2;
+ newNodePtr = 2;
// assign all triangles to the root node
BVHNode& root = bvhNode[0];
root.leftFirst = 0, root.triCount = triCount, root.aabbMin = bvhvec3( BVH_FAR ), root.aabbMax = bvhvec3( -BVH_FAR );
@@ -1309,7 +1391,7 @@ void BVH::BuildQuick( const bvhvec4slice& vertices )
fragment[i].bmin = tinybvh_min( tinybvh_min( verts[i * 3], verts[i * 3 + 1] ), verts[i * 3 + 2] );
fragment[i].bmax = tinybvh_max( tinybvh_max( verts[i * 3], verts[i * 3 + 1] ), verts[i * 3 + 2] );
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
// subdivide recursively
uint32_t task[256], taskCount = 0, nodeIdx = 0;
@@ -1328,14 +1410,14 @@ void BVH::BuildQuick( const bvhvec4slice& vertices )
bvhvec3 lbmin( BVH_FAR ), lbmax( -BVH_FAR ), rbmin( BVH_FAR ), rbmax( -BVH_FAR ), fmin, fmax;
for (uint32_t fi, i = 0; i < node.triCount; i++)
{
- fi = triIdx[src], fmin = fragment[fi].bmin, fmax = fragment[fi].bmax;
+ fi = primIdx[src], fmin = fragment[fi].bmin, fmax = fragment[fi].bmax;
centroid = (fmin[axis] + fmax[axis]) * 0.5f;
if (centroid < splitPos)
lbmin = tinybvh_min( lbmin, fmin ), lbmax = tinybvh_max( lbmax, fmax ), src++;
else
{
rbmin = tinybvh_min( rbmin, fmin ), rbmax = tinybvh_max( rbmax, fmax );
- tinybvh_swap( triIdx[src], triIdx[--j] );
+ tinybvh_swap( primIdx[src], primIdx[--j] );
}
}
// create child nodes
@@ -1391,6 +1473,37 @@ void BVH::Build( const bvhvec4slice& vertices, const uint32_t* indices, uint32_t
bvh_over_indices = true;
}
+void BVH::Build( void (*customGetAABB)(const unsigned, bvhvec3&, bvhvec3&), const uint32_t primCount )
+{
+ FATAL_ERROR_IF( primCount == 0, "BVH::Build( void (*customGetAABB)( .. ), instCount ), instCount == 0." );
+ triCount = idxCount = primCount;
+ const uint32_t spaceNeeded = primCount * 2; // upper limit
+ if (allocatedNodes < spaceNeeded)
+ {
+ AlignedFree( bvhNode );
+ AlignedFree( primIdx );
+ AlignedFree( fragment );
+ bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
+ allocatedNodes = spaceNeeded;
+ memset( &bvhNode[1], 0, 32 ); // node 1 remains unused, for cache line alignment.
+ primIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
+ fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
+ }
+ // copy relevant data from instance array
+ BVHNode& root = bvhNode[0];
+ root.leftFirst = 0, root.triCount = primCount, root.aabbMin = bvhvec3( BVH_FAR ), root.aabbMax = bvhvec3( -BVH_FAR );
+ for (uint32_t i = 0; i < primCount; i++)
+ {
+ customGetAABB( i, fragment[i].bmin, fragment[i].bmax );
+ fragment[i].primIdx = i, fragment[i].clipped = 0, primIdx[i] = i;
+ root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax );
+ }
+ // start build
+ newNodePtr = 2;
+ Build(); // or BuildAVX, for large TLAS.
+}
+
void BVH::Build( BLASInstance* instances, const uint32_t instCount, BVHBase** blasses, const uint32_t bCount )
{
FATAL_ERROR_IF( instCount == 0, "BVH::Build( BLASInstance*, instCount ), instCount == 0." );
@@ -1399,12 +1512,12 @@ void BVH::Build( BLASInstance* instances, const uint32_t instCount, BVHBase** bl
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
memset( &bvhNode[1], 0, 32 ); // node 1 remains unused, for cache line alignment.
- triIdx = (uint32_t*)AlignedAlloc( instCount * sizeof( uint32_t ) );
+ primIdx = (uint32_t*)AlignedAlloc( instCount * sizeof( uint32_t ) );
fragment = (Fragment*)AlignedAlloc( instCount * sizeof( Fragment ) );
}
instList = instances;
@@ -1415,13 +1528,16 @@ void BVH::Build( BLASInstance* instances, const uint32_t instCount, BVHBase** bl
root.leftFirst = 0, root.triCount = instCount, root.aabbMin = bvhvec3( BVH_FAR ), root.aabbMax = bvhvec3( -BVH_FAR );
for (uint32_t i = 0; i < instCount; i++)
{
- uint32_t blasIdx = instList[i].blasIdx;
- BVH* blas = (BVH*)blasList[blasIdx];
- instList[i].Update( blas );
+ if (blasList) // if a null pointer is passed, we'll assume the BLASInstances have been updated elsewhere.
+ {
+ uint32_t blasIdx = instList[i].blasIdx;
+ BVH* blas = (BVH*)blasList[blasIdx];
+ instList[i].Update( blas );
+ }
fragment[i].bmin = instList[i].aabbMin, fragment[i].primIdx = i;
fragment[i].bmax = instList[i].aabbMax, fragment[i].clipped = 0;
root.aabbMin = tinybvh_min( root.aabbMin, instList[i].aabbMin );
- root.aabbMax = tinybvh_max( root.aabbMax, instList[i].aabbMax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, instList[i].aabbMax ), primIdx[i] = i;
}
// start build
newNodePtr = 2;
@@ -1436,12 +1552,12 @@ void BVH::PrepareBuild( const bvhvec4slice& vertices, const uint32_t* indices, c
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
memset( &bvhNode[1], 0, 32 ); // node 1 remains unused, for cache line alignment.
- triIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
+ primIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
if (vertices) fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
else FATAL_ERROR_IF( fragment == 0, "BVH::PrepareBuild( 0, .. ), not called from ::Build( aabb )." );
}
@@ -1462,7 +1578,7 @@ void BVH::PrepareBuild( const bvhvec4slice& vertices, const uint32_t* indices, c
const bvhvec4 fmax = tinybvh_max( v0, tinybvh_max( v1, v2 ) );
fragment[i].bmin = fmin, fragment[i].bmax = fmax;
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
}
else
@@ -1477,7 +1593,7 @@ void BVH::PrepareBuild( const bvhvec4slice& vertices, const uint32_t* indices, c
const bvhvec4 fmax = tinybvh_max( v0, tinybvh_max( v1, v2 ) );
fragment[i].bmin = fmin, fragment[i].bmax = fmax;
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
vertIdx = (uint32_t*)indices;
}
@@ -1504,7 +1620,7 @@ void BVH::Build()
const bvhvec3 rpd3 = bvhvec3( BVHBINS / (node.aabbMax - node.aabbMin) ), nmin3 = node.aabbMin;
for (uint32_t i = 0; i < node.triCount; i++) // process all tris for x,y and z at once
{
- const uint32_t fi = triIdx[node.leftFirst + i];
+ const uint32_t fi = primIdx[node.leftFirst + i];
bvhint3 bi = bvhint3( ((fragment[fi].bmin + fragment[fi].bmax) * 0.5f - nmin3) * rpd3 );
bi.x = tinybvh_clamp( bi.x, 0, BVHBINS - 1 );
bi.y = tinybvh_clamp( bi.y, 0, BVHBINS - 1 );
@@ -1552,10 +1668,10 @@ void BVH::Build()
const float rpd = rpd3.cell[bestAxis], nmin = nmin3.cell[bestAxis];
for (uint32_t i = 0; i < node.triCount; i++)
{
- const uint32_t fi = triIdx[src];
+ const uint32_t fi = primIdx[src];
int32_t bi = (uint32_t)(((fragment[fi].bmin[bestAxis] + fragment[fi].bmax[bestAxis]) * 0.5f - nmin) * rpd);
bi = tinybvh_clamp( bi, 0, BVHBINS - 1 );
- if ((uint32_t)bi <= bestPos) src++; else tinybvh_swap( triIdx[src], triIdx[--j] );
+ if ((uint32_t)bi <= bestPos) src++; else tinybvh_swap( primIdx[src], primIdx[--j] );
}
// create child nodes
uint32_t leftCount = src - node.leftFirst, rightCount = node.triCount - leftCount;
@@ -1623,12 +1739,12 @@ void BVH::PrepareHQBuild( const bvhvec4slice& vertices, const uint32_t* indices,
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
memset( &bvhNode[1], 0, 32 ); // node 1 remains unused, for cache line alignment.
- triIdx = (uint32_t*)AlignedAlloc( (primCount + slack) * sizeof( uint32_t ) );
+ primIdx = (uint32_t*)AlignedAlloc( (primCount + slack) * sizeof( uint32_t ) );
fragment = (Fragment*)AlignedAlloc( (primCount + slack) * sizeof( Fragment ) );
}
else FATAL_ERROR_IF( !rebuildable, "BVH::PrepareHQBuild( .. ), bvh not rebuildable." );
@@ -1647,9 +1763,9 @@ void BVH::PrepareHQBuild( const bvhvec4slice& vertices, const uint32_t* indices,
const bvhvec4 v0 = verts[i * 3], v1 = verts[i * 3 + 1], v2 = verts[i * 3 + 2];
const bvhvec4 fmin = tinybvh_min( v0, tinybvh_min( v1, v2 ) );
const bvhvec4 fmax = tinybvh_max( v0, tinybvh_max( v1, v2 ) );
- fragment[i].bmin = fmin, fragment[i].bmax = fmax, fragment[i].primIdx = i;
+ fragment[i].bmin = fmin, fragment[i].bmax = fmax, fragment[i].primIdx = i, fragment[i].clipped = 0;
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
}
else
@@ -1663,20 +1779,20 @@ void BVH::PrepareHQBuild( const bvhvec4slice& vertices, const uint32_t* indices,
const bvhvec4 v0 = verts[i0], v1 = verts[i1], v2 = verts[i2];
const bvhvec4 fmin = tinybvh_min( v0, tinybvh_min( v1, v2 ) );
const bvhvec4 fmax = tinybvh_max( v0, tinybvh_max( v1, v2 ) );
- fragment[i].bmin = fmin, fragment[i].bmax = fmax, fragment[i].primIdx = i;
+ fragment[i].bmin = fmin, fragment[i].bmax = fmax, fragment[i].primIdx = i, fragment[i].clipped = 0;
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
vertIdx = (uint32_t*)indices;
}
// clear remainder of index array
- memset( triIdx + triCount, 0, slack * 4 );
+ memset( primIdx + triCount, 0, slack * 4 );
// all set; actual build happens in BVH::Build.
}
void BVH::BuildHQ()
{
const uint32_t slack = triCount >> 1; // for split prims
- uint32_t* triIdxA = triIdx;
+ uint32_t* triIdxA = primIdx;
uint32_t* triIdxB = (uint32_t*)AlignedAlloc( (triCount + slack) * sizeof( uint32_t ) );
memset( triIdxB, 0, (triCount + slack) * 4 );
// reset node pool
@@ -1703,7 +1819,7 @@ void BVH::BuildHQ()
const bvhvec3 rpd3 = bvhvec3( HQBVHBINS / (node.aabbMax - node.aabbMin) ), nmin3 = node.aabbMin;
for (uint32_t i = 0; i < node.triCount; i++) // process all tris for x,y and z at once
{
- const uint32_t fi = triIdx[node.leftFirst + i];
+ const uint32_t fi = primIdx[node.leftFirst + i];
bvhint3 bi = bvhint3( ((fragment[fi].bmin + fragment[fi].bmax) * 0.5f - nmin3) * rpd3 );
bi.x = tinybvh_clamp( bi.x, 0, HQBVHBINS - 1 );
bi.y = tinybvh_clamp( bi.y, 0, HQBVHBINS - 1 );
@@ -1752,8 +1868,8 @@ void BVH::BuildHQ()
for (uint32_t a = 0; a < 3; a++) if ((node.aabbMax[a] - node.aabbMin[a]) > minDim.cell[a])
{
// setup bins
- bvhvec3 binMin[HQBVHBINS], binMax[HQBVHBINS];
- for (uint32_t i = 0; i < HQBVHBINS; i++) binMin[i] = BVH_FAR, binMax[i] = -BVH_FAR;
+ bvhvec3 binaMin[HQBVHBINS], binaMax[HQBVHBINS];
+ for (uint32_t i = 0; i < HQBVHBINS; i++) binaMin[i] = BVH_FAR, binaMax[i] = -BVH_FAR;
uint32_t countIn[HQBVHBINS] = { 0 }, countOut[HQBVHBINS] = { 0 };
// populate bins with clipped fragments
const float planeDist = (node.aabbMax[a] - node.aabbMin[a]) / (HQBVHBINS * 0.9999f);
@@ -1764,12 +1880,9 @@ void BVH::BuildHQ()
const int32_t bin1 = tinybvh_clamp( (int32_t)((fragment[fragIdx].bmin[a] - nodeMin) * rPlaneDist), 0, HQBVHBINS - 1 );
const int32_t bin2 = tinybvh_clamp( (int32_t)((fragment[fragIdx].bmax[a] - nodeMin) * rPlaneDist), 0, HQBVHBINS - 1 );
countIn[bin1]++, countOut[bin2]++;
- if (bin2 == bin1)
- {
- // fragment fits in a single bin
- binMin[bin1] = tinybvh_min( binMin[bin1], fragment[fragIdx].bmin );
- binMax[bin1] = tinybvh_max( binMax[bin1], fragment[fragIdx].bmax );
- }
+ if (bin2 == bin1) // fragment fits in a single bin
+ binaMin[bin1] = tinybvh_min( binaMin[bin1], fragment[fragIdx].bmin ),
+ binaMax[bin1] = tinybvh_max( binaMax[bin1], fragment[fragIdx].bmax );
else for (int32_t j = bin1; j <= bin2; j++)
{
// clip fragment to each bin it overlaps
@@ -1779,8 +1892,8 @@ void BVH::BuildHQ()
Fragment orig = fragment[fragIdx];
Fragment tmpFrag;
if (!ClipFrag( orig, tmpFrag, bmin, bmax, minDim, a )) continue;
- binMin[j] = tinybvh_min( binMin[j], tmpFrag.bmin );
- binMax[j] = tinybvh_max( binMax[j], tmpFrag.bmax );
+ binaMin[j] = tinybvh_min( binaMin[j], tmpFrag.bmin );
+ binaMax[j] = tinybvh_max( binaMax[j], tmpFrag.bmax );
}
}
// evaluate split candidates
@@ -1789,8 +1902,8 @@ void BVH::BuildHQ()
float ANL[HQBVHBINS], ANR[HQBVHBINS];
for (uint32_t lN = 0, rN = 0, i = 0; i < HQBVHBINS - 1; i++)
{
- lBMin[i] = l1 = tinybvh_min( l1, binMin[i] ), rBMin[HQBVHBINS - 2 - i] = r1 = tinybvh_min( r1, binMin[HQBVHBINS - 1 - i] );
- lBMax[i] = l2 = tinybvh_max( l2, binMax[i] ), rBMax[HQBVHBINS - 2 - i] = r2 = tinybvh_max( r2, binMax[HQBVHBINS - 1 - i] );
+ lBMin[i] = l1 = tinybvh_min( l1, binaMin[i] ), rBMin[HQBVHBINS - 2 - i] = r1 = tinybvh_min( r1, binaMin[HQBVHBINS - 1 - i] );
+ lBMax[i] = l2 = tinybvh_max( l2, binaMax[i] ), rBMax[HQBVHBINS - 2 - i] = r2 = tinybvh_max( r2, binaMax[HQBVHBINS - 1 - i] );
lN += countIn[i], rN += countOut[HQBVHBINS - 1 - i], NL[i] = lN, NR[HQBVHBINS - 2 - i] = rN;
ANL[i] = lN == 0 ? BVH_FAR : ((l2 - l1).halfArea() * (float)lN);
ANR[HQBVHBINS - 2 - i] = rN == 0 ? BVH_FAR : ((r2 - r1).halfArea() * (float)rN);
@@ -1811,7 +1924,13 @@ void BVH::BuildHQ()
}
// evaluate best split cost
float noSplitCost = (float)node.triCount * C_INT;
- if (splitCost >= noSplitCost) break; // not splitting is better.
+ if (splitCost >= noSplitCost)
+ {
+ bvhvec3 nodeMin( BVH_FAR ), nodeMax( -BVH_FAR );
+ for (uint32_t i = 0; i < node.triCount; i++)
+ primIdx[node.leftFirst + i] = fragment[primIdx[node.leftFirst + i]].primIdx;
+ break; // not splitting is better.
+ }
// double-buffered partition
uint32_t A = sliceStart, B = sliceEnd, src = node.leftFirst;
if (spatial)
@@ -1819,62 +1938,65 @@ void BVH::BuildHQ()
// spatial partitioning
const float planeDist = (node.aabbMax[bestAxis] - node.aabbMin[bestAxis]) / (HQBVHBINS * 0.9999f);
const float rPlaneDist = 1.0f / planeDist, nodeMin = node.aabbMin[bestAxis];
- bvhvec3 finalLMin = bestLMin, finalLMax = bestLMax;
- bvhvec3 finalRMin = bestRMin, finalRMax = bestRMax;
for (uint32_t i = 0; i < node.triCount; i++)
{
const uint32_t fragIdx = triIdxA[src++];
- const uint32_t bin1 = (uint32_t)((fragment[fragIdx].bmin[bestAxis] - nodeMin) * rPlaneDist);
- const uint32_t bin2 = (uint32_t)((fragment[fragIdx].bmax[bestAxis] - nodeMin) * rPlaneDist);
+ const uint32_t bin1 = (uint32_t)tinybvh_max( (fragment[fragIdx].bmin[bestAxis] - nodeMin) * rPlaneDist, 0.0f );
+ const uint32_t bin2 = (uint32_t)tinybvh_max( (fragment[fragIdx].bmax[bestAxis] - nodeMin) * rPlaneDist, 0.0f );
if (bin2 <= bestPos) triIdxB[A++] = fragIdx; else if (bin1 > bestPos) triIdxB[--B] = fragIdx; else
{
#ifdef SBVH_UNSPLITTING
- // unsplitting
- if (!bvh_over_indices)
+ // unsplitting: 1. Calculate what happens if we add this primitive entirely to the left side
+ if (bestNR > 1)
{
- // 1. Calculate what happens if we add this primitive entirely to the left side
- if (bestNR > 1)
+ bvhvec3 unsplitLMin = tinybvh_min( bestLMin, fragment[fragIdx].bmin );
+ bvhvec3 unsplitLMax = tinybvh_max( bestLMax, fragment[fragIdx].bmax );
+ float AL = (unsplitLMax - unsplitLMin).halfArea();
+ float AR = (bestRMax - bestRMin).halfArea();
+ float CunsplitLeft = C_TRAV + C_INT * rSAV * (AL * bestNL + AR * (bestNR - 1));
+ if (CunsplitLeft < splitCost)
{
- bvhvec3 unsplitLMin = tinybvh_min( finalLMin, fragment[fragIdx].bmin );
- bvhvec3 unsplitLMax = tinybvh_max( finalLMax, fragment[fragIdx].bmax );
- float AL = (unsplitLMax - unsplitLMin).halfArea();
- float AR = (finalRMax - finalRMin).halfArea();
- float CunsplitLeft = C_TRAV + C_INT * rSAV * (AL * bestNL + AR * (bestNR - 1));
- if (CunsplitLeft < splitCost)
- {
- bestNR--, splitCost = CunsplitLeft, triIdxB[A++] = fragIdx;
- finalLMin = unsplitLMin, finalLMax = unsplitLMax;
- continue;
- }
+ bestNR--, splitCost = CunsplitLeft, triIdxB[A++] = fragIdx;
+ bestLMin = unsplitLMin, bestLMax = unsplitLMax;
+ continue;
}
- // 2. Calculate what happens if we add this primitive entirely to the right side
- if (bestNL > 1)
+ }
+ // 2. Calculate what happens if we add this primitive entirely to the right side
+ if (bestNL > 1)
+ {
+ const bvhvec3 unsplitRMin = tinybvh_min( bestRMin, fragment[fragIdx].bmin );
+ const bvhvec3 unsplitRMax = tinybvh_max( bestRMax, fragment[fragIdx].bmax );
+ const float AL = (bestLMax - bestLMin).halfArea();
+ const float AR = (unsplitRMax - unsplitRMin).halfArea();
+ const float CunsplitRight = C_TRAV + C_INT * rSAV * (AL * (bestNL - 1) + AR * bestNR);
+ if (CunsplitRight < splitCost)
{
- bvhvec3 unsplitRMin = tinybvh_min( finalRMin, fragment[fragIdx].bmin );
- bvhvec3 unsplitRMax = tinybvh_max( finalRMax, fragment[fragIdx].bmax );
- float AL = (finalLMax - finalLMin).halfArea();
- float AR = (unsplitRMax - unsplitRMin).halfArea();
- float CunsplitRight = C_TRAV + C_INT * rSAV * (AL * (bestNL - 1) + AR * bestNR);
- if (CunsplitRight < splitCost)
- {
- bestNL--, splitCost = CunsplitRight, triIdxB[--B] = fragIdx;
- finalRMin = unsplitRMin, finalRMax = unsplitRMax;
- continue;
- }
+ bestNL--, splitCost = CunsplitRight, triIdxB[--B] = fragIdx;
+ bestRMin = unsplitRMin, bestRMax = unsplitRMax;
+ continue;
}
}
#endif
// split straddler
- Fragment tmpFrag = fragment[fragIdx];
- Fragment newFrag;
- if (ClipFrag( tmpFrag, newFrag, tinybvh_max( bestRMin, node.aabbMin ), tinybvh_min( bestRMax, node.aabbMax ), minDim, bestAxis ))
- fragment[nextFrag] = newFrag, triIdxB[--B] = nextFrag++;
- if (ClipFrag( tmpFrag, fragment[fragIdx], tinybvh_max( bestLMin, node.aabbMin ), tinybvh_min( bestLMax, node.aabbMax ), minDim, bestAxis ))
- triIdxB[A++] = fragIdx;
+ ALIGNED( 64 ) Fragment part1, part2; // keep all clipping in a single cacheline.
+ bool leftOK = false, rightOK = false;
+ float splitPos = bestLMax[bestAxis];
+ SplitFrag( fragment[fragIdx], part1, part2, minDim, bestAxis, splitPos, leftOK, rightOK );
+ if (leftOK && rightOK)
+ fragment[fragIdx] = part1, triIdxB[A++] = fragIdx,
+ fragment[nextFrag] = part2, triIdxB[--B] = nextFrag++;
+ else // didn't work out; unsplit (rare)
+ if (leftOK) triIdxB[A++] = fragIdx; else triIdxB[--B] = fragIdx;
}
}
- bestLMin = finalLMin, bestLMax = finalLMax;
- bestRMin = finalRMin, bestRMax = finalRMax;
+ // for spatial splits, we fully refresh the bounds: clipping is never fully stable..
+ bestLMin = bestRMin = bvhvec3( BVH_FAR ), bestLMax = bestRMax = bvhvec3( -BVH_FAR );
+ for (uint32_t i = sliceStart; i < A; i++)
+ bestLMin = tinybvh_min( bestLMin, fragment[triIdxB[i]].bmin ),
+ bestLMax = tinybvh_max( bestLMax, fragment[triIdxB[i]].bmax );
+ for (uint32_t i = B; i < sliceEnd; i++)
+ bestRMin = tinybvh_min( bestRMin, fragment[triIdxB[i]].bmin ),
+ bestRMax = tinybvh_max( bestRMax, fragment[triIdxB[i]].bmax );
}
else
{
@@ -1882,7 +2004,7 @@ void BVH::BuildHQ()
const float rpd = rpd3.cell[bestAxis], nmin = nmin3.cell[bestAxis];
for (uint32_t i = 0; i < node.triCount; i++)
{
- const uint32_t fr = triIdx[src + i];
+ const uint32_t fr = primIdx[src + i];
int32_t bi = (int32_t)(((fragment[fr].bmin[bestAxis] + fragment[fr].bmax[bestAxis]) * 0.5f - nmin) * rpd);
bi = tinybvh_clamp( bi, 0, HQBVHBINS - 1 );
if (bi <= (int32_t)bestPos) triIdxB[A++] = fr; else triIdxB[--B] = fr;
@@ -1909,10 +2031,8 @@ void BVH::BuildHQ()
sliceStart = task[taskCount].sliceStart,
sliceEnd = task[taskCount].sliceEnd;
}
- // clean up
- for (uint32_t i = 0; i < triCount + slack; i++) triIdx[i] = fragment[triIdx[i]].primIdx;
- AlignedFree( triIdxB );
// all done.
+ AlignedFree( triIdxB );
aabbMin = bvhNode[0].aabbMin, aabbMax = bvhNode[0].aabbMax;
refittable = false; // can't refit an SBVH
may_have_holes = false; // there may be holes in the index list, but not in the node list
@@ -1924,7 +2044,7 @@ void BVH::BuildHQ()
// includes trees waving in the wind, or subsequent frames for skinned
// animations. Repeated refitting tends to lead to deteriorated BVHs and
// slower ray tracing. Rebuild when this happens.
-void BVH::Refit( const uint32_t nodeIdx )
+void BVH::Refit( const uint32_t /* unused */ )
{
FATAL_ERROR_IF( !refittable, "BVH::Refit( .. ), refitting an SBVH." );
FATAL_ERROR_IF( bvhNode == 0, "BVH::Refit( .. ), bvhNode == 0." );
@@ -1934,34 +2054,34 @@ void BVH::Refit( const uint32_t nodeIdx )
BVHNode& node = bvhNode[i];
if (node.isLeaf()) // leaf: adjust to current triangle vertex positions
{
- bvhvec4 aabbMin( BVH_FAR ), aabbMax( -BVH_FAR );
+ bvhvec4 bmin( BVH_FAR ), bmax( -BVH_FAR );
if (vertIdx)
{
for (uint32_t first = node.leftFirst, j = 0; j < node.triCount; j++)
{
- const uint32_t vidx = triIdx[first + j] * 3;
+ const uint32_t vidx = primIdx[first + j] * 3;
const uint32_t i0 = vertIdx[vidx], i1 = vertIdx[vidx + 1], i2 = vertIdx[vidx + 2];
const bvhvec4 v0 = verts[i0], v1 = verts[i1], v2 = verts[i2];
- const bvhvec4 t1 = tinybvh_min( v0, aabbMin );
- const bvhvec4 t2 = tinybvh_max( v0, aabbMax );
+ const bvhvec4 t1 = tinybvh_min( v0, bmin );
+ const bvhvec4 t2 = tinybvh_max( v0, bmax );
const bvhvec4 t3 = tinybvh_min( v1, v2 );
const bvhvec4 t4 = tinybvh_max( v1, v2 );
- aabbMin = tinybvh_min( t1, t3 );
- aabbMax = tinybvh_max( t2, t4 );
+ bmin = tinybvh_min( t1, t3 );
+ bmax = tinybvh_max( t2, t4 );
}
}
else
{
for (uint32_t first = node.leftFirst, j = 0; j < node.triCount; j++)
{
- const uint32_t vidx = triIdx[first + j] * 3;
+ const uint32_t vidx = primIdx[first + j] * 3;
const bvhvec4 v0 = verts[vidx], v1 = verts[vidx + 1], v2 = verts[vidx + 2];
- const bvhvec4 t1 = tinybvh_min( v0, aabbMin );
- const bvhvec4 t2 = tinybvh_max( v0, aabbMax );
+ const bvhvec4 t1 = tinybvh_min( v0, bmin );
+ const bvhvec4 t2 = tinybvh_max( v0, bmax );
const bvhvec4 t3 = tinybvh_min( v1, v2 );
const bvhvec4 t4 = tinybvh_max( v1, v2 );
- aabbMin = tinybvh_min( t1, t3 );
- aabbMax = tinybvh_max( t2, t4 );
+ bmin = tinybvh_min( t1, t3 );
+ bmax = tinybvh_max( t2, t4 );
}
}
node.aabbMin = aabbMin, node.aabbMax = aabbMax;
@@ -1975,6 +2095,35 @@ void BVH::Refit( const uint32_t nodeIdx )
aabbMin = bvhNode[0].aabbMin, aabbMax = bvhNode[0].aabbMax;
}
+bool BVH::IntersectSphere( const bvhvec3& pos, const float r ) const
+{
+ const bvhvec3 bmin = pos - bvhvec3( r ), bmax = pos + bvhvec3( r );
+ BVHNode* node = &bvhNode[0], * stack[64];
+ uint32_t stackPtr = 0;
+ const float r2 = r * r;
+ while (1)
+ {
+ if (node->isLeaf())
+ {
+ // check if the leaf aabb overlaps the sphere: https://gamedev.stackexchange.com/a/156877
+ float dist2 = 0;
+ if (pos.x < bmin.x) dist2 += (bmin.x - pos.x) * (bmin.x - pos.x);
+ if (pos.x > bmax.x) dist2 += (pos.x - bmax.x) * (pos.x - bmax.x);
+ if (pos.y < bmin.y) dist2 += (bmin.y - pos.y) * (bmin.y - pos.y);
+ if (pos.y > bmax.y) dist2 += (pos.y - bmax.y) * (pos.y - bmax.y);
+ if (pos.z < bmin.z) dist2 += (bmin.z - pos.z) * (bmin.z - pos.z);
+ if (pos.z > bmax.z) dist2 += (pos.z - bmax.z) * (pos.z - bmax.z);
+ if (dist2 <= r2) return true; else if (stackPtr == 0) break; else node = stack[--stackPtr];
+ }
+ BVHNode* child1 = &bvhNode[node->leftFirst], * child2 = &bvhNode[node->leftFirst + 1];
+ bool hit1 = child1->Intersect( bmin, bmax ), hit2 = child2->Intersect( bmin, bmax );
+ if (hit1 && hit2) stack[stackPtr++] = child2, node = child1;
+ else if (hit1) node = child1; else if (hit2) node = child2;
+ else { if (stackPtr == 0) break; node = stack[--stackPtr]; }
+ }
+ return false;
+}
+
int32_t BVH::Intersect( Ray& ray ) const
{
if (isTLAS()) return IntersectTLAS( ray );
@@ -1985,12 +2134,25 @@ int32_t BVH::Intersect( Ray& ray ) const
cost += C_TRAV;
if (node->isLeaf())
{
+ // Performance note: if indexed primitives (ENABLE_INDEXED_GEOMETRY) and custom
+ // geometry (ENABLE_CUSTOM_GEOMETRY) are both disabled, this leaf code reduces
+ // to a regular loop over triangles. Otherwise, the extra flexibility comes at
+ // a small performance cost.
if (indexedEnabled && vertIdx != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTriIndexed( ray, verts, vertIdx, triIdx[node->leftFirst + i] );
+ IntersectTriIndexed( ray, verts, vertIdx, primIdx[node->leftFirst + i] );
else if (customEnabled && customIntersect != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- (*customIntersect)(ray, triIdx[node->leftFirst + i]);
+ {
+ if ((*customIntersect)(ray, primIdx[node->leftFirst + i]))
+ {
+ #if INST_IDX_BITS == 32
+ ray.hit.inst = ray.instIdx;
+ #else
+ ray.hit.prim = (ray.hit.prim & PRIM_IDX_MASK) + ray.instIdx;
+ #endif
+ }
+ }
else for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTri( ray, verts, triIdx[node->leftFirst + i] );
+ IntersectTri( ray, verts, primIdx[node->leftFirst + i] );
if (stackPtr == 0) break; else node = stack[--stackPtr];
continue;
}
@@ -2024,17 +2186,48 @@ int32_t BVH::IntersectTLAS( Ray& ray ) const
for (uint32_t i = 0; i < node->triCount; i++)
{
// BLAS traversal
- const uint32_t instIdx = triIdx[node->leftFirst + i];
+ const uint32_t instIdx = primIdx[node->leftFirst + i];
const BLASInstance& inst = instList[instIdx];
- const BVH* blas = (const BVH*)blasList[inst.blasIdx]; // TODO: actually we don't know BVH type.
+ const BVHBase* blas = blasList[inst.blasIdx];
// 1. Transform ray with the inverse of the instance transform
- tmp.O = inst.TransformPoint( ray.O, inst.invTransform );
- tmp.D = inst.TransformVector( ray.D, inst.invTransform );
- tmp.rD = tinybvh_safercp( tmp.D );
- tmp.instIdx = instIdx << (32 - TLAS_BITS);
+ tmp.O = tinybvh_transform_point( ray.O, inst.invTransform );
+ tmp.D = tinybvh_transform_vector( ray.D, inst.invTransform );
+ tmp.instIdx = instIdx << (32 - INST_IDX_BITS);
tmp.hit = ray.hit;
// 2. Traverse BLAS with the transformed ray
- cost += blas->Intersect( tmp );
+ // Note: Valid BVH layout options for BLASses are the regular BVH layout,
+ // the AVX-optimized BVH_SOA layout and the wide BVH4_CPU layout. If all
+ // BLASses are of the same layout this reduces to nearly zero cost for
+ // a small set of predictable branches.
+ assert( blas->layout == LAYOUT_BVH || blas->layout == LAYOUT_BVH4_CPU || blas->layout == LAYOUT_BVH_SOA );
+ if (blas->layout == LAYOUT_BVH)
+ {
+ float reciDirScale = 1.0f;
+ if (((BVH*)blas)->customIntersect == 0)
+ {
+ // regular (triangle) BVH traversal
+ tmp.rD = tinybvh_safercp( tmp.D );
+ cost += ((BVH*)blas)->Intersect( tmp );
+ }
+ else
+ {
+ // when intersecting custom geometry, we need to normalize the transformed ray
+ // direction, just to be safe. This is not needed for intersecting a regular BVH.
+ const float dirScale = tinybvh_length( tmp.D );
+ reciDirScale = 1.0f / dirScale;
+ tmp.D = tmp.D * reciDirScale;
+ tmp.hit.t *= dirScale;
+ tmp.rD = tinybvh_safercp( tmp.D );
+ cost += ((BVH*)blas)->Intersect( tmp );
+ tmp.hit.t *= reciDirScale;
+ }
+ }
+ else
+ {
+ tmp.rD = tinybvh_safercp( tmp.D );
+ if (blas->layout == LAYOUT_BVH4_CPU) cost += ((BVH4_CPU*)blas)->Intersect( tmp );
+ else if (blas->layout == LAYOUT_BVH_SOA) cost += ((BVH_SoA*)blas)->Intersect( tmp );
+ }
// 3. Restore ray
ray.hit = tmp.hit;
}
@@ -2070,17 +2263,17 @@ bool BVH::IsOccluded( const Ray& ray ) const
if (indexedEnabled && vertIdx != 0)
{
for (uint32_t i = 0; i < node->triCount; i++)
- if (IndexedTriOccludes( ray, verts, vertIdx, triIdx[node->leftFirst + i] )) return true;
+ if (IndexedTriOccludes( ray, verts, vertIdx, primIdx[node->leftFirst + i] )) return true;
}
else if (customEnabled && customIsOccluded != 0)
{
for (uint32_t i = 0; i < node->triCount; i++)
- if ((*customIsOccluded)(ray, triIdx[node->leftFirst + i])) return true;
+ if ((*customIsOccluded)(ray, primIdx[node->leftFirst + i])) return true;
}
else
{
for (uint32_t i = 0; i < node->triCount; i++)
- if (TriOccludes( ray, verts, triIdx[node->leftFirst + i] )) return true;
+ if (TriOccludes( ray, verts, primIdx[node->leftFirst + i] )) return true;
}
if (stackPtr == 0) break; else node = stack[--stackPtr];
continue;
@@ -2115,11 +2308,11 @@ bool BVH::IsOccludedTLAS( const Ray& ray ) const
for (uint32_t i = 0; i < node->triCount; i++)
{
// BLAS traversal
- BLASInstance& inst = instList[triIdx[node->leftFirst + i]];
+ BLASInstance& inst = instList[primIdx[node->leftFirst + i]];
BVH* blas = (BVH*)blasList[inst.blasIdx]; // TODO: actually we don't know BVH type.
// 1. Transform ray with the inverse of the instance transform
- tmp.O = inst.TransformPoint( ray.O, inst.invTransform );
- tmp.D = inst.TransformVector( ray.D, inst.invTransform );
+ tmp.O = tinybvh_transform_point( ray.O, inst.invTransform );
+ tmp.D = tinybvh_transform_vector( ray.D, inst.invTransform );
tmp.rD = tinybvh_safercp( tmp.D );
// 2. Traverse BLAS with the transformed ray
if (blas->IsOccluded( tmp )) return true;
@@ -2164,16 +2357,16 @@ void BVH::Intersect256Rays( Ray* packet ) const
const bvhvec3 p1 = packet[51].O + packet[51].D; // top-right
const bvhvec3 p2 = packet[204].O + packet[204].D; // bottom-left
const bvhvec3 p3 = packet[255].O + packet[255].D; // bottom-right
- const bvhvec3 plane0 = normalize( cross( p0 - O, p0 - p2 ) ); // left plane
- const bvhvec3 plane1 = normalize( cross( p3 - O, p3 - p1 ) ); // right plane
- const bvhvec3 plane2 = normalize( cross( p1 - O, p1 - p0 ) ); // top plane
- const bvhvec3 plane3 = normalize( cross( p2 - O, p2 - p3 ) ); // bottom plane
+ const bvhvec3 plane0 = tinybvh_normalize( tinybvh_cross( p0 - O, p0 - p2 ) ); // left plane
+ const bvhvec3 plane1 = tinybvh_normalize( tinybvh_cross( p3 - O, p3 - p1 ) ); // right plane
+ const bvhvec3 plane2 = tinybvh_normalize( tinybvh_cross( p1 - O, p1 - p0 ) ); // top plane
+ const bvhvec3 plane3 = tinybvh_normalize( tinybvh_cross( p2 - O, p2 - p3 ) ); // bottom plane
const int32_t sign0x = plane0.x < 0 ? 4 : 0, sign0y = plane0.y < 0 ? 5 : 1, sign0z = plane0.z < 0 ? 6 : 2;
const int32_t sign1x = plane1.x < 0 ? 4 : 0, sign1y = plane1.y < 0 ? 5 : 1, sign1z = plane1.z < 0 ? 6 : 2;
const int32_t sign2x = plane2.x < 0 ? 4 : 0, sign2y = plane2.y < 0 ? 5 : 1, sign2z = plane2.z < 0 ? 6 : 2;
const int32_t sign3x = plane3.x < 0 ? 4 : 0, sign3y = plane3.y < 0 ? 5 : 1, sign3z = plane3.z < 0 ? 6 : 2;
- const float d0 = dot( O, plane0 ), d1 = dot( O, plane1 );
- const float d2 = dot( O, plane2 ), d3 = dot( O, plane3 );
+ const float d0 = tinybvh_dot( O, plane0 ), d1 = tinybvh_dot( O, plane1 );
+ const float d2 = tinybvh_dot( O, plane2 ), d3 = tinybvh_dot( O, plane3 );
// Traverse the tree with the packet
int32_t first = 0, last = 255; // first and last active ray in the packet
const BVHNode* node = &bvhNode[0];
@@ -2185,23 +2378,29 @@ void BVH::Intersect256Rays( Ray* packet ) const
// handle leaf node
for (uint32_t j = 0; j < node->triCount; j++)
{
- const uint32_t idx = triIdx[node->leftFirst + j], vid = idx * 3;
+ const uint32_t idx = primIdx[node->leftFirst + j], vid = idx * 3;
const bvhvec3 edge1 = verts[vid + 1] - verts[vid], edge2 = verts[vid + 2] - verts[vid];
const bvhvec3 s = O - bvhvec3( verts[vid] );
for (int32_t i = first; i <= last; i++)
{
Ray& ray = packet[i];
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) continue; // ray parallel to triangle
- const float f = 1 / a, u = f * dot( s, h );
+ const float f = 1 / a, u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
if (t <= 0 || t >= ray.hit.t) continue;
- ray.hit.t = t, ray.hit.u = u, ray.hit.v = v, ray.hit.prim = idx;
+ ray.hit.t = t, ray.hit.u = u, ray.hit.v = v;
+ #if INST_IDX_BITS == 32
+ ray.hit.prim = idx;
+ ray.hit.inst = ray.instIdx;
+ #else
+ ray.hit.prim = idx + ray.instIdx;
+ #endif
}
}
if (stackPtr == 0) break; else // pop
@@ -2221,17 +2420,21 @@ void BVH::Intersect256Rays( Ray* packet ) const
const bvhvec3 o1( left->aabbMin.x - O.x, left->aabbMin.y - O.y, left->aabbMin.z - O.z );
const bvhvec3 o2( left->aabbMax.x - O.x, left->aabbMax.y - O.y, left->aabbMax.z - O.z );
// 1. Early-in test: if first ray hits the node, the packet visits the node
- CALC_TMIN_TMAX_WITH_SLABTEST_ON_RAY( first );
- const bool earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
- distLeft = tmin;
+ bool earlyHit;
+ {
+ CALC_TMIN_TMAX_WITH_SLABTEST_ON_RAY( first );
+ earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
+ distLeft = tmin;
+ }
if (!earlyHit) // 2. Early-out test: if the node aabb is outside the four planes, we skip the node
{
float* minmax = (float*)left;
- bvhvec3 p0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
- bvhvec3 p1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
- bvhvec3 p2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
- bvhvec3 p3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
- if (dot( p0, plane0 ) > d0 || dot( p1, plane1 ) > d1 || dot( p2, plane2 ) > d2 || dot( p3, plane3 ) > d3)
+ bvhvec3 c0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
+ bvhvec3 c1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
+ bvhvec3 c2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
+ bvhvec3 c3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
+ if (tinybvh_dot( c0, plane0 ) > d0 || tinybvh_dot( c1, plane1 ) > d1 ||
+ tinybvh_dot( c2, plane2 ) > d2 || tinybvh_dot( c3, plane3 ) > d3)
visitLeft = false;
else // 3. Last resort: update first and last, stay in node if first > last
{
@@ -2254,17 +2457,21 @@ void BVH::Intersect256Rays( Ray* packet ) const
const bvhvec3 o1( right->aabbMin.x - O.x, right->aabbMin.y - O.y, right->aabbMin.z - O.z );
const bvhvec3 o2( right->aabbMax.x - O.x, right->aabbMax.y - O.y, right->aabbMax.z - O.z );
// 1. Early-in test: if first ray hits the node, the packet visits the node
- CALC_TMIN_TMAX_WITH_SLABTEST_ON_RAY( first );
- const bool earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
- distRight = tmin;
+ bool earlyHit;
+ {
+ CALC_TMIN_TMAX_WITH_SLABTEST_ON_RAY( first );
+ earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
+ distRight = tmin;
+ }
if (!earlyHit) // 2. Early-out test: if the node aabb is outside the four planes, we skip the node
{
float* minmax = (float*)right;
- bvhvec3 p0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
- bvhvec3 p1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
- bvhvec3 p2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
- bvhvec3 p3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
- if (dot( p0, plane0 ) > d0 || dot( p1, plane1 ) > d1 || dot( p2, plane2 ) > d2 || dot( p3, plane3 ) > d3)
+ bvhvec3 c0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
+ bvhvec3 c1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
+ bvhvec3 c2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
+ bvhvec3 c3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
+ if (tinybvh_dot( c0, plane0 ) > d0 || tinybvh_dot( c1, plane1 ) > d1 ||
+ tinybvh_dot( c2, plane2 ) > d2 || tinybvh_dot( c3, plane3 ) > d3)
visitRight = false;
else // 3. Last resort: update first and last, stay in node if first > last
{
@@ -2371,7 +2578,7 @@ void BVH_Verbose::ConvertFrom( const BVH& original, bool /* unused here */ )
CopyBasePropertiesFrom( original );
this->verts = original.verts;
this->fragment = original.fragment;
- this->triIdx = original.triIdx;
+ this->primIdx = original.primIdx;
bvhNode[0].parent = 0xffffffff; // root sentinel
// convert
uint32_t nodeIdx = 0, parent = 0xffffffff, stack[128], stackPtr = 0;
@@ -2424,15 +2631,15 @@ void BVH_Verbose::Refit( const uint32_t nodeIdx )
BVHNode& node = bvhNode[nodeIdx];
if (node.isLeaf()) // leaf: adjust to current triangle vertex positions
{
- bvhvec4 aabbMin( BVH_FAR ), aabbMax( -BVH_FAR );
+ bvhvec4 bmin( BVH_FAR ), bmax( -BVH_FAR );
for (uint32_t first = node.firstTri, j = 0; j < node.triCount; j++)
{
- const uint32_t vertIdx = triIdx[first + j] * 3;
- aabbMin = tinybvh_min( aabbMin, verts[vertIdx] ), aabbMax = tinybvh_max( aabbMax, verts[vertIdx] );
- aabbMin = tinybvh_min( aabbMin, verts[vertIdx + 1] ), aabbMax = tinybvh_max( aabbMax, verts[vertIdx + 1] );
- aabbMin = tinybvh_min( aabbMin, verts[vertIdx + 2] ), aabbMax = tinybvh_max( aabbMax, verts[vertIdx + 2] );
+ const uint32_t vertIdx = primIdx[first + j] * 3;
+ bmin = tinybvh_min( bmin, verts[vertIdx] ), bmax = tinybvh_max( bmax, verts[vertIdx] );
+ bmin = tinybvh_min( bmin, verts[vertIdx + 1] ), bmax = tinybvh_max( bmax, verts[vertIdx + 1] );
+ bmin = tinybvh_min( bmin, verts[vertIdx + 2] ), bmax = tinybvh_max( bmax, verts[vertIdx + 2] );
}
- node.aabbMin = aabbMin, node.aabbMax = aabbMax;
+ node.aabbMin = bmin, node.aabbMax = bmax;
}
else
{
@@ -2525,11 +2732,11 @@ void BVH_Verbose::SplitLeafs( const uint32_t maxPrims )
node.left = newIdx1, node.right = newIdx2, node.triCount = 0;
new1.aabbMin = new2.aabbMin = BVH_FAR, new1.aabbMax = new2.aabbMax = -BVH_FAR;
for (uint32_t fi, i = 0; i < new1.triCount; i++)
- fi = triIdx[new1.firstTri + i],
+ fi = primIdx[new1.firstTri + i],
new1.aabbMin = tinybvh_min( new1.aabbMin, fragment[fi].bmin ),
new1.aabbMax = tinybvh_max( new1.aabbMax, fragment[fi].bmax );
for (uint32_t fi, i = 0; i < new2.triCount; i++)
- fi = triIdx[new2.firstTri + i],
+ fi = primIdx[new2.firstTri + i],
new2.aabbMin = tinybvh_min( new2.aabbMin, fragment[fi].bmin ),
new2.aabbMax = tinybvh_max( new2.aabbMax, fragment[fi].bmax );
// recurse
@@ -2591,8 +2798,8 @@ void BVH_Verbose::MergeLeafs()
}
// cleanup
AlignedFree( subtreeTriCount );
- AlignedFree( triIdx );
- triIdx = newIdx, may_have_holes = true; // all over the place, in fact
+ AlignedFree( primIdx );
+ primIdx = newIdx, may_have_holes = true; // all over the place, in fact
}
// BVH_GPU implementation
@@ -2714,7 +2921,7 @@ int32_t BVH_GPU::Intersect( Ray& ray ) const
{
BVHNode* node = &bvhNode[0], * stack[64];
const bvhvec4slice& verts = bvh.verts;
- const uint32_t* triIdx = bvh.triIdx;
+ const uint32_t* primIdx = bvh.primIdx;
uint32_t stackPtr = 0, cost = 0;
while (1)
{
@@ -2722,11 +2929,11 @@ int32_t BVH_GPU::Intersect( Ray& ray ) const
if (node->isLeaf())
{
if (indexedEnabled && bvh.vertIdx != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTriIndexed( ray, verts, bvh.vertIdx, triIdx[node->firstTri + i] );
+ IntersectTriIndexed( ray, verts, bvh.vertIdx, primIdx[node->firstTri + i] );
else if (customEnabled && bvh.customIntersect != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- (*bvh.customIntersect)(ray, triIdx[node->firstTri + i]);
+ (*bvh.customIntersect)(ray, primIdx[node->firstTri + i]);
else for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTri( ray, verts, triIdx[node->firstTri + i] );
+ IntersectTri( ray, verts, primIdx[node->firstTri + i] );
if (stackPtr == 0) break; else node = stack[--stackPtr];
continue;
}
@@ -2946,7 +3153,7 @@ template void MBVH::Refit( const uint32_t nodeIdx )
{
for (uint32_t first = node.firstTri, j = 0; j < node.triCount; j++)
{
- const uint32_t vidx = bvh.triIdx[first + j] * 3;
+ const uint32_t vidx = bvh.primIdx[first + j] * 3;
const uint32_t i0 = bvh.vertIdx[vidx], i1 = bvh.vertIdx[vidx + 1], i2 = bvh.vertIdx[vidx + 2];
const bvhvec3 v0 = bvh.verts[i0], v1 = bvh.verts[i1], v2 = bvh.verts[i2];
aabbMin = tinybvh_min( aabbMin, tinybvh_min( tinybvh_min( v0, v1 ), v2 ) );
@@ -2957,7 +3164,7 @@ template void MBVH::Refit( const uint32_t nodeIdx )
{
for (uint32_t first = node.firstTri, j = 0; j < node.triCount; j++)
{
- const uint32_t vidx = bvh.triIdx[first + j] * 3;
+ const uint32_t vidx = bvh.primIdx[first + j] * 3;
const bvhvec3 v0 = bvh.verts[vidx], v1 = bvh.verts[vidx + 1], v2 = bvh.verts[vidx + 2];
aabbMin = tinybvh_min( aabbMin, tinybvh_min( tinybvh_min( v0, v1 ), v2 ) );
aabbMax = tinybvh_max( aabbMax, tinybvh_max( tinybvh_max( v0, v1 ), v2 ) );
@@ -2987,7 +3194,8 @@ template void MBVH::ConvertFrom( const BVH& original, bool compact )
bvh = original;
// allocate space
uint32_t spaceNeeded = compact ? original.usedNodes : original.allocatedNodes;
- if (M == 8) spaceNeeded += original.usedNodes >> 1; // cwbvh / SplitLeafs
+ constexpr bool M8 = M == 8;
+ if (M8) spaceNeeded += original.usedNodes >> 1; // cwbvh / SplitLeafs
if (allocatedNodes < spaceNeeded)
{
AlignedFree( mbvhNode );
@@ -3059,7 +3267,7 @@ template void MBVH::ConvertFrom( const BVH& original, bool compact )
// busy leafs recursively in multiple leaves, until the requirement is met.
template void MBVH::SplitBVHLeaf( const uint32_t nodeIdx, const uint32_t maxPrims )
{
- const uint32_t* triIdx = bvh.triIdx;
+ const uint32_t* primIdx = bvh.primIdx;
const Fragment* fragment = bvh.fragment;
MBVHNode& node = mbvhNode[nodeIdx];
if (node.triCount <= maxPrims) return; // also catches interior nodes
@@ -3083,7 +3291,7 @@ template void MBVH::SplitBVHLeaf( const uint32_t nodeIdx, const uint32
{
// TODO: why is this producing wrong aabbs for SBVH?
child.aabbMin = bvhvec3( BVH_FAR ), child.aabbMax = bvhvec3( -BVH_FAR );
- for (uint32_t fi, j = 0; j < child.triCount; j++) fi = triIdx[child.firstTri + j],
+ for (uint32_t fi, j = 0; j < child.triCount; j++) fi = primIdx[child.firstTri + j],
child.aabbMin = tinybvh_min( child.aabbMin, fragment[fi].bmin ),
child.aabbMax = tinybvh_max( child.aabbMax, fragment[fi].bmax );
}
@@ -3229,7 +3437,7 @@ void BVH4_CPU::ConvertFrom( const MBVH<4>& original, bool compact )
// assign vertex data
for (uint32_t j = 0; j < count; j++)
{
- uint32_t fi = bvh4.bvh.triIdx[first + j];
+ uint32_t fi = bvh4.bvh.primIdx[first + j];
PrecomputeTriangle( bvh4.bvh.verts, fi * 3, (float*)&bvh4Tris[triPtr] );
bvh4Tris[triPtr + 3] = bvhvec4( 0, 0, 0, *(float*)&fi );
triPtr += 4;
@@ -3353,7 +3561,7 @@ void BVH4_GPU::ConvertFrom( const MBVH<4>& original, bool compact )
childInfo[i] |= 0x80000000;
for (uint32_t j = 0; j < childNode[i]->triCount; j++)
{
- uint32_t t = bvh4.bvh.triIdx[childNode[i]->firstTri + j];
+ uint32_t t = bvh4.bvh.primIdx[childNode[i]->firstTri + j];
#ifdef BVH4_GPU_COMPRESSED_TRIS
PrecomputeTriangle( verts, t * 3, (float*)&bvh4Alt[newAlt4Ptr] );
bvh4Alt[newAlt4Ptr + 3] = bvhvec4( 0, 0, 0, *(float*)&t );
@@ -3512,17 +3720,17 @@ int32_t BVH4_GPU::Intersect( Ray& ray ) const
const bvhvec3 edge2 = bvhvec3( bvh4Data[triStart + 2] );
const bvhvec3 edge1 = bvhvec3( bvh4Data[triStart + 1] );
const bvhvec3 v0 = bvh4Data[triStart + 0];
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) continue;
const float f = 1 / a;
const bvhvec3 s = ray.O - v0;
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const float d = f * dot( edge2, q );
+ const float d = f * tinybvh_dot( edge2, q );
if (d <= 0.0f || d >= ray.hit.t /* i.e., t */) continue;
ray.hit.t = d, ray.hit.u = u, ray.hit.v = v;
ray.hit.prim = as_uint( bvh4Data[triStart + 0].w );
@@ -3689,7 +3897,7 @@ void BVH8_CWBVH::ConvertFrom( MBVH<8>& original, bool )
MBVH<8>::MBVHNode* const child = &bvh8.mbvhNode[orig->child[i]];
if (child->triCount > 3 /* must be leaf */) bvh8.SplitBVHLeaf( orig->child[i], 3 );
bvhvec3 childCentroid = (child->aabbMin + child->aabbMax) * 0.5f;
- cost[s][i] = dot( childCentroid - nodeCentroid, ds );
+ cost[s][i] = tinybvh_dot( childCentroid - nodeCentroid, ds );
}
}
while (1)
@@ -3753,7 +3961,7 @@ void BVH8_CWBVH::ConvertFrom( MBVH<8>& original, bool )
leafChildTriCount += tcount;
for (uint32_t j = 0; j < tcount; j++)
{
- int32_t primitiveIndex = bvh8.bvh.triIdx[child->firstTri + j];
+ int32_t primitiveIndex = bvh8.bvh.primIdx[child->firstTri + j];
#ifdef CWBVH_COMPRESSED_TRIS
PrecomputeTriangle( verts, +primitiveIndex * 3, (float*)&bvh8Tris[triDataPtr] );
bvh8Tris[triDataPtr + 3] = bvhvec4( 0, 0, 0, *(float*)&primitiveIndex );
@@ -3859,9 +4067,9 @@ void BVH::PrepareAVXBuild( const bvhvec4slice& vertices, const uint32_t* indices
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
- triIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
+ primIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
memset( &bvhNode[1], 0, 32 ); // avoid crash in refit.
@@ -3891,7 +4099,7 @@ void BVH::PrepareAVXBuild( const bvhvec4slice& vertices, const uint32_t* indices
const __m128 t1 = _mm_min_ps( _mm_min_ps( v0, v1 ), v2 );
const __m128 t2 = _mm_max_ps( _mm_max_ps( v0, v1 ), v2 );
frag4[i].bmin4 = t1, frag4[i].bmax4 = t2, rootMin = _mm_min_ps( rootMin, t1 ), rootMax = _mm_max_ps( rootMax, t2 );
- triIdx[i] = i;
+ primIdx[i] = i;
}
}
else
@@ -3905,7 +4113,7 @@ void BVH::PrepareAVXBuild( const bvhvec4slice& vertices, const uint32_t* indices
const __m128 t1 = _mm_min_ps( _mm_min_ps( v0, v1 ), v2 );
const __m128 t2 = _mm_max_ps( _mm_max_ps( v0, v1 ), v2 );
frag4[i].bmin4 = t1, frag4[i].bmax4 = t2, rootMin = _mm_min_ps( rootMin, t1 ), rootMax = _mm_max_ps( rootMax, t2 );
- triIdx[i] = i;
+ primIdx[i] = i;
}
}
root.aabbMin = *(bvhvec3*)&rootMin, root.aabbMax = *(bvhvec3*)&rootMax;
@@ -3945,14 +4153,14 @@ void BVH::BuildAVX()
const __m128 rpd4 = _mm_and_ps( _mm_div_ps( binmul3, d4 ), _mm_cmpneq_ps( d4, _mm_setzero_ps() ) );
// implementation of Section 4.1 of "Parallel Spatial Splits in Bounding Volume Hierarchies":
// main loop operates on two fragments to minimize dependencies and maximize ILP.
- uint32_t fi = triIdx[node.leftFirst];
+ uint32_t fi = primIdx[node.leftFirst];
memset( count, 0, sizeof( count ) );
__m256 r0, r1, r2, f = _mm256_xor_ps( _mm256_and_ps( frag8[fi], mask6 ), signFlip8 );
const __m128 fmin = _mm_and_ps( frag4[fi].bmin4, mask3 ), fmax = _mm_and_ps( frag4[fi].bmax4, mask3 );
const __m128i bi4 = _mm_cvtps_epi32( _mm_sub_ps( _mm_mul_ps( _mm_sub_ps( _mm_add_ps( fmax, fmin ), nmin4 ), rpd4 ), half4 ) );
const __m128i b4c = _mm_max_epi32( _mm_min_epi32( bi4, maxbin4 ), _mm_setzero_si128() ); // clamp needed after all
memcpy( binbox, binboxOrig, sizeof( binbox ) );
- uint32_t i0 = ILANE( b4c, 0 ), i1 = ILANE( b4c, 1 ), i2 = ILANE( b4c, 2 ), * ti = triIdx + node.leftFirst + 1;
+ uint32_t i0 = ILANE( b4c, 0 ), i1 = ILANE( b4c, 1 ), i2 = ILANE( b4c, 2 ), * ti = primIdx + node.leftFirst + 1;
for (uint32_t i = 0; i < node.triCount - 1; i++)
{
uint32_t fid = *ti++;
@@ -3960,14 +4168,14 @@ void BVH::BuildAVX()
if (fid > triCount) fid = triCount - 1; // never happens but g++ *and* vs2017 need this to not crash...
#endif
const __m256 b0 = binbox[i0], b1 = binbox[AVXBINS + i1], b2 = binbox[2 * AVXBINS + i2];
- const __m128 fmin = _mm_and_ps( frag4[fid].bmin4, mask3 ), fmax = _mm_and_ps( frag4[fid].bmax4, mask3 );
+ const __m128 frmin = _mm_and_ps( frag4[fid].bmin4, mask3 ), frmax = _mm_and_ps( frag4[fid].bmax4, mask3 );
r0 = _mm256_max_ps( b0, f ), r1 = _mm256_max_ps( b1, f ), r2 = _mm256_max_ps( b2, f );
- const __m128i bi4 = _mm_cvtps_epi32( _mm_sub_ps( _mm_mul_ps( _mm_sub_ps( _mm_add_ps( fmax, fmin ), nmin4 ), rpd4 ), half4 ) );
- const __m128i b4c = _mm_max_epi32( _mm_min_epi32( bi4, maxbin4 ), _mm_setzero_si128() ); // clamp needed after all
+ const __m128i b4 = _mm_cvtps_epi32( _mm_sub_ps( _mm_mul_ps( _mm_sub_ps( _mm_add_ps( frmax, frmin ), nmin4 ), rpd4 ), half4 ) );
+ const __m128i bc4 = _mm_max_epi32( _mm_min_epi32( b4, maxbin4 ), _mm_setzero_si128() ); // clamp needed after all
f = _mm256_xor_ps( _mm256_and_ps( frag8[fid], mask6 ), signFlip8 ), count[0][i0]++, count[1][i1]++, count[2][i2]++;
- binbox[i0] = r0, i0 = ILANE( b4c, 0 );
- binbox[AVXBINS + i1] = r1, i1 = ILANE( b4c, 1 );
- binbox[2 * AVXBINS + i2] = r2, i2 = ILANE( b4c, 2 );
+ binbox[i0] = r0, i0 = ILANE( bc4, 0 );
+ binbox[AVXBINS + i1] = r1, i1 = ILANE( bc4, 1 );
+ binbox[2 * AVXBINS + i2] = r2, i2 = ILANE( bc4, 2 );
}
// final business for final fragment
const __m256 b0 = binbox[i0], b1 = binbox[AVXBINS + i1], b2 = binbox[2 * AVXBINS + i2];
@@ -4006,11 +4214,11 @@ void BVH::BuildAVX()
if (splitCost >= noSplitCost) break; // not splitting is better.
// in-place partition
const float rpd = (*(bvhvec3*)&rpd4)[bestAxis], nmin = (*(bvhvec3*)&nmin4)[bestAxis];
- uint32_t t, fr = triIdx[src];
+ uint32_t t, fr = primIdx[src];
for (uint32_t i = 0; i < node.triCount; i++)
{
const uint32_t bi = (uint32_t)((fragment[fr].bmax[bestAxis] + fragment[fr].bmin[bestAxis] - nmin) * rpd);
- if (bi <= bestPos) fr = triIdx[++src]; else t = fr, fr = triIdx[src] = triIdx[--j], triIdx[j] = t;
+ if (bi <= bestPos) fr = primIdx[++src]; else t = fr, fr = primIdx[src] = primIdx[--j], primIdx[j] = t;
}
// create child nodes and recurse
const uint32_t leftCount = src - node.leftFirst, rightCount = node.triCount - leftCount;
@@ -4052,16 +4260,16 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
bvhvec3 p1 = packet[51].O + packet[51].D; // top-right
bvhvec3 p2 = packet[204].O + packet[204].D; // bottom-left
bvhvec3 p3 = packet[255].O + packet[255].D; // bottom-right
- bvhvec3 plane0 = normalize( cross( p0 - O, p0 - p2 ) ); // left plane
- bvhvec3 plane1 = normalize( cross( p3 - O, p3 - p1 ) ); // right plane
- bvhvec3 plane2 = normalize( cross( p1 - O, p1 - p0 ) ); // top plane
- bvhvec3 plane3 = normalize( cross( p2 - O, p2 - p3 ) ); // bottom plane
+ bvhvec3 plane0 = tinybvh_normalize( tinybvh_cross( p0 - O, p0 - p2 ) ); // left plane
+ bvhvec3 plane1 = tinybvh_normalize( tinybvh_cross( p3 - O, p3 - p1 ) ); // right plane
+ bvhvec3 plane2 = tinybvh_normalize( tinybvh_cross( p1 - O, p1 - p0 ) ); // top plane
+ bvhvec3 plane3 = tinybvh_normalize( tinybvh_cross( p2 - O, p2 - p3 ) ); // bottom plane
int32_t sign0x = plane0.x < 0 ? 4 : 0, sign0y = plane0.y < 0 ? 5 : 1, sign0z = plane0.z < 0 ? 6 : 2;
int32_t sign1x = plane1.x < 0 ? 4 : 0, sign1y = plane1.y < 0 ? 5 : 1, sign1z = plane1.z < 0 ? 6 : 2;
int32_t sign2x = plane2.x < 0 ? 4 : 0, sign2y = plane2.y < 0 ? 5 : 1, sign2z = plane2.z < 0 ? 6 : 2;
int32_t sign3x = plane3.x < 0 ? 4 : 0, sign3y = plane3.y < 0 ? 5 : 1, sign3z = plane3.z < 0 ? 6 : 2;
- float t0 = dot( O, plane0 ), t1 = dot( O, plane1 );
- float t2 = dot( O, plane2 ), t3 = dot( O, plane3 );
+ float t0 = tinybvh_dot( O, plane0 ), t1 = tinybvh_dot( O, plane1 );
+ float t2 = tinybvh_dot( O, plane2 ), t3 = tinybvh_dot( O, plane3 );
// Traverse the tree with the packet
int32_t first = 0, last = 255; // first and last active ray in the packet
BVHNode* node = &bvhNode[0];
@@ -4073,21 +4281,21 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
// handle leaf node
for (uint32_t j = 0; j < node->triCount; j++)
{
- const uint32_t idx = triIdx[node->leftFirst + j], vid = idx * 3;
+ const uint32_t idx = primIdx[node->leftFirst + j], vid = idx * 3;
const bvhvec3 edge1 = verts[vid + 1] - verts[vid], edge2 = verts[vid + 2] - verts[vid];
const bvhvec3 s = O - bvhvec3( verts[vid] );
for (int32_t i = first; i <= last; i++)
{
Ray& ray = packet[i];
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) continue; // ray parallel to triangle
- const float f = 1 / a, u = f * dot( s, h );
+ const float f = 1 / a, u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
if (t <= 0 || t >= ray.hit.t) continue;
ray.hit.t = t, ray.hit.u = u, ray.hit.v = v, ray.hit.prim = idx;
}
@@ -4109,23 +4317,27 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
const __m128 minO4 = _mm_sub_ps( *(__m128*) & left->aabbMin, O4 );
const __m128 maxO4 = _mm_sub_ps( *(__m128*) & left->aabbMax, O4 );
// 1. Early-in test: if first ray hits the node, the packet visits the node
- const __m128 rD4 = *(__m128*) & packet[first].rD;
- const __m128 st1 = _mm_mul_ps( _mm_and_ps( minO4, mask4 ), rD4 );
- const __m128 st2 = _mm_mul_ps( _mm_and_ps( maxO4, mask4 ), rD4 );
- const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
- const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
- const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
- const bool earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
- distLeft = tmin;
+ bool earlyHit;
+ {
+ const __m128 rD4 = *(__m128*) & packet[first].rD;
+ const __m128 st1 = _mm_mul_ps( _mm_and_ps( minO4, mask4 ), rD4 );
+ const __m128 st2 = _mm_mul_ps( _mm_and_ps( maxO4, mask4 ), rD4 );
+ const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
+ const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
+ const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
+ earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
+ distLeft = tmin;
+ }
// 2. Early-out test: if the node aabb is outside the four planes, we skip the node
if (!earlyHit)
{
float* minmax = (float*)left;
- bvhvec3 p0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
- bvhvec3 p1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
- bvhvec3 p2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
- bvhvec3 p3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
- if (dot( p0, plane0 ) > t0 || dot( p1, plane1 ) > t1 || dot( p2, plane2 ) > t2 || dot( p3, plane3 ) > t3)
+ bvhvec3 c0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
+ bvhvec3 c1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
+ bvhvec3 c2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
+ bvhvec3 c3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
+ if (tinybvh_dot( c0, plane0 ) > t0 || tinybvh_dot( c1, plane1 ) > t1 ||
+ tinybvh_dot( c2, plane2 ) > t2 || tinybvh_dot( c3, plane3 ) > t3)
visitLeft = false;
else
{
@@ -4159,22 +4371,26 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
const __m128 minO4 = _mm_sub_ps( *(__m128*) & right->aabbMin, O4 );
const __m128 maxO4 = _mm_sub_ps( *(__m128*) & right->aabbMax, O4 );
// 1. Early-in test: if first ray hits the node, the packet visits the node
- const __m128 rD4 = *(__m128*) & packet[first].rD;
- const __m128 st1 = _mm_mul_ps( minO4, rD4 ), st2 = _mm_mul_ps( maxO4, rD4 );
- const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
- const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
- const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
- const bool earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
- distRight = tmin;
+ bool earlyHit;
+ {
+ const __m128 rD4 = *(__m128*) & packet[first].rD;
+ const __m128 st1 = _mm_mul_ps( minO4, rD4 ), st2 = _mm_mul_ps( maxO4, rD4 );
+ const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
+ const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
+ const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
+ earlyHit = (tmax >= tmin && tmin < packet[first].hit.t && tmax >= 0);
+ distRight = tmin;
+ }
// 2. Early-out test: if the node aabb is outside the four planes, we skip the node
if (!earlyHit)
{
float* minmax = (float*)right;
- bvhvec3 p0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
- bvhvec3 p1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
- bvhvec3 p2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
- bvhvec3 p3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
- if (dot( p0, plane0 ) > t0 || dot( p1, plane1 ) > t1 || dot( p2, plane2 ) > t2 || dot( p3, plane3 ) > t3)
+ bvhvec3 c0( minmax[sign0x], minmax[sign0y], minmax[sign0z] );
+ bvhvec3 c1( minmax[sign1x], minmax[sign1y], minmax[sign1z] );
+ bvhvec3 c2( minmax[sign2x], minmax[sign2y], minmax[sign2z] );
+ bvhvec3 c3( minmax[sign3x], minmax[sign3y], minmax[sign3z] );
+ if (tinybvh_dot( c0, plane0 ) > t0 || tinybvh_dot( c1, plane1 ) > t1 ||
+ tinybvh_dot( c2, plane2 ) > t2 || tinybvh_dot( c3, plane3 ) > t3)
visitRight = false;
else
{
@@ -4185,9 +4401,9 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
const __m128 st1 = _mm_mul_ps( _mm_and_ps( minO4, mask4 ), rD4 );
const __m128 st2 = _mm_mul_ps( _mm_and_ps( maxO4, mask4 ), rD4 );
const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
- const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
- const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
- if (tmax >= tmin && tmin < packet[rightFirst].hit.t && tmax >= 0) { distRight = tmin; break; }
+ const float tmax1 = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
+ const float tmin1 = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
+ if (tmax1 >= tmin1 && tmin1 < packet[rightFirst].hit.t && tmax1 >= 0) { distRight = tmin1; break; }
}
for (; rightLast >= first; rightLast--)
{
@@ -4195,9 +4411,9 @@ void BVH::Intersect256RaysSSE( Ray* packet ) const
const __m128 st1 = _mm_mul_ps( _mm_and_ps( minO4, mask4 ), rD4 );
const __m128 st2 = _mm_mul_ps( _mm_and_ps( maxO4, mask4 ), rD4 );
const __m128 vmax4 = _mm_max_ps( st1, st2 ), vmin4 = _mm_min_ps( st1, st2 );
- const float tmax = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
- const float tmin = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
- if (tmax >= tmin && tmin < packet[rightLast].hit.t && tmax >= 0) break;
+ const float tmax1 = tinybvh_min( LANE( vmax4, 0 ), tinybvh_min( LANE( vmax4, 1 ), LANE( vmax4, 2 ) ) );
+ const float tmin1 = tinybvh_max( LANE( vmin4, 0 ), tinybvh_max( LANE( vmin4, 1 ), LANE( vmin4, 2 ) ) );
+ if (tmax1 >= tmin1 && tmin1 < packet[rightLast].hit.t && tmax1 >= 0) break;
}
visitRight = rightLast >= rightFirst;
}
@@ -4237,7 +4453,7 @@ int32_t BVH_SoA::Intersect( Ray& ray ) const
{
BVHNode* node = &bvhNode[0], * stack[64];
const bvhvec4slice& verts = bvh.verts;
- const uint32_t* triIdx = bvh.triIdx;
+ const uint32_t* primIdx = bvh.primIdx;
uint32_t stackPtr = 0, cost = 0;
const __m128 Ox4 = _mm_set1_ps( ray.O.x ), rDx4 = _mm_set1_ps( ray.rD.x );
const __m128 Oy4 = _mm_set1_ps( ray.O.y ), rDy4 = _mm_set1_ps( ray.rD.y );
@@ -4248,11 +4464,11 @@ int32_t BVH_SoA::Intersect( Ray& ray ) const
if (node->isLeaf())
{
if (indexedEnabled && bvh.vertIdx != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTriIndexed( ray, verts, bvh.vertIdx, triIdx[node->firstTri + i] );
+ IntersectTriIndexed( ray, verts, bvh.vertIdx, primIdx[node->firstTri + i] );
else if (customEnabled && bvh.customIntersect != 0) for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- (*bvh.customIntersect)(ray, triIdx[node->firstTri + i]);
+ (*bvh.customIntersect)(ray, primIdx[node->firstTri + i]);
else for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- IntersectTri( ray, verts, triIdx[node->firstTri + i] );
+ IntersectTri( ray, verts, primIdx[node->firstTri + i] );
if (stackPtr == 0) break; else node = stack[--stackPtr];
continue;
}
@@ -4315,7 +4531,7 @@ bool BVH_SoA::IsOccluded( const Ray& ray ) const
{
BVHNode* node = &bvhNode[0], * stack[64];
const bvhvec4slice& verts = bvh.verts;
- const uint32_t* triIdx = bvh.triIdx;
+ const uint32_t* primIdx = bvh.primIdx;
uint32_t stackPtr = 0;
const __m128 Ox4 = _mm_set1_ps( ray.O.x ), rDx4 = _mm_set1_ps( ray.rD.x );
const __m128 Oy4 = _mm_set1_ps( ray.O.y ), rDy4 = _mm_set1_ps( ray.rD.y );
@@ -4327,17 +4543,17 @@ bool BVH_SoA::IsOccluded( const Ray& ray ) const
if (indexedEnabled && bvh.vertIdx != 0)
{
for (uint32_t i = 0; i < node->triCount; i++)
- if (IndexedTriOccludes( ray, verts, bvh.vertIdx, triIdx[node->firstTri + i] )) return true;
+ if (IndexedTriOccludes( ray, verts, bvh.vertIdx, primIdx[node->firstTri + i] )) return true;
}
else if (customEnabled && bvh.customIsOccluded != 0)
{
for (uint32_t i = 0; i < node->triCount; i++)
- if ((*bvh.customIsOccluded)(ray, triIdx[node->firstTri + i])) return true;
+ if ((*bvh.customIsOccluded)(ray, primIdx[node->firstTri + i])) return true;
}
else
{
for (uint32_t i = 0; i < node->triCount; i++)
- if (TriOccludes( ray, verts, triIdx[node->firstTri + i] )) return true;
+ if (TriOccludes( ray, verts, primIdx[node->firstTri + i] )) return true;
}
if (stackPtr == 0) break; else node = stack[--stackPtr];
continue;
@@ -4532,24 +4748,24 @@ int32_t BVH8_CWBVH::Intersect( Ray& ray ) const
const bvhvec3 edge2 = bvhvec3( blasTris[triAddr + 0] );
const bvhvec3 edge1 = bvhvec3( blasTris[triAddr + 1] );
const bvhvec3 v0 = blasTris[triAddr + 2];
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) > 0.0000001f)
{
const float f = 1 / a;
const bvhvec3 s = ray.O - v0;
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u >= 0 && u <= 1)
{
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v >= 0 && u + v <= 1)
{
- const float d = f * dot( edge2, q );
+ const float d = f * tinybvh_dot( edge2, q );
if (d > 0.0f && d < tmax)
{
triangleuv = bvhvec2( u, v ), tmax = d;
- hitAddr = as_uint( blasTris[triAddr].w );
+ hitAddr = as_uint( blasTris[triAddr + 2].w );
}
}
}
@@ -4584,7 +4800,11 @@ inline void IntersectCompactTri( Ray& r, __m128& t4, const float* T )
const float u = T[0] * wr.x + T[1] * wr.y + T[2] * wr.z + T[3];
const float v = T[4] * wr.x + T[5] * wr.y + T[6] * wr.z + T[7];
const bool hit = u >= 0 && v >= 0 && u + v < 1;
+#if INST_IDX_BITS == 32
+ if (hit) r.hit = { 0, ta, u, v, *(uint32_t*)&T[15] }, t4 = _mm_set1_ps( ta );
+#else
if (hit) r.hit = { ta, u, v, *(uint32_t*)&T[15] }, t4 = _mm_set1_ps( ta );
+#endif
}
int32_t BVH4_CPU::Intersect( Ray& ray ) const
{
@@ -4910,228 +5130,12 @@ bool BVH4_CPU::IsOccluded( const Ray& ray ) const
#ifdef BVH_USENEON
-#define ILANE(a,b) vgetq_lane_s32(a, b)
-
-inline float32x4x2_t vmaxq_f32x2( float32x4x2_t a, float32x4x2_t b )
-{
- float32x4x2_t ret;
- ret.val[0] = vmaxq_f32( a.val[0], b.val[0] );
- ret.val[1] = vmaxq_f32( a.val[1], b.val[1] );
- return ret;
-}
-inline float halfArea( const float32x4_t a /* a contains extent of aabb */ )
-{
- ALIGNED( 64 ) float v[4];
- vst1q_f32( v, a );
- return v[0] * v[1] + v[1] * v[2] + v[2] * v[3];
-}
-inline float halfArea( const float32x4x2_t& a /* a contains aabb itself, with min.xyz negated */ )
-{
- ALIGNED( 64 ) float c[8];
- vst1q_f32( c, a.val[0] );
- vst1q_f32( c + 4, a.val[1] );
-
- float ex = c[4] + c[0], ey = c[5] + c[1], ez = c[6] + c[2];
- return ex * ey + ey * ez + ez * ex;
-}
-
-#if defined(__ARM_FEATURE_NEON) && defined(__ARM_NEON) && __ARM_ARCH >= 85
-// Use the native vrnd32xq_f32 if NEON 8.5 is available
-#else
-// Custom implementation of vrnd32xq_f32
-static inline int32x4_t vrnd32xq_f32( float32x4_t a ) {
- const float32x4_t half = vdupq_n_f32( 0.5f );
- uint32x4_t isNegative = vcltq_f32( a, vdupq_n_f32( 0.0f ) ); // Mask for negative numbers
- float32x4_t adjustment = vbslq_f32( isNegative, vnegq_f32( half ), half );
- return vcvtq_s32_f32( vaddq_f32( a, adjustment ) );
-}
-#endif
-
-#define PROCESS_PLANE( a, pos, ANLR, lN, rN, lb, rb ) if (lN * rN != 0) { \
- ANLR = halfArea( lb ) * (float)lN + halfArea( rb ) * (float)rN; \
- const float C = C_TRAV + C_INT * rSAV * ANLR; if (C < splitCost) \
- splitCost = C, bestAxis = a, bestPos = pos, bestLBox = lb, bestRBox = rb; }
-
-void BVH::BuildNEON( const bvhvec4* vertices, const uint32_t primCount )
-{
- // build the BVH with a continuous array of bvhvec4 vertices:
- // in this case, the stride for the slice is 16 bytes.
- BuildNEON( bvhvec4slice{ vertices, primCount * 3, sizeof( bvhvec4 ) } );
-}
-void BVH::BuildNEON( const bvhvec4slice& vertices )
-{
- FATAL_ERROR_IF( vertices.count == 0, "BVH::BuildNEON( .. ), primCount == 0." );
- FATAL_ERROR_IF( vertices.stride & 15, "BVH::BuildNEON( .. ), stride must be multiple of 16." );
- int32_t test = AVXBINS;
- if (test != 8) assert( false ); // AVX builders require AVXBINS == 8.
- // aligned data
- ALIGNED( 64 ) float32x4x2_t binbox[3 * AVXBINS]; // 768 bytes
- ALIGNED( 64 ) float32x4x2_t binboxOrig[3 * AVXBINS]; // 768 bytes
- ALIGNED( 64 ) uint32_t count[3][AVXBINS]{}; // 96 bytes
- ALIGNED( 64 ) float32x4x2_t bestLBox, bestRBox; // 64 bytes
- // some constants
- static const float32x4_t min4 = vdupq_n_f32( BVH_FAR ), max4 = vdupq_n_f32( -BVH_FAR ), half4 = vdupq_n_f32( 0.5f );
- static const float32x4_t two4 = vdupq_n_f32( 2.0f ), min1 = vdupq_n_f32( -1 );
- static const float32x4x2_t max8 = { max4, max4 };
- static const float32x4_t signFlip4 = SIMD_SETRVEC( -0.0f, -0.0f, -0.0f, 0.0f );
- static const float32x4x2_t signFlip8 = { signFlip4, vdupq_n_f32( 0 ) }; // TODO: Check me
- static const float32x4_t mask3 = vceqq_f32( SIMD_SETRVEC( 0, 0, 0, 1 ), vdupq_n_f32( 0 ) );
- static const float32x4_t binmul3 = vdupq_n_f32( AVXBINS * 0.49999f );
- for (uint32_t i = 0; i < 3 * AVXBINS; i++) binboxOrig[i] = max8; // binbox initialization template
- // reset node pool
- const uint32_t primCount = vertices.count / 3;
- const uint32_t spaceNeeded = primCount * 2;
- if (allocatedNodes < spaceNeeded)
- {
- AlignedFree( bvhNode );
- AlignedFree( triIdx );
- AlignedFree( fragment );
- triIdx = (uint32_t*)AlignedAlloc( primCount * sizeof( uint32_t ) );
- bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
- allocatedNodes = spaceNeeded;
- memset( &bvhNode[1], 0, 32 ); // avoid crash in refit.
- fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
- }
- else FATAL_ERROR_IF( !rebuildable, "BVH::BuildNEON( .. ), bvh not rebuildable." );
- verts = vertices; // note: we're not copying this data; don't delete.
- triCount = idxCount = primCount;
- uint32_t newNodePtr = 2;
- struct FragSSE { float32x4_t bmin4, bmax4; };
- FragSSE* frag4 = (FragSSE*)fragment;
- float32x4x2_t* frag8 = (float32x4x2_t*)fragment;
- const float32x4_t* verts4 = (float32x4_t*)vertices.data;
- // assign all triangles to the root node
- BVHNode& root = bvhNode[0];
- root.leftFirst = 0, root.triCount = triCount;
- // initialize fragments and update root bounds
- float32x4_t rootMin = min4, rootMax = max4;
- for (uint32_t i = 0; i < triCount; i++)
- {
- const float32x4_t v1 = vminq_f32( vminq_f32( verts4[i * 3], verts4[i * 3 + 1] ), verts4[i * 3 + 2] );
- const float32x4_t v2 = vmaxq_f32( vmaxq_f32( verts4[i * 3], verts4[i * 3 + 1] ), verts4[i * 3 + 2] );
- frag4[i].bmin4 = v1, frag4[i].bmax4 = v2, rootMin = vminq_f32( rootMin, v1 ), rootMax = vmaxq_f32( rootMax, v2 ), triIdx[i] = i;
- }
- root.aabbMin = *(bvhvec3*)&rootMin, root.aabbMax = *(bvhvec3*)&rootMax;
- // subdivide recursively
- ALIGNED( 64 ) uint32_t task[128], taskCount = 0, nodeIdx = 0;
- const bvhvec3 minDim = (root.aabbMax - root.aabbMin) * 1e-7f;
- while (1)
- {
- while (1)
- {
- BVHNode& node = bvhNode[nodeIdx];
- float32x4_t* node4 = (float32x4_t*)&bvhNode[nodeIdx];
- // find optimal object split
- const float32x4_t d4 = vbslq_f32( vshrq_n_s32( mask3, 31 ), vsubq_f32( node4[1], node4[0] ), min1 );
- const float32x4_t nmin4 = vmulq_f32( vandq_s32( node4[0], mask3 ), two4 );
- const float32x4_t rpd4 = vandq_s32( vdivq_f32( binmul3, d4 ), vmvnq_u32( vceqq_f32( d4, vdupq_n_f32( 0 ) ) ) );
- // implementation of Section 4.1 of "Parallel Spatial Splits in Bounding Volume Hierarchies":
- // main loop operates on two fragments to minimize dependencies and maximize ILP.
- uint32_t fi = triIdx[node.leftFirst];
- memset( count, 0, sizeof( count ) );
- Fragment tmp = fragment[fi];
- tmp.bmin *= -1.0f;
- float32x4x2_t r0, r1, r2, f = *(float32x4x2_t*)&tmp; // TODO: = veorq_s32x2( signFlip8, frag8[fi] );
- int32x4_t bi4 = vcvtq_s32_f32( vrnd32xq_f32( vsubq_f32( vmulq_f32( vsubq_f32( vaddq_f32( frag4[fi].bmax4, frag4[fi].bmin4 ), nmin4 ), rpd4 ), half4 ) ) );
- memcpy( binbox, binboxOrig, sizeof( binbox ) );
- uint32_t i0 = (uint32_t)(tinybvh_clamp( ILANE( bi4, 0 ), 0, 7 ));
- uint32_t i1 = (uint32_t)(tinybvh_clamp( ILANE( bi4, 1 ), 0, 7 ));
- uint32_t i2 = (uint32_t)(tinybvh_clamp( ILANE( bi4, 2 ), 0, 7 ));
- uint32_t* ti = triIdx + node.leftFirst + 1;
- for (uint32_t i = 0; i < node.triCount - 1; i++)
- {
- uint32_t fid = *ti++;
- #if 1
- if (fid > triCount) fid = triCount - 1; // TODO: shouldn't be needed...
- #endif
- const float32x4x2_t b0 = binbox[i0];
- const float32x4x2_t b1 = binbox[AVXBINS + i1];
- const float32x4x2_t b2 = binbox[2 * AVXBINS + i2];
- const float32x4_t fmin = frag4[fid].bmin4, fmax = frag4[fid].bmax4;
- r0 = vmaxq_f32x2( b0, f );
- r1 = vmaxq_f32x2( b1, f );
- r2 = vmaxq_f32x2( b2, f );
- const int32x4_t b4 = vcvtq_s32_f32( vrnd32xq_f32( vsubq_f32( vmulq_f32( vsubq_f32( vaddq_f32( fmax, fmin ), nmin4 ), rpd4 ), half4 ) ) );
- Fragment tmp = fragment[fid];
- tmp.bmin *= -1.0f;
- f = *(float32x4x2_t*)&tmp; // TODO: veorq_s32x2( signFlip8, frag8[fid] )
- count[0][i0]++, count[1][i1]++, count[2][i2]++;
- binbox[i0] = r0, i0 = (uint32_t)(tinybvh_clamp( ILANE( b4, 0 ), 0, 7 ));
- binbox[AVXBINS + i1] = r1, i1 = (uint32_t)(tinybvh_clamp( ILANE( b4, 1 ), 0, 7 ));
- binbox[2 * AVXBINS + i2] = r2, i2 = (uint32_t)(tinybvh_clamp( ILANE( b4, 2 ), 0, 7 ));
- }
- // final business for final fragment
- const float32x4x2_t b0 = binbox[i0], b1 = binbox[AVXBINS + i1], b2 = binbox[2 * AVXBINS + i2];
- count[0][i0]++, count[1][i1]++, count[2][i2]++;
- r0 = vmaxq_f32x2( b0, f );
- r1 = vmaxq_f32x2( b1, f );
- r2 = vmaxq_f32x2( b2, f );
- binbox[i0] = r0, binbox[AVXBINS + i1] = r1, binbox[2 * AVXBINS + i2] = r2;
- // calculate per-split totals
- float splitCost = BVH_FAR, rSAV = 1.0f / node.SurfaceArea();
- uint32_t bestAxis = 0, bestPos = 0, n = newNodePtr, j = node.leftFirst + node.triCount, src = node.leftFirst;
- const float32x4x2_t* bb = binbox;
- for (int32_t a = 0; a < 3; a++, bb += AVXBINS) if ((node.aabbMax[a] - node.aabbMin[a]) > minDim.cell[a])
- {
- // hardcoded bin processing for AVXBINS == 8
- assert( AVXBINS == 8 );
- const uint32_t lN0 = count[a][0], rN0 = count[a][7];
- const float32x4x2_t lb0 = bb[0], rb0 = bb[7];
- const uint32_t lN1 = lN0 + count[a][1], rN1 = rN0 + count[a][6], lN2 = lN1 + count[a][2];
- const uint32_t rN2 = rN1 + count[a][5], lN3 = lN2 + count[a][3], rN3 = rN2 + count[a][4];
- const float32x4x2_t lb1 = vmaxq_f32x2( lb0, bb[1] ), rb1 = vmaxq_f32x2( rb0, bb[6] );
- const float32x4x2_t lb2 = vmaxq_f32x2( lb1, bb[2] ), rb2 = vmaxq_f32x2( rb1, bb[5] );
- const float32x4x2_t lb3 = vmaxq_f32x2( lb2, bb[3] ), rb3 = vmaxq_f32x2( rb2, bb[4] );
- const uint32_t lN4 = lN3 + count[a][4], rN4 = rN3 + count[a][3], lN5 = lN4 + count[a][5];
- const uint32_t rN5 = rN4 + count[a][2], lN6 = lN5 + count[a][6], rN6 = rN5 + count[a][1];
- const float32x4x2_t lb4 = vmaxq_f32x2( lb3, bb[4] ), rb4 = vmaxq_f32x2( rb3, bb[3] );
- const float32x4x2_t lb5 = vmaxq_f32x2( lb4, bb[5] ), rb5 = vmaxq_f32x2( rb4, bb[2] );
- const float32x4x2_t lb6 = vmaxq_f32x2( lb5, bb[6] ), rb6 = vmaxq_f32x2( rb5, bb[1] );
- float ANLR3 = BVH_FAR; PROCESS_PLANE( a, 3, ANLR3, lN3, rN3, lb3, rb3 ); // most likely split
- float ANLR2 = BVH_FAR; PROCESS_PLANE( a, 2, ANLR2, lN2, rN4, lb2, rb4 );
- float ANLR4 = BVH_FAR; PROCESS_PLANE( a, 4, ANLR4, lN4, rN2, lb4, rb2 );
- float ANLR5 = BVH_FAR; PROCESS_PLANE( a, 5, ANLR5, lN5, rN1, lb5, rb1 );
- float ANLR1 = BVH_FAR; PROCESS_PLANE( a, 1, ANLR1, lN1, rN5, lb1, rb5 );
- float ANLR0 = BVH_FAR; PROCESS_PLANE( a, 0, ANLR0, lN0, rN6, lb0, rb6 );
- float ANLR6 = BVH_FAR; PROCESS_PLANE( a, 6, ANLR6, lN6, rN0, lb6, rb0 ); // least likely split
- }
- float noSplitCost = (float)node.triCount * C_INT;
- if (splitCost >= noSplitCost) break; // not splitting is better.
- // in-place partition
- const float rpd = (*(bvhvec3*)&rpd4)[bestAxis], nmin = (*(bvhvec3*)&nmin4)[bestAxis];
- uint32_t t, fr = triIdx[src];
- for (uint32_t i = 0; i < node.triCount; i++)
- {
- const uint32_t bi = (uint32_t)((fragment[fr].bmax[bestAxis] + fragment[fr].bmin[bestAxis] - nmin) * rpd);
- if (bi <= bestPos) fr = triIdx[++src]; else t = fr, fr = triIdx[src] = triIdx[--j], triIdx[j] = t;
- }
- // create child nodes and recurse
- const uint32_t leftCount = src - node.leftFirst, rightCount = node.triCount - leftCount;
- if (leftCount == 0 || rightCount == 0) break; // should not happen.
- (*(float32x4x2_t*)&bvhNode[n]).val[0] = veorq_s32( bestLBox.val[0], signFlip8.val[0] );
- (*(float32x4x2_t*)&bvhNode[n]).val[1] = veorq_s32( bestLBox.val[1], signFlip8.val[1] );
- bvhNode[n].leftFirst = node.leftFirst, bvhNode[n].triCount = leftCount;
- node.leftFirst = n++, node.triCount = 0, newNodePtr += 2;
- (*(float32x4x2_t*)&bvhNode[n]).val[0] = veorq_s32( bestRBox.val[0], signFlip8.val[0] );
- (*(float32x4x2_t*)&bvhNode[n]).val[1] = veorq_s32( bestRBox.val[1], signFlip8.val[1] );
- bvhNode[n].leftFirst = j, bvhNode[n].triCount = rightCount;
- task[taskCount++] = n, nodeIdx = n - 1;
- }
- // fetch subdivision task from stack
- if (taskCount == 0) break; else nodeIdx = task[--taskCount];
- }
- // all done.
- refittable = true; // not using spatial splits: can refit this BVH
- may_have_holes = false; // the NEON builder produces a continuous list of nodes
- usedNodes = newNodePtr;
-}
-
// Traverse the second alternative BVH layout (ALT_SOA).
int32_t BVH_SoA::Intersect( Ray& ray ) const
{
BVHNode* node = &bvhNode[0], * stack[64];
const bvhvec4slice& verts = bvh.verts;
- const uint32_t* triIdx = bvh.triIdx;
+ const uint32_t* primIdx = bvh.primIdx;
uint32_t stackPtr = 0, cost = 0;
const float32x4_t Ox4 = vdupq_n_f32( ray.O.x ), rDx4 = vdupq_n_f32( ray.rD.x );
const float32x4_t Oy4 = vdupq_n_f32( ray.O.y ), rDy4 = vdupq_n_f32( ray.rD.y );
@@ -5144,20 +5148,20 @@ int32_t BVH_SoA::Intersect( Ray& ray ) const
{
for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
{
- const uint32_t tidx = triIdx[node->firstTri + i], vertIdx = tidx * 3;
+ const uint32_t tidx = primIdx[node->firstTri + i], vertIdx = tidx * 3;
const bvhvec3 edge1 = verts[vertIdx + 1] - verts[vertIdx];
const bvhvec3 edge2 = verts[vertIdx + 2] - verts[vertIdx];
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) continue; // ray parallel to triangle
const float f = 1 / a;
const bvhvec3 s = ray.O - bvhvec3( verts[vertIdx] );
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
if (t < 0 || t > ray.hit.t) continue;
ray.hit.t = t, ray.hit.u = u, ray.hit.v = v, ray.hit.prim = tidx;
}
@@ -5229,7 +5233,11 @@ inline void IntersectCompactTri( Ray& r, float32x4_t& t4, const float* T )
const float u = T[0] * wr.x + T[1] * wr.y + T[2] * wr.z + T[3];
const float v = T[4] * wr.x + T[5] * wr.y + T[6] * wr.z + T[7];
const bool hit = u >= 0 && v >= 0 && u + v < 1;
+#if INST_IDX_BITS == 32
+ if (hit) r.hit = { 0, ta, u, v, *(uint32_t*)&T[15] }, t4 = vdupq_n_f32( ta );
+#else
if (hit) r.hit = { ta, u, v, *(uint32_t*)&T[15] }, t4 = vdupq_n_f32( ta );
+#endif
}
inline int32_t ARMVecMovemask( uint32x4_t v ) {
@@ -5430,10 +5438,8 @@ bool BVH4_CPU::IsOccluded( const Ray& ray ) const
const float32x4_t txmax = vmaxq_f32( tx1, tx2 ), tymax = vmaxq_f32( ty1, ty2 ), tzmax = vmaxq_f32( tz1, tz2 );
const float32x4_t tmin = vmaxq_f32( vmaxq_f32( txmin, tymin ), tzmin );
const float32x4_t tmax = vminq_f32( vminq_f32( txmax, tymax ), tzmax );
-
uint32x4_t hit = vandq_u32( vandq_u32( vcgeq_f32( tmax, tmin ), vcltq_f32( tmin, t4 ) ), vcgeq_f32( tmax, zero4 ) );
int32_t hitBits = ARMVecMovemask( hit ), hits = vcnt_s8( vreinterpret_s8_s32( vcreate_u32( hitBits ) ) )[0];
-
if (hits == 1 /* 43% */)
{
// just one node was hit - no sorting needed.
@@ -5567,7 +5573,36 @@ BVH_Double::~BVH_Double()
{
AlignedFree( fragment );
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
+}
+
+void BVH_Double::Build( void (*customGetAABB)(const uint64_t, bvhdbl3&, bvhdbl3&), const uint64_t primCount )
+{
+ FATAL_ERROR_IF( primCount == 0, "BVH_Double::Build( void (*customGetAABB)( .. ), instCount ), instCount == 0." );
+ triCount = idxCount = primCount;
+ const uint64_t spaceNeeded = primCount * 2; // upper limit
+ if (allocatedNodes < spaceNeeded)
+ {
+ AlignedFree( bvhNode );
+ AlignedFree( primIdx );
+ AlignedFree( fragment );
+ bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
+ allocatedNodes = spaceNeeded;
+ primIdx = (uint64_t*)AlignedAlloc( primCount * sizeof( uint64_t ) );
+ fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
+ }
+ // copy relevant data from instance array
+ BVHNode& root = bvhNode[0];
+ root.leftFirst = 0, root.triCount = primCount, root.aabbMin = bvhvec3( BVH_FAR ), root.aabbMax = bvhvec3( -BVH_FAR );
+ for (uint32_t i = 0; i < primCount; i++)
+ {
+ customGetAABB( i, fragment[i].bmin, fragment[i].bmax );
+ root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin ), fragment[i].primIdx = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
+ }
+ // start build
+ newNodePtr = 1;
+ Build(); // or BuildAVX, for large TLAS.
}
void BVH_Double::Build( BLASInstanceEx* bvhs, const uint64_t instCount, BVH_Double** blasses, const uint64_t bCount )
@@ -5578,11 +5613,11 @@ void BVH_Double::Build( BLASInstanceEx* bvhs, const uint64_t instCount, BVH_Doub
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
- triIdx = (uint64_t*)AlignedAlloc( instCount * sizeof( uint64_t ) );
+ primIdx = (uint64_t*)AlignedAlloc( instCount * sizeof( uint64_t ) );
fragment = (Fragment*)AlignedAlloc( instCount * sizeof( Fragment ) );
}
instList = (BLASInstanceEx*)bvhs;
@@ -5593,12 +5628,15 @@ void BVH_Double::Build( BLASInstanceEx* bvhs, const uint64_t instCount, BVH_Doub
root.leftFirst = 0, root.triCount = instCount, root.aabbMin = bvhdbl3( BVH_DBL_FAR ), root.aabbMax = bvhdbl3( -BVH_DBL_FAR );
for (uint64_t i = 0; i < instCount; i++)
{
- uint64_t blasIdx = instList[i].blasIdx;
- BVH_Double* blas = blasList[blasIdx];
- instList[i].Update( blas );
+ if (blasList) // if a null pointer is passed, we'll assume the BLASInstances have been updated elsewhere.
+ {
+ uint64_t blasIdx = instList[i].blasIdx;
+ BVH_Double* blas = blasList[blasIdx];
+ instList[i].Update( blas );
+ }
fragment[i].bmin = instList[i].aabbMin, fragment[i].primIdx = i, fragment[i].bmax = instList[i].aabbMax;
root.aabbMin = tinybvh_min( root.aabbMin, instList[i].aabbMin );
- root.aabbMax = tinybvh_max( root.aabbMax, instList[i].aabbMax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, instList[i].aabbMax ), primIdx[i] = i;
}
// start build
newNodePtr = 1;
@@ -5618,11 +5656,11 @@ void BVH_Double::PrepareBuild( const bvhdbl3* vertices, const uint64_t primCount
if (allocatedNodes < spaceNeeded)
{
AlignedFree( bvhNode );
- AlignedFree( triIdx );
+ AlignedFree( primIdx );
AlignedFree( fragment );
bvhNode = (BVHNode*)AlignedAlloc( spaceNeeded * sizeof( BVHNode ) );
allocatedNodes = spaceNeeded;
- triIdx = (uint64_t*)AlignedAlloc( primCount * sizeof( uint64_t ) );
+ primIdx = (uint64_t*)AlignedAlloc( primCount * sizeof( uint64_t ) );
fragment = (Fragment*)AlignedAlloc( primCount * sizeof( Fragment ) );
}
verts = (bvhdbl3*)vertices; // note: we're not copying this data; don't delete.
@@ -5636,7 +5674,7 @@ void BVH_Double::PrepareBuild( const bvhdbl3* vertices, const uint64_t primCount
fragment[i].bmin = tinybvh_min( tinybvh_min( v0, v1 ), v2 );
fragment[i].bmax = tinybvh_max( tinybvh_max( v0, v1 ), v2 );
root.aabbMin = tinybvh_min( root.aabbMin, fragment[i].bmin );
- root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), triIdx[i] = i;
+ root.aabbMax = tinybvh_max( root.aabbMax, fragment[i].bmax ), primIdx[i] = i;
}
// reset node pool
newNodePtr = 1;
@@ -5662,7 +5700,7 @@ void BVH_Double::Build()
const bvhdbl3 rpd3 = bvhdbl3( BVHBINS / (node.aabbMax - node.aabbMin) ), nmin3 = node.aabbMin;
for (uint32_t i = 0; i < node.triCount; i++) // process all tris for x,y and z at once
{
- const uint64_t fi = triIdx[node.leftFirst + i];
+ const uint64_t fi = primIdx[node.leftFirst + i];
const bvhdbl3 fbi = ((fragment[fi].bmin + fragment[fi].bmax) * 0.5 - nmin3) * rpd3;
bvhint3 bi( (int32_t)fbi.x, (int32_t)fbi.y, (int32_t)fbi.z );
bi.x = tinybvh_clamp( bi.x, 0, BVHBINS - 1 );
@@ -5711,10 +5749,10 @@ void BVH_Double::Build()
const double rpd = rpd3.cell[bestAxis], nmin = nmin3.cell[bestAxis];
for (uint64_t i = 0; i < node.triCount; i++)
{
- const uint64_t fi = triIdx[src];
+ const uint64_t fi = primIdx[src];
int32_t bi = (uint32_t)(((fragment[fi].bmin[bestAxis] + fragment[fi].bmax[bestAxis]) * 0.5 - nmin) * rpd);
bi = tinybvh_clamp( bi, 0, BVHBINS - 1 );
- if ((uint32_t)bi <= bestPos) src++; else tinybvh_swap( triIdx[src], triIdx[--j] );
+ if ((uint32_t)bi <= bestPos) src++; else tinybvh_swap( primIdx[src], primIdx[--j] );
}
// create child nodes
uint64_t leftCount = src - node.leftFirst, rightCount = node.triCount - leftCount;
@@ -5768,30 +5806,32 @@ int32_t BVH_Double::Intersect( RayEx& ray ) const
if (customEnabled && customIntersect != 0)
{
for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
- (*customIntersect)(ray, triIdx[node->leftFirst + i]);
+ if ((*customIntersect)(ray, primIdx[node->leftFirst + i]))
+ ray.hit.inst = ray.instIdx;
}
else for (uint32_t i = 0; i < node->triCount; i++, cost += C_INT)
{
- const uint64_t idx = triIdx[node->leftFirst + i];
+ const uint64_t idx = primIdx[node->leftFirst + i];
const uint64_t vertIdx = idx * 3;
const bvhdbl3 edge1 = verts[vertIdx + 1] - verts[vertIdx];
const bvhdbl3 edge2 = verts[vertIdx + 2] - verts[vertIdx];
- const bvhdbl3 h = cross( ray.D, edge2 );
- const double a = dot( edge1, h );
+ const bvhdbl3 h = tinybvh_cross( ray.D, edge2 );
+ const double a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001) continue; // ray parallel to triangle
const double f = 1 / a;
const bvhdbl3 s = ray.O - bvhdbl3( verts[vertIdx] );
- const double u = f * dot( s, h );
+ const double u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhdbl3 q = cross( s, edge1 );
- const double v = f * dot( ray.D, q );
+ const bvhdbl3 q = tinybvh_cross( s, edge1 );
+ const double v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const double t = f * dot( edge2, q );
+ const double t = f * tinybvh_dot( edge2, q );
if (t > 0 && t < ray.hit.t)
{
// register a hit: ray is shortened to t
ray.hit.t = t, ray.hit.u = u, ray.hit.v = v;
- ray.hit.prim = idx + ray.instIdx;
+ ray.hit.prim = idx;
+ ray.hit.inst = ray.instIdx;
}
}
if (stackPtr == 0) break; else node = stack[--stackPtr];
@@ -5828,20 +5868,32 @@ int32_t BVH_Double::IntersectTLAS( RayEx& ray ) const
for (uint32_t i = 0; i < node->triCount; i++)
{
// BLAS traversal
- const uint64_t instIdx = triIdx[node->leftFirst + i];
+ const uint64_t instIdx = primIdx[node->leftFirst + i];
BLASInstanceEx& inst = instList[instIdx];
BVH_Double* blas = blasList[inst.blasIdx];
// 1. Transform ray with the inverse of the instance transform
- tmp.O = inst.TransformPoint( ray.O, inst.invTransform );
- tmp.D = inst.TransformVector( ray.D, inst.invTransform );
+ tmp.O = tinybvh_transform_point( ray.O, inst.invTransform );
+ tmp.D = tinybvh_transform_vector( ray.D, inst.invTransform );
+ tmp.hit = ray.hit;
+ double reciDirScale = 1.0, dirScale = 1.0;
+ if (blas->customIntersect)
+ {
+ // when intersecting custom geometry, we need to normalize the
+ // transformed ray direction, just to be safe. This is not needed
+ // for intersecting a regular BVH.
+ dirScale = tinybvh_length( tmp.D );
+ reciDirScale = 1.0 / dirScale;
+ tmp.D = tmp.D * reciDirScale;
+ tmp.hit.t *= dirScale;
+ }
tmp.rD.x = tmp.D.x > 1e-24 ? (1.0 / tmp.D.x) : (tmp.D.x < -1e-24 ? (1.0 / tmp.D.x) : BVH_DBL_FAR);
tmp.rD.y = tmp.D.y > 1e-24 ? (1.0 / tmp.D.y) : (tmp.D.y < -1e-24 ? (1.0 / tmp.D.y) : BVH_DBL_FAR);
tmp.rD.z = tmp.D.z > 1e-24 ? (1.0 / tmp.D.z) : (tmp.D.z < -1e-24 ? (1.0 / tmp.D.z) : BVH_DBL_FAR);
- tmp.instIdx = instIdx << 32UL;
- tmp.hit = ray.hit;
// 2. Traverse BLAS with the transformed ray
+ tmp.instIdx = instIdx;
cost += blas->Intersect( tmp );
// 3. Restore ray
+ tmp.hit.t *= reciDirScale;
ray.hit = tmp.hit;
}
if (stackPtr == 0) break; else node = stack[--stackPtr];
@@ -5876,25 +5928,25 @@ bool BVH_Double::IsOccluded( const RayEx& ray ) const
if (customEnabled && customIntersect != 0)
{
for (uint32_t i = 0; i < node->triCount; i++)
- (*customIsOccluded)(ray, triIdx[node->leftFirst + i]);
+ (*customIsOccluded)(ray, primIdx[node->leftFirst + i]);
}
else for (uint32_t i = 0; i < node->triCount; i++)
{
- const uint64_t idx = triIdx[node->leftFirst + i];
+ const uint64_t idx = primIdx[node->leftFirst + i];
const uint64_t vertIdx = idx * 3;
const bvhdbl3 edge1 = verts[vertIdx + 1] - verts[vertIdx];
const bvhdbl3 edge2 = verts[vertIdx + 2] - verts[vertIdx];
- const bvhdbl3 h = cross( ray.D, edge2 );
- const double a = dot( edge1, h );
+ const bvhdbl3 h = tinybvh_cross( ray.D, edge2 );
+ const double a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001) continue; // ray parallel to triangle
const double f = 1 / a;
const bvhdbl3 s = ray.O - bvhdbl3( verts[vertIdx] );
- const double u = f * dot( s, h );
+ const double u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) continue;
- const bvhdbl3 q = cross( s, edge1 );
- const double v = f * dot( ray.D, q );
+ const bvhdbl3 q = tinybvh_cross( s, edge1 );
+ const double v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) continue;
- const double t = f * dot( edge2, q );
+ const double t = f * tinybvh_dot( edge2, q );
if (t > 0 && t < ray.hit.t) return true;
}
if (stackPtr == 0) break; else node = stack[--stackPtr];
@@ -5929,11 +5981,11 @@ bool BVH_Double::IsOccludedTLAS( const RayEx& ray ) const
for (uint32_t i = 0; i < node->triCount; i++)
{
// BLAS traversal
- BLASInstanceEx& inst = instList[triIdx[node->leftFirst + i]];
+ BLASInstanceEx& inst = instList[primIdx[node->leftFirst + i]];
BVH_Double* blas = blasList[inst.blasIdx];
// 1. Transform ray with the inverse of the instance transform
- tmp.O = inst.TransformPoint( ray.O, inst.invTransform );
- tmp.D = inst.TransformVector( ray.D, inst.invTransform );
+ tmp.O = tinybvh_transform_point( ray.O, inst.invTransform );
+ tmp.D = tinybvh_transform_vector( ray.D, inst.invTransform );
tmp.rD.x = tmp.D.x > 1e-24 ? (1.0 / tmp.D.x) : (tmp.D.x < -1e-24 ? (1.0 / tmp.D.x) : BVH_DBL_FAR);
tmp.rD.y = tmp.D.y > 1e-24 ? (1.0 / tmp.D.y) : (tmp.D.y < -1e-24 ? (1.0 / tmp.D.y) : BVH_DBL_FAR);
tmp.rD.z = tmp.D.z > 1e-24 ? (1.0 / tmp.D.z) : (tmp.D.z < -1e-24 ? (1.0 / tmp.D.z) : BVH_DBL_FAR);
@@ -5994,29 +6046,11 @@ void BLASInstance::Update( BVHBase* blas )
for (int32_t j = 0; j < 8; j++)
{
const bvhvec3 p( j & 1 ? bmax.x : bmin.x, j & 2 ? bmax.y : bmin.y, j & 4 ? bmax.z : bmin.z );
- const bvhvec3 t = TransformPoint( p, transform );
+ const bvhvec3 t = tinybvh_transform_point( p, transform );
aabbMin = tinybvh_min( aabbMin, t ), aabbMax = tinybvh_max( aabbMax, t );
}
}
-// TransformPoint
-bvhvec3 BLASInstance::TransformPoint( const bvhvec3& v, const float* T ) const
-{
- const bvhvec3 res(
- T[0] * v.x + T[1] * v.y + T[2] * v.z + T[3],
- T[4] * v.x + T[5] * v.y + T[6] * v.z + T[7],
- T[8] * v.x + T[9] * v.y + T[10] * v.z + T[11] );
- const float w = T[12] * v.x + T[13] * v.y + T[14] * v.z + T[15];
- if (w == 1) return res; else return res * (1.f / w);
-}
-
-// TransformVector - skips translation. Assumes orthonormal transform, for now.
-bvhvec3 BLASInstance::TransformVector( const bvhvec3& v, const float* T ) const
-{
- return bvhvec3( T[0] * v.x + T[1] * v.y + T[2] * v.z, T[4] * v.x +
- T[5] * v.y + T[6] * v.z, T[8] * v.x + T[9] * v.y + T[10] * v.z );
-}
-
// InvertTransform - calculate the inverse of the matrix stored in 'transform'
void BLASInstance::InvertTransform()
{
@@ -6057,29 +6091,11 @@ void BLASInstanceEx::Update( BVH_Double* blas )
for (int32_t j = 0; j < 8; j++)
{
const bvhdbl3 p( j & 1 ? bmax.x : bmin.x, j & 2 ? bmax.y : bmin.y, j & 4 ? bmax.z : bmin.z );
- const bvhdbl3 t = TransformPoint( p, transform );
+ const bvhdbl3 t = tinybvh_transform_point( p, transform );
aabbMin = tinybvh_min( aabbMin, t ), aabbMax = tinybvh_max( aabbMax, t );
}
}
-// TransformPoint
-bvhdbl3 BLASInstanceEx::TransformPoint( const bvhdbl3& v, const double* T ) const
-{
- const bvhdbl3 res(
- T[0] * v.x + T[1] * v.y + T[2] * v.z + T[3],
- T[4] * v.x + T[5] * v.y + T[6] * v.z + T[7],
- T[8] * v.x + T[9] * v.y + T[10] * v.z + T[11] );
- const double w = T[12] * v.x + T[13] * v.y + T[14] * v.z + T[15];
- if (w == 1) return res; else return res * (1. / w);
-}
-
-// TransformVector - skips translation. Assumes orthonormal transform, for now.
-bvhdbl3 BLASInstanceEx::TransformVector( const bvhdbl3& v, const double* T ) const
-{
- return bvhdbl3( T[0] * v.x + T[1] * v.y + T[2] * v.z, T[4] * v.x +
- T[5] * v.y + T[6] * v.z, T[8] * v.x + T[9] * v.y + T[10] * v.z );
-}
-
// InvertTransform - calculate the inverse of the matrix stored in 'transform'
void BLASInstanceEx::InvertTransform()
{
@@ -6124,22 +6140,26 @@ void BVHBase::IntersectTri( Ray& ray, const bvhvec4slice& verts, const uint32_t
const bvhvec4 vert0 = verts[vertIdx];
const bvhvec3 edge1 = verts[vertIdx + 1] - vert0;
const bvhvec3 edge2 = verts[vertIdx + 2] - vert0;
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) return; // ray parallel to triangle
const float f = 1 / a;
const bvhvec3 s = ray.O - bvhvec3( vert0 );
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) return;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) return;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
if (t > 0 && t < ray.hit.t)
{
// register a hit: ray is shortened to t
ray.hit.t = t, ray.hit.u = u, ray.hit.v = v;
+ #if INST_IDX_BITS == 32
+ ray.hit.prim = idx, ray.hit.inst = ray.instIdx;
+ #else
ray.hit.prim = idx + ray.instIdx;
+ #endif
}
}
@@ -6151,21 +6171,26 @@ void BVHBase::IntersectTriIndexed( Ray& ray, const bvhvec4slice& verts, const ui
const bvhvec4 vert0 = verts[i0];
const bvhvec3 edge1 = verts[i1] - vert0;
const bvhvec3 edge2 = verts[i2] - vert0;
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) return; // ray parallel to triangle
const float f = 1 / a;
const bvhvec3 s = ray.O - bvhvec3( vert0 );
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) return;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) return;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
if (t > 0 && t < ray.hit.t)
{
// register a hit: ray is shortened to t
- ray.hit.t = t, ray.hit.u = u, ray.hit.v = v, ray.hit.prim = idx;
+ ray.hit.t = t, ray.hit.u = u, ray.hit.v = v;
+ #if INST_IDX_BITS == 32
+ ray.hit.prim = idx, ray.hit.inst = ray.instIdx;
+ #else
+ ray.hit.prim = idx + ray.instIdx;
+ #endif
}
}
@@ -6177,17 +6202,17 @@ bool BVHBase::TriOccludes( const Ray& ray, const bvhvec4slice& verts, const uint
const bvhvec4 vert0 = verts[vertIdx];
const bvhvec3 edge1 = verts[vertIdx + 1] - vert0;
const bvhvec3 edge2 = verts[vertIdx + 2] - vert0;
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) return false; // ray parallel to triangle
const float f = 1 / a;
const bvhvec3 s = ray.O - bvhvec3( vert0 );
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) return false;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) return false;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
return t > 0 && t < ray.hit.t;
}
@@ -6198,17 +6223,17 @@ bool BVHBase::IndexedTriOccludes( const Ray& ray, const bvhvec4slice& verts, con
const bvhvec4 vert0 = verts[i0];
const bvhvec3 edge1 = verts[i1] - vert0;
const bvhvec3 edge2 = verts[i2] - vert0;
- const bvhvec3 h = cross( ray.D, edge2 );
- const float a = dot( edge1, h );
+ const bvhvec3 h = tinybvh_cross( ray.D, edge2 );
+ const float a = tinybvh_dot( edge1, h );
if (fabs( a ) < 0.0000001f) return false; // ray parallel to triangle
const float f = 1 / a;
const bvhvec3 s = ray.O - bvhvec3( vert0 );
- const float u = f * dot( s, h );
+ const float u = f * tinybvh_dot( s, h );
if (u < 0 || u > 1) return false;
- const bvhvec3 q = cross( s, edge1 );
- const float v = f * dot( ray.D, q );
+ const bvhvec3 q = tinybvh_cross( s, edge1 );
+ const float v = f * tinybvh_dot( ray.D, q );
if (v < 0 || u + v > 1) return false;
- const float t = f * dot( edge2, q );
+ const float t = f * tinybvh_dot( edge2, q );
return t > 0 && t < ray.hit.t;
}
@@ -6232,8 +6257,8 @@ float BVHBase::IntersectAABB( const Ray& ray, const bvhvec3& aabbMin, const bvhv
void BVHBase::PrecomputeTriangle( const bvhvec4slice& vert, uint32_t triIndex, float* T )
{
bvhvec3 v0 = vert[triIndex], v1 = vert[triIndex + 1], v2 = vert[triIndex + 2];
- bvhvec3 e1 = v1 - v0, e2 = v2 - v0, N = cross( e1, e2 );
- float x1, x2, n = dot( v0, N ), rN;
+ bvhvec3 e1 = v1 - v0, e2 = v2 - v0, N = tinybvh_cross( e1, e2 );
+ float x1, x2, n = tinybvh_dot( v0, N ), rN;
if (fabs( N[0] ) > fabs( N[1] ) && fabs( N[0] ) > fabs( N[2] ))
{
x1 = v1.y * v0.z - v1.z * v0.y, x2 = v2.y * v0.z - v2.z * v0.y, rN = 1.0f / N.x;
@@ -6258,6 +6283,13 @@ void BVHBase::PrecomputeTriangle( const bvhvec4slice& vert, uint32_t triIndex, f
else memset( T, 0, 12 * 4 ); // cerr << "degenerate source " << endl;
}
+bool BVH::BVHNode::Intersect( const bvhvec3& bmin, const bvhvec3& bmax ) const
+{
+ return bmin.x < aabbMax.x && bmax.x > aabbMin.x &&
+ bmin.y < aabbMax.y && bmax.y > aabbMin.y &&
+ bmin.z < aabbMax.z && bmax.z > aabbMin.z;
+}
+
// Faster ClipFrag, which clips against only two planes if a tri wasn't clipped before.
bool BVH::ClipFrag( const Fragment& orig, Fragment& newFrag, bvhvec3 bmin, bvhvec3 bmax, bvhvec3 minDim, const uint32_t axis )
{
@@ -6265,7 +6297,6 @@ bool BVH::ClipFrag( const Fragment& orig, Fragment& newFrag, bvhvec3 bmin, bvhve
bmin = tinybvh_max( bmin, orig.bmin ), bmax = tinybvh_min( bmax, orig.bmax );
const bvhvec3 extent = bmax - bmin;
uint32_t Nin = 3, vidx = orig.primIdx * 3;
- const float eps = minDim.cell[axis];
if (orig.clipped)
{
// generic case: Sutherland-Hodgeman against six bounding planes
@@ -6318,45 +6349,54 @@ bool BVH::ClipFrag( const Fragment& orig, Fragment& newFrag, bvhvec3 bmin, bvhve
// special case: if this fragment has not been clipped before, only clip against planes on split axis.
bool hasVerts = false;
bvhvec3 mn( BVH_FAR ), mx( -BVH_FAR ), vout[4], C;
- if (extent.cell[axis] > eps)
+ if (extent.cell[axis] > minDim.cell[axis])
{
- uint32_t Nout = 0;
const float l = bmin[axis], r = bmax[axis];
- bvhvec3 v0, v1, v2;
- if (vertIdx)
- v0 = verts[vertIdx[vidx]], v1 = verts[vertIdx[vidx + 1]], v2 = verts[vertIdx[vidx + 2]];
- else
- v0 = verts[vidx + 0], v1 = verts[vidx + 1], v2 = verts[vidx + 2];
- bool v0in = v0[axis] >= l - eps, v1in = v1[axis] >= l - eps, v2in = v2[axis] >= l - eps;
- if (v0in || v1in)
- {
- if (v0in ^ v1in)
- C = v0 + (l - v0[axis]) / (v1[axis] - v0[axis]) * (v1 - v0),
- C[axis] = l /* accurate */, vout[Nout++] = C;
- if (v1in) vout[Nout++] = v1;
- }
- if (v1in || v2in)
- {
- if (v1in ^ v2in)
- C = v1 + (l - v1[axis]) / (v2[axis] - v1[axis]) * (v2 - v1),
- C[axis] = l /* accurate */, vout[Nout++] = C;
- if (v2in) vout[Nout++] = v2;
- }
- if (v2in || v0in)
+ uint32_t Nout = 0;
{
- if (v2in ^ v0in)
- C = v2 + (l - v2[axis]) / (v0[axis] - v2[axis]) * (v0 - v2),
- C[axis] = l /* accurate */, vout[Nout++] = C;
- if (v0in) vout[Nout++] = v0;
+ bvhvec3 v0, v1, v2;
+ if (vertIdx)
+ v0 = verts[vertIdx[vidx]], v1 = verts[vertIdx[vidx + 1]], v2 = verts[vertIdx[vidx + 2]];
+ else
+ v0 = verts[vidx + 0], v1 = verts[vidx + 1], v2 = verts[vidx + 2];
+ bool v0in = v0[axis] >= l, v1in = v1[axis] >= l, v2in = v2[axis] >= l;
+ if (v0in || v1in)
+ {
+ if (v0in ^ v1in)
+ {
+ const float f = tinybvh_clamp( (l - v0[axis]) / (v1[axis] - v0[axis]), 0.0f, 1.0f );
+ C = v0 + f * (v1 - v0), C[axis] = l /* accurate */, vout[Nout++] = C;
+ }
+ if (v1in) vout[Nout++] = v1;
+ }
+ if (v1in || v2in)
+ {
+ if (v1in ^ v2in)
+ {
+ const float f = tinybvh_clamp( (l - v1[axis]) / (v2[axis] - v1[axis]), 0.0f, 1.0f );
+ C = v1 + f * (v2 - v1), C[axis] = l /* accurate */, vout[Nout++] = C;
+ }
+ if (v2in) vout[Nout++] = v2;
+ }
+ if (v2in || v0in)
+ {
+ if (v2in ^ v0in)
+ {
+ const float f = tinybvh_clamp( (l - v2[axis]) / (v0[axis] - v2[axis]), 0.0f, 1.0f );
+ C = v2 + f * (v0 - v2), C[axis] = l /* accurate */, vout[Nout++] = C;
+ }
+ if (v0in) vout[Nout++] = v0;
+ }
}
for (uint32_t v = 0; v < Nout; v++)
{
bvhvec3 v0 = vout[v], v1 = vout[(v + 1) % Nout];
- const bool v0in = v0[axis] <= r + eps, v1in = v1[axis] <= r + eps;
+ const bool v0in = v0[axis] <= r, v1in = v1[axis] <= r;
if (!(v0in || v1in)) continue; else if (v0in ^ v1in)
{
- bvhvec3 C = v0 + (r - v0[axis]) / (v1[axis] - v0[axis]) * (v1 - v0);
- C[axis] = r /* accurate */, hasVerts = true, mn = tinybvh_min( mn, C ), mx = tinybvh_max( mx, C );
+ const float f = tinybvh_clamp( (r - v0[axis]) / (v1[axis] - v0[axis]), 0.0f, 1.0f );
+ C = v0 + f * (v1 - v0), C[axis] = r /* accurate */, hasVerts = true;
+ mn = tinybvh_min( mn, C ), mx = tinybvh_max( mx, C );
}
if (v1in) hasVerts = true, mn = tinybvh_min( mn, v1 ), mx = tinybvh_max( mx, v1 );
}
@@ -6367,6 +6407,71 @@ bool BVH::ClipFrag( const Fragment& orig, Fragment& newFrag, bvhvec3 bmin, bvhve
}
}
+// SplitFrag: cut a fragment in two new fragments.
+void BVH::SplitFrag( const Fragment& orig, Fragment& left, Fragment& right, const bvhvec3& minDim, const uint32_t splitAxis, const float splitPos, bool& leftOK, bool& rightOK )
+{
+ // method: we will split the fragment against the main split axis into two new fragments.
+ // In case the original fragment was clipped before, we first clip to the AABB of 'orig'.
+ bvhvec3 vin[16], vout[16], vleft[16], vright[16]; // occasionally exceeds 9, but never 12
+ uint32_t vidx = orig.primIdx * 3, Nin = 3, Nout = 0, Nleft = 0, Nright = 0;
+ if (!vertIdx) vin[0] = verts[vidx], vin[1] = verts[vidx + 1], vin[2] = verts[vidx + 2];
+ else vin[0] = verts[vertIdx[vidx]], vin[1] = verts[vertIdx[vidx + 1]], vin[2] = verts[vertIdx[vidx + 2]];
+ const bvhvec3 extent = orig.bmax - orig.bmin;
+ if (orig.clipped) for (int a = 0; a < 3; a++) if (extent.cell[a] > minDim.cell[a])
+ {
+ float l = orig.bmin.cell[a], r = orig.bmax.cell[a];
+ Nout = 0;
+ for (uint32_t v = 0; v < Nin; v++)
+ {
+ bvhvec3 v0 = vin[v], v1 = vin[(v + 1) % Nin];
+ const bool v0in = v0[a] >= l, v1in = v1[a] >= l;
+ if (!(v0in || v1in)) continue; else if (v0in ^ v1in)
+ {
+ const float f = tinybvh_clamp( (l - v0[a]) / (v1[a] - v0[a]), 0.0f, 1.0f );
+ bvhvec3 C = v0 + f * (v1 - v0);
+ C[a] = l /* accurate */, vout[Nout++] = C;
+ }
+ if (v1in) vout[Nout++] = v1;
+ }
+ Nin = 0;
+ for (uint32_t v = 0; v < Nout; v++)
+ {
+ bvhvec3 v0 = vout[v], v1 = vout[(v + 1) % Nout];
+ const bool v0in = v0[a] <= r, v1in = v1[a] <= r;
+ if (!(v0in || v1in)) continue; else if (v0in ^ v1in)
+ {
+ const float f = tinybvh_clamp( (r - v0[a]) / (v1[a] - v0[a]), 0.0f, 1.0f );
+ bvhvec3 C = v0 + f * (v1 - v0);
+ C[a] = r /* accurate */, vin[Nin++] = C;
+ }
+ if (v1in) vin[Nin++] = v1;
+ }
+ }
+ for (uint32_t v = 0; v < Nin; v++)
+ {
+ bvhvec3 v0 = vin[v], v1 = vin[(v + 1) % Nin];
+ bool v0left = v0[splitAxis] < splitPos, v1left = v1[splitAxis] < splitPos;
+ if (v0left && v1left) vleft[Nleft++] = v1; else if (!v0left && !v1left) vright[Nright++] = v1; else
+ {
+ const float f = tinybvh_clamp( (splitPos - v0[splitAxis]) / (v1[splitAxis] - v0[splitAxis]), 0.0f, 1.0f );
+ bvhvec3 C = v0 + f * (v1 - v0);
+ C[splitAxis] = splitPos;
+ if (v0left) vleft[Nleft++] = vright[Nright++] = C, vright[Nright++] = v1;
+ else vright[Nright++] = vleft[Nleft++] = C, vleft[Nleft++] = v1;
+ }
+ }
+ // calculate left and right fragments
+ left.bmin = right.bmin = bvhvec3( BVH_FAR ), left.bmax = right.bmax = bvhvec3( -BVH_FAR );
+ for (uint32_t i = 0; i < Nleft; i++)
+ left.bmin = tinybvh_min( left.bmin, vleft[i] ),
+ left.bmax = tinybvh_max( left.bmax, vleft[i] );
+ for (uint32_t i = 0; i < Nright; i++)
+ right.bmin = tinybvh_min( right.bmin, vright[i] ),
+ right.bmax = tinybvh_max( right.bmax, vright[i] );
+ left.clipped = right.clipped = 1, left.primIdx = right.primIdx = orig.primIdx;
+ leftOK = Nleft > 0, rightOK = Nright > 0;
+}
+
// RefitUpVerbose: Update bounding boxes of ancestors of the specified node.
void BVH_Verbose::RefitUpVerbose( uint32_t nodeIdx )
{
@@ -6452,7 +6557,7 @@ void BVH_Verbose::MergeSubtree( const uint32_t nodeIdx, uint32_t* newIdx, uint32
BVHNode& node = bvhNode[nodeIdx];
if (node.isLeaf())
{
- memcpy( newIdx + newIdxPtr, triIdx + node.firstTri, node.triCount * 4 );
+ memcpy( newIdx + newIdxPtr, primIdx + node.firstTri, node.triCount * 4 );
newIdxPtr += node.triCount;
}
else
@@ -6467,6 +6572,4 @@ void BVH_Verbose::MergeSubtree( const uint32_t nodeIdx, uint32_t* newIdx, uint32
#pragma GCC diagnostic pop
#endif
-#endif // TINYBVH_IMPLEMENTATION
-
-#endif // TINY_BVH_H_
\ No newline at end of file
+#endif // TINYBVH_IMPLEMENTATION
\ No newline at end of file
diff --git a/tiny_bvh_anim.cpp b/tiny_bvh_anim.cpp
index a78e5aa..662cd8f 100644
--- a/tiny_bvh_anim.cpp
+++ b/tiny_bvh_anim.cpp
@@ -4,34 +4,67 @@
#define TILESIZE 20
#include "external/fenster.h" // https://github.com/zserge/fenster
-// #define DOUBLE_PRECISION_TEST
+#define GRIDSIZE 2
+#define INSTCOUNT (GRIDSIZE * GRIDSIZE * GRIDSIZE)
#define TINYBVH_IMPLEMENTATION
+#define INST_IDX_BITS 8 // override default; space for 256 instances.
#include "tiny_bvh.h"
#include
#include
using namespace tinybvh;
-BVH bvh, blas, tlas;
-BVHBase* bvhList[] = { &bvh, &blas };
-BLASInstance inst[3];
+struct Sphere { bvhvec3 pos; float r; };
+
+BVH4_CPU sponza;
+BVH obj; // custom geometry BVH must be regular BVH layout.
+BVH tlas; // TLAS must for now be in regular BVH layout.
+BVHBase* bvhList[] = { &sponza, &obj };
+BLASInstance inst[INSTCOUNT + 1 /* one extra for sponza */];
int frameIdx = 0, verts = 0, bverts = 0;
bvhvec4* triangles = 0;
bvhvec4* bunny = 0;
+Sphere* spheres = 0;
static std::atomic tileIdx( 0 );
static unsigned threadCount = std::thread::hardware_concurrency();
// setup view pyramid for a pinhole camera
static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
-static bvhvec3 view = normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+
+// callback for custom geometry: ray/sphere intersection
+bool sphereIntersect( tinybvh::Ray& ray, const unsigned primID )
+{
+ bvhvec3 oc = ray.O - spheres[primID].pos;
+ float b = tinybvh_dot( oc, ray.D );
+ float r = spheres[primID].r;
+ float c = tinybvh_dot( oc, oc ) - r * r;
+ float t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrtf( d ), t = -b - d;
+ bool hit = t < ray.hit.t && t > 0;
+ if (hit) ray.hit.t = t, ray.hit.prim = primID;
+ return hit;
+}
+
+bool sphereIsOccluded( const tinybvh::Ray& ray, const unsigned primID )
+{
+ bvhvec3 oc = ray.O - spheres[primID].pos;
+ float b = tinybvh_dot( oc, ray.D );
+ float r = spheres[primID].r;
+ float c = tinybvh_dot( oc, oc ) - r * r;
+ float t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrtf( d ), t = -b - d;
+ return t < ray.hit.t && t > 0;
+}
-// double-precision test
-bvhdbl3* trianglesEx = 0;
-bvhdbl3* bunnyEx = 0;
-BLASInstanceEx instEx[3];
-BVH_Double bvhEx, blasEx, tlasEx;
-BVH_Double* bvhExList[] = { &bvhEx, &blasEx };
+void sphereAABB( const unsigned primID, bvhvec3& boundsMin, bvhvec3& boundsMax )
+{
+ boundsMin = spheres[primID].pos - bvhvec3( spheres[primID].r );
+ boundsMax = spheres[primID].pos + bvhvec3( spheres[primID].r );
+}
void Init()
{
@@ -41,55 +74,58 @@ void Init()
printf( "Loading triangle data (%i tris).\n", verts );
verts *= 3, triangles = (bvhvec4*)malloc64( verts * 16 );
s.read( (char*)triangles, verts * 16 );
- bvh.Build( triangles, verts / 3 );
+ sponza.Build( triangles, verts / 3 );
// load bunny
std::fstream b{ "./testdata/bunny.bin", s.binary | s.in };
b.read( (char*)&bverts, 4 );
bverts *= 3, bunny = (bvhvec4*)malloc64( bverts * 16 );
b.read( (char*)bunny, verts * 16 );
- blas.Build( bunny, bverts / 3 );
+
+ // turn bunny into spheres
+ spheres = new Sphere[bverts / 3];
+ for (int i = 0; i < bverts / 3; i++)
+ {
+ bvhvec3 v0 = bunny[i * 3];
+ bvhvec3 v1 = bunny[i * 3 + 1];
+ bvhvec3 v2 = bunny[i * 3 + 2];
+ spheres[i].r = tinybvh_min( 1.2f, 0.55f * tinybvh_min( tinybvh_length( v1 - v0 ), tinybvh_length( v2 - v0 ) ) );
+ spheres[i].pos = (v0 + v1 + v2) * 0.33333f;
+ }
+
+ // build a BLAS over the bunny spheres
+ obj.Build( &sphereAABB, bverts / 3 );
+
+ // set custom intersection callbacks
+ obj.customIntersect = &sphereIntersect;
+ obj.customIsOccluded = &sphereIsOccluded;
// build a TLAS
- inst[0] = BLASInstance( 0 ); // static geometry
- inst[1] = BLASInstance( 1 );
- inst[1].transform[0] = inst[1].transform[5] = inst[1].transform[10] = 0.5f; // scale
- inst[1].transform[3 /* i.e., x translation */] = 4;
- inst[2] = BLASInstance( 1 );
- inst[2].transform[0] = inst[2].transform[5] = inst[2].transform[10] = 0.5f; // scale
- inst[2].transform[3 /* i.e., x translation */] = -4;
- // tlas.Build( inst, 3 ); // postponed to ::Tick, as we'll want to do this each frame.
-
- // convert data to doubles
- trianglesEx = (bvhdbl3*)malloc64( verts * sizeof( bvhdbl3 ) );
- for (int i = 0; i < verts; i++) trianglesEx[i] = bvhdbl3( triangles[i] );
- bunnyEx = (bvhdbl3*)malloc64( bverts * sizeof( bvhdbl3 ) );
- for (int i = 0; i < bverts; i++) bunnyEx[i] = bvhdbl3( bunny[i] );
-
- // build double-precision TLAS
- bvhEx.Build( trianglesEx, verts / 3 );
- blasEx.Build( bunnyEx, bverts / 3 );
- instEx[0] = BLASInstanceEx( 0 );
- instEx[1] = instEx[2] = BLASInstanceEx( 1 );
- instEx[1].transform[0] = instEx[1].transform[5] = instEx[1].transform[10] = 0.5; // scale
- instEx[2].transform[0] = instEx[2].transform[5] = instEx[2].transform[10] = 0.5; // scale
- instEx[1].transform[3] = 4, instEx[2].transform[3] = -4;
- // tlasEx.Build( instEx, 3 ); // postponed to ::Tick, as we'll want to do this each frame.
+ inst[0] = BLASInstance( 0 /* sponza */ );
+ for (int b = 1, x = 0; x < GRIDSIZE; x++) for (int y = 0; y < GRIDSIZE; y++) for (int z = 0; z < GRIDSIZE; z++, b++)
+ {
+ inst[b] = BLASInstance( 1 /* bunny */ );
+ inst[b].transform[0] = inst[b].transform[5] = inst[b].transform[10] = 0.6f; // scale
+ inst[b].transform[3] = (float)x * 5 - GRIDSIZE * 2.5f;
+ inst[b].transform[7] = (float)y * 5 - GRIDSIZE * 2.5f + 7;
+ inst[b].transform[11] = (float)z * 5 - GRIDSIZE * 2.5f + 1;
+ }
+ tlas.Build( inst, 1 + INSTCOUNT, bvhList, 2 ); // just move build to Tick if instance transforms are not static.
}
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * cross( view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
float moved = 0, spd = 10.0f * delta_time_s;
if (f.keys['A'] || f.keys['D']) eye += right * (f.keys['D'] ? spd : -spd), moved = 1;
if (f.keys['W'] || f.keys['S']) eye += view * (f.keys['W'] ? spd : -spd), moved = 1;
if (f.keys['R'] || f.keys['F']) eye += up * 2.0f * (f.keys['R'] ? spd : -spd), moved = 1;
- if (f.keys[20]) view = normalize( view + right * -0.1f * spd ), moved = 1;
- if (f.keys[19]) view = normalize( view + right * 0.1f * spd ), moved = 1;
- if (f.keys[17]) view = normalize( view + up * -0.1f * spd ), moved = 1;
- if (f.keys[18]) view = normalize( view + up * 0.1f * spd ), moved = 1;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -0.1f * spd ), moved = 1;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * 0.1f * spd ), moved = 1;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -0.1f * spd ), moved = 1;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * 0.1f * spd ), moved = 1;
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * cross( view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
bvhvec3 C = eye + 1.2f * view;
p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
return moved > 0;
@@ -104,38 +140,49 @@ void TraceWorkerThread( uint32_t* buf, int threadIdx )
{
const int tx = tile % xtiles, ty = tile / xtiles;
unsigned seed = (tile + 17) * 171717 + frameIdx * 1023;
- const bvhvec3 L = normalize( bvhvec3( 1, 2, 3 ) );
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
for (int y = 0; y < TILESIZE; y++) for (int x = 0; x < TILESIZE; x++)
{
const int pixel_x = tx * TILESIZE + x, pixel_y = ty * TILESIZE + y;
const int pixelIdx = pixel_x + pixel_y * SCRWIDTH;
// setup primary ray
const float u = (float)pixel_x / SCRWIDTH, v = (float)pixel_y / SCRHEIGHT;
- const bvhvec3 D = normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
- #ifdef DOUBLE_PRECISION_TEST
- RayEx ray( eye, D, 1e30f );
- tlasEx.Intersect( ray );
- #else
+ const bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
Ray ray( eye, D, 1e30f );
tlas.Intersect( ray );
- #endif
if (ray.hit.t < 10000)
{
uint32_t pixel_x = tx * 4 + x, pixel_y = ty * 4 + y;
- #ifdef DOUBLE_PRECISION_TEST
- uint64_t primIdx = ray.hit.prim & PRIM_IDX_MASK_DBL;
- uint64_t instIdx = ray.hit.prim >> 32UL;
+ #if INST_IDX_BITS == 32
+ // instance and primitive index are stored in separate fields
+ uint32_t primIdx = ray.hit.prim;
+ uint32_t instIdx = ray.hit.inst;
#else
+ // instance and primitive index are stored together for compactness
uint32_t primIdx = ray.hit.prim & PRIM_IDX_MASK;
uint32_t instIdx = (uint32_t)ray.hit.prim >> INST_IDX_SHFT;
#endif
- BVH* blas = (BVH*)tlas.blasList[inst[instIdx].blasIdx];
- bvhvec4slice& instTris = blas->verts;
- bvhvec3 v0 = instTris[primIdx * 3];
- bvhvec3 v1 = instTris[primIdx * 3 + 1];
- bvhvec3 v2 = instTris[primIdx * 3 + 2];
- bvhvec3 N = normalize( cross( v1 - v0, v2 - v0 ) ); // TODO: Transform to world space
- int c = (int)(255.9f * fabs( dot( N, L ) ));
+ BLASInstance& instance = inst[instIdx];
+ uint32_t blasIdx = instance.blasIdx;
+ bvhvec3 N;
+ if (blasIdx == 0)
+ {
+ // we hit the Sponza mesh, which consists of triangles
+ bvhvec3 v0 = triangles[primIdx * 3];
+ bvhvec3 v1 = triangles[primIdx * 3 + 1];
+ bvhvec3 v2 = triangles[primIdx * 3 + 2];
+ N = tinybvh_normalize( tinybvh_cross( v1 - v0, v2 - v0 ) );
+ // the next line is disabled because we know Sponza is used with an identity transform.
+ // N = tinybvh_transform_vector( N, instance.transform );
+ }
+ else
+ {
+ // we hit a sphere
+ bvhvec3 C = tinybvh_transform_point( spheres[primIdx].pos, instance.transform );
+ bvhvec3 I = ray.O + ray.hit.t * ray.D;
+ N = tinybvh_normalize( I - C );
+ }
+ int c = (int)(255.9f * fabs( tinybvh_dot( N, L ) ));
buf[pixelIdx] = c + (c << 8) + (c << 16);
}
}
@@ -151,30 +198,12 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
// clear the screen with a debug-friendly color
for (int i = 0; i < SCRWIDTH * SCRHEIGHT; i++) buf[i] = 0xaaaaff;
- // update TLAS
- tlas.Build( inst, 3, bvhList, 2 ); // regular
- tlasEx.Build( instEx, 3, bvhExList, 2 ); // double-precision
-
// render tiles
tileIdx = threadCount;
-#ifdef _DEBUG
- for (uint32_t i = 0; i < threadCount; i++) TraceWorkerThread( buf, i );
-#else
std::vector threads;
for (uint32_t i = 0; i < threadCount; i++)
threads.emplace_back( &TraceWorkerThread, buf, i );
for (auto& thread : threads) thread.join();
-#endif
-
- // change instance transforms
- static float a[3] = { 0 };
- for (int i = 1; i < 3; i++)
- {
- inst[i].transform[7] /* y-pos */ = sinf( a[i] ) * 3.0f + 3.5f;
- instEx[i].transform[7] = sin( (double)a[i] ) * 3 + 3.5;
- a[i] += 0.1f + (0.01f * (float)i);
- if (a[i] > 6.2832f) a[i] -= 6.2832f;
- }
}
void Shutdown() { /* nothing here. */ }
\ No newline at end of file
diff --git a/tiny_bvh_anim_double.cpp b/tiny_bvh_anim_double.cpp
new file mode 100644
index 0000000..732616d
--- /dev/null
+++ b/tiny_bvh_anim_double.cpp
@@ -0,0 +1,200 @@
+#define FENSTER_APP_IMPLEMENTATION
+#define SCRWIDTH 800
+#define SCRHEIGHT 600
+#define TILESIZE 20
+#include "external/fenster.h" // https://github.com/zserge/fenster
+
+#define GRIDSIZE 2
+#define INSTCOUNT (GRIDSIZE * GRIDSIZE * GRIDSIZE)
+
+#define TINYBVH_IMPLEMENTATION
+#include "tiny_bvh.h"
+#include
+#include
+
+using namespace tinybvh;
+
+struct Sphere { bvhdbl3 pos; double r; };
+
+BVH_Double sponza, obj, tlas;
+BVH_Double* bvhList[] = { &sponza, &obj };
+BLASInstanceEx inst[INSTCOUNT + 1 /* one extra for sponza */];
+int frameIdx = 0, verts = 0, bverts = 0;
+bvhvec4* triangles = 0, * bunny = 0;
+bvhdbl3* trianglesEx = 0;
+Sphere* spheres = 0;
+static std::atomic tileIdx( 0 );
+static unsigned threadCount = std::thread::hardware_concurrency();
+
+// setup view pyramid for a pinhole camera
+static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+
+// callback for custom geometry: ray/sphere intersection
+bool sphereIntersect( tinybvh::RayEx& ray, const uint64_t primID )
+{
+ bvhdbl3 oc = ray.O - spheres[primID].pos;
+ double b = tinybvh_dot( oc, ray.D );
+ double r = spheres[primID].r;
+ double c = tinybvh_dot( oc, oc ) - r * r;
+ double t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrt( d ), t = -b - d;
+ bool hit = t < ray.hit.t && t > 0;
+ if (hit) ray.hit.t = t, ray.hit.prim = primID;
+ return hit;
+}
+
+bool sphereIsOccluded( const tinybvh::RayEx& ray, const uint64_t primID )
+{
+ bvhdbl3 oc = ray.O - spheres[primID].pos;
+ double b = tinybvh_dot( oc, ray.D );
+ double r = spheres[primID].r;
+ double c = tinybvh_dot( oc, oc ) - r * r;
+ double t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrt( d ), t = -b - d;
+ return t < ray.hit.t && t > 0;
+}
+
+void sphereAABB( const uint64_t primID, bvhdbl3& boundsMin, bvhdbl3& boundsMax )
+{
+ boundsMin = spheres[primID].pos - bvhdbl3( spheres[primID].r );
+ boundsMax = spheres[primID].pos + bvhdbl3( spheres[primID].r );
+}
+
+void Init()
+{
+ // load raw vertex data for Crytek's Sponza
+ std::fstream s{ "./testdata/cryteksponza.bin", s.binary | s.in };
+ s.read( (char*)&verts, 4 );
+ printf( "Loading triangle data (%i tris).\n", verts );
+ verts *= 3, triangles = (bvhvec4*)malloc64( verts * sizeof( bvhvec4 ) );
+ s.read( (char*)triangles, verts * 16 );
+ trianglesEx = (bvhdbl3*)malloc64( verts * sizeof( bvhdbl3 ) );
+ for (int i = 0; i < verts; i++) trianglesEx[i] = bvhdbl3( triangles[i] );
+ sponza.Build( trianglesEx, verts / 3 );
+
+ // load bunny
+ std::fstream b{ "./testdata/bunny.bin", s.binary | s.in };
+ b.read( (char*)&bverts, 4 );
+ bverts *= 3, bunny = (bvhvec4*)malloc64( bverts * sizeof( bvhvec4 ) );
+ b.read( (char*)bunny, verts * 16 );
+
+ // turn bunny into spheres
+ spheres = new Sphere[bverts / 3];
+ for (int i = 0; i < bverts / 3; i++)
+ {
+ bvhdbl3 v0 = bvhdbl3( bunny[i * 3] );
+ bvhdbl3 v1 = bvhdbl3( bunny[i * 3 + 1] );
+ bvhdbl3 v2 = bvhdbl3( bunny[i * 3 + 2] );
+ spheres[i].r = tinybvh_min( 1.2, 0.55 * tinybvh_min( tinybvh_length( v1 - v0 ), tinybvh_length( v2 - v0 ) ) );
+ spheres[i].pos = (v0 + v1 + v2) * 0.33333;
+ }
+
+ // build a BLAS over the bunny spheres
+ obj.Build( &sphereAABB, bverts / 3 );
+
+ // set custom intersection callbacks
+ obj.customIntersect = &sphereIntersect;
+ obj.customIsOccluded = &sphereIsOccluded;
+
+ // build a TLAS
+ inst[0] = BLASInstanceEx( 0 /* sponza */ );
+ for (int b = 1, x = 0; x < GRIDSIZE; x++) for (int y = 0; y < GRIDSIZE; y++) for (int z = 0; z < GRIDSIZE; z++, b++)
+ {
+ inst[b] = BLASInstanceEx( 1 /* sphere bunny */ );
+ inst[b].transform[0] = inst[b].transform[5] = inst[b].transform[10] = 0.6; // scale
+ inst[b].transform[3] = (float)x * 5 - GRIDSIZE * 2.5;
+ inst[b].transform[7] = (float)y * 5 - GRIDSIZE * 2.5 + 7;
+ inst[b].transform[11] = (float)z * 5 - GRIDSIZE * 2.5 + 1;
+ }
+ tlas.Build( inst, 1 + INSTCOUNT, bvhList, 2 ); // just move build to Tick if instance transforms are not static.
+}
+
+bool UpdateCamera( float delta_time_s, fenster& f )
+{
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
+ float moved = 0, spd = 10.0f * delta_time_s;
+ if (f.keys['A'] || f.keys['D']) eye += right * (f.keys['D'] ? spd : -spd), moved = 1;
+ if (f.keys['W'] || f.keys['S']) eye += view * (f.keys['W'] ? spd : -spd), moved = 1;
+ if (f.keys['R'] || f.keys['F']) eye += up * 2.0f * (f.keys['R'] ? spd : -spd), moved = 1;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -0.1f * spd ), moved = 1;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * 0.1f * spd ), moved = 1;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -0.1f * spd ), moved = 1;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * 0.1f * spd ), moved = 1;
+ // recalculate right, up
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
+ bvhvec3 C = eye + 1.2f * view;
+ p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
+ return moved > 0;
+}
+
+void TraceWorkerThread( uint32_t* buf, int threadIdx )
+{
+ const int xtiles = SCRWIDTH / TILESIZE, ytiles = SCRHEIGHT / TILESIZE;
+ const int tiles = xtiles * ytiles;
+ int tile = threadIdx;
+ while (tile < tiles)
+ {
+ const int tx = tile % xtiles, ty = tile / xtiles;
+ unsigned seed = (tile + 17) * 171717 + frameIdx * 1023;
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
+ for (int y = 0; y < TILESIZE; y++) for (int x = 0; x < TILESIZE; x++)
+ {
+ const int pixel_x = tx * TILESIZE + x, pixel_y = ty * TILESIZE + y;
+ const int pixelIdx = pixel_x + pixel_y * SCRWIDTH;
+ // setup primary ray
+ const float u = (float)pixel_x / SCRWIDTH, v = (float)pixel_y / SCRHEIGHT;
+ const bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ RayEx ray( eye, D, 1e30f );
+ tlas.Intersect( ray );
+ if (ray.hit.t < 10000)
+ {
+ uint32_t pixel_x = tx * 4 + x, pixel_y = ty * 4 + y;
+ // instance and primitive index are stored in separate fields
+ uint64_t primIdx = ray.hit.prim;
+ uint64_t instIdx = ray.hit.inst;
+ BLASInstanceEx& instance = inst[instIdx];
+ bvhdbl3 N;
+ if (instance.blasIdx == 0)
+ {
+ // we hit the Sponza mesh, which consists of triangles
+ bvhdbl3 v0 = trianglesEx[primIdx * 3];
+ bvhdbl3 v1 = trianglesEx[primIdx * 3 + 1];
+ bvhdbl3 v2 = trianglesEx[primIdx * 3 + 2];
+ N = tinybvh_normalize( tinybvh_cross( v1 - v0, v2 - v0 ) );
+ N = tinybvh_transform_vector( N, instance.transform );
+ }
+ else
+ {
+ // we hit a sphere
+ bvhdbl3 C = tinybvh_transform_point( spheres[primIdx].pos, instance.transform );
+ bvhdbl3 I = ray.O + ray.hit.t * ray.D;
+ N = tinybvh_normalize( I - C );
+ }
+ int c = (int)(255.9 * fabs( tinybvh_dot( N, L ) ));
+ buf[pixelIdx] = c + (c << 8) + (c << 16);
+ }
+ }
+ tile = tileIdx++;
+ }
+}
+
+void Tick( float delta_time_s, fenster& f, uint32_t* buf )
+{
+ // handle user input and update camera
+ bool moved = UpdateCamera( delta_time_s, f ) || frameIdx++ == 0;
+
+ // clear the screen with a debug-friendly color
+ for (int i = 0; i < SCRWIDTH * SCRHEIGHT; i++) buf[i] = 0xaaaaff;
+
+ // render tiles
+ tileIdx = threadCount;
+ std::vector threads;
+ for (uint32_t i = 0; i < threadCount; i++)
+ threads.emplace_back( &TraceWorkerThread, buf, i );
+ for (auto& thread : threads) thread.join();
+}
+
+void Shutdown() { /* nothing here. */ }
\ No newline at end of file
diff --git a/tiny_bvh_collide.cpp b/tiny_bvh_collide.cpp
new file mode 100644
index 0000000..8673751
--- /dev/null
+++ b/tiny_bvh_collide.cpp
@@ -0,0 +1,184 @@
+#define FENSTER_APP_IMPLEMENTATION
+#define SCRWIDTH 800
+#define SCRHEIGHT 600
+#define TILESIZE 20
+#include "external/fenster.h" // https://github.com/zserge/fenster
+
+#define TINYBVH_IMPLEMENTATION
+#define INST_IDX_BITS 8 // override default; space for 256 instances.
+#include "tiny_bvh.h"
+#include
+#include
+
+using namespace tinybvh;
+
+struct Sphere { bvhvec3 pos; float r; };
+
+BVH sponza, obj, tlas;
+BVHBase* bvhList[] = { &sponza, &obj };
+BLASInstance inst[2];
+int frameIdx = 0, verts = 0;
+bvhvec4* triangles = 0;
+Sphere* spheres = 0;
+static std::atomic tileIdx( 0 );
+static unsigned threadCount = std::thread::hardware_concurrency();
+
+// setup view pyramid for a pinhole camera
+static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+
+// callback for custom geometry: ray/sphere intersection
+bool sphereIntersect( tinybvh::Ray& ray, const unsigned primID )
+{
+ bvhvec3 oc = ray.O - spheres[primID].pos;
+ float b = tinybvh_dot( oc, ray.D ), r = spheres[primID].r;
+ float c = tinybvh_dot( oc, oc ) - r * r, t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrtf( d ), t = -b - d;
+ bool hit = t < ray.hit.t && t > 0;
+ if (hit) ray.hit.t = t, ray.hit.prim = primID;
+ return hit;
+}
+
+bool sphereIsOccluded( const tinybvh::Ray& ray, const unsigned primID )
+{
+ bvhvec3 oc = ray.O - spheres[primID].pos;
+ float b = tinybvh_dot( oc, ray.D ), r = spheres[primID].r;
+ float c = tinybvh_dot( oc, oc ) - r * r, t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrtf( d ), t = -b - d;
+ return t < ray.hit.t && t > 0;
+}
+
+void sphereAABB( const unsigned primID, bvhvec3& boundsMin, bvhvec3& boundsMax )
+{
+ boundsMin = spheres[primID].pos - bvhvec3( spheres[primID].r );
+ boundsMax = spheres[primID].pos + bvhvec3( spheres[primID].r );
+}
+
+void Init()
+{
+ // load raw vertex data for Crytek's Sponza
+ std::fstream s{ "./testdata/cryteksponza.bin", s.binary | s.in };
+ s.read( (char*)&verts, 4 );
+ printf( "Loading triangle data (%i tris).\n", verts );
+ verts *= 3, triangles = (bvhvec4*)malloc64( verts * 16 );
+ s.read( (char*)triangles, verts * 16 );
+ sponza.Build( triangles, verts / 3 );
+
+ // create a blas for a single sphere
+ spheres = new Sphere[1];
+ spheres[0].pos = bvhvec3( 0 ), spheres[0].r = 2;
+ obj.Build( &sphereAABB, 1 );
+ obj.customIntersect = &sphereIntersect;
+ obj.customIsOccluded = &sphereIsOccluded;
+
+ // create instance list
+ inst[0] = BLASInstance( 0 /* sponza */ );
+ inst[1] = BLASInstance( 1 /* sphere */ );
+}
+
+bool UpdateCamera( float delta_time_s, fenster& f )
+{
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
+ float moved = 0, spd = 10.0f * delta_time_s;
+ if (f.keys['A'] || f.keys['D']) eye += right * (f.keys['D'] ? spd : -spd), moved = 1;
+ if (f.keys['W'] || f.keys['S']) eye += view * (f.keys['W'] ? spd : -spd), moved = 1;
+ if (f.keys['R'] || f.keys['F']) eye += up * 2.0f * (f.keys['R'] ? spd : -spd), moved = 1;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -0.1f * spd ), moved = 1;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * 0.1f * spd ), moved = 1;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -0.1f * spd ), moved = 1;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * 0.1f * spd ), moved = 1;
+ // recalculate right, up
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
+ bvhvec3 C = eye + 1.2f * view;
+ p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
+ return moved > 0;
+}
+
+void TraceWorkerThread( uint32_t* buf, int threadIdx )
+{
+ const int xtiles = SCRWIDTH / TILESIZE, ytiles = SCRHEIGHT / TILESIZE;
+ const int tiles = xtiles * ytiles;
+ int tile = threadIdx;
+ while (tile < tiles)
+ {
+ const int tx = tile % xtiles, ty = tile / xtiles;
+ unsigned seed = (tile + 17) * 171717 + frameIdx * 1023;
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
+ for (int y = 0; y < TILESIZE; y++) for (int x = 0; x < TILESIZE; x++)
+ {
+ const int pixel_x = tx * TILESIZE + x, pixel_y = ty * TILESIZE + y;
+ const int pixelIdx = pixel_x + pixel_y * SCRWIDTH;
+ // setup primary ray
+ const float u = (float)pixel_x / SCRWIDTH, v = (float)pixel_y / SCRHEIGHT;
+ const bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ Ray ray( eye, D, 1e30f );
+ tlas.Intersect( ray );
+ if (ray.hit.t < 10000)
+ {
+ uint32_t pixel_x = tx * 4 + x, pixel_y = ty * 4 + y;
+ #if INST_IDX_BITS == 32
+ // instance and primitive index are stored in separate fields
+ uint32_t primIdx = ray.hit.prim;
+ uint32_t instIdx = ray.hit.inst;
+ #else
+ // instance and primitive index are stored together for compactness
+ uint32_t primIdx = ray.hit.prim & PRIM_IDX_MASK;
+ uint32_t instIdx = (uint32_t)ray.hit.prim >> INST_IDX_SHFT;
+ #endif
+ BLASInstance& instance = inst[instIdx];
+ uint32_t blasIdx = instance.blasIdx;
+ bvhvec3 N;
+ if (blasIdx == 0)
+ {
+ // we hit the Sponza mesh, which consists of triangles
+ bvhvec3 v0 = triangles[primIdx * 3];
+ bvhvec3 v1 = triangles[primIdx * 3 + 1];
+ bvhvec3 v2 = triangles[primIdx * 3 + 2];
+ N = tinybvh_normalize( tinybvh_cross( v1 - v0, v2 - v0 ) );
+ // the next line is disabled because we know Sponza is used with an identity transform.
+ // N = tinybvh_transform_vector( N, instance.transform );
+ }
+ else
+ {
+ // we hit a sphere
+ bvhvec3 C = tinybvh_transform_point( spheres[primIdx].pos, instance.transform );
+ bvhvec3 I = ray.O + ray.hit.t * ray.D;
+ N = tinybvh_normalize( I - C );
+ }
+ int c = (int)(255.9f * fabs( tinybvh_dot( N, L ) ));
+ buf[pixelIdx] = c + (c << 8) + (c << 16);
+ }
+ }
+ tile = tileIdx++;
+ }
+}
+
+void Tick( float delta_time_s, fenster& f, uint32_t* buf )
+{
+ // handle user input and update camera
+ bool moved = UpdateCamera( delta_time_s, f ) || frameIdx++ == 0;
+
+ // clear the screen with a debug-friendly color
+ for (int i = 0; i < SCRWIDTH * SCRHEIGHT; i++) buf[i] = 0xaaaaff;
+
+ // position the sphere
+ static float bally = 20, ballv = 0;
+ ballv -= 0.05f;
+ bally += ballv;
+ inst[1].transform[7] = bally;
+ if (sponza.IntersectSphere( bvhvec3( 0, bally, 0 ), 2 )) ballv = -ballv;
+
+ // build the tlas
+ tlas.Build( inst, 2, bvhList, 2 );
+
+ // render tiles
+ tileIdx = threadCount;
+ std::vector threads;
+ for (uint32_t i = 0; i < threadCount; i++)
+ threads.emplace_back( &TraceWorkerThread, buf, i );
+ for (auto& thread : threads) thread.join();
+}
+
+void Shutdown() { /* nothing here. */ }
\ No newline at end of file
diff --git a/tiny_bvh_custom.cpp b/tiny_bvh_custom.cpp
index 129bb73..c093fac 100644
--- a/tiny_bvh_custom.cpp
+++ b/tiny_bvh_custom.cpp
@@ -23,34 +23,41 @@ int verts = 0;
// setup view pyramid for a pinhole camera
static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
-static bvhvec3 view = normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
// callback for custom geometry: ray/sphere intersection
-void sphereIntersect( tinybvh::Ray& ray, unsigned primID )
+bool sphereIntersect( tinybvh::Ray& ray, const unsigned primID )
{
bvhvec3 oc = ray.O - spheres[primID].pos;
- float b = dot( oc, ray.D );
+ float b = tinybvh_dot( oc, ray.D );
float r = spheres[primID].r;
- float c = dot( oc, oc ) - r * r;
+ float c = tinybvh_dot( oc, oc ) - r * r;
float t, d = b * b - c;
- if (d <= 0) return;
+ if (d <= 0) return false;
d = sqrtf( d ), t = -b - d;
bool hit = t < ray.hit.t && t > 0;
if (hit) ray.hit.t = t, ray.hit.prim = primID;
+ return hit;
}
-bool sphereIsOccluded( const tinybvh::Ray& ray, unsigned primID )
+bool sphereIsOccluded( const tinybvh::Ray& ray, const unsigned primID )
{
bvhvec3 oc = ray.O - spheres[primID].pos;
- float b = dot( oc, ray.D );
+ float b = tinybvh_dot( oc, ray.D );
float r = spheres[primID].r;
- float c = dot( oc, oc ) - r * r;
+ float c = tinybvh_dot( oc, oc ) - r * r;
float t, d = b * b - c;
if (d <= 0) return false;
d = sqrtf( d ), t = -b - d;
return t < ray.hit.t && t > 0;
}
+void sphereAABB( const unsigned primID, bvhvec3& boundsMin, bvhvec3& boundsMax )
+{
+ boundsMin = spheres[primID].pos - bvhvec3( spheres[primID].r );
+ boundsMax = spheres[primID].pos + bvhvec3( spheres[primID].r );
+}
+
void Init()
{
// load raw vertex data for Crytek's Sponza
@@ -66,25 +73,13 @@ void Init()
spheres = new Sphere[verts / 3];
for (int i = 0; i < verts / 3; i++)
{
- bvhvec3 v0 = triangles[i * 3 + 0];
- bvhvec3 v1 = triangles[i * 3 + 1];
- bvhvec3 v2 = triangles[i * 3 + 2];
- spheres[i].r = min( 0.05f, tinybvh_min( length( v1 - v0 ), length( v2 - v0 ) ) );
+ bvhvec3 v0 = triangles[i * 3], v1 = triangles[i * 3 + 1], v2 = triangles[i * 3 + 2];
+ spheres[i].r = tinybvh_min( 0.35f, 0.25f * tinybvh_min( tinybvh_length( v1 - v0 ), tinybvh_length( v2 - v0 ) ) );
spheres[i].pos = (v0 + v1 + v2) * 0.33333f;
}
- // abuse the triangle array to hold sphere bounding boxes
- for (int i = 0; i < verts / 3; i++)
- {
- bvhvec3 aabbMin = spheres[i].pos - bvhvec3( spheres[i].r );
- bvhvec3 aabbMax = spheres[i].pos + bvhvec3( spheres[i].r );
- triangles[i * 3 + 0] = aabbMin;
- triangles[i * 3 + 1] = (aabbMax + aabbMin) * 0.5f;
- triangles[i * 3 + 2] = aabbMax; // so, a degenerate tri: just a diagonal line.
- }
-
// build the BVH over the aabbs
- bvh.Build( triangles, verts / 3 );
+ bvh.Build( &sphereAABB, verts / 3 );
// set custom intersection callbacks
bvh.customIntersect = &sphereIntersect;
@@ -93,8 +88,8 @@ void Init()
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- bvhvec3 up = 0.8f * cross( view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( view, right );
// get camera controls.
bool moved = false;
@@ -104,14 +99,14 @@ bool UpdateCamera( float delta_time_s, fenster& f )
if (f.keys['S']) eye += view * -1.0f * delta_time_s * 10, moved = true;
if (f.keys['R']) eye += up * delta_time_s * 10, moved = true;
if (f.keys['F']) eye += up * -1.0f * delta_time_s * 10, moved = true;
- if (f.keys[20]) view = normalize( view + right * -1.0f * delta_time_s ), moved = true;
- if (f.keys[19]) view = normalize( view + right * delta_time_s ), moved = true;
- if (f.keys[17]) view = normalize( view + up * -1.0f * delta_time_s ), moved = true;
- if (f.keys[18]) view = normalize( view + up * delta_time_s ), moved = true;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * delta_time_s ), moved = true;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * delta_time_s ), moved = true;
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- up = 0.8f * cross( view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ up = 0.8f * tinybvh_cross( view, right );
bvhvec3 C = eye + 2 * view;
p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
return moved;
@@ -126,30 +121,25 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
for (int i = 0; i < SCRWIDTH * SCRHEIGHT; i++) buf[i] = 0xaaaaff;
// trace rays
- const bvhvec3 L = normalize( bvhvec3( 1, 2, 3 ) );
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
for (int ty = 0; ty < SCRHEIGHT / 4; ty++) for (int tx = 0; tx < SCRWIDTH / 4; tx++)
{
for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++)
{
float u = (float)(tx * 4 + x) / SCRWIDTH, v = (float)(ty * 4 + y) / SCRHEIGHT;
- bvhvec3 D = normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
Ray ray( eye, D, 1e30f );
bvh.Intersect( ray );
if (ray.hit.t < 10000)
{
int pixel_x = tx * 4 + x, pixel_y = ty * 4 + y, primIdx = ray.hit.prim;
- bvhvec3 v0 = triangles[primIdx * 3];
- bvhvec3 v1 = triangles[primIdx * 3 + 1];
- bvhvec3 v2 = triangles[primIdx * 3 + 2];
- bvhvec3 N = normalize( cross( v1 - v0, v2 - v0 ) );
- int c = (int)(255.9f * fabs( dot( N, L ) ));
+ bvhvec3 I = ray.O + ray.hit.t * ray.D;
+ bvhvec3 N = tinybvh_normalize( I - spheres[primIdx].pos );
+ int c = (int)(255.9f * fabs( tinybvh_dot( N, L ) ));
buf[pixel_x + pixel_y * SCRWIDTH] = c + (c << 8) + (c << 16);
}
}
}
}
-void Shutdown()
-{
- // nothing here.
-}
\ No newline at end of file
+void Shutdown() { /* nothing here. */ }
\ No newline at end of file
diff --git a/tiny_bvh_custom_double.cpp b/tiny_bvh_custom_double.cpp
new file mode 100644
index 0000000..eb486e3
--- /dev/null
+++ b/tiny_bvh_custom_double.cpp
@@ -0,0 +1,148 @@
+#define FENSTER_APP_IMPLEMENTATION
+#define SCRWIDTH 800
+#define SCRHEIGHT 600
+#include "external/fenster.h" // https://github.com/zserge/fenster
+
+#define TINYBVH_IMPLEMENTATION
+#include "tiny_bvh.h"
+#include
+
+using namespace tinybvh;
+
+struct Sphere
+{
+ bvhdbl3 pos;
+ double r;
+};
+
+BVH_Double bvh;
+int frameIdx = 0;
+bvhvec4* triangles = 0;
+Sphere* spheres = 0;
+int verts = 0;
+
+// setup view pyramid for a pinhole camera
+static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+
+// callback for custom geometry: ray/sphere intersection
+bool sphereIntersect( tinybvh::RayEx& ray, const uint64_t primID )
+{
+ bvhdbl3 oc = ray.O - spheres[primID].pos;
+ double b = tinybvh_dot( oc, ray.D );
+ double r = spheres[primID].r;
+ double c = tinybvh_dot( oc, oc ) - r * r;
+ double t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrt( d ), t = -b - d;
+ bool hit = t < ray.hit.t && t > 0;
+ if (hit) ray.hit.t = t, ray.hit.prim = primID;
+ return hit;
+}
+
+bool sphereIsOccluded( const tinybvh::RayEx& ray, const uint64_t primID )
+{
+ bvhdbl3 oc = ray.O - spheres[primID].pos;
+ double b = tinybvh_dot( oc, ray.D );
+ double r = spheres[primID].r;
+ double c = tinybvh_dot( oc, oc ) - r * r;
+ double t, d = b * b - c;
+ if (d <= 0) return false;
+ d = sqrt( d ), t = -b - d;
+ return t < ray.hit.t && t > 0;
+}
+
+void sphereAABB( const uint64_t primID, bvhdbl3& boundsMin, bvhdbl3& boundsMax )
+{
+ boundsMin = spheres[primID].pos - bvhdbl3( spheres[primID].r );
+ boundsMax = spheres[primID].pos + bvhdbl3( spheres[primID].r );
+}
+
+void Init()
+{
+ // load raw vertex data for Crytek's Sponza
+ std::fstream s{ "./testdata/cryteksponza.bin", s.binary | s.in };
+ s.seekp( 0 );
+ s.read( (char*)&verts, 4 );
+ printf( "Loading triangle data (%i tris).\n", verts );
+ verts *= 3, triangles = (bvhvec4*)malloc64( verts * 16 );
+ s.read( (char*)triangles, verts * 16 );
+ s.close();
+
+ // turn the array of triangles into an array of spheres
+ spheres = new Sphere[verts / 3];
+ for (int i = 0; i < verts / 3; i++)
+ {
+ bvhdbl3 v0 = bvhdbl3( triangles[i * 3] );
+ bvhdbl3 v1 = bvhdbl3( triangles[i * 3 + 1] );
+ bvhdbl3 v2 = bvhdbl3( triangles[i * 3 + 2] );
+ spheres[i].r = tinybvh_min( 0.35, 0.25 * tinybvh_min( tinybvh_length( v1 - v0 ), tinybvh_length( v2 - v0 ) ) );
+ spheres[i].pos = (v0 + v1 + v2) * 0.33333;
+ }
+
+ // build the BVH over the aabbs
+ bvh.Build( &sphereAABB, verts / 3 );
+
+ // set custom intersection callbacks
+ bvh.customIntersect = &sphereIntersect;
+ bvh.customIsOccluded = &sphereIsOccluded;
+}
+
+bool UpdateCamera( float delta_time_s, fenster& f )
+{
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( view, right );
+
+ // get camera controls. Note: 32-bit float scalars and vectors.
+ bool moved = false;
+ if (f.keys['A']) eye += right * -1.0f * delta_time_s * 10, moved = true;
+ if (f.keys['D']) eye += right * delta_time_s * 10, moved = true;
+ if (f.keys['W']) eye += view * delta_time_s * 10, moved = true;
+ if (f.keys['S']) eye += view * -1.0f * delta_time_s * 10, moved = true;
+ if (f.keys['R']) eye += up * delta_time_s * 10, moved = true;
+ if (f.keys['F']) eye += up * -1.0f * delta_time_s * 10, moved = true;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * delta_time_s ), moved = true;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * delta_time_s ), moved = true;
+
+ // recalculate right, up
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ up = 0.8f * tinybvh_cross( view, right );
+ bvhvec3 C = eye + 2 * view;
+ p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
+ return moved;
+}
+
+void Tick( float delta_time_s, fenster& f, uint32_t* buf )
+{
+ // handle user input and update camera
+ bool moved = UpdateCamera( delta_time_s, f ) || frameIdx++ == 0;
+
+ // clear the screen with a debug-friendly color
+ for (int i = 0; i < SCRWIDTH * SCRHEIGHT; i++) buf[i] = 0xaaaaff;
+
+ // trace rays
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
+ for (int ty = 0; ty < SCRHEIGHT / 4; ty++) for (int tx = 0; tx < SCRWIDTH / 4; tx++)
+ {
+ for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++)
+ {
+ float u = (float)(tx * 4 + x) / SCRWIDTH, v = (float)(ty * 4 + y) / SCRHEIGHT;
+ bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ RayEx ray( eye, D, 1e30f );
+ bvh.Intersect( ray );
+ if (ray.hit.t < 10000)
+ {
+ int pixel_x = tx * 4 + x, pixel_y = ty * 4 + y;
+ uint64_t primIdx = ray.hit.prim;
+ bvhdbl3 I = ray.O + ray.hit.t * ray.D;
+ bvhdbl3 N = tinybvh_normalize( I - spheres[primIdx].pos );
+ int c = (int)(255.9f * fabs( tinybvh_dot( N, L ) ));
+ buf[pixel_x + pixel_y * SCRWIDTH] = c + (c << 8) + (c << 16);
+ }
+ }
+ }
+}
+
+void Shutdown() { /* nothing here. */ }
\ No newline at end of file
diff --git a/tiny_bvh_fenster.cpp b/tiny_bvh_fenster.cpp
index 5f04012..8433ca1 100644
--- a/tiny_bvh_fenster.cpp
+++ b/tiny_bvh_fenster.cpp
@@ -30,10 +30,10 @@ int verts = 0, inds = 0;
// eye, p1 (top-left), p2 (top-right) and p3 (bottom-left)
#ifdef LOADSCENE
static bvhvec3 eye( -15.24f, 21.5f, 2.54f ), p1, p2, p3;
-static bvhvec3 view = normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) );
#else
static bvhvec3 eye( -3.5f, -1.5f, -6.5f ), p1, p2, p3;
-static bvhvec3 view = normalize( bvhvec3( 3, 1.5f, 5 ) );
+static bvhvec3 view = tinybvh_normalize( bvhvec3( 3, 1.5f, 5 ) );
#endif
void sphere_flake( float x, float y, float z, float s, int d = 0 )
@@ -44,7 +44,7 @@ void sphere_flake( float x, float y, float z, float s, int d = 0 )
for (int i = 0, u = 0; u < 8; u++) for (int v = 0; v < 8; v++, i++)
P( 0, u, v, 0 ), P( 1, u, 0, v ), P( 2, 0, u, v ),
P( 3, u, v, 7 ), P( 4, u, 7, v ), P( 5, 7, u, v );
- for (int i = 0; i < 384; i++) p[i] = normalize( p[i] - ofs ) * s + pos;
+ for (int i = 0; i < 384; i++) p[i] = tinybvh_normalize( p[i] - ofs ) * s + pos;
for (int i = 0, side = 0; side < 6; side++, i += 8)
for (int u = 0; u < 7; u++, i++) for (int v = 0; v < 7; v++, i++)
vertices[verts++] = p[i], vertices[verts++] = p[i + 8],
@@ -67,7 +67,7 @@ void sphere_flake_indexed( float x, float y, float z, float s, int d = 0 )
P( 0, u, v, 0 ), P( 1, u, 0, v ), P( 2, 0, u, v ),
P( 3, u, v, 7 ), P( 4, u, 7, v ), P( 5, 7, u, v );
for (int i = 0; i < 384; i++)
- p[i] = vertices[verts + i] = normalize( p[i] - ofs ) * s + pos;
+ p[i] = vertices[verts + i] = tinybvh_normalize( p[i] - ofs ) * s + pos;
for (int i = verts, side = 0; side < 6; side++, i += 8, verts += 64)
for (int u = 0; u < 7; u++, i++) for (int v = 0; v < 7; v++, i++)
indices[inds++] = i, indices[inds++] = i + 8,
@@ -121,8 +121,8 @@ void Init()
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- bvhvec3 up = 0.8f * cross( view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( view, right );
// get camera controls.
bool moved = false;
@@ -132,14 +132,14 @@ bool UpdateCamera( float delta_time_s, fenster& f )
if (f.keys['S']) eye += view * -1.0f * delta_time_s * 10, moved = true;
if (f.keys['R']) eye += up * delta_time_s * 10, moved = true;
if (f.keys['F']) eye += up * -1.0f * delta_time_s * 10, moved = true;
- if (f.keys[20]) view = normalize( view + right * -1.0f * delta_time_s ), moved = true;
- if (f.keys[19]) view = normalize( view + right * delta_time_s ), moved = true;
- if (f.keys[17]) view = normalize( view + up * -1.0f * delta_time_s ), moved = true;
- if (f.keys[18]) view = normalize( view + up * delta_time_s ), moved = true;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * delta_time_s ), moved = true;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * delta_time_s ), moved = true;
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- up = 0.8f * cross( view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ up = 0.8f * tinybvh_cross( view, right );
bvhvec3 C = eye + 2 * view;
p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
return moved;
@@ -164,7 +164,7 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++)
{
float u = (float)(tx + x) / SCRWIDTH, v = (float)(ty + y) / SCRHEIGHT;
- bvhvec3 D = normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
rays[N++] = Ray( eye, D, 1e30f );
}
}
@@ -173,7 +173,7 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
for (int i = 0; i < N; i++) depths[i] = bvh.Intersect( rays[i] );
// visualize result
- const bvhvec3 L = normalize( bvhvec3( 1, 2, 3 ) );
+ const bvhvec3 L = tinybvh_normalize( bvhvec3( 1, 2, 3 ) );
for (int i = 0, ty = 0; ty < SCRHEIGHT / 4; ty++) for (int tx = 0; tx < SCRWIDTH / 4; tx++)
{
for (int y = 0; y < 4; y++) for (int x = 0; x < 4; x++, i++) if (rays[i].hit.t < 10000)
@@ -184,8 +184,8 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
bvhvec3 v0 = vertices[v0idx];
bvhvec3 v1 = vertices[v1idx];
bvhvec3 v2 = vertices[v2idx];
- bvhvec3 N = normalize( cross( v1 - v0, v2 - v0 ) );
- int c = (int)(255.9f * fabs( dot( N, L ) ));
+ bvhvec3 N = tinybvh_normalize( tinybvh_cross( v1 - v0, v2 - v0 ) );
+ int c = (int)(255.9f * fabs( tinybvh_dot( N, L ) ));
buf[pixel_x + pixel_y * SCRWIDTH] = c + (c << 8) + (c << 16);
// buf[pixel_x + pixel_y * SCRWIDTH] = (primIdx * 0xdeece66d + 0xb) & 0xFFFFFF; // color is hashed primitive index
// buf[pixel_x + pixel_y * SCRWIDTH] = depths[i] << 17; // render depth as red
diff --git a/tiny_bvh_gpu.cpp b/tiny_bvh_gpu.cpp
index fb0e2a2..2348333 100644
--- a/tiny_bvh_gpu.cpp
+++ b/tiny_bvh_gpu.cpp
@@ -97,9 +97,9 @@ void Init()
AddMesh( "./testdata/bistro_ext_part1.bin", 1, bvhvec3( 0 ) );
AddMesh( "./testdata/bistro_ext_part2.bin", 1, bvhvec3( 0 ) );
// build bvh (here: 'compressed wide bvh', for efficient GPU rendering)
- if (!bvh.Load( "cwbvh.bin", triCount ))
+ if (1) // (!bvh.Load( "cwbvh.bin", triCount ))
{
- bvh.Build( tris, triCount );
+ bvh.BuildHQ( tris, triCount );
bvh.Save( "cwbvh.bin" ); // cache for next run.
}
// create OpenCL buffers for BVH data
@@ -118,18 +118,18 @@ void Init()
// Keyboard handling
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * cross( rd.view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * tinybvh_cross( rd.view, right );
// get camera controls.
float moved = 0, spd = 10.0f * delta_time_s;
if (f.keys['A'] || f.keys['D']) rd.eye += right * (f.keys['D'] ? spd : -spd), moved = 1;
if (f.keys['W'] || f.keys['S']) rd.eye += rd.view * (f.keys['W'] ? spd : -spd), moved = 1;
if (f.keys['R'] || f.keys['F']) rd.eye += up * 2.0f * (f.keys['R'] ? spd : -spd), moved = 1;
- if (f.keys[20]) rd.view = normalize( rd.view + right * -0.1f * spd ), moved = 1;
- if (f.keys[19]) rd.view = normalize( rd.view + right * 0.1f * spd ), moved = 1;
- if (f.keys[17]) rd.view = normalize( rd.view + up * -0.1f * spd ), moved = 1;
- if (f.keys[18]) rd.view = normalize( rd.view + up * 0.1f * spd ), moved = 1;
+ if (f.keys[20]) rd.view = tinybvh_normalize( rd.view + right * -0.1f * spd ), moved = 1;
+ if (f.keys[19]) rd.view = tinybvh_normalize( rd.view + right * 0.1f * spd ), moved = 1;
+ if (f.keys[17]) rd.view = tinybvh_normalize( rd.view + up * -0.1f * spd ), moved = 1;
+ if (f.keys[18]) rd.view = tinybvh_normalize( rd.view + up * 0.1f * spd ), moved = 1;
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * cross( rd.view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * tinybvh_cross( rd.view, right );
bvhvec3 C = rd.eye + 1.2f * rd.view;
rd.p0 = C - right + up, rd.p1 = C + right + up, rd.p2 = C - right - up;
return moved > 0;
@@ -167,9 +167,15 @@ void Tick( float delta_time_s, fenster& f, uint32_t* buf )
finalize->Run2D( oclint2( SCRWIDTH, SCRHEIGHT ) );
pixels->CopyFromDevice();
memcpy( buf, pixels->GetHostPtr(), N * sizeof( uint32_t ) );
+ // trace a ray to the mouse to obtain the index of a primitive
+ float mousex = (float)f.x / SCRWIDTH, mousey = (float)f.y / SCRHEIGHT;
+ bvhvec3 P = rd.p0 + mousex * (rd.p1 - rd.p0) + mousey * (rd.p2 - rd.p0);
+ Ray r( rd.eye, tinybvh_normalize( P - bvhvec3( rd.eye ) ) );
+ bvh.bvh8.bvh.Intersect( r );
+ bvhvec3 I = r.O + r.hit.t * r.D;
// print frame time / rate in window title
- char title[50];
- sprintf( title, "tiny_bvh %.2f s %.2f Hz", delta_time_s, 1.0f / delta_time_s );
+ char title[512];
+ sprintf( title, "tiny_bvh - prim %i - [%.2f,%.2f,%.2f] - %.1fms (%.2fHz)", r.hit.prim, I.x, I.y, I.z, delta_time_s * 1000, 1.0f / delta_time_s );
fenster_update_title( &f, title );
}
diff --git a/tiny_bvh_gpu2.cpp b/tiny_bvh_gpu2.cpp
index bf78721..533c9f3 100644
--- a/tiny_bvh_gpu2.cpp
+++ b/tiny_bvh_gpu2.cpp
@@ -6,9 +6,22 @@
#define SCRHEIGHT 720
#include "external/fenster.h" // https://github.com/zserge/fenster
-#define DRAGONS 100
+#define SCENE 2
+
+#if SCENE == 1
+
+// At GRIDSIZE == 15, make sure to set INST_IDX_BITS to 12 in tiny_bvh.h.
+#define GRIDSIZE 15
+#define DRAGONS (GRIDSIZE * GRIDSIZE * GRIDSIZE)
// #define AUTOCAM
+#else
+
+#define DRAGONS 100
+#define AUTOCAM
+
+#endif
+
// This application uses tinybvh - And this file will include the implementation.
#define TINYBVH_IMPLEMENTATION
#include "tiny_bvh.h"
@@ -94,7 +107,7 @@ static void splineCam( float t )
rd.eye = 0.5f * (a + (b * t) + (c * t * t) + ((3 * Qp - 3 * Rp + Sp - Pp) * t * t * t));
a = 2 * Qt, b = Rt - Pt, c = 2 * Pt - 5 * Qt + 4 * Rt - St;
bvhvec3 target = 0.5f * (a + (b * t) + (c * t * t) + ((3 * Qt - 3 * Rt + St - Pt) * t * t * t));
- rd.view = normalize( target - bvhvec3( rd.eye ) );
+ rd.view = tinybvh_normalize( target - bvhvec3( rd.eye ) );
}
static float uniform_rand() { return (float)rand() / (float)RAND_MAX; }
@@ -144,7 +157,6 @@ void Init()
// create OpenCL buffers for wavefront path tracing
int N = SCRWIDTH * SCRHEIGHT;
- pixels = new Buffer( N * sizeof( uint32_t ) );
raysIn = new Buffer( N * sizeof( bvhvec4 ) * 4 );
raysOut = new Buffer( N * sizeof( bvhvec4 ) * 4 );
connections = new Buffer( N * 3 * sizeof( bvhvec4 ) * 3 );
@@ -154,6 +166,30 @@ void Init()
noise = new Buffer( 128 * 128 * 8 * sizeof( uint32_t ), blueNoise );
noise->CopyToDevice();
+#if SCENE == 1
+
+ // load dragon mesh
+ AddMesh( "./testdata/dragon.bin", 1, bvhvec3( 0 ) );
+ swap( verts, dragonVerts );
+ swap( triCount, dragonTriCount );
+ dragon.Build( dragonVerts, dragonTriCount );
+
+ // dragon grid
+ for (int b = 1, x = 0; x < GRIDSIZE; x++) for (int y = 0; y < GRIDSIZE; y++) for (int z = 0; z < GRIDSIZE; z++, b++)
+ {
+ instance[b] = BLASInstance( 1 /* dragon */ );
+ BLASInstance& i = instance[b];
+ i.transform[0] = i.transform[5] = i.transform[10] = 0.07f;
+ i.transform[3] = x, i.transform[7] = y, i.transform[11] = z;
+ }
+
+ // vertex data for static scenery
+ AddQuad( bvhvec3( -22, 12, 2 ), 9, 5, 0x1ffffff ); // hard-coded light source
+ AddMesh( "./testdata/bistro_ext_part1.bin", 1, bvhvec3( 500 ), 0xffffff );
+ bistro.Build( verts, 300 );
+
+#else
+
// load dragon mesh
AddMesh( "./testdata/dragon.bin", 1, bvhvec3( 0 ) );
swap( verts, dragonVerts );
@@ -168,7 +204,7 @@ void Init()
float t = (float)d * 0.17f + 1.0f;
float size = 0.1f + 0.075f * uniform_rand();
bvhvec3 pos = splinePos( t );
- bvhvec3 D = -size * normalize( splinePos( t + 0.01f ) - pos );
+ bvhvec3 D = -size * tinybvh_normalize( splinePos( t + 0.01f ) - pos );
bvhvec3 U( 0, size, 0 );
bvhvec3 N( -D.z, 0, D.x );
pos += N * 20.0f * (uniform_rand() - 0.5f);
@@ -183,28 +219,32 @@ void Init()
AddQuad( bvhvec3( -22, 12, 2 ), 9, 5, 0x1ffffff ); // hard-coded light source
AddMesh( "./testdata/bistro_ext_part1.bin", 1, bvhvec3( 0 ) );
AddMesh( "./testdata/bistro_ext_part2.bin", 1, bvhvec3( 0 ) );
+ bistro.Build( verts, triCount );
+
+#endif
// build bvh (here: 'compressed wide bvh', for efficient GPU rendering)
- bistro.Build( verts, triCount );
instance[0] = BLASInstance( 0 /* static geometry */ );
+
+ // finalize scene: build tlas
tlas.Build( instance, DRAGONS + 1, blasList, 2 );
// create OpenCL buffers for BVH data
tlasNodes = new Buffer( tlas.allocatedNodes /* could change! */ * sizeof( BVH_GPU::BVHNode ), tlas.bvhNode );
- tlasIndices = new Buffer( tlas.bvh.idxCount * sizeof( uint32_t ), tlas.bvh.triIdx );
+ tlasIndices = new Buffer( tlas.bvh.idxCount * sizeof( uint32_t ), tlas.bvh.primIdx );
tlasNodes->CopyToDevice();
tlasIndices->CopyToDevice();
blasInstances = new Buffer( (DRAGONS + 1) * sizeof( BLASInstance ), instance );
blasInstances->CopyToDevice();
- bistroNodes = new Buffer( bistro.usedBlocks * sizeof( bvhvec4 ), bistro.bvh8Data );
- bistroTris = new Buffer( bistro.idxCount * 3 * sizeof( bvhvec4 ), bistro.bvh8Tris );
- bistroVerts = new Buffer( triCount * 3 * sizeof( bvhvec4 ), verts );
dragonNodes = new Buffer( dragon.usedBlocks * sizeof( bvhvec4 ), dragon.bvh8Data );
dragonTris = new Buffer( dragon.idxCount * 3 * sizeof( bvhvec4 ), dragon.bvh8Tris );
drVerts = new Buffer( dragonTriCount * 3 * sizeof( bvhvec4 ), dragonVerts );
dragonNodes->CopyToDevice();
dragonTris->CopyToDevice();
drVerts->CopyToDevice();
+ bistroNodes = new Buffer( bistro.usedBlocks * sizeof( bvhvec4 ), bistro.bvh8Data );
+ bistroTris = new Buffer( bistro.idxCount * 3 * sizeof( bvhvec4 ), bistro.bvh8Tris );
+ bistroVerts = new Buffer( triCount * 3 * sizeof( bvhvec4 ), verts );
bistroNodes->CopyToDevice();
bistroTris->CopyToDevice();
bistroVerts->CopyToDevice();
@@ -218,7 +258,8 @@ void Init()
// Keyboard handling
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * cross( rd.view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), rd.view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( rd.view, right );
#ifdef AUTOCAM
// playback camera spline
static float ct = 0, moved = 1;
@@ -243,13 +284,14 @@ bool UpdateCamera( float delta_time_s, fenster& f )
if (f.keys['A'] || f.keys['D']) rd.eye += right * (f.keys['D'] ? spd : -spd), moved = 1;
if (f.keys['W'] || f.keys['S']) rd.eye += rd.view * (f.keys['W'] ? spd : -spd), moved = 1;
if (f.keys['R'] || f.keys['F']) rd.eye += up * 2.0f * (f.keys['R'] ? spd : -spd), moved = 1;
- if (f.keys[20]) rd.view = normalize( rd.view + right * -0.1f * spd ), moved = 1;
- if (f.keys[19]) rd.view = normalize( rd.view + right * 0.1f * spd ), moved = 1;
- if (f.keys[17]) rd.view = normalize( rd.view + up * -0.1f * spd ), moved = 1;
- if (f.keys[18]) rd.view = normalize( rd.view + up * 0.1f * spd ), moved = 1;
+ if (f.keys[20]) rd.view = tinybvh_normalize( rd.view + right * -0.1f * spd ), moved = 1;
+ if (f.keys[19]) rd.view = tinybvh_normalize( rd.view + right * 0.1f * spd ), moved = 1;
+ if (f.keys[17]) rd.view = tinybvh_normalize( rd.view + up * -0.1f * spd ), moved = 1;
+ if (f.keys[18]) rd.view = tinybvh_normalize( rd.view + up * 0.1f * spd ), moved = 1;
#endif
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), rd.view ) ), up = 0.8f * cross( rd.view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), rd.view ) );
+ up = 0.8f * tinybvh_cross( rd.view, right );
bvhvec3 C = rd.eye + 1.2f * rd.view;
rd.p0 = C - right + up, rd.p1 = C + right + up, rd.p2 = C - right - up;
return moved > 0;
diff --git a/tiny_bvh_pt.cpp b/tiny_bvh_pt.cpp
index 66ba022..d1bb2ec 100644
--- a/tiny_bvh_pt.cpp
+++ b/tiny_bvh_pt.cpp
@@ -33,7 +33,7 @@ static unsigned threadCount = std::thread::hardware_concurrency();
// Setup view pyramid for a pinhole camera:
// eye, p1 (top-left), p2 (top-right) and p3 (bottom-left)
static bvhvec3 eye( 0, 30, 0 ), p1, p2, p3;
-static bvhvec3 view = normalize( bvhvec3( -1, 0, 0 ) );
+static bvhvec3 view = tinybvh_normalize( bvhvec3( -1, 0, 0 ) );
// Xor32 RNG
static unsigned RandomUInt( unsigned& seed ) { seed ^= seed << 13, seed ^= seed >> 17, seed ^= seed << 5; return seed; }
@@ -46,13 +46,13 @@ bvhvec3 DiffuseReflection( const bvhvec3 N, unsigned& seed )
do
{
R = bvhvec3( RandomFloat( seed ) * 2 - 1, RandomFloat( seed ) * 2 - 1, RandomFloat( seed ) * 2 - 1 );
- } while (dot( R, R ) > 1);
- return normalize( dot( R, N ) < 0 ? R : -R );
+ } while (tinybvh_dot( R, R ) > 1);
+ return tinybvh_normalize( tinybvh_dot( R, N ) < 0 ? R : -R );
}
bvhvec3 CosWeightedDiffReflection( const bvhvec3 N, unsigned& seed )
{
bvhvec3 R = DiffuseReflection( N, seed );
- return normalize( N + R );
+ return tinybvh_normalize( N + R );
}
// Color conversion
@@ -66,7 +66,7 @@ bvhvec3 TriangleColor( const unsigned idx ) { return rgb32_to_vec3( *(unsigned*)
bvhvec3 TriangleNormal( const unsigned idx )
{
bvhvec3 a = tris[idx * 3], b = tris[idx * 3 + 1], c = tris[idx * 3 + 2];
- return normalize( cross( b - a, a - c ) );
+ return tinybvh_normalize( tinybvh_cross( b - a, a - c ) );
}
// Scene management - Append a file, with optional position, scale and color override, tinyfied
@@ -107,7 +107,7 @@ void Init()
// Keyboard handling
bool UpdateCamera( float delta_time_s, fenster& f )
{
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * cross( view, right );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
// get camera controls.
bool moved = false;
if (f.keys['A']) eye += right * -1.0f * delta_time_s * 10, moved = true;
@@ -116,12 +116,12 @@ bool UpdateCamera( float delta_time_s, fenster& f )
if (f.keys['S']) eye += view * -1.0f * delta_time_s * 10, moved = true;
if (f.keys['R']) eye += up * delta_time_s * 20, moved = true;
if (f.keys['F']) eye += up * -1.0f * delta_time_s * 20, moved = true;
- if (f.keys[20]) view = normalize( view + right * -1.0f * delta_time_s ), moved = true;
- if (f.keys[19]) view = normalize( view + right * delta_time_s ), moved = true;
- if (f.keys[17]) view = normalize( view + up * -1.0f * delta_time_s ), moved = true;
- if (f.keys[18]) view = normalize( view + up * delta_time_s ), moved = true;
+ if (f.keys[20]) view = tinybvh_normalize( view + right * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[19]) view = tinybvh_normalize( view + right * delta_time_s ), moved = true;
+ if (f.keys[17]) view = tinybvh_normalize( view + up * -1.0f * delta_time_s ), moved = true;
+ if (f.keys[18]) view = tinybvh_normalize( view + up * delta_time_s ), moved = true;
// recalculate right, up
- right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * cross( view, right );
+ right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) ), up = 0.8f * tinybvh_cross( view, right );
bvhvec3 C = eye + 1.2f * view;
p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
return moved;
@@ -136,13 +136,13 @@ bvhvec3 Trace( Ray ray, unsigned& seed, unsigned depth = 0 )
if (ray.hit.t == 1e30f) return bvhvec3( 0.6f, 0.7f, 1 ); // hit nothing
bvhvec3 I = ray.O + ray.hit.t * ray.D;
bvhvec3 N = TriangleNormal( ray.hit.prim );
- if (dot( N, ray.D ) > 0) N = -N;
+ if (tinybvh_dot( N, ray.D ) > 0) N = -N;
bvhvec3 BRDF = TriangleColor( ray.hit.prim ) * (1.0f / 3.14159f);
bvhvec3 Lpos( RandomFloat( seed ) * 30 - 15, 40, RandomFloat( seed ) * 6 - 3 ); // virtual
- float dist = length( Lpos - I );
+ float dist = tinybvh_length( Lpos - I );
bvhvec3 L = (Lpos - I) * (1.0f / dist); // normalize
bvhvec3 direct = {}, indirect = {};
- float NdotL = dot( N, L ), NLdotL = fabs( dot( L, bvhvec3( 0, 1, 0 ) ) );
+ float NdotL = tinybvh_dot( N, L ), NLdotL = fabs( tinybvh_dot( L, bvhvec3( 0, 1, 0 ) ) );
if (NdotL > 0)
if (!bvh.IsOccluded( Ray( I + L * 0.001f, L, dist ) ))
direct = BRDF * NdotL * NLdotL * bvhvec3( 9, 9, 8 ) * 500 * (1.0f / (dist * dist));
@@ -150,7 +150,7 @@ bvhvec3 Trace( Ray ray, unsigned& seed, unsigned depth = 0 )
if (depth < 2)
{
bvhvec3 R = CosWeightedDiffReflection( N, seed );
- float pdf = 1.0f / dot( N, R );
+ float pdf = 1.0f / tinybvh_dot( N, R );
bvhvec3 irradiance = Trace( Ray( I + R * 0.001f, R ), seed, depth + 1 );
indirect = BRDF * irradiance * (1.0f / pdf);
}
@@ -173,7 +173,7 @@ void TraceWorkerThread( uint32_t* buf, float scale, int threadIdx )
const int pixelIdx = pixel_x + pixel_y * SCRWIDTH;
// setup primary ray
const float u = (float)pixel_x / SCRWIDTH, v = (float)pixel_y / SCRHEIGHT;
- const bvhvec3 D = normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
+ const bvhvec3 D = tinybvh_normalize( p1 + u * (p2 - p1) + v * (p3 - p1) - eye );
// trace
accumulator[pixelIdx] += Trace( Ray( eye, D ), seed );
const bvhvec3 E = accumulator[pixelIdx] * scale;
diff --git a/tiny_bvh_renderer.cpp b/tiny_bvh_renderer.cpp
index 3df2966..61d13f4 100644
--- a/tiny_bvh_renderer.cpp
+++ b/tiny_bvh_renderer.cpp
@@ -25,7 +25,7 @@ void sphere_flake( float x, float y, float z, float s, int d = 0 )
for (int i = 0, u = 0; u < 8; u++) for (int v = 0; v < 8; v++, i++)
P( 0, u, v, 0 ), P( 1, u, 0, v ), P( 2, 0, u, v ),
P( 3, u, v, 7 ), P( 4, u, 7, v ), P( 5, 7, u, v );
- for (int i = 0; i < 384; i++) p[i] = normalize( p[i] - ofs ) * s + pos;
+ for (int i = 0; i < 384; i++) p[i] = tinybvh_normalize( p[i] - ofs ) * s + pos;
for (int i = 0, side = 0; side < 6; side++, i += 8)
for (int u = 0; u < 7; u++, i++) for (int v = 0; v < 7; v++, i++)
triangles[verts++] = p[i], triangles[verts++] = p[i + 8],
@@ -49,9 +49,9 @@ int main()
bvh.Build( (bvhvec4*)triangles, verts / 3 );
// trace 120x50 primary rays
- bvhvec3 eye( -3.5f, -1.5f, -6 ), view = normalize( bvhvec3( 3, 1.5f, 5 ) );
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- bvhvec3 up = 0.8f * cross( view, right ), C = eye + 2 * view;
+ bvhvec3 eye( -3.5f, -1.5f, -6 ), view = tinybvh_normalize( bvhvec3( 3, 1.5f, 5 ) );
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( view, right ), C = eye + 2 * view;
bvhvec3 p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
char line[122];
float sum;
@@ -64,7 +64,7 @@ int main()
float u = (float)(x + (s & 3)) / 480.0f;
float v = (float)(y + (s >> 2)) / 200.0f;
bvhvec3 P = p1 + u * (p2 - p1) + v * (p3 - p1);
- Ray ray( eye, normalize( P - eye ) );
+ Ray ray( eye, tinybvh_normalize( P - eye ) );
bvh.Intersect( ray );
sum += ray.hit.t > 999 ? 0 : ray.hit.t;
}
diff --git a/tiny_bvh_speedtest.cpp b/tiny_bvh_speedtest.cpp
index 19947a4..0bac8de 100644
--- a/tiny_bvh_speedtest.cpp
+++ b/tiny_bvh_speedtest.cpp
@@ -14,7 +14,6 @@
#define BUILD_REFERENCE
#define BUILD_DOUBLE
#define BUILD_AVX
-#define BUILD_NEON
#define BUILD_SBVH
#define REFIT_BVH2
#define REFIT_MBVH4
@@ -377,12 +376,12 @@ int main()
bvhvec3( -1.3, 4.96, 12.28 )
}, eye = eyes[0];
bvhvec3 views[3] = {
- normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) ),
- normalize( bvhvec3( 0.9427, 0.0292, -0.3324 ) ),
- normalize( bvhvec3( -0.9886, 0.0507, -0.1419 ) )
+ tinybvh_normalize( bvhvec3( 0.826f, -0.438f, -0.356f ) ),
+ tinybvh_normalize( bvhvec3( 0.9427, 0.0292, -0.3324 ) ),
+ tinybvh_normalize( bvhvec3( -0.9886, 0.0507, -0.1419 ) )
}, view = views[0];
- bvhvec3 right = normalize( cross( bvhvec3( 0, 1, 0 ), view ) );
- bvhvec3 up = 0.8f * cross( view, right ), C = eye + 2 * view;
+ bvhvec3 right = tinybvh_normalize( tinybvh_cross( bvhvec3( 0, 1, 0 ), view ) );
+ bvhvec3 up = 0.8f * tinybvh_cross( view, right ), C = eye + 2 * view;
bvhvec3 p1 = C - right + up, p2 = C + right + up, p3 = C - right - up;
// generate primary rays in a cacheline-aligned buffer - and, for data locality:
@@ -408,7 +407,7 @@ int main()
float u = (float)(pixel_x * 4 + (s & 3)) / (SCRWIDTH * 4);
float v = (float)(pixel_y * 4 + (s >> 2)) / (SCRHEIGHT * 4);
bvhvec3 P = p1 + u * (p2 - p1) + v * (p3 - p1);
- fullBatch[i][Nfull++] = Ray( eye, normalize( P - eye ) );
+ fullBatch[i][Nfull++] = Ray( eye, tinybvh_normalize( P - eye ) );
if ((s & 7) == 0)
{
smallBatch[i][Nsmall] = fullBatch[i][Nfull - 1];
@@ -491,21 +490,6 @@ int main()
#endif
-#ifdef BUILD_NEON
-#ifdef BVH_USENEON
-
- // measure single-core bvh construction time - NEON builder
- printf( "- fast NEON builder: " );
- t.reset();
- for (int pass = 0; pass < 3; pass++) bvh->BuildNEON( triangles, verts / 3 );
- buildTime = t.elapsed() / 3.0f;
- TestPrimaryRays( _BVH, Nsmall, 3, &avgCost );
- printf( "%7.2fms for %7i triangles ", buildTime * 1000.0f, verts / 3 );
- printf( "- %6i nodes, SAH=%.2f, rayCost=%.2f\n", bvh->usedNodes, bvh->SAHCost(), avgCost );
-
-#endif
-#endif
-
#ifdef BUILD_SBVH
// measure single-core bvh construction time - AVX builder
@@ -606,7 +590,7 @@ int main()
{
vertices[i * 3 + 0] = triangles[i].x, vertices[i * 3 + 1] = triangles[i].y;
vertices[i * 3 + 2] = triangles[i].z, indices[i] = i; // Note: not using shared vertices.
- }
+}
rtcSetGeometryBuildQuality( embreeGeom, RTC_BUILD_QUALITY_HIGH ); // max quality
rtcCommitGeometry( embreeGeom );
rtcAttachGeometry( embreeScene, embreeGeom );
@@ -642,8 +626,8 @@ int main()
{
float t = tinybvh::tinybvh_min( 1000.0f, smallBatch[view][i].hit.t );
bvhvec3 I = smallBatch[view][i].O + t * smallBatch[view][i].D;
- bvhvec3 D = tinybvh::normalize( lightPos - I );
- shadowBatch[view][i] = Ray( I + D * shadowEpsilon, D, tinybvh::length( lightPos - I ) - shadowEpsilon );
+ bvhvec3 D = tinybvh_normalize( lightPos - I );
+ shadowBatch[view][i] = Ray( I + D * shadowEpsilon, D, tinybvh_length( lightPos - I ) - shadowEpsilon );
}
// get reference shadow ray query result
refOccluded[view] = 0, refOccl[view] = new unsigned[Nsmall];
@@ -821,7 +805,7 @@ int main()
}
// create OpenCL buffers for the BVH data calculated by tiny_bvh.h
tinyocl::Buffer gpuNodes( bvh_gpu->usedNodes * sizeof( BVH_GPU::BVHNode ), bvh_gpu->bvhNode );
- tinyocl::Buffer idxData( bvh_gpu->idxCount * sizeof( unsigned ), bvh_gpu->bvh.triIdx );
+ tinyocl::Buffer idxData( bvh_gpu->idxCount * sizeof( unsigned ), bvh_gpu->bvh.primIdx );
tinyocl::Buffer triData( bvh_gpu->triCount * 3 * sizeof( tinybvh::bvhvec4 ), triangles );
// synchronize the host-side data to the gpu side
gpuNodes.CopyToDevice();
@@ -1066,4 +1050,4 @@ int main()
printf( "all done." );
return 0;
-}
\ No newline at end of file
+ }
\ No newline at end of file
diff --git a/tiny_bvh_test.sln b/tiny_bvh_test.sln
index 35b74ab..b195401 100644
--- a/tiny_bvh_test.sln
+++ b/tiny_bvh_test.sln
@@ -21,6 +21,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_anim", "vcproj\tin
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_gpu2", "vcproj\tiny_bvh_gpu2.vcxproj", "{0D99C966-8C79-4C2D-B1F1-4D8E15B3A2BE}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_interop", "tmpl8\tiny_bvh_interop.vcxproj", "{1B482D44-6893-42E7-ADF6-E497E4FCE916}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_custom_double", "vcproj\tiny_bvh_custom_double.vcxproj", "{8A22807D-400D-407E-B54B-58826BDAFAC1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_anim_double", "vcproj\tiny_bvh_anim_double.vcxproj", "{C5214FDA-35D0-424A-8978-A1F9C2B190CE}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tiny_bvh_collide", "vcproj\tiny_bvh_collide.vcxproj", "{2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -29,6 +37,14 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x64.ActiveCfg = Debug|x64
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x64.Build.0 = Debug|x64
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x86.ActiveCfg = Debug|Win32
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x86.Build.0 = Debug|Win32
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x64.ActiveCfg = Release|x64
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x64.Build.0 = Release|x64
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x86.ActiveCfg = Release|Win32
+ {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x86.Build.0 = Release|Win32
{C668A5EF-8E6A-4060-89C2-ED0AFFF0EE90}.Debug|x64.ActiveCfg = Debug|x64
{C668A5EF-8E6A-4060-89C2-ED0AFFF0EE90}.Debug|x64.Build.0 = Debug|x64
{C668A5EF-8E6A-4060-89C2-ED0AFFF0EE90}.Debug|x86.ActiveCfg = Debug|Win32
@@ -69,14 +85,6 @@ Global
{430FCECF-7685-40A7-A415-4A0DE487158F}.Release|x64.Build.0 = Release|x64
{430FCECF-7685-40A7-A415-4A0DE487158F}.Release|x86.ActiveCfg = Release|Win32
{430FCECF-7685-40A7-A415-4A0DE487158F}.Release|x86.Build.0 = Release|Win32
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x64.ActiveCfg = Debug|x64
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x64.Build.0 = Debug|x64
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x86.ActiveCfg = Debug|Win32
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Debug|x86.Build.0 = Debug|Win32
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x64.ActiveCfg = Release|x64
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x64.Build.0 = Release|x64
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x86.ActiveCfg = Release|Win32
- {4B0A219D-68D0-41EA-A0C4-8EB9E6171218}.Release|x86.Build.0 = Release|Win32
{05E87951-A43C-49D9-BC3B-5F6387285D2E}.Debug|x64.ActiveCfg = Debug|x64
{05E87951-A43C-49D9-BC3B-5F6387285D2E}.Debug|x64.Build.0 = Debug|x64
{05E87951-A43C-49D9-BC3B-5F6387285D2E}.Debug|x86.ActiveCfg = Debug|Win32
@@ -101,6 +109,38 @@ Global
{0D99C966-8C79-4C2D-B1F1-4D8E15B3A2BE}.Release|x64.Build.0 = Release|x64
{0D99C966-8C79-4C2D-B1F1-4D8E15B3A2BE}.Release|x86.ActiveCfg = Release|Win32
{0D99C966-8C79-4C2D-B1F1-4D8E15B3A2BE}.Release|x86.Build.0 = Release|Win32
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Debug|x64.ActiveCfg = Debug|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Debug|x64.Build.0 = Debug|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Debug|x86.ActiveCfg = Debug|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Debug|x86.Build.0 = Debug|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Release|x64.ActiveCfg = Release|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Release|x64.Build.0 = Release|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Release|x86.ActiveCfg = Release|x64
+ {1B482D44-6893-42E7-ADF6-E497E4FCE916}.Release|x86.Build.0 = Release|x64
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Debug|x64.ActiveCfg = Debug|x64
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Debug|x64.Build.0 = Debug|x64
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Debug|x86.ActiveCfg = Debug|Win32
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Debug|x86.Build.0 = Debug|Win32
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Release|x64.ActiveCfg = Release|x64
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Release|x64.Build.0 = Release|x64
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Release|x86.ActiveCfg = Release|Win32
+ {8A22807D-400D-407E-B54B-58826BDAFAC1}.Release|x86.Build.0 = Release|Win32
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Debug|x64.ActiveCfg = Debug|x64
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Debug|x64.Build.0 = Debug|x64
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Debug|x86.ActiveCfg = Debug|Win32
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Debug|x86.Build.0 = Debug|Win32
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Release|x64.ActiveCfg = Release|x64
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Release|x64.Build.0 = Release|x64
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Release|x86.ActiveCfg = Release|Win32
+ {C5214FDA-35D0-424A-8978-A1F9C2B190CE}.Release|x86.Build.0 = Release|Win32
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Debug|x64.ActiveCfg = Debug|x64
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Debug|x64.Build.0 = Debug|x64
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Debug|x86.ActiveCfg = Debug|Win32
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Debug|x86.Build.0 = Debug|Win32
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Release|x64.ActiveCfg = Release|x64
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Release|x64.Build.0 = Release|x64
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Release|x86.ActiveCfg = Release|Win32
+ {2BFDD504-7B2B-48D7-B5C4-07A346E2B1C3}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/tiny_ocl.h b/tiny_ocl.h
index 5cb605b..461b70a 100644
--- a/tiny_ocl.h
+++ b/tiny_ocl.h
@@ -29,13 +29,17 @@ THE SOFTWARE.
// Use this in *one* .c or .cpp
// #define TINY_OCL_IMPLEMENTATION
// #include "tiny_ocl.h"
+// To enable OpenGL interop, define TINY_OCL_GLINTEROP before the include:
+// #define TINY_OCL_GLINTEROP
+// #define TINY_OCL_IMPLEMENTATION
+// #include "tiny_ocl.h"
//
#ifndef TINY_OCL_H_
#define TINY_OCL_H_
#define CL_TARGET_OPENCL_VERSION 300
-#include "cl.h"
+#include
#include
// aligned memory allocation
@@ -78,6 +82,7 @@ inline void free64( void* ptr, void* = nullptr ) { free( ptr ); }
#endif
namespace tinyocl {
+
// Math classes
struct oclint2
{
@@ -325,7 +330,7 @@ class Kernel
template void SetArgument( int idx, T value )
{
CheckCLStarted();
- if (sizeof( T ) == 12)
+ if constexpr (sizeof( T ) == 12)
{
// probably int3 / float3; pad to 16 bytes
unsigned tmp[4] = {};
@@ -362,8 +367,11 @@ class Kernel
public:
inline static bool candoInterop = false, clStarted = false;
};
+
} // namespace tinybvh
+#endif // TINY_OCL_H_
+
// ============================================================================
//
// I M P L E M E N T A T I O N
@@ -375,6 +383,11 @@ class Kernel
#ifdef _MSC_VER
#pragma comment( lib, "../external/OpenCL/lib/OpenCL.lib" )
#endif
+#ifdef TINY_OCL_GLINTEROP
+#include "cl_gl.h"
+#include "cl_ext.h"
+GLFWwindow* GetGLFWWindow(); // we need access to the glfw window..
+#endif
using namespace std;
using namespace tinyocl;
@@ -406,7 +419,7 @@ void FatalError( const char* fmt, ... )
while (1) exit( 0 );
}
-static string TextFileRead( const char* _File )
+static string ReadTextFile( const char* _File )
{
ifstream s( _File );
string str( (istreambuf_iterator( s )), istreambuf_iterator() );
@@ -570,8 +583,10 @@ Buffer::Buffer( unsigned int N, void* ptr, unsigned int t )
textureID = N; // representing texture N
if (!Kernel::candoInterop) FatalError( "didn't expect to get here." );
int error = 0;
- // if (t == TARGET) deviceBuffer = clCreateFromGLTexture( Kernel::GetContext(), CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, N, &error );
- // else deviceBuffer = clCreateFromGLTexture( Kernel::GetContext(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, N, &error );
+ #ifdef TINY_OCL_GLINTEROP
+ if (t == TARGET) deviceBuffer = clCreateFromGLTexture( Kernel::GetContext(), CL_MEM_WRITE_ONLY, GL_TEXTURE_2D, 0, N, &error );
+ else deviceBuffer = clCreateFromGLTexture( Kernel::GetContext(), CL_MEM_READ_ONLY, GL_TEXTURE_2D, 0, N, &error );
+ #endif
CHECKCL( error );
hostBuffer = 0;
}
@@ -731,7 +746,7 @@ Kernel::Kernel( const char* file, const char* entryPoint )
// load a cl file
sourceFile = new char[strlen( file ) + 1];
strcpy( sourceFile, file );
- string csText = TextFileRead( fileName );
+ string csText = ReadTextFile( fileName );
if (csText.size() == 0) FatalError( "File %s not found", file );
// add vendor defines
vendorLines = 0;
@@ -767,7 +782,7 @@ Kernel::Kernel( const char* file, const char* entryPoint )
if (end == string::npos) FatalError( "Expected second \" after #include in shader." );
string incFile = csText.substr( pos + 1, end - pos - 1 );
// load include file content
- string incText = TextFileRead( incFile.c_str() );
+ string incText = ReadTextFile( incFile.c_str() );
includes[Ninc].end = includes[Ninc].start + LineCount( incText );
includes[Ninc++].file = incFile;
if (incText.size() == 0) FatalError( "#include file not found:\n%s", incFile.c_str() );
@@ -967,8 +982,10 @@ bool Kernel::InitCL()
{
cl_context_properties props[] =
{
- // CL_GL_CONTEXT_KHR, (cl_context_properties)glfwGetWGLContext( window ),
- // CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
+ #ifdef TINY_OCL_GLINTEROP
+ CL_GL_CONTEXT_KHR, (cl_context_properties)glfwGetWGLContext( GetGLFWWindow() ),
+ CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
+ #endif
CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0
};
// attempt to create a context with the requested features
@@ -1150,9 +1167,11 @@ void Kernel::Run( const size_t count, const size_t localSize, cl_event* eventToW
if (acqBuffer)
{
if (!Kernel::candoInterop) FatalError( "OpenGL interop functionality required but not available." );
- // CHECKCL( error = clEnqueueAcquireGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
- // CHECKCL( error = clEnqueueNDRangeKernel( queue, kernel, 1, 0, &count, localSize == 0 ? 0 : &localSize, eventToWaitFor ? 1 : 0, eventToWaitFor, eventToSet ) );
- // CHECKCL( error = clEnqueueReleaseGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ #ifdef TINY_OCL_GLINTEROP
+ CHECKCL( error = clEnqueueAcquireGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ CHECKCL( error = clEnqueueNDRangeKernel( queue, kernel, 1, 0, &count, localSize == 0 ? 0 : &localSize, eventToWaitFor ? 1 : 0, eventToWaitFor, eventToSet ) );
+ CHECKCL( error = clEnqueueReleaseGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ #endif
}
else
{
@@ -1181,9 +1200,11 @@ void Kernel::Run2D( const oclint2 count, const oclint2 lsize, cl_event* eventToW
if (acqBuffer)
{
if (!Kernel::candoInterop) FatalError( "OpenGL interop functionality required but not available." );
- // CHECKCL( error = clEnqueueAcquireGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
- // CHECKCL( error = clEnqueueNDRangeKernel( queue, kernel, 2, 0, workSize, localSize, eventToWaitFor ? 1 : 0, eventToWaitFor, eventToSet ) );
- // CHECKCL( error = clEnqueueReleaseGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ #ifdef TINY_OCL_GLINTEROP
+ CHECKCL( error = clEnqueueAcquireGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ CHECKCL( error = clEnqueueNDRangeKernel( queue, kernel, 2, 0, workSize, localSize, eventToWaitFor ? 1 : 0, eventToWaitFor, eventToSet ) );
+ CHECKCL( error = clEnqueueReleaseGLObjects( queue, 1, acqBuffer->GetDevicePtr(), 0, 0, 0 ) );
+ #endif
}
else
{
@@ -1191,6 +1212,4 @@ void Kernel::Run2D( const oclint2 count, const oclint2 lsize, cl_event* eventToW
}
}
-#endif
-
-#endif
+#endif // TINY_OCL_IMPLEMENTATION
\ No newline at end of file
diff --git a/tmpl8/LICENSE b/tmpl8/LICENSE
new file mode 100644
index 0000000..0e259d4
--- /dev/null
+++ b/tmpl8/LICENSE
@@ -0,0 +1,121 @@
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
diff --git a/tmpl8/game.cpp b/tmpl8/game.cpp
new file mode 100644
index 0000000..7e28f70
--- /dev/null
+++ b/tmpl8/game.cpp
@@ -0,0 +1,150 @@
+// Template, 2024 IGAD Edition
+// Get the latest version from: https://github.com/jbikker/tmpl8
+// IGAD/NHTV/BUAS/UU - Jacco Bikker - 2006-2024
+
+#include "precomp.h"
+using namespace tinybvh;
+using namespace tinyocl;
+#include "game.h"
+
+#define AUTOCAM
+
+// -----------------------------------------------------------
+// Initialize the application
+// -----------------------------------------------------------
+void Game::Init()
+{
+ // create OpenCL kernels
+ init = new Kernel( "wavefront2.cl", "SetRenderData" );
+ clear = new Kernel( "wavefront2.cl", "Clear" );
+ rayGen = new Kernel( "wavefront2.cl", "Generate" );
+ extend = new Kernel( "wavefront2.cl", "Extend" );
+ shade = new Kernel( "wavefront2.cl", "Shade" );
+ updateCounters1 = new Kernel( "wavefront2.cl", "UpdateCounters1" );
+ updateCounters2 = new Kernel( "wavefront2.cl", "UpdateCounters2" );
+ traceShadows = new Kernel( "wavefront2.cl", "Connect" );
+ finalize = new Kernel( "wavefront2.cl", "FinalizeGL" );
+ screen = 0; // this tells the template to not overwrite the render target.
+
+ // we need the 'compute unit' or 'SM' count for wavefront rendering; ask OpenCL for it.
+ clGetDeviceInfo( init->GetDeviceID(), CL_DEVICE_MAX_COMPUTE_UNITS, sizeof( size_t ), &computeUnits, NULL );
+
+ // create OpenCL buffers for wavefront path tracing
+ int N = SCRWIDTH * SCRHEIGHT;
+ pixels = new Buffer( GetRenderTarget()->ID, 0, Buffer::TARGET );
+ raysIn = new Buffer( N * sizeof( float4 ) * 4 );
+ raysOut = new Buffer( N * sizeof( float4 ) * 4 );
+ connections = new Buffer( N * 3 * sizeof( float4 ) * 3 );
+ accumulator = new Buffer( N * sizeof( float4 ) );
+ LoadBlueNoise();
+ noise = new Buffer( 128 * 128 * 8 * sizeof( uint32_t ), blueNoise );
+ noise->CopyToDevice();
+
+ // load dragon mesh
+ AddMesh( "./testdata/dragon.bin", 1, float3( 0 ) );
+ swap( verts, dragonVerts );
+ swap( triCount, dragonTriCount );
+ dragon.Build( dragonVerts, dragonTriCount );
+
+ // create dragon instances
+ for (int d = 0; d < DRAGONS; d++)
+ {
+ instance[d + 1] = BLASInstance( 1 /* dragon */ );
+ BLASInstance& i = instance[d + 1];
+ float t = (float)d * 0.17f + 1.0f;
+ float size = 0.1f + 0.075f * RandomFloat();
+ float3 pos = splinePos( t );
+ float3 D = -size * normalize( splinePos( t + 0.01f ) - pos );
+ float3 U( 0, size, 0 );
+ float3 R( -D.z, 0, D.x );
+ pos += R * 20.0f * (RandomFloat() - 0.5f);
+ i.transform[0] = R.x, i.transform[1] = R.y, i.transform[2] = R.z;
+ i.transform[4] = U.x, i.transform[5] = U.y, i.transform[6] = U.z;
+ i.transform[8] = D.x, i.transform[9] = D.y, i.transform[10] = D.z;
+ i.transform[3] = pos.x;
+ i.transform[7] = -9.2f;
+ i.transform[11] = pos.z;
+ }
+ // load vertex data for static scenery
+ AddQuad( float3( -22, 12, 2 ), 9, 5, 0x1ffffff ); // hard-coded light source
+ AddMesh( "./testdata/bistro_ext_part1.bin", 1, float3( 0 ) );
+ AddMesh( "./testdata/bistro_ext_part2.bin", 1, float3( 0 ) );
+
+ // build bvh (here: 'compressed wide bvh', for efficient GPU rendering)
+ bistro.Build( verts, triCount );
+ instance[0] = BLASInstance( 0 /* static geometry */ );
+ tlas.Build( instance, DRAGONS + 1, blasList, 2 );
+
+ // create OpenCL buffers for BVH data
+ tlasNodes = new Buffer( tlas.allocatedNodes /* could change! */ * sizeof( BVH_GPU::BVHNode ), tlas.bvhNode );
+ tlasIndices = new Buffer( tlas.bvh.idxCount * sizeof( uint32_t ), tlas.bvh.primIdx );
+ tlasNodes->CopyToDevice();
+ tlasIndices->CopyToDevice();
+ blasInstances = new Buffer( (DRAGONS + 1) * sizeof( BLASInstance ), instance );
+ blasInstances->CopyToDevice();
+ bistroNodes = new Buffer( bistro.usedBlocks * sizeof( float4 ), bistro.bvh8Data );
+ bistroTris = new Buffer( bistro.idxCount * 3 * sizeof( float4 ), bistro.bvh8Tris );
+ bistroVerts = new Buffer( triCount * 3 * sizeof( float4 ), verts );
+ dragonNodes = new Buffer( dragon.usedBlocks * sizeof( float4 ), dragon.bvh8Data );
+ dragonTris = new Buffer( dragon.idxCount * 3 * sizeof( float4 ), dragon.bvh8Tris );
+ drVerts = new Buffer( dragonTriCount * 3 * sizeof( float4 ), dragonVerts );
+ dragonNodes->CopyToDevice();
+ dragonTris->CopyToDevice();
+ drVerts->CopyToDevice();
+ bistroNodes->CopyToDevice();
+ bistroTris->CopyToDevice();
+ bistroVerts->CopyToDevice();
+}
+
+// -----------------------------------------------------------
+// Update camera
+// -----------------------------------------------------------
+bool Game::UpdateCamera( float delta_time_s )
+{
+ // playback camera spline
+ static float ct = 0, moved = 1;
+ ct += delta_time_s * 0.25f;
+ if (ct > 10) ct -= 10;
+ splineCam( ct + 1 );
+ float3 right = normalize( cross( float3( 0, 1, 0 ), rd.view ) );
+ float3 up = 0.8f * cross( rd.view, right ), C = rd.eye + 1.2f * rd.view;
+ rd.p0 = C - right + up, rd.p1 = C + right + up, rd.p2 = C - right - up;
+ return moved > 0;
+}
+
+// -----------------------------------------------------------
+// Main application tick function - Executed once per frame
+// -----------------------------------------------------------
+void Game::Tick( float delta_time )
+{
+ // handle user input and update camera
+ int N = SCRWIDTH * SCRHEIGHT;
+ UpdateCamera( delta_time * 0.001f );
+ clear->SetArguments( accumulator );
+ clear->Run( N );
+ spp = 1;
+ // wavefront step 0: render on the GPU
+ init->SetArguments( N, rd.eye, rd.p0, rd.p1, rd.p2,
+ frameIdx, SCRWIDTH, SCRHEIGHT,
+ bistroNodes, bistroTris, bistroVerts, dragonNodes, dragonTris, drVerts,
+ tlasNodes, tlasIndices, blasInstances,
+ noise
+ );
+ init->Run( 1 ); // init atomic counters, set buffer ptrs etc.
+ rayGen->SetArguments( raysOut, spp * 19191 );
+ rayGen->Run2D( oclint2( SCRWIDTH, SCRHEIGHT ) );
+ for (int i = 0; i < 3; i++)
+ {
+ swap( raysOut, raysIn );
+ extend->SetArguments( raysIn );
+ extend->Run( computeUnits * 64 * 16, 64 );
+ updateCounters1->Run( 1 );
+ shade->SetArguments( accumulator, raysIn, raysOut, connections, spp - 1 );
+ shade->Run( computeUnits * 64 * 16, 64 );
+ updateCounters2->Run( 1 );
+ }
+ traceShadows->SetArguments( accumulator, connections );
+ traceShadows->Run( computeUnits * 64 * 8, 64 );
+ finalize->SetArguments( accumulator, 1.0f / (float)spp++, pixels );
+ finalize->Run2D( oclint2( SCRWIDTH, SCRHEIGHT ) );
+}
\ No newline at end of file
diff --git a/tmpl8/game.h b/tmpl8/game.h
new file mode 100644
index 0000000..e2c32a1
--- /dev/null
+++ b/tmpl8/game.h
@@ -0,0 +1,151 @@
+// Template, 2024 IGAD Edition
+// Get the latest version from: https://github.com/jbikker/tmpl8
+// IGAD/NHTV/BUAS/UU - Jacco Bikker - 2006-2024
+
+#pragma once
+#pragma warning( disable : 4324 ) // padding warning
+#define DRAGONS 100
+
+namespace Tmpl8
+{
+// View pyramid for a pinhole camera
+struct RenderData
+{
+ float4 eye = float4( 0, 30, 0, 0 ), view = float4( -1, 0, 0, 0 ), C, p0, p1, p2;
+ uint frameIdx, dummy1, dummy2, dummy3;
+};
+
+class Game : public TheApp
+{
+public:
+ // game flow methods
+ void Init();
+ void Tick( float );
+ bool UpdateCamera( float );
+ void Shutdown() { /* implement if you want to do something on exit */ }
+ // input handling
+ void MouseUp( int ) { /* implement if you want to detect mouse button presses */ }
+ void MouseDown( int ) { /* implement if you want to detect mouse button presses */ }
+ void MouseMove( int x, int y ) { mousePos.x = x, mousePos.y = y; }
+ void MouseWheel( float ) { /* implement if you want to handle the mouse wheel */ }
+ void KeyUp( int ) { /* implement if you want to handle keys */ }
+ void KeyDown( int ) { /* implement if you want to handle keys */ }
+ // helpers
+ float3 splinePos( float t )
+ {
+ uint s = (uint)t;
+ t -= (float)s;
+ const float3 P = spline[s - 1], Q = spline[s], R = spline[s + 1], S = spline[s + 2];
+ const float3 a = 2.0f * Q, b = R - P, c = 2.0f * P - 5.0f * Q + 4.0f * R - S;
+ return 0.5f * (a + (b * t) + (c * t * t) + ((3.0f * Q - 3.0f * R + S - P) * t * t * t));
+ }
+ void splineCam( float t )
+ {
+ uint s = (uint)t;
+ t -= (float)s, s *= 2;
+ const float3 Pp = cam[s - 2], Qp = cam[s], Rp = cam[s + 2], Sp = cam[s + 4];
+ const float3 Pt = cam[s - 1], Qt = cam[s + 1], Rt = cam[s + 3], St = cam[s + 5];
+ float3 a = 2.0f * Qp, b = Rp - Pp, c = 2.0f * Pp - 5.0f * Qp + 4.0f * Rp - Sp;
+ rd.eye = 0.5f * (a + (b * t) + (c * t * t) + ((3.0f * Qp - 3.0f * Rp + Sp - Pp) * t * t * t));
+ a = 2.0f * Qt, b = Rt - Pt, c = 2.0f * Pt - 5.0f * Qt + 4.0f * Rt - St;
+ float3 target = 0.5f * (a + (b * t) + (c * t * t) + ((3.0f * Qt - 3.0f * Rt + St - Pt) * t * t * t));
+ rd.view = normalize( target - float3( rd.eye ) );
+ }
+ void AddMesh( const char* file, float scale = 1, float3 pos = {}, int c = 0, int N = 0 )
+ {
+ std::fstream s{ file, s.binary | s.in }; s.read( (char*)&N, 4 );
+ float4* data = (float4*)tinybvh::malloc64( (N + triCount) * 48 );
+ if (verts) memcpy( data, verts, triCount * 48 ), tinybvh::free64( verts );
+ verts = data, s.read( (char*)verts + triCount * 48, N * 48 ), triCount += N;
+ for (int* b = (int*)verts + (triCount - N) * 12, i = 0; i < N * 3; i++)
+ *(float3*)b = *(float3*)b * scale + pos, b[3] = c ? c : b[3], b += 4;
+ }
+ void AddQuad( const float3 pos, const float w, const float d, int c )
+ {
+ float4* data = (float4*)tinybvh::malloc64( (triCount + 2) * 48 );
+ if (verts) memcpy( data + 6, verts, triCount * 48 ), tinybvh::free64( verts );
+ data[0] = float3( -w, 0, -d ), data[1] = float3( w, 0, -d );
+ data[2] = float3( w, 0, d ), data[3] = float3( -w, 0, -d ), verts = data;
+ data[4] = float3( w, 0, d ), data[5] = float3( -w, 0, d ), triCount += 2;
+ for (int i = 0; i < 6; i++) data[i] = 0.5f * data[i] + float4( pos, 0 ), data[i].w = *(float*)&c;
+ }
+ void LoadBlueNoise()
+ {
+ std::fstream s{ "./testdata/blue_noise_128x128x8_2d.raw", s.binary | s.in };
+ s.read( (char*)blueNoise, 128 * 128 * 8 * 4 );
+ }
+ // data members
+ int2 mousePos;
+ uint32_t frameIdx = 0, spp = 0;
+ RenderData rd;
+ // host-side mesh data
+ BLASInstance instance[DRAGONS + 2];
+ float4* verts = 0;
+ float4* dragonVerts = 0;
+ uint32_t triCount = 0;
+ uint32_t dragonTriCount = 0;
+ // host-side acceleration structures
+ BVH_GPU tlas;
+ BVH8_CWBVH bistro;
+ BVH8_CWBVH dragon;
+ BVHBase* blasList[2] = { &bistro, &dragon };
+ size_t computeUnits;
+ uint32_t* blueNoise = new uint32_t[128 * 128 * 8];
+ // OpenCL kernels
+ Kernel* init;
+ Kernel* clear;
+ Kernel* rayGen;
+ Kernel* extend;
+ Kernel* shade;
+ Kernel* updateCounters1;
+ Kernel* updateCounters2;
+ Kernel* traceShadows;
+ Kernel* finalize;
+ // OpenCL buffers
+ Buffer* pixels;
+ Buffer* accumulator;
+ Buffer* raysIn;
+ Buffer* raysOut;
+ Buffer* connections;
+ Buffer* bistroNodes = 0;
+ Buffer* bistroTris = 0;
+ Buffer* bistroVerts;
+ Buffer* dragonNodes = 0;
+ Buffer* dragonTris = 0;
+ Buffer* drVerts;
+ Buffer* noise = 0;
+ Buffer* tlasNodes = 0;
+ Buffer* tlasIndices = 0;
+ Buffer* blasInstances = 0;
+ // splines
+ float3 spline[24] = {
+ float3( -3.378f, 0, -38.44f ),float3( -1.91f, 0, -36.10f ),
+ float3( -1.775f, 0, -31.95f ),float3( -3.15f, 0, -28.50f ),
+ float3( -6.027f, 0, -24.12f ),float3( -9.32f, 0, -19.11f ),
+ float3( -12.40f, 0, -15.25f ),float3( -15.40f, 0, -12.02f ),
+ float3( -18.42f, 0, -7.97f ),float3( -20.30f, 0, -3.28f ),
+ float3( -19.36f, 0, 0.809f ),float3( -16.90f, 0, 2.53f ),
+ float3( -13.10f, 0, 4.788f ),float3( -8.25f, 0, 6.87f ),
+ float3( -3.060f, 0, 9.029f ),float3( 5.6988f, 0, 12.67f ),
+ float3( 12.176f, 0, 15.38f ),float3( 17.394f, 0, 18.44f ),
+ float3( 20.821f, 0, 21.96f ),float3( 25.406f, 0, 25.10f ),
+ float3( 29.196f, 0, 23.99f ),float3( 31.381f, 0, 19.60f ),
+ float3( 28.708f, 0, 14.89f ),float3( 21.821f, 0, 13.16f )
+ };
+ float3 cam[26] = {
+ float3( 1.86f, -7.21f, -31.52f ), float3( 0.97f, -7.25f, -31.08f ),
+ float3( -1.02f, -3.32f, -29.35f ), float3( -1.77f, -3.69f, -28.79f ),
+ float3( -7.80f, -4.41f, -21.00f ), float3( -8.15f, -5.24f, -20.57f ),
+ float3( -14.72f, -6.29f, -15.06f ), float3( -14.78f, -6.97f, -14.32f ),
+ float3( -20.33f, -6.91f, -10.36f ), float3( -19.81f, -7.57f, -9.81f ),
+ float3( -23.23f, -7.53f, -3.91f ), float3( -22.36f, -8.02f, -3.95f ),
+ float3( -21.29f, -8.22f, 3.83f ), float3( -20.51f, -8.38f, 3.23f ),
+ float3( -15.81f, -8.34f, 6.93f ), float3( -15.37f, -8.50f, 6.05f ),
+ float3( -11.27f, -8.34f, 8.90f ), float3( -10.94f, -8.50f, 7.97f ),
+ float3( -1.07f, -5.07f, 9.41f ), float3( -1.98f, -5.29f, 9.051f ),
+ float3( 9.77f, -7.38f, 13.64f ), float3( 8.84f, -7.33f, 13.28f ),
+ float3( 12.93f, 0.06f, 19.42f ), float3( 12.28f, -0.48f, 18.89f ),
+ float3( 19.39f, 8.09f, 23.33f ), float3( 18.89f, 7.33f, 22.92f ),
+ };
+};
+} // namespace Tmpl8
\ No newline at end of file
diff --git a/tmpl8/lib/GLFW/include/GLFW/glfw3.h b/tmpl8/lib/GLFW/include/GLFW/glfw3.h
new file mode 100644
index 0000000..9c55ac9
--- /dev/null
+++ b/tmpl8/lib/GLFW/include/GLFW/glfw3.h
@@ -0,0 +1,6547 @@
+/*************************************************************************
+ * GLFW 3.4 - www.glfw.org
+ * A library for OpenGL, window and input
+ *------------------------------------------------------------------------
+ * Copyright (c) 2002-2006 Marcus Geelnard
+ * Copyright (c) 2006-2019 Camilla Löwy
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would
+ * be appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not
+ * be misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ *************************************************************************/
+
+#ifndef _glfw3_h_
+#define _glfw3_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*************************************************************************
+ * Doxygen documentation
+ *************************************************************************/
+
+/*! @file glfw3.h
+ * @brief The header of the GLFW 3 API.
+ *
+ * This is the header file of the GLFW 3 API. It defines all its types and
+ * declares all its functions.
+ *
+ * For more information about how to use this file, see @ref build_include.
+ */
+/*! @defgroup context Context reference
+ * @brief Functions and types related to OpenGL and OpenGL ES contexts.
+ *
+ * This is the reference documentation for OpenGL and OpenGL ES context related
+ * functions. For more task-oriented information, see the @ref context_guide.
+ */
+/*! @defgroup vulkan Vulkan support reference
+ * @brief Functions and types related to Vulkan.
+ *
+ * This is the reference documentation for Vulkan related functions and types.
+ * For more task-oriented information, see the @ref vulkan_guide.
+ */
+/*! @defgroup init Initialization, version and error reference
+ * @brief Functions and types related to initialization and error handling.
+ *
+ * This is the reference documentation for initialization and termination of
+ * the library, version management and error handling. For more task-oriented
+ * information, see the @ref intro_guide.
+ */
+/*! @defgroup input Input reference
+ * @brief Functions and types related to input handling.
+ *
+ * This is the reference documentation for input related functions and types.
+ * For more task-oriented information, see the @ref input_guide.
+ */
+/*! @defgroup monitor Monitor reference
+ * @brief Functions and types related to monitors.
+ *
+ * This is the reference documentation for monitor related functions and types.
+ * For more task-oriented information, see the @ref monitor_guide.
+ */
+/*! @defgroup window Window reference
+ * @brief Functions and types related to windows.
+ *
+ * This is the reference documentation for window related functions and types,
+ * including creation, deletion and event polling. For more task-oriented
+ * information, see the @ref window_guide.
+ */
+
+
+/*************************************************************************
+ * Compiler- and platform-specific preprocessor work
+ *************************************************************************/
+
+/* If we are we on Windows, we want a single define for it.
+ */
+#if !defined(_WIN32) && (defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__))
+ #define _WIN32
+#endif /* _WIN32 */
+
+/* Include because most Windows GLU headers need wchar_t and
+ * the macOS OpenGL header blocks the definition of ptrdiff_t by glext.h.
+ * Include it unconditionally to avoid surprising side-effects.
+ */
+#include
+
+/* Include because it is needed by Vulkan and related functions.
+ * Include it unconditionally to avoid surprising side-effects.
+ */
+#include
+
+#if defined(GLFW_INCLUDE_VULKAN)
+ #include
+#endif /* Vulkan header */
+
+/* The Vulkan header may have indirectly included windows.h (because of
+ * VK_USE_PLATFORM_WIN32_KHR) so we offer our replacement symbols after it.
+ */
+
+/* It is customary to use APIENTRY for OpenGL function pointer declarations on
+ * all platforms. Additionally, the Windows OpenGL header needs APIENTRY.
+ */
+#if !defined(APIENTRY)
+ #if defined(_WIN32)
+ #define APIENTRY __stdcall
+ #else
+ #define APIENTRY
+ #endif
+ #define GLFW_APIENTRY_DEFINED
+#endif /* APIENTRY */
+
+/* Some Windows OpenGL headers need this.
+ */
+#if !defined(WINGDIAPI) && defined(_WIN32)
+ #define WINGDIAPI __declspec(dllimport)
+ #define GLFW_WINGDIAPI_DEFINED
+#endif /* WINGDIAPI */
+
+/* Some Windows GLU headers need this.
+ */
+#if !defined(CALLBACK) && defined(_WIN32)
+ #define CALLBACK __stdcall
+ #define GLFW_CALLBACK_DEFINED
+#endif /* CALLBACK */
+
+/* Include the chosen OpenGL or OpenGL ES headers.
+ */
+#if defined(GLFW_INCLUDE_ES1)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+#elif defined(GLFW_INCLUDE_ES2)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+#elif defined(GLFW_INCLUDE_ES3)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+#elif defined(GLFW_INCLUDE_ES31)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+#elif defined(GLFW_INCLUDE_ES32)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+#elif defined(GLFW_INCLUDE_GLCOREARB)
+
+ #if defined(__APPLE__)
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif /*GLFW_INCLUDE_GLEXT*/
+
+ #else /*__APPLE__*/
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+ #endif /*__APPLE__*/
+
+#elif defined(GLFW_INCLUDE_GLU)
+
+ #if defined(__APPLE__)
+
+ #if defined(GLFW_INCLUDE_GLU)
+ #include
+ #endif
+
+ #else /*__APPLE__*/
+
+ #if defined(GLFW_INCLUDE_GLU)
+ #include
+ #endif
+
+ #endif /*__APPLE__*/
+
+#elif !defined(GLFW_INCLUDE_NONE) && \
+ !defined(__gl_h_) && \
+ !defined(__gles1_gl_h_) && \
+ !defined(__gles2_gl2_h_) && \
+ !defined(__gles2_gl3_h_) && \
+ !defined(__gles2_gl31_h_) && \
+ !defined(__gles2_gl32_h_) && \
+ !defined(__gl_glcorearb_h_) && \
+ !defined(__gl2_h_) /*legacy*/ && \
+ !defined(__gl3_h_) /*legacy*/ && \
+ !defined(__gl31_h_) /*legacy*/ && \
+ !defined(__gl32_h_) /*legacy*/ && \
+ !defined(__glcorearb_h_) /*legacy*/ && \
+ !defined(__GL_H__) /*non-standard*/ && \
+ !defined(__gltypes_h_) /*non-standard*/ && \
+ !defined(__glee_h_) /*non-standard*/
+
+ #if defined(__APPLE__)
+
+ #if !defined(GLFW_INCLUDE_GLEXT)
+ #define GL_GLEXT_LEGACY
+ #endif
+ #include
+
+ #else /*__APPLE__*/
+
+ #include
+ #if defined(GLFW_INCLUDE_GLEXT)
+ #include
+ #endif
+
+ #endif /*__APPLE__*/
+
+#endif /* OpenGL and OpenGL ES headers */
+
+#if defined(GLFW_DLL) && defined(_GLFW_BUILD_DLL)
+ /* GLFW_DLL must be defined by applications that are linking against the DLL
+ * version of the GLFW library. _GLFW_BUILD_DLL is defined by the GLFW
+ * configuration header when compiling the DLL version of the library.
+ */
+ #error "You must not have both GLFW_DLL and _GLFW_BUILD_DLL defined"
+#endif
+
+/* GLFWAPI is used to declare public API functions for export
+ * from the DLL / shared library / dynamic library.
+ */
+#if defined(_WIN32) && defined(_GLFW_BUILD_DLL)
+ /* We are building GLFW as a Win32 DLL */
+ #define GLFWAPI __declspec(dllexport)
+#elif defined(_WIN32) && defined(GLFW_DLL)
+ /* We are calling a GLFW Win32 DLL */
+ #define GLFWAPI __declspec(dllimport)
+#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL)
+ /* We are building GLFW as a Unix shared library */
+ #define GLFWAPI __attribute__((visibility("default")))
+#else
+ #define GLFWAPI
+#endif
+
+
+/*************************************************************************
+ * GLFW API tokens
+ *************************************************************************/
+
+/*! @name GLFW version macros
+ * @{ */
+/*! @brief The major version number of the GLFW header.
+ *
+ * The major version number of the GLFW header. This is incremented when the
+ * API is changed in non-compatible ways.
+ * @ingroup init
+ */
+#define GLFW_VERSION_MAJOR 3
+/*! @brief The minor version number of the GLFW header.
+ *
+ * The minor version number of the GLFW header. This is incremented when
+ * features are added to the API but it remains backward-compatible.
+ * @ingroup init
+ */
+#define GLFW_VERSION_MINOR 4
+/*! @brief The revision number of the GLFW header.
+ *
+ * The revision number of the GLFW header. This is incremented when a bug fix
+ * release is made that does not contain any API changes.
+ * @ingroup init
+ */
+#define GLFW_VERSION_REVISION 0
+/*! @} */
+
+/*! @brief One.
+ *
+ * This is only semantic sugar for the number 1. You can instead use `1` or
+ * `true` or `_True` or `GL_TRUE` or `VK_TRUE` or anything else that is equal
+ * to one.
+ *
+ * @ingroup init
+ */
+#define GLFW_TRUE 1
+/*! @brief Zero.
+ *
+ * This is only semantic sugar for the number 0. You can instead use `0` or
+ * `false` or `_False` or `GL_FALSE` or `VK_FALSE` or anything else that is
+ * equal to zero.
+ *
+ * @ingroup init
+ */
+#define GLFW_FALSE 0
+
+/*! @name Key and button actions
+ * @{ */
+/*! @brief The key or mouse button was released.
+ *
+ * The key or mouse button was released.
+ *
+ * @ingroup input
+ */
+#define GLFW_RELEASE 0
+/*! @brief The key or mouse button was pressed.
+ *
+ * The key or mouse button was pressed.
+ *
+ * @ingroup input
+ */
+#define GLFW_PRESS 1
+/*! @brief The key was held down until it repeated.
+ *
+ * The key was held down until it repeated.
+ *
+ * @ingroup input
+ */
+#define GLFW_REPEAT 2
+/*! @} */
+
+/*! @defgroup hat_state Joystick hat states
+ * @brief Joystick hat states.
+ *
+ * See [joystick hat input](@ref joystick_hat) for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+#define GLFW_HAT_CENTERED 0
+#define GLFW_HAT_UP 1
+#define GLFW_HAT_RIGHT 2
+#define GLFW_HAT_DOWN 4
+#define GLFW_HAT_LEFT 8
+#define GLFW_HAT_RIGHT_UP (GLFW_HAT_RIGHT | GLFW_HAT_UP)
+#define GLFW_HAT_RIGHT_DOWN (GLFW_HAT_RIGHT | GLFW_HAT_DOWN)
+#define GLFW_HAT_LEFT_UP (GLFW_HAT_LEFT | GLFW_HAT_UP)
+#define GLFW_HAT_LEFT_DOWN (GLFW_HAT_LEFT | GLFW_HAT_DOWN)
+
+/*! @ingroup input
+ */
+#define GLFW_KEY_UNKNOWN -1
+
+/*! @} */
+
+/*! @defgroup keys Keyboard key tokens
+ * @brief Keyboard key tokens.
+ *
+ * See [key input](@ref input_key) for how these are used.
+ *
+ * These key codes are inspired by the _USB HID Usage Tables v1.12_ (p. 53-60),
+ * but re-arranged to map to 7-bit ASCII for printable keys (function keys are
+ * put in the 256+ range).
+ *
+ * The naming of the key codes follow these rules:
+ * - The US keyboard layout is used
+ * - Names of printable alphanumeric characters are used (e.g. "A", "R",
+ * "3", etc.)
+ * - For non-alphanumeric characters, Unicode:ish names are used (e.g.
+ * "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
+ * correspond to the Unicode standard (usually for brevity)
+ * - Keys that lack a clear US mapping are named "WORLD_x"
+ * - For non-printable keys, custom names are used (e.g. "F4",
+ * "BACKSPACE", etc.)
+ *
+ * @ingroup input
+ * @{
+ */
+
+/* Printable keys */
+#define GLFW_KEY_SPACE 32
+#define GLFW_KEY_APOSTROPHE 39 /* ' */
+#define GLFW_KEY_COMMA 44 /* , */
+#define GLFW_KEY_MINUS 45 /* - */
+#define GLFW_KEY_PERIOD 46 /* . */
+#define GLFW_KEY_SLASH 47 /* / */
+#define GLFW_KEY_0 48
+#define GLFW_KEY_1 49
+#define GLFW_KEY_2 50
+#define GLFW_KEY_3 51
+#define GLFW_KEY_4 52
+#define GLFW_KEY_5 53
+#define GLFW_KEY_6 54
+#define GLFW_KEY_7 55
+#define GLFW_KEY_8 56
+#define GLFW_KEY_9 57
+#define GLFW_KEY_SEMICOLON 59 /* ; */
+#define GLFW_KEY_EQUAL 61 /* = */
+#define GLFW_KEY_A 65
+#define GLFW_KEY_B 66
+#define GLFW_KEY_C 67
+#define GLFW_KEY_D 68
+#define GLFW_KEY_E 69
+#define GLFW_KEY_F 70
+#define GLFW_KEY_G 71
+#define GLFW_KEY_H 72
+#define GLFW_KEY_I 73
+#define GLFW_KEY_J 74
+#define GLFW_KEY_K 75
+#define GLFW_KEY_L 76
+#define GLFW_KEY_M 77
+#define GLFW_KEY_N 78
+#define GLFW_KEY_O 79
+#define GLFW_KEY_P 80
+#define GLFW_KEY_Q 81
+#define GLFW_KEY_R 82
+#define GLFW_KEY_S 83
+#define GLFW_KEY_T 84
+#define GLFW_KEY_U 85
+#define GLFW_KEY_V 86
+#define GLFW_KEY_W 87
+#define GLFW_KEY_X 88
+#define GLFW_KEY_Y 89
+#define GLFW_KEY_Z 90
+#define GLFW_KEY_LEFT_BRACKET 91 /* [ */
+#define GLFW_KEY_BACKSLASH 92 /* \ */
+#define GLFW_KEY_RIGHT_BRACKET 93 /* ] */
+#define GLFW_KEY_GRAVE_ACCENT 96 /* ` */
+#define GLFW_KEY_WORLD_1 161 /* non-US #1 */
+#define GLFW_KEY_WORLD_2 162 /* non-US #2 */
+
+/* Function keys */
+#define GLFW_KEY_ESCAPE 256
+#define GLFW_KEY_ENTER 257
+#define GLFW_KEY_TAB 258
+#define GLFW_KEY_BACKSPACE 259
+#define GLFW_KEY_INSERT 260
+#define GLFW_KEY_DELETE 261
+#define GLFW_KEY_RIGHT 262
+#define GLFW_KEY_LEFT 263
+#define GLFW_KEY_DOWN 264
+#define GLFW_KEY_UP 265
+#define GLFW_KEY_PAGE_UP 266
+#define GLFW_KEY_PAGE_DOWN 267
+#define GLFW_KEY_HOME 268
+#define GLFW_KEY_END 269
+#define GLFW_KEY_CAPS_LOCK 280
+#define GLFW_KEY_SCROLL_LOCK 281
+#define GLFW_KEY_NUM_LOCK 282
+#define GLFW_KEY_PRINT_SCREEN 283
+#define GLFW_KEY_PAUSE 284
+#define GLFW_KEY_F1 290
+#define GLFW_KEY_F2 291
+#define GLFW_KEY_F3 292
+#define GLFW_KEY_F4 293
+#define GLFW_KEY_F5 294
+#define GLFW_KEY_F6 295
+#define GLFW_KEY_F7 296
+#define GLFW_KEY_F8 297
+#define GLFW_KEY_F9 298
+#define GLFW_KEY_F10 299
+#define GLFW_KEY_F11 300
+#define GLFW_KEY_F12 301
+#define GLFW_KEY_F13 302
+#define GLFW_KEY_F14 303
+#define GLFW_KEY_F15 304
+#define GLFW_KEY_F16 305
+#define GLFW_KEY_F17 306
+#define GLFW_KEY_F18 307
+#define GLFW_KEY_F19 308
+#define GLFW_KEY_F20 309
+#define GLFW_KEY_F21 310
+#define GLFW_KEY_F22 311
+#define GLFW_KEY_F23 312
+#define GLFW_KEY_F24 313
+#define GLFW_KEY_F25 314
+#define GLFW_KEY_KP_0 320
+#define GLFW_KEY_KP_1 321
+#define GLFW_KEY_KP_2 322
+#define GLFW_KEY_KP_3 323
+#define GLFW_KEY_KP_4 324
+#define GLFW_KEY_KP_5 325
+#define GLFW_KEY_KP_6 326
+#define GLFW_KEY_KP_7 327
+#define GLFW_KEY_KP_8 328
+#define GLFW_KEY_KP_9 329
+#define GLFW_KEY_KP_DECIMAL 330
+#define GLFW_KEY_KP_DIVIDE 331
+#define GLFW_KEY_KP_MULTIPLY 332
+#define GLFW_KEY_KP_SUBTRACT 333
+#define GLFW_KEY_KP_ADD 334
+#define GLFW_KEY_KP_ENTER 335
+#define GLFW_KEY_KP_EQUAL 336
+#define GLFW_KEY_LEFT_SHIFT 340
+#define GLFW_KEY_LEFT_CONTROL 341
+#define GLFW_KEY_LEFT_ALT 342
+#define GLFW_KEY_LEFT_SUPER 343
+#define GLFW_KEY_RIGHT_SHIFT 344
+#define GLFW_KEY_RIGHT_CONTROL 345
+#define GLFW_KEY_RIGHT_ALT 346
+#define GLFW_KEY_RIGHT_SUPER 347
+#define GLFW_KEY_MENU 348
+
+#define GLFW_KEY_LAST GLFW_KEY_MENU
+
+/*! @} */
+
+/*! @defgroup mods Modifier key flags
+ * @brief Modifier key flags.
+ *
+ * See [key input](@ref input_key) for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+
+/*! @brief If this bit is set one or more Shift keys were held down.
+ *
+ * If this bit is set one or more Shift keys were held down.
+ */
+#define GLFW_MOD_SHIFT 0x0001
+/*! @brief If this bit is set one or more Control keys were held down.
+ *
+ * If this bit is set one or more Control keys were held down.
+ */
+#define GLFW_MOD_CONTROL 0x0002
+/*! @brief If this bit is set one or more Alt keys were held down.
+ *
+ * If this bit is set one or more Alt keys were held down.
+ */
+#define GLFW_MOD_ALT 0x0004
+/*! @brief If this bit is set one or more Super keys were held down.
+ *
+ * If this bit is set one or more Super keys were held down.
+ */
+#define GLFW_MOD_SUPER 0x0008
+/*! @brief If this bit is set the Caps Lock key is enabled.
+ *
+ * If this bit is set the Caps Lock key is enabled and the @ref
+ * GLFW_LOCK_KEY_MODS input mode is set.
+ */
+#define GLFW_MOD_CAPS_LOCK 0x0010
+/*! @brief If this bit is set the Num Lock key is enabled.
+ *
+ * If this bit is set the Num Lock key is enabled and the @ref
+ * GLFW_LOCK_KEY_MODS input mode is set.
+ */
+#define GLFW_MOD_NUM_LOCK 0x0020
+
+/*! @} */
+
+/*! @defgroup buttons Mouse buttons
+ * @brief Mouse button IDs.
+ *
+ * See [mouse button input](@ref input_mouse_button) for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+#define GLFW_MOUSE_BUTTON_1 0
+#define GLFW_MOUSE_BUTTON_2 1
+#define GLFW_MOUSE_BUTTON_3 2
+#define GLFW_MOUSE_BUTTON_4 3
+#define GLFW_MOUSE_BUTTON_5 4
+#define GLFW_MOUSE_BUTTON_6 5
+#define GLFW_MOUSE_BUTTON_7 6
+#define GLFW_MOUSE_BUTTON_8 7
+#define GLFW_MOUSE_BUTTON_LAST GLFW_MOUSE_BUTTON_8
+#define GLFW_MOUSE_BUTTON_LEFT GLFW_MOUSE_BUTTON_1
+#define GLFW_MOUSE_BUTTON_RIGHT GLFW_MOUSE_BUTTON_2
+#define GLFW_MOUSE_BUTTON_MIDDLE GLFW_MOUSE_BUTTON_3
+/*! @} */
+
+/*! @defgroup joysticks Joysticks
+ * @brief Joystick IDs.
+ *
+ * See [joystick input](@ref joystick) for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+#define GLFW_JOYSTICK_1 0
+#define GLFW_JOYSTICK_2 1
+#define GLFW_JOYSTICK_3 2
+#define GLFW_JOYSTICK_4 3
+#define GLFW_JOYSTICK_5 4
+#define GLFW_JOYSTICK_6 5
+#define GLFW_JOYSTICK_7 6
+#define GLFW_JOYSTICK_8 7
+#define GLFW_JOYSTICK_9 8
+#define GLFW_JOYSTICK_10 9
+#define GLFW_JOYSTICK_11 10
+#define GLFW_JOYSTICK_12 11
+#define GLFW_JOYSTICK_13 12
+#define GLFW_JOYSTICK_14 13
+#define GLFW_JOYSTICK_15 14
+#define GLFW_JOYSTICK_16 15
+#define GLFW_JOYSTICK_LAST GLFW_JOYSTICK_16
+/*! @} */
+
+/*! @defgroup gamepad_buttons Gamepad buttons
+ * @brief Gamepad buttons.
+ *
+ * See @ref gamepad for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+#define GLFW_GAMEPAD_BUTTON_A 0
+#define GLFW_GAMEPAD_BUTTON_B 1
+#define GLFW_GAMEPAD_BUTTON_X 2
+#define GLFW_GAMEPAD_BUTTON_Y 3
+#define GLFW_GAMEPAD_BUTTON_LEFT_BUMPER 4
+#define GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER 5
+#define GLFW_GAMEPAD_BUTTON_BACK 6
+#define GLFW_GAMEPAD_BUTTON_START 7
+#define GLFW_GAMEPAD_BUTTON_GUIDE 8
+#define GLFW_GAMEPAD_BUTTON_LEFT_THUMB 9
+#define GLFW_GAMEPAD_BUTTON_RIGHT_THUMB 10
+#define GLFW_GAMEPAD_BUTTON_DPAD_UP 11
+#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT 12
+#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN 13
+#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT 14
+#define GLFW_GAMEPAD_BUTTON_LAST GLFW_GAMEPAD_BUTTON_DPAD_LEFT
+
+#define GLFW_GAMEPAD_BUTTON_CROSS GLFW_GAMEPAD_BUTTON_A
+#define GLFW_GAMEPAD_BUTTON_CIRCLE GLFW_GAMEPAD_BUTTON_B
+#define GLFW_GAMEPAD_BUTTON_SQUARE GLFW_GAMEPAD_BUTTON_X
+#define GLFW_GAMEPAD_BUTTON_TRIANGLE GLFW_GAMEPAD_BUTTON_Y
+/*! @} */
+
+/*! @defgroup gamepad_axes Gamepad axes
+ * @brief Gamepad axes.
+ *
+ * See @ref gamepad for how these are used.
+ *
+ * @ingroup input
+ * @{ */
+#define GLFW_GAMEPAD_AXIS_LEFT_X 0
+#define GLFW_GAMEPAD_AXIS_LEFT_Y 1
+#define GLFW_GAMEPAD_AXIS_RIGHT_X 2
+#define GLFW_GAMEPAD_AXIS_RIGHT_Y 3
+#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER 4
+#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER 5
+#define GLFW_GAMEPAD_AXIS_LAST GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
+/*! @} */
+
+/*! @defgroup errors Error codes
+ * @brief Error codes.
+ *
+ * See [error handling](@ref error_handling) for how these are used.
+ *
+ * @ingroup init
+ * @{ */
+/*! @brief No error has occurred.
+ *
+ * No error has occurred.
+ *
+ * @analysis Yay.
+ */
+#define GLFW_NO_ERROR 0
+/*! @brief GLFW has not been initialized.
+ *
+ * This occurs if a GLFW function was called that must not be called unless the
+ * library is [initialized](@ref intro_init).
+ *
+ * @analysis Application programmer error. Initialize GLFW before calling any
+ * function that requires initialization.
+ */
+#define GLFW_NOT_INITIALIZED 0x00010001
+/*! @brief No context is current for this thread.
+ *
+ * This occurs if a GLFW function was called that needs and operates on the
+ * current OpenGL or OpenGL ES context but no context is current on the calling
+ * thread. One such function is @ref glfwSwapInterval.
+ *
+ * @analysis Application programmer error. Ensure a context is current before
+ * calling functions that require a current context.
+ */
+#define GLFW_NO_CURRENT_CONTEXT 0x00010002
+/*! @brief One of the arguments to the function was an invalid enum value.
+ *
+ * One of the arguments to the function was an invalid enum value, for example
+ * requesting @ref GLFW_RED_BITS with @ref glfwGetWindowAttrib.
+ *
+ * @analysis Application programmer error. Fix the offending call.
+ */
+#define GLFW_INVALID_ENUM 0x00010003
+/*! @brief One of the arguments to the function was an invalid value.
+ *
+ * One of the arguments to the function was an invalid value, for example
+ * requesting a non-existent OpenGL or OpenGL ES version like 2.7.
+ *
+ * Requesting a valid but unavailable OpenGL or OpenGL ES version will instead
+ * result in a @ref GLFW_VERSION_UNAVAILABLE error.
+ *
+ * @analysis Application programmer error. Fix the offending call.
+ */
+#define GLFW_INVALID_VALUE 0x00010004
+/*! @brief A memory allocation failed.
+ *
+ * A memory allocation failed.
+ *
+ * @analysis A bug in GLFW or the underlying operating system. Report the bug
+ * to our [issue tracker](https://github.com/glfw/glfw/issues).
+ */
+#define GLFW_OUT_OF_MEMORY 0x00010005
+/*! @brief GLFW could not find support for the requested API on the system.
+ *
+ * GLFW could not find support for the requested API on the system.
+ *
+ * @analysis The installed graphics driver does not support the requested
+ * API, or does not support it via the chosen context creation API.
+ * Below are a few examples.
+ *
+ * @par
+ * Some pre-installed Windows graphics drivers do not support OpenGL. AMD only
+ * supports OpenGL ES via EGL, while Nvidia and Intel only support it via
+ * a WGL or GLX extension. macOS does not provide OpenGL ES at all. The Mesa
+ * EGL, OpenGL and OpenGL ES libraries do not interface with the Nvidia binary
+ * driver. Older graphics drivers do not support Vulkan.
+ */
+#define GLFW_API_UNAVAILABLE 0x00010006
+/*! @brief The requested OpenGL or OpenGL ES version is not available.
+ *
+ * The requested OpenGL or OpenGL ES version (including any requested context
+ * or framebuffer hints) is not available on this machine.
+ *
+ * @analysis The machine does not support your requirements. If your
+ * application is sufficiently flexible, downgrade your requirements and try
+ * again. Otherwise, inform the user that their machine does not match your
+ * requirements.
+ *
+ * @par
+ * Future invalid OpenGL and OpenGL ES versions, for example OpenGL 4.8 if 5.0
+ * comes out before the 4.x series gets that far, also fail with this error and
+ * not @ref GLFW_INVALID_VALUE, because GLFW cannot know what future versions
+ * will exist.
+ */
+#define GLFW_VERSION_UNAVAILABLE 0x00010007
+/*! @brief A platform-specific error occurred that does not match any of the
+ * more specific categories.
+ *
+ * A platform-specific error occurred that does not match any of the more
+ * specific categories.
+ *
+ * @analysis A bug or configuration error in GLFW, the underlying operating
+ * system or its drivers, or a lack of required resources. Report the issue to
+ * our [issue tracker](https://github.com/glfw/glfw/issues).
+ */
+#define GLFW_PLATFORM_ERROR 0x00010008
+/*! @brief The requested format is not supported or available.
+ *
+ * If emitted during window creation, the requested pixel format is not
+ * supported.
+ *
+ * If emitted when querying the clipboard, the contents of the clipboard could
+ * not be converted to the requested format.
+ *
+ * @analysis If emitted during window creation, one or more
+ * [hard constraints](@ref window_hints_hard) did not match any of the
+ * available pixel formats. If your application is sufficiently flexible,
+ * downgrade your requirements and try again. Otherwise, inform the user that
+ * their machine does not match your requirements.
+ *
+ * @par
+ * If emitted when querying the clipboard, ignore the error or report it to
+ * the user, as appropriate.
+ */
+#define GLFW_FORMAT_UNAVAILABLE 0x00010009
+/*! @brief The specified window does not have an OpenGL or OpenGL ES context.
+ *
+ * A window that does not have an OpenGL or OpenGL ES context was passed to
+ * a function that requires it to have one.
+ *
+ * @analysis Application programmer error. Fix the offending call.
+ */
+#define GLFW_NO_WINDOW_CONTEXT 0x0001000A
+/*! @brief The specified cursor shape is not available.
+ *
+ * The specified standard cursor shape is not available, either because the
+ * current platform cursor theme does not provide it or because it is not
+ * available on the platform.
+ *
+ * @analysis Platform or system settings limitation. Pick another
+ * [standard cursor shape](@ref shapes) or create a
+ * [custom cursor](@ref cursor_custom).
+ */
+#define GLFW_CURSOR_UNAVAILABLE 0x0001000B
+/*! @brief The requested feature is not provided by the platform.
+ *
+ * The requested feature is not provided by the platform, so GLFW is unable to
+ * implement it. The documentation for each function notes if it could emit
+ * this error.
+ *
+ * @analysis Platform or platform version limitation. The error can be ignored
+ * unless the feature is critical to the application.
+ *
+ * @par
+ * A function call that emits this error has no effect other than the error and
+ * updating any existing out parameters.
+ */
+#define GLFW_FEATURE_UNAVAILABLE 0x0001000C
+/*! @brief The requested feature is not implemented for the platform.
+ *
+ * The requested feature has not yet been implemented in GLFW for this platform.
+ *
+ * @analysis An incomplete implementation of GLFW for this platform, hopefully
+ * fixed in a future release. The error can be ignored unless the feature is
+ * critical to the application.
+ *
+ * @par
+ * A function call that emits this error has no effect other than the error and
+ * updating any existing out parameters.
+ */
+#define GLFW_FEATURE_UNIMPLEMENTED 0x0001000D
+/*! @brief Platform unavailable or no matching platform was found.
+ *
+ * If emitted during initialization, no matching platform was found. If the @ref
+ * GLFW_PLATFORM init hint was set to `GLFW_ANY_PLATFORM`, GLFW could not detect any of
+ * the platforms supported by this library binary, except for the Null platform. If the
+ * init hint was set to a specific platform, it is either not supported by this library
+ * binary or GLFW was not able to detect it.
+ *
+ * If emitted by a native access function, GLFW was initialized for a different platform
+ * than the function is for.
+ *
+ * @analysis Failure to detect any platform usually only happens on non-macOS Unix
+ * systems, either when no window system is running or the program was run from
+ * a terminal that does not have the necessary environment variables. Fall back to
+ * a different platform if possible or notify the user that no usable platform was
+ * detected.
+ *
+ * Failure to detect a specific platform may have the same cause as above or be because
+ * support for that platform was not compiled in. Call @ref glfwPlatformSupported to
+ * check whether a specific platform is supported by a library binary.
+ */
+#define GLFW_PLATFORM_UNAVAILABLE 0x0001000E
+/*! @} */
+
+/*! @addtogroup window
+ * @{ */
+/*! @brief Input focus window hint and attribute
+ *
+ * Input focus [window hint](@ref GLFW_FOCUSED_hint) or
+ * [window attribute](@ref GLFW_FOCUSED_attrib).
+ */
+#define GLFW_FOCUSED 0x00020001
+/*! @brief Window iconification window attribute
+ *
+ * Window iconification [window attribute](@ref GLFW_ICONIFIED_attrib).
+ */
+#define GLFW_ICONIFIED 0x00020002
+/*! @brief Window resize-ability window hint and attribute
+ *
+ * Window resize-ability [window hint](@ref GLFW_RESIZABLE_hint) and
+ * [window attribute](@ref GLFW_RESIZABLE_attrib).
+ */
+#define GLFW_RESIZABLE 0x00020003
+/*! @brief Window visibility window hint and attribute
+ *
+ * Window visibility [window hint](@ref GLFW_VISIBLE_hint) and
+ * [window attribute](@ref GLFW_VISIBLE_attrib).
+ */
+#define GLFW_VISIBLE 0x00020004
+/*! @brief Window decoration window hint and attribute
+ *
+ * Window decoration [window hint](@ref GLFW_DECORATED_hint) and
+ * [window attribute](@ref GLFW_DECORATED_attrib).
+ */
+#define GLFW_DECORATED 0x00020005
+/*! @brief Window auto-iconification window hint and attribute
+ *
+ * Window auto-iconification [window hint](@ref GLFW_AUTO_ICONIFY_hint) and
+ * [window attribute](@ref GLFW_AUTO_ICONIFY_attrib).
+ */
+#define GLFW_AUTO_ICONIFY 0x00020006
+/*! @brief Window decoration window hint and attribute
+ *
+ * Window decoration [window hint](@ref GLFW_FLOATING_hint) and
+ * [window attribute](@ref GLFW_FLOATING_attrib).
+ */
+#define GLFW_FLOATING 0x00020007
+/*! @brief Window maximization window hint and attribute
+ *
+ * Window maximization [window hint](@ref GLFW_MAXIMIZED_hint) and
+ * [window attribute](@ref GLFW_MAXIMIZED_attrib).
+ */
+#define GLFW_MAXIMIZED 0x00020008
+/*! @brief Cursor centering window hint
+ *
+ * Cursor centering [window hint](@ref GLFW_CENTER_CURSOR_hint).
+ */
+#define GLFW_CENTER_CURSOR 0x00020009
+/*! @brief Window framebuffer transparency hint and attribute
+ *
+ * Window framebuffer transparency
+ * [window hint](@ref GLFW_TRANSPARENT_FRAMEBUFFER_hint) and
+ * [window attribute](@ref GLFW_TRANSPARENT_FRAMEBUFFER_attrib).
+ */
+#define GLFW_TRANSPARENT_FRAMEBUFFER 0x0002000A
+/*! @brief Mouse cursor hover window attribute.
+ *
+ * Mouse cursor hover [window attribute](@ref GLFW_HOVERED_attrib).
+ */
+#define GLFW_HOVERED 0x0002000B
+/*! @brief Input focus on calling show window hint and attribute
+ *
+ * Input focus [window hint](@ref GLFW_FOCUS_ON_SHOW_hint) or
+ * [window attribute](@ref GLFW_FOCUS_ON_SHOW_attrib).
+ */
+#define GLFW_FOCUS_ON_SHOW 0x0002000C
+
+/*! @brief Mouse input transparency window hint and attribute
+ *
+ * Mouse input transparency [window hint](@ref GLFW_MOUSE_PASSTHROUGH_hint) or
+ * [window attribute](@ref GLFW_MOUSE_PASSTHROUGH_attrib).
+ */
+#define GLFW_MOUSE_PASSTHROUGH 0x0002000D
+
+/*! @brief Initial position x-coordinate window hint.
+ *
+ * Initial position x-coordinate [window hint](@ref GLFW_POSITION_X).
+ */
+#define GLFW_POSITION_X 0x0002000E
+
+/*! @brief Initial position y-coordinate window hint.
+ *
+ * Initial position y-coordinate [window hint](@ref GLFW_POSITION_Y).
+ */
+#define GLFW_POSITION_Y 0x0002000F
+
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_RED_BITS).
+ */
+#define GLFW_RED_BITS 0x00021001
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_GREEN_BITS).
+ */
+#define GLFW_GREEN_BITS 0x00021002
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_BLUE_BITS).
+ */
+#define GLFW_BLUE_BITS 0x00021003
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_ALPHA_BITS).
+ */
+#define GLFW_ALPHA_BITS 0x00021004
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_DEPTH_BITS).
+ */
+#define GLFW_DEPTH_BITS 0x00021005
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_STENCIL_BITS).
+ */
+#define GLFW_STENCIL_BITS 0x00021006
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_ACCUM_RED_BITS).
+ */
+#define GLFW_ACCUM_RED_BITS 0x00021007
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_ACCUM_GREEN_BITS).
+ */
+#define GLFW_ACCUM_GREEN_BITS 0x00021008
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_ACCUM_BLUE_BITS).
+ */
+#define GLFW_ACCUM_BLUE_BITS 0x00021009
+/*! @brief Framebuffer bit depth hint.
+ *
+ * Framebuffer bit depth [hint](@ref GLFW_ACCUM_ALPHA_BITS).
+ */
+#define GLFW_ACCUM_ALPHA_BITS 0x0002100A
+/*! @brief Framebuffer auxiliary buffer hint.
+ *
+ * Framebuffer auxiliary buffer [hint](@ref GLFW_AUX_BUFFERS).
+ */
+#define GLFW_AUX_BUFFERS 0x0002100B
+/*! @brief OpenGL stereoscopic rendering hint.
+ *
+ * OpenGL stereoscopic rendering [hint](@ref GLFW_STEREO).
+ */
+#define GLFW_STEREO 0x0002100C
+/*! @brief Framebuffer MSAA samples hint.
+ *
+ * Framebuffer MSAA samples [hint](@ref GLFW_SAMPLES).
+ */
+#define GLFW_SAMPLES 0x0002100D
+/*! @brief Framebuffer sRGB hint.
+ *
+ * Framebuffer sRGB [hint](@ref GLFW_SRGB_CAPABLE).
+ */
+#define GLFW_SRGB_CAPABLE 0x0002100E
+/*! @brief Monitor refresh rate hint.
+ *
+ * Monitor refresh rate [hint](@ref GLFW_REFRESH_RATE).
+ */
+#define GLFW_REFRESH_RATE 0x0002100F
+/*! @brief Framebuffer double buffering hint and attribute.
+ *
+ * Framebuffer double buffering [hint](@ref GLFW_DOUBLEBUFFER_hint) and
+ * [attribute](@ref GLFW_DOUBLEBUFFER_attrib).
+ */
+#define GLFW_DOUBLEBUFFER 0x00021010
+
+/*! @brief Context client API hint and attribute.
+ *
+ * Context client API [hint](@ref GLFW_CLIENT_API_hint) and
+ * [attribute](@ref GLFW_CLIENT_API_attrib).
+ */
+#define GLFW_CLIENT_API 0x00022001
+/*! @brief Context client API major version hint and attribute.
+ *
+ * Context client API major version [hint](@ref GLFW_CONTEXT_VERSION_MAJOR_hint)
+ * and [attribute](@ref GLFW_CONTEXT_VERSION_MAJOR_attrib).
+ */
+#define GLFW_CONTEXT_VERSION_MAJOR 0x00022002
+/*! @brief Context client API minor version hint and attribute.
+ *
+ * Context client API minor version [hint](@ref GLFW_CONTEXT_VERSION_MINOR_hint)
+ * and [attribute](@ref GLFW_CONTEXT_VERSION_MINOR_attrib).
+ */
+#define GLFW_CONTEXT_VERSION_MINOR 0x00022003
+/*! @brief Context client API revision number attribute.
+ *
+ * Context client API revision number
+ * [attribute](@ref GLFW_CONTEXT_REVISION_attrib).
+ */
+#define GLFW_CONTEXT_REVISION 0x00022004
+/*! @brief Context robustness hint and attribute.
+ *
+ * Context client API revision number [hint](@ref GLFW_CONTEXT_ROBUSTNESS_hint)
+ * and [attribute](@ref GLFW_CONTEXT_ROBUSTNESS_attrib).
+ */
+#define GLFW_CONTEXT_ROBUSTNESS 0x00022005
+/*! @brief OpenGL forward-compatibility hint and attribute.
+ *
+ * OpenGL forward-compatibility [hint](@ref GLFW_OPENGL_FORWARD_COMPAT_hint)
+ * and [attribute](@ref GLFW_OPENGL_FORWARD_COMPAT_attrib).
+ */
+#define GLFW_OPENGL_FORWARD_COMPAT 0x00022006
+/*! @brief Debug mode context hint and attribute.
+ *
+ * Debug mode context [hint](@ref GLFW_CONTEXT_DEBUG_hint) and
+ * [attribute](@ref GLFW_CONTEXT_DEBUG_attrib).
+ */
+#define GLFW_CONTEXT_DEBUG 0x00022007
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_OPENGL_DEBUG_CONTEXT GLFW_CONTEXT_DEBUG
+/*! @brief OpenGL profile hint and attribute.
+ *
+ * OpenGL profile [hint](@ref GLFW_OPENGL_PROFILE_hint) and
+ * [attribute](@ref GLFW_OPENGL_PROFILE_attrib).
+ */
+#define GLFW_OPENGL_PROFILE 0x00022008
+/*! @brief Context flush-on-release hint and attribute.
+ *
+ * Context flush-on-release [hint](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint) and
+ * [attribute](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_attrib).
+ */
+#define GLFW_CONTEXT_RELEASE_BEHAVIOR 0x00022009
+/*! @brief Context error suppression hint and attribute.
+ *
+ * Context error suppression [hint](@ref GLFW_CONTEXT_NO_ERROR_hint) and
+ * [attribute](@ref GLFW_CONTEXT_NO_ERROR_attrib).
+ */
+#define GLFW_CONTEXT_NO_ERROR 0x0002200A
+/*! @brief Context creation API hint and attribute.
+ *
+ * Context creation API [hint](@ref GLFW_CONTEXT_CREATION_API_hint) and
+ * [attribute](@ref GLFW_CONTEXT_CREATION_API_attrib).
+ */
+#define GLFW_CONTEXT_CREATION_API 0x0002200B
+/*! @brief Window content area scaling window
+ * [window hint](@ref GLFW_SCALE_TO_MONITOR).
+ */
+#define GLFW_SCALE_TO_MONITOR 0x0002200C
+/*! @brief Window framebuffer scaling
+ * [window hint](@ref GLFW_SCALE_FRAMEBUFFER_hint).
+ */
+#define GLFW_SCALE_FRAMEBUFFER 0x0002200D
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for the
+ * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint) window hint for
+ * compatibility with earlier versions.
+ */
+#define GLFW_COCOA_RETINA_FRAMEBUFFER 0x00023001
+/*! @brief macOS specific
+ * [window hint](@ref GLFW_COCOA_FRAME_NAME_hint).
+ */
+#define GLFW_COCOA_FRAME_NAME 0x00023002
+/*! @brief macOS specific
+ * [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
+ */
+#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
+/*! @brief X11 specific
+ * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
+ */
+#define GLFW_X11_CLASS_NAME 0x00024001
+/*! @brief X11 specific
+ * [window hint](@ref GLFW_X11_CLASS_NAME_hint).
+ */
+#define GLFW_X11_INSTANCE_NAME 0x00024002
+#define GLFW_WIN32_KEYBOARD_MENU 0x00025001
+/*! @brief Win32 specific [window hint](@ref GLFW_WIN32_SHOWDEFAULT_hint).
+ */
+#define GLFW_WIN32_SHOWDEFAULT 0x00025002
+/*! @brief Wayland specific
+ * [window hint](@ref GLFW_WAYLAND_APP_ID_hint).
+ *
+ * Allows specification of the Wayland app_id.
+ */
+#define GLFW_WAYLAND_APP_ID 0x00026001
+/*! @} */
+
+#define GLFW_NO_API 0
+#define GLFW_OPENGL_API 0x00030001
+#define GLFW_OPENGL_ES_API 0x00030002
+
+#define GLFW_NO_ROBUSTNESS 0
+#define GLFW_NO_RESET_NOTIFICATION 0x00031001
+#define GLFW_LOSE_CONTEXT_ON_RESET 0x00031002
+
+#define GLFW_OPENGL_ANY_PROFILE 0
+#define GLFW_OPENGL_CORE_PROFILE 0x00032001
+#define GLFW_OPENGL_COMPAT_PROFILE 0x00032002
+
+#define GLFW_CURSOR 0x00033001
+#define GLFW_STICKY_KEYS 0x00033002
+#define GLFW_STICKY_MOUSE_BUTTONS 0x00033003
+#define GLFW_LOCK_KEY_MODS 0x00033004
+#define GLFW_RAW_MOUSE_MOTION 0x00033005
+
+#define GLFW_CURSOR_NORMAL 0x00034001
+#define GLFW_CURSOR_HIDDEN 0x00034002
+#define GLFW_CURSOR_DISABLED 0x00034003
+#define GLFW_CURSOR_CAPTURED 0x00034004
+
+#define GLFW_ANY_RELEASE_BEHAVIOR 0
+#define GLFW_RELEASE_BEHAVIOR_FLUSH 0x00035001
+#define GLFW_RELEASE_BEHAVIOR_NONE 0x00035002
+
+#define GLFW_NATIVE_CONTEXT_API 0x00036001
+#define GLFW_EGL_CONTEXT_API 0x00036002
+#define GLFW_OSMESA_CONTEXT_API 0x00036003
+
+#define GLFW_ANGLE_PLATFORM_TYPE_NONE 0x00037001
+#define GLFW_ANGLE_PLATFORM_TYPE_OPENGL 0x00037002
+#define GLFW_ANGLE_PLATFORM_TYPE_OPENGLES 0x00037003
+#define GLFW_ANGLE_PLATFORM_TYPE_D3D9 0x00037004
+#define GLFW_ANGLE_PLATFORM_TYPE_D3D11 0x00037005
+#define GLFW_ANGLE_PLATFORM_TYPE_VULKAN 0x00037007
+#define GLFW_ANGLE_PLATFORM_TYPE_METAL 0x00037008
+
+#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
+#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
+
+#define GLFW_ANY_POSITION 0x80000000
+
+/*! @defgroup shapes Standard cursor shapes
+ * @brief Standard system cursor shapes.
+ *
+ * These are the [standard cursor shapes](@ref cursor_standard) that can be
+ * requested from the platform (window system).
+ *
+ * @ingroup input
+ * @{ */
+
+/*! @brief The regular arrow cursor shape.
+ *
+ * The regular arrow cursor shape.
+ */
+#define GLFW_ARROW_CURSOR 0x00036001
+/*! @brief The text input I-beam cursor shape.
+ *
+ * The text input I-beam cursor shape.
+ */
+#define GLFW_IBEAM_CURSOR 0x00036002
+/*! @brief The crosshair cursor shape.
+ *
+ * The crosshair cursor shape.
+ */
+#define GLFW_CROSSHAIR_CURSOR 0x00036003
+/*! @brief The pointing hand cursor shape.
+ *
+ * The pointing hand cursor shape.
+ */
+#define GLFW_POINTING_HAND_CURSOR 0x00036004
+/*! @brief The horizontal resize/move arrow shape.
+ *
+ * The horizontal resize/move arrow shape. This is usually a horizontal
+ * double-headed arrow.
+ */
+#define GLFW_RESIZE_EW_CURSOR 0x00036005
+/*! @brief The vertical resize/move arrow shape.
+ *
+ * The vertical resize/move shape. This is usually a vertical double-headed
+ * arrow.
+ */
+#define GLFW_RESIZE_NS_CURSOR 0x00036006
+/*! @brief The top-left to bottom-right diagonal resize/move arrow shape.
+ *
+ * The top-left to bottom-right diagonal resize/move shape. This is usually
+ * a diagonal double-headed arrow.
+ *
+ * @note @macos This shape is provided by a private system API and may fail
+ * with @ref GLFW_CURSOR_UNAVAILABLE in the future.
+ *
+ * @note @wayland This shape is provided by a newer standard not supported by
+ * all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
+ */
+#define GLFW_RESIZE_NWSE_CURSOR 0x00036007
+/*! @brief The top-right to bottom-left diagonal resize/move arrow shape.
+ *
+ * The top-right to bottom-left diagonal resize/move shape. This is usually
+ * a diagonal double-headed arrow.
+ *
+ * @note @macos This shape is provided by a private system API and may fail
+ * with @ref GLFW_CURSOR_UNAVAILABLE in the future.
+ *
+ * @note @wayland This shape is provided by a newer standard not supported by
+ * all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
+ */
+#define GLFW_RESIZE_NESW_CURSOR 0x00036008
+/*! @brief The omni-directional resize/move cursor shape.
+ *
+ * The omni-directional resize cursor/move shape. This is usually either
+ * a combined horizontal and vertical double-headed arrow or a grabbing hand.
+ */
+#define GLFW_RESIZE_ALL_CURSOR 0x00036009
+/*! @brief The operation-not-allowed shape.
+ *
+ * The operation-not-allowed shape. This is usually a circle with a diagonal
+ * line through it.
+ *
+ * @note @wayland This shape is provided by a newer standard not supported by
+ * all cursor themes.
+ *
+ * @note @x11 This shape is provided by a newer standard not supported by all
+ * cursor themes.
+ */
+#define GLFW_NOT_ALLOWED_CURSOR 0x0003600A
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_HRESIZE_CURSOR GLFW_RESIZE_EW_CURSOR
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_VRESIZE_CURSOR GLFW_RESIZE_NS_CURSOR
+/*! @brief Legacy name for compatibility.
+ *
+ * This is an alias for compatibility with earlier versions.
+ */
+#define GLFW_HAND_CURSOR GLFW_POINTING_HAND_CURSOR
+/*! @} */
+
+#define GLFW_CONNECTED 0x00040001
+#define GLFW_DISCONNECTED 0x00040002
+
+/*! @addtogroup init
+ * @{ */
+/*! @brief Joystick hat buttons init hint.
+ *
+ * Joystick hat buttons [init hint](@ref GLFW_JOYSTICK_HAT_BUTTONS).
+ */
+#define GLFW_JOYSTICK_HAT_BUTTONS 0x00050001
+/*! @brief ANGLE rendering backend init hint.
+ *
+ * ANGLE rendering backend [init hint](@ref GLFW_ANGLE_PLATFORM_TYPE_hint).
+ */
+#define GLFW_ANGLE_PLATFORM_TYPE 0x00050002
+/*! @brief Platform selection init hint.
+ *
+ * Platform selection [init hint](@ref GLFW_PLATFORM).
+ */
+#define GLFW_PLATFORM 0x00050003
+/*! @brief macOS specific init hint.
+ *
+ * macOS specific [init hint](@ref GLFW_COCOA_CHDIR_RESOURCES_hint).
+ */
+#define GLFW_COCOA_CHDIR_RESOURCES 0x00051001
+/*! @brief macOS specific init hint.
+ *
+ * macOS specific [init hint](@ref GLFW_COCOA_MENUBAR_hint).
+ */
+#define GLFW_COCOA_MENUBAR 0x00051002
+/*! @brief X11 specific init hint.
+ *
+ * X11 specific [init hint](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint).
+ */
+#define GLFW_X11_XCB_VULKAN_SURFACE 0x00052001
+/*! @brief Wayland specific init hint.
+ *
+ * Wayland specific [init hint](@ref GLFW_WAYLAND_LIBDECOR_hint).
+ */
+#define GLFW_WAYLAND_LIBDECOR 0x00053001
+/*! @} */
+
+/*! @addtogroup init
+ * @{ */
+/*! @brief Hint value that enables automatic platform selection.
+ *
+ * Hint value for @ref GLFW_PLATFORM that enables automatic platform selection.
+ */
+#define GLFW_ANY_PLATFORM 0x00060000
+#define GLFW_PLATFORM_WIN32 0x00060001
+#define GLFW_PLATFORM_COCOA 0x00060002
+#define GLFW_PLATFORM_WAYLAND 0x00060003
+#define GLFW_PLATFORM_X11 0x00060004
+#define GLFW_PLATFORM_NULL 0x00060005
+/*! @} */
+
+#define GLFW_DONT_CARE -1
+
+
+/*************************************************************************
+ * GLFW API types
+ *************************************************************************/
+
+/*! @brief Client API function pointer type.
+ *
+ * Generic function pointer used for returning client API function pointers
+ * without forcing a cast from a regular pointer.
+ *
+ * @sa @ref context_glext
+ * @sa @ref glfwGetProcAddress
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup context
+ */
+typedef void (*GLFWglproc)(void);
+
+/*! @brief Vulkan API function pointer type.
+ *
+ * Generic function pointer used for returning Vulkan API function pointers
+ * without forcing a cast from a regular pointer.
+ *
+ * @sa @ref vulkan_proc
+ * @sa @ref glfwGetInstanceProcAddress
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+typedef void (*GLFWvkproc)(void);
+
+/*! @brief Opaque monitor object.
+ *
+ * Opaque monitor object.
+ *
+ * @see @ref monitor_object
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+typedef struct GLFWmonitor GLFWmonitor;
+
+/*! @brief Opaque window object.
+ *
+ * Opaque window object.
+ *
+ * @see @ref window_object
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+typedef struct GLFWwindow GLFWwindow;
+
+/*! @brief Opaque cursor object.
+ *
+ * Opaque cursor object.
+ *
+ * @see @ref cursor_object
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+typedef struct GLFWcursor GLFWcursor;
+
+/*! @brief The function pointer type for memory allocation callbacks.
+ *
+ * This is the function pointer type for memory allocation callbacks. A memory
+ * allocation callback function has the following signature:
+ * @code
+ * void* function_name(size_t size, void* user)
+ * @endcode
+ *
+ * This function must return either a memory block at least `size` bytes long,
+ * or `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
+ * failures gracefully yet.
+ *
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
+ *
+ * Any memory allocated via this function will be deallocated via the same allocator
+ * during library termination or earlier.
+ *
+ * Any memory allocated via this function must be suitably aligned for any object type.
+ * If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ * same as what `malloc` provides. If you are using C11 or later, this is the value of
+ * `alignof(max_align_t)`.
+ *
+ * The size will always be greater than zero. Allocations of size zero are filtered out
+ * before reaching the custom allocator.
+ *
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
+ *
+ * @param[in] size The minimum size, in bytes, of the memory block.
+ * @param[in] user The user-defined pointer from the allocator.
+ * @return The address of the newly allocated memory block, or `NULL` if an
+ * error occurred.
+ *
+ * @pointer_lifetime The returned memory block must be valid at least until it
+ * is deallocated.
+ *
+ * @reentrancy This function should not call any GLFW function.
+ *
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
+ *
+ * @sa @ref init_allocator
+ * @sa @ref GLFWallocator
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+typedef void* (* GLFWallocatefun)(size_t size, void* user);
+
+/*! @brief The function pointer type for memory reallocation callbacks.
+ *
+ * This is the function pointer type for memory reallocation callbacks.
+ * A memory reallocation callback function has the following signature:
+ * @code
+ * void* function_name(void* block, size_t size, void* user)
+ * @endcode
+ *
+ * This function must return a memory block at least `size` bytes long, or
+ * `NULL` if allocation failed. Note that not all parts of GLFW handle allocation
+ * failures gracefully yet.
+ *
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
+ *
+ * Any memory allocated via this function will be deallocated via the same allocator
+ * during library termination or earlier.
+ *
+ * Any memory allocated via this function must be suitably aligned for any object type.
+ * If you are using C99 or earlier, this alignment is platform-dependent but will be the
+ * same as what `realloc` provides. If you are using C11 or later, this is the value of
+ * `alignof(max_align_t)`.
+ *
+ * The block address will never be `NULL` and the size will always be greater than zero.
+ * Reallocations of a block to size zero are converted into deallocations before reaching
+ * the custom allocator. Reallocations of `NULL` to a non-zero size are converted into
+ * regular allocations before reaching the custom allocator.
+ *
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
+ *
+ * @param[in] block The address of the memory block to reallocate.
+ * @param[in] size The new minimum size, in bytes, of the memory block.
+ * @param[in] user The user-defined pointer from the allocator.
+ * @return The address of the newly allocated or resized memory block, or
+ * `NULL` if an error occurred.
+ *
+ * @pointer_lifetime The returned memory block must be valid at least until it
+ * is deallocated.
+ *
+ * @reentrancy This function should not call any GLFW function.
+ *
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
+ *
+ * @sa @ref init_allocator
+ * @sa @ref GLFWallocator
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+typedef void* (* GLFWreallocatefun)(void* block, size_t size, void* user);
+
+/*! @brief The function pointer type for memory deallocation callbacks.
+ *
+ * This is the function pointer type for memory deallocation callbacks.
+ * A memory deallocation callback function has the following signature:
+ * @code
+ * void function_name(void* block, void* user)
+ * @endcode
+ *
+ * This function may deallocate the specified memory block. This memory block
+ * will have been allocated with the same allocator.
+ *
+ * This function must support being called during @ref glfwInit but before the library is
+ * flagged as initialized, as well as during @ref glfwTerminate after the library is no
+ * longer flagged as initialized.
+ *
+ * The block address will never be `NULL`. Deallocations of `NULL` are filtered out
+ * before reaching the custom allocator.
+ *
+ * If this function returns `NULL`, GLFW will emit @ref GLFW_OUT_OF_MEMORY.
+ *
+ * This function must not call any GLFW function.
+ *
+ * @param[in] block The address of the memory block to deallocate.
+ * @param[in] user The user-defined pointer from the allocator.
+ *
+ * @pointer_lifetime The specified memory block will not be accessed by GLFW
+ * after this function is called.
+ *
+ * @reentrancy This function should not call any GLFW function.
+ *
+ * @thread_safety This function must support being called from any thread that calls GLFW
+ * functions.
+ *
+ * @sa @ref init_allocator
+ * @sa @ref GLFWallocator
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+typedef void (* GLFWdeallocatefun)(void* block, void* user);
+
+/*! @brief The function pointer type for error callbacks.
+ *
+ * This is the function pointer type for error callbacks. An error callback
+ * function has the following signature:
+ * @code
+ * void callback_name(int error_code, const char* description)
+ * @endcode
+ *
+ * @param[in] error_code An [error code](@ref errors). Future releases may add
+ * more error codes.
+ * @param[in] description A UTF-8 encoded string describing the error.
+ *
+ * @pointer_lifetime The error description string is valid until the callback
+ * function returns.
+ *
+ * @sa @ref error_handling
+ * @sa @ref glfwSetErrorCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup init
+ */
+typedef void (* GLFWerrorfun)(int error_code, const char* description);
+
+/*! @brief The function pointer type for window position callbacks.
+ *
+ * This is the function pointer type for window position callbacks. A window
+ * position callback function has the following signature:
+ * @code
+ * void callback_name(GLFWwindow* window, int xpos, int ypos)
+ * @endcode
+ *
+ * @param[in] window The window that was moved.
+ * @param[in] xpos The new x-coordinate, in screen coordinates, of the
+ * upper-left corner of the content area of the window.
+ * @param[in] ypos The new y-coordinate, in screen coordinates, of the
+ * upper-left corner of the content area of the window.
+ *
+ * @sa @ref window_pos
+ * @sa @ref glfwSetWindowPosCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowposfun)(GLFWwindow* window, int xpos, int ypos);
+
+/*! @brief The function pointer type for window size callbacks.
+ *
+ * This is the function pointer type for window size callbacks. A window size
+ * callback function has the following signature:
+ * @code
+ * void callback_name(GLFWwindow* window, int width, int height)
+ * @endcode
+ *
+ * @param[in] window The window that was resized.
+ * @param[in] width The new width, in screen coordinates, of the window.
+ * @param[in] height The new height, in screen coordinates, of the window.
+ *
+ * @sa @ref window_size
+ * @sa @ref glfwSetWindowSizeCallback
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowsizefun)(GLFWwindow* window, int width, int height);
+
+/*! @brief The function pointer type for window close callbacks.
+ *
+ * This is the function pointer type for window close callbacks. A window
+ * close callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window)
+ * @endcode
+ *
+ * @param[in] window The window that the user attempted to close.
+ *
+ * @sa @ref window_close
+ * @sa @ref glfwSetWindowCloseCallback
+ *
+ * @since Added in version 2.5.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowclosefun)(GLFWwindow* window);
+
+/*! @brief The function pointer type for window content refresh callbacks.
+ *
+ * This is the function pointer type for window content refresh callbacks.
+ * A window content refresh callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window);
+ * @endcode
+ *
+ * @param[in] window The window whose content needs to be refreshed.
+ *
+ * @sa @ref window_refresh
+ * @sa @ref glfwSetWindowRefreshCallback
+ *
+ * @since Added in version 2.5.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowrefreshfun)(GLFWwindow* window);
+
+/*! @brief The function pointer type for window focus callbacks.
+ *
+ * This is the function pointer type for window focus callbacks. A window
+ * focus callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int focused)
+ * @endcode
+ *
+ * @param[in] window The window that gained or lost input focus.
+ * @param[in] focused `GLFW_TRUE` if the window was given input focus, or
+ * `GLFW_FALSE` if it lost it.
+ *
+ * @sa @ref window_focus
+ * @sa @ref glfwSetWindowFocusCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowfocusfun)(GLFWwindow* window, int focused);
+
+/*! @brief The function pointer type for window iconify callbacks.
+ *
+ * This is the function pointer type for window iconify callbacks. A window
+ * iconify callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int iconified)
+ * @endcode
+ *
+ * @param[in] window The window that was iconified or restored.
+ * @param[in] iconified `GLFW_TRUE` if the window was iconified, or
+ * `GLFW_FALSE` if it was restored.
+ *
+ * @sa @ref window_iconify
+ * @sa @ref glfwSetWindowIconifyCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowiconifyfun)(GLFWwindow* window, int iconified);
+
+/*! @brief The function pointer type for window maximize callbacks.
+ *
+ * This is the function pointer type for window maximize callbacks. A window
+ * maximize callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int maximized)
+ * @endcode
+ *
+ * @param[in] window The window that was maximized or restored.
+ * @param[in] maximized `GLFW_TRUE` if the window was maximized, or
+ * `GLFW_FALSE` if it was restored.
+ *
+ * @sa @ref window_maximize
+ * @sa glfwSetWindowMaximizeCallback
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowmaximizefun)(GLFWwindow* window, int maximized);
+
+/*! @brief The function pointer type for framebuffer size callbacks.
+ *
+ * This is the function pointer type for framebuffer size callbacks.
+ * A framebuffer size callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int width, int height)
+ * @endcode
+ *
+ * @param[in] window The window whose framebuffer was resized.
+ * @param[in] width The new width, in pixels, of the framebuffer.
+ * @param[in] height The new height, in pixels, of the framebuffer.
+ *
+ * @sa @ref window_fbsize
+ * @sa @ref glfwSetFramebufferSizeCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWframebuffersizefun)(GLFWwindow* window, int width, int height);
+
+/*! @brief The function pointer type for window content scale callbacks.
+ *
+ * This is the function pointer type for window content scale callbacks.
+ * A window content scale callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, float xscale, float yscale)
+ * @endcode
+ *
+ * @param[in] window The window whose content scale changed.
+ * @param[in] xscale The new x-axis content scale of the window.
+ * @param[in] yscale The new y-axis content scale of the window.
+ *
+ * @sa @ref window_scale
+ * @sa @ref glfwSetWindowContentScaleCallback
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+typedef void (* GLFWwindowcontentscalefun)(GLFWwindow* window, float xscale, float yscale);
+
+/*! @brief The function pointer type for mouse button callbacks.
+ *
+ * This is the function pointer type for mouse button callback functions.
+ * A mouse button callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int button, int action, int mods)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] button The [mouse button](@ref buttons) that was pressed or
+ * released.
+ * @param[in] action One of `GLFW_PRESS` or `GLFW_RELEASE`. Future releases
+ * may add more actions.
+ * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ * held down.
+ *
+ * @sa @ref input_mouse_button
+ * @sa @ref glfwSetMouseButtonCallback
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle and modifier mask parameters.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWmousebuttonfun)(GLFWwindow* window, int button, int action, int mods);
+
+/*! @brief The function pointer type for cursor position callbacks.
+ *
+ * This is the function pointer type for cursor position callbacks. A cursor
+ * position callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, double xpos, double ypos);
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] xpos The new cursor x-coordinate, relative to the left edge of
+ * the content area.
+ * @param[in] ypos The new cursor y-coordinate, relative to the top edge of the
+ * content area.
+ *
+ * @sa @ref cursor_pos
+ * @sa @ref glfwSetCursorPosCallback
+ *
+ * @since Added in version 3.0. Replaces `GLFWmouseposfun`.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWcursorposfun)(GLFWwindow* window, double xpos, double ypos);
+
+/*! @brief The function pointer type for cursor enter/leave callbacks.
+ *
+ * This is the function pointer type for cursor enter/leave callbacks.
+ * A cursor enter/leave callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int entered)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] entered `GLFW_TRUE` if the cursor entered the window's content
+ * area, or `GLFW_FALSE` if it left it.
+ *
+ * @sa @ref cursor_enter
+ * @sa @ref glfwSetCursorEnterCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWcursorenterfun)(GLFWwindow* window, int entered);
+
+/*! @brief The function pointer type for scroll callbacks.
+ *
+ * This is the function pointer type for scroll callbacks. A scroll callback
+ * function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, double xoffset, double yoffset)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] xoffset The scroll offset along the x-axis.
+ * @param[in] yoffset The scroll offset along the y-axis.
+ *
+ * @sa @ref scrolling
+ * @sa @ref glfwSetScrollCallback
+ *
+ * @since Added in version 3.0. Replaces `GLFWmousewheelfun`.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWscrollfun)(GLFWwindow* window, double xoffset, double yoffset);
+
+/*! @brief The function pointer type for keyboard key callbacks.
+ *
+ * This is the function pointer type for keyboard key callbacks. A keyboard
+ * key callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] key The [keyboard key](@ref keys) that was pressed or released.
+ * @param[in] scancode The platform-specific scancode of the key.
+ * @param[in] action `GLFW_PRESS`, `GLFW_RELEASE` or `GLFW_REPEAT`. Future
+ * releases may add more actions.
+ * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ * held down.
+ *
+ * @sa @ref input_key
+ * @sa @ref glfwSetKeyCallback
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle, scancode and modifier mask parameters.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWkeyfun)(GLFWwindow* window, int key, int scancode, int action, int mods);
+
+/*! @brief The function pointer type for Unicode character callbacks.
+ *
+ * This is the function pointer type for Unicode character callbacks.
+ * A Unicode character callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, unsigned int codepoint)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] codepoint The Unicode code point of the character.
+ *
+ * @sa @ref input_char
+ * @sa @ref glfwSetCharCallback
+ *
+ * @since Added in version 2.4.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWcharfun)(GLFWwindow* window, unsigned int codepoint);
+
+/*! @brief The function pointer type for Unicode character with modifiers
+ * callbacks.
+ *
+ * This is the function pointer type for Unicode character with modifiers
+ * callbacks. It is called for each input character, regardless of what
+ * modifier keys are held down. A Unicode character with modifiers callback
+ * function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] codepoint The Unicode code point of the character.
+ * @param[in] mods Bit field describing which [modifier keys](@ref mods) were
+ * held down.
+ *
+ * @sa @ref input_char
+ * @sa @ref glfwSetCharModsCallback
+ *
+ * @deprecated Scheduled for removal in version 4.0.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWcharmodsfun)(GLFWwindow* window, unsigned int codepoint, int mods);
+
+/*! @brief The function pointer type for path drop callbacks.
+ *
+ * This is the function pointer type for path drop callbacks. A path drop
+ * callback function has the following signature:
+ * @code
+ * void function_name(GLFWwindow* window, int path_count, const char* paths[])
+ * @endcode
+ *
+ * @param[in] window The window that received the event.
+ * @param[in] path_count The number of dropped paths.
+ * @param[in] paths The UTF-8 encoded file and/or directory path names.
+ *
+ * @pointer_lifetime The path array and its strings are valid until the
+ * callback function returns.
+ *
+ * @sa @ref path_drop
+ * @sa @ref glfwSetDropCallback
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWdropfun)(GLFWwindow* window, int path_count, const char* paths[]);
+
+/*! @brief The function pointer type for monitor configuration callbacks.
+ *
+ * This is the function pointer type for monitor configuration callbacks.
+ * A monitor callback function has the following signature:
+ * @code
+ * void function_name(GLFWmonitor* monitor, int event)
+ * @endcode
+ *
+ * @param[in] monitor The monitor that was connected or disconnected.
+ * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future
+ * releases may add more events.
+ *
+ * @sa @ref monitor_event
+ * @sa @ref glfwSetMonitorCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+typedef void (* GLFWmonitorfun)(GLFWmonitor* monitor, int event);
+
+/*! @brief The function pointer type for joystick configuration callbacks.
+ *
+ * This is the function pointer type for joystick configuration callbacks.
+ * A joystick configuration callback function has the following signature:
+ * @code
+ * void function_name(int jid, int event)
+ * @endcode
+ *
+ * @param[in] jid The joystick that was connected or disconnected.
+ * @param[in] event One of `GLFW_CONNECTED` or `GLFW_DISCONNECTED`. Future
+ * releases may add more events.
+ *
+ * @sa @ref joystick_event
+ * @sa @ref glfwSetJoystickCallback
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup input
+ */
+typedef void (* GLFWjoystickfun)(int jid, int event);
+
+/*! @brief Video mode type.
+ *
+ * This describes a single video mode.
+ *
+ * @sa @ref monitor_modes
+ * @sa @ref glfwGetVideoMode
+ * @sa @ref glfwGetVideoModes
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added refresh rate member.
+ *
+ * @ingroup monitor
+ */
+typedef struct GLFWvidmode
+{
+ /*! The width, in screen coordinates, of the video mode.
+ */
+ int width;
+ /*! The height, in screen coordinates, of the video mode.
+ */
+ int height;
+ /*! The bit depth of the red channel of the video mode.
+ */
+ int redBits;
+ /*! The bit depth of the green channel of the video mode.
+ */
+ int greenBits;
+ /*! The bit depth of the blue channel of the video mode.
+ */
+ int blueBits;
+ /*! The refresh rate, in Hz, of the video mode.
+ */
+ int refreshRate;
+} GLFWvidmode;
+
+/*! @brief Gamma ramp.
+ *
+ * This describes the gamma ramp for a monitor.
+ *
+ * @sa @ref monitor_gamma
+ * @sa @ref glfwGetGammaRamp
+ * @sa @ref glfwSetGammaRamp
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+typedef struct GLFWgammaramp
+{
+ /*! An array of value describing the response of the red channel.
+ */
+ unsigned short* red;
+ /*! An array of value describing the response of the green channel.
+ */
+ unsigned short* green;
+ /*! An array of value describing the response of the blue channel.
+ */
+ unsigned short* blue;
+ /*! The number of elements in each array.
+ */
+ unsigned int size;
+} GLFWgammaramp;
+
+/*! @brief Image data.
+ *
+ * This describes a single 2D image. See the documentation for each related
+ * function what the expected pixel format is.
+ *
+ * @sa @ref cursor_custom
+ * @sa @ref window_icon
+ *
+ * @since Added in version 2.1.
+ * @glfw3 Removed format and bytes-per-pixel members.
+ *
+ * @ingroup window
+ */
+typedef struct GLFWimage
+{
+ /*! The width, in pixels, of this image.
+ */
+ int width;
+ /*! The height, in pixels, of this image.
+ */
+ int height;
+ /*! The pixel data of this image, arranged left-to-right, top-to-bottom.
+ */
+ unsigned char* pixels;
+} GLFWimage;
+
+/*! @brief Gamepad input state
+ *
+ * This describes the input state of a gamepad.
+ *
+ * @sa @ref gamepad
+ * @sa @ref glfwGetGamepadState
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+typedef struct GLFWgamepadstate
+{
+ /*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
+ * or `GLFW_RELEASE`.
+ */
+ unsigned char buttons[15];
+ /*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
+ * to 1.0 inclusive.
+ */
+ float axes[6];
+} GLFWgamepadstate;
+
+/*! @brief Custom heap memory allocator.
+ *
+ * This describes a custom heap memory allocator for GLFW. To set an allocator, pass it
+ * to @ref glfwInitAllocator before initializing the library.
+ *
+ * @sa @ref init_allocator
+ * @sa @ref glfwInitAllocator
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+typedef struct GLFWallocator
+{
+ /*! The memory allocation function. See @ref GLFWallocatefun for details about
+ * allocation function.
+ */
+ GLFWallocatefun allocate;
+ /*! The memory reallocation function. See @ref GLFWreallocatefun for details about
+ * reallocation function.
+ */
+ GLFWreallocatefun reallocate;
+ /*! The memory deallocation function. See @ref GLFWdeallocatefun for details about
+ * deallocation function.
+ */
+ GLFWdeallocatefun deallocate;
+ /*! The user pointer for this custom allocator. This value will be passed to the
+ * allocator functions.
+ */
+ void* user;
+} GLFWallocator;
+
+
+/*************************************************************************
+ * GLFW API functions
+ *************************************************************************/
+
+/*! @brief Initializes the GLFW library.
+ *
+ * This function initializes the GLFW library. Before most GLFW functions can
+ * be used, GLFW must be initialized, and before an application terminates GLFW
+ * should be terminated in order to free any resources allocated during or
+ * after initialization.
+ *
+ * If this function fails, it calls @ref glfwTerminate before returning. If it
+ * succeeds, you should call @ref glfwTerminate before the application exits.
+ *
+ * Additional calls to this function after successful initialization but before
+ * termination will return `GLFW_TRUE` immediately.
+ *
+ * The @ref GLFW_PLATFORM init hint controls which platforms are considered during
+ * initialization. This also depends on which platforms the library was compiled to
+ * support.
+ *
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_PLATFORM_UNAVAILABLE and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @macos This function will change the current directory of the
+ * application to the `Contents/Resources` subdirectory of the application's
+ * bundle, if present. This can be disabled with the @ref
+ * GLFW_COCOA_CHDIR_RESOURCES init hint.
+ *
+ * @remark @macos This function will create the main menu and dock icon for the
+ * application. If GLFW finds a `MainMenu.nib` it is loaded and assumed to
+ * contain a menu bar. Otherwise a minimal menu bar is created manually with
+ * common commands like Hide, Quit and About. The About entry opens a minimal
+ * about dialog with information from the application's bundle. The menu bar
+ * and dock icon can be disabled entirely with the @ref GLFW_COCOA_MENUBAR init
+ * hint.
+ *
+ * @remark __Wayland, X11:__ If the library was compiled with support for both
+ * Wayland and X11, and the @ref GLFW_PLATFORM init hint is set to
+ * `GLFW_ANY_PLATFORM`, the `XDG_SESSION_TYPE` environment variable affects
+ * which platform is picked. If the environment variable is not set, or is set
+ * to something other than `wayland` or `x11`, the regular detection mechanism
+ * will be used instead.
+ *
+ * @remark @x11 This function will set the `LC_CTYPE` category of the
+ * application locale according to the current environment if that category is
+ * still "C". This is because the "C" locale breaks Unicode text input.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref intro_init
+ * @sa @ref glfwInitHint
+ * @sa @ref glfwInitAllocator
+ * @sa @ref glfwTerminate
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup init
+ */
+GLFWAPI int glfwInit(void);
+
+/*! @brief Terminates the GLFW library.
+ *
+ * This function destroys all remaining windows and cursors, restores any
+ * modified gamma ramps and frees any other allocated resources. Once this
+ * function is called, you must again call @ref glfwInit successfully before
+ * you will be able to use most GLFW functions.
+ *
+ * If GLFW has been successfully initialized, this function should be called
+ * before the application exits. If initialization fails, there is no need to
+ * call this function, as it is called by @ref glfwInit before it returns
+ * failure.
+ *
+ * This function has no effect if GLFW is not initialized.
+ *
+ * @errors Possible errors include @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @warning The contexts of any remaining windows must not be current on any
+ * other thread when this function is called.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref intro_init
+ * @sa @ref glfwInit
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup init
+ */
+GLFWAPI void glfwTerminate(void);
+
+/*! @brief Sets the specified init hint to the desired value.
+ *
+ * This function sets hints for the next initialization of GLFW.
+ *
+ * The values you set hints to are never reset by GLFW, but they only take
+ * effect during initialization. Once GLFW has been initialized, any values
+ * you set will be ignored until the library is terminated and initialized
+ * again.
+ *
+ * Some hints are platform specific. These may be set on any platform but they
+ * will only affect their specific platform. Other platforms will ignore them.
+ * Setting these hints requires no platform specific headers or functions.
+ *
+ * @param[in] hint The [init hint](@ref init_hints) to set.
+ * @param[in] value The new value of the init hint.
+ *
+ * @errors Possible errors include @ref GLFW_INVALID_ENUM and @ref
+ * GLFW_INVALID_VALUE.
+ *
+ * @remarks This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa init_hints
+ * @sa glfwInit
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup init
+ */
+GLFWAPI void glfwInitHint(int hint, int value);
+
+/*! @brief Sets the init allocator to the desired value.
+ *
+ * To use the default allocator, call this function with a `NULL` argument.
+ *
+ * If you specify an allocator struct, every member must be a valid function
+ * pointer. If any member is `NULL`, this function will emit @ref
+ * GLFW_INVALID_VALUE and the init allocator will be unchanged.
+ *
+ * The functions in the allocator must fulfil a number of requirements. See the
+ * documentation for @ref GLFWallocatefun, @ref GLFWreallocatefun and @ref
+ * GLFWdeallocatefun for details.
+ *
+ * @param[in] allocator The allocator to use at the next initialization, or
+ * `NULL` to use the default one.
+ *
+ * @errors Possible errors include @ref GLFW_INVALID_VALUE.
+ *
+ * @pointer_lifetime The specified allocator is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref init_allocator
+ * @sa @ref glfwInit
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+GLFWAPI void glfwInitAllocator(const GLFWallocator* allocator);
+
+#if defined(VK_VERSION_1_0)
+
+/*! @brief Sets the desired Vulkan `vkGetInstanceProcAddr` function.
+ *
+ * This function sets the `vkGetInstanceProcAddr` function that GLFW will use for all
+ * Vulkan related entry point queries.
+ *
+ * This feature is mostly useful on macOS, if your copy of the Vulkan loader is in
+ * a location where GLFW cannot find it through dynamic loading, or if you are still
+ * using the static library version of the loader.
+ *
+ * If set to `NULL`, GLFW will try to load the Vulkan loader dynamically by its standard
+ * name and get this function from there. This is the default behavior.
+ *
+ * The standard name of the loader is `vulkan-1.dll` on Windows, `libvulkan.so.1` on
+ * Linux and other Unix-like systems and `libvulkan.1.dylib` on macOS. If your code is
+ * also loading it via these names then you probably don't need to use this function.
+ *
+ * The function address you set is never reset by GLFW, but it only takes effect during
+ * initialization. Once GLFW has been initialized, any updates will be ignored until the
+ * library is terminated and initialized again.
+ *
+ * @param[in] loader The address of the function to use, or `NULL`.
+ *
+ * @par Loader function signature
+ * @code
+ * PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance instance, const char* name)
+ * @endcode
+ * For more information about this function, see the
+ * [Vulkan Registry](https://www.khronos.org/registry/vulkan/).
+ *
+ * @errors None.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref vulkan_loader
+ * @sa @ref glfwInit
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+GLFWAPI void glfwInitVulkanLoader(PFN_vkGetInstanceProcAddr loader);
+
+#endif /*VK_VERSION_1_0*/
+
+/*! @brief Retrieves the version of the GLFW library.
+ *
+ * This function retrieves the major, minor and revision numbers of the GLFW
+ * library. It is intended for when you are using GLFW as a shared library and
+ * want to ensure that you are using the minimum required version.
+ *
+ * Any or all of the version arguments may be `NULL`.
+ *
+ * @param[out] major Where to store the major version number, or `NULL`.
+ * @param[out] minor Where to store the minor version number, or `NULL`.
+ * @param[out] rev Where to store the revision number, or `NULL`.
+ *
+ * @errors None.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref intro_version
+ * @sa @ref glfwGetVersionString
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup init
+ */
+GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev);
+
+/*! @brief Returns a string describing the compile-time configuration.
+ *
+ * This function returns the compile-time generated
+ * [version string](@ref intro_version_string) of the GLFW library binary. It describes
+ * the version, platforms, compiler and any platform or operating system specific
+ * compile-time options. It should not be confused with the OpenGL or OpenGL ES version
+ * string, queried with `glGetString`.
+ *
+ * __Do not use the version string__ to parse the GLFW library version. The
+ * @ref glfwGetVersion function provides the version of the running library
+ * binary in numerical format.
+ *
+ * __Do not use the version string__ to parse what platforms are supported. The @ref
+ * glfwPlatformSupported function lets you query platform support.
+ *
+ * @return The ASCII encoded GLFW version string.
+ *
+ * @errors None.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @pointer_lifetime The returned string is static and compile-time generated.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref intro_version
+ * @sa @ref glfwGetVersion
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup init
+ */
+GLFWAPI const char* glfwGetVersionString(void);
+
+/*! @brief Returns and clears the last error for the calling thread.
+ *
+ * This function returns and clears the [error code](@ref errors) of the last
+ * error that occurred on the calling thread, and optionally a UTF-8 encoded
+ * human-readable description of it. If no error has occurred since the last
+ * call, it returns @ref GLFW_NO_ERROR (zero) and the description pointer is
+ * set to `NULL`.
+ *
+ * @param[in] description Where to store the error description pointer, or `NULL`.
+ * @return The last error code for the calling thread, or @ref GLFW_NO_ERROR
+ * (zero).
+ *
+ * @errors None.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is guaranteed to be valid only until the
+ * next error occurs or the library is terminated.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref error_handling
+ * @sa @ref glfwSetErrorCallback
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup init
+ */
+GLFWAPI int glfwGetError(const char** description);
+
+/*! @brief Sets the error callback.
+ *
+ * This function sets the error callback, which is called with an error code
+ * and a human-readable description each time a GLFW error occurs.
+ *
+ * The error code is set before the callback is called. Calling @ref
+ * glfwGetError from the error callback will return the same value as the error
+ * code argument.
+ *
+ * The error callback is called on the thread where the error occurred. If you
+ * are using GLFW from multiple threads, your error callback needs to be
+ * written accordingly.
+ *
+ * Because the description string may have been generated specifically for that
+ * error, it is not guaranteed to be valid after the callback has returned. If
+ * you wish to use it after the callback returns, you need to make a copy.
+ *
+ * Once set, the error callback remains set even after the library has been
+ * terminated.
+ *
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set.
+ *
+ * @callback_signature
+ * @code
+ * void callback_name(int error_code, const char* description)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [callback pointer type](@ref GLFWerrorfun).
+ *
+ * @errors None.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref error_handling
+ * @sa @ref glfwGetError
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup init
+ */
+GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
+
+/*! @brief Returns the currently selected platform.
+ *
+ * This function returns the platform that was selected during initialization. The
+ * returned value will be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
+ * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
+ *
+ * @return The currently selected platform, or zero if an error occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref platform
+ * @sa @ref glfwPlatformSupported
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+GLFWAPI int glfwGetPlatform(void);
+
+/*! @brief Returns whether the library includes support for the specified platform.
+ *
+ * This function returns whether the library was compiled with support for the specified
+ * platform. The platform must be one of `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`,
+ * `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` or `GLFW_PLATFORM_NULL`.
+ *
+ * @param[in] platform The platform to query.
+ * @return `GLFW_TRUE` if the platform is supported, or `GLFW_FALSE` otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_INVALID_ENUM.
+ *
+ * @remark This function may be called before @ref glfwInit.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref platform
+ * @sa @ref glfwGetPlatform
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup init
+ */
+GLFWAPI int glfwPlatformSupported(int platform);
+
+/*! @brief Returns the currently connected monitors.
+ *
+ * This function returns an array of handles for all currently connected
+ * monitors. The primary monitor is always first in the returned array. If no
+ * monitors were found, this function returns `NULL`.
+ *
+ * @param[out] count Where to store the number of monitors in the returned
+ * array. This is set to zero if an error occurred.
+ * @return An array of monitor handles, or `NULL` if no monitors were found or
+ * if an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is guaranteed to be valid only until the
+ * monitor configuration changes or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_monitors
+ * @sa @ref monitor_event
+ * @sa @ref glfwGetPrimaryMonitor
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI GLFWmonitor** glfwGetMonitors(int* count);
+
+/*! @brief Returns the primary monitor.
+ *
+ * This function returns the primary monitor. This is usually the monitor
+ * where elements like the task bar or global menu bar are located.
+ *
+ * @return The primary monitor, or `NULL` if no monitors were found or if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @remark The primary monitor is always first in the array returned by @ref
+ * glfwGetMonitors.
+ *
+ * @sa @ref monitor_monitors
+ * @sa @ref glfwGetMonitors
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI GLFWmonitor* glfwGetPrimaryMonitor(void);
+
+/*! @brief Returns the position of the monitor's viewport on the virtual screen.
+ *
+ * This function returns the position, in screen coordinates, of the upper-left
+ * corner of the specified monitor.
+ *
+ * Any or all of the position arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` position arguments will be set to zero.
+ *
+ * @param[in] monitor The monitor to query.
+ * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
+ * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_properties
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorPos(GLFWmonitor* monitor, int* xpos, int* ypos);
+
+/*! @brief Retrieves the work area of the monitor.
+ *
+ * This function returns the position, in screen coordinates, of the upper-left
+ * corner of the work area of the specified monitor along with the work area
+ * size in screen coordinates. The work area is defined as the area of the
+ * monitor not occluded by the window system task bar where present. If no
+ * task bar exists then the work area is the monitor resolution in screen
+ * coordinates.
+ *
+ * Any or all of the position and size arguments may be `NULL`. If an error
+ * occurs, all non-`NULL` position and size arguments will be set to zero.
+ *
+ * @param[in] monitor The monitor to query.
+ * @param[out] xpos Where to store the monitor x-coordinate, or `NULL`.
+ * @param[out] ypos Where to store the monitor y-coordinate, or `NULL`.
+ * @param[out] width Where to store the monitor width, or `NULL`.
+ * @param[out] height Where to store the monitor height, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_workarea
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorWorkarea(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height);
+
+/*! @brief Returns the physical size of the monitor.
+ *
+ * This function returns the size, in millimetres, of the display area of the
+ * specified monitor.
+ *
+ * Some platforms do not provide accurate monitor size information, either
+ * because the monitor [EDID][] data is incorrect or because the driver does
+ * not report it accurately.
+ *
+ * [EDID]: https://en.wikipedia.org/wiki/Extended_display_identification_data
+ *
+ * Any or all of the size arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` size arguments will be set to zero.
+ *
+ * @param[in] monitor The monitor to query.
+ * @param[out] widthMM Where to store the width, in millimetres, of the
+ * monitor's display area, or `NULL`.
+ * @param[out] heightMM Where to store the height, in millimetres, of the
+ * monitor's display area, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark @win32 On Windows 8 and earlier the physical size is calculated from
+ * the current resolution and system DPI instead of querying the monitor EDID data.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_properties
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorPhysicalSize(GLFWmonitor* monitor, int* widthMM, int* heightMM);
+
+/*! @brief Retrieves the content scale for the specified monitor.
+ *
+ * This function retrieves the content scale for the specified monitor. The
+ * content scale is the ratio between the current DPI and the platform's
+ * default DPI. This is especially important for text and any UI elements. If
+ * the pixel dimensions of your UI scaled by this look appropriate on your
+ * machine then it should appear at a reasonable size on other machines
+ * regardless of their DPI and scaling settings. This relies on the system DPI
+ * and scaling settings being somewhat correct.
+ *
+ * The content scale may depend on both the monitor resolution and pixel
+ * density and on user settings. It may be very different from the raw DPI
+ * calculated from the physical size and current resolution.
+ *
+ * @param[in] monitor The monitor to query.
+ * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
+ * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @wayland Fractional scaling information is not yet available for
+ * monitors, so this function only returns integer content scales.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_scale
+ * @sa @ref glfwGetWindowContentScale
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwGetMonitorContentScale(GLFWmonitor* monitor, float* xscale, float* yscale);
+
+/*! @brief Returns the name of the specified monitor.
+ *
+ * This function returns a human-readable name, encoded as UTF-8, of the
+ * specified monitor. The name typically reflects the make and model of the
+ * monitor and is not guaranteed to be unique among the connected monitors.
+ *
+ * @param[in] monitor The monitor to query.
+ * @return The UTF-8 encoded name of the monitor, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified monitor is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_properties
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* monitor);
+
+/*! @brief Sets the user pointer of the specified monitor.
+ *
+ * This function sets the user-defined pointer of the specified monitor. The
+ * current value is retained until the monitor is disconnected. The initial
+ * value is `NULL`.
+ *
+ * This function may be called from the monitor callback, even for a monitor
+ * that is being disconnected.
+ *
+ * @param[in] monitor The monitor whose pointer to set.
+ * @param[in] pointer The new value.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref monitor_userptr
+ * @sa @ref glfwGetMonitorUserPointer
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer);
+
+/*! @brief Returns the user pointer of the specified monitor.
+ *
+ * This function returns the current value of the user-defined pointer of the
+ * specified monitor. The initial value is `NULL`.
+ *
+ * This function may be called from the monitor callback, even for a monitor
+ * that is being disconnected.
+ *
+ * @param[in] monitor The monitor whose pointer to return.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref monitor_userptr
+ * @sa @ref glfwSetMonitorUserPointer
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void* glfwGetMonitorUserPointer(GLFWmonitor* monitor);
+
+/*! @brief Sets the monitor configuration callback.
+ *
+ * This function sets the monitor configuration callback, or removes the
+ * currently set callback. This is called when a monitor is connected to or
+ * disconnected from the system.
+ *
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWmonitor* monitor, int event)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWmonitorfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_event
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
+
+/*! @brief Returns the available video modes for the specified monitor.
+ *
+ * This function returns an array of all video modes supported by the specified
+ * monitor. The returned array is sorted in ascending order, first by color
+ * bit depth (the sum of all channel depths), then by resolution area (the
+ * product of width and height), then resolution width and finally by refresh
+ * rate.
+ *
+ * @param[in] monitor The monitor to query.
+ * @param[out] count Where to store the number of video modes in the returned
+ * array. This is set to zero if an error occurred.
+ * @return An array of video modes, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified monitor is
+ * disconnected, this function is called again for that monitor or the library
+ * is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_modes
+ * @sa @ref glfwGetVideoMode
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Changed to return an array of modes for a specific monitor.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* monitor, int* count);
+
+/*! @brief Returns the current mode of the specified monitor.
+ *
+ * This function returns the current video mode of the specified monitor. If
+ * you have created a full screen window for that monitor, the return value
+ * will depend on whether that window is iconified.
+ *
+ * @param[in] monitor The monitor to query.
+ * @return The current mode of the monitor, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified monitor is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_modes
+ * @sa @ref glfwGetVideoModes
+ *
+ * @since Added in version 3.0. Replaces `glfwGetDesktopMode`.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
+
+/*! @brief Generates a gamma ramp and sets it for the specified monitor.
+ *
+ * This function generates an appropriately sized gamma ramp from the specified
+ * exponent and then calls @ref glfwSetGammaRamp with it. The value must be
+ * a finite number greater than zero.
+ *
+ * The software controlled gamma ramp is applied _in addition_ to the hardware
+ * gamma correction, which today is usually an approximation of sRGB gamma.
+ * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
+ * the default (usually sRGB-like) behavior.
+ *
+ * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
+ * GLFW_SRGB_CAPABLE hint.
+ *
+ * @param[in] monitor The monitor whose gamma ramp to set.
+ * @param[in] gamma The desired exponent.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
+ * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland Gamma handling is a privileged protocol, this function
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_gamma
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
+
+/*! @brief Returns the current gamma ramp for the specified monitor.
+ *
+ * This function returns the current gamma ramp of the specified monitor.
+ *
+ * @param[in] monitor The monitor to query.
+ * @return The current gamma ramp, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland Gamma handling is a privileged protocol, this function
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
+ * returning `NULL`.
+ *
+ * @pointer_lifetime The returned structure and its arrays are allocated and
+ * freed by GLFW. You should not free them yourself. They are valid until the
+ * specified monitor is disconnected, this function is called again for that
+ * monitor or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_gamma
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
+
+/*! @brief Sets the current gamma ramp for the specified monitor.
+ *
+ * This function sets the current gamma ramp for the specified monitor. The
+ * original gamma ramp for that monitor is saved by GLFW the first time this
+ * function is called and is restored by @ref glfwTerminate.
+ *
+ * The software controlled gamma ramp is applied _in addition_ to the hardware
+ * gamma correction, which today is usually an approximation of sRGB gamma.
+ * This means that setting a perfectly linear ramp, or gamma 1.0, will produce
+ * the default (usually sRGB-like) behavior.
+ *
+ * For gamma correct rendering with OpenGL or OpenGL ES, see the @ref
+ * GLFW_SRGB_CAPABLE hint.
+ *
+ * @param[in] monitor The monitor whose gamma ramp to set.
+ * @param[in] ramp The gamma ramp to use.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
+ * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark The size of the specified gamma ramp should match the size of the
+ * current ramp for that monitor.
+ *
+ * @remark @win32 The gamma ramp size must be 256.
+ *
+ * @remark @wayland Gamma handling is a privileged protocol, this function
+ * will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @pointer_lifetime The specified gamma ramp is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref monitor_gamma
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup monitor
+ */
+GLFWAPI void glfwSetGammaRamp(GLFWmonitor* monitor, const GLFWgammaramp* ramp);
+
+/*! @brief Resets all window hints to their default values.
+ *
+ * This function resets all window hints to their
+ * [default values](@ref window_hints_values).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_hints
+ * @sa @ref glfwWindowHint
+ * @sa @ref glfwWindowHintString
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwDefaultWindowHints(void);
+
+/*! @brief Sets the specified window hint to the desired value.
+ *
+ * This function sets hints for the next call to @ref glfwCreateWindow. The
+ * hints, once set, retain their values until changed by a call to this
+ * function or @ref glfwDefaultWindowHints, or until the library is terminated.
+ *
+ * Only integer value hints can be set with this function. String value hints
+ * are set with @ref glfwWindowHintString.
+ *
+ * This function does not check whether the specified hint values are valid.
+ * If you set hints to invalid values this will instead be reported by the next
+ * call to @ref glfwCreateWindow.
+ *
+ * Some hints are platform specific. These may be set on any platform but they
+ * will only affect their specific platform. Other platforms will ignore them.
+ * Setting these hints requires no platform specific headers or functions.
+ *
+ * @param[in] hint The [window hint](@ref window_hints) to set.
+ * @param[in] value The new value of the window hint.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_hints
+ * @sa @ref glfwWindowHintString
+ * @sa @ref glfwDefaultWindowHints
+ *
+ * @since Added in version 3.0. Replaces `glfwOpenWindowHint`.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwWindowHint(int hint, int value);
+
+/*! @brief Sets the specified window hint to the desired value.
+ *
+ * This function sets hints for the next call to @ref glfwCreateWindow. The
+ * hints, once set, retain their values until changed by a call to this
+ * function or @ref glfwDefaultWindowHints, or until the library is terminated.
+ *
+ * Only string type hints can be set with this function. Integer value hints
+ * are set with @ref glfwWindowHint.
+ *
+ * This function does not check whether the specified hint values are valid.
+ * If you set hints to invalid values this will instead be reported by the next
+ * call to @ref glfwCreateWindow.
+ *
+ * Some hints are platform specific. These may be set on any platform but they
+ * will only affect their specific platform. Other platforms will ignore them.
+ * Setting these hints requires no platform specific headers or functions.
+ *
+ * @param[in] hint The [window hint](@ref window_hints) to set.
+ * @param[in] value The new value of the window hint.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @pointer_lifetime The specified string is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_hints
+ * @sa @ref glfwWindowHint
+ * @sa @ref glfwDefaultWindowHints
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwWindowHintString(int hint, const char* value);
+
+/*! @brief Creates a window and its associated context.
+ *
+ * This function creates a window and its associated OpenGL or OpenGL ES
+ * context. Most of the options controlling how the window and its context
+ * should be created are specified with [window hints](@ref window_hints).
+ *
+ * Successful creation does not change which context is current. Before you
+ * can use the newly created context, you need to
+ * [make it current](@ref context_current). For information about the `share`
+ * parameter, see @ref context_sharing.
+ *
+ * The created window, framebuffer and context may differ from what you
+ * requested, as not all parameters and hints are
+ * [hard constraints](@ref window_hints_hard). This includes the size of the
+ * window, especially for full screen windows. To query the actual attributes
+ * of the created window, framebuffer and context, see @ref
+ * glfwGetWindowAttrib, @ref glfwGetWindowSize and @ref glfwGetFramebufferSize.
+ *
+ * To create a full screen window, you need to specify the monitor the window
+ * will cover. If no monitor is specified, the window will be windowed mode.
+ * Unless you have a way for the user to choose a specific monitor, it is
+ * recommended that you pick the primary monitor. For more information on how
+ * to query connected monitors, see @ref monitor_monitors.
+ *
+ * For full screen windows, the specified size becomes the resolution of the
+ * window's _desired video mode_. As long as a full screen window is not
+ * iconified, the supported video mode most closely matching the desired video
+ * mode is set for the specified monitor. For more information about full
+ * screen windows, including the creation of so called _windowed full screen_
+ * or _borderless full screen_ windows, see @ref window_windowed_full_screen.
+ *
+ * Once you have created the window, you can switch it between windowed and
+ * full screen mode with @ref glfwSetWindowMonitor. This will not affect its
+ * OpenGL or OpenGL ES context.
+ *
+ * By default, newly created windows use the placement recommended by the
+ * window system. To create the window at a specific position, set the @ref
+ * GLFW_POSITION_X and @ref GLFW_POSITION_Y window hints before creation. To
+ * restore the default behavior, set either or both hints back to
+ * `GLFW_ANY_POSITION`.
+ *
+ * As long as at least one full screen window is not iconified, the screensaver
+ * is prohibited from starting.
+ *
+ * Window systems put limits on window sizes. Very large or very small window
+ * dimensions may be overridden by the window system on creation. Check the
+ * actual [size](@ref window_size) after creation.
+ *
+ * The [swap interval](@ref buffer_swap) is not set during window creation and
+ * the initial value may vary depending on driver settings and defaults.
+ *
+ * @param[in] width The desired width, in screen coordinates, of the window.
+ * This must be greater than zero.
+ * @param[in] height The desired height, in screen coordinates, of the window.
+ * This must be greater than zero.
+ * @param[in] title The initial, UTF-8 encoded window title.
+ * @param[in] monitor The monitor to use for full screen mode, or `NULL` for
+ * windowed mode.
+ * @param[in] share The window whose context to share resources with, or `NULL`
+ * to not share resources.
+ * @return The handle of the created window, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_API_UNAVAILABLE, @ref
+ * GLFW_VERSION_UNAVAILABLE, @ref GLFW_FORMAT_UNAVAILABLE, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark @win32 Window creation will fail if the Microsoft GDI software
+ * OpenGL implementation is the only one available.
+ *
+ * @remark @win32 If the executable has an icon resource named `GLFW_ICON,` it
+ * will be set as the initial icon for the window. If no such icon is present,
+ * the `IDI_APPLICATION` icon will be used instead. To set a different icon,
+ * see @ref glfwSetWindowIcon.
+ *
+ * @remark @win32 The context to share resources with must not be current on
+ * any other thread.
+ *
+ * @remark @macos The OS only supports core profile contexts for OpenGL
+ * versions 3.2 and later. Before creating an OpenGL context of version 3.2 or
+ * later you must set the [GLFW_OPENGL_PROFILE](@ref GLFW_OPENGL_PROFILE_hint)
+ * hint accordingly. OpenGL 3.0 and 3.1 contexts are not supported at all
+ * on macOS.
+ *
+ * @remark @macos The GLFW window has no icon, as it is not a document
+ * window, but the dock icon will be the same as the application bundle's icon.
+ * For more information on bundles, see the
+ * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
+ *
+ * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
+ *
+ * @remark @macos On OS X 10.10 and later the window frame will not be rendered
+ * at full resolution on Retina displays unless the
+ * [GLFW_SCALE_FRAMEBUFFER](@ref GLFW_SCALE_FRAMEBUFFER_hint)
+ * hint is `GLFW_TRUE` and the `NSHighResolutionCapable` key is enabled in the
+ * application bundle's `Info.plist`. For more information, see
+ * [High Resolution Guidelines for OS X][hidpi-guide] in the Mac Developer
+ * Library. The GLFW test and example programs use a custom `Info.plist`
+ * template for this, which can be found as `CMake/Info.plist.in` in the source
+ * tree.
+ *
+ * [hidpi-guide]: https://developer.apple.com/library/mac/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
+ *
+ * @remark @macos When activating frame autosaving with
+ * [GLFW_COCOA_FRAME_NAME](@ref GLFW_COCOA_FRAME_NAME_hint), the specified
+ * window size and position may be overridden by previously saved values.
+ *
+ * @remark @wayland GLFW uses [libdecor][] where available to create its window
+ * decorations. This in turn uses server-side XDG decorations where available
+ * and provides high quality client-side decorations on compositors like GNOME.
+ * If both XDG decorations and libdecor are unavailable, GLFW falls back to
+ * a very simple set of window decorations that only support moving, resizing
+ * and the window manager's right-click menu.
+ *
+ * [libdecor]: https://gitlab.freedesktop.org/libdecor/libdecor
+ *
+ * @remark @x11 Some window managers will not respect the placement of
+ * initially hidden windows.
+ *
+ * @remark @x11 Due to the asynchronous nature of X11, it may take a moment for
+ * a window to reach its requested state. This means you may not be able to
+ * query the final size, position or other attributes directly after window
+ * creation.
+ *
+ * @remark @x11 The class part of the `WM_CLASS` window property will by
+ * default be set to the window title passed to this function. The instance
+ * part will use the contents of the `RESOURCE_NAME` environment variable, if
+ * present and not empty, or fall back to the window title. Set the
+ * [GLFW_X11_CLASS_NAME](@ref GLFW_X11_CLASS_NAME_hint) and
+ * [GLFW_X11_INSTANCE_NAME](@ref GLFW_X11_INSTANCE_NAME_hint) window hints to
+ * override this.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_creation
+ * @sa @ref glfwDestroyWindow
+ *
+ * @since Added in version 3.0. Replaces `glfwOpenWindow`.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
+
+/*! @brief Destroys the specified window and its context.
+ *
+ * This function destroys the specified window and its context. On calling
+ * this function, no further callbacks will be called for that window.
+ *
+ * If the context of the specified window is current on the main thread, it is
+ * detached before being destroyed.
+ *
+ * @param[in] window The window to destroy.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @note The context of the specified window must not be current on any other
+ * thread when this function is called.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_creation
+ * @sa @ref glfwCreateWindow
+ *
+ * @since Added in version 3.0. Replaces `glfwCloseWindow`.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwDestroyWindow(GLFWwindow* window);
+
+/*! @brief Checks the close flag of the specified window.
+ *
+ * This function returns the value of the close flag of the specified window.
+ *
+ * @param[in] window The window to query.
+ * @return The value of the close flag.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref window_close
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI int glfwWindowShouldClose(GLFWwindow* window);
+
+/*! @brief Sets the close flag of the specified window.
+ *
+ * This function sets the value of the close flag of the specified window.
+ * This can be used to override the user's attempt to close the window, or
+ * to signal that it should be closed.
+ *
+ * @param[in] window The window whose flag to change.
+ * @param[in] value The new value.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref window_close
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* window, int value);
+
+/*! @brief Returns the title of the specified window.
+ *
+ * This function returns the window title, encoded as UTF-8, of the specified
+ * window. This is the title set previously by @ref glfwCreateWindow
+ * or @ref glfwSetWindowTitle.
+ *
+ * @param[in] window The window to query.
+ * @return The UTF-8 encoded window title, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark The returned title is currently a copy of the title last set by @ref
+ * glfwCreateWindow or @ref glfwSetWindowTitle. It does not include any
+ * additional text which may be appended by the platform or another program.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the next call to @ref
+ * glfwGetWindowTitle or @ref glfwSetWindowTitle, or until the library is
+ * terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_title
+ * @sa @ref glfwSetWindowTitle
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup window
+ */
+GLFWAPI const char* glfwGetWindowTitle(GLFWwindow* window);
+
+/*! @brief Sets the title of the specified window.
+ *
+ * This function sets the window title, encoded as UTF-8, of the specified
+ * window.
+ *
+ * @param[in] window The window whose title to change.
+ * @param[in] title The UTF-8 encoded window title.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @macos The window title will not be updated until the next time you
+ * process events.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_title
+ * @sa @ref glfwGetWindowTitle
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowTitle(GLFWwindow* window, const char* title);
+
+/*! @brief Sets the icon for the specified window.
+ *
+ * This function sets the icon of the specified window. If passed an array of
+ * candidate images, those of or closest to the sizes desired by the system are
+ * selected. If no images are specified, the window reverts to its default
+ * icon.
+ *
+ * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
+ * bits per channel with the red channel first. They are arranged canonically
+ * as packed sequential rows, starting from the top-left corner.
+ *
+ * The desired image sizes varies depending on platform and system settings.
+ * The selected images will be rescaled as needed. Good sizes include 16x16,
+ * 32x32 and 48x48.
+ *
+ * @param[in] window The window whose icon to set.
+ * @param[in] count The number of images in the specified array, or zero to
+ * revert to the default window icon.
+ * @param[in] images The images to create the icon from. This is ignored if
+ * count is zero.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
+ * GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @pointer_lifetime The specified image data is copied before this function
+ * returns.
+ *
+ * @remark @macos Regular windows do not have icons on macOS. This function
+ * will emit @ref GLFW_FEATURE_UNAVAILABLE. The dock icon will be the same as
+ * the application bundle's icon. For more information on bundles, see the
+ * [Bundle Programming Guide][bundle-guide] in the Mac Developer Library.
+ *
+ * [bundle-guide]: https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/
+ *
+ * @remark @wayland There is no existing protocol to change an icon, the
+ * window will thus inherit the one defined in the application's desktop file.
+ * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_icon
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* images);
+
+/*! @brief Retrieves the position of the content area of the specified window.
+ *
+ * This function retrieves the position, in screen coordinates, of the
+ * upper-left corner of the content area of the specified window.
+ *
+ * Any or all of the position arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` position arguments will be set to zero.
+ *
+ * @param[in] window The window to query.
+ * @param[out] xpos Where to store the x-coordinate of the upper-left corner of
+ * the content area, or `NULL`.
+ * @param[out] ypos Where to store the y-coordinate of the upper-left corner of
+ * the content area, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland There is no way for an application to retrieve the global
+ * position of its windows. This function will emit @ref
+ * GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_pos
+ * @sa @ref glfwSetWindowPos
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
+
+/*! @brief Sets the position of the content area of the specified window.
+ *
+ * This function sets the position, in screen coordinates, of the upper-left
+ * corner of the content area of the specified windowed mode window. If the
+ * window is a full screen window, this function does nothing.
+ *
+ * __Do not use this function__ to move an already visible window unless you
+ * have very good reasons for doing so, as it will confuse and annoy the user.
+ *
+ * The window manager may put limits on what positions are allowed. GLFW
+ * cannot and should not override these limits.
+ *
+ * @param[in] window The window to query.
+ * @param[in] xpos The x-coordinate of the upper-left corner of the content area.
+ * @param[in] ypos The y-coordinate of the upper-left corner of the content area.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland There is no way for an application to set the global
+ * position of its windows. This function will emit @ref
+ * GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_pos
+ * @sa @ref glfwGetWindowPos
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowPos(GLFWwindow* window, int xpos, int ypos);
+
+/*! @brief Retrieves the size of the content area of the specified window.
+ *
+ * This function retrieves the size, in screen coordinates, of the content area
+ * of the specified window. If you wish to retrieve the size of the
+ * framebuffer of the window in pixels, see @ref glfwGetFramebufferSize.
+ *
+ * Any or all of the size arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` size arguments will be set to zero.
+ *
+ * @param[in] window The window whose size to retrieve.
+ * @param[out] width Where to store the width, in screen coordinates, of the
+ * content area, or `NULL`.
+ * @param[out] height Where to store the height, in screen coordinates, of the
+ * content area, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_size
+ * @sa @ref glfwSetWindowSize
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwGetWindowSize(GLFWwindow* window, int* width, int* height);
+
+/*! @brief Sets the size limits of the specified window.
+ *
+ * This function sets the size limits of the content area of the specified
+ * window. If the window is full screen, the size limits only take effect
+ * once it is made windowed. If the window is not resizable, this function
+ * does nothing.
+ *
+ * The size limits are applied immediately to a windowed mode window and may
+ * cause it to be resized.
+ *
+ * The maximum dimensions must be greater than or equal to the minimum
+ * dimensions and all must be greater than or equal to zero.
+ *
+ * @param[in] window The window to set limits for.
+ * @param[in] minwidth The minimum width, in screen coordinates, of the content
+ * area, or `GLFW_DONT_CARE`.
+ * @param[in] minheight The minimum height, in screen coordinates, of the
+ * content area, or `GLFW_DONT_CARE`.
+ * @param[in] maxwidth The maximum width, in screen coordinates, of the content
+ * area, or `GLFW_DONT_CARE`.
+ * @param[in] maxheight The maximum height, in screen coordinates, of the
+ * content area, or `GLFW_DONT_CARE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark If you set size limits and an aspect ratio that conflict, the
+ * results are undefined.
+ *
+ * @remark @wayland The size limits will not be applied until the window is
+ * actually resized, either by the user or by the compositor.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_sizelimits
+ * @sa @ref glfwSetWindowAspectRatio
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight);
+
+/*! @brief Sets the aspect ratio of the specified window.
+ *
+ * This function sets the required aspect ratio of the content area of the
+ * specified window. If the window is full screen, the aspect ratio only takes
+ * effect once it is made windowed. If the window is not resizable, this
+ * function does nothing.
+ *
+ * The aspect ratio is specified as a numerator and a denominator and both
+ * values must be greater than zero. For example, the common 16:9 aspect ratio
+ * is specified as 16 and 9, respectively.
+ *
+ * If the numerator and denominator is set to `GLFW_DONT_CARE` then the aspect
+ * ratio limit is disabled.
+ *
+ * The aspect ratio is applied immediately to a windowed mode window and may
+ * cause it to be resized.
+ *
+ * @param[in] window The window to set limits for.
+ * @param[in] numer The numerator of the desired aspect ratio, or
+ * `GLFW_DONT_CARE`.
+ * @param[in] denom The denominator of the desired aspect ratio, or
+ * `GLFW_DONT_CARE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark If you set size limits and an aspect ratio that conflict, the
+ * results are undefined.
+ *
+ * @remark @wayland The aspect ratio will not be applied until the window is
+ * actually resized, either by the user or by the compositor.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_sizelimits
+ * @sa @ref glfwSetWindowSizeLimits
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* window, int numer, int denom);
+
+/*! @brief Sets the size of the content area of the specified window.
+ *
+ * This function sets the size, in screen coordinates, of the content area of
+ * the specified window.
+ *
+ * For full screen windows, this function updates the resolution of its desired
+ * video mode and switches to the video mode closest to it, without affecting
+ * the window's context. As the context is unaffected, the bit depths of the
+ * framebuffer remain unchanged.
+ *
+ * If you wish to update the refresh rate of the desired video mode in addition
+ * to its resolution, see @ref glfwSetWindowMonitor.
+ *
+ * The window manager may put limits on what sizes are allowed. GLFW cannot
+ * and should not override these limits.
+ *
+ * @param[in] window The window to resize.
+ * @param[in] width The desired width, in screen coordinates, of the window
+ * content area.
+ * @param[in] height The desired height, in screen coordinates, of the window
+ * content area.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_size
+ * @sa @ref glfwGetWindowSize
+ * @sa @ref glfwSetWindowMonitor
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowSize(GLFWwindow* window, int width, int height);
+
+/*! @brief Retrieves the size of the framebuffer of the specified window.
+ *
+ * This function retrieves the size, in pixels, of the framebuffer of the
+ * specified window. If you wish to retrieve the size of the window in screen
+ * coordinates, see @ref glfwGetWindowSize.
+ *
+ * Any or all of the size arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` size arguments will be set to zero.
+ *
+ * @param[in] window The window whose framebuffer to query.
+ * @param[out] width Where to store the width, in pixels, of the framebuffer,
+ * or `NULL`.
+ * @param[out] height Where to store the height, in pixels, of the framebuffer,
+ * or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_fbsize
+ * @sa @ref glfwSetFramebufferSizeCallback
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwGetFramebufferSize(GLFWwindow* window, int* width, int* height);
+
+/*! @brief Retrieves the size of the frame of the window.
+ *
+ * This function retrieves the size, in screen coordinates, of each edge of the
+ * frame of the specified window. This size includes the title bar, if the
+ * window has one. The size of the frame may vary depending on the
+ * [window-related hints](@ref window_hints_wnd) used to create it.
+ *
+ * Because this function retrieves the size of each window frame edge and not
+ * the offset along a particular coordinate axis, the retrieved values will
+ * always be zero or positive.
+ *
+ * Any or all of the size arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` size arguments will be set to zero.
+ *
+ * @param[in] window The window whose frame size to query.
+ * @param[out] left Where to store the size, in screen coordinates, of the left
+ * edge of the window frame, or `NULL`.
+ * @param[out] top Where to store the size, in screen coordinates, of the top
+ * edge of the window frame, or `NULL`.
+ * @param[out] right Where to store the size, in screen coordinates, of the
+ * right edge of the window frame, or `NULL`.
+ * @param[out] bottom Where to store the size, in screen coordinates, of the
+ * bottom edge of the window frame, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_size
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* window, int* left, int* top, int* right, int* bottom);
+
+/*! @brief Retrieves the content scale for the specified window.
+ *
+ * This function retrieves the content scale for the specified window. The
+ * content scale is the ratio between the current DPI and the platform's
+ * default DPI. This is especially important for text and any UI elements. If
+ * the pixel dimensions of your UI scaled by this look appropriate on your
+ * machine then it should appear at a reasonable size on other machines
+ * regardless of their DPI and scaling settings. This relies on the system DPI
+ * and scaling settings being somewhat correct.
+ *
+ * On platforms where each monitors can have its own content scale, the window
+ * content scale will depend on which monitor the system considers the window
+ * to be on.
+ *
+ * @param[in] window The window to query.
+ * @param[out] xscale Where to store the x-axis content scale, or `NULL`.
+ * @param[out] yscale Where to store the y-axis content scale, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_scale
+ * @sa @ref glfwSetWindowContentScaleCallback
+ * @sa @ref glfwGetMonitorContentScale
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwGetWindowContentScale(GLFWwindow* window, float* xscale, float* yscale);
+
+/*! @brief Returns the opacity of the whole window.
+ *
+ * This function returns the opacity of the window, including any decorations.
+ *
+ * The opacity (or alpha) value is a positive finite number between zero and
+ * one, where zero is fully transparent and one is fully opaque. If the system
+ * does not support whole window transparency, this function always returns one.
+ *
+ * The initial opacity value for newly created windows is one.
+ *
+ * @param[in] window The window to query.
+ * @return The opacity value of the specified window.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_transparency
+ * @sa @ref glfwSetWindowOpacity
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI float glfwGetWindowOpacity(GLFWwindow* window);
+
+/*! @brief Sets the opacity of the whole window.
+ *
+ * This function sets the opacity of the window, including any decorations.
+ *
+ * The opacity (or alpha) value is a positive finite number between zero and
+ * one, where zero is fully transparent and one is fully opaque.
+ *
+ * The initial opacity value for newly created windows is one.
+ *
+ * A window created with framebuffer transparency may not use whole window
+ * transparency. The results of doing this are undefined.
+ *
+ * @param[in] window The window to set the opacity for.
+ * @param[in] opacity The desired opacity of the specified window.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland There is no way to set an opacity factor for a window.
+ * This function will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_transparency
+ * @sa @ref glfwGetWindowOpacity
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
+
+/*! @brief Iconifies the specified window.
+ *
+ * This function iconifies (minimizes) the specified window if it was
+ * previously restored. If the window is already iconified, this function does
+ * nothing.
+ *
+ * If the specified window is a full screen window, GLFW restores the original
+ * video mode of the monitor. The window's desired video mode is set again
+ * when the window is restored.
+ *
+ * @param[in] window The window to iconify.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @wayland Once a window is iconified, @ref glfwRestoreWindow won’t
+ * be able to restore it. This is a design decision of the xdg-shell
+ * protocol.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_iconify
+ * @sa @ref glfwRestoreWindow
+ * @sa @ref glfwMaximizeWindow
+ *
+ * @since Added in version 2.1.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
+
+/*! @brief Restores the specified window.
+ *
+ * This function restores the specified window if it was previously iconified
+ * (minimized) or maximized. If the window is already restored, this function
+ * does nothing.
+ *
+ * If the specified window is an iconified full screen window, its desired
+ * video mode is set again for its monitor when the window is restored.
+ *
+ * @param[in] window The window to restore.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_iconify
+ * @sa @ref glfwIconifyWindow
+ * @sa @ref glfwMaximizeWindow
+ *
+ * @since Added in version 2.1.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwRestoreWindow(GLFWwindow* window);
+
+/*! @brief Maximizes the specified window.
+ *
+ * This function maximizes the specified window if it was previously not
+ * maximized. If the window is already maximized, this function does nothing.
+ *
+ * If the specified window is a full screen window, this function does nothing.
+ *
+ * @param[in] window The window to maximize.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @par Thread Safety
+ * This function may only be called from the main thread.
+ *
+ * @sa @ref window_iconify
+ * @sa @ref glfwIconifyWindow
+ * @sa @ref glfwRestoreWindow
+ *
+ * @since Added in GLFW 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwMaximizeWindow(GLFWwindow* window);
+
+/*! @brief Makes the specified window visible.
+ *
+ * This function makes the specified window visible if it was previously
+ * hidden. If the window is already visible or is in full screen mode, this
+ * function does nothing.
+ *
+ * By default, windowed mode windows are focused when shown
+ * Set the [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) window hint
+ * to change this behavior for all newly created windows, or change the
+ * behavior for an existing window with @ref glfwSetWindowAttrib.
+ *
+ * @param[in] window The window to make visible.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @wayland Because Wayland wants every frame of the desktop to be
+ * complete, this function does not immediately make the window visible.
+ * Instead it will become visible the next time the window framebuffer is
+ * updated after this call.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_hide
+ * @sa @ref glfwHideWindow
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwShowWindow(GLFWwindow* window);
+
+/*! @brief Hides the specified window.
+ *
+ * This function hides the specified window if it was previously visible. If
+ * the window is already hidden or is in full screen mode, this function does
+ * nothing.
+ *
+ * @param[in] window The window to hide.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_hide
+ * @sa @ref glfwShowWindow
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwHideWindow(GLFWwindow* window);
+
+/*! @brief Brings the specified window to front and sets input focus.
+ *
+ * This function brings the specified window to front and sets input focus.
+ * The window should already be visible and not iconified.
+ *
+ * By default, both windowed and full screen mode windows are focused when
+ * initially created. Set the [GLFW_FOCUSED](@ref GLFW_FOCUSED_hint) to
+ * disable this behavior.
+ *
+ * Also by default, windowed mode windows are focused when shown
+ * with @ref glfwShowWindow. Set the
+ * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_hint) to disable this behavior.
+ *
+ * __Do not use this function__ to steal focus from other applications unless
+ * you are certain that is what the user wants. Focus stealing can be
+ * extremely disruptive.
+ *
+ * For a less disruptive way of getting the user's attention, see
+ * [attention requests](@ref window_attention).
+ *
+ * @param[in] window The window to give input focus.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @wayland The compositor will likely ignore focus requests unless
+ * another window created by the same application already has input focus.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_focus
+ * @sa @ref window_attention
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwFocusWindow(GLFWwindow* window);
+
+/*! @brief Requests user attention to the specified window.
+ *
+ * This function requests user attention to the specified window. On
+ * platforms where this is not supported, attention is requested to the
+ * application as a whole.
+ *
+ * Once the user has given attention, usually by focusing the window or
+ * application, the system will end the request automatically.
+ *
+ * @param[in] window The window to request attention to.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @macos Attention is requested to the application as a whole, not the
+ * specific window.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_attention
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwRequestWindowAttention(GLFWwindow* window);
+
+/*! @brief Returns the monitor that the window uses for full screen mode.
+ *
+ * This function returns the handle of the monitor that the specified window is
+ * in full screen on.
+ *
+ * @param[in] window The window to query.
+ * @return The monitor, or `NULL` if the window is in windowed mode or an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_monitor
+ * @sa @ref glfwSetWindowMonitor
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
+
+/*! @brief Sets the mode, monitor, video mode and placement of a window.
+ *
+ * This function sets the monitor that the window uses for full screen mode or,
+ * if the monitor is `NULL`, makes it windowed mode.
+ *
+ * When setting a monitor, this function updates the width, height and refresh
+ * rate of the desired video mode and switches to the video mode closest to it.
+ * The window position is ignored when setting a monitor.
+ *
+ * When the monitor is `NULL`, the position, width and height are used to
+ * place the window content area. The refresh rate is ignored when no monitor
+ * is specified.
+ *
+ * If you only wish to update the resolution of a full screen window or the
+ * size of a windowed mode window, see @ref glfwSetWindowSize.
+ *
+ * When a window transitions from full screen to windowed mode, this function
+ * restores any previous window settings such as whether it is decorated,
+ * floating, resizable, has size or aspect ratio limits, etc.
+ *
+ * @param[in] window The window whose monitor, size or video mode to set.
+ * @param[in] monitor The desired monitor, or `NULL` to set windowed mode.
+ * @param[in] xpos The desired x-coordinate of the upper-left corner of the
+ * content area.
+ * @param[in] ypos The desired y-coordinate of the upper-left corner of the
+ * content area.
+ * @param[in] width The desired with, in screen coordinates, of the content
+ * area or video mode.
+ * @param[in] height The desired height, in screen coordinates, of the content
+ * area or video mode.
+ * @param[in] refreshRate The desired refresh rate, in Hz, of the video mode,
+ * or `GLFW_DONT_CARE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark The OpenGL or OpenGL ES context will not be destroyed or otherwise
+ * affected by any resizing or mode switching, although you may need to update
+ * your viewport if the framebuffer size has changed.
+ *
+ * @remark @wayland The desired window position is ignored, as there is no way
+ * for an application to set this property.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_monitor
+ * @sa @ref window_full_screen
+ * @sa @ref glfwGetWindowMonitor
+ * @sa @ref glfwSetWindowSize
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate);
+
+/*! @brief Returns an attribute of the specified window.
+ *
+ * This function returns the value of an attribute of the specified window or
+ * its OpenGL or OpenGL ES context.
+ *
+ * @param[in] window The window to query.
+ * @param[in] attrib The [window attribute](@ref window_attribs) whose value to
+ * return.
+ * @return The value of the attribute, or zero if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark Framebuffer related hints are not window attributes. See @ref
+ * window_attribs_fb for more information.
+ *
+ * @remark Zero is a valid value for many window and context related
+ * attributes so you cannot use a return value of zero as an indication of
+ * errors. However, this function should not fail as long as it is passed
+ * valid arguments and the library has been [initialized](@ref intro_init).
+ *
+ * @remark @wayland The Wayland protocol provides no way to check whether a
+ * window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_attribs
+ * @sa @ref glfwSetWindowAttrib
+ *
+ * @since Added in version 3.0. Replaces `glfwGetWindowParam` and
+ * `glfwGetGLVersion`.
+ *
+ * @ingroup window
+ */
+GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
+
+/*! @brief Sets an attribute of the specified window.
+ *
+ * This function sets the value of an attribute of the specified window.
+ *
+ * The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
+ * [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
+ * [GLFW_FLOATING](@ref GLFW_FLOATING_attrib),
+ * [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib) and
+ * [GLFW_FOCUS_ON_SHOW](@ref GLFW_FOCUS_ON_SHOW_attrib).
+ * [GLFW_MOUSE_PASSTHROUGH](@ref GLFW_MOUSE_PASSTHROUGH_attrib)
+ *
+ * Some of these attributes are ignored for full screen windows. The new
+ * value will take effect if the window is later made windowed.
+ *
+ * Some of these attributes are ignored for windowed mode windows. The new
+ * value will take effect if the window is later made full screen.
+ *
+ * @param[in] window The window to set the attribute for.
+ * @param[in] attrib A supported window attribute.
+ * @param[in] value `GLFW_TRUE` or `GLFW_FALSE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM, @ref GLFW_INVALID_VALUE, @ref GLFW_PLATFORM_ERROR and @ref
+ * GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark Calling @ref glfwGetWindowAttrib will always return the latest
+ * value, even if that value is ignored by the current mode of the window.
+ *
+ * @remark @wayland The [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) window attribute is
+ * not supported. Setting this will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_attribs
+ * @sa @ref glfwGetWindowAttrib
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowAttrib(GLFWwindow* window, int attrib, int value);
+
+/*! @brief Sets the user pointer of the specified window.
+ *
+ * This function sets the user-defined pointer of the specified window. The
+ * current value is retained until the window is destroyed. The initial value
+ * is `NULL`.
+ *
+ * @param[in] window The window whose pointer to set.
+ * @param[in] pointer The new value.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref window_userptr
+ * @sa @ref glfwGetWindowUserPointer
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* window, void* pointer);
+
+/*! @brief Returns the user pointer of the specified window.
+ *
+ * This function returns the current value of the user-defined pointer of the
+ * specified window. The initial value is `NULL`.
+ *
+ * @param[in] window The window whose pointer to return.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref window_userptr
+ * @sa @ref glfwSetWindowUserPointer
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
+
+/*! @brief Sets the position callback for the specified window.
+ *
+ * This function sets the position callback of the specified window, which is
+ * called when the window is moved. The callback is provided with the
+ * position, in screen coordinates, of the upper-left corner of the content
+ * area of the window.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int xpos, int ypos)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowposfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark @wayland This callback will never be called, as there is no way for
+ * an application to know its global position.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_pos
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* window, GLFWwindowposfun callback);
+
+/*! @brief Sets the size callback for the specified window.
+ *
+ * This function sets the size callback of the specified window, which is
+ * called when the window is resized. The callback is provided with the size,
+ * in screen coordinates, of the content area of the window.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int width, int height)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowsizefun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_size
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwindowsizefun callback);
+
+/*! @brief Sets the close callback for the specified window.
+ *
+ * This function sets the close callback of the specified window, which is
+ * called when the user attempts to close the window, for example by clicking
+ * the close widget in the title bar.
+ *
+ * The close flag is set before this callback is called, but you can modify it
+ * at any time with @ref glfwSetWindowShouldClose.
+ *
+ * The close callback is not triggered by @ref glfwDestroyWindow.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowclosefun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark @macos Selecting Quit from the application menu will trigger the
+ * close callback for all windows.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_close
+ *
+ * @since Added in version 2.5.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
+
+/*! @brief Sets the refresh callback for the specified window.
+ *
+ * This function sets the refresh callback of the specified window, which is
+ * called when the content area of the window needs to be redrawn, for example
+ * if the window has been exposed after having been covered by another window.
+ *
+ * On compositing window systems such as Aero, Compiz, Aqua or Wayland, where
+ * the window contents are saved off-screen, this callback may be called only
+ * very infrequently or never at all.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window);
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowrefreshfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_refresh
+ *
+ * @since Added in version 2.5.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* window, GLFWwindowrefreshfun callback);
+
+/*! @brief Sets the focus callback for the specified window.
+ *
+ * This function sets the focus callback of the specified window, which is
+ * called when the window gains or loses input focus.
+ *
+ * After the focus callback is called for a window that lost input focus,
+ * synthetic key and mouse button release events will be generated for all such
+ * that had been pressed. For more information, see @ref glfwSetKeyCallback
+ * and @ref glfwSetMouseButtonCallback.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int focused)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowfocusfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_focus
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwindowfocusfun callback);
+
+/*! @brief Sets the iconify callback for the specified window.
+ *
+ * This function sets the iconification callback of the specified window, which
+ * is called when the window is iconified or restored.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int iconified)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowiconifyfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_iconify
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* window, GLFWwindowiconifyfun callback);
+
+/*! @brief Sets the maximize callback for the specified window.
+ *
+ * This function sets the maximization callback of the specified window, which
+ * is called when the window is maximized or restored.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int maximized)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowmaximizefun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_maximize
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* window, GLFWwindowmaximizefun callback);
+
+/*! @brief Sets the framebuffer resize callback for the specified window.
+ *
+ * This function sets the framebuffer resize callback of the specified window,
+ * which is called when the framebuffer of the specified window is resized.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int width, int height)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWframebuffersizefun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_fbsize
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* window, GLFWframebuffersizefun callback);
+
+/*! @brief Sets the window content scale callback for the specified window.
+ *
+ * This function sets the window content scale callback of the specified window,
+ * which is called when the content scale of the specified window changes.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, float xscale, float yscale)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWwindowcontentscalefun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref window_scale
+ * @sa @ref glfwGetWindowContentScale
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup window
+ */
+GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* window, GLFWwindowcontentscalefun callback);
+
+/*! @brief Processes all pending events.
+ *
+ * This function processes only those events that are already in the event
+ * queue and then returns immediately. Processing events will cause the window
+ * and input callbacks associated with those events to be called.
+ *
+ * On some platforms, a window move, resize or menu operation will cause event
+ * processing to block. This is due to how event processing is designed on
+ * those platforms. You can use the
+ * [window refresh callback](@ref window_refresh) to redraw the contents of
+ * your window when necessary during such operations.
+ *
+ * Do not assume that callbacks you set will _only_ be called in response to
+ * event processing functions like this one. While it is necessary to poll for
+ * events, window systems that require GLFW to register callbacks of its own
+ * can pass events to GLFW in response to many window system function calls.
+ * GLFW will pass those events on to the application callbacks before
+ * returning.
+ *
+ * Event processing is not required for joystick input to work.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref events
+ * @sa @ref glfwWaitEvents
+ * @sa @ref glfwWaitEventsTimeout
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwPollEvents(void);
+
+/*! @brief Waits until events are queued and processes them.
+ *
+ * This function puts the calling thread to sleep until at least one event is
+ * available in the event queue. Once one or more events are available,
+ * it behaves exactly like @ref glfwPollEvents, i.e. the events in the queue
+ * are processed and the function then returns immediately. Processing events
+ * will cause the window and input callbacks associated with those events to be
+ * called.
+ *
+ * Since not all events are associated with callbacks, this function may return
+ * without a callback having been called even if you are monitoring all
+ * callbacks.
+ *
+ * On some platforms, a window move, resize or menu operation will cause event
+ * processing to block. This is due to how event processing is designed on
+ * those platforms. You can use the
+ * [window refresh callback](@ref window_refresh) to redraw the contents of
+ * your window when necessary during such operations.
+ *
+ * Do not assume that callbacks you set will _only_ be called in response to
+ * event processing functions like this one. While it is necessary to poll for
+ * events, window systems that require GLFW to register callbacks of its own
+ * can pass events to GLFW in response to many window system function calls.
+ * GLFW will pass those events on to the application callbacks before
+ * returning.
+ *
+ * Event processing is not required for joystick input to work.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref events
+ * @sa @ref glfwPollEvents
+ * @sa @ref glfwWaitEventsTimeout
+ *
+ * @since Added in version 2.5.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwWaitEvents(void);
+
+/*! @brief Waits with timeout until events are queued and processes them.
+ *
+ * This function puts the calling thread to sleep until at least one event is
+ * available in the event queue, or until the specified timeout is reached. If
+ * one or more events are available, it behaves exactly like @ref
+ * glfwPollEvents, i.e. the events in the queue are processed and the function
+ * then returns immediately. Processing events will cause the window and input
+ * callbacks associated with those events to be called.
+ *
+ * The timeout value must be a positive finite number.
+ *
+ * Since not all events are associated with callbacks, this function may return
+ * without a callback having been called even if you are monitoring all
+ * callbacks.
+ *
+ * On some platforms, a window move, resize or menu operation will cause event
+ * processing to block. This is due to how event processing is designed on
+ * those platforms. You can use the
+ * [window refresh callback](@ref window_refresh) to redraw the contents of
+ * your window when necessary during such operations.
+ *
+ * Do not assume that callbacks you set will _only_ be called in response to
+ * event processing functions like this one. While it is necessary to poll for
+ * events, window systems that require GLFW to register callbacks of its own
+ * can pass events to GLFW in response to many window system function calls.
+ * GLFW will pass those events on to the application callbacks before
+ * returning.
+ *
+ * Event processing is not required for joystick input to work.
+ *
+ * @param[in] timeout The maximum amount of time, in seconds, to wait.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref events
+ * @sa @ref glfwPollEvents
+ * @sa @ref glfwWaitEvents
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwWaitEventsTimeout(double timeout);
+
+/*! @brief Posts an empty event to the event queue.
+ *
+ * This function posts an empty event from the current thread to the event
+ * queue, causing @ref glfwWaitEvents or @ref glfwWaitEventsTimeout to return.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref events
+ * @sa @ref glfwWaitEvents
+ * @sa @ref glfwWaitEventsTimeout
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwPostEmptyEvent(void);
+
+/*! @brief Returns the value of an input option for the specified window.
+ *
+ * This function returns the value of an input option for the specified window.
+ * The mode must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
+ * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
+ * @ref GLFW_RAW_MOUSE_MOTION.
+ *
+ * @param[in] window The window to query.
+ * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
+ * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
+ * `GLFW_RAW_MOUSE_MOTION`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref glfwSetInputMode
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwGetInputMode(GLFWwindow* window, int mode);
+
+/*! @brief Sets an input option for the specified window.
+ *
+ * This function sets an input mode option for the specified window. The mode
+ * must be one of @ref GLFW_CURSOR, @ref GLFW_STICKY_KEYS,
+ * @ref GLFW_STICKY_MOUSE_BUTTONS, @ref GLFW_LOCK_KEY_MODS or
+ * @ref GLFW_RAW_MOUSE_MOTION.
+ *
+ * If the mode is `GLFW_CURSOR`, the value must be one of the following cursor
+ * modes:
+ * - `GLFW_CURSOR_NORMAL` makes the cursor visible and behaving normally.
+ * - `GLFW_CURSOR_HIDDEN` makes the cursor invisible when it is over the
+ * content area of the window but does not restrict the cursor from leaving.
+ * - `GLFW_CURSOR_DISABLED` hides and grabs the cursor, providing virtual
+ * and unlimited cursor movement. This is useful for implementing for
+ * example 3D camera controls.
+ * - `GLFW_CURSOR_CAPTURED` makes the cursor visible and confines it to the
+ * content area of the window.
+ *
+ * If the mode is `GLFW_STICKY_KEYS`, the value must be either `GLFW_TRUE` to
+ * enable sticky keys, or `GLFW_FALSE` to disable it. If sticky keys are
+ * enabled, a key press will ensure that @ref glfwGetKey returns `GLFW_PRESS`
+ * the next time it is called even if the key had been released before the
+ * call. This is useful when you are only interested in whether keys have been
+ * pressed but not when or in which order.
+ *
+ * If the mode is `GLFW_STICKY_MOUSE_BUTTONS`, the value must be either
+ * `GLFW_TRUE` to enable sticky mouse buttons, or `GLFW_FALSE` to disable it.
+ * If sticky mouse buttons are enabled, a mouse button press will ensure that
+ * @ref glfwGetMouseButton returns `GLFW_PRESS` the next time it is called even
+ * if the mouse button had been released before the call. This is useful when
+ * you are only interested in whether mouse buttons have been pressed but not
+ * when or in which order.
+ *
+ * If the mode is `GLFW_LOCK_KEY_MODS`, the value must be either `GLFW_TRUE` to
+ * enable lock key modifier bits, or `GLFW_FALSE` to disable them. If enabled,
+ * callbacks that receive modifier bits will also have the @ref
+ * GLFW_MOD_CAPS_LOCK bit set when the event was generated with Caps Lock on,
+ * and the @ref GLFW_MOD_NUM_LOCK bit when Num Lock was on.
+ *
+ * If the mode is `GLFW_RAW_MOUSE_MOTION`, the value must be either `GLFW_TRUE`
+ * to enable raw (unscaled and unaccelerated) mouse motion when the cursor is
+ * disabled, or `GLFW_FALSE` to disable it. If raw motion is not supported,
+ * attempting to set this will emit @ref GLFW_FEATURE_UNAVAILABLE. Call @ref
+ * glfwRawMouseMotionSupported to check for support.
+ *
+ * @param[in] window The window whose input mode to set.
+ * @param[in] mode One of `GLFW_CURSOR`, `GLFW_STICKY_KEYS`,
+ * `GLFW_STICKY_MOUSE_BUTTONS`, `GLFW_LOCK_KEY_MODS` or
+ * `GLFW_RAW_MOUSE_MOTION`.
+ * @param[in] value The new value of the specified input mode.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM, @ref GLFW_PLATFORM_ERROR and @ref
+ * GLFW_FEATURE_UNAVAILABLE (see above).
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref glfwGetInputMode
+ *
+ * @since Added in version 3.0. Replaces `glfwEnable` and `glfwDisable`.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetInputMode(GLFWwindow* window, int mode, int value);
+
+/*! @brief Returns whether raw mouse motion is supported.
+ *
+ * This function returns whether raw mouse motion is supported on the current
+ * system. This status does not change after GLFW has been initialized so you
+ * only need to check this once. If you attempt to enable raw motion on
+ * a system that does not support it, @ref GLFW_PLATFORM_ERROR will be emitted.
+ *
+ * Raw mouse motion is closer to the actual motion of the mouse across
+ * a surface. It is not affected by the scaling and acceleration applied to
+ * the motion of the desktop cursor. That processing is suitable for a cursor
+ * while raw motion is better for controlling for example a 3D camera. Because
+ * of this, raw mouse motion is only provided when the cursor is disabled.
+ *
+ * @return `GLFW_TRUE` if raw mouse motion is supported on the current machine,
+ * or `GLFW_FALSE` otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref raw_mouse_motion
+ * @sa @ref glfwSetInputMode
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwRawMouseMotionSupported(void);
+
+/*! @brief Returns the layout-specific name of the specified printable key.
+ *
+ * This function returns the name of the specified printable key, encoded as
+ * UTF-8. This is typically the character that key would produce without any
+ * modifier keys, intended for displaying key bindings to the user. For dead
+ * keys, it is typically the diacritic it would add to a character.
+ *
+ * __Do not use this function__ for [text input](@ref input_char). You will
+ * break text input for many languages even if it happens to work for yours.
+ *
+ * If the key is `GLFW_KEY_UNKNOWN`, the scancode is used to identify the key,
+ * otherwise the scancode is ignored. If you specify a non-printable key, or
+ * `GLFW_KEY_UNKNOWN` and a scancode that maps to a non-printable key, this
+ * function returns `NULL` but does not emit an error.
+ *
+ * This behavior allows you to always pass in the arguments in the
+ * [key callback](@ref input_key) without modification.
+ *
+ * The printable keys are:
+ * - `GLFW_KEY_APOSTROPHE`
+ * - `GLFW_KEY_COMMA`
+ * - `GLFW_KEY_MINUS`
+ * - `GLFW_KEY_PERIOD`
+ * - `GLFW_KEY_SLASH`
+ * - `GLFW_KEY_SEMICOLON`
+ * - `GLFW_KEY_EQUAL`
+ * - `GLFW_KEY_LEFT_BRACKET`
+ * - `GLFW_KEY_RIGHT_BRACKET`
+ * - `GLFW_KEY_BACKSLASH`
+ * - `GLFW_KEY_WORLD_1`
+ * - `GLFW_KEY_WORLD_2`
+ * - `GLFW_KEY_0` to `GLFW_KEY_9`
+ * - `GLFW_KEY_A` to `GLFW_KEY_Z`
+ * - `GLFW_KEY_KP_0` to `GLFW_KEY_KP_9`
+ * - `GLFW_KEY_KP_DECIMAL`
+ * - `GLFW_KEY_KP_DIVIDE`
+ * - `GLFW_KEY_KP_MULTIPLY`
+ * - `GLFW_KEY_KP_SUBTRACT`
+ * - `GLFW_KEY_KP_ADD`
+ * - `GLFW_KEY_KP_EQUAL`
+ *
+ * Names for printable keys depend on keyboard layout, while names for
+ * non-printable keys are the same across layouts but depend on the application
+ * language and should be localized along with other user interface text.
+ *
+ * @param[in] key The key to query, or `GLFW_KEY_UNKNOWN`.
+ * @param[in] scancode The scancode of the key to query.
+ * @return The UTF-8 encoded, layout-specific name of the key, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE, @ref GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark The contents of the returned string may change when a keyboard
+ * layout change event is received.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_key_name
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup input
+ */
+GLFWAPI const char* glfwGetKeyName(int key, int scancode);
+
+/*! @brief Returns the platform-specific scancode of the specified key.
+ *
+ * This function returns the platform-specific scancode of the specified key.
+ *
+ * If the specified [key token](@ref keys) corresponds to a physical key not
+ * supported on the current platform then this method will return `-1`.
+ * Calling this function with anything other than a key token will return `-1`
+ * and generate a @ref GLFW_INVALID_ENUM error.
+ *
+ * @param[in] key Any [key token](@ref keys).
+ * @return The platform-specific scancode for the key, or `-1` if the key is
+ * not supported on the current platform or an [error](@ref error_handling)
+ * occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref input_key
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwGetKeyScancode(int key);
+
+/*! @brief Returns the last reported state of a keyboard key for the specified
+ * window.
+ *
+ * This function returns the last state reported for the specified key to the
+ * specified window. The returned state is one of `GLFW_PRESS` or
+ * `GLFW_RELEASE`. The action `GLFW_REPEAT` is only reported to the key callback.
+ *
+ * If the @ref GLFW_STICKY_KEYS input mode is enabled, this function returns
+ * `GLFW_PRESS` the first time you call it for a key that was pressed, even if
+ * that key has already been released.
+ *
+ * The key functions deal with physical keys, with [key tokens](@ref keys)
+ * named after their use on the standard US keyboard layout. If you want to
+ * input text, use the Unicode character callback instead.
+ *
+ * The [modifier key bit masks](@ref mods) are not key tokens and cannot be
+ * used with this function.
+ *
+ * __Do not use this function__ to implement [text input](@ref input_char).
+ *
+ * @param[in] window The desired window.
+ * @param[in] key The desired [keyboard key](@ref keys). `GLFW_KEY_UNKNOWN` is
+ * not a valid key for this function.
+ * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_key
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwGetKey(GLFWwindow* window, int key);
+
+/*! @brief Returns the last reported state of a mouse button for the specified
+ * window.
+ *
+ * This function returns the last state reported for the specified mouse button
+ * to the specified window. The returned state is one of `GLFW_PRESS` or
+ * `GLFW_RELEASE`.
+ *
+ * If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function
+ * returns `GLFW_PRESS` the first time you call it for a mouse button that was
+ * pressed, even if that mouse button has already been released.
+ *
+ * @param[in] window The desired window.
+ * @param[in] button The desired [mouse button](@ref buttons).
+ * @return One of `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_mouse_button
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button);
+
+/*! @brief Retrieves the position of the cursor relative to the content area of
+ * the window.
+ *
+ * This function returns the position of the cursor, in screen coordinates,
+ * relative to the upper-left corner of the content area of the specified
+ * window.
+ *
+ * If the cursor is disabled (with `GLFW_CURSOR_DISABLED`) then the cursor
+ * position is unbounded and limited only by the minimum and maximum values of
+ * a `double`.
+ *
+ * The coordinate can be converted to their integer equivalents with the
+ * `floor` function. Casting directly to an integer type works for positive
+ * coordinates, but fails for negative ones.
+ *
+ * Any or all of the position arguments may be `NULL`. If an error occurs, all
+ * non-`NULL` position arguments will be set to zero.
+ *
+ * @param[in] window The desired window.
+ * @param[out] xpos Where to store the cursor x-coordinate, relative to the
+ * left edge of the content area, or `NULL`.
+ * @param[out] ypos Where to store the cursor y-coordinate, relative to the to
+ * top edge of the content area, or `NULL`.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_pos
+ * @sa @ref glfwSetCursorPos
+ *
+ * @since Added in version 3.0. Replaces `glfwGetMousePos`.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwGetCursorPos(GLFWwindow* window, double* xpos, double* ypos);
+
+/*! @brief Sets the position of the cursor, relative to the content area of the
+ * window.
+ *
+ * This function sets the position, in screen coordinates, of the cursor
+ * relative to the upper-left corner of the content area of the specified
+ * window. The window must have input focus. If the window does not have
+ * input focus when this function is called, it fails silently.
+ *
+ * __Do not use this function__ to implement things like camera controls. GLFW
+ * already provides the `GLFW_CURSOR_DISABLED` cursor mode that hides the
+ * cursor, transparently re-centers it and provides unconstrained cursor
+ * motion. See @ref glfwSetInputMode for more information.
+ *
+ * If the cursor mode is `GLFW_CURSOR_DISABLED` then the cursor position is
+ * unconstrained and limited only by the minimum and maximum values of
+ * a `double`.
+ *
+ * @param[in] window The desired window.
+ * @param[in] xpos The desired x-coordinate, relative to the left edge of the
+ * content area.
+ * @param[in] ypos The desired y-coordinate, relative to the top edge of the
+ * content area.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
+ *
+ * @remark @wayland This function will only work when the cursor mode is
+ * `GLFW_CURSOR_DISABLED`, otherwise it will emit @ref GLFW_FEATURE_UNAVAILABLE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_pos
+ * @sa @ref glfwGetCursorPos
+ *
+ * @since Added in version 3.0. Replaces `glfwSetMousePos`.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
+
+/*! @brief Creates a custom cursor.
+ *
+ * Creates a new custom cursor image that can be set for a window with @ref
+ * glfwSetCursor. The cursor can be destroyed with @ref glfwDestroyCursor.
+ * Any remaining cursors are destroyed by @ref glfwTerminate.
+ *
+ * The pixels are 32-bit, little-endian, non-premultiplied RGBA, i.e. eight
+ * bits per channel with the red channel first. They are arranged canonically
+ * as packed sequential rows, starting from the top-left corner.
+ *
+ * The cursor hotspot is specified in pixels, relative to the upper-left corner
+ * of the cursor image. Like all other coordinate systems in GLFW, the X-axis
+ * points to the right and the Y-axis points down.
+ *
+ * @param[in] image The desired cursor image.
+ * @param[in] xhot The desired x-coordinate, in pixels, of the cursor hotspot.
+ * @param[in] yhot The desired y-coordinate, in pixels, of the cursor hotspot.
+ * @return The handle of the created cursor, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The specified image data is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_object
+ * @sa @ref glfwDestroyCursor
+ * @sa @ref glfwCreateStandardCursor
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcursor* glfwCreateCursor(const GLFWimage* image, int xhot, int yhot);
+
+/*! @brief Creates a cursor with a standard shape.
+ *
+ * Returns a cursor with a standard shape, that can be set for a window with
+ * @ref glfwSetCursor. The images for these cursors come from the system
+ * cursor theme and their exact appearance will vary between platforms.
+ *
+ * Most of these shapes are guaranteed to exist on every supported platform but
+ * a few may not be present. See the table below for details.
+ *
+ * Cursor shape | Windows | macOS | X11 | Wayland
+ * ------------------------------ | ------- | ----- | ------ | -------
+ * @ref GLFW_ARROW_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_IBEAM_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_CROSSHAIR_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_POINTING_HAND_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_RESIZE_EW_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_RESIZE_NS_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_RESIZE_NWSE_CURSOR | Yes | Yes1 | Maybe2 | Maybe2
+ * @ref GLFW_RESIZE_NESW_CURSOR | Yes | Yes1 | Maybe2 | Maybe2
+ * @ref GLFW_RESIZE_ALL_CURSOR | Yes | Yes | Yes | Yes
+ * @ref GLFW_NOT_ALLOWED_CURSOR | Yes | Yes | Maybe2 | Maybe2
+ *
+ * 1) This uses a private system API and may fail in the future.
+ *
+ * 2) This uses a newer standard that not all cursor themes support.
+ *
+ * If the requested shape is not available, this function emits a @ref
+ * GLFW_CURSOR_UNAVAILABLE error and returns `NULL`.
+ *
+ * @param[in] shape One of the [standard shapes](@ref shapes).
+ * @return A new cursor ready to use or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM, @ref GLFW_CURSOR_UNAVAILABLE and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_standard
+ * @sa @ref glfwCreateCursor
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcursor* glfwCreateStandardCursor(int shape);
+
+/*! @brief Destroys a cursor.
+ *
+ * This function destroys a cursor previously created with @ref
+ * glfwCreateCursor. Any remaining cursors will be destroyed by @ref
+ * glfwTerminate.
+ *
+ * If the specified cursor is current for any window, that window will be
+ * reverted to the default cursor. This does not affect the cursor mode.
+ *
+ * @param[in] cursor The cursor object to destroy.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @reentrancy This function must not be called from a callback.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_object
+ * @sa @ref glfwCreateCursor
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwDestroyCursor(GLFWcursor* cursor);
+
+/*! @brief Sets the cursor for the window.
+ *
+ * This function sets the cursor image to be used when the cursor is over the
+ * content area of the specified window. The set cursor will only be visible
+ * when the [cursor mode](@ref cursor_mode) of the window is
+ * `GLFW_CURSOR_NORMAL`.
+ *
+ * On some platforms, the set cursor may not be visible unless the window also
+ * has input focus.
+ *
+ * @param[in] window The window to set the cursor for.
+ * @param[in] cursor The cursor to set, or `NULL` to switch back to the default
+ * arrow cursor.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_object
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetCursor(GLFWwindow* window, GLFWcursor* cursor);
+
+/*! @brief Sets the key callback.
+ *
+ * This function sets the key callback of the specified window, which is called
+ * when a key is pressed, repeated or released.
+ *
+ * The key functions deal with physical keys, with layout independent
+ * [key tokens](@ref keys) named after their values in the standard US keyboard
+ * layout. If you want to input text, use the
+ * [character callback](@ref glfwSetCharCallback) instead.
+ *
+ * When a window loses input focus, it will generate synthetic key release
+ * events for all pressed keys with associated key tokens. You can tell these
+ * events from user-generated events by the fact that the synthetic ones are
+ * generated after the focus loss event has been processed, i.e. after the
+ * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
+ *
+ * The scancode of a key is specific to that platform or sometimes even to that
+ * machine. Scancodes are intended to allow users to bind keys that don't have
+ * a GLFW key token. Such keys have `key` set to `GLFW_KEY_UNKNOWN`, their
+ * state is not saved and so it cannot be queried with @ref glfwGetKey.
+ *
+ * Sometimes GLFW needs to generate synthetic key events, in which case the
+ * scancode may be zero.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new key callback, or `NULL` to remove the currently
+ * set callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int key, int scancode, int action, int mods)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWkeyfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_key
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWkeyfun glfwSetKeyCallback(GLFWwindow* window, GLFWkeyfun callback);
+
+/*! @brief Sets the Unicode character callback.
+ *
+ * This function sets the character callback of the specified window, which is
+ * called when a Unicode character is input.
+ *
+ * The character callback is intended for Unicode text input. As it deals with
+ * characters, it is keyboard layout dependent, whereas the
+ * [key callback](@ref glfwSetKeyCallback) is not. Characters do not map 1:1
+ * to physical keys, as a key may produce zero, one or more characters. If you
+ * want to know whether a specific physical key was pressed or released, see
+ * the key callback instead.
+ *
+ * The character callback behaves as system text input normally does and will
+ * not be called if modifier keys are held down that would prevent normal text
+ * input on that platform, for example a Super (Command) key on macOS or Alt key
+ * on Windows.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, unsigned int codepoint)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWcharfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_char
+ *
+ * @since Added in version 2.4.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcharfun glfwSetCharCallback(GLFWwindow* window, GLFWcharfun callback);
+
+/*! @brief Sets the Unicode character with modifiers callback.
+ *
+ * This function sets the character with modifiers callback of the specified
+ * window, which is called when a Unicode character is input regardless of what
+ * modifier keys are used.
+ *
+ * The character with modifiers callback is intended for implementing custom
+ * Unicode character input. For regular Unicode text input, see the
+ * [character callback](@ref glfwSetCharCallback). Like the character
+ * callback, the character with modifiers callback deals with characters and is
+ * keyboard layout dependent. Characters do not map 1:1 to physical keys, as
+ * a key may produce zero, one or more characters. If you want to know whether
+ * a specific physical key was pressed or released, see the
+ * [key callback](@ref glfwSetKeyCallback) instead.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or an
+ * [error](@ref error_handling) occurred.
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, unsigned int codepoint, int mods)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWcharmodsfun).
+ *
+ * @deprecated Scheduled for removal in version 4.0.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_char
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcharmodsfun glfwSetCharModsCallback(GLFWwindow* window, GLFWcharmodsfun callback);
+
+/*! @brief Sets the mouse button callback.
+ *
+ * This function sets the mouse button callback of the specified window, which
+ * is called when a mouse button is pressed or released.
+ *
+ * When a window loses input focus, it will generate synthetic mouse button
+ * release events for all pressed mouse buttons. You can tell these events
+ * from user-generated events by the fact that the synthetic ones are generated
+ * after the focus loss event has been processed, i.e. after the
+ * [window focus callback](@ref glfwSetWindowFocusCallback) has been called.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int button, int action, int mods)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWmousebuttonfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref input_mouse_button
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter and return value.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWmousebuttonfun glfwSetMouseButtonCallback(GLFWwindow* window, GLFWmousebuttonfun callback);
+
+/*! @brief Sets the cursor position callback.
+ *
+ * This function sets the cursor position callback of the specified window,
+ * which is called when the cursor is moved. The callback is provided with the
+ * position, in screen coordinates, relative to the upper-left corner of the
+ * content area of the window.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, double xpos, double ypos);
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWcursorposfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_pos
+ *
+ * @since Added in version 3.0. Replaces `glfwSetMousePosCallback`.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcursorposfun glfwSetCursorPosCallback(GLFWwindow* window, GLFWcursorposfun callback);
+
+/*! @brief Sets the cursor enter/leave callback.
+ *
+ * This function sets the cursor boundary crossing callback of the specified
+ * window, which is called when the cursor enters or leaves the content area of
+ * the window.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int entered)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWcursorenterfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref cursor_enter
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWcursorenterfun glfwSetCursorEnterCallback(GLFWwindow* window, GLFWcursorenterfun callback);
+
+/*! @brief Sets the scroll callback.
+ *
+ * This function sets the scroll callback of the specified window, which is
+ * called when a scrolling device is used, such as a mouse wheel or scrolling
+ * area of a touchpad.
+ *
+ * The scroll callback receives all scrolling input, like that from a mouse
+ * wheel or a touchpad scrolling area.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new scroll callback, or `NULL` to remove the
+ * currently set callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, double xoffset, double yoffset)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWscrollfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref scrolling
+ *
+ * @since Added in version 3.0. Replaces `glfwSetMouseWheelCallback`.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWscrollfun glfwSetScrollCallback(GLFWwindow* window, GLFWscrollfun callback);
+
+/*! @brief Sets the path drop callback.
+ *
+ * This function sets the path drop callback of the specified window, which is
+ * called when one or more dragged paths are dropped on the window.
+ *
+ * Because the path array and its strings may have been generated specifically
+ * for that event, they are not guaranteed to be valid after the callback has
+ * returned. If you wish to use them after the callback returns, you need to
+ * make a deep copy.
+ *
+ * @param[in] window The window whose callback to set.
+ * @param[in] callback The new file drop callback, or `NULL` to remove the
+ * currently set callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(GLFWwindow* window, int path_count, const char* paths[])
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWdropfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref path_drop
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWdropfun glfwSetDropCallback(GLFWwindow* window, GLFWdropfun callback);
+
+/*! @brief Returns whether the specified joystick is present.
+ *
+ * This function returns whether the specified joystick is present.
+ *
+ * There is no need to call this function before other functions that accept
+ * a joystick ID, as they all check for presence before performing any other
+ * work.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @return `GLFW_TRUE` if the joystick is present, or `GLFW_FALSE` otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick
+ *
+ * @since Added in version 3.0. Replaces `glfwGetJoystickParam`.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwJoystickPresent(int jid);
+
+/*! @brief Returns the values of all axes of the specified joystick.
+ *
+ * This function returns the values of all axes of the specified joystick.
+ * Each element in the array is a value between -1.0 and 1.0.
+ *
+ * If the specified joystick is not present this function will return `NULL`
+ * but will not generate an error. This can be used instead of first calling
+ * @ref glfwJoystickPresent.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @param[out] count Where to store the number of axis values in the returned
+ * array. This is set to zero if the joystick is not present or an error
+ * occurred.
+ * @return An array of axis values, or `NULL` if the joystick is not present or
+ * an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick_axis
+ *
+ * @since Added in version 3.0. Replaces `glfwGetJoystickPos`.
+ *
+ * @ingroup input
+ */
+GLFWAPI const float* glfwGetJoystickAxes(int jid, int* count);
+
+/*! @brief Returns the state of all buttons of the specified joystick.
+ *
+ * This function returns the state of all buttons of the specified joystick.
+ * Each element in the array is either `GLFW_PRESS` or `GLFW_RELEASE`.
+ *
+ * For backward compatibility with earlier versions that did not have @ref
+ * glfwGetJoystickHats, the button array also includes all hats, each
+ * represented as four buttons. The hats are in the same order as returned by
+ * __glfwGetJoystickHats__ and are in the order _up_, _right_, _down_ and
+ * _left_. To disable these extra buttons, set the @ref
+ * GLFW_JOYSTICK_HAT_BUTTONS init hint before initialization.
+ *
+ * If the specified joystick is not present this function will return `NULL`
+ * but will not generate an error. This can be used instead of first calling
+ * @ref glfwJoystickPresent.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @param[out] count Where to store the number of button states in the returned
+ * array. This is set to zero if the joystick is not present or an error
+ * occurred.
+ * @return An array of button states, or `NULL` if the joystick is not present
+ * or an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick_button
+ *
+ * @since Added in version 2.2.
+ * @glfw3 Changed to return a dynamic array.
+ *
+ * @ingroup input
+ */
+GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
+
+/*! @brief Returns the state of all hats of the specified joystick.
+ *
+ * This function returns the state of all hats of the specified joystick.
+ * Each element in the array is one of the following values:
+ *
+ * Name | Value
+ * ---- | -----
+ * `GLFW_HAT_CENTERED` | 0
+ * `GLFW_HAT_UP` | 1
+ * `GLFW_HAT_RIGHT` | 2
+ * `GLFW_HAT_DOWN` | 4
+ * `GLFW_HAT_LEFT` | 8
+ * `GLFW_HAT_RIGHT_UP` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_UP`
+ * `GLFW_HAT_RIGHT_DOWN` | `GLFW_HAT_RIGHT` \| `GLFW_HAT_DOWN`
+ * `GLFW_HAT_LEFT_UP` | `GLFW_HAT_LEFT` \| `GLFW_HAT_UP`
+ * `GLFW_HAT_LEFT_DOWN` | `GLFW_HAT_LEFT` \| `GLFW_HAT_DOWN`
+ *
+ * The diagonal directions are bitwise combinations of the primary (up, right,
+ * down and left) directions and you can test for these individually by ANDing
+ * it with the corresponding direction.
+ *
+ * @code
+ * if (hats[2] & GLFW_HAT_RIGHT)
+ * {
+ * // State of hat 2 could be right-up, right or right-down
+ * }
+ * @endcode
+ *
+ * If the specified joystick is not present this function will return `NULL`
+ * but will not generate an error. This can be used instead of first calling
+ * @ref glfwJoystickPresent.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @param[out] count Where to store the number of hat states in the returned
+ * array. This is set to zero if the joystick is not present or an error
+ * occurred.
+ * @return An array of hat states, or `NULL` if the joystick is not present
+ * or an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected, this function is called again for that joystick or the library
+ * is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick_hat
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI const unsigned char* glfwGetJoystickHats(int jid, int* count);
+
+/*! @brief Returns the name of the specified joystick.
+ *
+ * This function returns the name, encoded as UTF-8, of the specified joystick.
+ * The returned string is allocated and freed by GLFW. You should not free it
+ * yourself.
+ *
+ * If the specified joystick is not present this function will return `NULL`
+ * but will not generate an error. This can be used instead of first calling
+ * @ref glfwJoystickPresent.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @return The UTF-8 encoded name of the joystick, or `NULL` if the joystick
+ * is not present or an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick_name
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI const char* glfwGetJoystickName(int jid);
+
+/*! @brief Returns the SDL compatible GUID of the specified joystick.
+ *
+ * This function returns the SDL compatible GUID, as a UTF-8 encoded
+ * hexadecimal string, of the specified joystick. The returned string is
+ * allocated and freed by GLFW. You should not free it yourself.
+ *
+ * The GUID is what connects a joystick to a gamepad mapping. A connected
+ * joystick will always have a GUID even if there is no gamepad mapping
+ * assigned to it.
+ *
+ * If the specified joystick is not present this function will return `NULL`
+ * but will not generate an error. This can be used instead of first calling
+ * @ref glfwJoystickPresent.
+ *
+ * The GUID uses the format introduced in SDL 2.0.5. This GUID tries to
+ * uniquely identify the make and model of a joystick but does not identify
+ * a specific unit, e.g. all wired Xbox 360 controllers will have the same
+ * GUID on that platform. The GUID for a unit may vary between platforms
+ * depending on what hardware information the platform specific APIs provide.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @return The UTF-8 encoded GUID of the joystick, or `NULL` if the joystick
+ * is not present or an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_INVALID_ENUM and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref gamepad
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI const char* glfwGetJoystickGUID(int jid);
+
+/*! @brief Sets the user pointer of the specified joystick.
+ *
+ * This function sets the user-defined pointer of the specified joystick. The
+ * current value is retained until the joystick is disconnected. The initial
+ * value is `NULL`.
+ *
+ * This function may be called from the joystick callback, even for a joystick
+ * that is being disconnected.
+ *
+ * @param[in] jid The joystick whose pointer to set.
+ * @param[in] pointer The new value.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref joystick_userptr
+ * @sa @ref glfwGetJoystickUserPointer
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetJoystickUserPointer(int jid, void* pointer);
+
+/*! @brief Returns the user pointer of the specified joystick.
+ *
+ * This function returns the current value of the user-defined pointer of the
+ * specified joystick. The initial value is `NULL`.
+ *
+ * This function may be called from the joystick callback, even for a joystick
+ * that is being disconnected.
+ *
+ * @param[in] jid The joystick whose pointer to return.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @sa @ref joystick_userptr
+ * @sa @ref glfwSetJoystickUserPointer
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI void* glfwGetJoystickUserPointer(int jid);
+
+/*! @brief Returns whether the specified joystick has a gamepad mapping.
+ *
+ * This function returns whether the specified joystick is both present and has
+ * a gamepad mapping.
+ *
+ * If the specified joystick is present but does not have a gamepad mapping
+ * this function will return `GLFW_FALSE` but will not generate an error. Call
+ * @ref glfwJoystickPresent to check if a joystick is present regardless of
+ * whether it has a mapping.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @return `GLFW_TRUE` if a joystick is both present and has a gamepad mapping,
+ * or `GLFW_FALSE` otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref gamepad
+ * @sa @ref glfwGetGamepadState
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwJoystickIsGamepad(int jid);
+
+/*! @brief Sets the joystick configuration callback.
+ *
+ * This function sets the joystick configuration callback, or removes the
+ * currently set callback. This is called when a joystick is connected to or
+ * disconnected from the system.
+ *
+ * For joystick connection and disconnection events to be delivered on all
+ * platforms, you need to call one of the [event processing](@ref events)
+ * functions. Joystick disconnection may also be detected and the callback
+ * called by joystick functions. The function will then return whatever it
+ * returns if the joystick is not present.
+ *
+ * @param[in] callback The new callback, or `NULL` to remove the currently set
+ * callback.
+ * @return The previously set callback, or `NULL` if no callback was set or the
+ * library had not been [initialized](@ref intro_init).
+ *
+ * @callback_signature
+ * @code
+ * void function_name(int jid, int event)
+ * @endcode
+ * For more information about the callback parameters, see the
+ * [function pointer type](@ref GLFWjoystickfun).
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref joystick_event
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup input
+ */
+GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
+
+/*! @brief Adds the specified SDL_GameControllerDB gamepad mappings.
+ *
+ * This function parses the specified ASCII encoded string and updates the
+ * internal list with any gamepad mappings it finds. This string may
+ * contain either a single gamepad mapping or many mappings separated by
+ * newlines. The parser supports the full format of the `gamecontrollerdb.txt`
+ * source file including empty lines and comments.
+ *
+ * See @ref gamepad_mapping for a description of the format.
+ *
+ * If there is already a gamepad mapping for a given GUID in the internal list,
+ * it will be replaced by the one passed to this function. If the library is
+ * terminated and re-initialized the internal list will revert to the built-in
+ * default.
+ *
+ * @param[in] string The string containing the gamepad mappings.
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_VALUE.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref gamepad
+ * @sa @ref glfwJoystickIsGamepad
+ * @sa @ref glfwGetGamepadName
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwUpdateGamepadMappings(const char* string);
+
+/*! @brief Returns the human-readable gamepad name for the specified joystick.
+ *
+ * This function returns the human-readable name of the gamepad from the
+ * gamepad mapping assigned to the specified joystick.
+ *
+ * If the specified joystick is not present or does not have a gamepad mapping
+ * this function will return `NULL` but will not generate an error. Call
+ * @ref glfwJoystickPresent to check whether it is present regardless of
+ * whether it has a mapping.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @return The UTF-8 encoded name of the gamepad, or `NULL` if the
+ * joystick is not present, does not have a mapping or an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the specified joystick is
+ * disconnected, the gamepad mappings are updated or the library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref gamepad
+ * @sa @ref glfwJoystickIsGamepad
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI const char* glfwGetGamepadName(int jid);
+
+/*! @brief Retrieves the state of the specified joystick remapped as a gamepad.
+ *
+ * This function retrieves the state of the specified joystick remapped to
+ * an Xbox-like gamepad.
+ *
+ * If the specified joystick is not present or does not have a gamepad mapping
+ * this function will return `GLFW_FALSE` but will not generate an error. Call
+ * @ref glfwJoystickPresent to check whether it is present regardless of
+ * whether it has a mapping.
+ *
+ * The Guide button may not be available for input as it is often hooked by the
+ * system or the Steam client.
+ *
+ * Not all devices have all the buttons or axes provided by @ref
+ * GLFWgamepadstate. Unavailable buttons and axes will always report
+ * `GLFW_RELEASE` and 0.0 respectively.
+ *
+ * @param[in] jid The [joystick](@ref joysticks) to query.
+ * @param[out] state The gamepad input state of the joystick.
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if no joystick is
+ * connected, it has no gamepad mapping or an [error](@ref error_handling)
+ * occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_ENUM.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref gamepad
+ * @sa @ref glfwUpdateGamepadMappings
+ * @sa @ref glfwJoystickIsGamepad
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup input
+ */
+GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
+
+/*! @brief Sets the clipboard to the specified string.
+ *
+ * This function sets the system clipboard to the specified, UTF-8 encoded
+ * string.
+ *
+ * @param[in] window Deprecated. Any valid window or `NULL`.
+ * @param[in] string A UTF-8 encoded string.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @remark @win32 The clipboard on Windows has a single global lock for reading and
+ * writing. GLFW tries to acquire it a few times, which is almost always enough. If it
+ * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ * It is safe to try this multiple times.
+ *
+ * @pointer_lifetime The specified string is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref clipboard
+ * @sa @ref glfwGetClipboardString
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
+
+/*! @brief Returns the contents of the clipboard as a string.
+ *
+ * This function returns the contents of the system clipboard, if it contains
+ * or is convertible to a UTF-8 encoded string. If the clipboard is empty or
+ * if its contents cannot be converted, `NULL` is returned and a @ref
+ * GLFW_FORMAT_UNAVAILABLE error is generated.
+ *
+ * @param[in] window Deprecated. Any valid window or `NULL`.
+ * @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
+ * if an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_FORMAT_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark @win32 The clipboard on Windows has a single global lock for reading and
+ * writing. GLFW tries to acquire it a few times, which is almost always enough. If it
+ * cannot acquire the lock then this function emits @ref GLFW_PLATFORM_ERROR and returns.
+ * It is safe to try this multiple times.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the next call to @ref
+ * glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
+ * is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref clipboard
+ * @sa @ref glfwSetClipboardString
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
+
+/*! @brief Returns the GLFW time.
+ *
+ * This function returns the current GLFW time, in seconds. Unless the time
+ * has been set using @ref glfwSetTime it measures time elapsed since GLFW was
+ * initialized.
+ *
+ * This function and @ref glfwSetTime are helper functions on top of @ref
+ * glfwGetTimerFrequency and @ref glfwGetTimerValue.
+ *
+ * The resolution of the timer is system dependent, but is usually on the order
+ * of a few micro- or nanoseconds. It uses the highest-resolution monotonic
+ * time source on each operating system.
+ *
+ * @return The current time, in seconds, or zero if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread. Reading and
+ * writing of the internal base time is not atomic, so it needs to be
+ * externally synchronized with calls to @ref glfwSetTime.
+ *
+ * @sa @ref time
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup input
+ */
+GLFWAPI double glfwGetTime(void);
+
+/*! @brief Sets the GLFW time.
+ *
+ * This function sets the current GLFW time, in seconds. The value must be
+ * a positive finite number less than or equal to 18446744073.0, which is
+ * approximately 584.5 years.
+ *
+ * This function and @ref glfwGetTime are helper functions on top of @ref
+ * glfwGetTimerFrequency and @ref glfwGetTimerValue.
+ *
+ * @param[in] time The new value, in seconds.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_INVALID_VALUE.
+ *
+ * @remark The upper limit of GLFW time is calculated as
+ * floor((264 - 1) / 109) and is due to implementations
+ * storing nanoseconds in 64 bits. The limit may be increased in the future.
+ *
+ * @thread_safety This function may be called from any thread. Reading and
+ * writing of the internal base time is not atomic, so it needs to be
+ * externally synchronized with calls to @ref glfwGetTime.
+ *
+ * @sa @ref time
+ *
+ * @since Added in version 2.2.
+ *
+ * @ingroup input
+ */
+GLFWAPI void glfwSetTime(double time);
+
+/*! @brief Returns the current value of the raw timer.
+ *
+ * This function returns the current value of the raw timer, measured in
+ * 1 / frequency seconds. To get the frequency, call @ref
+ * glfwGetTimerFrequency.
+ *
+ * @return The value of the timer, or zero if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref time
+ * @sa @ref glfwGetTimerFrequency
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup input
+ */
+GLFWAPI uint64_t glfwGetTimerValue(void);
+
+/*! @brief Returns the frequency, in Hz, of the raw timer.
+ *
+ * This function returns the frequency, in Hz, of the raw timer.
+ *
+ * @return The frequency of the timer, in Hz, or zero if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref time
+ * @sa @ref glfwGetTimerValue
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup input
+ */
+GLFWAPI uint64_t glfwGetTimerFrequency(void);
+
+/*! @brief Makes the context of the specified window current for the calling
+ * thread.
+ *
+ * This function makes the OpenGL or OpenGL ES context of the specified window
+ * current on the calling thread. It can also detach the current context from
+ * the calling thread without making a new one current by passing in `NULL`.
+ *
+ * A context must only be made current on a single thread at a time and each
+ * thread can have only a single current context at a time. Making a context
+ * current detaches any previously current context on the calling thread.
+ *
+ * When moving a context between threads, you must detach it (make it
+ * non-current) on the old thread before making it current on the new one.
+ *
+ * By default, making a context non-current implicitly forces a pipeline flush.
+ * On machines that support `GL_KHR_context_flush_control`, you can control
+ * whether a context performs this flush by setting the
+ * [GLFW_CONTEXT_RELEASE_BEHAVIOR](@ref GLFW_CONTEXT_RELEASE_BEHAVIOR_hint)
+ * hint.
+ *
+ * The specified window must have an OpenGL or OpenGL ES context. Specifying
+ * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
+ * error.
+ *
+ * @param[in] window The window whose context to make current, or `NULL` to
+ * detach the current context.
+ *
+ * @remarks If the previously current context was created via a different
+ * context creation API than the one passed to this function, GLFW will still
+ * detach the previous one from its API before making the new one current.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref context_current
+ * @sa @ref glfwGetCurrentContext
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup context
+ */
+GLFWAPI void glfwMakeContextCurrent(GLFWwindow* window);
+
+/*! @brief Returns the window whose context is current on the calling thread.
+ *
+ * This function returns the window whose OpenGL or OpenGL ES context is
+ * current on the calling thread.
+ *
+ * @return The window whose context is current, or `NULL` if no window's
+ * context is current.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref context_current
+ * @sa @ref glfwMakeContextCurrent
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup context
+ */
+GLFWAPI GLFWwindow* glfwGetCurrentContext(void);
+
+/*! @brief Swaps the front and back buffers of the specified window.
+ *
+ * This function swaps the front and back buffers of the specified window when
+ * rendering with OpenGL or OpenGL ES. If the swap interval is greater than
+ * zero, the GPU driver waits the specified number of screen updates before
+ * swapping the buffers.
+ *
+ * The specified window must have an OpenGL or OpenGL ES context. Specifying
+ * a window without a context will generate a @ref GLFW_NO_WINDOW_CONTEXT
+ * error.
+ *
+ * This function does not apply to Vulkan. If you are rendering with Vulkan,
+ * see `vkQueuePresentKHR` instead.
+ *
+ * @param[in] window The window whose buffers to swap.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark __EGL:__ The context of the specified window must be current on the
+ * calling thread.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref buffer_swap
+ * @sa @ref glfwSwapInterval
+ *
+ * @since Added in version 1.0.
+ * @glfw3 Added window handle parameter.
+ *
+ * @ingroup window
+ */
+GLFWAPI void glfwSwapBuffers(GLFWwindow* window);
+
+/*! @brief Sets the swap interval for the current context.
+ *
+ * This function sets the swap interval for the current OpenGL or OpenGL ES
+ * context, i.e. the number of screen updates to wait from the time @ref
+ * glfwSwapBuffers was called before swapping the buffers and returning. This
+ * is sometimes called _vertical synchronization_, _vertical retrace
+ * synchronization_ or just _vsync_.
+ *
+ * A context that supports either of the `WGL_EXT_swap_control_tear` and
+ * `GLX_EXT_swap_control_tear` extensions also accepts _negative_ swap
+ * intervals, which allows the driver to swap immediately even if a frame
+ * arrives a little bit late. You can check for these extensions with @ref
+ * glfwExtensionSupported.
+ *
+ * A context must be current on the calling thread. Calling this function
+ * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ * This function does not apply to Vulkan. If you are rendering with Vulkan,
+ * see the present mode of your swapchain instead.
+ *
+ * @param[in] interval The minimum number of screen updates to wait for
+ * until the buffers are swapped by @ref glfwSwapBuffers.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark This function is not called during context creation, leaving the
+ * swap interval set to whatever is the default for that API. This is done
+ * because some swap interval extensions used by GLFW do not allow the swap
+ * interval to be reset to zero once it has been set to a non-zero value.
+ *
+ * @remark Some GPU drivers do not honor the requested swap interval, either
+ * because of a user setting that overrides the application's request or due to
+ * bugs in the driver.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref buffer_swap
+ * @sa @ref glfwSwapBuffers
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup context
+ */
+GLFWAPI void glfwSwapInterval(int interval);
+
+/*! @brief Returns whether the specified extension is available.
+ *
+ * This function returns whether the specified
+ * [API extension](@ref context_glext) is supported by the current OpenGL or
+ * OpenGL ES context. It searches both for client API extension and context
+ * creation API extensions.
+ *
+ * A context must be current on the calling thread. Calling this function
+ * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ * As this functions retrieves and searches one or more extension strings each
+ * call, it is recommended that you cache its results if it is going to be used
+ * frequently. The extension strings will not change during the lifetime of
+ * a context, so there is no danger in doing this.
+ *
+ * This function does not apply to Vulkan. If you are using Vulkan, see @ref
+ * glfwGetRequiredInstanceExtensions, `vkEnumerateInstanceExtensionProperties`
+ * and `vkEnumerateDeviceExtensionProperties` instead.
+ *
+ * @param[in] extension The ASCII encoded name of the extension.
+ * @return `GLFW_TRUE` if the extension is available, or `GLFW_FALSE`
+ * otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref
+ * GLFW_PLATFORM_ERROR.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref context_glext
+ * @sa @ref glfwGetProcAddress
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup context
+ */
+GLFWAPI int glfwExtensionSupported(const char* extension);
+
+/*! @brief Returns the address of the specified function for the current
+ * context.
+ *
+ * This function returns the address of the specified OpenGL or OpenGL ES
+ * [core or extension function](@ref context_glext), if it is supported
+ * by the current context.
+ *
+ * A context must be current on the calling thread. Calling this function
+ * without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
+ *
+ * This function does not apply to Vulkan. If you are rendering with Vulkan,
+ * see @ref glfwGetInstanceProcAddress, `vkGetInstanceProcAddr` and
+ * `vkGetDeviceProcAddr` instead.
+ *
+ * @param[in] procname The ASCII encoded name of the function.
+ * @return The address of the function, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_CURRENT_CONTEXT and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark The address of a given function is not guaranteed to be the same
+ * between contexts.
+ *
+ * @remark This function may return a non-`NULL` address despite the
+ * associated version or extension not being available. Always check the
+ * context version or extension string first.
+ *
+ * @pointer_lifetime The returned function pointer is valid until the context
+ * is destroyed or the library is terminated.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref context_glext
+ * @sa @ref glfwExtensionSupported
+ *
+ * @since Added in version 1.0.
+ *
+ * @ingroup context
+ */
+GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname);
+
+/*! @brief Returns whether the Vulkan loader and an ICD have been found.
+ *
+ * This function returns whether the Vulkan loader and any minimally functional
+ * ICD have been found.
+ *
+ * The availability of a Vulkan loader and even an ICD does not by itself guarantee that
+ * surface creation or even instance creation is possible. Call @ref
+ * glfwGetRequiredInstanceExtensions to check whether the extensions necessary for Vulkan
+ * surface creation are available and @ref glfwGetPhysicalDevicePresentationSupport to
+ * check whether a queue family of a physical device supports image presentation.
+ *
+ * @return `GLFW_TRUE` if Vulkan is minimally available, or `GLFW_FALSE`
+ * otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref vulkan_support
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+GLFWAPI int glfwVulkanSupported(void);
+
+/*! @brief Returns the Vulkan instance extensions required by GLFW.
+ *
+ * This function returns an array of names of Vulkan instance extensions required
+ * by GLFW for creating Vulkan surfaces for GLFW windows. If successful, the
+ * list will always contain `VK_KHR_surface`, so if you don't require any
+ * additional extensions you can pass this list directly to the
+ * `VkInstanceCreateInfo` struct.
+ *
+ * If Vulkan is not available on the machine, this function returns `NULL` and
+ * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
+ * to check whether Vulkan is at least minimally available.
+ *
+ * If Vulkan is available but no set of extensions allowing window surface
+ * creation was found, this function returns `NULL`. You may still use Vulkan
+ * for off-screen rendering and compute work.
+ *
+ * @param[out] count Where to store the number of extensions in the returned
+ * array. This is set to zero if an error occurred.
+ * @return An array of ASCII encoded extension names, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_API_UNAVAILABLE.
+ *
+ * @remark Additional extensions may be required by future versions of GLFW.
+ * You should check if any extensions you wish to enable are already in the
+ * returned array, as it is an error to specify an extension more than once in
+ * the `VkInstanceCreateInfo` struct.
+ *
+ * @pointer_lifetime The returned array is allocated and freed by GLFW. You
+ * should not free it yourself. It is guaranteed to be valid only until the
+ * library is terminated.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref vulkan_ext
+ * @sa @ref glfwCreateWindowSurface
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+GLFWAPI const char** glfwGetRequiredInstanceExtensions(uint32_t* count);
+
+#if defined(VK_VERSION_1_0)
+
+/*! @brief Returns the address of the specified Vulkan instance function.
+ *
+ * This function returns the address of the specified Vulkan core or extension
+ * function for the specified instance. If instance is set to `NULL` it can
+ * return any function exported from the Vulkan loader, including at least the
+ * following functions:
+ *
+ * - `vkEnumerateInstanceExtensionProperties`
+ * - `vkEnumerateInstanceLayerProperties`
+ * - `vkCreateInstance`
+ * - `vkGetInstanceProcAddr`
+ *
+ * If Vulkan is not available on the machine, this function returns `NULL` and
+ * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
+ * to check whether Vulkan is at least minimally available.
+ *
+ * This function is equivalent to calling `vkGetInstanceProcAddr` with
+ * a platform-specific query of the Vulkan loader as a fallback.
+ *
+ * @param[in] instance The Vulkan instance to query, or `NULL` to retrieve
+ * functions related to instance creation.
+ * @param[in] procname The ASCII encoded name of the function.
+ * @return The address of the function, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_API_UNAVAILABLE.
+ *
+ * @pointer_lifetime The returned function pointer is valid until the library
+ * is terminated.
+ *
+ * @thread_safety This function may be called from any thread.
+ *
+ * @sa @ref vulkan_proc
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, const char* procname);
+
+/*! @brief Returns whether the specified queue family can present images.
+ *
+ * This function returns whether the specified queue family of the specified
+ * physical device supports presentation to the platform GLFW was built for.
+ *
+ * If Vulkan or the required window surface creation instance extensions are
+ * not available on the machine, or if the specified instance was not created
+ * with the required extensions, this function returns `GLFW_FALSE` and
+ * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported
+ * to check whether Vulkan is at least minimally available and @ref
+ * glfwGetRequiredInstanceExtensions to check what instance extensions are
+ * required.
+ *
+ * @param[in] instance The instance that the physical device belongs to.
+ * @param[in] device The physical device that the queue family belongs to.
+ * @param[in] queuefamily The index of the queue family to query.
+ * @return `GLFW_TRUE` if the queue family supports presentation, or
+ * `GLFW_FALSE` otherwise.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_API_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @remark @macos This function currently always returns `GLFW_TRUE`, as the
+ * `VK_MVK_macos_surface` and `VK_EXT_metal_surface` extensions do not provide
+ * a `vkGetPhysicalDevice*PresentationSupport` type function.
+ *
+ * @thread_safety This function may be called from any thread. For
+ * synchronization details of Vulkan objects, see the Vulkan specification.
+ *
+ * @sa @ref vulkan_present
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+GLFWAPI int glfwGetPhysicalDevicePresentationSupport(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
+
+/*! @brief Creates a Vulkan surface for the specified window.
+ *
+ * This function creates a Vulkan surface for the specified window.
+ *
+ * If the Vulkan loader or at least one minimally functional ICD were not found,
+ * this function returns `VK_ERROR_INITIALIZATION_FAILED` and generates a @ref
+ * GLFW_API_UNAVAILABLE error. Call @ref glfwVulkanSupported to check whether
+ * Vulkan is at least minimally available.
+ *
+ * If the required window surface creation instance extensions are not
+ * available or if the specified instance was not created with these extensions
+ * enabled, this function returns `VK_ERROR_EXTENSION_NOT_PRESENT` and
+ * generates a @ref GLFW_API_UNAVAILABLE error. Call @ref
+ * glfwGetRequiredInstanceExtensions to check what instance extensions are
+ * required.
+ *
+ * The window surface cannot be shared with another API so the window must
+ * have been created with the [client api hint](@ref GLFW_CLIENT_API_attrib)
+ * set to `GLFW_NO_API` otherwise it generates a @ref GLFW_INVALID_VALUE error
+ * and returns `VK_ERROR_NATIVE_WINDOW_IN_USE_KHR`.
+ *
+ * The window surface must be destroyed before the specified Vulkan instance.
+ * It is the responsibility of the caller to destroy the window surface. GLFW
+ * does not destroy it for you. Call `vkDestroySurfaceKHR` to destroy the
+ * surface.
+ *
+ * @param[in] instance The Vulkan instance to create the surface in.
+ * @param[in] window The window to create the surface for.
+ * @param[in] allocator The allocator to use, or `NULL` to use the default
+ * allocator.
+ * @param[out] surface Where to store the handle of the surface. This is set
+ * to `VK_NULL_HANDLE` if an error occurred.
+ * @return `VK_SUCCESS` if successful, or a Vulkan error code if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_API_UNAVAILABLE, @ref GLFW_PLATFORM_ERROR and @ref GLFW_INVALID_VALUE
+ *
+ * @remark If an error occurs before the creation call is made, GLFW returns
+ * the Vulkan error code most appropriate for the error. Appropriate use of
+ * @ref glfwVulkanSupported and @ref glfwGetRequiredInstanceExtensions should
+ * eliminate almost all occurrences of these errors.
+ *
+ * @remark @macos GLFW prefers the `VK_EXT_metal_surface` extension, with the
+ * `VK_MVK_macos_surface` extension as a fallback. The name of the selected
+ * extension, if any, is included in the array returned by @ref
+ * glfwGetRequiredInstanceExtensions.
+ *
+ * @remark @macos This function creates and sets a `CAMetalLayer` instance for
+ * the window content view, which is required for MoltenVK to function.
+ *
+ * @remark @x11 By default GLFW prefers the `VK_KHR_xcb_surface` extension,
+ * with the `VK_KHR_xlib_surface` extension as a fallback. You can make
+ * `VK_KHR_xlib_surface` the preferred extension by setting the
+ * [GLFW_X11_XCB_VULKAN_SURFACE](@ref GLFW_X11_XCB_VULKAN_SURFACE_hint) init
+ * hint. The name of the selected extension, if any, is included in the array
+ * returned by @ref glfwGetRequiredInstanceExtensions.
+ *
+ * @thread_safety This function may be called from any thread. For
+ * synchronization details of Vulkan objects, see the Vulkan specification.
+ *
+ * @sa @ref vulkan_surface
+ * @sa @ref glfwGetRequiredInstanceExtensions
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup vulkan
+ */
+GLFWAPI VkResult glfwCreateWindowSurface(VkInstance instance, GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);
+
+#endif /*VK_VERSION_1_0*/
+
+
+/*************************************************************************
+ * Global definition cleanup
+ *************************************************************************/
+
+/* ------------------- BEGIN SYSTEM/COMPILER SPECIFIC -------------------- */
+
+#ifdef GLFW_WINGDIAPI_DEFINED
+ #undef WINGDIAPI
+ #undef GLFW_WINGDIAPI_DEFINED
+#endif
+
+#ifdef GLFW_CALLBACK_DEFINED
+ #undef CALLBACK
+ #undef GLFW_CALLBACK_DEFINED
+#endif
+
+/* Some OpenGL related headers need GLAPIENTRY, but it is unconditionally
+ * defined by some gl.h variants (OpenBSD) so define it after if needed.
+ */
+#ifndef GLAPIENTRY
+ #define GLAPIENTRY APIENTRY
+ #define GLFW_GLAPIENTRY_DEFINED
+#endif
+
+/* -------------------- END SYSTEM/COMPILER SPECIFIC --------------------- */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _glfw3_h_ */
+
diff --git a/tmpl8/lib/GLFW/include/GLFW/glfw3native.h b/tmpl8/lib/GLFW/include/GLFW/glfw3native.h
new file mode 100644
index 0000000..92f0d32
--- /dev/null
+++ b/tmpl8/lib/GLFW/include/GLFW/glfw3native.h
@@ -0,0 +1,663 @@
+/*************************************************************************
+ * GLFW 3.4 - www.glfw.org
+ * A library for OpenGL, window and input
+ *------------------------------------------------------------------------
+ * Copyright (c) 2002-2006 Marcus Geelnard
+ * Copyright (c) 2006-2018 Camilla Löwy
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would
+ * be appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not
+ * be misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ *
+ *************************************************************************/
+
+#ifndef _glfw3_native_h_
+#define _glfw3_native_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*************************************************************************
+ * Doxygen documentation
+ *************************************************************************/
+
+/*! @file glfw3native.h
+ * @brief The header of the native access functions.
+ *
+ * This is the header file of the native access functions. See @ref native for
+ * more information.
+ */
+/*! @defgroup native Native access
+ * @brief Functions related to accessing native handles.
+ *
+ * **By using the native access functions you assert that you know what you're
+ * doing and how to fix problems caused by using them. If you don't, you
+ * shouldn't be using them.**
+ *
+ * Before the inclusion of @ref glfw3native.h, you may define zero or more
+ * window system API macro and zero or more context creation API macros.
+ *
+ * The chosen backends must match those the library was compiled for. Failure
+ * to do this will cause a link-time error.
+ *
+ * The available window API macros are:
+ * * `GLFW_EXPOSE_NATIVE_WIN32`
+ * * `GLFW_EXPOSE_NATIVE_COCOA`
+ * * `GLFW_EXPOSE_NATIVE_X11`
+ * * `GLFW_EXPOSE_NATIVE_WAYLAND`
+ *
+ * The available context API macros are:
+ * * `GLFW_EXPOSE_NATIVE_WGL`
+ * * `GLFW_EXPOSE_NATIVE_NSGL`
+ * * `GLFW_EXPOSE_NATIVE_GLX`
+ * * `GLFW_EXPOSE_NATIVE_EGL`
+ * * `GLFW_EXPOSE_NATIVE_OSMESA`
+ *
+ * These macros select which of the native access functions that are declared
+ * and which platform-specific headers to include. It is then up your (by
+ * definition platform-specific) code to handle which of these should be
+ * defined.
+ *
+ * If you do not want the platform-specific headers to be included, define
+ * `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
+ *
+ * @code
+ * #define GLFW_EXPOSE_NATIVE_WIN32
+ * #define GLFW_EXPOSE_NATIVE_WGL
+ * #define GLFW_NATIVE_INCLUDE_NONE
+ * #include
+ * @endcode
+ */
+
+
+/*************************************************************************
+ * System headers and types
+ *************************************************************************/
+
+#if !defined(GLFW_NATIVE_INCLUDE_NONE)
+
+ #if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
+ /* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
+ * example to allow applications to correctly declare a GL_KHR_debug callback)
+ * but windows.h assumes no one will define APIENTRY before it does
+ */
+ #if defined(GLFW_APIENTRY_DEFINED)
+ #undef APIENTRY
+ #undef GLFW_APIENTRY_DEFINED
+ #endif
+ #include
+ #endif
+
+ #if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
+ #if defined(__OBJC__)
+ #import
+ #else
+ #include
+ #include
+ #endif
+ #endif
+
+ #if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
+ #include
+ #include
+ #endif
+
+ #if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
+ #include
+ #endif
+
+ #if defined(GLFW_EXPOSE_NATIVE_WGL)
+ /* WGL is declared by windows.h */
+ #endif
+ #if defined(GLFW_EXPOSE_NATIVE_NSGL)
+ /* NSGL is declared by Cocoa.h */
+ #endif
+ #if defined(GLFW_EXPOSE_NATIVE_GLX)
+ /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
+ * default it also acts as an OpenGL header
+ * However, glx.h will include gl.h, which will define it unconditionally
+ */
+ #if defined(GLFW_GLAPIENTRY_DEFINED)
+ #undef GLAPIENTRY
+ #undef GLFW_GLAPIENTRY_DEFINED
+ #endif
+ #include
+ #endif
+ #if defined(GLFW_EXPOSE_NATIVE_EGL)
+ #include
+ #endif
+ #if defined(GLFW_EXPOSE_NATIVE_OSMESA)
+ /* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
+ * default it also acts as an OpenGL header
+ * However, osmesa.h will include gl.h, which will define it unconditionally
+ */
+ #if defined(GLFW_GLAPIENTRY_DEFINED)
+ #undef GLAPIENTRY
+ #undef GLFW_GLAPIENTRY_DEFINED
+ #endif
+ #include
+ #endif
+
+#endif /*GLFW_NATIVE_INCLUDE_NONE*/
+
+
+/*************************************************************************
+ * Functions
+ *************************************************************************/
+
+#if defined(GLFW_EXPOSE_NATIVE_WIN32)
+/*! @brief Returns the adapter device name of the specified monitor.
+ *
+ * @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
+ * of the specified monitor, or `NULL` if an [error](@ref error_handling)
+ * occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup native
+ */
+GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
+
+/*! @brief Returns the display device name of the specified monitor.
+ *
+ * @return The UTF-8 encoded display device name (for example
+ * `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup native
+ */
+GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `HWND` of the specified window.
+ *
+ * @return The `HWND` of the specified window, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @remark The `HDC` associated with the window can be queried with the
+ * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
+ * function.
+ * @code
+ * HDC dc = GetDC(glfwGetWin32Window(window));
+ * @endcode
+ * This DC is private and does not need to be released.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_WGL)
+/*! @brief Returns the `HGLRC` of the specified window.
+ *
+ * @return The `HGLRC` of the specified window, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @remark The `HDC` associated with the window can be queried with the
+ * [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
+ * function.
+ * @code
+ * HDC dc = GetDC(glfwGetWin32Window(window));
+ * @endcode
+ * This DC is private and does not need to be released.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_COCOA)
+/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
+ *
+ * @return The `CGDirectDisplayID` of the specified monitor, or
+ * `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup native
+ */
+GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `NSWindow` of the specified window.
+ *
+ * @return The `NSWindow` of the specified window, or `nil` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
+
+/*! @brief Returns the `NSView` of the specified window.
+ *
+ * @return The `NSView` of the specified window, or `nil` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.4.
+ *
+ * @ingroup native
+ */
+GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_NSGL)
+/*! @brief Returns the `NSOpenGLContext` of the specified window.
+ *
+ * @return The `NSOpenGLContext` of the specified window, or `nil` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_X11)
+/*! @brief Returns the `Display` used by GLFW.
+ *
+ * @return The `Display` used by GLFW, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI Display* glfwGetX11Display(void);
+
+/*! @brief Returns the `RRCrtc` of the specified monitor.
+ *
+ * @return The `RRCrtc` of the specified monitor, or `None` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup native
+ */
+GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
+
+/*! @brief Returns the `RROutput` of the specified monitor.
+ *
+ * @return The `RROutput` of the specified monitor, or `None` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.1.
+ *
+ * @ingroup native
+ */
+GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the `Window` of the specified window.
+ *
+ * @return The `Window` of the specified window, or `None` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
+
+/*! @brief Sets the current primary selection to the specified string.
+ *
+ * @param[in] string A UTF-8 encoded string.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The specified string is copied before this function
+ * returns.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref clipboard
+ * @sa glfwGetX11SelectionString
+ * @sa glfwSetClipboardString
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup native
+ */
+GLFWAPI void glfwSetX11SelectionString(const char* string);
+
+/*! @brief Returns the contents of the current primary selection as a string.
+ *
+ * If the selection is empty or if its contents cannot be converted, `NULL`
+ * is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
+ *
+ * @return The contents of the selection as a UTF-8 encoded string, or `NULL`
+ * if an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
+ *
+ * @pointer_lifetime The returned string is allocated and freed by GLFW. You
+ * should not free it yourself. It is valid until the next call to @ref
+ * glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
+ * library is terminated.
+ *
+ * @thread_safety This function must only be called from the main thread.
+ *
+ * @sa @ref clipboard
+ * @sa glfwSetX11SelectionString
+ * @sa glfwGetClipboardString
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup native
+ */
+GLFWAPI const char* glfwGetX11SelectionString(void);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_GLX)
+/*! @brief Returns the `GLXContext` of the specified window.
+ *
+ * @return The `GLXContext` of the specified window, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
+
+/*! @brief Returns the `GLXWindow` of the specified window.
+ *
+ * @return The `GLXWindow` of the specified window, or `None` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
+ * GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup native
+ */
+GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
+/*! @brief Returns the `struct wl_display*` used by GLFW.
+ *
+ * @return The `struct wl_display*` used by GLFW, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup native
+ */
+GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
+
+/*! @brief Returns the `struct wl_output*` of the specified monitor.
+ *
+ * @return The `struct wl_output*` of the specified monitor, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup native
+ */
+GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
+
+/*! @brief Returns the main `struct wl_surface*` of the specified window.
+ *
+ * @return The main `struct wl_surface*` of the specified window, or `NULL` if
+ * an [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_PLATFORM_UNAVAILABLE.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.2.
+ *
+ * @ingroup native
+ */
+GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_EGL)
+/*! @brief Returns the `EGLDisplay` used by GLFW.
+ *
+ * @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
+ *
+ * @remark Because EGL is initialized on demand, this function will return
+ * `EGL_NO_DISPLAY` until the first context has been created via EGL.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
+
+/*! @brief Returns the `EGLContext` of the specified window.
+ *
+ * @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
+
+/*! @brief Returns the `EGLSurface` of the specified window.
+ *
+ * @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.0.
+ *
+ * @ingroup native
+ */
+GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
+#endif
+
+#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
+/*! @brief Retrieves the color buffer associated with the specified window.
+ *
+ * @param[in] window The window whose color buffer to retrieve.
+ * @param[out] width Where to store the width of the color buffer, or `NULL`.
+ * @param[out] height Where to store the height of the color buffer, or `NULL`.
+ * @param[out] format Where to store the OSMesa pixel format of the color
+ * buffer, or `NULL`.
+ * @param[out] buffer Where to store the address of the color buffer, or
+ * `NULL`.
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup native
+ */
+GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
+
+/*! @brief Retrieves the depth buffer associated with the specified window.
+ *
+ * @param[in] window The window whose depth buffer to retrieve.
+ * @param[out] width Where to store the width of the depth buffer, or `NULL`.
+ * @param[out] height Where to store the height of the depth buffer, or `NULL`.
+ * @param[out] bytesPerValue Where to store the number of bytes per depth
+ * buffer element, or `NULL`.
+ * @param[out] buffer Where to store the address of the depth buffer, or
+ * `NULL`.
+ * @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup native
+ */
+GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
+
+/*! @brief Returns the `OSMesaContext` of the specified window.
+ *
+ * @return The `OSMesaContext` of the specified window, or `NULL` if an
+ * [error](@ref error_handling) occurred.
+ *
+ * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
+ * GLFW_NO_WINDOW_CONTEXT.
+ *
+ * @thread_safety This function may be called from any thread. Access is not
+ * synchronized.
+ *
+ * @since Added in version 3.3.
+ *
+ * @ingroup native
+ */
+GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _glfw3_native_h_ */
+
diff --git a/tmpl8/lib/GLFW/lib-vc2022/glfw3.lib b/tmpl8/lib/GLFW/lib-vc2022/glfw3.lib
new file mode 100644
index 0000000..92de429
Binary files /dev/null and b/tmpl8/lib/GLFW/lib-vc2022/glfw3.lib differ
diff --git a/tmpl8/lib/GLFW/version.txt b/tmpl8/lib/GLFW/version.txt
new file mode 100644
index 0000000..d86d4f1
--- /dev/null
+++ b/tmpl8/lib/GLFW/version.txt
@@ -0,0 +1 @@
+Obtained June 19, 2024.
\ No newline at end of file
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl.h b/tmpl8/lib/OpenCL/inc/CL/cl.h
new file mode 100644
index 0000000..792e20c
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl.h
@@ -0,0 +1,1935 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef __OPENCL_CL_H
+#define __OPENCL_CL_H
+
+#include
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+
+typedef struct _cl_platform_id * cl_platform_id;
+typedef struct _cl_device_id * cl_device_id;
+typedef struct _cl_context * cl_context;
+typedef struct _cl_command_queue * cl_command_queue;
+typedef struct _cl_mem * cl_mem;
+typedef struct _cl_program * cl_program;
+typedef struct _cl_kernel * cl_kernel;
+typedef struct _cl_event * cl_event;
+typedef struct _cl_sampler * cl_sampler;
+
+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. */
+typedef cl_ulong cl_bitfield;
+typedef cl_ulong cl_properties;
+typedef cl_bitfield cl_device_type;
+typedef cl_uint cl_platform_info;
+typedef cl_uint cl_device_info;
+typedef cl_bitfield cl_device_fp_config;
+typedef cl_uint cl_device_mem_cache_type;
+typedef cl_uint cl_device_local_mem_type;
+typedef cl_bitfield cl_device_exec_capabilities;
+#ifdef CL_VERSION_2_0
+typedef cl_bitfield cl_device_svm_capabilities;
+#endif
+typedef cl_bitfield cl_command_queue_properties;
+#ifdef CL_VERSION_1_2
+typedef intptr_t cl_device_partition_property;
+typedef cl_bitfield cl_device_affinity_domain;
+#endif
+
+typedef intptr_t cl_context_properties;
+typedef cl_uint cl_context_info;
+#ifdef CL_VERSION_2_0
+typedef cl_properties cl_queue_properties;
+#endif
+typedef cl_uint cl_command_queue_info;
+typedef cl_uint cl_channel_order;
+typedef cl_uint cl_channel_type;
+typedef cl_bitfield cl_mem_flags;
+#ifdef CL_VERSION_2_0
+typedef cl_bitfield cl_svm_mem_flags;
+#endif
+typedef cl_uint cl_mem_object_type;
+typedef cl_uint cl_mem_info;
+#ifdef CL_VERSION_1_2
+typedef cl_bitfield cl_mem_migration_flags;
+#endif
+typedef cl_uint cl_image_info;
+#ifdef CL_VERSION_1_1
+typedef cl_uint cl_buffer_create_type;
+#endif
+typedef cl_uint cl_addressing_mode;
+typedef cl_uint cl_filter_mode;
+typedef cl_uint cl_sampler_info;
+typedef cl_bitfield cl_map_flags;
+#ifdef CL_VERSION_2_0
+typedef intptr_t cl_pipe_properties;
+typedef cl_uint cl_pipe_info;
+#endif
+typedef cl_uint cl_program_info;
+typedef cl_uint cl_program_build_info;
+#ifdef CL_VERSION_1_2
+typedef cl_uint cl_program_binary_type;
+#endif
+typedef cl_int cl_build_status;
+typedef cl_uint cl_kernel_info;
+#ifdef CL_VERSION_1_2
+typedef cl_uint cl_kernel_arg_info;
+typedef cl_uint cl_kernel_arg_address_qualifier;
+typedef cl_uint cl_kernel_arg_access_qualifier;
+typedef cl_bitfield cl_kernel_arg_type_qualifier;
+#endif
+typedef cl_uint cl_kernel_work_group_info;
+#ifdef CL_VERSION_2_1
+typedef cl_uint cl_kernel_sub_group_info;
+#endif
+typedef cl_uint cl_event_info;
+typedef cl_uint cl_command_type;
+typedef cl_uint cl_profiling_info;
+#ifdef CL_VERSION_2_0
+typedef cl_properties cl_sampler_properties;
+typedef cl_uint cl_kernel_exec_info;
+#endif
+#ifdef CL_VERSION_3_0
+typedef cl_bitfield cl_device_atomic_capabilities;
+typedef cl_bitfield cl_device_device_enqueue_capabilities;
+typedef cl_uint cl_khronos_vendor_id;
+typedef cl_properties cl_mem_properties;
+#endif
+typedef cl_uint cl_version;
+
+typedef struct _cl_image_format {
+ cl_channel_order image_channel_order;
+ cl_channel_type image_channel_data_type;
+} cl_image_format;
+
+#ifdef CL_VERSION_1_2
+
+typedef struct _cl_image_desc {
+ cl_mem_object_type image_type;
+ size_t image_width;
+ size_t image_height;
+ size_t image_depth;
+ size_t image_array_size;
+ size_t image_row_pitch;
+ size_t image_slice_pitch;
+ cl_uint num_mip_levels;
+ cl_uint num_samples;
+#ifdef CL_VERSION_2_0
+#if defined(__GNUC__)
+ __extension__ /* Prevents warnings about anonymous union in -pedantic builds */
+#endif
+#if defined(_MSC_VER) && !defined(__STDC__)
+#pragma warning( push )
+#pragma warning( disable : 4201 ) /* Prevents warning about nameless struct/union in /W4 builds */
+#endif
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wc11-extensions" /* Prevents warning about nameless union being C11 extension*/
+#endif
+#if defined(_MSC_VER) && defined(__STDC__)
+ /* Anonymous unions are not supported in /Za builds */
+#else
+ union {
+#endif
+#endif
+ cl_mem buffer;
+#ifdef CL_VERSION_2_0
+#if defined(_MSC_VER) && defined(__STDC__)
+ /* Anonymous unions are not supported in /Za builds */
+#else
+ cl_mem mem_object;
+ };
+#endif
+#if defined(_MSC_VER) && !defined(__STDC__)
+#pragma warning( pop )
+#endif
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+#endif
+} cl_image_desc;
+
+#endif
+
+#ifdef CL_VERSION_1_1
+
+typedef struct _cl_buffer_region {
+ size_t origin;
+ size_t size;
+} cl_buffer_region;
+
+#endif
+
+#ifdef CL_VERSION_3_0
+
+#define CL_NAME_VERSION_MAX_NAME_SIZE 64
+
+typedef struct _cl_name_version {
+ cl_version version;
+ char name[CL_NAME_VERSION_MAX_NAME_SIZE];
+} cl_name_version;
+
+#endif
+
+/******************************************************************************/
+
+/* Error Codes */
+#define CL_SUCCESS 0
+#define CL_DEVICE_NOT_FOUND -1
+#define CL_DEVICE_NOT_AVAILABLE -2
+#define CL_COMPILER_NOT_AVAILABLE -3
+#define CL_MEM_OBJECT_ALLOCATION_FAILURE -4
+#define CL_OUT_OF_RESOURCES -5
+#define CL_OUT_OF_HOST_MEMORY -6
+#define CL_PROFILING_INFO_NOT_AVAILABLE -7
+#define CL_MEM_COPY_OVERLAP -8
+#define CL_IMAGE_FORMAT_MISMATCH -9
+#define CL_IMAGE_FORMAT_NOT_SUPPORTED -10
+#define CL_BUILD_PROGRAM_FAILURE -11
+#define CL_MAP_FAILURE -12
+#ifdef CL_VERSION_1_1
+#define CL_MISALIGNED_SUB_BUFFER_OFFSET -13
+#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
+#endif
+#ifdef CL_VERSION_1_2
+#define CL_COMPILE_PROGRAM_FAILURE -15
+#define CL_LINKER_NOT_AVAILABLE -16
+#define CL_LINK_PROGRAM_FAILURE -17
+#define CL_DEVICE_PARTITION_FAILED -18
+#define CL_KERNEL_ARG_INFO_NOT_AVAILABLE -19
+#endif
+
+#define CL_INVALID_VALUE -30
+#define CL_INVALID_DEVICE_TYPE -31
+#define CL_INVALID_PLATFORM -32
+#define CL_INVALID_DEVICE -33
+#define CL_INVALID_CONTEXT -34
+#define CL_INVALID_QUEUE_PROPERTIES -35
+#define CL_INVALID_COMMAND_QUEUE -36
+#define CL_INVALID_HOST_PTR -37
+#define CL_INVALID_MEM_OBJECT -38
+#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39
+#define CL_INVALID_IMAGE_SIZE -40
+#define CL_INVALID_SAMPLER -41
+#define CL_INVALID_BINARY -42
+#define CL_INVALID_BUILD_OPTIONS -43
+#define CL_INVALID_PROGRAM -44
+#define CL_INVALID_PROGRAM_EXECUTABLE -45
+#define CL_INVALID_KERNEL_NAME -46
+#define CL_INVALID_KERNEL_DEFINITION -47
+#define CL_INVALID_KERNEL -48
+#define CL_INVALID_ARG_INDEX -49
+#define CL_INVALID_ARG_VALUE -50
+#define CL_INVALID_ARG_SIZE -51
+#define CL_INVALID_KERNEL_ARGS -52
+#define CL_INVALID_WORK_DIMENSION -53
+#define CL_INVALID_WORK_GROUP_SIZE -54
+#define CL_INVALID_WORK_ITEM_SIZE -55
+#define CL_INVALID_GLOBAL_OFFSET -56
+#define CL_INVALID_EVENT_WAIT_LIST -57
+#define CL_INVALID_EVENT -58
+#define CL_INVALID_OPERATION -59
+#define CL_INVALID_GL_OBJECT -60
+#define CL_INVALID_BUFFER_SIZE -61
+#define CL_INVALID_MIP_LEVEL -62
+#define CL_INVALID_GLOBAL_WORK_SIZE -63
+#ifdef CL_VERSION_1_1
+#define CL_INVALID_PROPERTY -64
+#endif
+#ifdef CL_VERSION_1_2
+#define CL_INVALID_IMAGE_DESCRIPTOR -65
+#define CL_INVALID_COMPILER_OPTIONS -66
+#define CL_INVALID_LINKER_OPTIONS -67
+#define CL_INVALID_DEVICE_PARTITION_COUNT -68
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_INVALID_PIPE_SIZE -69
+#define CL_INVALID_DEVICE_QUEUE -70
+#endif
+#ifdef CL_VERSION_2_2
+#define CL_INVALID_SPEC_ID -71
+#define CL_MAX_SIZE_RESTRICTION_EXCEEDED -72
+#endif
+
+
+/* cl_bool */
+#define CL_FALSE 0
+#define CL_TRUE 1
+#ifdef CL_VERSION_1_2
+#define CL_BLOCKING CL_TRUE
+#define CL_NON_BLOCKING CL_FALSE
+#endif
+
+/* cl_platform_info */
+#define CL_PLATFORM_PROFILE 0x0900
+#define CL_PLATFORM_VERSION 0x0901
+#define CL_PLATFORM_NAME 0x0902
+#define CL_PLATFORM_VENDOR 0x0903
+#define CL_PLATFORM_EXTENSIONS 0x0904
+#ifdef CL_VERSION_2_1
+#define CL_PLATFORM_HOST_TIMER_RESOLUTION 0x0905
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_PLATFORM_NUMERIC_VERSION 0x0906
+#define CL_PLATFORM_EXTENSIONS_WITH_VERSION 0x0907
+#endif
+
+/* cl_device_type - bitfield */
+#define CL_DEVICE_TYPE_DEFAULT (1 << 0)
+#define CL_DEVICE_TYPE_CPU (1 << 1)
+#define CL_DEVICE_TYPE_GPU (1 << 2)
+#define CL_DEVICE_TYPE_ACCELERATOR (1 << 3)
+#ifdef CL_VERSION_1_2
+#define CL_DEVICE_TYPE_CUSTOM (1 << 4)
+#endif
+#define CL_DEVICE_TYPE_ALL 0xFFFFFFFF
+
+/* cl_device_info */
+#define CL_DEVICE_TYPE 0x1000
+#define CL_DEVICE_VENDOR_ID 0x1001
+#define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002
+#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004
+#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B
+#define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C
+#define CL_DEVICE_ADDRESS_BITS 0x100D
+#define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E
+#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F
+#define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010
+#define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011
+#define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012
+#define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013
+#define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014
+#define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015
+#define CL_DEVICE_IMAGE_SUPPORT 0x1016
+#define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017
+#define CL_DEVICE_MAX_SAMPLERS 0x1018
+#define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019
+#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A
+#define CL_DEVICE_SINGLE_FP_CONFIG 0x101B
+#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C
+#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D
+#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E
+#define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F
+#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020
+#define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021
+#define CL_DEVICE_LOCAL_MEM_TYPE 0x1022
+#define CL_DEVICE_LOCAL_MEM_SIZE 0x1023
+#define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024
+#define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025
+#define CL_DEVICE_ENDIAN_LITTLE 0x1026
+#define CL_DEVICE_AVAILABLE 0x1027
+#define CL_DEVICE_COMPILER_AVAILABLE 0x1028
+#define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029
+#define CL_DEVICE_QUEUE_PROPERTIES 0x102A /* deprecated */
+#ifdef CL_VERSION_2_0
+#define CL_DEVICE_QUEUE_ON_HOST_PROPERTIES 0x102A
+#endif
+#define CL_DEVICE_NAME 0x102B
+#define CL_DEVICE_VENDOR 0x102C
+#define CL_DRIVER_VERSION 0x102D
+#define CL_DEVICE_PROFILE 0x102E
+#define CL_DEVICE_VERSION 0x102F
+#define CL_DEVICE_EXTENSIONS 0x1030
+#define CL_DEVICE_PLATFORM 0x1031
+#ifdef CL_VERSION_1_2
+#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
+#endif
+/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG which is already defined in "cl_ext.h" */
+#ifdef CL_VERSION_1_1
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034
+#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035 /* deprecated */
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C
+#define CL_DEVICE_OPENCL_C_VERSION 0x103D
+#endif
+#ifdef CL_VERSION_1_2
+#define CL_DEVICE_LINKER_AVAILABLE 0x103E
+#define CL_DEVICE_BUILT_IN_KERNELS 0x103F
+#define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE 0x1040
+#define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE 0x1041
+#define CL_DEVICE_PARENT_DEVICE 0x1042
+#define CL_DEVICE_PARTITION_MAX_SUB_DEVICES 0x1043
+#define CL_DEVICE_PARTITION_PROPERTIES 0x1044
+#define CL_DEVICE_PARTITION_AFFINITY_DOMAIN 0x1045
+#define CL_DEVICE_PARTITION_TYPE 0x1046
+#define CL_DEVICE_REFERENCE_COUNT 0x1047
+#define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC 0x1048
+#define CL_DEVICE_PRINTF_BUFFER_SIZE 0x1049
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT 0x104A
+#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT 0x104B
+#define CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS 0x104C
+#define CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE 0x104D
+#define CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES 0x104E
+#define CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE 0x104F
+#define CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE 0x1050
+#define CL_DEVICE_MAX_ON_DEVICE_QUEUES 0x1051
+#define CL_DEVICE_MAX_ON_DEVICE_EVENTS 0x1052
+#define CL_DEVICE_SVM_CAPABILITIES 0x1053
+#define CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE 0x1054
+#define CL_DEVICE_MAX_PIPE_ARGS 0x1055
+#define CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS 0x1056
+#define CL_DEVICE_PIPE_MAX_PACKET_SIZE 0x1057
+#define CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT 0x1058
+#define CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT 0x1059
+#define CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT 0x105A
+#endif
+#ifdef CL_VERSION_2_1
+#define CL_DEVICE_IL_VERSION 0x105B
+#define CL_DEVICE_MAX_NUM_SUB_GROUPS 0x105C
+#define CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS 0x105D
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_DEVICE_NUMERIC_VERSION 0x105E
+#define CL_DEVICE_EXTENSIONS_WITH_VERSION 0x1060
+#define CL_DEVICE_ILS_WITH_VERSION 0x1061
+#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION 0x1062
+#define CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES 0x1063
+#define CL_DEVICE_ATOMIC_FENCE_CAPABILITIES 0x1064
+#define CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT 0x1065
+#define CL_DEVICE_OPENCL_C_ALL_VERSIONS 0x1066
+#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x1067
+#define CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT 0x1068
+#define CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT 0x1069
+/* 0x106A to 0x106E - Reserved for upcoming KHR extension */
+#define CL_DEVICE_OPENCL_C_FEATURES 0x106F
+#define CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES 0x1070
+#define CL_DEVICE_PIPE_SUPPORT 0x1071
+#define CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED 0x1072
+#endif
+
+/* cl_device_fp_config - bitfield */
+#define CL_FP_DENORM (1 << 0)
+#define CL_FP_INF_NAN (1 << 1)
+#define CL_FP_ROUND_TO_NEAREST (1 << 2)
+#define CL_FP_ROUND_TO_ZERO (1 << 3)
+#define CL_FP_ROUND_TO_INF (1 << 4)
+#define CL_FP_FMA (1 << 5)
+#ifdef CL_VERSION_1_1
+#define CL_FP_SOFT_FLOAT (1 << 6)
+#endif
+#ifdef CL_VERSION_1_2
+#define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT (1 << 7)
+#endif
+
+/* cl_device_mem_cache_type */
+#define CL_NONE 0x0
+#define CL_READ_ONLY_CACHE 0x1
+#define CL_READ_WRITE_CACHE 0x2
+
+/* cl_device_local_mem_type */
+#define CL_LOCAL 0x1
+#define CL_GLOBAL 0x2
+
+/* cl_device_exec_capabilities - bitfield */
+#define CL_EXEC_KERNEL (1 << 0)
+#define CL_EXEC_NATIVE_KERNEL (1 << 1)
+
+/* cl_command_queue_properties - bitfield */
+#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0)
+#define CL_QUEUE_PROFILING_ENABLE (1 << 1)
+#ifdef CL_VERSION_2_0
+#define CL_QUEUE_ON_DEVICE (1 << 2)
+#define CL_QUEUE_ON_DEVICE_DEFAULT (1 << 3)
+#endif
+
+/* cl_context_info */
+#define CL_CONTEXT_REFERENCE_COUNT 0x1080
+#define CL_CONTEXT_DEVICES 0x1081
+#define CL_CONTEXT_PROPERTIES 0x1082
+#ifdef CL_VERSION_1_1
+#define CL_CONTEXT_NUM_DEVICES 0x1083
+#endif
+
+/* cl_context_properties */
+#define CL_CONTEXT_PLATFORM 0x1084
+#ifdef CL_VERSION_1_2
+#define CL_CONTEXT_INTEROP_USER_SYNC 0x1085
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_device_partition_property */
+#define CL_DEVICE_PARTITION_EQUALLY 0x1086
+#define CL_DEVICE_PARTITION_BY_COUNTS 0x1087
+#define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END 0x0
+#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN 0x1088
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_device_affinity_domain */
+#define CL_DEVICE_AFFINITY_DOMAIN_NUMA (1 << 0)
+#define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE (1 << 1)
+#define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE (1 << 2)
+#define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE (1 << 3)
+#define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE (1 << 4)
+#define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE (1 << 5)
+
+#endif
+
+#ifdef CL_VERSION_2_0
+
+/* cl_device_svm_capabilities */
+#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0)
+#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1)
+#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2)
+#define CL_DEVICE_SVM_ATOMICS (1 << 3)
+
+#endif
+
+/* cl_command_queue_info */
+#define CL_QUEUE_CONTEXT 0x1090
+#define CL_QUEUE_DEVICE 0x1091
+#define CL_QUEUE_REFERENCE_COUNT 0x1092
+#define CL_QUEUE_PROPERTIES 0x1093
+#ifdef CL_VERSION_2_0
+#define CL_QUEUE_SIZE 0x1094
+#endif
+#ifdef CL_VERSION_2_1
+#define CL_QUEUE_DEVICE_DEFAULT 0x1095
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_QUEUE_PROPERTIES_ARRAY 0x1098
+#endif
+
+/* cl_mem_flags and cl_svm_mem_flags - bitfield */
+#define CL_MEM_READ_WRITE (1 << 0)
+#define CL_MEM_WRITE_ONLY (1 << 1)
+#define CL_MEM_READ_ONLY (1 << 2)
+#define CL_MEM_USE_HOST_PTR (1 << 3)
+#define CL_MEM_ALLOC_HOST_PTR (1 << 4)
+#define CL_MEM_COPY_HOST_PTR (1 << 5)
+/* reserved (1 << 6) */
+#ifdef CL_VERSION_1_2
+#define CL_MEM_HOST_WRITE_ONLY (1 << 7)
+#define CL_MEM_HOST_READ_ONLY (1 << 8)
+#define CL_MEM_HOST_NO_ACCESS (1 << 9)
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10) /* used by cl_svm_mem_flags only */
+#define CL_MEM_SVM_ATOMICS (1 << 11) /* used by cl_svm_mem_flags only */
+#define CL_MEM_KERNEL_READ_AND_WRITE (1 << 12)
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_mem_migration_flags - bitfield */
+#define CL_MIGRATE_MEM_OBJECT_HOST (1 << 0)
+#define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED (1 << 1)
+
+#endif
+
+/* cl_channel_order */
+#define CL_R 0x10B0
+#define CL_A 0x10B1
+#define CL_RG 0x10B2
+#define CL_RA 0x10B3
+#define CL_RGB 0x10B4
+#define CL_RGBA 0x10B5
+#define CL_BGRA 0x10B6
+#define CL_ARGB 0x10B7
+#define CL_INTENSITY 0x10B8
+#define CL_LUMINANCE 0x10B9
+#ifdef CL_VERSION_1_1
+#define CL_Rx 0x10BA
+#define CL_RGx 0x10BB
+#define CL_RGBx 0x10BC
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_DEPTH 0x10BD
+#define CL_sRGB 0x10BF
+#define CL_sRGBx 0x10C0
+#define CL_sRGBA 0x10C1
+#define CL_sBGRA 0x10C2
+#define CL_ABGR 0x10C3
+#endif
+
+/* cl_channel_type */
+#define CL_SNORM_INT8 0x10D0
+#define CL_SNORM_INT16 0x10D1
+#define CL_UNORM_INT8 0x10D2
+#define CL_UNORM_INT16 0x10D3
+#define CL_UNORM_SHORT_565 0x10D4
+#define CL_UNORM_SHORT_555 0x10D5
+#define CL_UNORM_INT_101010 0x10D6
+#define CL_SIGNED_INT8 0x10D7
+#define CL_SIGNED_INT16 0x10D8
+#define CL_SIGNED_INT32 0x10D9
+#define CL_UNSIGNED_INT8 0x10DA
+#define CL_UNSIGNED_INT16 0x10DB
+#define CL_UNSIGNED_INT32 0x10DC
+#define CL_HALF_FLOAT 0x10DD
+#define CL_FLOAT 0x10DE
+#ifdef CL_VERSION_2_1
+#define CL_UNORM_INT_101010_2 0x10E0
+#endif
+
+/* cl_mem_object_type */
+#define CL_MEM_OBJECT_BUFFER 0x10F0
+#define CL_MEM_OBJECT_IMAGE2D 0x10F1
+#define CL_MEM_OBJECT_IMAGE3D 0x10F2
+#ifdef CL_VERSION_1_2
+#define CL_MEM_OBJECT_IMAGE2D_ARRAY 0x10F3
+#define CL_MEM_OBJECT_IMAGE1D 0x10F4
+#define CL_MEM_OBJECT_IMAGE1D_ARRAY 0x10F5
+#define CL_MEM_OBJECT_IMAGE1D_BUFFER 0x10F6
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_MEM_OBJECT_PIPE 0x10F7
+#endif
+
+/* cl_mem_info */
+#define CL_MEM_TYPE 0x1100
+#define CL_MEM_FLAGS 0x1101
+#define CL_MEM_SIZE 0x1102
+#define CL_MEM_HOST_PTR 0x1103
+#define CL_MEM_MAP_COUNT 0x1104
+#define CL_MEM_REFERENCE_COUNT 0x1105
+#define CL_MEM_CONTEXT 0x1106
+#ifdef CL_VERSION_1_1
+#define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107
+#define CL_MEM_OFFSET 0x1108
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_MEM_USES_SVM_POINTER 0x1109
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_MEM_PROPERTIES 0x110A
+#endif
+
+/* cl_image_info */
+#define CL_IMAGE_FORMAT 0x1110
+#define CL_IMAGE_ELEMENT_SIZE 0x1111
+#define CL_IMAGE_ROW_PITCH 0x1112
+#define CL_IMAGE_SLICE_PITCH 0x1113
+#define CL_IMAGE_WIDTH 0x1114
+#define CL_IMAGE_HEIGHT 0x1115
+#define CL_IMAGE_DEPTH 0x1116
+#ifdef CL_VERSION_1_2
+#define CL_IMAGE_ARRAY_SIZE 0x1117
+#define CL_IMAGE_BUFFER 0x1118
+#define CL_IMAGE_NUM_MIP_LEVELS 0x1119
+#define CL_IMAGE_NUM_SAMPLES 0x111A
+#endif
+
+
+/* cl_pipe_info */
+#ifdef CL_VERSION_2_0
+#define CL_PIPE_PACKET_SIZE 0x1120
+#define CL_PIPE_MAX_PACKETS 0x1121
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_PIPE_PROPERTIES 0x1122
+#endif
+
+/* cl_addressing_mode */
+#define CL_ADDRESS_NONE 0x1130
+#define CL_ADDRESS_CLAMP_TO_EDGE 0x1131
+#define CL_ADDRESS_CLAMP 0x1132
+#define CL_ADDRESS_REPEAT 0x1133
+#ifdef CL_VERSION_1_1
+#define CL_ADDRESS_MIRRORED_REPEAT 0x1134
+#endif
+
+/* cl_filter_mode */
+#define CL_FILTER_NEAREST 0x1140
+#define CL_FILTER_LINEAR 0x1141
+
+/* cl_sampler_info */
+#define CL_SAMPLER_REFERENCE_COUNT 0x1150
+#define CL_SAMPLER_CONTEXT 0x1151
+#define CL_SAMPLER_NORMALIZED_COORDS 0x1152
+#define CL_SAMPLER_ADDRESSING_MODE 0x1153
+#define CL_SAMPLER_FILTER_MODE 0x1154
+#ifdef CL_VERSION_2_0
+/* These enumerants are for the cl_khr_mipmap_image extension.
+ They have since been added to cl_ext.h with an appropriate
+ KHR suffix, but are left here for backwards compatibility. */
+#define CL_SAMPLER_MIP_FILTER_MODE 0x1155
+#define CL_SAMPLER_LOD_MIN 0x1156
+#define CL_SAMPLER_LOD_MAX 0x1157
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_SAMPLER_PROPERTIES 0x1158
+#endif
+
+/* cl_map_flags - bitfield */
+#define CL_MAP_READ (1 << 0)
+#define CL_MAP_WRITE (1 << 1)
+#ifdef CL_VERSION_1_2
+#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2)
+#endif
+
+/* cl_program_info */
+#define CL_PROGRAM_REFERENCE_COUNT 0x1160
+#define CL_PROGRAM_CONTEXT 0x1161
+#define CL_PROGRAM_NUM_DEVICES 0x1162
+#define CL_PROGRAM_DEVICES 0x1163
+#define CL_PROGRAM_SOURCE 0x1164
+#define CL_PROGRAM_BINARY_SIZES 0x1165
+#define CL_PROGRAM_BINARIES 0x1166
+#ifdef CL_VERSION_1_2
+#define CL_PROGRAM_NUM_KERNELS 0x1167
+#define CL_PROGRAM_KERNEL_NAMES 0x1168
+#endif
+#ifdef CL_VERSION_2_1
+#define CL_PROGRAM_IL 0x1169
+#endif
+#ifdef CL_VERSION_2_2
+#define CL_PROGRAM_SCOPE_GLOBAL_CTORS_PRESENT 0x116A
+#define CL_PROGRAM_SCOPE_GLOBAL_DTORS_PRESENT 0x116B
+#endif
+
+/* cl_program_build_info */
+#define CL_PROGRAM_BUILD_STATUS 0x1181
+#define CL_PROGRAM_BUILD_OPTIONS 0x1182
+#define CL_PROGRAM_BUILD_LOG 0x1183
+#ifdef CL_VERSION_1_2
+#define CL_PROGRAM_BINARY_TYPE 0x1184
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE 0x1185
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_program_binary_type */
+#define CL_PROGRAM_BINARY_TYPE_NONE 0x0
+#define CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT 0x1
+#define CL_PROGRAM_BINARY_TYPE_LIBRARY 0x2
+#define CL_PROGRAM_BINARY_TYPE_EXECUTABLE 0x4
+
+#endif
+
+/* cl_build_status */
+#define CL_BUILD_SUCCESS 0
+#define CL_BUILD_NONE -1
+#define CL_BUILD_ERROR -2
+#define CL_BUILD_IN_PROGRESS -3
+
+/* cl_kernel_info */
+#define CL_KERNEL_FUNCTION_NAME 0x1190
+#define CL_KERNEL_NUM_ARGS 0x1191
+#define CL_KERNEL_REFERENCE_COUNT 0x1192
+#define CL_KERNEL_CONTEXT 0x1193
+#define CL_KERNEL_PROGRAM 0x1194
+#ifdef CL_VERSION_1_2
+#define CL_KERNEL_ATTRIBUTES 0x1195
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_kernel_arg_info */
+#define CL_KERNEL_ARG_ADDRESS_QUALIFIER 0x1196
+#define CL_KERNEL_ARG_ACCESS_QUALIFIER 0x1197
+#define CL_KERNEL_ARG_TYPE_NAME 0x1198
+#define CL_KERNEL_ARG_TYPE_QUALIFIER 0x1199
+#define CL_KERNEL_ARG_NAME 0x119A
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_kernel_arg_address_qualifier */
+#define CL_KERNEL_ARG_ADDRESS_GLOBAL 0x119B
+#define CL_KERNEL_ARG_ADDRESS_LOCAL 0x119C
+#define CL_KERNEL_ARG_ADDRESS_CONSTANT 0x119D
+#define CL_KERNEL_ARG_ADDRESS_PRIVATE 0x119E
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_kernel_arg_access_qualifier */
+#define CL_KERNEL_ARG_ACCESS_READ_ONLY 0x11A0
+#define CL_KERNEL_ARG_ACCESS_WRITE_ONLY 0x11A1
+#define CL_KERNEL_ARG_ACCESS_READ_WRITE 0x11A2
+#define CL_KERNEL_ARG_ACCESS_NONE 0x11A3
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* cl_kernel_arg_type_qualifier */
+#define CL_KERNEL_ARG_TYPE_NONE 0
+#define CL_KERNEL_ARG_TYPE_CONST (1 << 0)
+#define CL_KERNEL_ARG_TYPE_RESTRICT (1 << 1)
+#define CL_KERNEL_ARG_TYPE_VOLATILE (1 << 2)
+#ifdef CL_VERSION_2_0
+#define CL_KERNEL_ARG_TYPE_PIPE (1 << 3)
+#endif
+
+#endif
+
+/* cl_kernel_work_group_info */
+#define CL_KERNEL_WORK_GROUP_SIZE 0x11B0
+#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1
+#define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2
+#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
+#define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4
+#ifdef CL_VERSION_1_2
+#define CL_KERNEL_GLOBAL_WORK_SIZE 0x11B5
+#endif
+
+#ifdef CL_VERSION_2_1
+
+/* cl_kernel_sub_group_info */
+#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE 0x2033
+#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE 0x2034
+#define CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT 0x11B8
+#define CL_KERNEL_MAX_NUM_SUB_GROUPS 0x11B9
+#define CL_KERNEL_COMPILE_NUM_SUB_GROUPS 0x11BA
+
+#endif
+
+#ifdef CL_VERSION_2_0
+
+/* cl_kernel_exec_info */
+#define CL_KERNEL_EXEC_INFO_SVM_PTRS 0x11B6
+#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM 0x11B7
+
+#endif
+
+/* cl_event_info */
+#define CL_EVENT_COMMAND_QUEUE 0x11D0
+#define CL_EVENT_COMMAND_TYPE 0x11D1
+#define CL_EVENT_REFERENCE_COUNT 0x11D2
+#define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3
+#ifdef CL_VERSION_1_1
+#define CL_EVENT_CONTEXT 0x11D4
+#endif
+
+/* cl_command_type */
+#define CL_COMMAND_NDRANGE_KERNEL 0x11F0
+#define CL_COMMAND_TASK 0x11F1
+#define CL_COMMAND_NATIVE_KERNEL 0x11F2
+#define CL_COMMAND_READ_BUFFER 0x11F3
+#define CL_COMMAND_WRITE_BUFFER 0x11F4
+#define CL_COMMAND_COPY_BUFFER 0x11F5
+#define CL_COMMAND_READ_IMAGE 0x11F6
+#define CL_COMMAND_WRITE_IMAGE 0x11F7
+#define CL_COMMAND_COPY_IMAGE 0x11F8
+#define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9
+#define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA
+#define CL_COMMAND_MAP_BUFFER 0x11FB
+#define CL_COMMAND_MAP_IMAGE 0x11FC
+#define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD
+#define CL_COMMAND_MARKER 0x11FE
+#define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF
+#define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200
+#ifdef CL_VERSION_1_1
+#define CL_COMMAND_READ_BUFFER_RECT 0x1201
+#define CL_COMMAND_WRITE_BUFFER_RECT 0x1202
+#define CL_COMMAND_COPY_BUFFER_RECT 0x1203
+#define CL_COMMAND_USER 0x1204
+#endif
+#ifdef CL_VERSION_1_2
+#define CL_COMMAND_BARRIER 0x1205
+#define CL_COMMAND_MIGRATE_MEM_OBJECTS 0x1206
+#define CL_COMMAND_FILL_BUFFER 0x1207
+#define CL_COMMAND_FILL_IMAGE 0x1208
+#endif
+#ifdef CL_VERSION_2_0
+#define CL_COMMAND_SVM_FREE 0x1209
+#define CL_COMMAND_SVM_MEMCPY 0x120A
+#define CL_COMMAND_SVM_MEMFILL 0x120B
+#define CL_COMMAND_SVM_MAP 0x120C
+#define CL_COMMAND_SVM_UNMAP 0x120D
+#endif
+#ifdef CL_VERSION_3_0
+#define CL_COMMAND_SVM_MIGRATE_MEM 0x120E
+#endif
+
+/* command execution status */
+#define CL_COMPLETE 0x0
+#define CL_RUNNING 0x1
+#define CL_SUBMITTED 0x2
+#define CL_QUEUED 0x3
+
+/* cl_buffer_create_type */
+#ifdef CL_VERSION_1_1
+#define CL_BUFFER_CREATE_TYPE_REGION 0x1220
+#endif
+
+/* cl_profiling_info */
+#define CL_PROFILING_COMMAND_QUEUED 0x1280
+#define CL_PROFILING_COMMAND_SUBMIT 0x1281
+#define CL_PROFILING_COMMAND_START 0x1282
+#define CL_PROFILING_COMMAND_END 0x1283
+#ifdef CL_VERSION_2_0
+#define CL_PROFILING_COMMAND_COMPLETE 0x1284
+#endif
+
+/* cl_device_atomic_capabilities - bitfield */
+#ifdef CL_VERSION_3_0
+#define CL_DEVICE_ATOMIC_ORDER_RELAXED (1 << 0)
+#define CL_DEVICE_ATOMIC_ORDER_ACQ_REL (1 << 1)
+#define CL_DEVICE_ATOMIC_ORDER_SEQ_CST (1 << 2)
+#define CL_DEVICE_ATOMIC_SCOPE_WORK_ITEM (1 << 3)
+#define CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP (1 << 4)
+#define CL_DEVICE_ATOMIC_SCOPE_DEVICE (1 << 5)
+#define CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES (1 << 6)
+#endif
+
+/* cl_device_device_enqueue_capabilities - bitfield */
+#ifdef CL_VERSION_3_0
+#define CL_DEVICE_QUEUE_SUPPORTED (1 << 0)
+#define CL_DEVICE_QUEUE_REPLACEABLE_DEFAULT (1 << 1)
+#endif
+
+/* cl_khronos_vendor_id */
+#define CL_KHRONOS_VENDOR_ID_CODEPLAY 0x10004
+
+/* cl_version */
+#define CL_VERSION_MAJOR_BITS (10)
+#define CL_VERSION_MINOR_BITS (10)
+#define CL_VERSION_PATCH_BITS (12)
+
+#define CL_VERSION_MAJOR_MASK ((1 << CL_VERSION_MAJOR_BITS) - 1)
+#define CL_VERSION_MINOR_MASK ((1 << CL_VERSION_MINOR_BITS) - 1)
+#define CL_VERSION_PATCH_MASK ((1 << CL_VERSION_PATCH_BITS) - 1)
+
+#define CL_VERSION_MAJOR(version) \
+ ((version) >> (CL_VERSION_MINOR_BITS + CL_VERSION_PATCH_BITS))
+
+#define CL_VERSION_MINOR(version) \
+ (((version) >> CL_VERSION_PATCH_BITS) & CL_VERSION_MINOR_MASK)
+
+#define CL_VERSION_PATCH(version) ((version) & CL_VERSION_PATCH_MASK)
+
+#define CL_MAKE_VERSION(major, minor, patch) \
+ ((((major) & CL_VERSION_MAJOR_MASK) \
+ << (CL_VERSION_MINOR_BITS + CL_VERSION_PATCH_BITS)) | \
+ (((minor) & CL_VERSION_MINOR_MASK) << CL_VERSION_PATCH_BITS) | \
+ ((patch) & CL_VERSION_PATCH_MASK))
+
+/********************************************************************************************************/
+
+/* CL_NO_PROTOTYPES implies CL_NO_CORE_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_CORE_PROTOTYPES)
+#define CL_NO_CORE_PROTOTYPES
+#endif
+
+#if !defined(CL_NO_CORE_PROTOTYPES)
+
+/* Platform API */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPlatformIDs(cl_uint num_entries,
+ cl_platform_id * platforms,
+ cl_uint * num_platforms) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPlatformInfo(cl_platform_id platform,
+ cl_platform_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+/* Device APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDs(cl_platform_id platform,
+ cl_device_type device_type,
+ cl_uint num_entries,
+ cl_device_id * devices,
+ cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceInfo(cl_device_id device,
+ cl_device_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateSubDevices(cl_device_id in_device,
+ const cl_device_partition_property * properties,
+ cl_uint num_devices,
+ cl_device_id * out_devices,
+ cl_uint * num_devices_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseDevice(cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_VERSION_2_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetDefaultDeviceCommandQueue(cl_context context,
+ cl_device_id device,
+ cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceAndHostTimer(cl_device_id device,
+ cl_ulong* device_timestamp,
+ cl_ulong* host_timestamp) CL_API_SUFFIX__VERSION_2_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetHostTimer(cl_device_id device,
+ cl_ulong * host_timestamp) CL_API_SUFFIX__VERSION_2_1;
+
+#endif
+
+/* Context APIs */
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContext(const cl_context_properties * properties,
+ cl_uint num_devices,
+ const cl_device_id * devices,
+ void (CL_CALLBACK * pfn_notify)(const char * errinfo,
+ const void * private_info,
+ size_t cb,
+ void * user_data),
+ void * user_data,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContextFromType(const cl_context_properties * properties,
+ cl_device_type device_type,
+ void (CL_CALLBACK * pfn_notify)(const char * errinfo,
+ const void * private_info,
+ size_t cb,
+ void * user_data),
+ void * user_data,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainContext(cl_context context) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseContext(cl_context context) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetContextInfo(cl_context context,
+ cl_context_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_3_0
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetContextDestructorCallback(cl_context context,
+ void (CL_CALLBACK* pfn_notify)(cl_context context,
+ void* user_data),
+ void* user_data) CL_API_SUFFIX__VERSION_3_0;
+
+#endif
+
+/* Command Queue APIs */
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_command_queue CL_API_CALL
+clCreateCommandQueueWithProperties(cl_context context,
+ cl_device_id device,
+ const cl_queue_properties * properties,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseCommandQueue(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetCommandQueueInfo(cl_command_queue command_queue,
+ cl_command_queue_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+/* Memory Object APIs */
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBuffer(cl_context context,
+ cl_mem_flags flags,
+ size_t size,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateSubBuffer(cl_mem buffer,
+ cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type,
+ const void * buffer_create_info,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImage(cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format * image_format,
+ const cl_image_desc * image_desc,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreatePipe(cl_context context,
+ cl_mem_flags flags,
+ cl_uint pipe_packet_size,
+ cl_uint pipe_max_packets,
+ const cl_pipe_properties * properties,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+#ifdef CL_VERSION_3_0
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBufferWithProperties(cl_context context,
+ const cl_mem_properties * properties,
+ cl_mem_flags flags,
+ size_t size,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImageWithProperties(cl_context context,
+ const cl_mem_properties * properties,
+ cl_mem_flags flags,
+ const cl_image_format * image_format,
+ const cl_image_desc * image_desc,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_3_0;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseMemObject(cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedImageFormats(cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_image_format * image_formats,
+ cl_uint * num_image_formats) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMemObjectInfo(cl_mem memobj,
+ cl_mem_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetImageInfo(cl_mem image,
+ cl_image_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPipeInfo(cl_mem pipe,
+ cl_pipe_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetMemObjectDestructorCallback(cl_mem memobj,
+ void (CL_CALLBACK * pfn_notify)(cl_mem memobj,
+ void * user_data),
+ void * user_data) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+/* SVM Allocation APIs */
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY void * CL_API_CALL
+clSVMAlloc(cl_context context,
+ cl_svm_mem_flags flags,
+ size_t size,
+ cl_uint alignment) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY void CL_API_CALL
+clSVMFree(cl_context context,
+ void * svm_pointer) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+/* Sampler APIs */
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_sampler CL_API_CALL
+clCreateSamplerWithProperties(cl_context context,
+ const cl_sampler_properties * sampler_properties,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseSampler(cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSamplerInfo(cl_sampler sampler,
+ cl_sampler_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+/* Program Object APIs */
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithSource(cl_context context,
+ cl_uint count,
+ const char ** strings,
+ const size_t * lengths,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithBinary(cl_context context,
+ cl_uint num_devices,
+ const cl_device_id * device_list,
+ const size_t * lengths,
+ const unsigned char ** binaries,
+ cl_int * binary_status,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithBuiltInKernels(cl_context context,
+ cl_uint num_devices,
+ const cl_device_id * device_list,
+ const char * kernel_names,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_VERSION_2_1
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithIL(cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseProgram(cl_program program) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clBuildProgram(cl_program program,
+ cl_uint num_devices,
+ const cl_device_id * device_list,
+ const char * options,
+ void (CL_CALLBACK * pfn_notify)(cl_program program,
+ void * user_data),
+ void * user_data) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCompileProgram(cl_program program,
+ cl_uint num_devices,
+ const cl_device_id * device_list,
+ const char * options,
+ cl_uint num_input_headers,
+ const cl_program * input_headers,
+ const char ** header_include_names,
+ void (CL_CALLBACK * pfn_notify)(cl_program program,
+ void * user_data),
+ void * user_data) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clLinkProgram(cl_context context,
+ cl_uint num_devices,
+ const cl_device_id * device_list,
+ const char * options,
+ cl_uint num_input_programs,
+ const cl_program * input_programs,
+ void (CL_CALLBACK * pfn_notify)(cl_program program,
+ void * user_data),
+ void * user_data,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_VERSION_2_2
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_2_2_DEPRECATED cl_int CL_API_CALL
+clSetProgramReleaseCallback(cl_program program,
+ void (CL_CALLBACK * pfn_notify)(cl_program program,
+ void * user_data),
+ void * user_data) CL_API_SUFFIX__VERSION_2_2_DEPRECATED;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetProgramSpecializationConstant(cl_program program,
+ cl_uint spec_id,
+ size_t spec_size,
+ const void* spec_value) CL_API_SUFFIX__VERSION_2_2;
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clUnloadPlatformCompiler(cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramInfo(cl_program program,
+ cl_program_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramBuildInfo(cl_program program,
+ cl_device_id device,
+ cl_program_build_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+/* Kernel Object APIs */
+extern CL_API_ENTRY cl_kernel CL_API_CALL
+clCreateKernel(cl_program program,
+ const char * kernel_name,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateKernelsInProgram(cl_program program,
+ cl_uint num_kernels,
+ cl_kernel * kernels,
+ cl_uint * num_kernels_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_2_1
+
+extern CL_API_ENTRY cl_kernel CL_API_CALL
+clCloneKernel(cl_kernel source_kernel,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_2_1;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseKernel(cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArg(cl_kernel kernel,
+ cl_uint arg_index,
+ size_t arg_size,
+ const void * arg_value) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArgSVMPointer(cl_kernel kernel,
+ cl_uint arg_index,
+ const void * arg_value) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelExecInfo(cl_kernel kernel,
+ cl_kernel_exec_info param_name,
+ size_t param_value_size,
+ const void * param_value) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelInfo(cl_kernel kernel,
+ cl_kernel_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelArgInfo(cl_kernel kernel,
+ cl_uint arg_indx,
+ cl_kernel_arg_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelWorkGroupInfo(cl_kernel kernel,
+ cl_device_id device,
+ cl_kernel_work_group_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_2_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelSubGroupInfo(cl_kernel kernel,
+ cl_device_id device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_1;
+
+#endif
+
+/* Event Object APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clWaitForEvents(cl_uint num_events,
+ const cl_event * event_list) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventInfo(cl_event event,
+ cl_event_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateUserEvent(cl_context context,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseEvent(cl_event event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetUserEventStatus(cl_event event,
+ cl_int execution_status) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetEventCallback(cl_event event,
+ cl_int command_exec_callback_type,
+ void (CL_CALLBACK * pfn_notify)(cl_event event,
+ cl_int event_command_status,
+ void * user_data),
+ void * user_data) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+/* Profiling APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventProfilingInfo(cl_event event,
+ cl_profiling_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+/* Flush and Finish APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFlush(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFinish(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
+
+/* Enqueued Commands APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadBuffer(cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_read,
+ size_t offset,
+ size_t size,
+ void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadBufferRect(cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_read,
+ const size_t * buffer_origin,
+ const size_t * host_origin,
+ const size_t * region,
+ size_t buffer_row_pitch,
+ size_t buffer_slice_pitch,
+ size_t host_row_pitch,
+ size_t host_slice_pitch,
+ void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteBuffer(cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_write,
+ size_t offset,
+ size_t size,
+ const void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteBufferRect(cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_write,
+ const size_t * buffer_origin,
+ const size_t * host_origin,
+ const size_t * region,
+ size_t buffer_row_pitch,
+ size_t buffer_slice_pitch,
+ size_t host_row_pitch,
+ size_t host_slice_pitch,
+ const void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueFillBuffer(cl_command_queue command_queue,
+ cl_mem buffer,
+ const void * pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBuffer(cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBufferRect(cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t * src_origin,
+ const size_t * dst_origin,
+ const size_t * region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_1;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadImage(cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_read,
+ const size_t * origin,
+ const size_t * region,
+ size_t row_pitch,
+ size_t slice_pitch,
+ void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteImage(cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_write,
+ const size_t * origin,
+ const size_t * region,
+ size_t input_row_pitch,
+ size_t input_slice_pitch,
+ const void * ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueFillImage(cl_command_queue command_queue,
+ cl_mem image,
+ const void * fill_color,
+ const size_t * origin,
+ const size_t * region,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImage(cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t * src_origin,
+ const size_t * dst_origin,
+ const size_t * region,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t * src_origin,
+ const size_t * region,
+ size_t dst_offset,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBufferToImage(cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t * dst_origin,
+ const size_t * region,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapBuffer(cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_map,
+ cl_map_flags map_flags,
+ size_t offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapImage(cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_map,
+ cl_map_flags map_flags,
+ const size_t * origin,
+ const size_t * region,
+ size_t * image_row_pitch,
+ size_t * image_slice_pitch,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueUnmapMemObject(cl_command_queue command_queue,
+ cl_mem memobj,
+ void * mapped_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMigrateMemObjects(cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem * mem_objects,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNDRangeKernel(cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t * global_work_offset,
+ const size_t * global_work_size,
+ const size_t * local_work_size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNativeKernel(cl_command_queue command_queue,
+ void (CL_CALLBACK * user_func)(void *),
+ void * args,
+ size_t cb_args,
+ cl_uint num_mem_objects,
+ const cl_mem * mem_list,
+ const void ** args_mem_loc,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_VERSION_1_2
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMarkerWithWaitList(cl_command_queue command_queue,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueBarrierWithWaitList(cl_command_queue command_queue,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_VERSION_2_0
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMFree(cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void * svm_pointers[],
+ void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue,
+ cl_uint num_svm_pointers,
+ void * svm_pointers[],
+ void * user_data),
+ void * user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemcpy(cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void * dst_ptr,
+ const void * src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemFill(cl_command_queue command_queue,
+ void * svm_ptr,
+ const void * pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMap(cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void * svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMUnmap(cl_command_queue command_queue,
+ void * svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_0;
+
+#endif
+
+#ifdef CL_VERSION_2_1
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMigrateMem(cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ const void ** svm_pointers,
+ const size_t * sizes,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_2_1;
+
+#endif
+
+#ifdef CL_VERSION_1_2
+
+/* Extension function access
+ *
+ * Returns the extension function address for the given function name,
+ * or NULL if a valid function can not be found. The client must
+ * check to make sure the address is not NULL, before using or
+ * calling the returned function address.
+ */
+extern CL_API_ENTRY void * CL_API_CALL
+clGetExtensionFunctionAddressForPlatform(cl_platform_id platform,
+ const char * func_name) CL_API_SUFFIX__VERSION_1_2;
+
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+ /*
+ * WARNING:
+ * This API introduces mutable state into the OpenCL implementation. It has been REMOVED
+ * to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the
+ * OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
+ * It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
+ *
+ * Software developers previously relying on this API are instructed to set the command queue
+ * properties when creating the queue, instead.
+ */
+ extern CL_API_ENTRY cl_int CL_API_CALL
+ clSetCommandQueueProperty(cl_command_queue command_queue,
+ cl_command_queue_properties properties,
+ cl_bool enable,
+ cl_command_queue_properties * old_properties) CL_API_SUFFIX__VERSION_1_0_DEPRECATED;
+#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
+
+/* Deprecated OpenCL 1.1 APIs */
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
+clCreateImage2D(cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format * image_format,
+ size_t image_width,
+ size_t image_height,
+ size_t image_row_pitch,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL
+clCreateImage3D(cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format * image_format,
+ size_t image_width,
+ size_t image_height,
+ size_t image_depth,
+ size_t image_row_pitch,
+ size_t image_slice_pitch,
+ void * host_ptr,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL
+clEnqueueMarker(cl_command_queue command_queue,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL
+clEnqueueWaitForEvents(cl_command_queue command_queue,
+ cl_uint num_events,
+ const cl_event * event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL
+clEnqueueBarrier(cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL
+clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL
+clGetExtensionFunctionAddress(const char * func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+/* Deprecated OpenCL 2.0 APIs */
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_command_queue CL_API_CALL
+clCreateCommandQueue(cl_context context,
+ cl_device_id device,
+ cl_command_queue_properties properties,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_sampler CL_API_CALL
+clCreateSampler(cl_context context,
+ cl_bool normalized_coords,
+ cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode,
+ cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+extern CL_API_ENTRY CL_API_PREFIX__VERSION_1_2_DEPRECATED cl_int CL_API_CALL
+clEnqueueTask(cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint num_events_in_wait_list,
+ const cl_event * event_wait_list,
+ cl_event * event) CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+#endif /* !defined(CL_NO_CORE_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_CL_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_d3d10.h b/tmpl8/lib/OpenCL/inc/CL/cl_d3d10.h
new file mode 100644
index 0000000..6b56c77
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_d3d10.h
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_D3D10_H_
+#define OPENCL_CL_D3D10_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( push )
+#pragma warning( disable : 4201 )
+#pragma warning( disable : 5105 )
+#endif
+#endif
+#include
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( pop )
+#endif
+#endif
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_d3d10_sharing
+***************************************************************/
+#define cl_khr_d3d10_sharing 1
+#define CL_KHR_D3D10_SHARING_EXTENSION_NAME \
+ "cl_khr_d3d10_sharing"
+
+
+#define CL_KHR_D3D10_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_d3d10_device_source_khr;
+typedef cl_uint cl_d3d10_device_set_khr;
+
+/* Error codes */
+#define CL_INVALID_D3D10_DEVICE_KHR -1002
+#define CL_INVALID_D3D10_RESOURCE_KHR -1003
+#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
+#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
+
+/* cl_d3d10_device_source_khr */
+#define CL_D3D10_DEVICE_KHR 0x4010
+#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
+
+/* cl_d3d10_device_set_khr */
+#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
+#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
+
+/* cl_context_info */
+#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
+#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
+
+/* cl_mem_info */
+#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
+
+/* cl_image_info */
+#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
+#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceIDsFromD3D10KHR_t(
+ cl_platform_id platform,
+ cl_d3d10_device_source_khr d3d_device_source,
+ void* d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDsFromD3D10KHR_t *
+clGetDeviceIDsFromD3D10KHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D10BufferKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Buffer* resource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D10BufferKHR_t *
+clCreateFromD3D10BufferKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D10Texture2DKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Texture2D* resource,
+ UINT subresource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D10Texture2DKHR_t *
+clCreateFromD3D10Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D10Texture3DKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Texture3D* resource,
+ UINT subresource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D10Texture3DKHR_t *
+clCreateFromD3D10Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireD3D10ObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireD3D10ObjectsKHR_t *
+clEnqueueAcquireD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseD3D10ObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseD3D10ObjectsKHR_t *
+clEnqueueReleaseD3D10ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDsFromD3D10KHR(
+ cl_platform_id platform,
+ cl_d3d10_device_source_khr d3d_device_source,
+ void* d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D10BufferKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Buffer* resource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D10Texture2DKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Texture2D* resource,
+ UINT subresource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D10Texture3DKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D10Texture3D* resource,
+ UINT subresource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireD3D10ObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseD3D10ObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_sharing_format_query_d3d10
+***************************************************************/
+#define cl_intel_sharing_format_query_d3d10 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_D3D10_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_d3d10"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_D3D10_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_khr_d3d10_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedD3D10TextureFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ DXGI_FORMAT* d3d10_formats,
+ cl_uint* num_texture_formats);
+
+typedef clGetSupportedD3D10TextureFormatsINTEL_t *
+clGetSupportedD3D10TextureFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedD3D10TextureFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ DXGI_FORMAT* d3d10_formats,
+ cl_uint* num_texture_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_D3D10_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_d3d11.h b/tmpl8/lib/OpenCL/inc/CL/cl_d3d11.h
new file mode 100644
index 0000000..384c8f4
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_d3d11.h
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_D3D11_H_
+#define OPENCL_CL_D3D11_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( push )
+#pragma warning( disable : 4201 )
+#pragma warning( disable : 5105 )
+#endif
+#endif
+#include
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( pop )
+#endif
+#endif
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_d3d11_sharing
+***************************************************************/
+#define cl_khr_d3d11_sharing 1
+#define CL_KHR_D3D11_SHARING_EXTENSION_NAME \
+ "cl_khr_d3d11_sharing"
+
+
+#define CL_KHR_D3D11_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_d3d11_device_source_khr;
+typedef cl_uint cl_d3d11_device_set_khr;
+
+/* Error codes */
+#define CL_INVALID_D3D11_DEVICE_KHR -1006
+#define CL_INVALID_D3D11_RESOURCE_KHR -1007
+#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008
+#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009
+
+/* cl_d3d11_device_source_khr */
+#define CL_D3D11_DEVICE_KHR 0x4019
+#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A
+
+/* cl_d3d11_device_set_khr */
+#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B
+#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C
+
+/* cl_context_info */
+#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D
+#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D
+
+/* cl_mem_info */
+#define CL_MEM_D3D11_RESOURCE_KHR 0x401E
+
+/* cl_image_info */
+#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020
+#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceIDsFromD3D11KHR_t(
+ cl_platform_id platform,
+ cl_d3d11_device_source_khr d3d_device_source,
+ void* d3d_object,
+ cl_d3d11_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDsFromD3D11KHR_t *
+clGetDeviceIDsFromD3D11KHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D11BufferKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Buffer* resource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D11BufferKHR_t *
+clCreateFromD3D11BufferKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D11Texture2DKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Texture2D* resource,
+ UINT subresource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D11Texture2DKHR_t *
+clCreateFromD3D11Texture2DKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL
+clCreateFromD3D11Texture3DKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Texture3D* resource,
+ UINT subresource,
+ cl_int* errcode_ret);
+
+typedef clCreateFromD3D11Texture3DKHR_t *
+clCreateFromD3D11Texture3DKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireD3D11ObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireD3D11ObjectsKHR_t *
+clEnqueueAcquireD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseD3D11ObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseD3D11ObjectsKHR_t *
+clEnqueueReleaseD3D11ObjectsKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDsFromD3D11KHR(
+ cl_platform_id platform,
+ cl_d3d11_device_source_khr d3d_device_source,
+ void* d3d_object,
+ cl_d3d11_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D11BufferKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Buffer* resource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D11Texture2DKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Texture2D* resource,
+ UINT subresource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromD3D11Texture3DKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ ID3D11Texture3D* resource,
+ UINT subresource,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireD3D11ObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseD3D11ObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_sharing_format_query_d3d11
+***************************************************************/
+#define cl_intel_sharing_format_query_d3d11 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_D3D11_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_d3d11"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_D3D11_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_khr_d3d11_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedD3D11TextureFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ DXGI_FORMAT* d3d11_formats,
+ cl_uint* num_texture_formats);
+
+typedef clGetSupportedD3D11TextureFormatsINTEL_t *
+clGetSupportedD3D11TextureFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedD3D11TextureFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ DXGI_FORMAT* d3d11_formats,
+ cl_uint* num_texture_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_D3D11_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing.h b/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing.h
new file mode 100644
index 0000000..b079379
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing.h
@@ -0,0 +1,386 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_DX9_MEDIA_SHARING_H_
+#define OPENCL_CL_DX9_MEDIA_SHARING_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#if defined(_WIN32)
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( push )
+#pragma warning( disable : 4201 )
+#pragma warning( disable : 5105 )
+#endif
+#endif
+#include
+#if defined(_MSC_VER)
+#if _MSC_VER >=1500
+#pragma warning( pop )
+#endif
+#endif
+#endif
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_dx9_media_sharing
+***************************************************************/
+#define cl_khr_dx9_media_sharing 1
+#define CL_KHR_DX9_MEDIA_SHARING_EXTENSION_NAME \
+ "cl_khr_dx9_media_sharing"
+
+
+#define CL_KHR_DX9_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_dx9_media_adapter_type_khr;
+typedef cl_uint cl_dx9_media_adapter_set_khr;
+
+#if defined(_WIN32)
+typedef struct _cl_dx9_surface_info_khr {
+ IDirect3DSurface9* resource;
+ HANDLE shared_handle;
+} cl_dx9_surface_info_khr;
+
+#endif /* defined(_WIN32) */
+
+/* Error codes */
+#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010
+#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011
+#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012
+#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013
+
+/* cl_media_adapter_type_khr */
+#define CL_ADAPTER_D3D9_KHR 0x2020
+#define CL_ADAPTER_D3D9EX_KHR 0x2021
+#define CL_ADAPTER_DXVA_KHR 0x2022
+
+/* cl_media_adapter_set_khr */
+#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023
+#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024
+
+/* cl_context_info */
+#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025
+#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026
+#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027
+
+/* cl_mem_info */
+#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028
+#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029
+
+/* cl_image_info */
+#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B
+#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceIDsFromDX9MediaAdapterKHR_t(
+ cl_platform_id platform,
+ cl_uint num_media_adapters,
+ cl_dx9_media_adapter_type_khr* media_adapter_type,
+ void* media_adapters,
+ cl_dx9_media_adapter_set_khr media_adapter_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDsFromDX9MediaAdapterKHR_t *
+clGetDeviceIDsFromDX9MediaAdapterKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL
+clCreateFromDX9MediaSurfaceKHR_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_dx9_media_adapter_type_khr adapter_type,
+ void* surface_info,
+ cl_uint plane,
+ cl_int* errcode_ret);
+
+typedef clCreateFromDX9MediaSurfaceKHR_t *
+clCreateFromDX9MediaSurfaceKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireDX9MediaSurfacesKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireDX9MediaSurfacesKHR_t *
+clEnqueueAcquireDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseDX9MediaSurfacesKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseDX9MediaSurfacesKHR_t *
+clEnqueueReleaseDX9MediaSurfacesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDsFromDX9MediaAdapterKHR(
+ cl_platform_id platform,
+ cl_uint num_media_adapters,
+ cl_dx9_media_adapter_type_khr* media_adapter_type,
+ void* media_adapters,
+ cl_dx9_media_adapter_set_khr media_adapter_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromDX9MediaSurfaceKHR(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_dx9_media_adapter_type_khr adapter_type,
+ void* surface_info,
+ cl_uint plane,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireDX9MediaSurfacesKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseDX9MediaSurfacesKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_dx9_media_sharing
+***************************************************************/
+#define cl_intel_dx9_media_sharing 1
+#define CL_INTEL_DX9_MEDIA_SHARING_EXTENSION_NAME \
+ "cl_intel_dx9_media_sharing"
+
+
+#define CL_INTEL_DX9_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_dx9_device_source_intel;
+typedef cl_uint cl_dx9_device_set_intel;
+
+/* Error codes */
+#define CL_INVALID_DX9_DEVICE_INTEL -1010
+#define CL_INVALID_DX9_RESOURCE_INTEL -1011
+#define CL_DX9_RESOURCE_ALREADY_ACQUIRED_INTEL -1012
+#define CL_DX9_RESOURCE_NOT_ACQUIRED_INTEL -1013
+
+/* cl_dx9_device_source_intel */
+#define CL_D3D9_DEVICE_INTEL 0x4022
+#define CL_D3D9EX_DEVICE_INTEL 0x4070
+#define CL_DXVA_DEVICE_INTEL 0x4071
+
+/* cl_dx9_device_set_intel */
+#define CL_PREFERRED_DEVICES_FOR_DX9_INTEL 0x4024
+#define CL_ALL_DEVICES_FOR_DX9_INTEL 0x4025
+
+/* cl_context_info */
+#define CL_CONTEXT_D3D9_DEVICE_INTEL 0x4026
+#define CL_CONTEXT_D3D9EX_DEVICE_INTEL 0x4072
+#define CL_CONTEXT_DXVA_DEVICE_INTEL 0x4073
+
+/* cl_mem_info */
+#define CL_MEM_DX9_RESOURCE_INTEL 0x4027
+#define CL_MEM_DX9_SHARED_HANDLE_INTEL 0x4074
+
+/* cl_image_info */
+#define CL_IMAGE_DX9_PLANE_INTEL 0x4075
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_DX9_OBJECTS_INTEL 0x402A
+#define CL_COMMAND_RELEASE_DX9_OBJECTS_INTEL 0x402B
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceIDsFromDX9INTEL_t(
+ cl_platform_id platform,
+ cl_dx9_device_source_intel dx9_device_source,
+ void* dx9_object,
+ cl_dx9_device_set_intel dx9_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDsFromDX9INTEL_t *
+clGetDeviceIDsFromDX9INTEL_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_mem CL_API_CALL
+clCreateFromDX9MediaSurfaceINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ IDirect3DSurface9* resource,
+ HANDLE sharedHandle,
+ UINT plane,
+ cl_int* errcode_ret);
+
+typedef clCreateFromDX9MediaSurfaceINTEL_t *
+clCreateFromDX9MediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireDX9ObjectsINTEL_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireDX9ObjectsINTEL_t *
+clEnqueueAcquireDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseDX9ObjectsINTEL_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseDX9ObjectsINTEL_t *
+clEnqueueReleaseDX9ObjectsINTEL_fn CL_API_SUFFIX__VERSION_1_1;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDsFromDX9INTEL(
+ cl_platform_id platform,
+ cl_dx9_device_source_intel dx9_device_source,
+ void* dx9_object,
+ cl_dx9_device_set_intel dx9_device_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromDX9MediaSurfaceINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ IDirect3DSurface9* resource,
+ HANDLE sharedHandle,
+ UINT plane,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireDX9ObjectsINTEL(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseDX9ObjectsINTEL(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_sharing_format_query_dx9
+***************************************************************/
+#define cl_intel_sharing_format_query_dx9 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_DX9_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_dx9"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_DX9_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_khr_dx9_media_sharing or cl_intel_dx9_media_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedDX9MediaSurfaceFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ D3DFORMAT* dx9_formats,
+ cl_uint* num_surface_formats);
+
+typedef clGetSupportedDX9MediaSurfaceFormatsINTEL_t *
+clGetSupportedDX9MediaSurfaceFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedDX9MediaSurfaceFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ D3DFORMAT* dx9_formats,
+ cl_uint* num_surface_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_DX9_MEDIA_SHARING_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing_intel.h b/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing_intel.h
new file mode 100644
index 0000000..f6518d7
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_dx9_media_sharing_intel.h
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#include
+#pragma message("The Intel DX9 media sharing extensions have been moved into cl_dx9_media_sharing.h. Please include cl_dx9_media_sharing.h directly.")
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_egl.h b/tmpl8/lib/OpenCL/inc/CL/cl_egl.h
new file mode 100644
index 0000000..68aefec
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_egl.h
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_EGL_H_
+#define OPENCL_CL_EGL_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_egl_image
+***************************************************************/
+#define cl_khr_egl_image 1
+#define CL_KHR_EGL_IMAGE_EXTENSION_NAME \
+ "cl_khr_egl_image"
+
+
+#define CL_KHR_EGL_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* Command type for events created with clEnqueueAcquireEGLObjectsKHR */
+#define CL_COMMAND_EGL_FENCE_SYNC_OBJECT_KHR 0x202F
+#define CL_COMMAND_ACQUIRE_EGL_OBJECTS_KHR 0x202D
+#define CL_COMMAND_RELEASE_EGL_OBJECTS_KHR 0x202E
+
+/* Error type for clCreateFromEGLImageKHR */
+#define CL_INVALID_EGL_OBJECT_KHR -1093
+#define CL_EGL_RESOURCE_NOT_ACQUIRED_KHR -1092
+
+/* CLeglImageKHR is an opaque handle to an EGLImage */
+typedef void* CLeglImageKHR;
+
+/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
+typedef void* CLeglDisplayKHR;
+
+/* properties passed to clCreateFromEGLImageKHR */
+typedef intptr_t cl_egl_image_properties_khr;
+
+
+typedef cl_mem CL_API_CALL
+clCreateFromEGLImageKHR_t(
+ cl_context context,
+ CLeglDisplayKHR egldisplay,
+ CLeglImageKHR eglimage,
+ cl_mem_flags flags,
+ const cl_egl_image_properties_khr* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateFromEGLImageKHR_t *
+clCreateFromEGLImageKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireEGLObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireEGLObjectsKHR_t *
+clEnqueueAcquireEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseEGLObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseEGLObjectsKHR_t *
+clEnqueueReleaseEGLObjectsKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromEGLImageKHR(
+ cl_context context,
+ CLeglDisplayKHR egldisplay,
+ CLeglImageKHR eglimage,
+ cl_mem_flags flags,
+ const cl_egl_image_properties_khr* properties,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireEGLObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseEGLObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_egl_event
+***************************************************************/
+#define cl_khr_egl_event 1
+#define CL_KHR_EGL_EVENT_EXTENSION_NAME \
+ "cl_khr_egl_event"
+
+
+#define CL_KHR_EGL_EVENT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* CLeglDisplayKHR is an opaque handle to an EGLDisplay */
+/* type CLeglDisplayKHR */
+
+/* CLeglSyncKHR is an opaque handle to an EGLSync object */
+typedef void* CLeglSyncKHR;
+
+
+typedef cl_event CL_API_CALL
+clCreateEventFromEGLSyncKHR_t(
+ cl_context context,
+ CLeglSyncKHR sync,
+ CLeglDisplayKHR display,
+ cl_int* errcode_ret);
+
+typedef clCreateEventFromEGLSyncKHR_t *
+clCreateEventFromEGLSyncKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateEventFromEGLSyncKHR(
+ cl_context context,
+ CLeglSyncKHR sync,
+ CLeglDisplayKHR display,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_EGL_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_ext.h b/tmpl8/lib/OpenCL/inc/CL/cl_ext.h
new file mode 100644
index 0000000..1a48985
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_ext.h
@@ -0,0 +1,4227 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_EXT_H_
+#define OPENCL_CL_EXT_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_command_buffer
+***************************************************************/
+#define cl_khr_command_buffer 1
+#define CL_KHR_COMMAND_BUFFER_EXTENSION_NAME \
+ "cl_khr_command_buffer"
+
+
+#define CL_KHR_COMMAND_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 5)
+
+typedef cl_bitfield cl_device_command_buffer_capabilities_khr;
+typedef struct _cl_command_buffer_khr* cl_command_buffer_khr;
+typedef cl_uint cl_sync_point_khr;
+typedef cl_uint cl_command_buffer_info_khr;
+typedef cl_uint cl_command_buffer_state_khr;
+typedef cl_properties cl_command_buffer_properties_khr;
+typedef cl_bitfield cl_command_buffer_flags_khr;
+typedef cl_properties cl_command_properties_khr;
+typedef struct _cl_mutable_command_khr* cl_mutable_command_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR 0x12A9
+#define CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR 0x12AA
+
+/* cl_device_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR (1 << 0)
+#define CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR (1 << 1)
+#define CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR (1 << 2)
+#define CL_COMMAND_BUFFER_CAPABILITY_OUT_OF_ORDER_KHR (1 << 3)
+
+/* cl_command_buffer_properties_khr */
+#define CL_COMMAND_BUFFER_FLAGS_KHR 0x1293
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR (1 << 0)
+
+/* Error codes */
+#define CL_INVALID_COMMAND_BUFFER_KHR -1138
+#define CL_INVALID_SYNC_POINT_WAIT_LIST_KHR -1139
+#define CL_INCOMPATIBLE_COMMAND_QUEUE_KHR -1140
+
+/* cl_command_buffer_info_khr */
+#define CL_COMMAND_BUFFER_QUEUES_KHR 0x1294
+#define CL_COMMAND_BUFFER_NUM_QUEUES_KHR 0x1295
+#define CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR 0x1296
+#define CL_COMMAND_BUFFER_STATE_KHR 0x1297
+#define CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR 0x1298
+#define CL_COMMAND_BUFFER_CONTEXT_KHR 0x1299
+
+/* cl_command_buffer_state_khr */
+#define CL_COMMAND_BUFFER_STATE_RECORDING_KHR 0
+#define CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR 1
+#define CL_COMMAND_BUFFER_STATE_PENDING_KHR 2
+
+/* cl_command_type */
+#define CL_COMMAND_COMMAND_BUFFER_KHR 0x12A8
+
+
+typedef cl_command_buffer_khr CL_API_CALL
+clCreateCommandBufferKHR_t(
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ const cl_command_buffer_properties_khr* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandBufferKHR_t *
+clCreateCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clFinalizeCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clFinalizeCommandBufferKHR_t *
+clFinalizeCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clRetainCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clRetainCommandBufferKHR_t *
+clRetainCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clReleaseCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer);
+
+typedef clReleaseCommandBufferKHR_t *
+clReleaseCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueCommandBufferKHR_t(
+ cl_uint num_queues,
+ cl_command_queue* queues,
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCommandBufferKHR_t *
+clEnqueueCommandBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandBarrierWithWaitListKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandBarrierWithWaitListKHR_t *
+clCommandBarrierWithWaitListKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferKHR_t *
+clCommandCopyBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferRectKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferRectKHR_t *
+clCommandCopyBufferRectKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyBufferToImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyBufferToImageKHR_t *
+clCommandCopyBufferToImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyImageKHR_t *
+clCommandCopyImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandCopyImageToBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* region,
+ size_t dst_offset,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandCopyImageToBufferKHR_t *
+clCommandCopyImageToBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandFillBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem buffer,
+ const void* pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandFillBufferKHR_t *
+clCommandFillBufferKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandFillImageKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem image,
+ const void* fill_color,
+ const size_t* origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandFillImageKHR_t *
+clCommandFillImageKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clCommandNDRangeKernelKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ const size_t* local_work_size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandNDRangeKernelKHR_t *
+clCommandNDRangeKernelKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clGetCommandBufferInfoKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_buffer_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetCommandBufferInfoKHR_t *
+clGetCommandBufferInfoKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL
+clCreateCommandBufferKHR(
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ const cl_command_buffer_properties_khr* properties,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFinalizeCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseCommandBufferKHR(
+ cl_command_buffer_khr command_buffer) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCommandBufferKHR(
+ cl_uint num_queues,
+ cl_command_queue* queues,
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandBarrierWithWaitListKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferRectKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyBufferToImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandCopyImageToBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* region,
+ size_t dst_offset,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandFillBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem buffer,
+ const void* pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandFillImageKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_mem image,
+ const void* fill_color,
+ const size_t* origin,
+ const size_t* region,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandNDRangeKernelKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ const size_t* local_work_size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetCommandBufferInfoKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_buffer_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/* From version 0.9.4 of the extension */
+
+typedef cl_int CL_API_CALL
+clCommandSVMMemcpyKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandSVMMemcpyKHR_t *
+clCommandSVMMemcpyKHR_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL
+clCommandSVMMemFillKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle);
+
+typedef clCommandSVMMemFillKHR_t *
+clCommandSVMMemFillKHR_fn CL_API_SUFFIX__VERSION_2_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandSVMMemcpyKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCommandSVMMemFillKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_command_queue command_queue,
+ const cl_command_properties_khr* properties,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_sync_points_in_wait_list,
+ const cl_sync_point_khr* sync_point_wait_list,
+ cl_sync_point_khr* sync_point,
+ cl_mutable_command_khr* mutable_handle) CL_API_SUFFIX__VERSION_2_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_command_buffer_multi_device
+***************************************************************/
+#define cl_khr_command_buffer_multi_device 1
+#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_NAME \
+ "cl_khr_command_buffer_multi_device"
+
+
+#define CL_KHR_COMMAND_BUFFER_MULTI_DEVICE_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 1)
+
+typedef cl_bitfield cl_platform_command_buffer_capabilities_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_COMMAND_BUFFER_CAPABILITIES_KHR 0x0908
+
+/* cl_platform_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_PLATFORM_UNIVERSAL_SYNC_KHR (1 << 0)
+#define CL_COMMAND_BUFFER_PLATFORM_REMAP_QUEUES_KHR (1 << 1)
+#define CL_COMMAND_BUFFER_PLATFORM_AUTOMATIC_REMAP_KHR (1 << 2)
+
+/* cl_device_info */
+#define CL_DEVICE_COMMAND_BUFFER_NUM_SYNC_DEVICES_KHR 0x12AB
+#define CL_DEVICE_COMMAND_BUFFER_SYNC_DEVICES_KHR 0x12AC
+
+/* cl_device_command_buffer_capabilities_khr - bitfield */
+#define CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR (1 << 4)
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR (1 << 2)
+
+
+typedef cl_command_buffer_khr CL_API_CALL
+clRemapCommandBufferKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_bool automatic,
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ cl_uint num_handles,
+ const cl_mutable_command_khr* handles,
+ cl_mutable_command_khr* handles_ret,
+ cl_int* errcode_ret);
+
+typedef clRemapCommandBufferKHR_t *
+clRemapCommandBufferKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_buffer_khr CL_API_CALL
+clRemapCommandBufferKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_bool automatic,
+ cl_uint num_queues,
+ const cl_command_queue* queues,
+ cl_uint num_handles,
+ const cl_mutable_command_khr* handles,
+ cl_mutable_command_khr* handles_ret,
+ cl_int* errcode_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_command_buffer_mutable_dispatch
+***************************************************************/
+#define cl_khr_command_buffer_mutable_dispatch 1
+#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_NAME \
+ "cl_khr_command_buffer_mutable_dispatch"
+
+
+#define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 3)
+
+typedef cl_uint cl_command_buffer_update_type_khr;
+typedef cl_bitfield cl_mutable_dispatch_fields_khr;
+typedef cl_uint cl_mutable_command_info_khr;
+typedef struct _cl_mutable_dispatch_arg_khr {
+ cl_uint arg_index;
+ size_t arg_size;
+ const void* arg_value;
+} cl_mutable_dispatch_arg_khr;
+typedef struct _cl_mutable_dispatch_exec_info_khr {
+ cl_uint param_name;
+ size_t param_value_size;
+ const void* param_value;
+} cl_mutable_dispatch_exec_info_khr;
+typedef struct _cl_mutable_dispatch_config_khr {
+ cl_mutable_command_khr command;
+ cl_uint num_args;
+ cl_uint num_svm_args;
+ cl_uint num_exec_infos;
+ cl_uint work_dim;
+ const cl_mutable_dispatch_arg_khr* arg_list;
+ const cl_mutable_dispatch_arg_khr* arg_svm_list;
+ const cl_mutable_dispatch_exec_info_khr* exec_info_list;
+ const size_t* global_work_offset;
+ const size_t* global_work_size;
+ const size_t* local_work_size;
+} cl_mutable_dispatch_config_khr;
+typedef cl_bitfield cl_mutable_dispatch_asserts_khr;
+
+/* cl_command_buffer_flags_khr - bitfield */
+#define CL_COMMAND_BUFFER_MUTABLE_KHR (1 << 1)
+
+/* Error codes */
+#define CL_INVALID_MUTABLE_COMMAND_KHR -1141
+
+/* cl_device_info */
+#define CL_DEVICE_MUTABLE_DISPATCH_CAPABILITIES_KHR 0x12B0
+
+/* cl_command_properties_khr */
+#define CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR 0x12B1
+
+/* cl_mutable_dispatch_fields_khr - bitfield */
+#define CL_MUTABLE_DISPATCH_GLOBAL_OFFSET_KHR (1 << 0)
+#define CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR (1 << 1)
+#define CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR (1 << 2)
+#define CL_MUTABLE_DISPATCH_ARGUMENTS_KHR (1 << 3)
+#define CL_MUTABLE_DISPATCH_EXEC_INFO_KHR (1 << 4)
+
+/* cl_mutable_command_info_khr */
+#define CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR 0x12A0
+#define CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR 0x12A1
+#define CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR 0x12AD
+#define CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR 0x12A2
+#define CL_MUTABLE_DISPATCH_KERNEL_KHR 0x12A3
+#define CL_MUTABLE_DISPATCH_DIMENSIONS_KHR 0x12A4
+#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR 0x12A5
+#define CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR 0x12A6
+#define CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR 0x12A7
+
+/* cl_command_buffer_update_type_khr */
+#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 0
+
+/* cl_command_buffer_properties_khr */
+#define CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B7
+
+/* cl_command_properties_khr */
+#define CL_MUTABLE_DISPATCH_ASSERTS_KHR 0x12B8
+
+/* cl_mutable_dispatch_asserts_khr - bitfield */
+#define CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR (1 << 0)
+
+
+typedef cl_int CL_API_CALL
+clUpdateMutableCommandsKHR_t(
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_configs,
+ const cl_command_buffer_update_type_khr* config_types,
+ const void** configs);
+
+typedef clUpdateMutableCommandsKHR_t *
+clUpdateMutableCommandsKHR_fn ;
+
+typedef cl_int CL_API_CALL
+clGetMutableCommandInfoKHR_t(
+ cl_mutable_command_khr command,
+ cl_mutable_command_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetMutableCommandInfoKHR_t *
+clGetMutableCommandInfoKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clUpdateMutableCommandsKHR(
+ cl_command_buffer_khr command_buffer,
+ cl_uint num_configs,
+ const cl_command_buffer_update_type_khr* config_types,
+ const void** configs) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMutableCommandInfoKHR(
+ cl_mutable_command_khr command,
+ cl_mutable_command_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_fp64
+***************************************************************/
+#define cl_khr_fp64 1
+#define CL_KHR_FP64_EXTENSION_NAME \
+ "cl_khr_fp64"
+
+
+#define CL_KHR_FP64_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_1_2)
+/* cl_device_info - defined in CL.h for OpenCL 1.2 and newer */
+#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
+
+#endif /* !defined(CL_VERSION_1_2) */
+
+/***************************************************************
+* cl_khr_fp16
+***************************************************************/
+#define cl_khr_fp16 1
+#define CL_KHR_FP16_EXTENSION_NAME \
+ "cl_khr_fp16"
+
+
+#define CL_KHR_FP16_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_HALF_FP_CONFIG 0x1033
+
+/***************************************************************
+* cl_APPLE_SetMemObjectDestructor
+***************************************************************/
+#define cl_APPLE_SetMemObjectDestructor 1
+#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_NAME \
+ "cl_APPLE_SetMemObjectDestructor"
+
+
+#define CL_APPLE_SETMEMOBJECTDESTRUCTOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clSetMemObjectDestructorAPPLE_t(
+ cl_mem memobj,
+ void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
+ void* user_data);
+
+typedef clSetMemObjectDestructorAPPLE_t *
+clSetMemObjectDestructorAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetMemObjectDestructorAPPLE(
+ cl_mem memobj,
+ void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_APPLE_ContextLoggingFunctions
+***************************************************************/
+#define cl_APPLE_ContextLoggingFunctions 1
+#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_NAME \
+ "cl_APPLE_ContextLoggingFunctions"
+
+
+#define CL_APPLE_CONTEXTLOGGINGFUNCTIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef void CL_API_CALL
+clLogMessagesToSystemLogAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToSystemLogAPPLE_t *
+clLogMessagesToSystemLogAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void CL_API_CALL
+clLogMessagesToStdoutAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToStdoutAPPLE_t *
+clLogMessagesToStdoutAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void CL_API_CALL
+clLogMessagesToStderrAPPLE_t(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data);
+
+typedef clLogMessagesToStderrAPPLE_t *
+clLogMessagesToStderrAPPLE_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToSystemLogAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToStdoutAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void CL_API_CALL
+clLogMessagesToStderrAPPLE(
+ const char* errstr,
+ const void* private_info,
+ size_t cb,
+ void* user_data) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_icd
+***************************************************************/
+#define cl_khr_icd 1
+#define CL_KHR_ICD_EXTENSION_NAME \
+ "cl_khr_icd"
+
+
+#define CL_KHR_ICD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_platform_info */
+#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
+
+/* Error codes */
+#define CL_PLATFORM_NOT_FOUND_KHR -1001
+
+
+typedef cl_int CL_API_CALL
+clIcdGetPlatformIDsKHR_t(
+ cl_uint num_entries,
+ cl_platform_id* platforms,
+ cl_uint* num_platforms);
+
+typedef clIcdGetPlatformIDsKHR_t *
+clIcdGetPlatformIDsKHR_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clIcdGetPlatformIDsKHR(
+ cl_uint num_entries,
+ cl_platform_id* platforms,
+ cl_uint* num_platforms) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_il_program
+***************************************************************/
+#define cl_khr_il_program 1
+#define CL_KHR_IL_PROGRAM_EXTENSION_NAME \
+ "cl_khr_il_program"
+
+
+#define CL_KHR_IL_PROGRAM_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_IL_VERSION_KHR 0x105B
+
+/* cl_program_info */
+#define CL_PROGRAM_IL_KHR 0x1169
+
+
+typedef cl_program CL_API_CALL
+clCreateProgramWithILKHR_t(
+ cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithILKHR_t *
+clCreateProgramWithILKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithILKHR(
+ cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_image2d_from_buffer
+***************************************************************/
+#define cl_khr_image2d_from_buffer 1
+#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_NAME \
+ "cl_khr_image2d_from_buffer"
+
+
+#define CL_KHR_IMAGE2D_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR 0x104A
+#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR 0x104B
+
+/***************************************************************
+* cl_khr_initialize_memory
+***************************************************************/
+#define cl_khr_initialize_memory 1
+#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_NAME \
+ "cl_khr_initialize_memory"
+
+
+#define CL_KHR_INITIALIZE_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_context_memory_initialize_khr;
+
+/* cl_context_properties */
+#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x2030
+
+/* cl_context_memory_initialize_khr */
+#define CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR (1 << 0)
+#define CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR (1 << 1)
+
+/***************************************************************
+* cl_khr_terminate_context
+***************************************************************/
+#define cl_khr_terminate_context 1
+#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_NAME \
+ "cl_khr_terminate_context"
+
+
+#define CL_KHR_TERMINATE_CONTEXT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_device_terminate_capability_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x2031
+
+/* cl_context_properties */
+#define CL_CONTEXT_TERMINATE_KHR 0x2032
+
+/* cl_device_terminate_capability_khr */
+#define CL_DEVICE_TERMINATE_CAPABILITY_CONTEXT_KHR (1 << 0)
+
+/* Error codes */
+#define CL_CONTEXT_TERMINATED_KHR -1121
+
+
+typedef cl_int CL_API_CALL
+clTerminateContextKHR_t(
+ cl_context context);
+
+typedef clTerminateContextKHR_t *
+clTerminateContextKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clTerminateContextKHR(
+ cl_context context) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_spir
+***************************************************************/
+#define cl_khr_spir 1
+#define CL_KHR_SPIR_EXTENSION_NAME \
+ "cl_khr_spir"
+
+
+#define CL_KHR_SPIR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SPIR_VERSIONS 0x40E0
+
+/* cl_program_binary_type */
+#define CL_PROGRAM_BINARY_TYPE_INTERMEDIATE 0x40E1
+
+/***************************************************************
+* cl_khr_create_command_queue
+***************************************************************/
+#define cl_khr_create_command_queue 1
+#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_NAME \
+ "cl_khr_create_command_queue"
+
+
+#define CL_KHR_CREATE_COMMAND_QUEUE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_properties cl_queue_properties_khr;
+
+
+typedef cl_command_queue CL_API_CALL
+clCreateCommandQueueWithPropertiesKHR_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_queue_properties_khr* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandQueueWithPropertiesKHR_t *
+clCreateCommandQueueWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_command_queue CL_API_CALL
+clCreateCommandQueueWithPropertiesKHR(
+ cl_context context,
+ cl_device_id device,
+ const cl_queue_properties_khr* properties,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_nv_device_attribute_query
+***************************************************************/
+#define cl_nv_device_attribute_query 1
+#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_nv_device_attribute_query"
+
+
+#define CL_NV_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
+#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
+#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
+#define CL_DEVICE_WARP_SIZE_NV 0x4003
+#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
+#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
+#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
+
+/***************************************************************
+* cl_amd_device_attribute_query
+***************************************************************/
+#define cl_amd_device_attribute_query 1
+#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_amd_device_attribute_query"
+
+
+#define CL_AMD_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
+#define CL_DEVICE_TOPOLOGY_AMD 0x4037
+#define CL_DEVICE_BOARD_NAME_AMD 0x4038
+#define CL_DEVICE_GLOBAL_FREE_MEMORY_AMD 0x4039
+#define CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD 0x4040
+#define CL_DEVICE_SIMD_WIDTH_AMD 0x4041
+#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042
+#define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
+#define CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD 0x4044
+#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD 0x4045
+#define CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD 0x4046
+#define CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD 0x4047
+#define CL_DEVICE_LOCAL_MEM_BANKS_AMD 0x4048
+#define CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD 0x4049
+#define CL_DEVICE_GFXIP_MAJOR_AMD 0x404A
+#define CL_DEVICE_GFXIP_MINOR_AMD 0x404B
+#define CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD 0x404C
+#define CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD 0x4030
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD 0x4031
+#define CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD 0x4033
+#define CL_DEVICE_PCIE_ID_AMD 0x4034
+
+/***************************************************************
+* cl_arm_printf
+***************************************************************/
+#define cl_arm_printf 1
+#define CL_ARM_PRINTF_EXTENSION_NAME \
+ "cl_arm_printf"
+
+
+#define CL_ARM_PRINTF_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_context_properties */
+#define CL_PRINTF_CALLBACK_ARM 0x40B0
+#define CL_PRINTF_BUFFERSIZE_ARM 0x40B1
+
+/***************************************************************
+* cl_ext_device_fission
+***************************************************************/
+#define cl_ext_device_fission 1
+#define CL_EXT_DEVICE_FISSION_EXTENSION_NAME \
+ "cl_ext_device_fission"
+
+
+#define CL_EXT_DEVICE_FISSION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_ulong cl_device_partition_property_ext;
+
+/* Error codes */
+#define CL_DEVICE_PARTITION_FAILED_EXT -1057
+#define CL_INVALID_PARTITION_COUNT_EXT -1058
+#define CL_INVALID_PARTITION_NAME_EXT -1059
+
+/* cl_device_info */
+#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
+#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
+#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
+#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
+#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
+
+/* cl_device_partition_property_ext */
+#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
+#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
+#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
+#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
+
+/* cl_device_partition_property_ext - affinity domains */
+#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
+#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
+#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
+#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
+#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
+#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
+
+/* cl_device_partition_property_ext - list terminators */
+#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext)0)
+#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext)0)
+#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext)0 - 1)
+
+
+typedef cl_int CL_API_CALL
+clReleaseDeviceEXT_t(
+ cl_device_id device);
+
+typedef clReleaseDeviceEXT_t *
+clReleaseDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clRetainDeviceEXT_t(
+ cl_device_id device);
+
+typedef clRetainDeviceEXT_t *
+clRetainDeviceEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL
+clCreateSubDevicesEXT_t(
+ cl_device_id in_device,
+ const cl_device_partition_property_ext* properties,
+ cl_uint num_entries,
+ cl_device_id* out_devices,
+ cl_uint* num_devices);
+
+typedef clCreateSubDevicesEXT_t *
+clCreateSubDevicesEXT_fn CL_API_SUFFIX__VERSION_1_1;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseDeviceEXT(
+ cl_device_id device) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainDeviceEXT(
+ cl_device_id device) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateSubDevicesEXT(
+ cl_device_id in_device,
+ const cl_device_partition_property_ext* properties,
+ cl_uint num_entries,
+ cl_device_id* out_devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_migrate_memobject
+***************************************************************/
+#define cl_ext_migrate_memobject 1
+#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_NAME \
+ "cl_ext_migrate_memobject"
+
+
+#define CL_EXT_MIGRATE_MEMOBJECT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_mem_migration_flags_ext;
+
+/* cl_mem_migration_flags_ext */
+#define CL_MIGRATE_MEM_OBJECT_HOST_EXT (1 << 0)
+
+/* cl_command_type */
+#define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040
+
+
+typedef cl_int CL_API_CALL
+clEnqueueMigrateMemObjectEXT_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_mem_migration_flags_ext flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMigrateMemObjectEXT_t *
+clEnqueueMigrateMemObjectEXT_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMigrateMemObjectEXT(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_mem_migration_flags_ext flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_cxx_for_opencl
+***************************************************************/
+#define cl_ext_cxx_for_opencl 1
+#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_NAME \
+ "cl_ext_cxx_for_opencl"
+
+
+#define CL_EXT_CXX_FOR_OPENCL_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT 0x4230
+
+/***************************************************************
+* cl_qcom_ext_host_ptr
+***************************************************************/
+#define cl_qcom_ext_host_ptr 1
+#define CL_QCOM_EXT_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_ext_host_ptr"
+
+
+#define CL_QCOM_EXT_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_image_pitch_info_qcom;
+typedef struct _cl_mem_ext_host_ptr {
+ cl_uint allocation_type;
+ cl_uint host_cache_policy;
+} cl_mem_ext_host_ptr;
+
+/* cl_mem_flags */
+#define CL_MEM_EXT_HOST_PTR_QCOM (1 << 29)
+
+/* cl_device_info */
+#define CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM 0x40A0
+#define CL_DEVICE_PAGE_SIZE_QCOM 0x40A1
+
+/* cl_image_pitch_info_qcom */
+#define CL_IMAGE_ROW_ALIGNMENT_QCOM 0x40A2
+#define CL_IMAGE_SLICE_ALIGNMENT_QCOM 0x40A3
+
+/* cl_uint host_cache_policy */
+#define CL_MEM_HOST_UNCACHED_QCOM 0x40A4
+#define CL_MEM_HOST_WRITEBACK_QCOM 0x40A5
+#define CL_MEM_HOST_WRITETHROUGH_QCOM 0x40A6
+#define CL_MEM_HOST_WRITE_COMBINING_QCOM 0x40A7
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceImageInfoQCOM_t(
+ cl_device_id device,
+ size_t image_width,
+ size_t image_height,
+ const cl_image_format* image_format,
+ cl_image_pitch_info_qcom param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetDeviceImageInfoQCOM_t *
+clGetDeviceImageInfoQCOM_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceImageInfoQCOM(
+ cl_device_id device,
+ size_t image_width,
+ size_t image_height,
+ const cl_image_format* image_format,
+ cl_image_pitch_info_qcom param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_qcom_ext_host_ptr_iocoherent
+***************************************************************/
+#define cl_qcom_ext_host_ptr_iocoherent 1
+#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_NAME \
+ "cl_qcom_ext_host_ptr_iocoherent"
+
+
+#define CL_QCOM_EXT_HOST_PTR_IOCOHERENT_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_uint host_cache_policy */
+#define CL_MEM_HOST_IOCOHERENT_QCOM 0x40A9
+
+/***************************************************************
+* cl_qcom_ion_host_ptr
+***************************************************************/
+#define cl_qcom_ion_host_ptr 1
+#define CL_QCOM_ION_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_ion_host_ptr"
+
+
+#define CL_QCOM_ION_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_ext_host_ptr */
+typedef struct _cl_mem_ion_host_ptr {
+ cl_mem_ext_host_ptr ext_host_ptr;
+ int ion_filedesc;
+ void* ion_hostptr;
+} cl_mem_ion_host_ptr;
+
+/* cl_uint allocation_type */
+#define CL_MEM_ION_HOST_PTR_QCOM 0x40A8
+
+/***************************************************************
+* cl_qcom_android_native_buffer_host_ptr
+***************************************************************/
+#define cl_qcom_android_native_buffer_host_ptr 1
+#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_NAME \
+ "cl_qcom_android_native_buffer_host_ptr"
+
+
+#define CL_QCOM_ANDROID_NATIVE_BUFFER_HOST_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_ext_host_ptr */
+typedef struct _cl_mem_android_native_buffer_host_ptr {
+ cl_mem_ext_host_ptr ext_host_ptr;
+ void* anb_ptr;
+} cl_mem_android_native_buffer_host_ptr;
+
+/* cl_uint allocation_type */
+#define CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM 0x40C6
+
+/***************************************************************
+* cl_img_yuv_image
+***************************************************************/
+#define cl_img_yuv_image 1
+#define CL_IMG_YUV_IMAGE_EXTENSION_NAME \
+ "cl_img_yuv_image"
+
+
+#define CL_IMG_YUV_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_NV21_IMG 0x40D0
+#define CL_YV12_IMG 0x40D1
+
+/***************************************************************
+* cl_img_cached_allocations
+***************************************************************/
+#define cl_img_cached_allocations 1
+#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_NAME \
+ "cl_img_cached_allocations"
+
+
+#define CL_IMG_CACHED_ALLOCATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_flags */
+#define CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG (1 << 26)
+#define CL_MEM_USE_CACHED_CPU_MEMORY_IMG (1 << 27)
+
+/***************************************************************
+* cl_img_use_gralloc_ptr
+***************************************************************/
+#define cl_img_use_gralloc_ptr 1
+#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_NAME \
+ "cl_img_use_gralloc_ptr"
+
+
+#define CL_IMG_USE_GRALLOC_PTR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Error codes */
+#define CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG 0x40D4
+#define CL_INVALID_GRALLOC_OBJECT_IMG 0x40D5
+
+/* cl_mem_flags */
+#define CL_MEM_USE_GRALLOC_PTR_IMG (1 << 28)
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG 0x40D2
+#define CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG 0x40D3
+
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireGrallocObjectsIMG_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireGrallocObjectsIMG_t *
+clEnqueueAcquireGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseGrallocObjectsIMG_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseGrallocObjectsIMG_t *
+clEnqueueReleaseGrallocObjectsIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGrallocObjectsIMG(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGrallocObjectsIMG(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_img_generate_mipmap
+***************************************************************/
+#define cl_img_generate_mipmap 1
+#define CL_IMG_GENERATE_MIPMAP_EXTENSION_NAME \
+ "cl_img_generate_mipmap"
+
+
+#define CL_IMG_GENERATE_MIPMAP_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_mipmap_filter_mode_img;
+
+/* cl_mipmap_filter_mode_img */
+#define CL_MIPMAP_FILTER_ANY_IMG 0x0
+#define CL_MIPMAP_FILTER_BOX_IMG 0x1
+
+/* cl_command_type */
+#define CL_COMMAND_GENERATE_MIPMAP_IMG 0x40D6
+
+
+typedef cl_int CL_API_CALL
+clEnqueueGenerateMipmapIMG_t(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ cl_mipmap_filter_mode_img mipmap_filter_mode,
+ const size_t* array_region,
+ const size_t* mip_region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueGenerateMipmapIMG_t *
+clEnqueueGenerateMipmapIMG_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueGenerateMipmapIMG(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ cl_mipmap_filter_mode_img mipmap_filter_mode,
+ const size_t* array_region,
+ const size_t* mip_region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_img_mem_properties
+***************************************************************/
+#define cl_img_mem_properties 1
+#define CL_IMG_MEM_PROPERTIES_EXTENSION_NAME \
+ "cl_img_mem_properties"
+
+
+#define CL_IMG_MEM_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties */
+#define CL_MEM_ALLOC_FLAGS_IMG 0x40D7
+
+/* cl_mem_alloc_flags_img */
+#define CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG (1 << 0)
+#define CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG (1 << 1)
+#define CL_MEM_ALLOC_GPU_CACHED_IMG (1 << 2)
+#define CL_MEM_ALLOC_CPU_LOCAL_IMG (1 << 3)
+#define CL_MEM_ALLOC_GPU_LOCAL_IMG (1 << 4)
+#define CL_MEM_ALLOC_GPU_PRIVATE_IMG (1 << 5)
+
+/* cl_device_info */
+#define CL_DEVICE_MEMORY_CAPABILITIES_IMG 0x40D8
+
+/***************************************************************
+* cl_khr_subgroups
+***************************************************************/
+#define cl_khr_subgroups 1
+#define CL_KHR_SUBGROUPS_EXTENSION_NAME \
+ "cl_khr_subgroups"
+
+
+#define CL_KHR_SUBGROUPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_2_1)
+/* defined in CL.h for OpenCL 2.1 and newer */
+typedef cl_uint cl_kernel_sub_group_info;
+
+#endif /* !defined(CL_VERSION_2_1) */
+
+/* cl_kernel_sub_group_info */
+#define CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR 0x2033
+#define CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR 0x2034
+
+
+typedef cl_int CL_API_CALL
+clGetKernelSubGroupInfoKHR_t(
+ cl_kernel in_kernel,
+ cl_device_id in_device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelSubGroupInfoKHR_t *
+clGetKernelSubGroupInfoKHR_fn CL_API_SUFFIX__VERSION_2_0_DEPRECATED;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelSubGroupInfoKHR(
+ cl_kernel in_kernel,
+ cl_device_id in_device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_2_0_DEPRECATED;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_mipmap_image
+***************************************************************/
+#define cl_khr_mipmap_image 1
+#define CL_KHR_MIPMAP_IMAGE_EXTENSION_NAME \
+ "cl_khr_mipmap_image"
+
+
+#define CL_KHR_MIPMAP_IMAGE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_sampler_properties */
+#define CL_SAMPLER_MIP_FILTER_MODE_KHR 0x1155
+#define CL_SAMPLER_LOD_MIN_KHR 0x1156
+#define CL_SAMPLER_LOD_MAX_KHR 0x1157
+
+/***************************************************************
+* cl_khr_priority_hints
+***************************************************************/
+#define cl_khr_priority_hints 1
+#define CL_KHR_PRIORITY_HINTS_EXTENSION_NAME \
+ "cl_khr_priority_hints"
+
+
+#define CL_KHR_PRIORITY_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* To be used by clGetEventInfo */
+typedef cl_uint cl_queue_priority_khr;
+
+/* cl_queue_properties */
+#define CL_QUEUE_PRIORITY_KHR 0x1096
+
+/* cl_queue_priority_khr */
+#define CL_QUEUE_PRIORITY_HIGH_KHR (1 << 0)
+#define CL_QUEUE_PRIORITY_MED_KHR (1 << 1)
+#define CL_QUEUE_PRIORITY_LOW_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_throttle_hints
+***************************************************************/
+#define cl_khr_throttle_hints 1
+#define CL_KHR_THROTTLE_HINTS_EXTENSION_NAME \
+ "cl_khr_throttle_hints"
+
+
+#define CL_KHR_THROTTLE_HINTS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* To be used by clGetEventInfo */
+typedef cl_uint cl_queue_throttle_khr;
+
+/* cl_queue_properties */
+#define CL_QUEUE_THROTTLE_KHR 0x1097
+
+/* cl_queue_throttle_khr */
+#define CL_QUEUE_THROTTLE_HIGH_KHR (1 << 0)
+#define CL_QUEUE_THROTTLE_MED_KHR (1 << 1)
+#define CL_QUEUE_THROTTLE_LOW_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_subgroup_named_barrier
+***************************************************************/
+#define cl_khr_subgroup_named_barrier 1
+#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_NAME \
+ "cl_khr_subgroup_named_barrier"
+
+
+#define CL_KHR_SUBGROUP_NAMED_BARRIER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR 0x2035
+
+/***************************************************************
+* cl_khr_extended_versioning
+***************************************************************/
+#define cl_khr_extended_versioning 1
+#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_NAME \
+ "cl_khr_extended_versioning"
+
+
+#define CL_KHR_EXTENDED_VERSIONING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#define CL_VERSION_MAJOR_BITS_KHR 10
+#define CL_VERSION_MINOR_BITS_KHR 10
+#define CL_VERSION_PATCH_BITS_KHR 12
+
+#define CL_VERSION_MAJOR_MASK_KHR ((1 << CL_VERSION_MAJOR_BITS_KHR) - 1)
+#define CL_VERSION_MINOR_MASK_KHR ((1 << CL_VERSION_MINOR_BITS_KHR) - 1)
+#define CL_VERSION_PATCH_MASK_KHR ((1 << CL_VERSION_PATCH_BITS_KHR) - 1)
+
+#define CL_VERSION_MAJOR_KHR(version) ((version) >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR))
+#define CL_VERSION_MINOR_KHR(version) (((version) >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR)
+#define CL_VERSION_PATCH_KHR(version) ((version) & CL_VERSION_PATCH_MASK_KHR)
+
+#define CL_MAKE_VERSION_KHR(major, minor, patch) \
+ ((((major) & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)) | \
+ (((minor) & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR) | \
+ ((patch) & CL_VERSION_PATCH_MASK_KHR))
+
+#define CL_NAME_VERSION_MAX_NAME_SIZE_KHR 64
+
+typedef cl_uint cl_version_khr;
+typedef struct _cl_name_version_khr {
+ cl_version_khr version;
+ char name[CL_NAME_VERSION_MAX_NAME_SIZE_KHR];
+} cl_name_version_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_NUMERIC_VERSION_KHR 0x0906
+#define CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR 0x0907
+
+/* cl_device_info */
+#define CL_DEVICE_NUMERIC_VERSION_KHR 0x105E
+#define CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR 0x105F
+#define CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR 0x1060
+#define CL_DEVICE_ILS_WITH_VERSION_KHR 0x1061
+#define CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR 0x1062
+
+/***************************************************************
+* cl_khr_device_uuid
+***************************************************************/
+#define cl_khr_device_uuid 1
+#define CL_KHR_DEVICE_UUID_EXTENSION_NAME \
+ "cl_khr_device_uuid"
+
+
+#define CL_KHR_DEVICE_UUID_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* Size Constants */
+#define CL_UUID_SIZE_KHR 16
+#define CL_LUID_SIZE_KHR 8
+
+/* cl_device_info */
+#define CL_DEVICE_UUID_KHR 0x106A
+#define CL_DRIVER_UUID_KHR 0x106B
+#define CL_DEVICE_LUID_VALID_KHR 0x106C
+#define CL_DEVICE_LUID_KHR 0x106D
+#define CL_DEVICE_NODE_MASK_KHR 0x106E
+
+/***************************************************************
+* cl_khr_pci_bus_info
+***************************************************************/
+#define cl_khr_pci_bus_info 1
+#define CL_KHR_PCI_BUS_INFO_EXTENSION_NAME \
+ "cl_khr_pci_bus_info"
+
+
+#define CL_KHR_PCI_BUS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef struct _cl_device_pci_bus_info_khr {
+ cl_uint pci_domain;
+ cl_uint pci_bus;
+ cl_uint pci_device;
+ cl_uint pci_function;
+} cl_device_pci_bus_info_khr;
+
+/* cl_device_info */
+#define CL_DEVICE_PCI_BUS_INFO_KHR 0x410F
+
+/***************************************************************
+* cl_khr_suggested_local_work_size
+***************************************************************/
+#define cl_khr_suggested_local_work_size 1
+#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_NAME \
+ "cl_khr_suggested_local_work_size"
+
+
+#define CL_KHR_SUGGESTED_LOCAL_WORK_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clGetKernelSuggestedLocalWorkSizeKHR_t(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ size_t* suggested_local_work_size);
+
+typedef clGetKernelSuggestedLocalWorkSizeKHR_t *
+clGetKernelSuggestedLocalWorkSizeKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelSuggestedLocalWorkSizeKHR(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ size_t* suggested_local_work_size) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_integer_dot_product
+***************************************************************/
+#define cl_khr_integer_dot_product 1
+#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_NAME \
+ "cl_khr_integer_dot_product"
+
+
+#define CL_KHR_INTEGER_DOT_PRODUCT_EXTENSION_VERSION CL_MAKE_VERSION(2, 0, 0)
+
+typedef cl_bitfield cl_device_integer_dot_product_capabilities_khr;
+typedef struct _cl_device_integer_dot_product_acceleration_properties_khr {
+ cl_bool signed_accelerated;
+ cl_bool unsigned_accelerated;
+ cl_bool mixed_signedness_accelerated;
+ cl_bool accumulating_saturating_signed_accelerated;
+ cl_bool accumulating_saturating_unsigned_accelerated;
+ cl_bool accumulating_saturating_mixed_signedness_accelerated;
+} cl_device_integer_dot_product_acceleration_properties_khr;
+
+/* cl_device_integer_dot_product_capabilities_khr */
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR (1 << 0)
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR (1 << 1)
+
+/* cl_device_info */
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR 0x1073
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR 0x1074
+#define CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR 0x1075
+
+/***************************************************************
+* cl_khr_external_memory
+***************************************************************/
+#define cl_khr_external_memory 1
+#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_NAME \
+ "cl_khr_external_memory"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1)
+
+typedef cl_uint cl_external_memory_handle_type_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x2044
+
+/* cl_device_info */
+#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR 0x204F
+#define CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR 0x2052
+
+/* cl_mem_properties */
+#define CL_MEM_DEVICE_HANDLE_LIST_KHR 0x2051
+#define CL_MEM_DEVICE_HANDLE_LIST_END_KHR 0
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR 0x2047
+#define CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR 0x2048
+
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireExternalMemObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireExternalMemObjectsKHR_t *
+clEnqueueAcquireExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseExternalMemObjectsKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseExternalMemObjectsKHR_t *
+clEnqueueReleaseExternalMemObjectsKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireExternalMemObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_3_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseExternalMemObjectsKHR(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_memory_dma_buf
+***************************************************************/
+#define cl_khr_external_memory_dma_buf 1
+#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME \
+ "cl_khr_external_memory_dma_buf"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR 0x2067
+
+/***************************************************************
+* cl_khr_external_memory_opaque_fd
+***************************************************************/
+#define cl_khr_external_memory_opaque_fd 1
+#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_NAME \
+ "cl_khr_external_memory_opaque_fd"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR 0x2060
+
+/***************************************************************
+* cl_khr_external_memory_win32
+***************************************************************/
+#define cl_khr_external_memory_win32 1
+#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME \
+ "cl_khr_external_memory_win32"
+
+
+#define CL_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(1, 1, 0)
+
+/* cl_external_memory_handle_type_khr */
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR 0x2061
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2062
+#define CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2069
+
+/***************************************************************
+* cl_khr_external_semaphore
+***************************************************************/
+#define cl_khr_external_semaphore 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME \
+ "cl_khr_external_semaphore"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 1)
+
+typedef struct _cl_semaphore_khr * cl_semaphore_khr;
+typedef cl_uint cl_external_semaphore_handle_type_khr;
+
+/* cl_platform_info */
+#define CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x2037
+#define CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x2038
+
+/* cl_device_info */
+#define CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR 0x204D
+#define CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x204E
+
+/* cl_semaphore_properties_khr */
+#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR 0x203F
+#define CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR 0
+
+/* cl_semaphore_info_khr */
+#define CL_SEMAPHORE_EXPORTABLE_KHR 0x2054
+
+
+typedef cl_int CL_API_CALL
+clGetSemaphoreHandleForTypeKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_device_id device,
+ cl_external_semaphore_handle_type_khr handle_type,
+ size_t handle_size,
+ void* handle_ptr,
+ size_t* handle_size_ret);
+
+typedef clGetSemaphoreHandleForTypeKHR_t *
+clGetSemaphoreHandleForTypeKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSemaphoreHandleForTypeKHR(
+ cl_semaphore_khr sema_object,
+ cl_device_id device,
+ cl_external_semaphore_handle_type_khr handle_type,
+ size_t handle_size,
+ void* handle_ptr,
+ size_t* handle_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_semaphore_opaque_fd
+***************************************************************/
+#define cl_khr_external_semaphore_opaque_fd 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_NAME \
+ "cl_khr_external_semaphore_opaque_fd"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR 0x2055
+
+/***************************************************************
+* cl_khr_external_semaphore_sync_fd
+***************************************************************/
+#define cl_khr_external_semaphore_sync_fd 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_NAME \
+ "cl_khr_external_semaphore_sync_fd"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_SYNC_FD_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_properties cl_semaphore_reimport_properties_khr;
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_SYNC_FD_KHR 0x2058
+
+
+typedef cl_int CL_API_CALL
+clReImportSemaphoreSyncFdKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_reimport_properties_khr* reimport_props,
+ int fd);
+
+typedef clReImportSemaphoreSyncFdKHR_t *
+clReImportSemaphoreSyncFdKHR_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReImportSemaphoreSyncFdKHR(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_reimport_properties_khr* reimport_props,
+ int fd) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_external_semaphore_win32
+***************************************************************/
+#define cl_khr_external_semaphore_win32 1
+#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME \
+ "cl_khr_external_semaphore_win32"
+
+
+#define CL_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 1)
+
+/* cl_external_semaphore_handle_type_khr */
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR 0x2056
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR 0x2057
+#define CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR 0x2068
+
+/***************************************************************
+* cl_khr_semaphore
+***************************************************************/
+#define cl_khr_semaphore 1
+#define CL_KHR_SEMAPHORE_EXTENSION_NAME \
+ "cl_khr_semaphore"
+
+
+#define CL_KHR_SEMAPHORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* type cl_semaphore_khr */
+typedef cl_properties cl_semaphore_properties_khr;
+typedef cl_uint cl_semaphore_info_khr;
+typedef cl_uint cl_semaphore_type_khr;
+typedef cl_ulong cl_semaphore_payload_khr;
+
+/* cl_semaphore_type */
+#define CL_SEMAPHORE_TYPE_BINARY_KHR 1
+
+/* cl_platform_info */
+#define CL_PLATFORM_SEMAPHORE_TYPES_KHR 0x2036
+
+/* cl_device_info */
+#define CL_DEVICE_SEMAPHORE_TYPES_KHR 0x204C
+
+/* cl_semaphore_info_khr */
+#define CL_SEMAPHORE_CONTEXT_KHR 0x2039
+#define CL_SEMAPHORE_REFERENCE_COUNT_KHR 0x203A
+#define CL_SEMAPHORE_PROPERTIES_KHR 0x203B
+#define CL_SEMAPHORE_PAYLOAD_KHR 0x203C
+
+/* cl_semaphore_info_khr or cl_semaphore_properties_khr */
+#define CL_SEMAPHORE_TYPE_KHR 0x203D
+#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR 0x2053
+#define CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR 0
+
+/* cl_command_type */
+#define CL_COMMAND_SEMAPHORE_WAIT_KHR 0x2042
+#define CL_COMMAND_SEMAPHORE_SIGNAL_KHR 0x2043
+
+/* Error codes */
+#define CL_INVALID_SEMAPHORE_KHR -1142
+
+
+typedef cl_semaphore_khr CL_API_CALL
+clCreateSemaphoreWithPropertiesKHR_t(
+ cl_context context,
+ const cl_semaphore_properties_khr* sema_props,
+ cl_int* errcode_ret);
+
+typedef clCreateSemaphoreWithPropertiesKHR_t *
+clCreateSemaphoreWithPropertiesKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueWaitSemaphoresKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWaitSemaphoresKHR_t *
+clEnqueueWaitSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSignalSemaphoresKHR_t(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSignalSemaphoresKHR_t *
+clEnqueueSignalSemaphoresKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clGetSemaphoreInfoKHR_t(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetSemaphoreInfoKHR_t *
+clGetSemaphoreInfoKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clReleaseSemaphoreKHR_t(
+ cl_semaphore_khr sema_object);
+
+typedef clReleaseSemaphoreKHR_t *
+clReleaseSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clRetainSemaphoreKHR_t(
+ cl_semaphore_khr sema_object);
+
+typedef clRetainSemaphoreKHR_t *
+clRetainSemaphoreKHR_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_semaphore_khr CL_API_CALL
+clCreateSemaphoreWithPropertiesKHR(
+ cl_context context,
+ const cl_semaphore_properties_khr* sema_props,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWaitSemaphoresKHR(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSignalSemaphoresKHR(
+ cl_command_queue command_queue,
+ cl_uint num_sema_objects,
+ const cl_semaphore_khr* sema_objects,
+ const cl_semaphore_payload_khr* sema_payload_list,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSemaphoreInfoKHR(
+ cl_semaphore_khr sema_object,
+ cl_semaphore_info_khr param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseSemaphoreKHR(
+ cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainSemaphoreKHR(
+ cl_semaphore_khr sema_object) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_import_memory
+***************************************************************/
+#define cl_arm_import_memory 1
+#define CL_ARM_IMPORT_MEMORY_EXTENSION_NAME \
+ "cl_arm_import_memory"
+
+
+#define CL_ARM_IMPORT_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef intptr_t cl_import_properties_arm;
+
+/* cl_import_properties_arm */
+#define CL_IMPORT_TYPE_ARM 0x40B2
+#define CL_IMPORT_TYPE_HOST_ARM 0x40B3
+#define CL_IMPORT_TYPE_DMA_BUF_ARM 0x40B4
+#define CL_IMPORT_TYPE_PROTECTED_ARM 0x40B5
+#define CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM 0x41E2
+#define CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM 0x41E3
+#define CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM SIZE_MAX
+#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM 0x41EF
+#define CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM 0x41F0
+
+
+typedef cl_mem CL_API_CALL
+clImportMemoryARM_t(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_import_properties_arm* properties,
+ void* memory,
+ size_t size,
+ cl_int* errcode_ret);
+
+typedef clImportMemoryARM_t *
+clImportMemoryARM_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clImportMemoryARM(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_import_properties_arm* properties,
+ void* memory,
+ size_t size,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_shared_virtual_memory
+***************************************************************/
+#define cl_arm_shared_virtual_memory 1
+#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_NAME \
+ "cl_arm_shared_virtual_memory"
+
+
+#define CL_ARM_SHARED_VIRTUAL_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_svm_mem_flags_arm;
+typedef cl_uint cl_kernel_exec_info_arm;
+typedef cl_bitfield cl_device_svm_capabilities_arm;
+
+/* cl_device_info */
+#define CL_DEVICE_SVM_CAPABILITIES_ARM 0x40B6
+
+/* cl_mem_info */
+#define CL_MEM_USES_SVM_POINTER_ARM 0x40B7
+
+/* cl_kernel_exec_info_arm */
+#define CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM 0x40B8
+#define CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM 0x40B9
+
+/* cl_command_type */
+#define CL_COMMAND_SVM_FREE_ARM 0x40BA
+#define CL_COMMAND_SVM_MEMCPY_ARM 0x40BB
+#define CL_COMMAND_SVM_MEMFILL_ARM 0x40BC
+#define CL_COMMAND_SVM_MAP_ARM 0x40BD
+#define CL_COMMAND_SVM_UNMAP_ARM 0x40BE
+
+/* cl_device_svm_capabilities_arm */
+#define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM (1 << 0)
+#define CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM (1 << 1)
+#define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM (1 << 2)
+#define CL_DEVICE_SVM_ATOMICS_ARM (1 << 3)
+
+/* cl_svm_mem_flags_arm */
+#define CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM (1 << 10)
+#define CL_MEM_SVM_ATOMICS_ARM (1 << 11)
+
+
+typedef void* CL_API_CALL
+clSVMAllocARM_t(
+ cl_context context,
+ cl_svm_mem_flags_arm flags,
+ size_t size,
+ cl_uint alignment);
+
+typedef clSVMAllocARM_t *
+clSVMAllocARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef void CL_API_CALL
+clSVMFreeARM_t(
+ cl_context context,
+ void* svm_pointer);
+
+typedef clSVMFreeARM_t *
+clSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMFreeARM_t(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void* svm_pointers[],
+ void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void * svm_pointers[], void *user_data),
+ void* user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMFreeARM_t *
+clEnqueueSVMFreeARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMemcpyARM_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemcpyARM_t *
+clEnqueueSVMMemcpyARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMemFillARM_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemFillARM_t *
+clEnqueueSVMMemFillARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMMapARM_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void* svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMapARM_t *
+clEnqueueSVMMapARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueSVMUnmapARM_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMUnmapARM_t *
+clEnqueueSVMUnmapARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clSetKernelArgSVMPointerARM_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value);
+
+typedef clSetKernelArgSVMPointerARM_t *
+clSetKernelArgSVMPointerARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clSetKernelExecInfoARM_t(
+ cl_kernel kernel,
+ cl_kernel_exec_info_arm param_name,
+ size_t param_value_size,
+ const void* param_value);
+
+typedef clSetKernelExecInfoARM_t *
+clSetKernelExecInfoARM_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void* CL_API_CALL
+clSVMAllocARM(
+ cl_context context,
+ cl_svm_mem_flags_arm flags,
+ size_t size,
+ cl_uint alignment) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY void CL_API_CALL
+clSVMFreeARM(
+ cl_context context,
+ void* svm_pointer) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMFreeARM(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void* svm_pointers[],
+ void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void * svm_pointers[], void *user_data),
+ void* user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemcpyARM(
+ cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMemFillARM(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMMapARM(
+ cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void* svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueSVMUnmapARM(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArgSVMPointerARM(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelExecInfoARM(
+ cl_kernel kernel,
+ cl_kernel_exec_info_arm param_name,
+ size_t param_value_size,
+ const void* param_value) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_arm_get_core_id
+***************************************************************/
+#if defined(CL_VERSION_1_2)
+
+#define cl_arm_get_core_id 1
+#define CL_ARM_GET_CORE_ID_EXTENSION_NAME \
+ "cl_arm_get_core_id"
+
+
+#define CL_ARM_GET_CORE_ID_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM 0x40BF
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/***************************************************************
+* cl_arm_job_slot_selection
+***************************************************************/
+#define cl_arm_job_slot_selection 1
+#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_NAME \
+ "cl_arm_job_slot_selection"
+
+
+#define CL_ARM_JOB_SLOT_SELECTION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_JOB_SLOTS_ARM 0x41E0
+
+/* cl_queue_properties */
+#define CL_QUEUE_JOB_SLOT_ARM 0x41E1
+
+/***************************************************************
+* cl_arm_scheduling_controls
+***************************************************************/
+#define cl_arm_scheduling_controls 1
+#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_NAME \
+ "cl_arm_scheduling_controls"
+
+
+#define CL_ARM_SCHEDULING_CONTROLS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Types */
+typedef cl_bitfield cl_device_scheduling_controls_capabilities_arm;
+
+/* cl_device_scheduling_controls_capabilities_arm */
+#define CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM (1 << 0)
+#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM (1 << 1)
+#define CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM (1 << 2)
+#define CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM (1 << 3)
+#define CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM (1 << 4)
+#define CL_DEVICE_SCHEDULING_WARP_THROTTLING_ARM (1 << 5)
+#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_BATCH_QUEUE_SIZE_ARM (1 << 6)
+#define CL_DEVICE_SCHEDULING_COMPUTE_UNIT_LIMIT_ARM (1 << 7)
+
+/* cl_device_info */
+#define CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM 0x41E4
+#define CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM 0x41EB
+#define CL_DEVICE_MAX_WARP_COUNT_ARM 0x41EA
+
+/* cl_kernel_exec_info */
+#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM 0x41E5
+#define CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM 0x41E6
+#define CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM 0x41E8
+#define CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM 0x41F1
+
+/* cl_kernel_info */
+#define CL_KERNEL_MAX_WARP_COUNT_ARM 0x41E9
+
+/* cl_queue_properties */
+#define CL_QUEUE_KERNEL_BATCHING_ARM 0x41E7
+#define CL_QUEUE_DEFERRED_FLUSH_ARM 0x41EC
+#define CL_QUEUE_COMPUTE_UNIT_LIMIT_ARM 0x41F3
+
+/***************************************************************
+* cl_arm_controlled_kernel_termination
+***************************************************************/
+#define cl_arm_controlled_kernel_termination 1
+#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_NAME \
+ "cl_arm_controlled_kernel_termination"
+
+
+#define CL_ARM_CONTROLLED_KERNEL_TERMINATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Types */
+typedef cl_bitfield cl_device_controlled_termination_capabilities_arm;
+
+/* Error codes */
+#define CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM -1108
+
+/* cl_device_controlled_termination_capabilities_arm */
+#define CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM (1 << 0)
+#define CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM (1 << 1)
+#define CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM (1 << 2)
+
+/* cl_device_info */
+#define CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM 0x41EE
+
+/* cl_event_info */
+#define CL_EVENT_COMMAND_TERMINATION_REASON_ARM 0x41ED
+
+/* cl_command_termination_reason_arm */
+#define CL_COMMAND_TERMINATION_COMPLETION_ARM 0
+#define CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM 1
+#define CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM 2
+#define CL_COMMAND_TERMINATION_ERROR_ARM 3
+
+/***************************************************************
+* cl_arm_protected_memory_allocation
+***************************************************************/
+#define cl_arm_protected_memory_allocation 1
+#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_NAME \
+ "cl_arm_protected_memory_allocation"
+
+
+#define CL_ARM_PROTECTED_MEMORY_ALLOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+#define CL_MEM_PROTECTED_ALLOC_ARM ((cl_bitfield)1 << 36)
+
+/***************************************************************
+* cl_intel_exec_by_local_thread
+***************************************************************/
+#define cl_intel_exec_by_local_thread 1
+#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_NAME \
+ "cl_intel_exec_by_local_thread"
+
+
+#define CL_INTEL_EXEC_BY_LOCAL_THREAD_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_command_queue_properties - bitfield */
+#define CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL ((cl_bitfield)1 << 31)
+
+/***************************************************************
+* cl_intel_device_attribute_query
+***************************************************************/
+#define cl_intel_device_attribute_query 1
+#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_NAME \
+ "cl_intel_device_attribute_query"
+
+
+#define CL_INTEL_DEVICE_ATTRIBUTE_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_device_feature_capabilities_intel;
+
+/* cl_device_feature_capabilities_intel */
+#define CL_DEVICE_FEATURE_FLAG_DP4A_INTEL (1 << 0)
+#define CL_DEVICE_FEATURE_FLAG_DPAS_INTEL (1 << 1)
+
+/* cl_device_info */
+#define CL_DEVICE_IP_VERSION_INTEL 0x4250
+#define CL_DEVICE_ID_INTEL 0x4251
+#define CL_DEVICE_NUM_SLICES_INTEL 0x4252
+#define CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL 0x4253
+#define CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL 0x4254
+#define CL_DEVICE_NUM_THREADS_PER_EU_INTEL 0x4255
+#define CL_DEVICE_FEATURE_CAPABILITIES_INTEL 0x4256
+
+/***************************************************************
+* cl_intel_device_partition_by_names
+***************************************************************/
+#define cl_intel_device_partition_by_names 1
+#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_NAME \
+ "cl_intel_device_partition_by_names"
+
+
+#define CL_INTEL_DEVICE_PARTITION_BY_NAMES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+#define CL_DEVICE_PARTITION_BY_NAMES_INTEL 0x4052
+#define CL_PARTITION_BY_NAMES_LIST_END_INTEL -1
+
+/***************************************************************
+* cl_intel_accelerator
+***************************************************************/
+#define cl_intel_accelerator 1
+#define CL_INTEL_ACCELERATOR_EXTENSION_NAME \
+ "cl_intel_accelerator"
+
+
+#define CL_INTEL_ACCELERATOR_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef struct _cl_accelerator_intel* cl_accelerator_intel;
+typedef cl_uint cl_accelerator_type_intel;
+typedef cl_uint cl_accelerator_info_intel;
+
+/* cl_accelerator_info_intel */
+#define CL_ACCELERATOR_DESCRIPTOR_INTEL 0x4090
+#define CL_ACCELERATOR_REFERENCE_COUNT_INTEL 0x4091
+#define CL_ACCELERATOR_CONTEXT_INTEL 0x4092
+#define CL_ACCELERATOR_TYPE_INTEL 0x4093
+
+/* Error codes */
+#define CL_INVALID_ACCELERATOR_INTEL -1094
+#define CL_INVALID_ACCELERATOR_TYPE_INTEL -1095
+#define CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL -1096
+#define CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL -1097
+
+
+typedef cl_accelerator_intel CL_API_CALL
+clCreateAcceleratorINTEL_t(
+ cl_context context,
+ cl_accelerator_type_intel accelerator_type,
+ size_t descriptor_size,
+ const void* descriptor,
+ cl_int* errcode_ret);
+
+typedef clCreateAcceleratorINTEL_t *
+clCreateAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clGetAcceleratorInfoINTEL_t(
+ cl_accelerator_intel accelerator,
+ cl_accelerator_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetAcceleratorInfoINTEL_t *
+clGetAcceleratorInfoINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clRetainAcceleratorINTEL_t(
+ cl_accelerator_intel accelerator);
+
+typedef clRetainAcceleratorINTEL_t *
+clRetainAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clReleaseAcceleratorINTEL_t(
+ cl_accelerator_intel accelerator);
+
+typedef clReleaseAcceleratorINTEL_t *
+clReleaseAcceleratorINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_accelerator_intel CL_API_CALL
+clCreateAcceleratorINTEL(
+ cl_context context,
+ cl_accelerator_type_intel accelerator_type,
+ size_t descriptor_size,
+ const void* descriptor,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetAcceleratorInfoINTEL(
+ cl_accelerator_intel accelerator,
+ cl_accelerator_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainAcceleratorINTEL(
+ cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseAcceleratorINTEL(
+ cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_motion_estimation
+***************************************************************/
+#define cl_intel_motion_estimation 1
+#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_motion_estimation"
+
+
+#define CL_INTEL_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef struct _cl_motion_estimation_desc_intel {
+ cl_uint mb_block_type;
+ cl_uint subpixel_mode;
+ cl_uint sad_adjust_mode;
+ cl_uint search_path_type;
+} cl_motion_estimation_desc_intel;
+
+/* cl_accelerator_type_intel */
+#define CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL 0x0
+
+/* cl_uint mb_block_type */
+#define CL_ME_MB_TYPE_16x16_INTEL 0x0
+#define CL_ME_MB_TYPE_8x8_INTEL 0x1
+#define CL_ME_MB_TYPE_4x4_INTEL 0x2
+
+/* cl_uint subpixel_mode */
+#define CL_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
+#define CL_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
+#define CL_ME_SUBPIXEL_MODE_QPEL_INTEL 0x2
+
+/* cl_uint sad_adjust_mode */
+#define CL_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
+#define CL_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x1
+
+/* cl_uint search_path_type */
+#define CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL 0x0
+#define CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL 0x1
+#define CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL 0x5
+
+/***************************************************************
+* cl_intel_advanced_motion_estimation
+***************************************************************/
+#define cl_intel_advanced_motion_estimation 1
+#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_advanced_motion_estimation"
+
+
+#define CL_INTEL_ADVANCED_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_ME_VERSION_INTEL 0x407E
+
+#define CL_ME_VERSION_LEGACY_INTEL 0x0
+#define CL_ME_VERSION_ADVANCED_VER_1_INTEL 0x1
+#define CL_ME_VERSION_ADVANCED_VER_2_INTEL 0x2
+
+#define CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL 0x1
+#define CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL 0x2
+
+#define CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL 0x0
+#define CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL 0x4
+
+#define CL_ME_COST_PENALTY_NONE_INTEL 0x0
+#define CL_ME_COST_PENALTY_LOW_INTEL 0x1
+#define CL_ME_COST_PENALTY_NORMAL_INTEL 0x2
+#define CL_ME_COST_PENALTY_HIGH_INTEL 0x3
+
+#define CL_ME_COST_PRECISION_QPEL_INTEL 0x0
+#define CL_ME_COST_PRECISION_HPEL_INTEL 0x1
+#define CL_ME_COST_PRECISION_PEL_INTEL 0x2
+#define CL_ME_COST_PRECISION_DPEL_INTEL 0x3
+
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
+#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
+#define CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
+#define CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
+#define CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
+#define CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
+
+#define CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
+#define CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
+#define CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
+
+#define CL_ME_FORWARD_INPUT_MODE_INTEL 0x1
+#define CL_ME_BACKWARD_INPUT_MODE_INTEL 0x2
+#define CL_ME_BIDIRECTION_INPUT_MODE_INTEL 0x3
+
+#define CL_ME_BIDIR_WEIGHT_QUARTER_INTEL 16
+#define CL_ME_BIDIR_WEIGHT_THIRD_INTEL 21
+#define CL_ME_BIDIR_WEIGHT_HALF_INTEL 32
+#define CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 43
+#define CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 48
+
+/***************************************************************
+* cl_intel_simultaneous_sharing
+***************************************************************/
+#define cl_intel_simultaneous_sharing 1
+#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_NAME \
+ "cl_intel_simultaneous_sharing"
+
+
+#define CL_INTEL_SIMULTANEOUS_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL 0x4104
+#define CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL 0x4105
+
+/***************************************************************
+* cl_intel_egl_image_yuv
+***************************************************************/
+#define cl_intel_egl_image_yuv 1
+#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_NAME \
+ "cl_intel_egl_image_yuv"
+
+
+#define CL_INTEL_EGL_IMAGE_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_egl_image_properties_khr */
+#define CL_EGL_YUV_PLANE_INTEL 0x4107
+
+/***************************************************************
+* cl_intel_packed_yuv
+***************************************************************/
+#define cl_intel_packed_yuv 1
+#define CL_INTEL_PACKED_YUV_EXTENSION_NAME \
+ "cl_intel_packed_yuv"
+
+
+#define CL_INTEL_PACKED_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_YUYV_INTEL 0x4076
+#define CL_UYVY_INTEL 0x4077
+#define CL_YVYU_INTEL 0x4078
+#define CL_VYUY_INTEL 0x4079
+
+/***************************************************************
+* cl_intel_required_subgroup_size
+***************************************************************/
+#define cl_intel_required_subgroup_size 1
+#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_NAME \
+ "cl_intel_required_subgroup_size"
+
+
+#define CL_INTEL_REQUIRED_SUBGROUP_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_SUB_GROUP_SIZES_INTEL 0x4108
+
+/* cl_kernel_work_group_info */
+#define CL_KERNEL_SPILL_MEM_SIZE_INTEL 0x4109
+
+/* cl_kernel_sub_group_info */
+#define CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL 0x410A
+
+/***************************************************************
+* cl_intel_driver_diagnostics
+***************************************************************/
+#define cl_intel_driver_diagnostics 1
+#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_NAME \
+ "cl_intel_driver_diagnostics"
+
+
+#define CL_INTEL_DRIVER_DIAGNOSTICS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_diagnostic_verbose_level_intel;
+
+/* cl_context_properties */
+#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
+
+/* cl_diagnostic_verbose_level_intel */
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL 0xff
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL (1 << 0)
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL (1 << 1)
+#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL (1 << 2)
+
+/***************************************************************
+* cl_intel_planar_yuv
+***************************************************************/
+#define cl_intel_planar_yuv 1
+#define CL_INTEL_PLANAR_YUV_EXTENSION_NAME \
+ "cl_intel_planar_yuv"
+
+
+#define CL_INTEL_PLANAR_YUV_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_channel_order */
+#define CL_NV12_INTEL 0x410E
+
+/* cl_mem_flags */
+#define CL_MEM_NO_ACCESS_INTEL (1 << 24)
+#define CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL (1 << 25)
+
+/* cl_device_info */
+#define CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL 0x417E
+#define CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL 0x417F
+
+/***************************************************************
+* cl_intel_device_side_avc_motion_estimation
+***************************************************************/
+#define cl_intel_device_side_avc_motion_estimation 1
+#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_NAME \
+ "cl_intel_device_side_avc_motion_estimation"
+
+
+#define CL_INTEL_DEVICE_SIDE_AVC_MOTION_ESTIMATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_AVC_ME_VERSION_INTEL 0x410B
+#define CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL 0x410C
+#define CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL 0x410D
+
+/* returned by CL_DEVICE_AVC_ME_VERSION_INTEL */
+#define CL_AVC_ME_VERSION_0_INTEL 0x0
+#define CL_AVC_ME_VERSION_1_INTEL 0x1
+
+/* Inter macro-block major shape values */
+#define CL_AVC_ME_MAJOR_16x16_INTEL 0x0
+#define CL_AVC_ME_MAJOR_16x8_INTEL 0x1
+#define CL_AVC_ME_MAJOR_8x16_INTEL 0x2
+#define CL_AVC_ME_MAJOR_8x8_INTEL 0x3
+
+/* Inter macro-block minor shape values */
+#define CL_AVC_ME_MINOR_8x8_INTEL 0x0
+#define CL_AVC_ME_MINOR_8x4_INTEL 0x1
+#define CL_AVC_ME_MINOR_4x8_INTEL 0x2
+#define CL_AVC_ME_MINOR_4x4_INTEL 0x3
+
+/* Inter macro-block major direction values */
+#define CL_AVC_ME_MAJOR_FORWARD_INTEL 0x0
+#define CL_AVC_ME_MAJOR_BACKWARD_INTEL 0x1
+#define CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL 0x2
+
+/* Inter (IME) partition mask values */
+#define CL_AVC_ME_PARTITION_MASK_ALL_INTEL 0x0
+#define CL_AVC_ME_PARTITION_MASK_16x16_INTEL 0x7E
+#define CL_AVC_ME_PARTITION_MASK_16x8_INTEL 0x7D
+#define CL_AVC_ME_PARTITION_MASK_8x16_INTEL 0x7B
+#define CL_AVC_ME_PARTITION_MASK_8x8_INTEL 0x77
+#define CL_AVC_ME_PARTITION_MASK_8x4_INTEL 0x6F
+#define CL_AVC_ME_PARTITION_MASK_4x8_INTEL 0x5F
+#define CL_AVC_ME_PARTITION_MASK_4x4_INTEL 0x3F
+
+/* Search window configuration */
+#define CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL 0x0
+#define CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL 0x1
+#define CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL 0x2
+#define CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL 0x3
+#define CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL 0x4
+#define CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL 0x5
+#define CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL 0x6
+#define CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL 0x7
+#define CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL 0x8
+#define CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL 0x9
+#define CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL 0x2
+#define CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL 0xa
+
+/* SAD adjustment mode */
+#define CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL 0x0
+#define CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL 0x2
+
+/* Pixel resolution */
+#define CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL 0x0
+#define CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL 0x1
+#define CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL 0x3
+
+/* Cost precision values */
+#define CL_AVC_ME_COST_PRECISION_QPEL_INTEL 0x0
+#define CL_AVC_ME_COST_PRECISION_HPEL_INTEL 0x1
+#define CL_AVC_ME_COST_PRECISION_PEL_INTEL 0x2
+#define CL_AVC_ME_COST_PRECISION_DPEL_INTEL 0x3
+
+/* Inter bidirectional weights */
+#define CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL 0x10
+#define CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL 0x15
+#define CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL 0x20
+#define CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL 0x2B
+#define CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL 0x30
+
+/* Inter border reached values */
+#define CL_AVC_ME_BORDER_REACHED_LEFT_INTEL 0x0
+#define CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL 0x2
+#define CL_AVC_ME_BORDER_REACHED_TOP_INTEL 0x4
+#define CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL 0x8
+
+/* Inter skip block partition type */
+#define CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL 0x0
+#define CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL 0x4000
+
+/* Inter skip motion vector mask */
+#define CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL (0x1 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL (0x2 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL (0x3 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL (0x55 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL (0xAA << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL (0xFF << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL (0x1 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL (0x2 << 24)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL (0x1 << 26)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL (0x2 << 26)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL (0x1 << 28)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL (0x2 << 28)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL (0x1 << 30)
+#define CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL (0x2 << 30)
+
+/* Block based skip type values */
+#define CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL 0x00
+#define CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL 0x80
+
+/* cl_intel_device_side_avc_motion_estimation.?? */
+#define CL_AVC_ME_INTRA_16x16_INTEL 0x0
+#define CL_AVC_ME_INTRA_8x8_INTEL 0x1
+#define CL_AVC_ME_INTRA_4x4_INTEL 0x2
+
+/* Luma intra partition mask values */
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL 0x6
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL 0x5
+#define CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL 0x3
+
+/* Intra neighbor availability mask values */
+#define CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL 0x60
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL 0x10
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL 0x8
+#define CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL 0x4
+
+/* Luma intra modes */
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL 0x0
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL 0x2
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL 0x3
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL 0x4
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL 0x4
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL 0x5
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL 0x6
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL 0x7
+#define CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL 0x8
+
+/* Chroma intra modes */
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL 0x0
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL 0x1
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL 0x2
+#define CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL 0x3
+
+/* Reference image select values */
+#define CL_AVC_ME_FRAME_FORWARD_INTEL 0x1
+#define CL_AVC_ME_FRAME_BACKWARD_INTEL 0x2
+#define CL_AVC_ME_FRAME_DUAL_INTEL 0x3
+
+/* Slice type values */
+#define CL_AVC_ME_SLICE_TYPE_PRED_INTEL 0x0
+#define CL_AVC_ME_SLICE_TYPE_BPRED_INTEL 0x1
+#define CL_AVC_ME_SLICE_TYPE_INTRA_INTEL 0x2
+
+/* Interlaced image field polarity values */
+#define CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL 0x0
+#define CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL 0x1
+
+/***************************************************************
+* cl_intel_unified_shared_memory
+***************************************************************/
+#define cl_intel_unified_shared_memory 1
+#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_NAME \
+ "cl_intel_unified_shared_memory"
+
+
+#define CL_INTEL_UNIFIED_SHARED_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_device_unified_shared_memory_capabilities_intel;
+typedef cl_properties cl_mem_properties_intel;
+typedef cl_bitfield cl_mem_alloc_flags_intel;
+typedef cl_uint cl_mem_info_intel;
+typedef cl_uint cl_unified_shared_memory_type_intel;
+typedef cl_uint cl_mem_advice_intel;
+
+/* cl_device_info */
+#define CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL 0x4190
+#define CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL 0x4191
+#define CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4192
+#define CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL 0x4193
+#define CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL 0x4194
+
+/* cl_unified_shared_memory_capabilities_intel - bitfield */
+#define CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL (1 << 0)
+#define CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL (1 << 1)
+#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL (1 << 2)
+#define CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL (1 << 3)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_ALLOC_FLAGS_INTEL 0x4195
+
+/* cl_mem_alloc_flags_intel - bitfield */
+#define CL_MEM_ALLOC_WRITE_COMBINED_INTEL (1 << 0)
+#define CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL (1 << 1)
+#define CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL (1 << 2)
+
+/* cl_mem_alloc_info_intel */
+#define CL_MEM_ALLOC_TYPE_INTEL 0x419A
+#define CL_MEM_ALLOC_BASE_PTR_INTEL 0x419B
+#define CL_MEM_ALLOC_SIZE_INTEL 0x419C
+#define CL_MEM_ALLOC_DEVICE_INTEL 0x419D
+
+/* cl_unified_shared_memory_type_intel */
+#define CL_MEM_TYPE_UNKNOWN_INTEL 0x4196
+#define CL_MEM_TYPE_HOST_INTEL 0x4197
+#define CL_MEM_TYPE_DEVICE_INTEL 0x4198
+#define CL_MEM_TYPE_SHARED_INTEL 0x4199
+
+/* cl_kernel_exec_info */
+#define CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL 0x4200
+#define CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL 0x4201
+#define CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL 0x4202
+#define CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL 0x4203
+
+/* cl_command_type */
+#define CL_COMMAND_MEMFILL_INTEL 0x4204
+#define CL_COMMAND_MEMCPY_INTEL 0x4205
+#define CL_COMMAND_MIGRATEMEM_INTEL 0x4206
+#define CL_COMMAND_MEMADVISE_INTEL 0x4207
+
+
+typedef void* CL_API_CALL
+clHostMemAllocINTEL_t(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clHostMemAllocINTEL_t *
+clHostMemAllocINTEL_fn ;
+
+typedef void* CL_API_CALL
+clDeviceMemAllocINTEL_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clDeviceMemAllocINTEL_t *
+clDeviceMemAllocINTEL_fn ;
+
+typedef void* CL_API_CALL
+clSharedMemAllocINTEL_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret);
+
+typedef clSharedMemAllocINTEL_t *
+clSharedMemAllocINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clMemFreeINTEL_t(
+ cl_context context,
+ void* ptr);
+
+typedef clMemFreeINTEL_t *
+clMemFreeINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clMemBlockingFreeINTEL_t(
+ cl_context context,
+ void* ptr);
+
+typedef clMemBlockingFreeINTEL_t *
+clMemBlockingFreeINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clGetMemAllocInfoINTEL_t(
+ cl_context context,
+ const void* ptr,
+ cl_mem_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetMemAllocInfoINTEL_t *
+clGetMemAllocInfoINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clSetKernelArgMemPointerINTEL_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value);
+
+typedef clSetKernelArgMemPointerINTEL_t *
+clSetKernelArgMemPointerINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemFillINTEL_t(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemFillINTEL_t *
+clEnqueueMemFillINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemcpyINTEL_t(
+ cl_command_queue command_queue,
+ cl_bool blocking,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemcpyINTEL_t *
+clEnqueueMemcpyINTEL_fn ;
+
+typedef cl_int CL_API_CALL
+clEnqueueMemAdviseINTEL_t(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_advice_intel advice,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemAdviseINTEL_t *
+clEnqueueMemAdviseINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY void* CL_API_CALL
+clHostMemAllocINTEL(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY void* CL_API_CALL
+clDeviceMemAllocINTEL(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY void* CL_API_CALL
+clSharedMemAllocINTEL(
+ cl_context context,
+ cl_device_id device,
+ const cl_mem_properties_intel* properties,
+ size_t size,
+ cl_uint alignment,
+ cl_int* errcode_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clMemFreeINTEL(
+ cl_context context,
+ void* ptr) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clMemBlockingFreeINTEL(
+ cl_context context,
+ void* ptr) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMemAllocInfoINTEL(
+ cl_context context,
+ const void* ptr,
+ cl_mem_info_intel param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArgMemPointerINTEL(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemFillINTEL(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemcpyINTEL(
+ cl_command_queue command_queue,
+ cl_bool blocking,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemAdviseINTEL(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_advice_intel advice,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#if defined(CL_VERSION_1_2)
+/* Requires OpenCL 1.2 for cl_mem_migration_flags: */
+
+typedef cl_int CL_API_CALL
+clEnqueueMigrateMemINTEL_t(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMigrateMemINTEL_t *
+clEnqueueMigrateMemINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMigrateMemINTEL(
+ cl_command_queue command_queue,
+ const void* ptr,
+ size_t size,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/* deprecated, use clEnqueueMemFillINTEL instead */
+
+typedef cl_int CL_API_CALL
+clEnqueueMemsetINTEL_t(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ cl_int value,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMemsetINTEL_t *
+clEnqueueMemsetINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMemsetINTEL(
+ cl_command_queue command_queue,
+ void* dst_ptr,
+ cl_int value,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_mem_alloc_buffer_location
+***************************************************************/
+#define cl_intel_mem_alloc_buffer_location 1
+#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_NAME \
+ "cl_intel_mem_alloc_buffer_location"
+
+
+#define CL_INTEL_MEM_ALLOC_BUFFER_LOCATION_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_ALLOC_BUFFER_LOCATION_INTEL 0x419E
+
+/* cl_mem_alloc_info_intel */
+/* enum CL_MEM_ALLOC_BUFFER_LOCATION_INTEL */
+
+/***************************************************************
+* cl_intel_create_buffer_with_properties
+***************************************************************/
+#define cl_intel_create_buffer_with_properties 1
+#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_NAME \
+ "cl_intel_create_buffer_with_properties"
+
+
+#define CL_INTEL_CREATE_BUFFER_WITH_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* type cl_mem_properties_intel */
+
+
+typedef cl_mem CL_API_CALL
+clCreateBufferWithPropertiesINTEL_t(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateBufferWithPropertiesINTEL_t *
+clCreateBufferWithPropertiesINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBufferWithPropertiesINTEL(
+ cl_context context,
+ const cl_mem_properties_intel* properties,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_program_scope_host_pipe
+***************************************************************/
+#define cl_intel_program_scope_host_pipe 1
+#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_NAME \
+ "cl_intel_program_scope_host_pipe"
+
+
+#define CL_INTEL_PROGRAM_SCOPE_HOST_PIPE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* clGetEventInfo response when param_name is CL_EVENT_COMMAND_TYPE */
+#define CL_COMMAND_READ_HOST_PIPE_INTEL 0x4214
+#define CL_COMMAND_WRITE_HOST_PIPE_INTEL 0x4215
+
+/* clGetProgramInfo param_name */
+#define CL_PROGRAM_NUM_HOST_PIPES_INTEL 0x4216
+#define CL_PROGRAM_HOST_PIPE_NAMES_INTEL 0x4217
+
+
+typedef cl_int CL_API_CALL
+clEnqueueReadHostPipeINTEL_t(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_read,
+ void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReadHostPipeINTEL_t *
+clEnqueueReadHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueWriteHostPipeINTEL_t(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_write,
+ const void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWriteHostPipeINTEL_t *
+clEnqueueWriteHostPipeINTEL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadHostPipeINTEL(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_read,
+ void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteHostPipeINTEL(
+ cl_command_queue command_queue,
+ cl_program program,
+ const char* pipe_symbol,
+ cl_bool blocking_write,
+ const void* ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_mem_channel_property
+***************************************************************/
+#define cl_intel_mem_channel_property 1
+#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_NAME \
+ "cl_intel_mem_channel_property"
+
+
+#define CL_INTEL_MEM_CHANNEL_PROPERTY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties_intel */
+#define CL_MEM_CHANNEL_INTEL 0x4213
+
+/***************************************************************
+* cl_intel_mem_force_host_memory
+***************************************************************/
+#define cl_intel_mem_force_host_memory 1
+#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_NAME \
+ "cl_intel_mem_force_host_memory"
+
+
+#define CL_INTEL_MEM_FORCE_HOST_MEMORY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_flags */
+#define CL_MEM_FORCE_HOST_MEMORY_INTEL (1 << 20)
+
+/***************************************************************
+* cl_intel_command_queue_families
+***************************************************************/
+#define cl_intel_command_queue_families 1
+#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_NAME \
+ "cl_intel_command_queue_families"
+
+
+#define CL_INTEL_COMMAND_QUEUE_FAMILIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_bitfield cl_command_queue_capabilities_intel;
+
+#define CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL 64
+
+typedef struct _cl_queue_family_properties_intel {
+ cl_command_queue_properties properties;
+ cl_command_queue_capabilities_intel capabilities;
+ cl_uint count;
+ char name[CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL];
+} cl_queue_family_properties_intel;
+
+/* cl_device_info */
+#define CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL 0x418B
+
+/* cl_queue_properties */
+#define CL_QUEUE_FAMILY_INTEL 0x418C
+#define CL_QUEUE_INDEX_INTEL 0x418D
+
+/* cl_command_queue_capabilities_intel */
+#define CL_QUEUE_DEFAULT_CAPABILITIES_INTEL 0
+#define CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL (1 << 0)
+#define CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL (1 << 1)
+#define CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 2)
+#define CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL (1 << 3)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL (1 << 8)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL (1 << 9)
+#define CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL (1 << 10)
+#define CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL (1 << 11)
+#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL (1 << 12)
+#define CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL (1 << 13)
+#define CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL (1 << 14)
+#define CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL (1 << 15)
+#define CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL (1 << 16)
+#define CL_QUEUE_CAPABILITY_MARKER_INTEL (1 << 24)
+#define CL_QUEUE_CAPABILITY_BARRIER_INTEL (1 << 25)
+#define CL_QUEUE_CAPABILITY_KERNEL_INTEL (1 << 26)
+
+/***************************************************************
+* cl_intel_queue_no_sync_operations
+***************************************************************/
+#define cl_intel_queue_no_sync_operations 1
+#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_NAME \
+ "cl_intel_queue_no_sync_operations"
+
+
+#define CL_INTEL_QUEUE_NO_SYNC_OPERATIONS_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_command_queue_properties */
+#define CL_QUEUE_NO_SYNC_OPERATIONS_INTEL (1 << 29)
+
+/***************************************************************
+* cl_intel_sharing_format_query
+***************************************************************/
+#define cl_intel_sharing_format_query 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_NAME \
+ "cl_intel_sharing_format_query"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/***************************************************************
+* cl_ext_image_requirements_info
+***************************************************************/
+#if defined(CL_VERSION_3_0)
+
+#define cl_ext_image_requirements_info 1
+#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_NAME \
+ "cl_ext_image_requirements_info"
+
+
+#define CL_EXT_IMAGE_REQUIREMENTS_INFO_EXTENSION_VERSION CL_MAKE_VERSION(0, 5, 0)
+
+/* Types */
+typedef cl_uint cl_image_requirements_info_ext;
+
+/* cl_image_requirements_info_ext */
+#define CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT 0x1292
+#define CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT 0x1290
+#define CL_IMAGE_REQUIREMENTS_SIZE_EXT 0x12B2
+#define CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT 0x12B3
+#define CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT 0x12B4
+#define CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT 0x12B5
+#define CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT 0x12B6
+
+/* Enqueued Commands APIs */
+
+typedef cl_int CL_API_CALL
+clGetImageRequirementsInfoEXT_t(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ cl_image_requirements_info_ext param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetImageRequirementsInfoEXT_t *
+clGetImageRequirementsInfoEXT_fn CL_API_SUFFIX__VERSION_3_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetImageRequirementsInfoEXT(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ cl_image_requirements_info_ext param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_3_0) */
+
+/***************************************************************
+* cl_ext_image_from_buffer
+***************************************************************/
+#if defined(CL_VERSION_3_0)
+
+#define cl_ext_image_from_buffer 1
+#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_NAME \
+ "cl_ext_image_from_buffer"
+
+
+#define CL_EXT_IMAGE_FROM_BUFFER_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_image_requirements_info_ext */
+#define CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT 0x1291
+
+#endif /* defined(CL_VERSION_3_0) */
+
+/***************************************************************
+* cl_loader_info
+***************************************************************/
+#define cl_loader_info 1
+#define CL_LOADER_INFO_EXTENSION_NAME \
+ "cl_loader_info"
+
+
+#define CL_LOADER_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_icdl_info;
+
+/* cl_icdl_info */
+#define CL_ICDL_OCL_VERSION 1
+#define CL_ICDL_VERSION 2
+#define CL_ICDL_NAME 3
+#define CL_ICDL_VENDOR 4
+
+
+typedef cl_int CL_API_CALL
+clGetICDLoaderInfoOCLICD_t(
+ cl_icdl_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetICDLoaderInfoOCLICD_t *
+clGetICDLoaderInfoOCLICD_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetICDLoaderInfoOCLICD(
+ cl_icdl_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_depth_images
+***************************************************************/
+#define cl_khr_depth_images 1
+#define CL_KHR_DEPTH_IMAGES_EXTENSION_NAME \
+ "cl_khr_depth_images"
+
+
+#define CL_KHR_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+#if !defined(CL_VERSION_2_0)
+/* cl_channel_order - defined in CL.h for OpenCL 2.0 and newer */
+#define CL_DEPTH 0x10BD
+
+#endif /* !defined(CL_VERSION_2_0) */
+
+/***************************************************************
+* cl_ext_float_atomics
+***************************************************************/
+#define cl_ext_float_atomics 1
+#define CL_EXT_FLOAT_ATOMICS_EXTENSION_NAME \
+ "cl_ext_float_atomics"
+
+
+#define CL_EXT_FLOAT_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_bitfield cl_device_fp_atomic_capabilities_ext;
+
+/* cl_device_fp_atomic_capabilities_ext */
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 0)
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_ADD_EXT (1 << 1)
+#define CL_DEVICE_GLOBAL_FP_ATOMIC_MIN_MAX_EXT (1 << 2)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_LOAD_STORE_EXT (1 << 16)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_ADD_EXT (1 << 17)
+#define CL_DEVICE_LOCAL_FP_ATOMIC_MIN_MAX_EXT (1 << 18)
+
+/* cl_device_info */
+#define CL_DEVICE_SINGLE_FP_ATOMIC_CAPABILITIES_EXT 0x4231
+#define CL_DEVICE_DOUBLE_FP_ATOMIC_CAPABILITIES_EXT 0x4232
+#define CL_DEVICE_HALF_FP_ATOMIC_CAPABILITIES_EXT 0x4233
+
+/***************************************************************
+* cl_intel_create_mem_object_properties
+***************************************************************/
+#define cl_intel_create_mem_object_properties 1
+#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_NAME \
+ "cl_intel_create_mem_object_properties"
+
+
+#define CL_INTEL_CREATE_MEM_OBJECT_PROPERTIES_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* cl_mem_properties */
+#define CL_MEM_LOCALLY_UNCACHED_RESOURCE_INTEL 0x4218
+#define CL_MEM_DEVICE_ID_INTEL 0x4219
+
+/***************************************************************
+* cl_pocl_content_size
+***************************************************************/
+#define cl_pocl_content_size 1
+#define CL_POCL_CONTENT_SIZE_EXTENSION_NAME \
+ "cl_pocl_content_size"
+
+
+#define CL_POCL_CONTENT_SIZE_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+
+typedef cl_int CL_API_CALL
+clSetContentSizeBufferPoCL_t(
+ cl_mem buffer,
+ cl_mem content_size_buffer);
+
+typedef clSetContentSizeBufferPoCL_t *
+clSetContentSizeBufferPoCL_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetContentSizeBufferPoCL(
+ cl_mem buffer,
+ cl_mem content_size_buffer) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_ext_image_raw10_raw12
+***************************************************************/
+#define cl_ext_image_raw10_raw12 1
+#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_NAME \
+ "cl_ext_image_raw10_raw12"
+
+
+#define CL_EXT_IMAGE_RAW10_RAW12_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_type */
+#define CL_UNSIGNED_INT_RAW10_EXT 0x10E3
+#define CL_UNSIGNED_INT_RAW12_EXT 0x10E4
+
+/***************************************************************
+* cl_khr_3d_image_writes
+***************************************************************/
+#define cl_khr_3d_image_writes 1
+#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_3d_image_writes"
+
+
+#define CL_KHR_3D_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_async_work_group_copy_fence
+***************************************************************/
+#define cl_khr_async_work_group_copy_fence 1
+#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_NAME \
+ "cl_khr_async_work_group_copy_fence"
+
+
+#define CL_KHR_ASYNC_WORK_GROUP_COPY_FENCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_byte_addressable_store
+***************************************************************/
+#define cl_khr_byte_addressable_store 1
+#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_NAME \
+ "cl_khr_byte_addressable_store"
+
+
+#define CL_KHR_BYTE_ADDRESSABLE_STORE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_device_enqueue_local_arg_types
+***************************************************************/
+#define cl_khr_device_enqueue_local_arg_types 1
+#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_NAME \
+ "cl_khr_device_enqueue_local_arg_types"
+
+
+#define CL_KHR_DEVICE_ENQUEUE_LOCAL_ARG_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_expect_assume
+***************************************************************/
+#define cl_khr_expect_assume 1
+#define CL_KHR_EXPECT_ASSUME_EXTENSION_NAME \
+ "cl_khr_expect_assume"
+
+
+#define CL_KHR_EXPECT_ASSUME_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_extended_async_copies
+***************************************************************/
+#define cl_khr_extended_async_copies 1
+#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_NAME \
+ "cl_khr_extended_async_copies"
+
+
+#define CL_KHR_EXTENDED_ASYNC_COPIES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_extended_bit_ops
+***************************************************************/
+#define cl_khr_extended_bit_ops 1
+#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_NAME \
+ "cl_khr_extended_bit_ops"
+
+
+#define CL_KHR_EXTENDED_BIT_OPS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_global_int32_base_atomics
+***************************************************************/
+#define cl_khr_global_int32_base_atomics 1
+#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_global_int32_base_atomics"
+
+
+#define CL_KHR_GLOBAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_global_int32_extended_atomics
+***************************************************************/
+#define cl_khr_global_int32_extended_atomics 1
+#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_global_int32_extended_atomics"
+
+
+#define CL_KHR_GLOBAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_int64_base_atomics
+***************************************************************/
+#define cl_khr_int64_base_atomics 1
+#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_int64_base_atomics"
+
+
+#define CL_KHR_INT64_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_int64_extended_atomics
+***************************************************************/
+#define cl_khr_int64_extended_atomics 1
+#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_int64_extended_atomics"
+
+
+#define CL_KHR_INT64_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_kernel_clock
+***************************************************************/
+#define cl_khr_kernel_clock 1
+#define CL_KHR_KERNEL_CLOCK_EXTENSION_NAME \
+ "cl_khr_kernel_clock"
+
+
+#define CL_KHR_KERNEL_CLOCK_EXTENSION_VERSION CL_MAKE_VERSION(0, 9, 0)
+
+/* cl_device_info */
+#define CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR 0x1076
+
+typedef cl_bitfield cl_device_kernel_clock_capabilities_khr;
+
+/* cl_device_kernel_clock_capabilities_khr */
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR (1 << 0)
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR (1 << 1)
+#define CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR (1 << 2)
+
+/***************************************************************
+* cl_khr_local_int32_base_atomics
+***************************************************************/
+#define cl_khr_local_int32_base_atomics 1
+#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_NAME \
+ "cl_khr_local_int32_base_atomics"
+
+
+#define CL_KHR_LOCAL_INT32_BASE_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_local_int32_extended_atomics
+***************************************************************/
+#define cl_khr_local_int32_extended_atomics 1
+#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_NAME \
+ "cl_khr_local_int32_extended_atomics"
+
+
+#define CL_KHR_LOCAL_INT32_EXTENDED_ATOMICS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_mipmap_image_writes
+***************************************************************/
+#define cl_khr_mipmap_image_writes 1
+#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_mipmap_image_writes"
+
+
+#define CL_KHR_MIPMAP_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_select_fprounding_mode
+***************************************************************/
+#define cl_khr_select_fprounding_mode 1
+#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_NAME \
+ "cl_khr_select_fprounding_mode"
+
+
+#define CL_KHR_SELECT_FPROUNDING_MODE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_extended_debug_info
+***************************************************************/
+#define cl_khr_spirv_extended_debug_info 1
+#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_NAME \
+ "cl_khr_spirv_extended_debug_info"
+
+
+#define CL_KHR_SPIRV_EXTENDED_DEBUG_INFO_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_linkonce_odr
+***************************************************************/
+#define cl_khr_spirv_linkonce_odr 1
+#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_NAME \
+ "cl_khr_spirv_linkonce_odr"
+
+
+#define CL_KHR_SPIRV_LINKONCE_ODR_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_spirv_no_integer_wrap_decoration
+***************************************************************/
+#define cl_khr_spirv_no_integer_wrap_decoration 1
+#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_NAME \
+ "cl_khr_spirv_no_integer_wrap_decoration"
+
+
+#define CL_KHR_SPIRV_NO_INTEGER_WRAP_DECORATION_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_srgb_image_writes
+***************************************************************/
+#define cl_khr_srgb_image_writes 1
+#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_NAME \
+ "cl_khr_srgb_image_writes"
+
+
+#define CL_KHR_SRGB_IMAGE_WRITES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_ballot
+***************************************************************/
+#define cl_khr_subgroup_ballot 1
+#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_NAME \
+ "cl_khr_subgroup_ballot"
+
+
+#define CL_KHR_SUBGROUP_BALLOT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_clustered_reduce
+***************************************************************/
+#define cl_khr_subgroup_clustered_reduce 1
+#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_NAME \
+ "cl_khr_subgroup_clustered_reduce"
+
+
+#define CL_KHR_SUBGROUP_CLUSTERED_REDUCE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_extended_types
+***************************************************************/
+#define cl_khr_subgroup_extended_types 1
+#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME \
+ "cl_khr_subgroup_extended_types"
+
+
+#define CL_KHR_SUBGROUP_EXTENDED_TYPES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_non_uniform_arithmetic
+***************************************************************/
+#define cl_khr_subgroup_non_uniform_arithmetic 1
+#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_NAME \
+ "cl_khr_subgroup_non_uniform_arithmetic"
+
+
+#define CL_KHR_SUBGROUP_NON_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_non_uniform_vote
+***************************************************************/
+#define cl_khr_subgroup_non_uniform_vote 1
+#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_NAME \
+ "cl_khr_subgroup_non_uniform_vote"
+
+
+#define CL_KHR_SUBGROUP_NON_UNIFORM_VOTE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_rotate
+***************************************************************/
+#define cl_khr_subgroup_rotate 1
+#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_NAME \
+ "cl_khr_subgroup_rotate"
+
+
+#define CL_KHR_SUBGROUP_ROTATE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_shuffle
+***************************************************************/
+#define cl_khr_subgroup_shuffle 1
+#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_NAME \
+ "cl_khr_subgroup_shuffle"
+
+
+#define CL_KHR_SUBGROUP_SHUFFLE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_subgroup_shuffle_relative
+***************************************************************/
+#define cl_khr_subgroup_shuffle_relative 1
+#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_NAME \
+ "cl_khr_subgroup_shuffle_relative"
+
+
+#define CL_KHR_SUBGROUP_SHUFFLE_RELATIVE_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_khr_work_group_uniform_arithmetic
+***************************************************************/
+#define cl_khr_work_group_uniform_arithmetic 1
+#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_NAME \
+ "cl_khr_work_group_uniform_arithmetic"
+
+
+#define CL_KHR_WORK_GROUP_UNIFORM_ARITHMETIC_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/***************************************************************
+* cl_ext_image_unorm_int_2_101010
+***************************************************************/
+#define cl_ext_image_unorm_int_2_101010 1
+#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_NAME \
+ "cl_ext_image_unorm_int_2_101010"
+
+
+#define CL_EXT_IMAGE_UNORM_INT_2_101010_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_type */
+#define CL_UNORM_INT_2_101010_EXT 0x10E5
+
+/***************************************************************
+* cl_img_cancel_command
+***************************************************************/
+#define cl_img_cancel_command 1
+#define CL_IMG_CANCEL_COMMAND_EXTENSION_NAME \
+ "cl_img_cancel_command"
+
+
+#define CL_IMG_CANCEL_COMMAND_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* Error codes */
+#define CL_CANCELLED_IMG -1126
+
+
+typedef cl_int CL_API_CALL
+clCancelCommandsIMG_t(
+ const cl_event* event_list,
+ size_t num_events_in_list);
+
+typedef clCancelCommandsIMG_t *
+clCancelCommandsIMG_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCancelCommandsIMG(
+ const cl_event* event_list,
+ size_t num_events_in_list) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_EXT_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_ext_intel.h b/tmpl8/lib/OpenCL/inc/CL/cl_ext_intel.h
new file mode 100644
index 0000000..a7ae87a
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_ext_intel.h
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+#include
+#pragma message("The Intel extensions have been moved into cl_ext.h. Please include cl_ext.h directly.")
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_function_types.h b/tmpl8/lib/OpenCL/inc/CL/cl_function_types.h
new file mode 100644
index 0000000..124f53b
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_function_types.h
@@ -0,0 +1,1184 @@
+/*
+ * Copyright (c) 2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * OpenCL is a trademark of Apple Inc. used under license by Khronos.
+ */
+
+#ifndef OPENCL_CL_FUNCTION_TYPES_H_
+#define OPENCL_CL_FUNCTION_TYPES_H_
+
+#include
+
+typedef cl_int CL_API_CALL clGetPlatformIDs_t(
+ cl_uint num_entries,
+ cl_platform_id* platforms,
+ cl_uint* num_platforms);
+
+typedef clGetPlatformIDs_t *
+clGetPlatformIDs_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetPlatformInfo_t(
+ cl_platform_id platform,
+ cl_platform_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetPlatformInfo_t *
+clGetPlatformInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetDeviceIDs_t(
+ cl_platform_id platform,
+ cl_device_type device_type,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDs_t *
+clGetDeviceIDs_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetDeviceInfo_t(
+ cl_device_id device,
+ cl_device_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetDeviceInfo_t *
+clGetDeviceInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_context CL_API_CALL clCreateContext_t(
+ const cl_context_properties* properties,
+ cl_uint num_devices,
+ const cl_device_id* devices,
+ void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
+ void* user_data,
+ cl_int* errcode_ret);
+
+typedef clCreateContext_t *
+clCreateContext_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_context CL_API_CALL clCreateContextFromType_t(
+ const cl_context_properties* properties,
+ cl_device_type device_type,
+ void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
+ void* user_data,
+ cl_int* errcode_ret);
+
+typedef clCreateContextFromType_t *
+clCreateContextFromType_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainContext_t(
+ cl_context context);
+
+typedef clRetainContext_t *
+clRetainContext_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseContext_t(
+ cl_context context);
+
+typedef clReleaseContext_t *
+clReleaseContext_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetContextInfo_t(
+ cl_context context,
+ cl_context_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetContextInfo_t *
+clGetContextInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainCommandQueue_t(
+ cl_command_queue command_queue);
+
+typedef clRetainCommandQueue_t *
+clRetainCommandQueue_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseCommandQueue_t(
+ cl_command_queue command_queue);
+
+typedef clReleaseCommandQueue_t *
+clReleaseCommandQueue_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetCommandQueueInfo_t(
+ cl_command_queue command_queue,
+ cl_command_queue_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetCommandQueueInfo_t *
+clGetCommandQueueInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL clCreateBuffer_t(
+ cl_context context,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateBuffer_t *
+clCreateBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainMemObject_t(
+ cl_mem memobj);
+
+typedef clRetainMemObject_t *
+clRetainMemObject_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseMemObject_t(
+ cl_mem memobj);
+
+typedef clReleaseMemObject_t *
+clReleaseMemObject_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetSupportedImageFormats_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_image_format* image_formats,
+ cl_uint* num_image_formats);
+
+typedef clGetSupportedImageFormats_t *
+clGetSupportedImageFormats_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetMemObjectInfo_t(
+ cl_mem memobj,
+ cl_mem_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetMemObjectInfo_t *
+clGetMemObjectInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetImageInfo_t(
+ cl_mem image,
+ cl_image_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetImageInfo_t *
+clGetImageInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainSampler_t(
+ cl_sampler sampler);
+
+typedef clRetainSampler_t *
+clRetainSampler_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseSampler_t(
+ cl_sampler sampler);
+
+typedef clReleaseSampler_t *
+clReleaseSampler_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetSamplerInfo_t(
+ cl_sampler sampler,
+ cl_sampler_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetSamplerInfo_t *
+clGetSamplerInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_program CL_API_CALL clCreateProgramWithSource_t(
+ cl_context context,
+ cl_uint count,
+ const char** strings,
+ const size_t* lengths,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithSource_t *
+clCreateProgramWithSource_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_program CL_API_CALL clCreateProgramWithBinary_t(
+ cl_context context,
+ cl_uint num_devices,
+ const cl_device_id* device_list,
+ const size_t* lengths,
+ const unsigned char** binaries,
+ cl_int* binary_status,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithBinary_t *
+clCreateProgramWithBinary_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainProgram_t(
+ cl_program program);
+
+typedef clRetainProgram_t *
+clRetainProgram_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseProgram_t(
+ cl_program program);
+
+typedef clReleaseProgram_t *
+clReleaseProgram_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clBuildProgram_t(
+ cl_program program,
+ cl_uint num_devices,
+ const cl_device_id* device_list,
+ const char* options,
+ void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
+ void* user_data);
+
+typedef clBuildProgram_t *
+clBuildProgram_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetProgramInfo_t(
+ cl_program program,
+ cl_program_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetProgramInfo_t *
+clGetProgramInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetProgramBuildInfo_t(
+ cl_program program,
+ cl_device_id device,
+ cl_program_build_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetProgramBuildInfo_t *
+clGetProgramBuildInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_kernel CL_API_CALL clCreateKernel_t(
+ cl_program program,
+ const char* kernel_name,
+ cl_int* errcode_ret);
+
+typedef clCreateKernel_t *
+clCreateKernel_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clCreateKernelsInProgram_t(
+ cl_program program,
+ cl_uint num_kernels,
+ cl_kernel* kernels,
+ cl_uint* num_kernels_ret);
+
+typedef clCreateKernelsInProgram_t *
+clCreateKernelsInProgram_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainKernel_t(
+ cl_kernel kernel);
+
+typedef clRetainKernel_t *
+clRetainKernel_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseKernel_t(
+ cl_kernel kernel);
+
+typedef clReleaseKernel_t *
+clReleaseKernel_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clSetKernelArg_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ size_t arg_size,
+ const void* arg_value);
+
+typedef clSetKernelArg_t *
+clSetKernelArg_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetKernelInfo_t(
+ cl_kernel kernel,
+ cl_kernel_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelInfo_t *
+clGetKernelInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetKernelWorkGroupInfo_t(
+ cl_kernel kernel,
+ cl_device_id device,
+ cl_kernel_work_group_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelWorkGroupInfo_t *
+clGetKernelWorkGroupInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clWaitForEvents_t(
+ cl_uint num_events,
+ const cl_event* event_list);
+
+typedef clWaitForEvents_t *
+clWaitForEvents_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetEventInfo_t(
+ cl_event event,
+ cl_event_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetEventInfo_t *
+clGetEventInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clRetainEvent_t(
+ cl_event event);
+
+typedef clRetainEvent_t *
+clRetainEvent_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clReleaseEvent_t(
+ cl_event event);
+
+typedef clReleaseEvent_t *
+clReleaseEvent_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clGetEventProfilingInfo_t(
+ cl_event event,
+ cl_profiling_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetEventProfilingInfo_t *
+clGetEventProfilingInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clFlush_t(
+ cl_command_queue command_queue);
+
+typedef clFlush_t *
+clFlush_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clFinish_t(
+ cl_command_queue command_queue);
+
+typedef clFinish_t *
+clFinish_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueReadBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_read,
+ size_t offset,
+ size_t size,
+ void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReadBuffer_t *
+clEnqueueReadBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueWriteBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_write,
+ size_t offset,
+ size_t size,
+ const void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWriteBuffer_t *
+clEnqueueWriteBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueCopyBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ size_t src_offset,
+ size_t dst_offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCopyBuffer_t *
+clEnqueueCopyBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueReadImage_t(
+ cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_read,
+ const size_t* origin,
+ const size_t* region,
+ size_t row_pitch,
+ size_t slice_pitch,
+ void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReadImage_t *
+clEnqueueReadImage_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueWriteImage_t(
+ cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_write,
+ const size_t* origin,
+ const size_t* region,
+ size_t input_row_pitch,
+ size_t input_slice_pitch,
+ const void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWriteImage_t *
+clEnqueueWriteImage_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueCopyImage_t(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_image,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCopyImage_t *
+clEnqueueCopyImage_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueCopyImageToBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem src_image,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* region,
+ size_t dst_offset,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCopyImageToBuffer_t *
+clEnqueueCopyImageToBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueCopyBufferToImage_t(
+ cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_image,
+ size_t src_offset,
+ const size_t* dst_origin,
+ const size_t* region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCopyBufferToImage_t *
+clEnqueueCopyBufferToImage_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void* CL_API_CALL clEnqueueMapBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_map,
+ cl_map_flags map_flags,
+ size_t offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event,
+ cl_int* errcode_ret);
+
+typedef clEnqueueMapBuffer_t *
+clEnqueueMapBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef void* CL_API_CALL clEnqueueMapImage_t(
+ cl_command_queue command_queue,
+ cl_mem image,
+ cl_bool blocking_map,
+ cl_map_flags map_flags,
+ const size_t* origin,
+ const size_t* region,
+ size_t* image_row_pitch,
+ size_t* image_slice_pitch,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event,
+ cl_int* errcode_ret);
+
+typedef clEnqueueMapImage_t *
+clEnqueueMapImage_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueUnmapMemObject_t(
+ cl_command_queue command_queue,
+ cl_mem memobj,
+ void* mapped_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueUnmapMemObject_t *
+clEnqueueUnmapMemObject_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueNDRangeKernel_t(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint work_dim,
+ const size_t* global_work_offset,
+ const size_t* global_work_size,
+ const size_t* local_work_size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueNDRangeKernel_t *
+clEnqueueNDRangeKernel_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clEnqueueNativeKernel_t(
+ cl_command_queue command_queue,
+ void (CL_CALLBACK* user_func)(void*),
+ void* args,
+ size_t cb_args,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_list,
+ const void** args_mem_loc,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueNativeKernel_t *
+clEnqueueNativeKernel_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL clSetCommandQueueProperty_t(
+ cl_command_queue command_queue,
+ cl_command_queue_properties properties,
+ cl_bool enable,
+ cl_command_queue_properties* old_properties);
+
+typedef clSetCommandQueueProperty_t *
+clSetCommandQueueProperty_fn CL_API_SUFFIX__VERSION_1_0_DEPRECATED;
+
+typedef cl_mem CL_API_CALL clCreateImage2D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ size_t image_width,
+ size_t image_height,
+ size_t image_row_pitch,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateImage2D_t *
+clCreateImage2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_mem CL_API_CALL clCreateImage3D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ size_t image_width,
+ size_t image_height,
+ size_t image_depth,
+ size_t image_row_pitch,
+ size_t image_slice_pitch,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateImage3D_t *
+clCreateImage3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_int CL_API_CALL clEnqueueMarker_t(
+ cl_command_queue command_queue,
+ cl_event* event);
+
+typedef clEnqueueMarker_t *
+clEnqueueMarker_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_int CL_API_CALL clEnqueueWaitForEvents_t(
+ cl_command_queue command_queue,
+ cl_uint num_events,
+ const cl_event* event_list);
+
+typedef clEnqueueWaitForEvents_t *
+clEnqueueWaitForEvents_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_int CL_API_CALL clEnqueueBarrier_t(
+ cl_command_queue command_queue);
+
+typedef clEnqueueBarrier_t *
+clEnqueueBarrier_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_int CL_API_CALL clUnloadCompiler_t(
+ void );
+
+typedef clUnloadCompiler_t *
+clUnloadCompiler_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef void* CL_API_CALL clGetExtensionFunctionAddress_t(
+ const char* func_name);
+
+typedef clGetExtensionFunctionAddress_t *
+clGetExtensionFunctionAddress_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_command_queue CL_API_CALL clCreateCommandQueue_t(
+ cl_context context,
+ cl_device_id device,
+ cl_command_queue_properties properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandQueue_t *
+clCreateCommandQueue_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+typedef cl_sampler CL_API_CALL clCreateSampler_t(
+ cl_context context,
+ cl_bool normalized_coords,
+ cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode,
+ cl_int* errcode_ret);
+
+typedef clCreateSampler_t *
+clCreateSampler_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+typedef cl_int CL_API_CALL clEnqueueTask_t(
+ cl_command_queue command_queue,
+ cl_kernel kernel,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueTask_t *
+clEnqueueTask_fn CL_API_SUFFIX__VERSION_1_2_DEPRECATED;
+
+#ifdef CL_VERSION_1_1
+
+typedef cl_mem CL_API_CALL clCreateSubBuffer_t(
+ cl_mem buffer,
+ cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type,
+ const void* buffer_create_info,
+ cl_int* errcode_ret);
+
+typedef clCreateSubBuffer_t *
+clCreateSubBuffer_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clSetMemObjectDestructorCallback_t(
+ cl_mem memobj,
+ void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
+ void* user_data);
+
+typedef clSetMemObjectDestructorCallback_t *
+clSetMemObjectDestructorCallback_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_event CL_API_CALL clCreateUserEvent_t(
+ cl_context context,
+ cl_int* errcode_ret);
+
+typedef clCreateUserEvent_t *
+clCreateUserEvent_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clSetUserEventStatus_t(
+ cl_event event,
+ cl_int execution_status);
+
+typedef clSetUserEventStatus_t *
+clSetUserEventStatus_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clSetEventCallback_t(
+ cl_event event,
+ cl_int command_exec_callback_type,
+ void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data),
+ void* user_data);
+
+typedef clSetEventCallback_t *
+clSetEventCallback_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clEnqueueReadBufferRect_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_read,
+ const size_t* buffer_origin,
+ const size_t* host_origin,
+ const size_t* region,
+ size_t buffer_row_pitch,
+ size_t buffer_slice_pitch,
+ size_t host_row_pitch,
+ size_t host_slice_pitch,
+ void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReadBufferRect_t *
+clEnqueueReadBufferRect_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clEnqueueWriteBufferRect_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ cl_bool blocking_write,
+ const size_t* buffer_origin,
+ const size_t* host_origin,
+ const size_t* region,
+ size_t buffer_row_pitch,
+ size_t buffer_slice_pitch,
+ size_t host_row_pitch,
+ size_t host_slice_pitch,
+ const void* ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueWriteBufferRect_t *
+clEnqueueWriteBufferRect_fn CL_API_SUFFIX__VERSION_1_1;
+
+typedef cl_int CL_API_CALL clEnqueueCopyBufferRect_t(
+ cl_command_queue command_queue,
+ cl_mem src_buffer,
+ cl_mem dst_buffer,
+ const size_t* src_origin,
+ const size_t* dst_origin,
+ const size_t* region,
+ size_t src_row_pitch,
+ size_t src_slice_pitch,
+ size_t dst_row_pitch,
+ size_t dst_slice_pitch,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueCopyBufferRect_t *
+clEnqueueCopyBufferRect_fn CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* CL_VERSION_1_1 */
+
+#ifdef CL_VERSION_1_2
+
+typedef cl_int CL_API_CALL clCreateSubDevices_t(
+ cl_device_id in_device,
+ const cl_device_partition_property* properties,
+ cl_uint num_devices,
+ cl_device_id* out_devices,
+ cl_uint* num_devices_ret);
+
+typedef clCreateSubDevices_t *
+clCreateSubDevices_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clRetainDevice_t(
+ cl_device_id device);
+
+typedef clRetainDevice_t *
+clRetainDevice_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clReleaseDevice_t(
+ cl_device_id device);
+
+typedef clReleaseDevice_t *
+clReleaseDevice_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL clCreateImage_t(
+ cl_context context,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateImage_t *
+clCreateImage_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_t(
+ cl_context context,
+ cl_uint num_devices,
+ const cl_device_id* device_list,
+ const char* kernel_names,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithBuiltInKernels_t *
+clCreateProgramWithBuiltInKernels_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clCompileProgram_t(
+ cl_program program,
+ cl_uint num_devices,
+ const cl_device_id* device_list,
+ const char* options,
+ cl_uint num_input_headers,
+ const cl_program* input_headers,
+ const char** header_include_names,
+ void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
+ void* user_data);
+
+typedef clCompileProgram_t *
+clCompileProgram_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_program CL_API_CALL clLinkProgram_t(
+ cl_context context,
+ cl_uint num_devices,
+ const cl_device_id* device_list,
+ const char* options,
+ cl_uint num_input_programs,
+ const cl_program* input_programs,
+ void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
+ void* user_data,
+ cl_int* errcode_ret);
+
+typedef clLinkProgram_t *
+clLinkProgram_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clUnloadPlatformCompiler_t(
+ cl_platform_id platform);
+
+typedef clUnloadPlatformCompiler_t *
+clUnloadPlatformCompiler_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clGetKernelArgInfo_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ cl_kernel_arg_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelArgInfo_t *
+clGetKernelArgInfo_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clEnqueueFillBuffer_t(
+ cl_command_queue command_queue,
+ cl_mem buffer,
+ const void* pattern,
+ size_t pattern_size,
+ size_t offset,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueFillBuffer_t *
+clEnqueueFillBuffer_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clEnqueueFillImage_t(
+ cl_command_queue command_queue,
+ cl_mem image,
+ const void* fill_color,
+ const size_t* origin,
+ const size_t* region,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueFillImage_t *
+clEnqueueFillImage_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clEnqueueMigrateMemObjects_t(
+ cl_command_queue command_queue,
+ cl_uint num_mem_objects,
+ const cl_mem* mem_objects,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMigrateMemObjects_t *
+clEnqueueMigrateMemObjects_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clEnqueueMarkerWithWaitList_t(
+ cl_command_queue command_queue,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueMarkerWithWaitList_t *
+clEnqueueMarkerWithWaitList_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL clEnqueueBarrierWithWaitList_t(
+ cl_command_queue command_queue,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueBarrierWithWaitList_t *
+clEnqueueBarrierWithWaitList_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_t(
+ cl_platform_id platform,
+ const char* func_name);
+
+typedef clGetExtensionFunctionAddressForPlatform_t *
+clGetExtensionFunctionAddressForPlatform_fn CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* CL_VERSION_1_2 */
+
+#ifdef CL_VERSION_2_0
+
+typedef cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_t(
+ cl_context context,
+ cl_device_id device,
+ const cl_queue_properties* properties,
+ cl_int* errcode_ret);
+
+typedef clCreateCommandQueueWithProperties_t *
+clCreateCommandQueueWithProperties_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_mem CL_API_CALL clCreatePipe_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_uint pipe_packet_size,
+ cl_uint pipe_max_packets,
+ const cl_pipe_properties* properties,
+ cl_int* errcode_ret);
+
+typedef clCreatePipe_t *
+clCreatePipe_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clGetPipeInfo_t(
+ cl_mem pipe,
+ cl_pipe_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetPipeInfo_t *
+clGetPipeInfo_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef void* CL_API_CALL clSVMAlloc_t(
+ cl_context context,
+ cl_svm_mem_flags flags,
+ size_t size,
+ cl_uint alignment);
+
+typedef clSVMAlloc_t *
+clSVMAlloc_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef void CL_API_CALL clSVMFree_t(
+ cl_context context,
+ void* svm_pointer);
+
+typedef clSVMFree_t *
+clSVMFree_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_sampler CL_API_CALL clCreateSamplerWithProperties_t(
+ cl_context context,
+ const cl_sampler_properties* sampler_properties,
+ cl_int* errcode_ret);
+
+typedef clCreateSamplerWithProperties_t *
+clCreateSamplerWithProperties_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clSetKernelArgSVMPointer_t(
+ cl_kernel kernel,
+ cl_uint arg_index,
+ const void* arg_value);
+
+typedef clSetKernelArgSVMPointer_t *
+clSetKernelArgSVMPointer_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clSetKernelExecInfo_t(
+ cl_kernel kernel,
+ cl_kernel_exec_info param_name,
+ size_t param_value_size,
+ const void* param_value);
+
+typedef clSetKernelExecInfo_t *
+clSetKernelExecInfo_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clEnqueueSVMFree_t(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ void* svm_pointers[],
+ void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data),
+ void* user_data,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMFree_t *
+clEnqueueSVMFree_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clEnqueueSVMMemcpy_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_copy,
+ void* dst_ptr,
+ const void* src_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemcpy_t *
+clEnqueueSVMMemcpy_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clEnqueueSVMMemFill_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ const void* pattern,
+ size_t pattern_size,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMemFill_t *
+clEnqueueSVMMemFill_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clEnqueueSVMMap_t(
+ cl_command_queue command_queue,
+ cl_bool blocking_map,
+ cl_map_flags flags,
+ void* svm_ptr,
+ size_t size,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMap_t *
+clEnqueueSVMMap_fn CL_API_SUFFIX__VERSION_2_0;
+
+typedef cl_int CL_API_CALL clEnqueueSVMUnmap_t(
+ cl_command_queue command_queue,
+ void* svm_ptr,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMUnmap_t *
+clEnqueueSVMUnmap_fn CL_API_SUFFIX__VERSION_2_0;
+
+#endif /* CL_VERSION_2_0 */
+
+#ifdef CL_VERSION_2_1
+
+typedef cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_t(
+ cl_context context,
+ cl_device_id device,
+ cl_command_queue command_queue);
+
+typedef clSetDefaultDeviceCommandQueue_t *
+clSetDefaultDeviceCommandQueue_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_int CL_API_CALL clGetDeviceAndHostTimer_t(
+ cl_device_id device,
+ cl_ulong* device_timestamp,
+ cl_ulong* host_timestamp);
+
+typedef clGetDeviceAndHostTimer_t *
+clGetDeviceAndHostTimer_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_int CL_API_CALL clGetHostTimer_t(
+ cl_device_id device,
+ cl_ulong* host_timestamp);
+
+typedef clGetHostTimer_t *
+clGetHostTimer_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_program CL_API_CALL clCreateProgramWithIL_t(
+ cl_context context,
+ const void* il,
+ size_t length,
+ cl_int* errcode_ret);
+
+typedef clCreateProgramWithIL_t *
+clCreateProgramWithIL_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_kernel CL_API_CALL clCloneKernel_t(
+ cl_kernel source_kernel,
+ cl_int* errcode_ret);
+
+typedef clCloneKernel_t *
+clCloneKernel_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_int CL_API_CALL clGetKernelSubGroupInfo_t(
+ cl_kernel kernel,
+ cl_device_id device,
+ cl_kernel_sub_group_info param_name,
+ size_t input_value_size,
+ const void* input_value,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetKernelSubGroupInfo_t *
+clGetKernelSubGroupInfo_fn CL_API_SUFFIX__VERSION_2_1;
+
+typedef cl_int CL_API_CALL clEnqueueSVMMigrateMem_t(
+ cl_command_queue command_queue,
+ cl_uint num_svm_pointers,
+ const void** svm_pointers,
+ const size_t* sizes,
+ cl_mem_migration_flags flags,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueSVMMigrateMem_t *
+clEnqueueSVMMigrateMem_fn CL_API_SUFFIX__VERSION_2_1;
+
+#endif /* CL_VERSION_2_1 */
+
+#ifdef CL_VERSION_2_2
+
+typedef cl_int CL_API_CALL clSetProgramSpecializationConstant_t(
+ cl_program program,
+ cl_uint spec_id,
+ size_t spec_size,
+ const void* spec_value);
+
+typedef clSetProgramSpecializationConstant_t *
+clSetProgramSpecializationConstant_fn CL_API_SUFFIX__VERSION_2_2;
+
+typedef cl_int CL_API_CALL clSetProgramReleaseCallback_t(
+ cl_program program,
+ void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
+ void* user_data);
+
+typedef clSetProgramReleaseCallback_t *
+clSetProgramReleaseCallback_fn CL_API_SUFFIX__VERSION_2_2_DEPRECATED;
+
+#endif /* CL_VERSION_2_2 */
+
+#ifdef CL_VERSION_3_0
+
+typedef cl_int CL_API_CALL clSetContextDestructorCallback_t(
+ cl_context context,
+ void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
+ void* user_data);
+
+typedef clSetContextDestructorCallback_t *
+clSetContextDestructorCallback_fn CL_API_SUFFIX__VERSION_3_0;
+
+typedef cl_mem CL_API_CALL clCreateBufferWithProperties_t(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ size_t size,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateBufferWithProperties_t *
+clCreateBufferWithProperties_fn CL_API_SUFFIX__VERSION_3_0;
+
+typedef cl_mem CL_API_CALL clCreateImageWithProperties_t(
+ cl_context context,
+ const cl_mem_properties* properties,
+ cl_mem_flags flags,
+ const cl_image_format* image_format,
+ const cl_image_desc* image_desc,
+ void* host_ptr,
+ cl_int* errcode_ret);
+
+typedef clCreateImageWithProperties_t *
+clCreateImageWithProperties_fn CL_API_SUFFIX__VERSION_3_0;
+
+#endif /* CL_VERSION_3_0 */
+
+#endif /* OPENCL_CL_FUNCTION_TYPES_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_gl.h b/tmpl8/lib/OpenCL/inc/CL/cl_gl.h
new file mode 100644
index 0000000..552560f
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_gl.h
@@ -0,0 +1,421 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_GL_H_
+#define OPENCL_CL_GL_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_khr_gl_sharing
+***************************************************************/
+#define cl_khr_gl_sharing 1
+#define CL_KHR_GL_SHARING_EXTENSION_NAME \
+ "cl_khr_gl_sharing"
+
+
+#define CL_KHR_GL_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef int cl_GLint;
+typedef unsigned int cl_GLenum;
+typedef unsigned int cl_GLuint;
+
+typedef cl_uint cl_gl_context_info;
+
+/* Error codes */
+#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
+
+/* cl_gl_context_info */
+#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
+#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
+
+/* Additional cl_context_properties */
+#define CL_GL_CONTEXT_KHR 0x2008
+#define CL_EGL_DISPLAY_KHR 0x2009
+#define CL_GLX_DISPLAY_KHR 0x200A
+#define CL_WGL_HDC_KHR 0x200B
+#define CL_CGL_SHAREGROUP_KHR 0x200C
+
+typedef cl_uint cl_gl_object_type;
+typedef cl_uint cl_gl_texture_info;
+typedef cl_uint cl_gl_platform_info;
+
+/* cl_gl_object_type */
+#define CL_GL_OBJECT_BUFFER 0x2000
+#define CL_GL_OBJECT_TEXTURE2D 0x2001
+#define CL_GL_OBJECT_TEXTURE3D 0x2002
+#define CL_GL_OBJECT_RENDERBUFFER 0x2003
+
+#if defined(CL_VERSION_1_2)
+/* cl_gl_object_type */
+#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E
+#define CL_GL_OBJECT_TEXTURE1D 0x200F
+#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010
+#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011
+
+#endif /* defined(CL_VERSION_1_2) */
+
+/* cl_gl_texture_info */
+#define CL_GL_TEXTURE_TARGET 0x2004
+#define CL_GL_MIPMAP_LEVEL 0x2005
+
+
+typedef cl_int CL_API_CALL
+clGetGLContextInfoKHR_t(
+ const cl_context_properties* properties,
+ cl_gl_context_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetGLContextInfoKHR_t *
+clGetGLContextInfoKHR_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLBuffer_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLBuffer_t *
+clCreateFromGLBuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLContextInfoKHR(
+ const cl_context_properties* properties,
+ cl_gl_context_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLBuffer(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint bufobj,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#if defined(CL_VERSION_1_2)
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture_t *
+clCreateFromGLTexture_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#endif /* defined(CL_VERSION_1_2) */
+
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint renderbuffer,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLRenderbuffer_t *
+clCreateFromGLRenderbuffer_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clGetGLObjectInfo_t(
+ cl_mem memobj,
+ cl_gl_object_type* gl_object_type,
+ cl_GLuint* gl_object_name);
+
+typedef clGetGLObjectInfo_t *
+clGetGLObjectInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clGetGLTextureInfo_t(
+ cl_mem memobj,
+ cl_gl_texture_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetGLTextureInfo_t *
+clGetGLTextureInfo_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireGLObjects_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireGLObjects_t *
+clEnqueueAcquireGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseGLObjects_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseGLObjects_t *
+clEnqueueReleaseGLObjects_fn CL_API_SUFFIX__VERSION_1_0;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLuint renderbuffer,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLObjectInfo(
+ cl_mem memobj,
+ cl_gl_object_type* gl_object_type,
+ cl_GLuint* gl_object_name) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLTextureInfo(
+ cl_mem memobj,
+ cl_gl_texture_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGLObjects(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGLObjects(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_0;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/* OpenCL 1.0 APIs that were deprecated in OpenCL 1.2 */
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture2D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture2D_t *
+clCreateFromGLTexture2D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+typedef cl_mem CL_API_CALL
+clCreateFromGLTexture3D_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret);
+
+typedef clCreateFromGLTexture3D_t *
+clCreateFromGLTexture3D_fn CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture2D(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture3D(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_GLenum target,
+ cl_GLint miplevel,
+ cl_GLuint texture,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_gl_event
+***************************************************************/
+#define cl_khr_gl_event 1
+#define CL_KHR_GL_EVENT_EXTENSION_NAME \
+ "cl_khr_gl_event"
+
+
+#define CL_KHR_GL_EVENT_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef struct __GLsync * cl_GLsync;
+
+/* cl_command_type */
+#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
+
+
+typedef cl_event CL_API_CALL
+clCreateEventFromGLsyncKHR_t(
+ cl_context context,
+ cl_GLsync sync,
+ cl_int* errcode_ret);
+
+typedef clCreateEventFromGLsyncKHR_t *
+clCreateEventFromGLsyncKHR_fn CL_API_SUFFIX__VERSION_1_1;
+
+#if !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateEventFromGLsyncKHR(
+ cl_context context,
+ cl_GLsync sync,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_1;
+
+#endif /* !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_khr_gl_depth_images
+***************************************************************/
+#define cl_khr_gl_depth_images 1
+#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_NAME \
+ "cl_khr_gl_depth_images"
+
+
+#define CL_KHR_GL_DEPTH_IMAGES_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_channel_order */
+#define CL_DEPTH_STENCIL 0x10BE
+
+/* cl_channel_type */
+#define CL_UNORM_INT24 0x10DF
+
+/***************************************************************
+* cl_khr_gl_msaa_sharing
+***************************************************************/
+#define cl_khr_gl_msaa_sharing 1
+#define CL_KHR_GL_MSAA_SHARING_EXTENSION_NAME \
+ "cl_khr_gl_msaa_sharing"
+
+
+#define CL_KHR_GL_MSAA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+/* cl_gl_texture_info */
+#define CL_GL_NUM_SAMPLES 0x2012
+
+/***************************************************************
+* cl_intel_sharing_format_query_gl
+***************************************************************/
+#define cl_intel_sharing_format_query_gl 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_gl"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_GL_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_khr_gl_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedGLTextureFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_GLenum* gl_formats,
+ cl_uint* num_texture_formats);
+
+typedef clGetSupportedGLTextureFormatsINTEL_t *
+clGetSupportedGLTextureFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedGLTextureFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint num_entries,
+ cl_GLenum* gl_formats,
+ cl_uint* num_texture_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_GL_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_gl_ext.h b/tmpl8/lib/OpenCL/inc/CL/cl_gl_ext.h
new file mode 100644
index 0000000..b5da13e
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_gl_ext.h
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2021 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#include
+#pragma message("The extensions in cl_gl_ext.h have been moved into cl_gl.h. Please include cl_gl.h directly.")
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_half.h b/tmpl8/lib/OpenCL/inc/CL/cl_half.h
new file mode 100644
index 0000000..ecc4223
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_half.h
@@ -0,0 +1,440 @@
+/*******************************************************************************
+ * Copyright (c) 2019-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+/**
+ * This is a header-only utility library that provides OpenCL host code with
+ * routines for converting to/from cl_half values.
+ *
+ * Example usage:
+ *
+ * #include
+ * ...
+ * cl_half h = cl_half_from_float(0.5f, CL_HALF_RTE);
+ * cl_float f = cl_half_to_float(h);
+ */
+
+#ifndef OPENCL_CL_HALF_H
+#define OPENCL_CL_HALF_H
+
+#include
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * Rounding mode used when converting to cl_half.
+ */
+typedef enum
+{
+ CL_HALF_RTE, // round to nearest even
+ CL_HALF_RTZ, // round towards zero
+ CL_HALF_RTP, // round towards positive infinity
+ CL_HALF_RTN, // round towards negative infinity
+} cl_half_rounding_mode;
+
+
+/* Private utility macros. */
+#define CL_HALF_EXP_MASK 0x7C00
+#define CL_HALF_MAX_FINITE_MAG 0x7BFF
+
+
+/*
+ * Utility to deal with values that overflow when converting to half precision.
+ */
+static inline cl_half cl_half_handle_overflow(cl_half_rounding_mode rounding_mode,
+ uint16_t sign)
+{
+ if (rounding_mode == CL_HALF_RTZ)
+ {
+ // Round overflow towards zero -> largest finite number (preserving sign)
+ return (sign << 15) | CL_HALF_MAX_FINITE_MAG;
+ }
+ else if (rounding_mode == CL_HALF_RTP && sign)
+ {
+ // Round negative overflow towards positive infinity -> most negative finite number
+ return (1 << 15) | CL_HALF_MAX_FINITE_MAG;
+ }
+ else if (rounding_mode == CL_HALF_RTN && !sign)
+ {
+ // Round positive overflow towards negative infinity -> largest finite number
+ return CL_HALF_MAX_FINITE_MAG;
+ }
+
+ // Overflow to infinity
+ return (sign << 15) | CL_HALF_EXP_MASK;
+}
+
+/*
+ * Utility to deal with values that underflow when converting to half precision.
+ */
+static inline cl_half cl_half_handle_underflow(cl_half_rounding_mode rounding_mode,
+ uint16_t sign)
+{
+ if (rounding_mode == CL_HALF_RTP && !sign)
+ {
+ // Round underflow towards positive infinity -> smallest positive value
+ return (sign << 15) | 1;
+ }
+ else if (rounding_mode == CL_HALF_RTN && sign)
+ {
+ // Round underflow towards negative infinity -> largest negative value
+ return (sign << 15) | 1;
+ }
+
+ // Flush to zero
+ return (sign << 15);
+}
+
+
+/**
+ * Convert a cl_float to a cl_half.
+ */
+static inline cl_half cl_half_from_float(cl_float f, cl_half_rounding_mode rounding_mode)
+{
+ // Type-punning to get direct access to underlying bits
+ union
+ {
+ cl_float f;
+ uint32_t i;
+ } f32;
+ f32.f = f;
+
+ // Extract sign bit
+ uint16_t sign = f32.i >> 31;
+
+ // Extract FP32 exponent and mantissa
+ uint32_t f_exp = (f32.i >> (CL_FLT_MANT_DIG - 1)) & 0xFF;
+ uint32_t f_mant = f32.i & ((1 << (CL_FLT_MANT_DIG - 1)) - 1);
+
+ // Remove FP32 exponent bias
+ int32_t exp = f_exp - CL_FLT_MAX_EXP + 1;
+
+ // Add FP16 exponent bias
+ uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
+
+ // Position of the bit that will become the FP16 mantissa LSB
+ uint32_t lsb_pos = CL_FLT_MANT_DIG - CL_HALF_MANT_DIG;
+
+ // Check for NaN / infinity
+ if (f_exp == 0xFF)
+ {
+ if (f_mant)
+ {
+ // NaN -> propagate mantissa and silence it
+ uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
+ h_mant |= 0x200;
+ return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
+ }
+ else
+ {
+ // Infinity -> zero mantissa
+ return (sign << 15) | CL_HALF_EXP_MASK;
+ }
+ }
+
+ // Check for zero
+ if (!f_exp && !f_mant)
+ {
+ return (sign << 15);
+ }
+
+ // Check for overflow
+ if (exp >= CL_HALF_MAX_EXP)
+ {
+ return cl_half_handle_overflow(rounding_mode, sign);
+ }
+
+ // Check for underflow
+ if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1))
+ {
+ return cl_half_handle_underflow(rounding_mode, sign);
+ }
+
+ // Check for value that will become denormal
+ if (exp < -14)
+ {
+ // Denormal -> include the implicit 1 from the FP32 mantissa
+ h_exp = 0;
+ f_mant |= 1 << (CL_FLT_MANT_DIG - 1);
+
+ // Mantissa shift amount depends on exponent
+ lsb_pos = -exp + (CL_FLT_MANT_DIG - 25);
+ }
+
+ // Generate FP16 mantissa by shifting FP32 mantissa
+ uint16_t h_mant = (uint16_t)(f_mant >> lsb_pos);
+
+ // Check whether we need to round
+ uint32_t halfway = 1 << (lsb_pos - 1);
+ uint32_t mask = (halfway << 1) - 1;
+ switch (rounding_mode)
+ {
+ case CL_HALF_RTE:
+ if ((f_mant & mask) > halfway)
+ {
+ // More than halfway -> round up
+ h_mant += 1;
+ }
+ else if ((f_mant & mask) == halfway)
+ {
+ // Exactly halfway -> round to nearest even
+ if (h_mant & 0x1)
+ h_mant += 1;
+ }
+ break;
+ case CL_HALF_RTZ:
+ // Mantissa has already been truncated -> do nothing
+ break;
+ case CL_HALF_RTP:
+ if ((f_mant & mask) && !sign)
+ {
+ // Round positive numbers up
+ h_mant += 1;
+ }
+ break;
+ case CL_HALF_RTN:
+ if ((f_mant & mask) && sign)
+ {
+ // Round negative numbers down
+ h_mant += 1;
+ }
+ break;
+ }
+
+ // Check for mantissa overflow
+ if (h_mant & 0x400)
+ {
+ h_exp += 1;
+ h_mant = 0;
+ }
+
+ return (sign << 15) | (h_exp << 10) | h_mant;
+}
+
+
+/**
+ * Convert a cl_double to a cl_half.
+ */
+static inline cl_half cl_half_from_double(cl_double d, cl_half_rounding_mode rounding_mode)
+{
+ // Type-punning to get direct access to underlying bits
+ union
+ {
+ cl_double d;
+ uint64_t i;
+ } f64;
+ f64.d = d;
+
+ // Extract sign bit
+ uint16_t sign = f64.i >> 63;
+
+ // Extract FP64 exponent and mantissa
+ uint64_t d_exp = (f64.i >> (CL_DBL_MANT_DIG - 1)) & 0x7FF;
+ uint64_t d_mant = f64.i & (((uint64_t)1 << (CL_DBL_MANT_DIG - 1)) - 1);
+
+ // Remove FP64 exponent bias
+ int64_t exp = d_exp - CL_DBL_MAX_EXP + 1;
+
+ // Add FP16 exponent bias
+ uint16_t h_exp = (uint16_t)(exp + CL_HALF_MAX_EXP - 1);
+
+ // Position of the bit that will become the FP16 mantissa LSB
+ uint32_t lsb_pos = CL_DBL_MANT_DIG - CL_HALF_MANT_DIG;
+
+ // Check for NaN / infinity
+ if (d_exp == 0x7FF)
+ {
+ if (d_mant)
+ {
+ // NaN -> propagate mantissa and silence it
+ uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
+ h_mant |= 0x200;
+ return (sign << 15) | CL_HALF_EXP_MASK | h_mant;
+ }
+ else
+ {
+ // Infinity -> zero mantissa
+ return (sign << 15) | CL_HALF_EXP_MASK;
+ }
+ }
+
+ // Check for zero
+ if (!d_exp && !d_mant)
+ {
+ return (sign << 15);
+ }
+
+ // Check for overflow
+ if (exp >= CL_HALF_MAX_EXP)
+ {
+ return cl_half_handle_overflow(rounding_mode, sign);
+ }
+
+ // Check for underflow
+ if (exp < (CL_HALF_MIN_EXP - CL_HALF_MANT_DIG - 1))
+ {
+ return cl_half_handle_underflow(rounding_mode, sign);
+ }
+
+ // Check for value that will become denormal
+ if (exp < -14)
+ {
+ // Include the implicit 1 from the FP64 mantissa
+ h_exp = 0;
+ d_mant |= (uint64_t)1 << (CL_DBL_MANT_DIG - 1);
+
+ // Mantissa shift amount depends on exponent
+ lsb_pos = (uint32_t)(-exp + (CL_DBL_MANT_DIG - 25));
+ }
+
+ // Generate FP16 mantissa by shifting FP64 mantissa
+ uint16_t h_mant = (uint16_t)(d_mant >> lsb_pos);
+
+ // Check whether we need to round
+ uint64_t halfway = (uint64_t)1 << (lsb_pos - 1);
+ uint64_t mask = (halfway << 1) - 1;
+ switch (rounding_mode)
+ {
+ case CL_HALF_RTE:
+ if ((d_mant & mask) > halfway)
+ {
+ // More than halfway -> round up
+ h_mant += 1;
+ }
+ else if ((d_mant & mask) == halfway)
+ {
+ // Exactly halfway -> round to nearest even
+ if (h_mant & 0x1)
+ h_mant += 1;
+ }
+ break;
+ case CL_HALF_RTZ:
+ // Mantissa has already been truncated -> do nothing
+ break;
+ case CL_HALF_RTP:
+ if ((d_mant & mask) && !sign)
+ {
+ // Round positive numbers up
+ h_mant += 1;
+ }
+ break;
+ case CL_HALF_RTN:
+ if ((d_mant & mask) && sign)
+ {
+ // Round negative numbers down
+ h_mant += 1;
+ }
+ break;
+ }
+
+ // Check for mantissa overflow
+ if (h_mant & 0x400)
+ {
+ h_exp += 1;
+ h_mant = 0;
+ }
+
+ return (sign << 15) | (h_exp << 10) | h_mant;
+}
+
+
+/**
+ * Convert a cl_half to a cl_float.
+ */
+static inline cl_float cl_half_to_float(cl_half h)
+{
+ // Type-punning to get direct access to underlying bits
+ union
+ {
+ cl_float f;
+ uint32_t i;
+ } f32;
+
+ // Extract sign bit
+ uint16_t sign = h >> 15;
+
+ // Extract FP16 exponent and mantissa
+ uint16_t h_exp = (h >> (CL_HALF_MANT_DIG - 1)) & 0x1F;
+ uint16_t h_mant = h & 0x3FF;
+
+ // Remove FP16 exponent bias
+ int32_t exp = h_exp - CL_HALF_MAX_EXP + 1;
+
+ // Add FP32 exponent bias
+ uint32_t f_exp = exp + CL_FLT_MAX_EXP - 1;
+
+ // Check for NaN / infinity
+ if (h_exp == 0x1F)
+ {
+ if (h_mant)
+ {
+ // NaN -> propagate mantissa and silence it
+ uint32_t f_mant = h_mant << (CL_FLT_MANT_DIG - CL_HALF_MANT_DIG);
+ f_mant |= 0x400000;
+ f32.i = (sign << 31) | 0x7F800000 | f_mant;
+ return f32.f;
+ }
+ else
+ {
+ // Infinity -> zero mantissa
+ f32.i = (sign << 31) | 0x7F800000;
+ return f32.f;
+ }
+ }
+
+ // Check for zero / denormal
+ if (h_exp == 0)
+ {
+ if (h_mant == 0)
+ {
+ // Zero -> zero exponent
+ f_exp = 0;
+ }
+ else
+ {
+ // Denormal -> normalize it
+ // - Shift mantissa to make most-significant 1 implicit
+ // - Adjust exponent accordingly
+ uint32_t shift = 0;
+ while ((h_mant & 0x400) == 0)
+ {
+ h_mant <<= 1;
+ shift++;
+ }
+ h_mant &= 0x3FF;
+ f_exp -= shift - 1;
+ }
+ }
+
+ f32.i = (sign << 31) | (f_exp << 23) | (h_mant << 13);
+ return f32.f;
+}
+
+
+#undef CL_HALF_EXP_MASK
+#undef CL_HALF_MAX_FINITE_MAG
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* OPENCL_CL_HALF_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_icd.h b/tmpl8/lib/OpenCL/inc/CL/cl_icd.h
new file mode 100644
index 0000000..435ad48
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_icd.h
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2019-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_ICD_H
+#define OPENCL_CL_ICD_H
+
+#include
+#include
+#include
+#include
+#include
+
+#if defined(_WIN32)
+#include
+#include
+#include
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Vendor dispatch table structure */
+
+typedef struct _cl_icd_dispatch {
+ /* OpenCL 1.0 */
+ clGetPlatformIDs_t *clGetPlatformIDs;
+ clGetPlatformInfo_t *clGetPlatformInfo;
+ clGetDeviceIDs_t *clGetDeviceIDs;
+ clGetDeviceInfo_t *clGetDeviceInfo;
+ clCreateContext_t *clCreateContext;
+ clCreateContextFromType_t *clCreateContextFromType;
+ clRetainContext_t *clRetainContext;
+ clReleaseContext_t *clReleaseContext;
+ clGetContextInfo_t *clGetContextInfo;
+ clCreateCommandQueue_t *clCreateCommandQueue;
+ clRetainCommandQueue_t *clRetainCommandQueue;
+ clReleaseCommandQueue_t *clReleaseCommandQueue;
+ clGetCommandQueueInfo_t *clGetCommandQueueInfo;
+ clSetCommandQueueProperty_t *clSetCommandQueueProperty;
+ clCreateBuffer_t *clCreateBuffer;
+ clCreateImage2D_t *clCreateImage2D;
+ clCreateImage3D_t *clCreateImage3D;
+ clRetainMemObject_t *clRetainMemObject;
+ clReleaseMemObject_t *clReleaseMemObject;
+ clGetSupportedImageFormats_t *clGetSupportedImageFormats;
+ clGetMemObjectInfo_t *clGetMemObjectInfo;
+ clGetImageInfo_t *clGetImageInfo;
+ clCreateSampler_t *clCreateSampler;
+ clRetainSampler_t *clRetainSampler;
+ clReleaseSampler_t *clReleaseSampler;
+ clGetSamplerInfo_t *clGetSamplerInfo;
+ clCreateProgramWithSource_t *clCreateProgramWithSource;
+ clCreateProgramWithBinary_t *clCreateProgramWithBinary;
+ clRetainProgram_t *clRetainProgram;
+ clReleaseProgram_t *clReleaseProgram;
+ clBuildProgram_t *clBuildProgram;
+ clUnloadCompiler_t *clUnloadCompiler;
+ clGetProgramInfo_t *clGetProgramInfo;
+ clGetProgramBuildInfo_t *clGetProgramBuildInfo;
+ clCreateKernel_t *clCreateKernel;
+ clCreateKernelsInProgram_t *clCreateKernelsInProgram;
+ clRetainKernel_t *clRetainKernel;
+ clReleaseKernel_t *clReleaseKernel;
+ clSetKernelArg_t *clSetKernelArg;
+ clGetKernelInfo_t *clGetKernelInfo;
+ clGetKernelWorkGroupInfo_t *clGetKernelWorkGroupInfo;
+ clWaitForEvents_t *clWaitForEvents;
+ clGetEventInfo_t *clGetEventInfo;
+ clRetainEvent_t *clRetainEvent;
+ clReleaseEvent_t *clReleaseEvent;
+ clGetEventProfilingInfo_t *clGetEventProfilingInfo;
+ clFlush_t *clFlush;
+ clFinish_t *clFinish;
+ clEnqueueReadBuffer_t *clEnqueueReadBuffer;
+ clEnqueueWriteBuffer_t *clEnqueueWriteBuffer;
+ clEnqueueCopyBuffer_t *clEnqueueCopyBuffer;
+ clEnqueueReadImage_t *clEnqueueReadImage;
+ clEnqueueWriteImage_t *clEnqueueWriteImage;
+ clEnqueueCopyImage_t *clEnqueueCopyImage;
+ clEnqueueCopyImageToBuffer_t *clEnqueueCopyImageToBuffer;
+ clEnqueueCopyBufferToImage_t *clEnqueueCopyBufferToImage;
+ clEnqueueMapBuffer_t *clEnqueueMapBuffer;
+ clEnqueueMapImage_t *clEnqueueMapImage;
+ clEnqueueUnmapMemObject_t *clEnqueueUnmapMemObject;
+ clEnqueueNDRangeKernel_t *clEnqueueNDRangeKernel;
+ clEnqueueTask_t *clEnqueueTask;
+ clEnqueueNativeKernel_t *clEnqueueNativeKernel;
+ clEnqueueMarker_t *clEnqueueMarker;
+ clEnqueueWaitForEvents_t *clEnqueueWaitForEvents;
+ clEnqueueBarrier_t *clEnqueueBarrier;
+ clGetExtensionFunctionAddress_t *clGetExtensionFunctionAddress;
+ clCreateFromGLBuffer_t *clCreateFromGLBuffer;
+ clCreateFromGLTexture2D_t *clCreateFromGLTexture2D;
+ clCreateFromGLTexture3D_t *clCreateFromGLTexture3D;
+ clCreateFromGLRenderbuffer_t *clCreateFromGLRenderbuffer;
+ clGetGLObjectInfo_t *clGetGLObjectInfo;
+ clGetGLTextureInfo_t *clGetGLTextureInfo;
+ clEnqueueAcquireGLObjects_t *clEnqueueAcquireGLObjects;
+ clEnqueueReleaseGLObjects_t *clEnqueueReleaseGLObjects;
+ clGetGLContextInfoKHR_t *clGetGLContextInfoKHR;
+
+ /* cl_khr_d3d10_sharing */
+#ifdef _WIN32
+ clGetDeviceIDsFromD3D10KHR_t *clGetDeviceIDsFromD3D10KHR;
+ clCreateFromD3D10BufferKHR_t *clCreateFromD3D10BufferKHR;
+ clCreateFromD3D10Texture2DKHR_t *clCreateFromD3D10Texture2DKHR;
+ clCreateFromD3D10Texture3DKHR_t *clCreateFromD3D10Texture3DKHR;
+ clEnqueueAcquireD3D10ObjectsKHR_t *clEnqueueAcquireD3D10ObjectsKHR;
+ clEnqueueReleaseD3D10ObjectsKHR_t *clEnqueueReleaseD3D10ObjectsKHR;
+#else
+ void *clGetDeviceIDsFromD3D10KHR;
+ void *clCreateFromD3D10BufferKHR;
+ void *clCreateFromD3D10Texture2DKHR;
+ void *clCreateFromD3D10Texture3DKHR;
+ void *clEnqueueAcquireD3D10ObjectsKHR;
+ void *clEnqueueReleaseD3D10ObjectsKHR;
+#endif
+
+ /* OpenCL 1.1 */
+#ifdef CL_VERSION_1_1
+ clSetEventCallback_t *clSetEventCallback;
+ clCreateSubBuffer_t *clCreateSubBuffer;
+ clSetMemObjectDestructorCallback_t *clSetMemObjectDestructorCallback;
+ clCreateUserEvent_t *clCreateUserEvent;
+ clSetUserEventStatus_t *clSetUserEventStatus;
+ clEnqueueReadBufferRect_t *clEnqueueReadBufferRect;
+ clEnqueueWriteBufferRect_t *clEnqueueWriteBufferRect;
+ clEnqueueCopyBufferRect_t *clEnqueueCopyBufferRect;
+#else
+ void *clSetEventCallback;
+ void *clCreateSubBuffer;
+ void *clSetMemObjectDestructorCallback;
+ void *clCreateUserEvent;
+ void *clSetUserEventStatus;
+ void *clEnqueueReadBufferRect;
+ void *clEnqueueWriteBufferRect;
+ void *clEnqueueCopyBufferRect;
+#endif
+
+ /* cl_ext_device_fission */
+ clCreateSubDevicesEXT_t *clCreateSubDevicesEXT;
+ clRetainDeviceEXT_t *clRetainDeviceEXT;
+ clReleaseDeviceEXT_t *clReleaseDeviceEXT;
+
+ /* cl_khr_gl_event */
+ clCreateEventFromGLsyncKHR_t *clCreateEventFromGLsyncKHR;
+
+ /* OpenCL 1.2 */
+#ifdef CL_VERSION_1_2
+ clCreateSubDevices_t *clCreateSubDevices;
+ clRetainDevice_t *clRetainDevice;
+ clReleaseDevice_t *clReleaseDevice;
+ clCreateImage_t *clCreateImage;
+ clCreateProgramWithBuiltInKernels_t *clCreateProgramWithBuiltInKernels;
+ clCompileProgram_t *clCompileProgram;
+ clLinkProgram_t *clLinkProgram;
+ clUnloadPlatformCompiler_t *clUnloadPlatformCompiler;
+ clGetKernelArgInfo_t *clGetKernelArgInfo;
+ clEnqueueFillBuffer_t *clEnqueueFillBuffer;
+ clEnqueueFillImage_t *clEnqueueFillImage;
+ clEnqueueMigrateMemObjects_t *clEnqueueMigrateMemObjects;
+ clEnqueueMarkerWithWaitList_t *clEnqueueMarkerWithWaitList;
+ clEnqueueBarrierWithWaitList_t *clEnqueueBarrierWithWaitList;
+ clGetExtensionFunctionAddressForPlatform_t *
+ clGetExtensionFunctionAddressForPlatform;
+ clCreateFromGLTexture_t *clCreateFromGLTexture;
+#else
+ void *clCreateSubDevices;
+ void *clRetainDevice;
+ void *clReleaseDevice;
+ void *clCreateImage;
+ void *clCreateProgramWithBuiltInKernels;
+ void *clCompileProgram;
+ void *clLinkProgram;
+ void *clUnloadPlatformCompiler;
+ void *clGetKernelArgInfo;
+ void *clEnqueueFillBuffer;
+ void *clEnqueueFillImage;
+ void *clEnqueueMigrateMemObjects;
+ void *clEnqueueMarkerWithWaitList;
+ void *clEnqueueBarrierWithWaitList;
+ void *clGetExtensionFunctionAddressForPlatform;
+ void *clCreateFromGLTexture;
+#endif
+
+ /* cl_khr_d3d11_sharing and cl_khr_dx9_media_sharing */
+#ifdef _WIN32
+ clGetDeviceIDsFromD3D11KHR_t *clGetDeviceIDsFromD3D11KHR;
+ clCreateFromD3D11BufferKHR_t *clCreateFromD3D11BufferKHR;
+ clCreateFromD3D11Texture2DKHR_t *clCreateFromD3D11Texture2DKHR;
+ clCreateFromD3D11Texture3DKHR_t *clCreateFromD3D11Texture3DKHR;
+ clCreateFromDX9MediaSurfaceKHR_t *clCreateFromDX9MediaSurfaceKHR;
+ clEnqueueAcquireD3D11ObjectsKHR_t *clEnqueueAcquireD3D11ObjectsKHR;
+ clEnqueueReleaseD3D11ObjectsKHR_t *clEnqueueReleaseD3D11ObjectsKHR;
+ clGetDeviceIDsFromDX9MediaAdapterKHR_t *
+ clGetDeviceIDsFromDX9MediaAdapterKHR;
+ clEnqueueAcquireDX9MediaSurfacesKHR_t *
+ clEnqueueAcquireDX9MediaSurfacesKHR;
+ clEnqueueReleaseDX9MediaSurfacesKHR_t *
+ clEnqueueReleaseDX9MediaSurfacesKHR;
+#else
+ void *clGetDeviceIDsFromD3D11KHR;
+ void *clCreateFromD3D11BufferKHR;
+ void *clCreateFromD3D11Texture2DKHR;
+ void *clCreateFromD3D11Texture3DKHR;
+ void *clCreateFromDX9MediaSurfaceKHR;
+ void *clEnqueueAcquireD3D11ObjectsKHR;
+ void *clEnqueueReleaseD3D11ObjectsKHR;
+ void *clGetDeviceIDsFromDX9MediaAdapterKHR;
+ void *clEnqueueAcquireDX9MediaSurfacesKHR;
+ void *clEnqueueReleaseDX9MediaSurfacesKHR;
+#endif
+
+ /* cl_khr_egl_image */
+ clCreateFromEGLImageKHR_t *clCreateFromEGLImageKHR;
+ clEnqueueAcquireEGLObjectsKHR_t *clEnqueueAcquireEGLObjectsKHR;
+ clEnqueueReleaseEGLObjectsKHR_t *clEnqueueReleaseEGLObjectsKHR;
+
+ /* cl_khr_egl_event */
+ clCreateEventFromEGLSyncKHR_t *clCreateEventFromEGLSyncKHR;
+
+ /* OpenCL 2.0 */
+#ifdef CL_VERSION_2_0
+ clCreateCommandQueueWithProperties_t *clCreateCommandQueueWithProperties;
+ clCreatePipe_t *clCreatePipe;
+ clGetPipeInfo_t *clGetPipeInfo;
+ clSVMAlloc_t *clSVMAlloc;
+ clSVMFree_t *clSVMFree;
+ clEnqueueSVMFree_t *clEnqueueSVMFree;
+ clEnqueueSVMMemcpy_t *clEnqueueSVMMemcpy;
+ clEnqueueSVMMemFill_t *clEnqueueSVMMemFill;
+ clEnqueueSVMMap_t *clEnqueueSVMMap;
+ clEnqueueSVMUnmap_t *clEnqueueSVMUnmap;
+ clCreateSamplerWithProperties_t *clCreateSamplerWithProperties;
+ clSetKernelArgSVMPointer_t *clSetKernelArgSVMPointer;
+ clSetKernelExecInfo_t *clSetKernelExecInfo;
+#else
+ void *clCreateCommandQueueWithProperties;
+ void *clCreatePipe;
+ void *clGetPipeInfo;
+ void *clSVMAlloc;
+ void *clSVMFree;
+ void *clEnqueueSVMFree;
+ void *clEnqueueSVMMemcpy;
+ void *clEnqueueSVMMemFill;
+ void *clEnqueueSVMMap;
+ void *clEnqueueSVMUnmap;
+ void *clCreateSamplerWithProperties;
+ void *clSetKernelArgSVMPointer;
+ void *clSetKernelExecInfo;
+#endif
+
+ /* cl_khr_sub_groups */
+ clGetKernelSubGroupInfoKHR_t *clGetKernelSubGroupInfoKHR;
+
+ /* OpenCL 2.1 */
+#ifdef CL_VERSION_2_1
+ clCloneKernel_t *clCloneKernel;
+ clCreateProgramWithIL_t *clCreateProgramWithIL;
+ clEnqueueSVMMigrateMem_t *clEnqueueSVMMigrateMem;
+ clGetDeviceAndHostTimer_t *clGetDeviceAndHostTimer;
+ clGetHostTimer_t *clGetHostTimer;
+ clGetKernelSubGroupInfo_t *clGetKernelSubGroupInfo;
+ clSetDefaultDeviceCommandQueue_t *clSetDefaultDeviceCommandQueue;
+#else
+ void *clCloneKernel;
+ void *clCreateProgramWithIL;
+ void *clEnqueueSVMMigrateMem;
+ void *clGetDeviceAndHostTimer;
+ void *clGetHostTimer;
+ void *clGetKernelSubGroupInfo;
+ void *clSetDefaultDeviceCommandQueue;
+#endif
+
+ /* OpenCL 2.2 */
+#ifdef CL_VERSION_2_2
+ clSetProgramReleaseCallback_t *clSetProgramReleaseCallback;
+ clSetProgramSpecializationConstant_t *clSetProgramSpecializationConstant;
+#else
+ void *clSetProgramReleaseCallback;
+ void *clSetProgramSpecializationConstant;
+#endif
+
+ /* OpenCL 3.0 */
+#ifdef CL_VERSION_3_0
+ clCreateBufferWithProperties_t *clCreateBufferWithProperties;
+ clCreateImageWithProperties_t *clCreateImageWithProperties;
+ clSetContextDestructorCallback_t *clSetContextDestructorCallback;
+#else
+ void *clCreateBufferWithProperties;
+ void *clCreateImageWithProperties;
+ void *clSetContextDestructorCallback;
+#endif
+
+} cl_icd_dispatch;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* #ifndef OPENCL_CL_ICD_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_layer.h b/tmpl8/lib/OpenCL/inc/CL/cl_layer.h
new file mode 100644
index 0000000..245f7b5
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_layer.h
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_LAYER_H_
+#define OPENCL_CL_LAYER_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_loader_layers
+***************************************************************/
+#define cl_loader_layers 1
+#define CL_LOADER_LAYERS_EXTENSION_NAME \
+ "cl_loader_layers"
+
+
+#define CL_LOADER_LAYERS_EXTENSION_VERSION CL_MAKE_VERSION(1, 0, 0)
+
+typedef cl_uint cl_layer_info;
+typedef cl_uint cl_layer_api_version;
+
+/* cl_layer_info */
+#define CL_LAYER_API_VERSION 0x4240
+#define CL_LAYER_NAME 0x4241
+
+/* Misc API enums */
+#define CL_LAYER_API_VERSION_100 100
+
+
+typedef cl_int CL_API_CALL
+clGetLayerInfo_t(
+ cl_layer_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret);
+
+typedef clGetLayerInfo_t *
+clGetLayerInfo_fn ;
+
+typedef cl_int CL_API_CALL
+clInitLayer_t(
+ cl_uint num_entries,
+ const cl_icd_dispatch* target_dispatch,
+ cl_uint* num_entries_ret,
+ const cl_icd_dispatch** layer_dispatch_ret);
+
+typedef clInitLayer_t *
+clInitLayer_fn ;
+
+/*
+** The function pointer typedefs prefixed with "pfn_" are provided for
+** compatibility with earlier versions of the headers. New code is
+** encouraged to use the function pointer typedefs that are suffixed with
+** "_fn" instead, for consistency.
+*/
+
+typedef clGetLayerInfo_t *
+pfn_clGetLayerInfo ;
+
+typedef clInitLayer_t *
+pfn_clInitLayer ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetLayerInfo(
+ cl_layer_info param_name,
+ size_t param_value_size,
+ void* param_value,
+ size_t* param_value_size_ret) ;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clInitLayer(
+ cl_uint num_entries,
+ const cl_icd_dispatch* target_dispatch,
+ cl_uint* num_entries_ret,
+ const cl_icd_dispatch** layer_dispatch_ret) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_LAYER_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_platform.h b/tmpl8/lib/OpenCL/inc/CL/cl_platform.h
new file mode 100644
index 0000000..5f92d6f
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_platform.h
@@ -0,0 +1,1407 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef __CL_PLATFORM_H
+#define __CL_PLATFORM_H
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_WIN32)
+ #if !defined(CL_API_ENTRY)
+ #define CL_API_ENTRY
+ #endif
+ #if !defined(CL_API_CALL)
+ #define CL_API_CALL __stdcall
+ #endif
+ #if !defined(CL_CALLBACK)
+ #define CL_CALLBACK __stdcall
+ #endif
+#else
+ #if !defined(CL_API_ENTRY)
+ #define CL_API_ENTRY
+ #endif
+ #if !defined(CL_API_CALL)
+ #define CL_API_CALL
+ #endif
+ #if !defined(CL_CALLBACK)
+ #define CL_CALLBACK
+ #endif
+#endif
+
+/*
+ * Deprecation flags refer to the last version of the header in which the
+ * feature was not deprecated.
+ *
+ * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without
+ * deprecation but is deprecated in versions later than 1.1.
+ */
+
+#ifndef CL_API_SUFFIX_USER
+#define CL_API_SUFFIX_USER
+#endif
+
+#ifndef CL_API_PREFIX_USER
+#define CL_API_PREFIX_USER
+#endif
+
+#define CL_API_SUFFIX_COMMON CL_API_SUFFIX_USER
+#define CL_API_PREFIX_COMMON CL_API_PREFIX_USER
+
+#define CL_API_SUFFIX__VERSION_1_0 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_1_1 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_1_2 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_2_0 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_2_1 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_2_2 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__VERSION_3_0 CL_API_SUFFIX_COMMON
+#define CL_API_SUFFIX__EXPERIMENTAL CL_API_SUFFIX_COMMON
+
+
+#ifdef __GNUC__
+ #define CL_API_SUFFIX_DEPRECATED __attribute__((deprecated))
+ #define CL_API_PREFIX_DEPRECATED
+#elif defined(_MSC_VER) && !defined(__clang__)
+ #define CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX_DEPRECATED __declspec(deprecated)
+#else
+ #define CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX_DEPRECATED
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+ #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
+ #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
+ #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+ #endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
+ #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
+ #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+#endif
+
+#ifdef CL_USE_DEPRECATED_OPENCL_2_2_APIS
+ #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON
+ #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON
+#else
+ #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
+ #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
+#endif
+
+#if (defined (_WIN32) && defined(_MSC_VER))
+
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wlanguage-extension-token"
+#endif
+
+/* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
+/* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
+#if defined(__clang__) || _MSC_VER >= 1600
+ #include
+#endif
+
+/* scalar types */
+typedef signed __int8 cl_char;
+typedef unsigned __int8 cl_uchar;
+typedef signed __int16 cl_short;
+typedef unsigned __int16 cl_ushort;
+typedef signed __int32 cl_int;
+typedef unsigned __int32 cl_uint;
+typedef signed __int64 cl_long;
+typedef unsigned __int64 cl_ulong;
+
+typedef unsigned __int16 cl_half;
+typedef float cl_float;
+typedef double cl_double;
+
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
+/* Macro names and corresponding values defined by OpenCL */
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN 1.175494350822287507969e-38f
+#define CL_FLT_EPSILON 1.1920928955078125e-7f
+
+#define CL_HALF_DIG 3
+#define CL_HALF_MANT_DIG 11
+#define CL_HALF_MAX_10_EXP +4
+#define CL_HALF_MAX_EXP +16
+#define CL_HALF_MIN_10_EXP -4
+#define CL_HALF_MIN_EXP -13
+#define CL_HALF_RADIX 2
+#define CL_HALF_MAX 65504.0f
+#define CL_HALF_MIN 6.103515625e-05f
+#define CL_HALF_EPSILON 9.765625e-04f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 1.7976931348623158e+308
+#define CL_DBL_MIN 2.225073858507201383090e-308
+#define CL_DBL_EPSILON 2.220446049250313080847e-16
+
+#define CL_M_E 2.7182818284590452354
+#define CL_M_LOG2E 1.4426950408889634074
+#define CL_M_LOG10E 0.43429448190325182765
+#define CL_M_LN2 0.69314718055994530942
+#define CL_M_LN10 2.30258509299404568402
+#define CL_M_PI 3.14159265358979323846
+#define CL_M_PI_2 1.57079632679489661923
+#define CL_M_PI_4 0.78539816339744830962
+#define CL_M_1_PI 0.31830988618379067154
+#define CL_M_2_PI 0.63661977236758134308
+#define CL_M_2_SQRTPI 1.12837916709551257390
+#define CL_M_SQRT2 1.41421356237309504880
+#define CL_M_SQRT1_2 0.70710678118654752440
+
+#define CL_M_E_F 2.718281828f
+#define CL_M_LOG2E_F 1.442695041f
+#define CL_M_LOG10E_F 0.434294482f
+#define CL_M_LN2_F 0.693147181f
+#define CL_M_LN10_F 2.302585093f
+#define CL_M_PI_F 3.141592654f
+#define CL_M_PI_2_F 1.570796327f
+#define CL_M_PI_4_F 0.785398163f
+#define CL_M_1_PI_F 0.318309886f
+#define CL_M_2_PI_F 0.636619772f
+#define CL_M_2_SQRTPI_F 1.128379167f
+#define CL_M_SQRT2_F 1.414213562f
+#define CL_M_SQRT1_2_F 0.707106781f
+
+#define CL_NAN (CL_INFINITY - CL_INFINITY)
+#define CL_HUGE_VALF ((cl_float) 1e50)
+#define CL_HUGE_VAL ((cl_double) 1e500)
+#define CL_MAXFLOAT CL_FLT_MAX
+#define CL_INFINITY CL_HUGE_VALF
+
+#else
+
+#include
+
+/* scalar types */
+typedef int8_t cl_char;
+typedef uint8_t cl_uchar;
+typedef int16_t cl_short;
+typedef uint16_t cl_ushort;
+typedef int32_t cl_int;
+typedef uint32_t cl_uint;
+typedef int64_t cl_long;
+typedef uint64_t cl_ulong;
+
+typedef uint16_t cl_half;
+typedef float cl_float;
+typedef double cl_double;
+
+/* Macro names and corresponding values defined by OpenCL */
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN 1.175494350822287507969e-38f
+#define CL_FLT_EPSILON 1.1920928955078125e-7f
+
+#define CL_HALF_DIG 3
+#define CL_HALF_MANT_DIG 11
+#define CL_HALF_MAX_10_EXP +4
+#define CL_HALF_MAX_EXP +16
+#define CL_HALF_MIN_10_EXP -4
+#define CL_HALF_MIN_EXP -13
+#define CL_HALF_RADIX 2
+#define CL_HALF_MAX 65504.0f
+#define CL_HALF_MIN 6.103515625e-05f
+#define CL_HALF_EPSILON 9.765625e-04f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
+#define CL_DBL_MIN 2.225073858507201383090e-308
+#define CL_DBL_EPSILON 2.220446049250313080847e-16
+
+#define CL_M_E 2.7182818284590452354
+#define CL_M_LOG2E 1.4426950408889634074
+#define CL_M_LOG10E 0.43429448190325182765
+#define CL_M_LN2 0.69314718055994530942
+#define CL_M_LN10 2.30258509299404568402
+#define CL_M_PI 3.14159265358979323846
+#define CL_M_PI_2 1.57079632679489661923
+#define CL_M_PI_4 0.78539816339744830962
+#define CL_M_1_PI 0.31830988618379067154
+#define CL_M_2_PI 0.63661977236758134308
+#define CL_M_2_SQRTPI 1.12837916709551257390
+#define CL_M_SQRT2 1.41421356237309504880
+#define CL_M_SQRT1_2 0.70710678118654752440
+
+#define CL_M_E_F 2.718281828f
+#define CL_M_LOG2E_F 1.442695041f
+#define CL_M_LOG10E_F 0.434294482f
+#define CL_M_LN2_F 0.693147181f
+#define CL_M_LN10_F 2.302585093f
+#define CL_M_PI_F 3.141592654f
+#define CL_M_PI_2_F 1.570796327f
+#define CL_M_PI_4_F 0.785398163f
+#define CL_M_1_PI_F 0.318309886f
+#define CL_M_2_PI_F 0.636619772f
+#define CL_M_2_SQRTPI_F 1.128379167f
+#define CL_M_SQRT2_F 1.414213562f
+#define CL_M_SQRT1_2_F 0.707106781f
+
+#if defined( __GNUC__ )
+ #define CL_HUGE_VALF __builtin_huge_valf()
+ #define CL_HUGE_VAL __builtin_huge_val()
+ #define CL_NAN __builtin_nanf( "" )
+#else
+ #define CL_HUGE_VALF ((cl_float) 1e50)
+ #define CL_HUGE_VAL ((cl_double) 1e500)
+ float nanf( const char * );
+ #define CL_NAN nanf( "" )
+#endif
+#define CL_MAXFLOAT CL_FLT_MAX
+#define CL_INFINITY CL_HUGE_VALF
+
+#endif
+
+#include
+
+/*
+ * Vector types
+ *
+ * Note: OpenCL requires that all types be naturally aligned.
+ * This means that vector types must be naturally aligned.
+ * For example, a vector of four floats must be aligned to
+ * a 16 byte boundary (calculated as 4 * the natural 4-byte
+ * alignment of the float). The alignment qualifiers here
+ * will only function properly if your compiler supports them
+ * and if you don't actively work to defeat them. For example,
+ * in order for a cl_float4 to be 16 byte aligned in a struct,
+ * the start of the struct must itself be 16-byte aligned.
+ *
+ * Maintaining proper alignment is the user's responsibility.
+ */
+
+/* Define basic vector types */
+#if defined( __VEC__ )
+ #if !defined(__clang__)
+ #include /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
+ #endif
+ typedef __vector unsigned char __cl_uchar16;
+ typedef __vector signed char __cl_char16;
+ typedef __vector unsigned short __cl_ushort8;
+ typedef __vector signed short __cl_short8;
+ typedef __vector unsigned int __cl_uint4;
+ typedef __vector signed int __cl_int4;
+ typedef __vector float __cl_float4;
+ #define __CL_UCHAR16__ 1
+ #define __CL_CHAR16__ 1
+ #define __CL_USHORT8__ 1
+ #define __CL_SHORT8__ 1
+ #define __CL_UINT4__ 1
+ #define __CL_INT4__ 1
+ #define __CL_FLOAT4__ 1
+#endif
+
+#if defined( __SSE__ )
+ #if defined( __MINGW64__ )
+ #include
+ #else
+ #include
+ #endif
+ #if defined( __GNUC__ )
+ typedef float __cl_float4 __attribute__((vector_size(16)));
+ #else
+ typedef __m128 __cl_float4;
+ #endif
+ #define __CL_FLOAT4__ 1
+#endif
+
+#if defined( __SSE2__ )
+ #if defined( __MINGW64__ )
+ #include
+ #else
+ #include
+ #endif
+ #if defined( __GNUC__ )
+ typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
+ typedef cl_char __cl_char16 __attribute__((vector_size(16)));
+ typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
+ typedef cl_short __cl_short8 __attribute__((vector_size(16)));
+ typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
+ typedef cl_int __cl_int4 __attribute__((vector_size(16)));
+ typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
+ typedef cl_long __cl_long2 __attribute__((vector_size(16)));
+ typedef cl_double __cl_double2 __attribute__((vector_size(16)));
+ #else
+ typedef __m128i __cl_uchar16;
+ typedef __m128i __cl_char16;
+ typedef __m128i __cl_ushort8;
+ typedef __m128i __cl_short8;
+ typedef __m128i __cl_uint4;
+ typedef __m128i __cl_int4;
+ typedef __m128i __cl_ulong2;
+ typedef __m128i __cl_long2;
+ typedef __m128d __cl_double2;
+ #endif
+ #define __CL_UCHAR16__ 1
+ #define __CL_CHAR16__ 1
+ #define __CL_USHORT8__ 1
+ #define __CL_SHORT8__ 1
+ #define __CL_INT4__ 1
+ #define __CL_UINT4__ 1
+ #define __CL_ULONG2__ 1
+ #define __CL_LONG2__ 1
+ #define __CL_DOUBLE2__ 1
+#endif
+
+#if defined( __MMX__ )
+ #include
+ #if defined( __GNUC__ )
+ typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
+ typedef cl_char __cl_char8 __attribute__((vector_size(8)));
+ typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
+ typedef cl_short __cl_short4 __attribute__((vector_size(8)));
+ typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
+ typedef cl_int __cl_int2 __attribute__((vector_size(8)));
+ typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
+ typedef cl_long __cl_long1 __attribute__((vector_size(8)));
+ typedef cl_float __cl_float2 __attribute__((vector_size(8)));
+ #else
+ typedef __m64 __cl_uchar8;
+ typedef __m64 __cl_char8;
+ typedef __m64 __cl_ushort4;
+ typedef __m64 __cl_short4;
+ typedef __m64 __cl_uint2;
+ typedef __m64 __cl_int2;
+ typedef __m64 __cl_ulong1;
+ typedef __m64 __cl_long1;
+ typedef __m64 __cl_float2;
+ #endif
+ #define __CL_UCHAR8__ 1
+ #define __CL_CHAR8__ 1
+ #define __CL_USHORT4__ 1
+ #define __CL_SHORT4__ 1
+ #define __CL_INT2__ 1
+ #define __CL_UINT2__ 1
+ #define __CL_ULONG1__ 1
+ #define __CL_LONG1__ 1
+ #define __CL_FLOAT2__ 1
+#endif
+
+#if defined( __AVX__ )
+ #if defined( __MINGW64__ )
+ #include
+ #else
+ #include
+ #endif
+ #if defined( __GNUC__ )
+ typedef cl_float __cl_float8 __attribute__((vector_size(32)));
+ typedef cl_double __cl_double4 __attribute__((vector_size(32)));
+ #else
+ typedef __m256 __cl_float8;
+ typedef __m256d __cl_double4;
+ #endif
+ #define __CL_FLOAT8__ 1
+ #define __CL_DOUBLE4__ 1
+#endif
+
+/* Define capabilities for anonymous struct members. */
+#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__
+#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__)
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__
+#elif defined(__GNUC__) && ! defined(__STRICT_ANSI__)
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__ __extension__
+#elif defined(__clang__)
+#define __CL_HAS_ANON_STRUCT__ 1
+#define __CL_ANON_STRUCT__ __extension__
+#else
+#define __CL_HAS_ANON_STRUCT__ 0
+#define __CL_ANON_STRUCT__
+#endif
+
+#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
+ /* Disable warning C4201: nonstandard extension used : nameless struct/union */
+ #pragma warning( push )
+ #pragma warning( disable : 4201 )
+#endif
+
+/* Define alignment keys */
+#if defined( __GNUC__ ) || defined(__INTEGRITY)
+ #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
+#elif defined( _WIN32) && (_MSC_VER)
+ /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
+ /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
+ /* #include */
+ /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
+ #define CL_ALIGNED(_x)
+#else
+ #warning Need to implement some method to align data here
+ #define CL_ALIGNED(_x)
+#endif
+
+/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
+#if __CL_HAS_ANON_STRUCT__
+ /* .xyzw and .s0123...{f|F} are supported */
+ #define CL_HAS_NAMED_VECTOR_FIELDS 1
+ /* .hi and .lo are supported */
+ #define CL_HAS_HI_LO_VECTOR_FIELDS 1
+#endif
+
+/* Define cl_vector types */
+
+/* ---- cl_charn ---- */
+typedef union
+{
+ cl_char CL_ALIGNED(2) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_char x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_char s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_char lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2;
+#endif
+}cl_char2;
+
+typedef union
+{
+ cl_char CL_ALIGNED(4) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[2];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4;
+#endif
+}cl_char4;
+
+/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
+typedef cl_char4 cl_char3;
+
+typedef union
+{
+ cl_char CL_ALIGNED(8) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[4];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4[2];
+#endif
+#if defined( __CL_CHAR8__ )
+ __cl_char8 v8;
+#endif
+}cl_char8;
+
+typedef union
+{
+ cl_char CL_ALIGNED(16) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[8];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4[4];
+#endif
+#if defined( __CL_CHAR8__ )
+ __cl_char8 v8[2];
+#endif
+#if defined( __CL_CHAR16__ )
+ __cl_char16 v16;
+#endif
+}cl_char16;
+
+
+/* ---- cl_ucharn ---- */
+typedef union
+{
+ cl_uchar CL_ALIGNED(2) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uchar x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; };
+#endif
+#if defined( __cl_uchar2__)
+ __cl_uchar2 v2;
+#endif
+}cl_uchar2;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(4) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[2];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4;
+#endif
+}cl_uchar4;
+
+/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
+typedef cl_uchar4 cl_uchar3;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(8) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[4];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4[2];
+#endif
+#if defined( __CL_UCHAR8__ )
+ __cl_uchar8 v8;
+#endif
+}cl_uchar8;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(16) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[8];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4[4];
+#endif
+#if defined( __CL_UCHAR8__ )
+ __cl_uchar8 v8[2];
+#endif
+#if defined( __CL_UCHAR16__ )
+ __cl_uchar16 v16;
+#endif
+}cl_uchar16;
+
+
+/* ---- cl_shortn ---- */
+typedef union
+{
+ cl_short CL_ALIGNED(4) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_short x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_short s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_short lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2;
+#endif
+}cl_short2;
+
+typedef union
+{
+ cl_short CL_ALIGNED(8) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[2];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4;
+#endif
+}cl_short4;
+
+/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
+typedef cl_short4 cl_short3;
+
+typedef union
+{
+ cl_short CL_ALIGNED(16) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[4];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4[2];
+#endif
+#if defined( __CL_SHORT8__ )
+ __cl_short8 v8;
+#endif
+}cl_short8;
+
+typedef union
+{
+ cl_short CL_ALIGNED(32) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[8];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4[4];
+#endif
+#if defined( __CL_SHORT8__ )
+ __cl_short8 v8[2];
+#endif
+#if defined( __CL_SHORT16__ )
+ __cl_short16 v16;
+#endif
+}cl_short16;
+
+
+/* ---- cl_ushortn ---- */
+typedef union
+{
+ cl_ushort CL_ALIGNED(4) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ushort x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2;
+#endif
+}cl_ushort2;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(8) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[2];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4;
+#endif
+}cl_ushort4;
+
+/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
+typedef cl_ushort4 cl_ushort3;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(16) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[4];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4[2];
+#endif
+#if defined( __CL_USHORT8__ )
+ __cl_ushort8 v8;
+#endif
+}cl_ushort8;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(32) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[8];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4[4];
+#endif
+#if defined( __CL_USHORT8__ )
+ __cl_ushort8 v8[2];
+#endif
+#if defined( __CL_USHORT16__ )
+ __cl_ushort16 v16;
+#endif
+}cl_ushort16;
+
+
+/* ---- cl_halfn ---- */
+typedef union
+{
+ cl_half CL_ALIGNED(4) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_half x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_half s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_half lo, hi; };
+#endif
+#if defined( __CL_HALF2__)
+ __cl_half2 v2;
+#endif
+}cl_half2;
+
+typedef union
+{
+ cl_half CL_ALIGNED(8) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
+#endif
+#if defined( __CL_HALF2__)
+ __cl_half2 v2[2];
+#endif
+#if defined( __CL_HALF4__)
+ __cl_half4 v4;
+#endif
+}cl_half4;
+
+/* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
+typedef cl_half4 cl_half3;
+
+typedef union
+{
+ cl_half CL_ALIGNED(16) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
+#endif
+#if defined( __CL_HALF2__)
+ __cl_half2 v2[4];
+#endif
+#if defined( __CL_HALF4__)
+ __cl_half4 v4[2];
+#endif
+#if defined( __CL_HALF8__ )
+ __cl_half8 v8;
+#endif
+}cl_half8;
+
+typedef union
+{
+ cl_half CL_ALIGNED(32) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
+#endif
+#if defined( __CL_HALF2__)
+ __cl_half2 v2[8];
+#endif
+#if defined( __CL_HALF4__)
+ __cl_half4 v4[4];
+#endif
+#if defined( __CL_HALF8__ )
+ __cl_half8 v8[2];
+#endif
+#if defined( __CL_HALF16__ )
+ __cl_half16 v16;
+#endif
+}cl_half16;
+
+/* ---- cl_intn ---- */
+typedef union
+{
+ cl_int CL_ALIGNED(8) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_int x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_int s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_int lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2;
+#endif
+}cl_int2;
+
+typedef union
+{
+ cl_int CL_ALIGNED(16) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[2];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4;
+#endif
+}cl_int4;
+
+/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
+typedef cl_int4 cl_int3;
+
+typedef union
+{
+ cl_int CL_ALIGNED(32) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[4];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4[2];
+#endif
+#if defined( __CL_INT8__ )
+ __cl_int8 v8;
+#endif
+}cl_int8;
+
+typedef union
+{
+ cl_int CL_ALIGNED(64) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[8];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4[4];
+#endif
+#if defined( __CL_INT8__ )
+ __cl_int8 v8[2];
+#endif
+#if defined( __CL_INT16__ )
+ __cl_int16 v16;
+#endif
+}cl_int16;
+
+
+/* ---- cl_uintn ---- */
+typedef union
+{
+ cl_uint CL_ALIGNED(8) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uint x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2;
+#endif
+}cl_uint2;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(16) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[2];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4;
+#endif
+}cl_uint4;
+
+/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
+typedef cl_uint4 cl_uint3;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(32) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[4];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4[2];
+#endif
+#if defined( __CL_UINT8__ )
+ __cl_uint8 v8;
+#endif
+}cl_uint8;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(64) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[8];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4[4];
+#endif
+#if defined( __CL_UINT8__ )
+ __cl_uint8 v8[2];
+#endif
+#if defined( __CL_UINT16__ )
+ __cl_uint16 v16;
+#endif
+}cl_uint16;
+
+/* ---- cl_longn ---- */
+typedef union
+{
+ cl_long CL_ALIGNED(16) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_long x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_long s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_long lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2;
+#endif
+}cl_long2;
+
+typedef union
+{
+ cl_long CL_ALIGNED(32) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[2];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4;
+#endif
+}cl_long4;
+
+/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
+typedef cl_long4 cl_long3;
+
+typedef union
+{
+ cl_long CL_ALIGNED(64) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[4];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4[2];
+#endif
+#if defined( __CL_LONG8__ )
+ __cl_long8 v8;
+#endif
+}cl_long8;
+
+typedef union
+{
+ cl_long CL_ALIGNED(128) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[8];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4[4];
+#endif
+#if defined( __CL_LONG8__ )
+ __cl_long8 v8[2];
+#endif
+#if defined( __CL_LONG16__ )
+ __cl_long16 v16;
+#endif
+}cl_long16;
+
+
+/* ---- cl_ulongn ---- */
+typedef union
+{
+ cl_ulong CL_ALIGNED(16) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ulong x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2;
+#endif
+}cl_ulong2;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(32) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[2];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4;
+#endif
+}cl_ulong4;
+
+/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
+typedef cl_ulong4 cl_ulong3;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(64) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[4];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4[2];
+#endif
+#if defined( __CL_ULONG8__ )
+ __cl_ulong8 v8;
+#endif
+}cl_ulong8;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(128) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[8];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4[4];
+#endif
+#if defined( __CL_ULONG8__ )
+ __cl_ulong8 v8[2];
+#endif
+#if defined( __CL_ULONG16__ )
+ __cl_ulong16 v16;
+#endif
+}cl_ulong16;
+
+
+/* --- cl_floatn ---- */
+
+typedef union
+{
+ cl_float CL_ALIGNED(8) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_float x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_float s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_float lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2;
+#endif
+}cl_float2;
+
+typedef union
+{
+ cl_float CL_ALIGNED(16) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[2];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4;
+#endif
+}cl_float4;
+
+/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
+typedef cl_float4 cl_float3;
+
+typedef union
+{
+ cl_float CL_ALIGNED(32) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[4];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4[2];
+#endif
+#if defined( __CL_FLOAT8__ )
+ __cl_float8 v8;
+#endif
+}cl_float8;
+
+typedef union
+{
+ cl_float CL_ALIGNED(64) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[8];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4[4];
+#endif
+#if defined( __CL_FLOAT8__ )
+ __cl_float8 v8[2];
+#endif
+#if defined( __CL_FLOAT16__ )
+ __cl_float16 v16;
+#endif
+}cl_float16;
+
+/* --- cl_doublen ---- */
+
+typedef union
+{
+ cl_double CL_ALIGNED(16) s[2];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_double x, y; };
+ __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
+ __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2;
+#endif
+}cl_double2;
+
+typedef union
+{
+ cl_double CL_ALIGNED(32) s[4];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; };
+ __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[2];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4;
+#endif
+}cl_double4;
+
+/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
+typedef cl_double4 cl_double3;
+
+typedef union
+{
+ cl_double CL_ALIGNED(64) s[8];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
+ __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
+ __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[4];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4[2];
+#endif
+#if defined( __CL_DOUBLE8__ )
+ __cl_double8 v8;
+#endif
+}cl_double8;
+
+typedef union
+{
+ cl_double CL_ALIGNED(128) s[16];
+#if __CL_HAS_ANON_STRUCT__
+ __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[8];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4[4];
+#endif
+#if defined( __CL_DOUBLE8__ )
+ __cl_double8 v8[2];
+#endif
+#if defined( __CL_DOUBLE16__ )
+ __cl_double16 v16;
+#endif
+}cl_double16;
+
+/* Macro to facilitate debugging
+ * Usage:
+ * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
+ * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
+ * Each line thereafter of OpenCL C source must end with: \n\
+ * The last line ends in ";
+ *
+ * Example:
+ *
+ * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
+ * kernel void foo( int a, float * b ) \n\
+ * { \n\
+ * // my comment \n\
+ * *b[ get_global_id(0)] = a; \n\
+ * } \n\
+ * ";
+ *
+ * This should correctly set up the line, (column) and file information for your source
+ * string so you can do source level debugging.
+ */
+#define __CL_STRINGIFY( _x ) # _x
+#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
+#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
+
+#ifdef __cplusplus
+}
+#endif
+
+#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
+ #pragma warning( pop )
+#endif
+
+#endif /* __CL_PLATFORM_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_va_api_media_sharing_intel.h b/tmpl8/lib/OpenCL/inc/CL/cl_va_api_media_sharing_intel.h
new file mode 100644
index 0000000..9fb8863
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_va_api_media_sharing_intel.h
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2023 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H_
+#define OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H_
+
+/*
+** This header is generated from the Khronos OpenCL XML API Registry.
+*/
+
+#include
+
+#include
+
+/* CL_NO_PROTOTYPES implies CL_NO_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_PROTOTYPES) && !defined(CL_NO_EXTENSION_PROTOTYPES)
+#define CL_NO_EXTENSION_PROTOTYPES
+#endif
+
+/* CL_NO_EXTENSION_PROTOTYPES implies
+ CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES and
+ CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES: */
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+#if defined(CL_NO_EXTENSION_PROTOTYPES) && \
+ !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+#define CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/***************************************************************
+* cl_intel_sharing_format_query_va_api
+***************************************************************/
+#define cl_intel_sharing_format_query_va_api 1
+#define CL_INTEL_SHARING_FORMAT_QUERY_VA_API_EXTENSION_NAME \
+ "cl_intel_sharing_format_query_va_api"
+
+
+#define CL_INTEL_SHARING_FORMAT_QUERY_VA_API_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+/* when cl_intel_va_api_media_sharing is supported */
+
+typedef cl_int CL_API_CALL
+clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ VAImageFormat* va_api_formats,
+ cl_uint* num_surface_formats);
+
+typedef clGetSupportedVA_APIMediaSurfaceFormatsINTEL_t *
+clGetSupportedVA_APIMediaSurfaceFormatsINTEL_fn ;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedVA_APIMediaSurfaceFormatsINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ cl_mem_object_type image_type,
+ cl_uint plane,
+ cl_uint num_entries,
+ VAImageFormat* va_api_formats,
+ cl_uint* num_surface_formats) ;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+/***************************************************************
+* cl_intel_va_api_media_sharing
+***************************************************************/
+#define cl_intel_va_api_media_sharing 1
+#define CL_INTEL_VA_API_MEDIA_SHARING_EXTENSION_NAME \
+ "cl_intel_va_api_media_sharing"
+
+
+#define CL_INTEL_VA_API_MEDIA_SHARING_EXTENSION_VERSION CL_MAKE_VERSION(0, 0, 0)
+
+typedef cl_uint cl_va_api_device_source_intel;
+typedef cl_uint cl_va_api_device_set_intel;
+
+/* Error codes */
+#define CL_INVALID_VA_API_MEDIA_ADAPTER_INTEL -1098
+#define CL_INVALID_VA_API_MEDIA_SURFACE_INTEL -1099
+#define CL_VA_API_MEDIA_SURFACE_ALREADY_ACQUIRED_INTEL -1100
+#define CL_VA_API_MEDIA_SURFACE_NOT_ACQUIRED_INTEL -1101
+
+/* cl_va_api_device_source_intel */
+#define CL_VA_API_DISPLAY_INTEL 0x4094
+
+/* cl_va_api_device_set_intel */
+#define CL_PREFERRED_DEVICES_FOR_VA_API_INTEL 0x4095
+#define CL_ALL_DEVICES_FOR_VA_API_INTEL 0x4096
+
+/* cl_context_info */
+#define CL_CONTEXT_VA_API_DISPLAY_INTEL 0x4097
+
+/* cl_mem_info */
+#define CL_MEM_VA_API_MEDIA_SURFACE_INTEL 0x4098
+
+/* cl_image_info */
+#define CL_IMAGE_VA_API_PLANE_INTEL 0x4099
+
+/* cl_command_type */
+#define CL_COMMAND_ACQUIRE_VA_API_MEDIA_SURFACES_INTEL 0x409A
+#define CL_COMMAND_RELEASE_VA_API_MEDIA_SURFACES_INTEL 0x409B
+
+
+typedef cl_int CL_API_CALL
+clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t(
+ cl_platform_id platform,
+ cl_va_api_device_source_intel media_adapter_type,
+ void* media_adapter,
+ cl_va_api_device_set_intel media_adapter_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices);
+
+typedef clGetDeviceIDsFromVA_APIMediaAdapterINTEL_t *
+clGetDeviceIDsFromVA_APIMediaAdapterINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_mem CL_API_CALL
+clCreateFromVA_APIMediaSurfaceINTEL_t(
+ cl_context context,
+ cl_mem_flags flags,
+ VASurfaceID* surface,
+ cl_uint plane,
+ cl_int* errcode_ret);
+
+typedef clCreateFromVA_APIMediaSurfaceINTEL_t *
+clCreateFromVA_APIMediaSurfaceINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueAcquireVA_APIMediaSurfacesINTEL_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueAcquireVA_APIMediaSurfacesINTEL_t *
+clEnqueueAcquireVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+typedef cl_int CL_API_CALL
+clEnqueueReleaseVA_APIMediaSurfacesINTEL_t(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event);
+
+typedef clEnqueueReleaseVA_APIMediaSurfacesINTEL_t *
+clEnqueueReleaseVA_APIMediaSurfacesINTEL_fn CL_API_SUFFIX__VERSION_1_2;
+
+#if !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES)
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDsFromVA_APIMediaAdapterINTEL(
+ cl_platform_id platform,
+ cl_va_api_device_source_intel media_adapter_type,
+ void* media_adapter,
+ cl_va_api_device_set_intel media_adapter_set,
+ cl_uint num_entries,
+ cl_device_id* devices,
+ cl_uint* num_devices) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromVA_APIMediaSurfaceINTEL(
+ cl_context context,
+ cl_mem_flags flags,
+ VASurfaceID* surface,
+ cl_uint plane,
+ cl_int* errcode_ret) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireVA_APIMediaSurfacesINTEL(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseVA_APIMediaSurfacesINTEL(
+ cl_command_queue command_queue,
+ cl_uint num_objects,
+ const cl_mem* mem_objects,
+ cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list,
+ cl_event* event) CL_API_SUFFIX__VERSION_1_2;
+
+#endif /* !defined(CL_NO_NON_ICD_DISPATCH_EXTENSION_PROTOTYPES) */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OPENCL_CL_VA_API_MEDIA_SHARING_INTEL_H_ */
diff --git a/tmpl8/lib/OpenCL/inc/CL/cl_version.h b/tmpl8/lib/OpenCL/inc/CL/cl_version.h
new file mode 100644
index 0000000..3844938
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/cl_version.h
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2018-2020 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef __CL_VERSION_H
+#define __CL_VERSION_H
+
+/* Detect which version to target */
+#if !defined(CL_TARGET_OPENCL_VERSION)
+#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
+#define CL_TARGET_OPENCL_VERSION 300
+#endif
+#if CL_TARGET_OPENCL_VERSION != 100 && \
+ CL_TARGET_OPENCL_VERSION != 110 && \
+ CL_TARGET_OPENCL_VERSION != 120 && \
+ CL_TARGET_OPENCL_VERSION != 200 && \
+ CL_TARGET_OPENCL_VERSION != 210 && \
+ CL_TARGET_OPENCL_VERSION != 220 && \
+ CL_TARGET_OPENCL_VERSION != 300
+#pragma message("cl_version: CL_TARGET_OPENCL_VERSION is not a valid value (100, 110, 120, 200, 210, 220, 300). Defaulting to 300 (OpenCL 3.0)")
+#undef CL_TARGET_OPENCL_VERSION
+#define CL_TARGET_OPENCL_VERSION 300
+#endif
+
+
+/* OpenCL Version */
+#if CL_TARGET_OPENCL_VERSION >= 300 && !defined(CL_VERSION_3_0)
+#define CL_VERSION_3_0 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 220 && !defined(CL_VERSION_2_2)
+#define CL_VERSION_2_2 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 210 && !defined(CL_VERSION_2_1)
+#define CL_VERSION_2_1 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 200 && !defined(CL_VERSION_2_0)
+#define CL_VERSION_2_0 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 120 && !defined(CL_VERSION_1_2)
+#define CL_VERSION_1_2 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 110 && !defined(CL_VERSION_1_1)
+#define CL_VERSION_1_1 1
+#endif
+#if CL_TARGET_OPENCL_VERSION >= 100 && !defined(CL_VERSION_1_0)
+#define CL_VERSION_1_0 1
+#endif
+
+/* Allow deprecated APIs for older OpenCL versions. */
+#if CL_TARGET_OPENCL_VERSION <= 220 && !defined(CL_USE_DEPRECATED_OPENCL_2_2_APIS)
+#define CL_USE_DEPRECATED_OPENCL_2_2_APIS
+#endif
+#if CL_TARGET_OPENCL_VERSION <= 210 && !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS)
+#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
+#endif
+#if CL_TARGET_OPENCL_VERSION <= 200 && !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS)
+#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
+#endif
+#if CL_TARGET_OPENCL_VERSION <= 120 && !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS)
+#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
+#endif
+#if CL_TARGET_OPENCL_VERSION <= 110 && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
+#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
+#endif
+#if CL_TARGET_OPENCL_VERSION <= 100 && !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS)
+#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
+#endif
+
+#endif /* __CL_VERSION_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/opencl.h b/tmpl8/lib/OpenCL/inc/CL/opencl.h
new file mode 100644
index 0000000..ef8dd1e
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/opencl.h
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2021 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+
+#ifndef __OPENCL_H
+#define __OPENCL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include
+#include
+#include
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_H */
diff --git a/tmpl8/lib/OpenCL/inc/CL/version.txt b/tmpl8/lib/OpenCL/inc/CL/version.txt
new file mode 100644
index 0000000..7ddfffd
--- /dev/null
+++ b/tmpl8/lib/OpenCL/inc/CL/version.txt
@@ -0,0 +1,2 @@
+Obtained from https://github.com/KhronosGroup/OpenCL-Headers
+June 19, 2024.
\ No newline at end of file
diff --git a/tmpl8/lib/OpenCL/lib/OpenCL.lib b/tmpl8/lib/OpenCL/lib/OpenCL.lib
new file mode 100644
index 0000000..6deecc2
Binary files /dev/null and b/tmpl8/lib/OpenCL/lib/OpenCL.lib differ
diff --git a/tmpl8/lib/OpenCL/version.txt b/tmpl8/lib/OpenCL/version.txt
new file mode 100644
index 0000000..c64e23c
--- /dev/null
+++ b/tmpl8/lib/OpenCL/version.txt
@@ -0,0 +1,6 @@
+In this directory:
+- Header files obtained from https://github.com/KhronosGroup/OpenCL-SDK
+ October 26, 2024
+- Library file, freshly compiled as static lib for x64 and obtained from:
+ https://github.com/KhronosGroup/OpenCL-ICD-Loader
+ Also on October 26, 2024.
\ No newline at end of file
diff --git a/tmpl8/lib/glad/generated June 19, 2024 b/tmpl8/lib/glad/generated June 19, 2024
new file mode 100644
index 0000000..e69de29
diff --git a/tmpl8/lib/glad/glad.h b/tmpl8/lib/glad/glad.h
new file mode 100644
index 0000000..7283c68
--- /dev/null
+++ b/tmpl8/lib/glad/glad.h
@@ -0,0 +1,2142 @@
+/**
+ * Loader generated by glad 2.0.6 on Wed Jun 19 06:49:13 2024
+ *
+ * SPDX-License-Identifier: (WTFPL OR CC0-1.0) AND Apache-2.0
+ *
+ * Generator: C/C++
+ * Specification: gl
+ * Extensions: 0
+ *
+ * APIs:
+ * - gl:core=3.3
+ *
+ * Options:
+ * - ALIAS = False
+ * - DEBUG = False
+ * - HEADER_ONLY = False
+ * - LOADER = True
+ * - MX = False
+ * - ON_DEMAND = False
+ *
+ * Commandline:
+ * --api='gl:core=3.3' --extensions='' c --loader
+ *
+ * Online:
+ * http://glad.sh/#api=gl%3Acore%3D3.3&extensions=&generator=c&options=LOADER
+ *
+ */
+
+#ifndef GLAD_GL_H_
+#define GLAD_GL_H_
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-id-macro"
+#endif
+#ifdef __gl_h_
+ #error OpenGL (gl.h) header already included (API: gl), remove previous include!
+#endif
+#define __gl_h_ 1
+#ifdef __gl3_h_
+ #error OpenGL (gl3.h) header already included (API: gl), remove previous include!
+#endif
+#define __gl3_h_ 1
+#ifdef __glext_h_
+ #error OpenGL (glext.h) header already included (API: gl), remove previous include!
+#endif
+#define __glext_h_ 1
+#ifdef __gl3ext_h_
+ #error OpenGL (gl3ext.h) header already included (API: gl), remove previous include!
+#endif
+#define __gl3ext_h_ 1
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
+#define GLAD_GL
+#define GLAD_OPTION_GL_LOADER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GLAD_PLATFORM_H_
+#define GLAD_PLATFORM_H_
+
+#ifndef GLAD_PLATFORM_WIN32
+ #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__)
+ #define GLAD_PLATFORM_WIN32 1
+ #else
+ #define GLAD_PLATFORM_WIN32 0
+ #endif
+#endif
+
+#ifndef GLAD_PLATFORM_APPLE
+ #ifdef __APPLE__
+ #define GLAD_PLATFORM_APPLE 1
+ #else
+ #define GLAD_PLATFORM_APPLE 0
+ #endif
+#endif
+
+#ifndef GLAD_PLATFORM_EMSCRIPTEN
+ #ifdef __EMSCRIPTEN__
+ #define GLAD_PLATFORM_EMSCRIPTEN 1
+ #else
+ #define GLAD_PLATFORM_EMSCRIPTEN 0
+ #endif
+#endif
+
+#ifndef GLAD_PLATFORM_UWP
+ #if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY)
+ #ifdef __has_include
+ #if __has_include()
+ #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
+ #endif
+ #elif _MSC_VER >= 1700 && !_USING_V110_SDK71_
+ #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1
+ #endif
+ #endif
+
+ #ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY
+ #include
+ #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
+ #define GLAD_PLATFORM_UWP 1
+ #endif
+ #endif
+
+ #ifndef GLAD_PLATFORM_UWP
+ #define GLAD_PLATFORM_UWP 0
+ #endif
+#endif
+
+#ifdef __GNUC__
+ #define GLAD_GNUC_EXTENSION __extension__
+#else
+ #define GLAD_GNUC_EXTENSION
+#endif
+
+#define GLAD_UNUSED(x) (void)(x)
+
+#ifndef GLAD_API_CALL
+ #if defined(GLAD_API_CALL_EXPORT)
+ #if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__)
+ #if defined(GLAD_API_CALL_EXPORT_BUILD)
+ #if defined(__GNUC__)
+ #define GLAD_API_CALL __attribute__ ((dllexport)) extern
+ #else
+ #define GLAD_API_CALL __declspec(dllexport) extern
+ #endif
+ #else
+ #if defined(__GNUC__)
+ #define GLAD_API_CALL __attribute__ ((dllimport)) extern
+ #else
+ #define GLAD_API_CALL __declspec(dllimport) extern
+ #endif
+ #endif
+ #elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD)
+ #define GLAD_API_CALL __attribute__ ((visibility ("default"))) extern
+ #else
+ #define GLAD_API_CALL extern
+ #endif
+ #else
+ #define GLAD_API_CALL extern
+ #endif
+#endif
+
+#ifdef APIENTRY
+ #define GLAD_API_PTR APIENTRY
+#elif GLAD_PLATFORM_WIN32
+ #define GLAD_API_PTR __stdcall
+#else
+ #define GLAD_API_PTR
+#endif
+
+#ifndef GLAPI
+#define GLAPI GLAD_API_CALL
+#endif
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY GLAD_API_PTR
+#endif
+
+#define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor)
+#define GLAD_VERSION_MAJOR(version) (version / 10000)
+#define GLAD_VERSION_MINOR(version) (version % 10000)
+
+#define GLAD_GENERATOR_VERSION "2.0.6"
+
+typedef void (*GLADapiproc)(void);
+
+typedef GLADapiproc (*GLADloadfunc)(const char *name);
+typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name);
+
+typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...);
+typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...);
+
+#endif /* GLAD_PLATFORM_H_ */
+
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_ALPHA 0x1906
+#define GL_ALREADY_SIGNALED 0x911A
+#define GL_ALWAYS 0x0207
+#define GL_AND 0x1501
+#define GL_AND_INVERTED 0x1504
+#define GL_AND_REVERSE 0x1502
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_BACK 0x0405
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_BGRA_INTEGER 0x8D9B
+#define GL_BGR_INTEGER 0x8D9A
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_COLOR 0x8005
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLUE 0x1905
+#define GL_BLUE_INTEGER 0x8D96
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_BUFFER_ACCESS 0x88BB
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_BYTE 0x1400
+#define GL_CCW 0x0901
+#define GL_CLAMP_READ_COLOR 0x891C
+#define GL_CLAMP_TO_BORDER 0x812D
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_CLEAR 0x1500
+#define GL_CLIP_DISTANCE0 0x3000
+#define GL_CLIP_DISTANCE1 0x3001
+#define GL_CLIP_DISTANCE2 0x3002
+#define GL_CLIP_DISTANCE3 0x3003
+#define GL_CLIP_DISTANCE4 0x3004
+#define GL_CLIP_DISTANCE5 0x3005
+#define GL_CLIP_DISTANCE6 0x3006
+#define GL_CLIP_DISTANCE7 0x3007
+#define GL_COLOR 0x1800
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#define GL_COLOR_ATTACHMENT10 0x8CEA
+#define GL_COLOR_ATTACHMENT11 0x8CEB
+#define GL_COLOR_ATTACHMENT12 0x8CEC
+#define GL_COLOR_ATTACHMENT13 0x8CED
+#define GL_COLOR_ATTACHMENT14 0x8CEE
+#define GL_COLOR_ATTACHMENT15 0x8CEF
+#define GL_COLOR_ATTACHMENT16 0x8CF0
+#define GL_COLOR_ATTACHMENT17 0x8CF1
+#define GL_COLOR_ATTACHMENT18 0x8CF2
+#define GL_COLOR_ATTACHMENT19 0x8CF3
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#define GL_COLOR_ATTACHMENT20 0x8CF4
+#define GL_COLOR_ATTACHMENT21 0x8CF5
+#define GL_COLOR_ATTACHMENT22 0x8CF6
+#define GL_COLOR_ATTACHMENT23 0x8CF7
+#define GL_COLOR_ATTACHMENT24 0x8CF8
+#define GL_COLOR_ATTACHMENT25 0x8CF9
+#define GL_COLOR_ATTACHMENT26 0x8CFA
+#define GL_COLOR_ATTACHMENT27 0x8CFB
+#define GL_COLOR_ATTACHMENT28 0x8CFC
+#define GL_COLOR_ATTACHMENT29 0x8CFD
+#define GL_COLOR_ATTACHMENT3 0x8CE3
+#define GL_COLOR_ATTACHMENT30 0x8CFE
+#define GL_COLOR_ATTACHMENT31 0x8CFF
+#define GL_COLOR_ATTACHMENT4 0x8CE4
+#define GL_COLOR_ATTACHMENT5 0x8CE5
+#define GL_COLOR_ATTACHMENT6 0x8CE6
+#define GL_COLOR_ATTACHMENT7 0x8CE7
+#define GL_COLOR_ATTACHMENT8 0x8CE8
+#define GL_COLOR_ATTACHMENT9 0x8CE9
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_COMPRESSED_RED 0x8225
+#define GL_COMPRESSED_RED_RGTC1 0x8DBB
+#define GL_COMPRESSED_RG 0x8226
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_COMPRESSED_RG_RGTC2 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
+#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
+#define GL_COMPRESSED_SRGB 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_CONDITION_SATISFIED 0x911C
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#define GL_CONTEXT_FLAGS 0x821E
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+#define GL_COPY 0x1503
+#define GL_COPY_INVERTED 0x150C
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_CURRENT_QUERY 0x8865
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_CW 0x0900
+#define GL_DECR 0x1E03
+#define GL_DECR_WRAP 0x8508
+#define GL_DELETE_STATUS 0x8B80
+#define GL_DEPTH 0x1801
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_DEPTH_CLAMP 0x864F
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_DEPTH_COMPONENT32 0x81A7
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
+#define GL_DEPTH_TEST 0x0B71
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DITHER 0x0BD0
+#define GL_DONT_CARE 0x1100
+#define GL_DOUBLE 0x140A
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_DRAW_BUFFER0 0x8825
+#define GL_DRAW_BUFFER1 0x8826
+#define GL_DRAW_BUFFER10 0x882F
+#define GL_DRAW_BUFFER11 0x8830
+#define GL_DRAW_BUFFER12 0x8831
+#define GL_DRAW_BUFFER13 0x8832
+#define GL_DRAW_BUFFER14 0x8833
+#define GL_DRAW_BUFFER15 0x8834
+#define GL_DRAW_BUFFER2 0x8827
+#define GL_DRAW_BUFFER3 0x8828
+#define GL_DRAW_BUFFER4 0x8829
+#define GL_DRAW_BUFFER5 0x882A
+#define GL_DRAW_BUFFER6 0x882B
+#define GL_DRAW_BUFFER7 0x882C
+#define GL_DRAW_BUFFER8 0x882D
+#define GL_DRAW_BUFFER9 0x882E
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_DST_ALPHA 0x0304
+#define GL_DST_COLOR 0x0306
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_EQUAL 0x0202
+#define GL_EQUIV 0x1509
+#define GL_EXTENSIONS 0x1F03
+#define GL_FALSE 0
+#define GL_FASTEST 0x1101
+#define GL_FILL 0x1B02
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_FIXED_ONLY 0x891D
+#define GL_FLOAT 0x1406
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT2x3 0x8B65
+#define GL_FLOAT_MAT2x4 0x8B66
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT3x2 0x8B67
+#define GL_FLOAT_MAT3x4 0x8B68
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_FLOAT_MAT4x2 0x8B69
+#define GL_FLOAT_MAT4x3 0x8B6A
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_DEFAULT 0x8218
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#define GL_FRAMEBUFFER_UNDEFINED 0x8219
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRONT 0x0404
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_FRONT_FACE 0x0B46
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_GEQUAL 0x0206
+#define GL_GREATER 0x0204
+#define GL_GREEN 0x1904
+#define GL_GREEN_INTEGER 0x8D95
+#define GL_HALF_FLOAT 0x140B
+#define GL_INCR 0x1E02
+#define GL_INCR_WRAP 0x8507
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_INT 0x1404
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_INT_SAMPLER_1D 0x8DC9
+#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_INT_SAMPLER_2D_RECT 0x8DCD
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#define GL_INVALID_INDEX 0xFFFFFFFF
+#define GL_INVALID_OPERATION 0x0502
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVERT 0x150A
+#define GL_KEEP 0x1E00
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_LEFT 0x0406
+#define GL_LEQUAL 0x0203
+#define GL_LESS 0x0201
+#define GL_LINE 0x1B01
+#define GL_LINEAR 0x2601
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINES 0x0001
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_LINE_STRIP 0x0003
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_WIDTH_RANGE 0x0B22
+#define GL_LINK_STATUS 0x8B82
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_LOWER_LEFT 0x8CA1
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
+#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
+#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
+#define GL_MAP_READ_BIT 0x0001
+#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
+#define GL_MAP_WRITE_BIT 0x0002
+#define GL_MAX 0x8008
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
+#define GL_MAX_CLIP_DISTANCES 0x0D32
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_DRAW_BUFFERS 0x8824
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_MAX_SAMPLES 0x8D57
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MIN 0x8007
+#define GL_MINOR_VERSION 0x821C
+#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_MULTISAMPLE 0x809D
+#define GL_NAND 0x150E
+#define GL_NEAREST 0x2600
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEVER 0x0200
+#define GL_NICEST 0x1102
+#define GL_NONE 0
+#define GL_NOOP 0x1505
+#define GL_NOR 0x1508
+#define GL_NOTEQUAL 0x0205
+#define GL_NO_ERROR 0
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_OBJECT_TYPE 0x9112
+#define GL_ONE 1
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
+#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_OR 0x1507
+#define GL_OR_INVERTED 0x150D
+#define GL_OR_REVERSE 0x150B
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_PIXEL_PACK_BUFFER 0x88EB
+#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER 0x88EC
+#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
+#define GL_POINT 0x1B00
+#define GL_POINTS 0x0000
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_POINT_SIZE_RANGE 0x0B12
+#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_PRIMITIVES_GENERATED 0x8C87
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+#define GL_PROGRAM_POINT_SIZE 0x8642
+#define GL_PROVOKING_VERTEX 0x8E4F
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
+#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
+#define GL_QUERY_BY_REGION_WAIT 0x8E15
+#define GL_QUERY_COUNTER_BITS 0x8864
+#define GL_QUERY_NO_WAIT 0x8E14
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#define GL_QUERY_WAIT 0x8E13
+#define GL_R11F_G11F_B10F 0x8C3A
+#define GL_R16 0x822A
+#define GL_R16F 0x822D
+#define GL_R16I 0x8233
+#define GL_R16UI 0x8234
+#define GL_R16_SNORM 0x8F98
+#define GL_R32F 0x822E
+#define GL_R32I 0x8235
+#define GL_R32UI 0x8236
+#define GL_R3_G3_B2 0x2A10
+#define GL_R8 0x8229
+#define GL_R8I 0x8231
+#define GL_R8UI 0x8232
+#define GL_R8_SNORM 0x8F94
+#define GL_RASTERIZER_DISCARD 0x8C89
+#define GL_READ_BUFFER 0x0C02
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#define GL_READ_ONLY 0x88B8
+#define GL_READ_WRITE 0x88BA
+#define GL_RED 0x1903
+#define GL_RED_INTEGER 0x8D94
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERER 0x1F01
+#define GL_REPEAT 0x2901
+#define GL_REPLACE 0x1E01
+#define GL_RG 0x8227
+#define GL_RG16 0x822C
+#define GL_RG16F 0x822F
+#define GL_RG16I 0x8239
+#define GL_RG16UI 0x823A
+#define GL_RG16_SNORM 0x8F99
+#define GL_RG32F 0x8230
+#define GL_RG32I 0x823B
+#define GL_RG32UI 0x823C
+#define GL_RG8 0x822B
+#define GL_RG8I 0x8237
+#define GL_RG8UI 0x8238
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB 0x1907
+#define GL_RGB10 0x8052
+#define GL_RGB10_A2 0x8059
+#define GL_RGB10_A2UI 0x906F
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGB16F 0x881B
+#define GL_RGB16I 0x8D89
+#define GL_RGB16UI 0x8D77
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGB32F 0x8815
+#define GL_RGB32I 0x8D83
+#define GL_RGB32UI 0x8D71
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB5_A1 0x8057
+#define GL_RGB8 0x8051
+#define GL_RGB8I 0x8D8F
+#define GL_RGB8UI 0x8D7D
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGB9_E5 0x8C3D
+#define GL_RGBA 0x1908
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_RGBA16F 0x881A
+#define GL_RGBA16I 0x8D88
+#define GL_RGBA16UI 0x8D76
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_RGBA2 0x8055
+#define GL_RGBA32F 0x8814
+#define GL_RGBA32I 0x8D82
+#define GL_RGBA32UI 0x8D70
+#define GL_RGBA4 0x8056
+#define GL_RGBA8 0x8058
+#define GL_RGBA8I 0x8D8E
+#define GL_RGBA8UI 0x8D7C
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RG_INTEGER 0x8228
+#define GL_RIGHT 0x0407
+#define GL_SAMPLER_1D 0x8B5D
+#define GL_SAMPLER_1D_ARRAY 0x8DC0
+#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
+#define GL_SAMPLER_1D_SHADOW 0x8B61
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_SAMPLER_2D_RECT 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_BINDING 0x8919
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLES_PASSED 0x8914
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_SEPARATE_ATTRIBS 0x8C8D
+#define GL_SET 0x150F
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_SHORT 0x1402
+#define GL_SIGNALED 0x9119
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC1_COLOR 0x88F9
+#define GL_SRC_ALPHA 0x0302
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_SRC_COLOR 0x0300
+#define GL_SRGB 0x8C40
+#define GL_SRGB8 0x8C41
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_SRGB_ALPHA 0x8C42
+#define GL_STATIC_COPY 0x88E6
+#define GL_STATIC_DRAW 0x88E4
+#define GL_STATIC_READ 0x88E5
+#define GL_STENCIL 0x1802
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_INDEX1 0x8D46
+#define GL_STENCIL_INDEX16 0x8D49
+#define GL_STENCIL_INDEX4 0x8D47
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_TEST 0x0B90
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STEREO 0x0C33
+#define GL_STREAM_COPY 0x88E2
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STREAM_READ 0x88E1
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_SYNC_CONDITION 0x9113
+#define GL_SYNC_FENCE 0x9116
+#define GL_SYNC_FLAGS 0x9115
+#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
+#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
+#define GL_SYNC_STATUS 0x9114
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_1D_ARRAY 0x8C18
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_ALPHA_SIZE 0x805F
+#define GL_TEXTURE_ALPHA_TYPE 0x8C13
+#define GL_TEXTURE_BASE_LEVEL 0x813C
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
+#define GL_TEXTURE_BLUE_SIZE 0x805E
+#define GL_TEXTURE_BLUE_TYPE 0x8C12
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_DEPTH_TYPE 0x8C16
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_GREEN_SIZE 0x805D
+#define GL_TEXTURE_GREEN_TYPE 0x8C11
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_TEXTURE_LOD_BIAS 0x8501
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MAX_LEVEL 0x813D
+#define GL_TEXTURE_MAX_LOD 0x813B
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_MIN_LOD 0x813A
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_TEXTURE_RED_SIZE 0x805C
+#define GL_TEXTURE_RED_TYPE 0x8C10
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_SHARED_SIZE 0x8C3F
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#define GL_TEXTURE_SWIZZLE_A 0x8E45
+#define GL_TEXTURE_SWIZZLE_B 0x8E44
+#define GL_TEXTURE_SWIZZLE_G 0x8E43
+#define GL_TEXTURE_SWIZZLE_R 0x8E42
+#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TIMEOUT_EXPIRED 0x911B
+#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFF
+#define GL_TIMESTAMP 0x8E28
+#define GL_TIME_ELAPSED 0x88BF
+#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_TRUE 1
+#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
+#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
+#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BUFFER 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING 0x8A28
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
+#define GL_UNIFORM_BUFFER_START 0x8A29
+#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
+#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
+#define GL_UNIFORM_NAME_LENGTH 0x8A39
+#define GL_UNIFORM_OFFSET 0x8A3B
+#define GL_UNIFORM_SIZE 0x8A38
+#define GL_UNIFORM_TYPE 0x8A37
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_UNSIGNALED 0x9118
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_INT 0x1405
+#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
+#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
+#define GL_UNSIGNED_INT_VEC2 0x8DC6
+#define GL_UNSIGNED_INT_VEC3 0x8DC7
+#define GL_UNSIGNED_INT_VEC4 0x8DC8
+#define GL_UNSIGNED_NORMALIZED 0x8C17
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UPPER_LEFT 0x8CA2
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_VENDOR 0x1F00
+#define GL_VERSION 0x1F02
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_VIEWPORT 0x0BA2
+#define GL_WAIT_FAILED 0x911D
+#define GL_WRITE_ONLY 0x88B9
+#define GL_XOR 0x1506
+#define GL_ZERO 0
+
+
+#include "khrplatform.h"
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef void GLvoid;
+typedef khronos_int8_t GLbyte;
+typedef khronos_uint8_t GLubyte;
+typedef khronos_int16_t GLshort;
+typedef khronos_uint16_t GLushort;
+typedef int GLint;
+typedef unsigned int GLuint;
+typedef khronos_int32_t GLclampx;
+typedef int GLsizei;
+typedef khronos_float_t GLfloat;
+typedef khronos_float_t GLclampf;
+typedef double GLdouble;
+typedef double GLclampd;
+typedef void *GLeglClientBufferEXT;
+typedef void *GLeglImageOES;
+typedef char GLchar;
+typedef char GLcharARB;
+#ifdef __APPLE__
+typedef void *GLhandleARB;
+#else
+typedef unsigned int GLhandleARB;
+#endif
+typedef khronos_uint16_t GLhalf;
+typedef khronos_uint16_t GLhalfARB;
+typedef khronos_int32_t GLfixed;
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_intptr_t GLintptr;
+#else
+typedef khronos_intptr_t GLintptr;
+#endif
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_intptr_t GLintptrARB;
+#else
+typedef khronos_intptr_t GLintptrARB;
+#endif
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_ssize_t GLsizeiptr;
+#else
+typedef khronos_ssize_t GLsizeiptr;
+#endif
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060)
+typedef khronos_ssize_t GLsizeiptrARB;
+#else
+typedef khronos_ssize_t GLsizeiptrARB;
+#endif
+typedef khronos_int64_t GLint64;
+typedef khronos_int64_t GLint64EXT;
+typedef khronos_uint64_t GLuint64;
+typedef khronos_uint64_t GLuint64EXT;
+typedef struct __GLsync *GLsync;
+struct _cl_context;
+struct _cl_event;
+typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+typedef unsigned short GLhalfNV;
+typedef GLintptr GLvdpauSurfaceNV;
+typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void);
+
+
+#define GL_VERSION_1_0 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_0;
+#define GL_VERSION_1_1 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_1;
+#define GL_VERSION_1_2 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_2;
+#define GL_VERSION_1_3 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_3;
+#define GL_VERSION_1_4 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_4;
+#define GL_VERSION_1_5 1
+GLAD_API_CALL int GLAD_GL_VERSION_1_5;
+#define GL_VERSION_2_0 1
+GLAD_API_CALL int GLAD_GL_VERSION_2_0;
+#define GL_VERSION_2_1 1
+GLAD_API_CALL int GLAD_GL_VERSION_2_1;
+#define GL_VERSION_3_0 1
+GLAD_API_CALL int GLAD_GL_VERSION_3_0;
+#define GL_VERSION_3_1 1
+GLAD_API_CALL int GLAD_GL_VERSION_3_1;
+#define GL_VERSION_3_2 1
+GLAD_API_CALL int GLAD_GL_VERSION_3_2;
+#define GL_VERSION_3_3 1
+GLAD_API_CALL int GLAD_GL_VERSION_3_3;
+
+
+typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture);
+typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBEGINQUERYPROC)(GLenum target, GLuint id);
+typedef void (GLAD_API_PTR *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode);
+typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler);
+typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture);
+typedef void (GLAD_API_PTR *PFNGLBINDVERTEXARRAYPROC)(GLuint array);
+typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
+typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (GLAD_API_PTR *PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage);
+typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data);
+typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp);
+typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHPROC)(GLdouble depth);
+typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s);
+typedef GLenum (GLAD_API_PTR *PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+typedef void (GLAD_API_PTR *PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data);
+typedef void (GLAD_API_PTR *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef GLuint (GLAD_API_PTR *PFNGLCREATEPROGRAMPROC)(void);
+typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type);
+typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint * ids);
+typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint * samplers);
+typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDELETESYNCPROC)(GLsync sync);
+typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint * arrays);
+typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func);
+typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag);
+typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f);
+typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader);
+typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLDISABLEIPROC)(GLenum target, GLuint index);
+typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
+typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERPROC)(GLenum buf);
+typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum * bufs);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount);
+typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices);
+typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex);
+typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap);
+typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLENABLEIPROC)(GLenum target, GLuint index);
+typedef void (GLAD_API_PTR *PFNGLENDCONDITIONALRENDERPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLENDQUERYPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLENDTRANSFORMFEEDBACKPROC)(void);
+typedef GLsync (GLAD_API_PTR *PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags);
+typedef void (GLAD_API_PTR *PFNGLFINISHPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLFLUSHPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers);
+typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers);
+typedef void (GLAD_API_PTR *PFNGLGENQUERIESPROC)(GLsizei n, GLuint * ids);
+typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers);
+typedef void (GLAD_API_PTR *PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint * samplers);
+typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures);
+typedef void (GLAD_API_PTR *PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint * arrays);
+typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName);
+typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders);
+typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean * data);
+typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void ** params);
+typedef void (GLAD_API_PTR *PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void * data);
+typedef void (GLAD_API_PTR *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void * img);
+typedef void (GLAD_API_PTR *PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble * data);
+typedef GLenum (GLAD_API_PTR *PFNGLGETERRORPROC)(void);
+typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data);
+typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar * name);
+typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint * data);
+typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data);
+typedef void (GLAD_API_PTR *PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat * val);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source);
+typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params);
+typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name);
+typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGIPROC)(GLenum name, GLuint index);
+typedef void (GLAD_API_PTR *PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei * length, GLint * values);
+typedef void (GLAD_API_PTR *PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels);
+typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name);
+typedef GLuint (GLAD_API_PTR *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar * uniformBlockName);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices);
+typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params);
+typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode);
+typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap);
+typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDIPROC)(GLenum target, GLuint index);
+typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program);
+typedef GLboolean (GLAD_API_PTR *PFNGLISQUERYPROC)(GLuint id);
+typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSAMPLERPROC)(GLuint sampler);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader);
+typedef GLboolean (GLAD_API_PTR *PFNGLISSYNCPROC)(GLsync sync);
+typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture);
+typedef GLboolean (GLAD_API_PTR *PFNGLISVERTEXARRAYPROC)(GLuint array);
+typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width);
+typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLLOGICOPPROC)(GLenum opcode);
+typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERPROC)(GLenum target, GLenum access);
+typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount);
+typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex);
+typedef void (GLAD_API_PTR *PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLPOINTSIZEPROC)(GLfloat size);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units);
+typedef void (GLAD_API_PTR *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index);
+typedef void (GLAD_API_PTR *PFNGLPROVOKINGVERTEXPROC)(GLenum mode);
+typedef void (GLAD_API_PTR *PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target);
+typedef void (GLAD_API_PTR *PFNGLREADBUFFERPROC)(GLenum src);
+typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels);
+typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert);
+typedef void (GLAD_API_PTR *PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat * param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint * param);
+typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);
+typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (GLAD_API_PTR *PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
+typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels);
+typedef void (GLAD_API_PTR *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value);
+typedef GLboolean (GLAD_API_PTR *PFNGLUNMAPBUFFERPROC)(GLenum target);
+typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort * v);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value);
+typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer);
+typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GLAD_API_PTR *PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
+
+GLAD_API_CALL PFNGLACTIVETEXTUREPROC glad_glActiveTexture;
+#define glActiveTexture glad_glActiveTexture
+GLAD_API_CALL PFNGLATTACHSHADERPROC glad_glAttachShader;
+#define glAttachShader glad_glAttachShader
+GLAD_API_CALL PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;
+#define glBeginConditionalRender glad_glBeginConditionalRender
+GLAD_API_CALL PFNGLBEGINQUERYPROC glad_glBeginQuery;
+#define glBeginQuery glad_glBeginQuery
+GLAD_API_CALL PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;
+#define glBeginTransformFeedback glad_glBeginTransformFeedback
+GLAD_API_CALL PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
+#define glBindAttribLocation glad_glBindAttribLocation
+GLAD_API_CALL PFNGLBINDBUFFERPROC glad_glBindBuffer;
+#define glBindBuffer glad_glBindBuffer
+GLAD_API_CALL PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;
+#define glBindBufferBase glad_glBindBufferBase
+GLAD_API_CALL PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;
+#define glBindBufferRange glad_glBindBufferRange
+GLAD_API_CALL PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;
+#define glBindFragDataLocation glad_glBindFragDataLocation
+GLAD_API_CALL PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed;
+#define glBindFragDataLocationIndexed glad_glBindFragDataLocationIndexed
+GLAD_API_CALL PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;
+#define glBindFramebuffer glad_glBindFramebuffer
+GLAD_API_CALL PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;
+#define glBindRenderbuffer glad_glBindRenderbuffer
+GLAD_API_CALL PFNGLBINDSAMPLERPROC glad_glBindSampler;
+#define glBindSampler glad_glBindSampler
+GLAD_API_CALL PFNGLBINDTEXTUREPROC glad_glBindTexture;
+#define glBindTexture glad_glBindTexture
+GLAD_API_CALL PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;
+#define glBindVertexArray glad_glBindVertexArray
+GLAD_API_CALL PFNGLBLENDCOLORPROC glad_glBlendColor;
+#define glBlendColor glad_glBlendColor
+GLAD_API_CALL PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
+#define glBlendEquation glad_glBlendEquation
+GLAD_API_CALL PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;
+#define glBlendEquationSeparate glad_glBlendEquationSeparate
+GLAD_API_CALL PFNGLBLENDFUNCPROC glad_glBlendFunc;
+#define glBlendFunc glad_glBlendFunc
+GLAD_API_CALL PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
+#define glBlendFuncSeparate glad_glBlendFuncSeparate
+GLAD_API_CALL PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;
+#define glBlitFramebuffer glad_glBlitFramebuffer
+GLAD_API_CALL PFNGLBUFFERDATAPROC glad_glBufferData;
+#define glBufferData glad_glBufferData
+GLAD_API_CALL PFNGLBUFFERSUBDATAPROC glad_glBufferSubData;
+#define glBufferSubData glad_glBufferSubData
+GLAD_API_CALL PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;
+#define glCheckFramebufferStatus glad_glCheckFramebufferStatus
+GLAD_API_CALL PFNGLCLAMPCOLORPROC glad_glClampColor;
+#define glClampColor glad_glClampColor
+GLAD_API_CALL PFNGLCLEARPROC glad_glClear;
+#define glClear glad_glClear
+GLAD_API_CALL PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;
+#define glClearBufferfi glad_glClearBufferfi
+GLAD_API_CALL PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;
+#define glClearBufferfv glad_glClearBufferfv
+GLAD_API_CALL PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;
+#define glClearBufferiv glad_glClearBufferiv
+GLAD_API_CALL PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;
+#define glClearBufferuiv glad_glClearBufferuiv
+GLAD_API_CALL PFNGLCLEARCOLORPROC glad_glClearColor;
+#define glClearColor glad_glClearColor
+GLAD_API_CALL PFNGLCLEARDEPTHPROC glad_glClearDepth;
+#define glClearDepth glad_glClearDepth
+GLAD_API_CALL PFNGLCLEARSTENCILPROC glad_glClearStencil;
+#define glClearStencil glad_glClearStencil
+GLAD_API_CALL PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;
+#define glClientWaitSync glad_glClientWaitSync
+GLAD_API_CALL PFNGLCOLORMASKPROC glad_glColorMask;
+#define glColorMask glad_glColorMask
+GLAD_API_CALL PFNGLCOLORMASKIPROC glad_glColorMaski;
+#define glColorMaski glad_glColorMaski
+GLAD_API_CALL PFNGLCOMPILESHADERPROC glad_glCompileShader;
+#define glCompileShader glad_glCompileShader
+GLAD_API_CALL PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;
+#define glCompressedTexImage1D glad_glCompressedTexImage1D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;
+#define glCompressedTexImage2D glad_glCompressedTexImage2D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;
+#define glCompressedTexImage3D glad_glCompressedTexImage3D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;
+#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;
+#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D
+GLAD_API_CALL PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;
+#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D
+GLAD_API_CALL PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;
+#define glCopyBufferSubData glad_glCopyBufferSubData
+GLAD_API_CALL PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;
+#define glCopyTexImage1D glad_glCopyTexImage1D
+GLAD_API_CALL PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;
+#define glCopyTexImage2D glad_glCopyTexImage2D
+GLAD_API_CALL PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;
+#define glCopyTexSubImage1D glad_glCopyTexSubImage1D
+GLAD_API_CALL PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;
+#define glCopyTexSubImage2D glad_glCopyTexSubImage2D
+GLAD_API_CALL PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;
+#define glCopyTexSubImage3D glad_glCopyTexSubImage3D
+GLAD_API_CALL PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
+#define glCreateProgram glad_glCreateProgram
+GLAD_API_CALL PFNGLCREATESHADERPROC glad_glCreateShader;
+#define glCreateShader glad_glCreateShader
+GLAD_API_CALL PFNGLCULLFACEPROC glad_glCullFace;
+#define glCullFace glad_glCullFace
+GLAD_API_CALL PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;
+#define glDeleteBuffers glad_glDeleteBuffers
+GLAD_API_CALL PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;
+#define glDeleteFramebuffers glad_glDeleteFramebuffers
+GLAD_API_CALL PFNGLDELETEPROGRAMPROC glad_glDeleteProgram;
+#define glDeleteProgram glad_glDeleteProgram
+GLAD_API_CALL PFNGLDELETEQUERIESPROC glad_glDeleteQueries;
+#define glDeleteQueries glad_glDeleteQueries
+GLAD_API_CALL PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;
+#define glDeleteRenderbuffers glad_glDeleteRenderbuffers
+GLAD_API_CALL PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers;
+#define glDeleteSamplers glad_glDeleteSamplers
+GLAD_API_CALL PFNGLDELETESHADERPROC glad_glDeleteShader;
+#define glDeleteShader glad_glDeleteShader
+GLAD_API_CALL PFNGLDELETESYNCPROC glad_glDeleteSync;
+#define glDeleteSync glad_glDeleteSync
+GLAD_API_CALL PFNGLDELETETEXTURESPROC glad_glDeleteTextures;
+#define glDeleteTextures glad_glDeleteTextures
+GLAD_API_CALL PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;
+#define glDeleteVertexArrays glad_glDeleteVertexArrays
+GLAD_API_CALL PFNGLDEPTHFUNCPROC glad_glDepthFunc;
+#define glDepthFunc glad_glDepthFunc
+GLAD_API_CALL PFNGLDEPTHMASKPROC glad_glDepthMask;
+#define glDepthMask glad_glDepthMask
+GLAD_API_CALL PFNGLDEPTHRANGEPROC glad_glDepthRange;
+#define glDepthRange glad_glDepthRange
+GLAD_API_CALL PFNGLDETACHSHADERPROC glad_glDetachShader;
+#define glDetachShader glad_glDetachShader
+GLAD_API_CALL PFNGLDISABLEPROC glad_glDisable;
+#define glDisable glad_glDisable
+GLAD_API_CALL PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;
+#define glDisableVertexAttribArray glad_glDisableVertexAttribArray
+GLAD_API_CALL PFNGLDISABLEIPROC glad_glDisablei;
+#define glDisablei glad_glDisablei
+GLAD_API_CALL PFNGLDRAWARRAYSPROC glad_glDrawArrays;
+#define glDrawArrays glad_glDrawArrays
+GLAD_API_CALL PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;
+#define glDrawArraysInstanced glad_glDrawArraysInstanced
+GLAD_API_CALL PFNGLDRAWBUFFERPROC glad_glDrawBuffer;
+#define glDrawBuffer glad_glDrawBuffer
+GLAD_API_CALL PFNGLDRAWBUFFERSPROC glad_glDrawBuffers;
+#define glDrawBuffers glad_glDrawBuffers
+GLAD_API_CALL PFNGLDRAWELEMENTSPROC glad_glDrawElements;
+#define glDrawElements glad_glDrawElements
+GLAD_API_CALL PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;
+#define glDrawElementsBaseVertex glad_glDrawElementsBaseVertex
+GLAD_API_CALL PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;
+#define glDrawElementsInstanced glad_glDrawElementsInstanced
+GLAD_API_CALL PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;
+#define glDrawElementsInstancedBaseVertex glad_glDrawElementsInstancedBaseVertex
+GLAD_API_CALL PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;
+#define glDrawRangeElements glad_glDrawRangeElements
+GLAD_API_CALL PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;
+#define glDrawRangeElementsBaseVertex glad_glDrawRangeElementsBaseVertex
+GLAD_API_CALL PFNGLENABLEPROC glad_glEnable;
+#define glEnable glad_glEnable
+GLAD_API_CALL PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;
+#define glEnableVertexAttribArray glad_glEnableVertexAttribArray
+GLAD_API_CALL PFNGLENABLEIPROC glad_glEnablei;
+#define glEnablei glad_glEnablei
+GLAD_API_CALL PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;
+#define glEndConditionalRender glad_glEndConditionalRender
+GLAD_API_CALL PFNGLENDQUERYPROC glad_glEndQuery;
+#define glEndQuery glad_glEndQuery
+GLAD_API_CALL PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;
+#define glEndTransformFeedback glad_glEndTransformFeedback
+GLAD_API_CALL PFNGLFENCESYNCPROC glad_glFenceSync;
+#define glFenceSync glad_glFenceSync
+GLAD_API_CALL PFNGLFINISHPROC glad_glFinish;
+#define glFinish glad_glFinish
+GLAD_API_CALL PFNGLFLUSHPROC glad_glFlush;
+#define glFlush glad_glFlush
+GLAD_API_CALL PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;
+#define glFlushMappedBufferRange glad_glFlushMappedBufferRange
+GLAD_API_CALL PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;
+#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;
+#define glFramebufferTexture glad_glFramebufferTexture
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;
+#define glFramebufferTexture1D glad_glFramebufferTexture1D
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;
+#define glFramebufferTexture2D glad_glFramebufferTexture2D
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;
+#define glFramebufferTexture3D glad_glFramebufferTexture3D
+GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;
+#define glFramebufferTextureLayer glad_glFramebufferTextureLayer
+GLAD_API_CALL PFNGLFRONTFACEPROC glad_glFrontFace;
+#define glFrontFace glad_glFrontFace
+GLAD_API_CALL PFNGLGENBUFFERSPROC glad_glGenBuffers;
+#define glGenBuffers glad_glGenBuffers
+GLAD_API_CALL PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;
+#define glGenFramebuffers glad_glGenFramebuffers
+GLAD_API_CALL PFNGLGENQUERIESPROC glad_glGenQueries;
+#define glGenQueries glad_glGenQueries
+GLAD_API_CALL PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;
+#define glGenRenderbuffers glad_glGenRenderbuffers
+GLAD_API_CALL PFNGLGENSAMPLERSPROC glad_glGenSamplers;
+#define glGenSamplers glad_glGenSamplers
+GLAD_API_CALL PFNGLGENTEXTURESPROC glad_glGenTextures;
+#define glGenTextures glad_glGenTextures
+GLAD_API_CALL PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;
+#define glGenVertexArrays glad_glGenVertexArrays
+GLAD_API_CALL PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;
+#define glGenerateMipmap glad_glGenerateMipmap
+GLAD_API_CALL PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;
+#define glGetActiveAttrib glad_glGetActiveAttrib
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;
+#define glGetActiveUniform glad_glGetActiveUniform
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;
+#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;
+#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;
+#define glGetActiveUniformName glad_glGetActiveUniformName
+GLAD_API_CALL PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;
+#define glGetActiveUniformsiv glad_glGetActiveUniformsiv
+GLAD_API_CALL PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;
+#define glGetAttachedShaders glad_glGetAttachedShaders
+GLAD_API_CALL PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;
+#define glGetAttribLocation glad_glGetAttribLocation
+GLAD_API_CALL PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;
+#define glGetBooleani_v glad_glGetBooleani_v
+GLAD_API_CALL PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
+#define glGetBooleanv glad_glGetBooleanv
+GLAD_API_CALL PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;
+#define glGetBufferParameteri64v glad_glGetBufferParameteri64v
+GLAD_API_CALL PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;
+#define glGetBufferParameteriv glad_glGetBufferParameteriv
+GLAD_API_CALL PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;
+#define glGetBufferPointerv glad_glGetBufferPointerv
+GLAD_API_CALL PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;
+#define glGetBufferSubData glad_glGetBufferSubData
+GLAD_API_CALL PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;
+#define glGetCompressedTexImage glad_glGetCompressedTexImage
+GLAD_API_CALL PFNGLGETDOUBLEVPROC glad_glGetDoublev;
+#define glGetDoublev glad_glGetDoublev
+GLAD_API_CALL PFNGLGETERRORPROC glad_glGetError;
+#define glGetError glad_glGetError
+GLAD_API_CALL PFNGLGETFLOATVPROC glad_glGetFloatv;
+#define glGetFloatv glad_glGetFloatv
+GLAD_API_CALL PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex;
+#define glGetFragDataIndex glad_glGetFragDataIndex
+GLAD_API_CALL PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;
+#define glGetFragDataLocation glad_glGetFragDataLocation
+GLAD_API_CALL PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;
+#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv
+GLAD_API_CALL PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;
+#define glGetInteger64i_v glad_glGetInteger64i_v
+GLAD_API_CALL PFNGLGETINTEGER64VPROC glad_glGetInteger64v;
+#define glGetInteger64v glad_glGetInteger64v
+GLAD_API_CALL PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;
+#define glGetIntegeri_v glad_glGetIntegeri_v
+GLAD_API_CALL PFNGLGETINTEGERVPROC glad_glGetIntegerv;
+#define glGetIntegerv glad_glGetIntegerv
+GLAD_API_CALL PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;
+#define glGetMultisamplefv glad_glGetMultisamplefv
+GLAD_API_CALL PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;
+#define glGetProgramInfoLog glad_glGetProgramInfoLog
+GLAD_API_CALL PFNGLGETPROGRAMIVPROC glad_glGetProgramiv;
+#define glGetProgramiv glad_glGetProgramiv
+GLAD_API_CALL PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v;
+#define glGetQueryObjecti64v glad_glGetQueryObjecti64v
+GLAD_API_CALL PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;
+#define glGetQueryObjectiv glad_glGetQueryObjectiv
+GLAD_API_CALL PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v;
+#define glGetQueryObjectui64v glad_glGetQueryObjectui64v
+GLAD_API_CALL PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;
+#define glGetQueryObjectuiv glad_glGetQueryObjectuiv
+GLAD_API_CALL PFNGLGETQUERYIVPROC glad_glGetQueryiv;
+#define glGetQueryiv glad_glGetQueryiv
+GLAD_API_CALL PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;
+#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv
+GLAD_API_CALL PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv;
+#define glGetSamplerParameterIiv glad_glGetSamplerParameterIiv
+GLAD_API_CALL PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv;
+#define glGetSamplerParameterIuiv glad_glGetSamplerParameterIuiv
+GLAD_API_CALL PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv;
+#define glGetSamplerParameterfv glad_glGetSamplerParameterfv
+GLAD_API_CALL PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv;
+#define glGetSamplerParameteriv glad_glGetSamplerParameteriv
+GLAD_API_CALL PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;
+#define glGetShaderInfoLog glad_glGetShaderInfoLog
+GLAD_API_CALL PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;
+#define glGetShaderSource glad_glGetShaderSource
+GLAD_API_CALL PFNGLGETSHADERIVPROC glad_glGetShaderiv;
+#define glGetShaderiv glad_glGetShaderiv
+GLAD_API_CALL PFNGLGETSTRINGPROC glad_glGetString;
+#define glGetString glad_glGetString
+GLAD_API_CALL PFNGLGETSTRINGIPROC glad_glGetStringi;
+#define glGetStringi glad_glGetStringi
+GLAD_API_CALL PFNGLGETSYNCIVPROC glad_glGetSynciv;
+#define glGetSynciv glad_glGetSynciv
+GLAD_API_CALL PFNGLGETTEXIMAGEPROC glad_glGetTexImage;
+#define glGetTexImage glad_glGetTexImage
+GLAD_API_CALL PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;
+#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv
+GLAD_API_CALL PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;
+#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv
+GLAD_API_CALL PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;
+#define glGetTexParameterIiv glad_glGetTexParameterIiv
+GLAD_API_CALL PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;
+#define glGetTexParameterIuiv glad_glGetTexParameterIuiv
+GLAD_API_CALL PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;
+#define glGetTexParameterfv glad_glGetTexParameterfv
+GLAD_API_CALL PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;
+#define glGetTexParameteriv glad_glGetTexParameteriv
+GLAD_API_CALL PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;
+#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying
+GLAD_API_CALL PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;
+#define glGetUniformBlockIndex glad_glGetUniformBlockIndex
+GLAD_API_CALL PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;
+#define glGetUniformIndices glad_glGetUniformIndices
+GLAD_API_CALL PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;
+#define glGetUniformLocation glad_glGetUniformLocation
+GLAD_API_CALL PFNGLGETUNIFORMFVPROC glad_glGetUniformfv;
+#define glGetUniformfv glad_glGetUniformfv
+GLAD_API_CALL PFNGLGETUNIFORMIVPROC glad_glGetUniformiv;
+#define glGetUniformiv glad_glGetUniformiv
+GLAD_API_CALL PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;
+#define glGetUniformuiv glad_glGetUniformuiv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;
+#define glGetVertexAttribIiv glad_glGetVertexAttribIiv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;
+#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;
+#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;
+#define glGetVertexAttribdv glad_glGetVertexAttribdv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;
+#define glGetVertexAttribfv glad_glGetVertexAttribfv
+GLAD_API_CALL PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;
+#define glGetVertexAttribiv glad_glGetVertexAttribiv
+GLAD_API_CALL PFNGLHINTPROC glad_glHint;
+#define glHint glad_glHint
+GLAD_API_CALL PFNGLISBUFFERPROC glad_glIsBuffer;
+#define glIsBuffer glad_glIsBuffer
+GLAD_API_CALL PFNGLISENABLEDPROC glad_glIsEnabled;
+#define glIsEnabled glad_glIsEnabled
+GLAD_API_CALL PFNGLISENABLEDIPROC glad_glIsEnabledi;
+#define glIsEnabledi glad_glIsEnabledi
+GLAD_API_CALL PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;
+#define glIsFramebuffer glad_glIsFramebuffer
+GLAD_API_CALL PFNGLISPROGRAMPROC glad_glIsProgram;
+#define glIsProgram glad_glIsProgram
+GLAD_API_CALL PFNGLISQUERYPROC glad_glIsQuery;
+#define glIsQuery glad_glIsQuery
+GLAD_API_CALL PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;
+#define glIsRenderbuffer glad_glIsRenderbuffer
+GLAD_API_CALL PFNGLISSAMPLERPROC glad_glIsSampler;
+#define glIsSampler glad_glIsSampler
+GLAD_API_CALL PFNGLISSHADERPROC glad_glIsShader;
+#define glIsShader glad_glIsShader
+GLAD_API_CALL PFNGLISSYNCPROC glad_glIsSync;
+#define glIsSync glad_glIsSync
+GLAD_API_CALL PFNGLISTEXTUREPROC glad_glIsTexture;
+#define glIsTexture glad_glIsTexture
+GLAD_API_CALL PFNGLISVERTEXARRAYPROC glad_glIsVertexArray;
+#define glIsVertexArray glad_glIsVertexArray
+GLAD_API_CALL PFNGLLINEWIDTHPROC glad_glLineWidth;
+#define glLineWidth glad_glLineWidth
+GLAD_API_CALL PFNGLLINKPROGRAMPROC glad_glLinkProgram;
+#define glLinkProgram glad_glLinkProgram
+GLAD_API_CALL PFNGLLOGICOPPROC glad_glLogicOp;
+#define glLogicOp glad_glLogicOp
+GLAD_API_CALL PFNGLMAPBUFFERPROC glad_glMapBuffer;
+#define glMapBuffer glad_glMapBuffer
+GLAD_API_CALL PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;
+#define glMapBufferRange glad_glMapBufferRange
+GLAD_API_CALL PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;
+#define glMultiDrawArrays glad_glMultiDrawArrays
+GLAD_API_CALL PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;
+#define glMultiDrawElements glad_glMultiDrawElements
+GLAD_API_CALL PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;
+#define glMultiDrawElementsBaseVertex glad_glMultiDrawElementsBaseVertex
+GLAD_API_CALL PFNGLPIXELSTOREFPROC glad_glPixelStoref;
+#define glPixelStoref glad_glPixelStoref
+GLAD_API_CALL PFNGLPIXELSTOREIPROC glad_glPixelStorei;
+#define glPixelStorei glad_glPixelStorei
+GLAD_API_CALL PFNGLPOINTPARAMETERFPROC glad_glPointParameterf;
+#define glPointParameterf glad_glPointParameterf
+GLAD_API_CALL PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;
+#define glPointParameterfv glad_glPointParameterfv
+GLAD_API_CALL PFNGLPOINTPARAMETERIPROC glad_glPointParameteri;
+#define glPointParameteri glad_glPointParameteri
+GLAD_API_CALL PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;
+#define glPointParameteriv glad_glPointParameteriv
+GLAD_API_CALL PFNGLPOINTSIZEPROC glad_glPointSize;
+#define glPointSize glad_glPointSize
+GLAD_API_CALL PFNGLPOLYGONMODEPROC glad_glPolygonMode;
+#define glPolygonMode glad_glPolygonMode
+GLAD_API_CALL PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;
+#define glPolygonOffset glad_glPolygonOffset
+GLAD_API_CALL PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;
+#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex
+GLAD_API_CALL PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;
+#define glProvokingVertex glad_glProvokingVertex
+GLAD_API_CALL PFNGLQUERYCOUNTERPROC glad_glQueryCounter;
+#define glQueryCounter glad_glQueryCounter
+GLAD_API_CALL PFNGLREADBUFFERPROC glad_glReadBuffer;
+#define glReadBuffer glad_glReadBuffer
+GLAD_API_CALL PFNGLREADPIXELSPROC glad_glReadPixels;
+#define glReadPixels glad_glReadPixels
+GLAD_API_CALL PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;
+#define glRenderbufferStorage glad_glRenderbufferStorage
+GLAD_API_CALL PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;
+#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample
+GLAD_API_CALL PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;
+#define glSampleCoverage glad_glSampleCoverage
+GLAD_API_CALL PFNGLSAMPLEMASKIPROC glad_glSampleMaski;
+#define glSampleMaski glad_glSampleMaski
+GLAD_API_CALL PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv;
+#define glSamplerParameterIiv glad_glSamplerParameterIiv
+GLAD_API_CALL PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv;
+#define glSamplerParameterIuiv glad_glSamplerParameterIuiv
+GLAD_API_CALL PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf;
+#define glSamplerParameterf glad_glSamplerParameterf
+GLAD_API_CALL PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv;
+#define glSamplerParameterfv glad_glSamplerParameterfv
+GLAD_API_CALL PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri;
+#define glSamplerParameteri glad_glSamplerParameteri
+GLAD_API_CALL PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv;
+#define glSamplerParameteriv glad_glSamplerParameteriv
+GLAD_API_CALL PFNGLSCISSORPROC glad_glScissor;
+#define glScissor glad_glScissor
+GLAD_API_CALL PFNGLSHADERSOURCEPROC glad_glShaderSource;
+#define glShaderSource glad_glShaderSource
+GLAD_API_CALL PFNGLSTENCILFUNCPROC glad_glStencilFunc;
+#define glStencilFunc glad_glStencilFunc
+GLAD_API_CALL PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;
+#define glStencilFuncSeparate glad_glStencilFuncSeparate
+GLAD_API_CALL PFNGLSTENCILMASKPROC glad_glStencilMask;
+#define glStencilMask glad_glStencilMask
+GLAD_API_CALL PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;
+#define glStencilMaskSeparate glad_glStencilMaskSeparate
+GLAD_API_CALL PFNGLSTENCILOPPROC glad_glStencilOp;
+#define glStencilOp glad_glStencilOp
+GLAD_API_CALL PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;
+#define glStencilOpSeparate glad_glStencilOpSeparate
+GLAD_API_CALL PFNGLTEXBUFFERPROC glad_glTexBuffer;
+#define glTexBuffer glad_glTexBuffer
+GLAD_API_CALL PFNGLTEXIMAGE1DPROC glad_glTexImage1D;
+#define glTexImage1D glad_glTexImage1D
+GLAD_API_CALL PFNGLTEXIMAGE2DPROC glad_glTexImage2D;
+#define glTexImage2D glad_glTexImage2D
+GLAD_API_CALL PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;
+#define glTexImage2DMultisample glad_glTexImage2DMultisample
+GLAD_API_CALL PFNGLTEXIMAGE3DPROC glad_glTexImage3D;
+#define glTexImage3D glad_glTexImage3D
+GLAD_API_CALL PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;
+#define glTexImage3DMultisample glad_glTexImage3DMultisample
+GLAD_API_CALL PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;
+#define glTexParameterIiv glad_glTexParameterIiv
+GLAD_API_CALL PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;
+#define glTexParameterIuiv glad_glTexParameterIuiv
+GLAD_API_CALL PFNGLTEXPARAMETERFPROC glad_glTexParameterf;
+#define glTexParameterf glad_glTexParameterf
+GLAD_API_CALL PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;
+#define glTexParameterfv glad_glTexParameterfv
+GLAD_API_CALL PFNGLTEXPARAMETERIPROC glad_glTexParameteri;
+#define glTexParameteri glad_glTexParameteri
+GLAD_API_CALL PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;
+#define glTexParameteriv glad_glTexParameteriv
+GLAD_API_CALL PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;
+#define glTexSubImage1D glad_glTexSubImage1D
+GLAD_API_CALL PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;
+#define glTexSubImage2D glad_glTexSubImage2D
+GLAD_API_CALL PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;
+#define glTexSubImage3D glad_glTexSubImage3D
+GLAD_API_CALL PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;
+#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings
+GLAD_API_CALL PFNGLUNIFORM1FPROC glad_glUniform1f;
+#define glUniform1f glad_glUniform1f
+GLAD_API_CALL PFNGLUNIFORM1FVPROC glad_glUniform1fv;
+#define glUniform1fv glad_glUniform1fv
+GLAD_API_CALL PFNGLUNIFORM1IPROC glad_glUniform1i;
+#define glUniform1i glad_glUniform1i
+GLAD_API_CALL PFNGLUNIFORM1IVPROC glad_glUniform1iv;
+#define glUniform1iv glad_glUniform1iv
+GLAD_API_CALL PFNGLUNIFORM1UIPROC glad_glUniform1ui;
+#define glUniform1ui glad_glUniform1ui
+GLAD_API_CALL PFNGLUNIFORM1UIVPROC glad_glUniform1uiv;
+#define glUniform1uiv glad_glUniform1uiv
+GLAD_API_CALL PFNGLUNIFORM2FPROC glad_glUniform2f;
+#define glUniform2f glad_glUniform2f
+GLAD_API_CALL PFNGLUNIFORM2FVPROC glad_glUniform2fv;
+#define glUniform2fv glad_glUniform2fv
+GLAD_API_CALL PFNGLUNIFORM2IPROC glad_glUniform2i;
+#define glUniform2i glad_glUniform2i
+GLAD_API_CALL PFNGLUNIFORM2IVPROC glad_glUniform2iv;
+#define glUniform2iv glad_glUniform2iv
+GLAD_API_CALL PFNGLUNIFORM2UIPROC glad_glUniform2ui;
+#define glUniform2ui glad_glUniform2ui
+GLAD_API_CALL PFNGLUNIFORM2UIVPROC glad_glUniform2uiv;
+#define glUniform2uiv glad_glUniform2uiv
+GLAD_API_CALL PFNGLUNIFORM3FPROC glad_glUniform3f;
+#define glUniform3f glad_glUniform3f
+GLAD_API_CALL PFNGLUNIFORM3FVPROC glad_glUniform3fv;
+#define glUniform3fv glad_glUniform3fv
+GLAD_API_CALL PFNGLUNIFORM3IPROC glad_glUniform3i;
+#define glUniform3i glad_glUniform3i
+GLAD_API_CALL PFNGLUNIFORM3IVPROC glad_glUniform3iv;
+#define glUniform3iv glad_glUniform3iv
+GLAD_API_CALL PFNGLUNIFORM3UIPROC glad_glUniform3ui;
+#define glUniform3ui glad_glUniform3ui
+GLAD_API_CALL PFNGLUNIFORM3UIVPROC glad_glUniform3uiv;
+#define glUniform3uiv glad_glUniform3uiv
+GLAD_API_CALL PFNGLUNIFORM4FPROC glad_glUniform4f;
+#define glUniform4f glad_glUniform4f
+GLAD_API_CALL PFNGLUNIFORM4FVPROC glad_glUniform4fv;
+#define glUniform4fv glad_glUniform4fv
+GLAD_API_CALL PFNGLUNIFORM4IPROC glad_glUniform4i;
+#define glUniform4i glad_glUniform4i
+GLAD_API_CALL PFNGLUNIFORM4IVPROC glad_glUniform4iv;
+#define glUniform4iv glad_glUniform4iv
+GLAD_API_CALL PFNGLUNIFORM4UIPROC glad_glUniform4ui;
+#define glUniform4ui glad_glUniform4ui
+GLAD_API_CALL PFNGLUNIFORM4UIVPROC glad_glUniform4uiv;
+#define glUniform4uiv glad_glUniform4uiv
+GLAD_API_CALL PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;
+#define glUniformBlockBinding glad_glUniformBlockBinding
+GLAD_API_CALL PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;
+#define glUniformMatrix2fv glad_glUniformMatrix2fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;
+#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;
+#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;
+#define glUniformMatrix3fv glad_glUniformMatrix3fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;
+#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;
+#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;
+#define glUniformMatrix4fv glad_glUniformMatrix4fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;
+#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv
+GLAD_API_CALL PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
+#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv
+GLAD_API_CALL PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;
+#define glUnmapBuffer glad_glUnmapBuffer
+GLAD_API_CALL PFNGLUSEPROGRAMPROC glad_glUseProgram;
+#define glUseProgram glad_glUseProgram
+GLAD_API_CALL PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;
+#define glValidateProgram glad_glValidateProgram
+GLAD_API_CALL PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;
+#define glVertexAttrib1d glad_glVertexAttrib1d
+GLAD_API_CALL PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;
+#define glVertexAttrib1dv glad_glVertexAttrib1dv
+GLAD_API_CALL PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;
+#define glVertexAttrib1f glad_glVertexAttrib1f
+GLAD_API_CALL PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;
+#define glVertexAttrib1fv glad_glVertexAttrib1fv
+GLAD_API_CALL PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;
+#define glVertexAttrib1s glad_glVertexAttrib1s
+GLAD_API_CALL PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;
+#define glVertexAttrib1sv glad_glVertexAttrib1sv
+GLAD_API_CALL PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;
+#define glVertexAttrib2d glad_glVertexAttrib2d
+GLAD_API_CALL PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;
+#define glVertexAttrib2dv glad_glVertexAttrib2dv
+GLAD_API_CALL PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;
+#define glVertexAttrib2f glad_glVertexAttrib2f
+GLAD_API_CALL PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;
+#define glVertexAttrib2fv glad_glVertexAttrib2fv
+GLAD_API_CALL PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;
+#define glVertexAttrib2s glad_glVertexAttrib2s
+GLAD_API_CALL PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;
+#define glVertexAttrib2sv glad_glVertexAttrib2sv
+GLAD_API_CALL PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;
+#define glVertexAttrib3d glad_glVertexAttrib3d
+GLAD_API_CALL PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;
+#define glVertexAttrib3dv glad_glVertexAttrib3dv
+GLAD_API_CALL PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;
+#define glVertexAttrib3f glad_glVertexAttrib3f
+GLAD_API_CALL PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;
+#define glVertexAttrib3fv glad_glVertexAttrib3fv
+GLAD_API_CALL PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;
+#define glVertexAttrib3s glad_glVertexAttrib3s
+GLAD_API_CALL PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;
+#define glVertexAttrib3sv glad_glVertexAttrib3sv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;
+#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;
+#define glVertexAttrib4Niv glad_glVertexAttrib4Niv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;
+#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;
+#define glVertexAttrib4Nub glad_glVertexAttrib4Nub
+GLAD_API_CALL PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;
+#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;
+#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv
+GLAD_API_CALL PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;
+#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv
+GLAD_API_CALL PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;
+#define glVertexAttrib4bv glad_glVertexAttrib4bv
+GLAD_API_CALL PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;
+#define glVertexAttrib4d glad_glVertexAttrib4d
+GLAD_API_CALL PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;
+#define glVertexAttrib4dv glad_glVertexAttrib4dv
+GLAD_API_CALL PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;
+#define glVertexAttrib4f glad_glVertexAttrib4f
+GLAD_API_CALL PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;
+#define glVertexAttrib4fv glad_glVertexAttrib4fv
+GLAD_API_CALL PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;
+#define glVertexAttrib4iv glad_glVertexAttrib4iv
+GLAD_API_CALL PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;
+#define glVertexAttrib4s glad_glVertexAttrib4s
+GLAD_API_CALL PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;
+#define glVertexAttrib4sv glad_glVertexAttrib4sv
+GLAD_API_CALL PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;
+#define glVertexAttrib4ubv glad_glVertexAttrib4ubv
+GLAD_API_CALL PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;
+#define glVertexAttrib4uiv glad_glVertexAttrib4uiv
+GLAD_API_CALL PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;
+#define glVertexAttrib4usv glad_glVertexAttrib4usv
+GLAD_API_CALL PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor;
+#define glVertexAttribDivisor glad_glVertexAttribDivisor
+GLAD_API_CALL PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;
+#define glVertexAttribI1i glad_glVertexAttribI1i
+GLAD_API_CALL PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;
+#define glVertexAttribI1iv glad_glVertexAttribI1iv
+GLAD_API_CALL PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;
+#define glVertexAttribI1ui glad_glVertexAttribI1ui
+GLAD_API_CALL PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;
+#define glVertexAttribI1uiv glad_glVertexAttribI1uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;
+#define glVertexAttribI2i glad_glVertexAttribI2i
+GLAD_API_CALL PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;
+#define glVertexAttribI2iv glad_glVertexAttribI2iv
+GLAD_API_CALL PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;
+#define glVertexAttribI2ui glad_glVertexAttribI2ui
+GLAD_API_CALL PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;
+#define glVertexAttribI2uiv glad_glVertexAttribI2uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;
+#define glVertexAttribI3i glad_glVertexAttribI3i
+GLAD_API_CALL PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;
+#define glVertexAttribI3iv glad_glVertexAttribI3iv
+GLAD_API_CALL PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;
+#define glVertexAttribI3ui glad_glVertexAttribI3ui
+GLAD_API_CALL PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;
+#define glVertexAttribI3uiv glad_glVertexAttribI3uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;
+#define glVertexAttribI4bv glad_glVertexAttribI4bv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;
+#define glVertexAttribI4i glad_glVertexAttribI4i
+GLAD_API_CALL PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;
+#define glVertexAttribI4iv glad_glVertexAttribI4iv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;
+#define glVertexAttribI4sv glad_glVertexAttribI4sv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;
+#define glVertexAttribI4ubv glad_glVertexAttribI4ubv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;
+#define glVertexAttribI4ui glad_glVertexAttribI4ui
+GLAD_API_CALL PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;
+#define glVertexAttribI4uiv glad_glVertexAttribI4uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;
+#define glVertexAttribI4usv glad_glVertexAttribI4usv
+GLAD_API_CALL PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;
+#define glVertexAttribIPointer glad_glVertexAttribIPointer
+GLAD_API_CALL PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui;
+#define glVertexAttribP1ui glad_glVertexAttribP1ui
+GLAD_API_CALL PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv;
+#define glVertexAttribP1uiv glad_glVertexAttribP1uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui;
+#define glVertexAttribP2ui glad_glVertexAttribP2ui
+GLAD_API_CALL PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv;
+#define glVertexAttribP2uiv glad_glVertexAttribP2uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui;
+#define glVertexAttribP3ui glad_glVertexAttribP3ui
+GLAD_API_CALL PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv;
+#define glVertexAttribP3uiv glad_glVertexAttribP3uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui;
+#define glVertexAttribP4ui glad_glVertexAttribP4ui
+GLAD_API_CALL PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv;
+#define glVertexAttribP4uiv glad_glVertexAttribP4uiv
+GLAD_API_CALL PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;
+#define glVertexAttribPointer glad_glVertexAttribPointer
+GLAD_API_CALL PFNGLVIEWPORTPROC glad_glViewport;
+#define glViewport glad_glViewport
+GLAD_API_CALL PFNGLWAITSYNCPROC glad_glWaitSync;
+#define glWaitSync glad_glWaitSync
+
+
+
+
+
+GLAD_API_CALL int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr);
+GLAD_API_CALL int gladLoadGL( GLADloadfunc load);
+
+
+#ifdef GLAD_GL
+
+GLAD_API_CALL int gladLoaderLoadGL(void);
+GLAD_API_CALL void gladLoaderUnloadGL(void);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/tmpl8/lib/glad/khrplatform.h b/tmpl8/lib/glad/khrplatform.h
new file mode 100644
index 0000000..0164644
--- /dev/null
+++ b/tmpl8/lib/glad/khrplatform.h
@@ -0,0 +1,311 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2018 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * The master copy of khrplatform.h is maintained in the Khronos EGL
+ * Registry repository at https://github.com/KhronosGroup/EGL-Registry
+ * The last semantic modification to khrplatform.h was at commit ID:
+ * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by filing pull requests or issues on
+ * the EGL Registry repository linked above.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
+# define KHRONOS_STATIC 1
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(KHRONOS_STATIC)
+ /* If the preprocessor constant KHRONOS_STATIC is defined, make the
+ * header compatible with static linking. */
+# define KHRONOS_APICALL
+#elif defined(_WIN32)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#elif defined(__ANDROID__)
+# define KHRONOS_APICALL __attribute__((visibility("default")))
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+/*
+ * To support platform where unsigned long cannot be used interchangeably with
+ * inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
+ * Ideally, we could just use (u)intptr_t everywhere, but this could result in
+ * ABI breakage if khronos_uintptr_t is changed from unsigned long to
+ * unsigned long long or similar (this results in different C++ name mangling).
+ * To avoid changes for existing platforms, we restrict usage of intptr_t to
+ * platforms where the size of a pointer is larger than the size of long.
+ */
+#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
+#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
+#define KHRONOS_USE_INTPTR_T
+#endif
+#endif
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef KHRONOS_USE_INTPTR_T
+typedef intptr_t khronos_intptr_t;
+typedef uintptr_t khronos_uintptr_t;
+#elif defined(_WIN64)
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+#endif
+
+#if defined(_WIN64)
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/tmpl8/lib/json.hpp b/tmpl8/lib/json.hpp
new file mode 100644
index 0000000..87475ab
--- /dev/null
+++ b/tmpl8/lib/json.hpp
@@ -0,0 +1,26753 @@
+/*
+ __ _____ _____ _____
+ __| | __| | | | JSON for Modern C++
+| | |__ | | | | | | version 3.10.4
+|_____|_____|_____|_|___| https://github.com/nlohmann/json
+
+Licensed under the MIT License .
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2019 Niels Lohmann .
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3
+#define NLOHMANN_JSON_VERSION_MINOR 10
+#define NLOHMANN_JSON_VERSION_PATCH 4
+
+#include // all_of, find, for_each
+#include // nullptr_t, ptrdiff_t, size_t
+#include // hash, less
+#include // initializer_list
+#ifndef JSON_NO_IO
+ #include // istream, ostream
+#endif // JSON_NO_IO
+#include // random_access_iterator_tag
+#include // unique_ptr
+#include // accumulate
+#include // string, stoi, to_string
+#include // declval, forward, move, pair, swap
+#include // vector
+
+// #include
+
+
+#include
+#include
+
+// #include
+
+
+#include // transform
+#include // array
+#include // forward_list
+#include // inserter, front_inserter, end
+#include