Halide 14.0.0
Halide compiler and libraries
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
12extern "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 */
30extern 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 */
39extern 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
49extern void halide_openglcompute_finalize_kernels(void *user_context, void *state_ptr);
50// @}
51
52/** This function retrieves pointers to OpenGL API functions.
53 *
54 * You may have to implement this yourself. Halide only provides implementations
55 * for some platforms."
56 */
57void *halide_opengl_get_proc_address(void *user_context, const char *name);
58
59/** This function creates an OpenGL context for use by the OpenGL backend.
60 *
61 * You may have to implement this yourself as well. Halide only provides
62* implementations for some platforms."
63 */
64int halide_opengl_create_context(void *user_context);
65
66#ifdef __cplusplus
67} // End extern "C"
68#endif
69
70#endif // HALIDE_HALIDERUNTIMEOPENGLCOMPUTE_H
This file declares the routines used by Halide internally in its runtime.
int halide_opengl_create_context(void *user_context)
This function creates an OpenGL context for use by the OpenGL backend.
void halide_openglcompute_finalize_kernels(void *user_context, void *state_ptr)
const struct halide_device_interface_t * halide_openglcompute_device_interface()
void * halide_opengl_get_proc_address(void *user_context, const char *name)
This function retrieves pointers to OpenGL API functions.
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[])
This function triggers execution of OpenGL program built around compute shader.
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.
signed __INT8_TYPE__ int8_t
Each GPU API provides a halide_device_interface_t struct pointing to the code that manages device all...
A runtime tag for a type in the halide type system.