#include "main/glheader.h"
#include "main/context.h"
#include "main/imports.h"
#include "main/macros.h"
#include "program.h"
#include "prog_parameter.h"
#include "prog_print.h"
#include "prog_instruction.h"
#include "nvfragparse.h"
Data Structures | |
struct | instruction_pattern |
struct | parse_state |
Current parsing state. More... | |
Defines | |
#define | INPUT_1V 1 |
#define | INPUT_2V 2 |
#define | INPUT_3V 3 |
#define | INPUT_1S 4 |
#define | INPUT_2S 5 |
#define | INPUT_CC 6 |
#define | INPUT_1V_T 7 |
#define | INPUT_3V_T 8 |
#define | INPUT_NONE 9 |
#define | INPUT_1V_S 10 |
#define | OUTPUT_V 20 |
#define | OUTPUT_S 21 |
#define | OUTPUT_NONE 22 |
#define | _R FLOAT32 |
#define | _H FLOAT16 |
#define | _X FIXED12 |
#define | _C 0x08 |
#define | _S 0x10 |
#define | RETURN_ERROR |
#define | RETURN_ERROR1(msg) |
#define | RETURN_ERROR2(msg1, msg2) |
Functions | |
static void | record_error (struct parse_state *parseState, const char *msg, int lineNo) |
static struct instruction_pattern | MatchInstruction (const GLubyte *token) |
static GLboolean | IsLetter (GLubyte b) |
static GLboolean | IsDigit (GLubyte b) |
static GLboolean | IsWhitespace (GLubyte b) |
static GLint | GetToken (struct parse_state *parseState, GLubyte *token) |
Starting at 'str' find the next token. | |
static GLboolean | Parse_Token (struct parse_state *parseState, GLubyte *token) |
Get next token from input stream and increment stream pointer past token. | |
static GLboolean | Peek_Token (struct parse_state *parseState, GLubyte *token) |
Get next token from input stream but don't increment stream pointer. | |
static GLboolean | Parse_String (struct parse_state *parseState, const char *pattern) |
Try to match 'pattern' as the next token after any whitespace/comments. | |
static GLboolean | Parse_Identifier (struct parse_state *parseState, GLubyte *ident) |
static GLboolean | Parse_ScalarConstant (struct parse_state *parseState, GLfloat *number) |
Parse a floating point constant, or a defined symbol name. | |
static GLboolean | Parse_VectorConstant (struct parse_state *parseState, GLfloat *vec) |
Parse a vector constant, one of: { float } { float, float } { float, float, float } { float, float, float, float }. | |
static GLuint | Parse_VectorOrScalarConstant (struct parse_state *parseState, GLfloat *vec) |
Parse <number>, <varname> or {a, b, c, d}. | |
static GLboolean | Parse_TextureImageId (struct parse_state *parseState, GLubyte *texUnit, GLubyte *texTargetBit) |
Parse a texture image source: [TEX0 | TEX1 | . | |
static GLboolean | Parse_SwizzleSuffix (const GLubyte *token, GLuint swizzle[4]) |
Parse a scalar suffix like .x, .y, .z or .w or parse a swizzle suffix like .wxyz, .xxyy, etc and return the swizzle indexes. | |
static GLboolean | Parse_CondCodeMask (struct parse_state *parseState, struct prog_dst_register *dstReg) |
static GLboolean | Parse_TempReg (struct parse_state *parseState, GLint *tempRegNum) |
Parse a temporary register: Rnn or Hnn. | |
static GLboolean | Parse_DummyReg (struct parse_state *parseState, GLint *regNum) |
Parse a write-only dummy register: RC or HC. | |
static GLboolean | Parse_ProgramParamReg (struct parse_state *parseState, GLint *regNum) |
Parse a program local parameter register "p[##]". | |
static GLboolean | Parse_FragReg (struct parse_state *parseState, GLint *tempRegNum) |
Parse f[name] - fragment input register. | |
static GLboolean | Parse_OutputReg (struct parse_state *parseState, GLint *outputRegNum) |
static GLboolean | Parse_MaskedDstReg (struct parse_state *parseState, struct prog_dst_register *dstReg) |
static GLboolean | Parse_VectorSrc (struct parse_state *parseState, struct prog_src_register *srcReg) |
Parse a vector source (register, constant, etc): <vectorSrc> ::= <absVectorSrc> | <baseVectorSrc> <absVectorSrc> ::= <negate> "|" <baseVectorSrc> "|". | |
static GLboolean | Parse_ScalarSrcReg (struct parse_state *parseState, struct prog_src_register *srcReg) |
static GLboolean | Parse_PrintInstruction (struct parse_state *parseState, struct prog_instruction *inst) |
static GLboolean | Parse_InstructionSequence (struct parse_state *parseState, struct prog_instruction program[]) |
void | _mesa_parse_nv_fragment_program (GLcontext *ctx, GLenum dstTarget, const GLubyte *str, GLsizei len, struct gl_fragment_program *program) |
Parse/compile the 'str' returning the compiled 'program'. | |
const char * | _mesa_nv_fragment_input_register_name (GLuint i) |
Variables | |
static struct instruction_pattern | Instructions [] |
static const char * | InputRegisters [MAX_NV_FRAGMENT_PROGRAM_INPUTS+1] |
#define _C 0x08 |
#define _H FLOAT16 |
#define _R FLOAT32 |
#define _S 0x10 |
#define _X FIXED12 |
#define INPUT_1S 4 |
#define INPUT_1V 1 |
#define INPUT_1V_S 10 |
#define INPUT_1V_T 7 |
#define INPUT_2S 5 |
#define INPUT_2V 2 |
#define INPUT_3V 3 |
#define INPUT_3V_T 8 |
#define INPUT_CC 6 |
#define INPUT_NONE 9 |
#define OUTPUT_NONE 22 |
#define OUTPUT_S 21 |
#define OUTPUT_V 20 |
#define RETURN_ERROR |
Value:
do { \ record_error(parseState, "Unexpected end of input.", __LINE__); \ return GL_FALSE; \ } while(0)
#define RETURN_ERROR1 | ( | msg | ) |
Value:
do { \ record_error(parseState, msg, __LINE__); \ return GL_FALSE; \ } while(0)
#define RETURN_ERROR2 | ( | msg1, | |||
msg2 | ) |
Value:
do { \ char err[1000]; \ _mesa_sprintf(err, "%s %s", msg1, msg2); \ record_error(parseState, err, __LINE__); \ return GL_FALSE; \ } while(0)
const char* _mesa_nv_fragment_input_register_name | ( | GLuint | i | ) |
void _mesa_parse_nv_fragment_program | ( | GLcontext * | ctx, | |
GLenum | dstTarget, | |||
const GLubyte * | str, | |||
GLsizei | len, | |||
struct gl_fragment_program * | program | |||
) |
Parse/compile the 'str' returning the compiled 'program'.
ctx->Program.ErrorPos will be -1 if successful. Otherwise, ErrorPos indicates the position of the error in 'str'.
static GLint GetToken | ( | struct parse_state * | parseState, | |
GLubyte * | token | |||
) | [static] |
Starting at 'str' find the next token.
A token can be an integer, an identifier or punctuation symbol.
static GLboolean IsDigit | ( | GLubyte | b | ) | [static] |
static GLboolean IsLetter | ( | GLubyte | b | ) | [static] |
static GLboolean IsWhitespace | ( | GLubyte | b | ) | [static] |
static struct instruction_pattern MatchInstruction | ( | const GLubyte * | token | ) | [static, read] |
static GLboolean Parse_CondCodeMask | ( | struct parse_state * | parseState, | |
struct prog_dst_register * | dstReg | |||
) | [static] |
static GLboolean Parse_DummyReg | ( | struct parse_state * | parseState, | |
GLint * | regNum | |||
) | [static] |
Parse a write-only dummy register: RC or HC.
static GLboolean Parse_FragReg | ( | struct parse_state * | parseState, | |
GLint * | tempRegNum | |||
) | [static] |
Parse f[name] - fragment input register.
static GLboolean Parse_Identifier | ( | struct parse_state * | parseState, | |
GLubyte * | ident | |||
) | [static] |
static GLboolean Parse_InstructionSequence | ( | struct parse_state * | parseState, | |
struct prog_instruction | program[] | |||
) | [static] |
static GLboolean Parse_MaskedDstReg | ( | struct parse_state * | parseState, | |
struct prog_dst_register * | dstReg | |||
) | [static] |
static GLboolean Parse_OutputReg | ( | struct parse_state * | parseState, | |
GLint * | outputRegNum | |||
) | [static] |
static GLboolean Parse_PrintInstruction | ( | struct parse_state * | parseState, | |
struct prog_instruction * | inst | |||
) | [static] |
static GLboolean Parse_ProgramParamReg | ( | struct parse_state * | parseState, | |
GLint * | regNum | |||
) | [static] |
Parse a program local parameter register "p[##]".
static GLboolean Parse_ScalarConstant | ( | struct parse_state * | parseState, | |
GLfloat * | number | |||
) | [static] |
Parse a floating point constant, or a defined symbol name.
[+/-]N[.N[eN]] Output: number[0 .. 3] will get the value.
static GLboolean Parse_ScalarSrcReg | ( | struct parse_state * | parseState, | |
struct prog_src_register * | srcReg | |||
) | [static] |
static GLboolean Parse_String | ( | struct parse_state * | parseState, | |
const char * | pattern | |||
) | [static] |
Try to match 'pattern' as the next token after any whitespace/comments.
static GLboolean Parse_SwizzleSuffix | ( | const GLubyte * | token, | |
GLuint | swizzle[4] | |||
) | [static] |
Parse a scalar suffix like .x, .y, .z or .w or parse a swizzle suffix like .wxyz, .xxyy, etc and return the swizzle indexes.
static GLboolean Parse_TempReg | ( | struct parse_state * | parseState, | |
GLint * | tempRegNum | |||
) | [static] |
Parse a temporary register: Rnn or Hnn.
static GLboolean Parse_TextureImageId | ( | struct parse_state * | parseState, | |
GLubyte * | texUnit, | |||
GLubyte * | texTargetBit | |||
) | [static] |
Parse a texture image source: [TEX0 | TEX1 | .
. | TEX15] , [1D | 2D | 3D | CUBE | RECT]
static GLboolean Parse_Token | ( | struct parse_state * | parseState, | |
GLubyte * | token | |||
) | [static] |
Get next token from input stream and increment stream pointer past token.
static GLboolean Parse_VectorConstant | ( | struct parse_state * | parseState, | |
GLfloat * | vec | |||
) | [static] |
Parse a vector constant, one of: { float } { float, float } { float, float, float } { float, float, float, float }.
static GLuint Parse_VectorOrScalarConstant | ( | struct parse_state * | parseState, | |
GLfloat * | vec | |||
) | [static] |
Parse <number>, <varname> or {a, b, c, d}.
Return number of values in the vector or scalar, or zero if parse error.
static GLboolean Parse_VectorSrc | ( | struct parse_state * | parseState, | |
struct prog_src_register * | srcReg | |||
) | [static] |
Parse a vector source (register, constant, etc): <vectorSrc> ::= <absVectorSrc> | <baseVectorSrc> <absVectorSrc> ::= <negate> "|" <baseVectorSrc> "|".
static GLboolean Peek_Token | ( | struct parse_state * | parseState, | |
GLubyte * | token | |||
) | [static] |
Get next token from input stream but don't increment stream pointer.
static void record_error | ( | struct parse_state * | parseState, | |
const char * | msg, | |||
int | lineNo | |||
) | [static] |
const char* InputRegisters[MAX_NV_FRAGMENT_PROGRAM_INPUTS+1] [static] |
Initial value:
{ "WPOS", "COL0", "COL1", "FOGC", "TEX0", "TEX1", "TEX2", "TEX3", "TEX4", "TEX5", "TEX6", "TEX7", NULL }
struct instruction_pattern Instructions[] [static] |