Vuo  2.0.0
VuoGlPool.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16 
17 #include "VuoGlContext.h"
18 #include "VuoImage.h"
19 #include "VuoMesh.h"
20 
21 #include <stdint.h>
22 
26 typedef enum
27 {
28  VuoGlPool_ArrayBuffer,
29  VuoGlPool_ElementArrayBuffer
30 // VuoGlPool_Texture ///< @see VuoGlTexturePool_use
31 // VuoGlPool_Framebuffer ///< Cannot be shared between contexts
32 // VuoGlPool_VertexArray ///< Cannot be shared between contexts
34 
35 GLuint VuoGlPool_use(VuoGlContext glContext, VuoGlPoolType type, unsigned long size);
36 
42 #define VuoGlPool_retain(glBufferName) VuoGlPool_retainF(glBufferName, __FILE__, __LINE__, __func__);
43 void VuoGlPool_retainF(GLuint glBufferName, const char *file, unsigned int linenumber, const char *func);
44 
51 #define VuoGlPool_release(type, size, glBufferName) VuoGlPool_releaseF(type, size, glBufferName, __FILE__, __LINE__, __func__);
52 void VuoGlPool_releaseF(VuoGlPoolType type, unsigned long size, GLuint glBufferName, const char *file, unsigned int linenumber, const char *func);
53 
57 typedef enum
58 {
59  VuoGlTexturePool_NoAllocation,
60  VuoGlTexturePool_Allocate,
61  VuoGlTexturePool_AllocateIOSurface,
63 
64 GLuint VuoGlTexturePool_use(VuoGlContext glContext, VuoGlTexturePoolAllocation allocation, GLenum target, GLenum internalformat, unsigned short width, unsigned short height, GLenum format, void *ioSurfaceRef);
65 void VuoGlTexturePool_disuse(VuoGlTexturePoolAllocation allocation, GLenum target, GLenum internalformat, unsigned short width, unsigned short height, GLuint name);
66 
67 GLuint VuoGlTexture_getType(GLuint format);
68 unsigned char VuoGlTexture_getChannelCount(GLuint format);
69 unsigned char VuoGlTexture_getBytesPerPixel(GLuint internalformat, GLuint format);
70 unsigned char VuoGlTexture_getBytesPerPixelForInternalFormat(GLuint internalformat);
71 bool VuoGlTexture_formatHasAlphaChannel(GLuint format);
72 
73 unsigned long VuoGlTexture_getMaximumTextureBytes(VuoGlContext glContext);
74 
75 void VuoGlTexture_retain(GLuint glTextureName, VuoImage_freeCallback freeCallback, void *freeCallbackContext);
76 void VuoGlTexture_release(VuoGlTexturePoolAllocation allocation, GLuint glTextureTarget, GLenum internalformat, unsigned short width, unsigned short height, GLuint glTextureName);
77 void VuoGlTexture_disown(GLuint glTextureName);
78 
79 typedef void * VuoIoSurface;
80 VuoIoSurface VuoIoSurfacePool_use(VuoGlContext glContext, unsigned short pixelsWide, unsigned short pixelsHigh, GLuint *outputTexture);
83 unsigned short VuoIoSurfacePool_getWidth(VuoIoSurface vis);
84 unsigned short VuoIoSurfacePool_getHeight(VuoIoSurface vis);
86 void VuoIoSurfacePool_disuse(VuoIoSurface vis, bool quarantine);
87 
88 void VuoIoSurfacePool_signal(void *ioSurface);
89 
90 GLuint VuoGlShader_use(VuoGlContext glContext, GLenum type, const char *source, void *outIssues);
91 
95 typedef struct
96 {
97  GLuint programName;
98 
99  void *uniforms;
100 } VuoGlProgram;
101 
102 VuoGlProgram VuoGlProgram_use(VuoGlContext glContext, const char *description, GLuint vertexShaderName, GLuint geometryShaderName, GLuint fragmentShaderName, VuoMesh_ElementAssemblyMethod assemblyMethod, unsigned int expectedOutputPrimitiveCount, void *outIssues);
103 int VuoGlProgram_getUniformLocation(VuoGlProgram program, const char *uniformIdentifier);
104 
105 char *VuoGl_stringForConstant(GLenum constant);
106 
107 void VuoGlPool_logVRAMAllocated(unsigned long bytesAllocated);
108 void VuoGlPool_logVRAMFreed(unsigned long bytesFreed);
109 
110 #ifdef __cplusplus
111 }
112 #endif