Halide
HalideRuntimeOpenGLCompute.h
Go to the documentation of this file.
1 #ifndef HALIDE_HALIDERUNTIMEOPENGLCOMPUTE_H
2 #define HALIDE_HALIDERUNTIMEOPENGLCOMPUTE_H
3 
4 // Don't include HalideRuntime.h if the contents of it were already pasted into a generated header above this one
5 #ifndef HALIDE_HALIDERUNTIME_H
6 
7 #include "HalideRuntime.h"
8 
9 #endif
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 /** \file
16  * Routines specific to the Halide OpenGL Compute runtime.
17  */
18 
19 #define HALIDE_RUNTIME_OPENGLCOMPUTE
20 
22 
23 /** These are forward declared here to allow clients to override the
24  * Halide Glsl runtime. Do not call them. */
25 // @{
26 
27 /** This function sets up OpenGL context, loads relevant GL functions, then
28  * compiles src OpenGL compute shader into OpenGL program and stores it for future use.
29  */
30 extern int halide_openglcompute_initialize_kernels(void *user_context, void **state_ptr,
31  const char *src, int size);
32 
33 /** This function triggers execution of OpenGL program built around compute shader.
34  * Execution of the shader is parallelized into given number of blocks and threads.
35  *
36  * This function doesn't wait for the completion of the shader, but it sets memory
37  * barrier which forces successive retrieval of output data to wait until shader is done.
38  */
39 extern int halide_openglcompute_run(void *user_context,
40  void *state_ptr,
41  const char *entry_name,
42  int blocksX, int blocksY, int blocksZ,
43  int threadsX, int threadsY, int threadsZ,
44  int shared_mem_bytes,
45  struct halide_type_t arg_types[],
46  void *args[],
47  int8_t is_buffer[],
48  int num_attributes,
49  float *vertex_buffer,
50  int num_coords_dim0,
51  int num_coords_dim1);
52 // @}
53 
54 /** This function retrieves pointers to OpenGL API functions.
55  *
56  * You may have to implement this yourself. Halide only provides implementations
57  * for some platforms."
58  */
59 void *halide_opengl_get_proc_address(void *user_context, const char *name);
60 
61 /** This function creates an OpenGL context for use by the OpenGL backend.
62  *
63  * You may have to implement this yourself as well. Halide only provides
64 * implementations for some platforms."
65  */
67 
68 #ifdef __cplusplus
69 } // End extern "C"
70 #endif
71 
72 #endif // HALIDE_HALIDERUNTIMEOPENGLCOMPUTE_H
halide_openglcompute_device_interface
const struct halide_device_interface_t * halide_openglcompute_device_interface()
halide_openglcompute_initialize_kernels
int halide_openglcompute_initialize_kernels(void *user_context, void **state_ptr, const char *src, int size)
These are forward declared here to allow clients to override the Halide Glsl runtime.
int8_t
signed __INT8_TYPE__ int8_t
Definition: runtime_internal.h:24
halide_type_t
A runtime tag for a type in the halide type system.
Definition: HalideRuntime.h:426
halide_openglcompute_run
int halide_openglcompute_run(void *user_context, void *state_ptr, const char *entry_name, int blocksX, int blocksY, int blocksZ, int threadsX, int threadsY, int threadsZ, int shared_mem_bytes, struct halide_type_t arg_types[], void *args[], int8_t is_buffer[], int num_attributes, float *vertex_buffer, int num_coords_dim0, int num_coords_dim1)
This function triggers execution of OpenGL program built around compute shader.
halide_opengl_get_proc_address
void * halide_opengl_get_proc_address(void *user_context, const char *name)
This function retrieves pointers to OpenGL API functions.
HalideRuntime.h
halide_opengl_create_context
int halide_opengl_create_context(void *user_context)
This function creates an OpenGL context for use by the OpenGL backend.
halide_device_interface_t
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...
Definition: HalideRuntime.h:721
user_context
void * user_context
Definition: printer.h:33