#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
#include "program.h"
#include "prog_cache.h"
#include "prog_parameter.h"
#include "prog_instruction.h"
Functions | |
void | _mesa_init_program (GLcontext *ctx) |
Init context's vertex/fragment program state. | |
void | _mesa_free_program_data (GLcontext *ctx) |
Free a context's vertex/fragment program state. | |
void | _mesa_update_default_objects_program (GLcontext *ctx) |
Update the default program objects in the given context to reference those specified in the shared state and release those referencing the old shared state. | |
void | _mesa_set_program_error (GLcontext *ctx, GLint pos, const char *string) |
Set the vertex/fragment program error state (position and error string). | |
const GLubyte * | _mesa_find_line_column (const GLubyte *string, const GLubyte *pos, GLint *line, GLint *col) |
Find the line number and column for 'pos' within 'string'. | |
static struct gl_program * | _mesa_init_program_struct (GLcontext *ctx, struct gl_program *prog, GLenum target, GLuint id) |
Initialize a new vertex/fragment program object. | |
struct gl_program * | _mesa_init_fragment_program (GLcontext *ctx, struct gl_fragment_program *prog, GLenum target, GLuint id) |
Initialize a new fragment program object. | |
struct gl_program * | _mesa_init_vertex_program (GLcontext *ctx, struct gl_vertex_program *prog, GLenum target, GLuint id) |
Initialize a new vertex program object. | |
struct gl_program * | _mesa_new_program (GLcontext *ctx, GLenum target, GLuint id) |
Allocate and initialize a new fragment/vertex program object but don't put it into the program hash table. | |
void | _mesa_delete_program (GLcontext *ctx, struct gl_program *prog) |
Delete a program and remove it from the hash table, ignoring the reference count. | |
struct gl_program * | _mesa_lookup_program (GLcontext *ctx, GLuint id) |
Return the gl_program object for a given ID. | |
void | _mesa_reference_program (GLcontext *ctx, struct gl_program **ptr, struct gl_program *prog) |
Reference counting for vertex/fragment programs. | |
struct gl_program * | _mesa_clone_program (GLcontext *ctx, const struct gl_program *prog) |
Return a copy of a program. | |
GLboolean | _mesa_insert_instructions (struct gl_program *prog, GLuint start, GLuint count) |
Insert 'count' NOP instructions at 'start' in the given program. | |
GLboolean | _mesa_delete_instructions (struct gl_program *prog, GLuint start, GLuint count) |
Delete 'count' instructions at 'start' in the given program. | |
static void | replace_registers (struct prog_instruction *inst, GLuint numInst, GLuint oldFile, GLuint oldIndex, GLuint newFile, GLuint newIndex) |
Search instructions for registers that match (oldFile, oldIndex), replacing them with (newFile, newIndex). | |
static void | adjust_param_indexes (struct prog_instruction *inst, GLuint numInst, GLuint offset) |
Search instructions for references to program parameters. | |
struct gl_program * | _mesa_combine_programs (GLcontext *ctx, const struct gl_program *progA, const struct gl_program *progB) |
Combine two programs into one. | |
GLint | _mesa_find_free_register (const struct gl_program *prog, GLuint regFile) |
Scan the given program to find a free register of the given type. | |
void | _mesa_postprocess_program (GLcontext *ctx, struct gl_program *prog) |
"Post-process" a GPU program. | |
Variables | |
struct gl_program | _mesa_DummyProgram |
A pointer to this dummy program is put into the hash table when glGenPrograms is called. |
struct gl_program* _mesa_clone_program | ( | GLcontext * | ctx, | |
const struct gl_program * | prog | |||
) | [read] |
Return a copy of a program.
XXX Problem here if the program object is actually OO-derivation made by a device driver.
struct gl_program* _mesa_combine_programs | ( | GLcontext * | ctx, | |
const struct gl_program * | progA, | |||
const struct gl_program * | progB | |||
) | [read] |
Combine two programs into one.
Fix instructions so the outputs of the first program go to the inputs of the second program.
GLboolean _mesa_delete_instructions | ( | struct gl_program * | prog, | |
GLuint | start, | |||
GLuint | count | |||
) |
Delete 'count' instructions at 'start' in the given program.
Adjust branch targets accordingly.
void _mesa_delete_program | ( | GLcontext * | ctx, | |
struct gl_program * | prog | |||
) |
Delete a program and remove it from the hash table, ignoring the reference count.
Called via ctx->Driver.DeleteProgram. May be wrapped (OO deriviation) by a device driver function.
GLint _mesa_find_free_register | ( | const struct gl_program * | prog, | |
GLuint | regFile | |||
) |
Scan the given program to find a free register of the given type.
regFile | - PROGRAM_INPUT, PROGRAM_OUTPUT or PROGRAM_TEMPORARY |
const GLubyte* _mesa_find_line_column | ( | const GLubyte * | string, | |
const GLubyte * | pos, | |||
GLint * | line, | |||
GLint * | col | |||
) |
Find the line number and column for 'pos' within 'string'.
Return a copy of the line which contains 'pos'. Free the line with _mesa_free().
string | the program string | |
pos | the position within the string | |
line | returns the line number corresponding to 'pos'. | |
col | returns the column number corresponding to 'pos'. |
void _mesa_free_program_data | ( | GLcontext * | ctx | ) |
Free a context's vertex/fragment program state.
struct gl_program* _mesa_init_fragment_program | ( | GLcontext * | ctx, | |
struct gl_fragment_program * | prog, | |||
GLenum | target, | |||
GLuint | id | |||
) | [read] |
Initialize a new fragment program object.
void _mesa_init_program | ( | GLcontext * | ctx | ) |
Init context's vertex/fragment program state.
static struct gl_program* _mesa_init_program_struct | ( | GLcontext * | ctx, | |
struct gl_program * | prog, | |||
GLenum | target, | |||
GLuint | id | |||
) | [static, read] |
Initialize a new vertex/fragment program object.
struct gl_program* _mesa_init_vertex_program | ( | GLcontext * | ctx, | |
struct gl_vertex_program * | prog, | |||
GLenum | target, | |||
GLuint | id | |||
) | [read] |
Initialize a new vertex program object.
GLboolean _mesa_insert_instructions | ( | struct gl_program * | prog, | |
GLuint | start, | |||
GLuint | count | |||
) |
Insert 'count' NOP instructions at 'start' in the given program.
Adjust branch targets accordingly.
struct gl_program* _mesa_lookup_program | ( | GLcontext * | ctx, | |
GLuint | id | |||
) | [read] |
Return the gl_program object for a given ID.
Basically just a wrapper for _mesa_HashLookup() to avoid a lot of casts elsewhere.
struct gl_program* _mesa_new_program | ( | GLcontext * | ctx, | |
GLenum | target, | |||
GLuint | id | |||
) | [read] |
Allocate and initialize a new fragment/vertex program object but don't put it into the program hash table.
Called via ctx->Driver.NewProgram. May be overridden (ie. replaced) by a device driver function to implement OO deriviation with additional types not understood by this function.
ctx | context | |
id | program id/number | |
target | program target/type |
void _mesa_postprocess_program | ( | GLcontext * | ctx, | |
struct gl_program * | prog | |||
) |
"Post-process" a GPU program.
This is intended to be used for debugging. Example actions include no-op'ing instructions or changing instruction behaviour.
void _mesa_reference_program | ( | GLcontext * | ctx, | |
struct gl_program ** | ptr, | |||
struct gl_program * | prog | |||
) |
Reference counting for vertex/fragment programs.
void _mesa_set_program_error | ( | GLcontext * | ctx, | |
GLint | pos, | |||
const char * | string | |||
) |
Set the vertex/fragment program error state (position and error string).
This is generally called from within the parsers.
void _mesa_update_default_objects_program | ( | GLcontext * | ctx | ) |
Update the default program objects in the given context to reference those specified in the shared state and release those referencing the old shared state.
static void adjust_param_indexes | ( | struct prog_instruction * | inst, | |
GLuint | numInst, | |||
GLuint | offset | |||
) | [static] |
Search instructions for references to program parameters.
When found, increment the parameter index by 'offset'. Used when combining programs.
static void replace_registers | ( | struct prog_instruction * | inst, | |
GLuint | numInst, | |||
GLuint | oldFile, | |||
GLuint | oldIndex, | |||
GLuint | newFile, | |||
GLuint | newIndex | |||
) | [static] |
Search instructions for registers that match (oldFile, oldIndex), replacing them with (newFile, newIndex).
struct gl_program _mesa_DummyProgram |
A pointer to this dummy program is put into the hash table when glGenPrograms is called.