Vuo
1.2.6
|
VuoShader implementation.
Macros | |
#define | DEFINE_PROGRAM() |
Defines a program variable and initializes it with the relevant program based on inputPrimitiveMode . | |
Typedefs | |
typedef std::map< VuoGlContext, GLuint > | VuoShaderContextType |
Type for VuoShaderContextMap. | |
Functions | |
void | VuoShader_free (void *shader) |
Frees the CPU memory and GPU objects associated with the shader. | |
VuoShader | VuoShader_make (const char *name) |
Creates a shader object, which contains multiple GL Program Objects. | |
VuoShader | VuoShader_make_VuoColor (VuoColor color) |
Creates an unlit color shader object. | |
VuoShader | VuoShader_make_VuoShader (VuoShader shader) |
Returns the passed shader (does not make a copy). | |
VuoShader | VuoShader_make_VuoImage (VuoImage image) |
Creates an unlit image shader. | |
void | VuoShader_addSource (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const char *vertexShaderSource, const char *geometryShaderSource, const char *fragmentShaderSource) |
Associates GLSL shader source code with the specified inputPrimitiveMode of the specified shader . | |
void | VuoShader_setExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const unsigned int expectedOutputPrimitiveCount) |
Specifies the number of primitives the geometry shader is expected to produce per invocation. | |
void | VuoShader_setMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, const bool mayChangeOutputPrimitiveCount) |
Specifies whether the geometry shader may dynamically choose to skip outputting some primitives or output additional primitives. | |
unsigned int | VuoShader_getExpectedOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode) |
Returns the number of primitives the geometry shader is expected to produce per invocation. | |
bool | VuoShader_getMayChangeOutputPrimitiveCount (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode) |
Returns true if the geometry shader may not output the expected primitive count. | |
bool | VuoShader_isTransformFeedback (VuoShader shader) |
Returns true if each of shader 's defined inputPrimitiveMode s has a vertex shader (and optionally a geometry shader) but lacks a fragment shader. | |
static bool | VuoShader_ensureUploaded (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext) |
Ensures that the source code for the specified inputPrimitiveMode is compiled, linked, and uploaded. | |
bool | VuoShader_getAttributeLocations (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, int *positionLocation, int *normalLocation, int *tangentLocation, int *bitangentLocation, int *textureCoordinateLocation) |
Outputs the shader program's vertex attribute locations (the same values as glGetAttribLocation() ). | |
void | VuoShader_initPerlinTexture (CGLContextObj cgl_ctx) |
Create and load a 2D texture for a combined index permutation and gradient lookup table. | |
void | VuoShader_initGradTexture (CGLContextObj cgl_ctx) |
Create and load a 2D texture for a 4D gradient lookup table. | |
static void | __attribute__ ((constructor)) VuoShaderContext_init(void) |
Initializes VuoShaderContext_semaphore. | |
bool | VuoShader_activate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext, VuoGlProgram *outputProgram) |
Activates the shader program (glUseProgram() ) on the specified glContext , binds the shader's images to texture units, and uploads its unforms, so that the shader is ready for use in rendering. | |
void | VuoShader_deactivate (VuoShader shader, const VuoMesh_ElementAssemblyMethod inputPrimitiveMode, VuoGlContext glContext) |
Unbinds the shader's images from their texture units. | |
void | VuoShader_resetContext (VuoGlContext glContext) |
Disuses whatever shader (if any) is currently active on glContext . | |
VuoShader | VuoShader_makeFromJson (json_object *js) |
Decodes the JSON object js , expected to contain a 64-bit integer (memory address or 0), to create a new VuoShader . | |
json_object * | VuoShader_getJson (const VuoShader value) |
Encodes value as a JSON object. | |
json_object * | VuoShader_getInterprocessJson (const VuoShader value) |
Calls VuoShader_getJson(). | |
char * | VuoShader_getSummary (const VuoShader value) |
Returns a summary of the shader: the text description provided to VuoShader_make. | |
VuoPoint2d | VuoShader_samplerCoordinatesFromVuoCoordinates (VuoPoint2d vuoCoordinates, VuoImage image) |
Converts the provided vuoCoordinates into GLSL Sampler Coordinates relative to the provided image . | |
VuoReal | VuoShader_samplerSizeFromVuoSize (VuoReal vuoSize) |
Converts an x-axis distance in Vuo Coordinates into GLSL Sampler Coordinates. | |
Variables | |
static GLuint | VuoShader_perlinTexture |
GL texture name for the Perlin permutation table. | |
static GLuint | VuoShader_gradTexture |
GL texture name for the Simplex permutation table. | |
VuoShaderContextType | VuoShaderContextMap |
The currently-active shader on each context. | |
static dispatch_semaphore_t | VuoShaderContext_semaphore |
Serializes access to VuoShaderContextMap. | |
#define DEFINE_PROGRAM | ( | ) |
Defines a program
variable and initializes it with the relevant program based on inputPrimitiveMode
.
typedef std::map<VuoGlContext, GLuint> VuoShaderContextType |
Type for VuoShaderContextMap.
|
static |
Initializes VuoShaderContext_semaphore.
|
static |
Ensures that the source code for the specified inputPrimitiveMode
is compiled, linked, and uploaded.
If the shader is NULL, or there is no source code for the specified inputPrimitiveMode
, or it fails to compile or link, returns false
.
Must be called while shader->lock
is locked.
void VuoShader_free | ( | void * | shader | ) |
Frees the CPU memory and GPU objects associated with the shader.
This function may be called from any thread.
void VuoShader_initGradTexture | ( | CGLContextObj | cgl_ctx | ) |
Create and load a 2D texture for a 4D gradient lookup table.
This is used for 4D noise only.
Author: Stefan Gustavson (stegu) 2004, 2005, 2011 ("The C code in "noisevsnoise.c" is public domain.") @itn .liu. se
void VuoShader_initPerlinTexture | ( | CGLContextObj | cgl_ctx | ) |
Create and load a 2D texture for a combined index permutation and gradient lookup table.
This texture is used for 2D and 3D noise, both classic and simplex.
Author: Stefan Gustavson (stegu) 2004, 2005, 2011 ("The C code in "noisevsnoise.c" is public domain.") @itn .liu. se
|
static |
GL texture name for the Simplex permutation table.
|
static |
GL texture name for the Perlin permutation table.
|
static |
Serializes access to VuoShaderContextMap.
VuoShaderContextType VuoShaderContextMap |
The currently-active shader on each context.
This is placed in VuoGlContext (a dylib) instead of VuoShader (a static module) to ensure there's only one instance per process.