CX/include/cx.h
Marcel Plch fee012f56c
More threading stuff
So far it doesn't do anything,
but soon™ it will.
2024-11-09 21:29:02 +01:00

65 lines
1.2 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 <tensor.h>
#include <model.h>
#include <tensor.h>
#include <shader.h>
#include <neural.h>
// Declare common data structures.
typedef struct _cx_thrd {
pthread_t thread;
void *ctx; // Arbitrary thread context
} CX_Thread;
typedef struct _cx_thrgr {
CX_Thread *group_manager;
CX_Thread **workers;
size_t worker_count;
size_t worker_size;
} CX_ThreadGroup;
typedef struct _cx_ctx {
GLFWwindow *window;
Neural_Network *nn;
CX_ThreadGroup **threads;
GLuint *VertexArrayIDs;
size_t VertexArray_count;
size_t VertexArray_size;
GLuint *programIDs;
size_t ProgramID_count;
size_t ProgramID_size;
} CX_Context;
// Declare functions
CX_Context *cx_context_new(void);
int cx_glinit(GLFWwindow **);
int cx_nninit(Neural_Network **);
int cx_init(CX_Context **);
int cx_run(CX_Context *);
#endif