Vuo  0.5.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Typedefs | Functions | Variables
VuoGlPool.cc File Reference

Description

VuoGlPool implementation.

Typedefs

typedef void(* sendErrorType )(const char *message)
 https://b33p.net/kosada/node/6908
 
typedef pair< unsigned short,
unsigned short > 
VuoGlTextureDimensionsType
 Texture width and height.
 
typedef pair< queue< GLuint >
, double > 
VuoGlTextureLastUsed
 A queue of textures of a given format and size, including the last time any of the textures were used.
 
typedef map< GLenum, map
< VuoGlTextureDimensionsType,
VuoGlTextureLastUsed > > 
VuoGlTexturePoolType
 VuoGlTexturePool[internalformat][size] gives a list of unused textures.
 
typedef map< GLuint, unsigned int > VuoGlTextureReferenceCounts
 The number of times each glTextureName is retained..
 

Functions

GLuint VuoGlPool_use (VuoGlContext glContext, VuoGlPoolType type, unsigned long size)
 Returns an OpenGL Buffer Object of type type.
 
void VuoGlPool_disuse (VuoGlContext glContext, VuoGlPoolType type, unsigned long size, GLuint name)
 Indicates that the caller is done using the OpenGL object name of type type.
 
GLuint VuoGlTexturePool_use (VuoGlContext glContext, GLenum internalformat, unsigned short width, unsigned short height, GLenum format)
 Returns an OpenGL texture.
 
void VuoGlTexture_retain (GLuint glTextureName)
 Increments the reference count for glTextureName.
 
void VuoGlTexture_release (GLenum internalformat, unsigned short width, unsigned short height, GLuint glTextureName)
 Decrements the reference count for glTextureName.
 
void VuoGlShader_printShaderInfoLog (CGLContextObj cgl_ctx, GLuint obj)
 Prints GLSL debug information to the console.
 
GLuint VuoGlShader_use (VuoGlContext glContext, GLenum type, const char *source)
 Returns an OpenGL Shader Object representing the specified source.
 
const char * VuoGl_stringForConstant (GLenum constant)
 Returns a string for the specified OpenGL constant.
 

Variables

map< GLenum, map< long, GLuint > > VuoGlShaderPool
 Shaders, keyed by type (vertex, fragment, ...) and source code hash.
 
dispatch_semaphore_t VuoGlShaderPool_semaphore = NULL
 Synchronizes access to VuoGlShaderPool.
 

Typedef Documentation

typedef void(* sendErrorType)(const char *message)
typedef pair<unsigned short,unsigned short> VuoGlTextureDimensionsType

Texture width and height.

typedef pair<queue<GLuint>,double> VuoGlTextureLastUsed

A queue of textures of a given format and size, including the last time any of the textures were used.

VuoGlTexturePool[internalformat][size] gives a list of unused textures.

typedef map<GLuint, unsigned int> VuoGlTextureReferenceCounts

The number of times each glTextureName is retained..

Function Documentation

const char* VuoGl_stringForConstant ( GLenum  constant)

Returns a string for the specified OpenGL constant.

Don't free the string returned by this function.

void VuoGlPool_disuse ( VuoGlContext  glContext,
VuoGlPoolType  type,
unsigned long  size,
GLuint  name 
)

Indicates that the caller is done using the OpenGL object name of type type.

The object is returned to the pool, so other callers can use it (which is more efficient than deleting and re-generating objects).

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

GLuint VuoGlPool_use ( VuoGlContext  glContext,
VuoGlPoolType  type,
unsigned long  size 
)

Returns an OpenGL Buffer Object of type type.

If an existing, unused buffer of the specified type and size is available, it is returned. Otherwise, a new buffer is created.

Todo:
https://b33p.net/kosada/node/6901 The returned buffer's storage ~~is~~ will be preallocated (so the caller can efficiently upload data using glBufferSubData),

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Todo:
remove VRAM check after https://b33p.net/kosada/node/6909
Todo:
https://b33p.net/kosada/node/6901
void VuoGlShader_printShaderInfoLog ( CGLContextObj  cgl_ctx,
GLuint  obj 
)

Prints GLSL debug information to the console.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

GLuint VuoGlShader_use ( VuoGlContext  glContext,
GLenum  type,
const char *  source 
)

Returns an OpenGL Shader Object representing the specified source.

To improve performance, this function keeps a cache of precompiled shaders. If a precompiled shader exists for the specified source, that shader is returned. Otherwise, source is passed off to OpenGL to be compiled.

void VuoGlTexture_release ( GLenum  internalformat,
unsigned short  width,
unsigned short  height,
GLuint  glTextureName 
)

Decrements the reference count for glTextureName.

This function may be called from any thread.

void VuoGlTexture_retain ( GLuint  glTextureName)

Increments the reference count for glTextureName.

This function may be called from any thread.

GLuint VuoGlTexturePool_use ( VuoGlContext  glContext,
GLenum  internalformat,
unsigned short  width,
unsigned short  height,
GLenum  format 
)

Returns an OpenGL texture.

If an existing, unused texture matching the specified internalformat, width, and height is available, it is returned. Otherwise, a new texture is created.

The returned texture's storage is preallocated (so the caller can efficiently upload data using glTexSubImage2D), and its texturing properties are set to the defaults:

  • wrapping: clamp to border
  • filtering: linear

See glTexImage2D for information about internalformat and format.

This function may be called from any thread. (However, the caller is responsible for ensuring that the GL context is not used simultaneously on multiple threads.)

Todo:
remove VRAM check after https://b33p.net/kosada/node/6909

Variable Documentation

map<GLenum, map<long, GLuint> > VuoGlShaderPool

Shaders, keyed by type (vertex, fragment, ...) and source code hash.

dispatch_semaphore_t VuoGlShaderPool_semaphore = NULL

Synchronizes access to VuoGlShaderPool.