diff options
Diffstat (limited to 'source/blender/gpu/intern/gpu_context_private.h')
-rw-r--r-- | source/blender/gpu/intern/gpu_context_private.h | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_context_private.h b/source/blender/gpu/intern/gpu_context_private.h index 08fbefe3b3f..374a05bc25f 100644 --- a/source/blender/gpu/intern/gpu_context_private.h +++ b/source/blender/gpu/intern/gpu_context_private.h @@ -27,12 +27,52 @@ #include "GPU_context.h" +/* TODO cleanup this ifdef */ #ifdef __cplusplus -extern "C" { -#endif + +# include <mutex> +# include <pthread.h> +# include <string.h> +# include <unordered_set> +# include <vector> struct GPUFrameBuffer; +struct GPUContext { + GLuint default_vao; + GLuint default_framebuffer; + GPUFrameBuffer *current_fbo; + std::unordered_set<GPUBatch *> batches; /* Batches that have VAOs from this context */ +# ifdef DEBUG + std::unordered_set<GPUFrameBuffer *> + framebuffers; /* Framebuffers that have FBO from this context */ +# endif + struct GPUMatrixState *matrix_state; + std::vector<GLuint> orphaned_vertarray_ids; + std::vector<GLuint> orphaned_framebuffer_ids; + std::mutex orphans_mutex; /* todo: try spinlock instead */ +# if TRUST_NO_ONE + pthread_t thread; /* Thread on which this context is active. */ + bool thread_is_used; +# endif + + GPUContext() + { +# if TRUST_NO_ONE + thread_is_used = false; +# endif + current_fbo = 0; + }; + + virtual ~GPUContext(){}; +}; + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + GLuint GPU_vao_default(void); GLuint GPU_framebuffer_default(void); |