core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

shader_api.h File Reference

#include "main/glheader.h"
#include "main/mtypes.h"

Functions

void _mesa_init_shader_state (GLcontext *ctx)
 Internal functions.
void _mesa_free_shader_state (GLcontext *ctx)
 Free the per-context shader-related state.
void _mesa_clear_shader_program_data (GLcontext *ctx, struct gl_shader_program *shProg)
 Clear (free) the shader program state that gets produced by linking.
void _mesa_free_shader_program_data (GLcontext *ctx, struct gl_shader_program *shProg)
 Free all the data that hangs off a shader program object, but not the object itself.
void _mesa_free_shader_program (GLcontext *ctx, struct gl_shader_program *shProg)
 Free/delete a shader program object.
void _mesa_reference_shader_program (GLcontext *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg)
 Set ptr to point to shProg.
struct gl_shader_program_mesa_lookup_shader_program (GLcontext *ctx, GLuint name)
 Lookup a GLSL program object.
struct gl_shader_mesa_new_shader (GLcontext *ctx, GLuint name, GLenum type)
 Allocate a new gl_shader object, initialize it.
void _mesa_free_shader (GLcontext *ctx, struct gl_shader *sh)
void _mesa_reference_shader (GLcontext *ctx, struct gl_shader **ptr, struct gl_shader *sh)
 Set ptr to point to sh.
struct gl_shader_mesa_lookup_shader (GLcontext *ctx, GLuint name)
 Lookup a GLSL shader object.
void _mesa_update_shader_textures_used (struct gl_program *prog)
 Update the vertex/fragment program's TexturesUsed array.
void _mesa_use_program (GLcontext *ctx, GLuint program)
 Called via ctx->Driver.UseProgram().
GLboolean _mesa_validate_shader_program (GLcontext *ctx, const struct gl_shader_program *shProg, char *errMsg)
 Do validation of the given shader program.
void _mesa_init_glsl_driver_functions (struct dd_function_table *driver)
 Plug in Mesa's GLSL functions into the device driver function table.


Function Documentation

void _mesa_clear_shader_program_data ( GLcontext ctx,
struct gl_shader_program shProg 
)

Clear (free) the shader program state that gets produced by linking.

void _mesa_free_shader ( GLcontext ctx,
struct gl_shader sh 
)

void _mesa_free_shader_program ( GLcontext ctx,
struct gl_shader_program shProg 
)

Free/delete a shader program object.

void _mesa_free_shader_program_data ( GLcontext ctx,
struct gl_shader_program shProg 
)

Free all the data that hangs off a shader program object, but not the object itself.

void _mesa_free_shader_state ( GLcontext ctx  ) 

Free the per-context shader-related state.

void _mesa_init_glsl_driver_functions ( struct dd_function_table driver  ) 

Plug in Mesa's GLSL functions into the device driver function table.

void _mesa_init_shader_state ( GLcontext ctx  ) 

Internal functions.

struct gl_shader* _mesa_lookup_shader ( GLcontext ctx,
GLuint  name 
) [read]

Lookup a GLSL shader object.

struct gl_shader_program* _mesa_lookup_shader_program ( GLcontext ctx,
GLuint  name 
) [read]

Lookup a GLSL program object.

struct gl_shader* _mesa_new_shader ( GLcontext ctx,
GLuint  name,
GLenum  type 
) [read]

Allocate a new gl_shader object, initialize it.

void _mesa_reference_shader ( GLcontext ctx,
struct gl_shader **  ptr,
struct gl_shader sh 
)

Set ptr to point to sh.

If ptr is pointing to another shader, decrement its refcount (and delete if refcount hits zero). Then set ptr to point to sh, incrementing its refcount.

void _mesa_reference_shader_program ( GLcontext ctx,
struct gl_shader_program **  ptr,
struct gl_shader_program shProg 
)

Set ptr to point to shProg.

If ptr is pointing to another object, decrement its refcount (and delete if refcount hits zero). Then set ptr to point to shProg, incrementing its refcount.

void _mesa_update_shader_textures_used ( struct gl_program prog  ) 

Update the vertex/fragment program's TexturesUsed array.

This needs to be called after glUniform(set sampler var) is called. A call to glUniform(samplerVar, value) causes a sampler to point to a particular texture unit. We know the sampler's texture target (1D/2D/3D/etc) from compile time but the sampler's texture unit is set by glUniform() calls.

So, scan the program->SamplerUnits[] and program->SamplerTargets[] information to update the prog->TexturesUsed[] values. Each value of TexturesUsed[unit] is one of zero, TEXTURE_1D_INDEX, TEXTURE_2D_INDEX, TEXTURE_3D_INDEX, etc. We'll use that info for state validation before rendering.

void _mesa_use_program ( GLcontext ctx,
GLuint  program 
)

Called via ctx->Driver.UseProgram().

GLboolean _mesa_validate_shader_program ( GLcontext ctx,
const struct gl_shader_program shProg,
char *  errMsg 
)

Do validation of the given shader program.

Parameters:
errMsg returns error message if validation fails.
Returns:
GL_TRUE if valid, GL_FALSE if invalid (and set errMsg)


Generated on Sun Sep 27 06:48:02 2009 for Mesa Vertex and Fragment Program code by  doxygen 1.5.4