CX/include/cx.h

73 lines
1.4 KiB
C

#ifndef CX_H
#define CX_H
// Include standard headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <stdint.h>
#include <pthread.h>
// Include GLEW
#include <GL/glew.h>
// Include GLFW
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
// Include project headers
#include <cx_thread.h>
#include <tensor.h>
#include <model.h>
#include <tensor.h>
#include <neural.h>
#include <shader.h>
// Declare common data structures.
typedef struct _cx_gl_ctx {
void (*free)(void *self);
uint8_t master_lock;
uint8_t *worker_locks;
CX_ThreadGroup **workers;
GLFWwindow *window;
ModelRegistry *mr;
GLuint *VertexArrayIDs;
size_t VertexArray_count;
size_t VertexArray_size;
GLuint *programIDs;
size_t ProgramID_count;
size_t ProgramID_size;
} CX_GL_CTX;
typedef struct _cx_nn_ctx {
void (*free)(void *self);
uint8_t master_lock;
uint8_t *worker_locks;
CX_ThreadGroup **workers;
Neural_Network *nn;
float *input_buffer;
float *output_buffer;
} CX_NN_CTX;
typedef struct _cx_ctx {
CX_ThreadGroup **threads;
CX_GL_CTX *gl_ctx;
CX_NN_CTX *nn_ctx;
} CX_Context;
// Declare functions
CX_Context *cx_context_new(void);
int cx_glinit(CX_GL_CTX **);
int cx_nninit(Neural_Network **);
int cx_init(CX_Context **);
int cx_run(CX_Context *);
#endif