diff options
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/arbprogparse.c | 3861 | ||||
-rw-r--r-- | src/mesa/shader/arbprogram.syn | 2824 | ||||
-rw-r--r-- | src/mesa/shader/arbprogram_syn.h | 1350 |
3 files changed, 0 insertions, 8035 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 36ddc373b03..8596aa2eeae 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -65,3867 +65,6 @@ having three separate program parameter arrays. #include "prog_instruction.h" #include "program_parser.h" -/** - * This is basically a union of the vertex_program and fragment_program - * structs that we can use to parse the program into - * - * XXX we can probably get rid of this entirely someday. - */ -struct arb_program -{ - struct gl_program Base; - - GLuint Position; /* Just used for error reporting while parsing */ - GLuint MajorVersion; - GLuint MinorVersion; - - /* ARB_vertex_progmra options */ - GLboolean HintPositionInvariant; - - /* ARB_fragment_progmra options */ - GLenum PrecisionOption; /* GL_DONT_CARE, GL_NICEST or GL_FASTEST */ - GLenum FogOption; /* GL_NONE, GL_LINEAR, GL_EXP or GL_EXP2 */ - - /* ARB_fragment_program specifics */ - GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; - GLbitfield ShadowSamplers; - GLuint NumAluInstructions; - GLuint NumTexInstructions; - GLuint NumTexIndirections; - - GLboolean UsesKill; -}; - - -#if 0 -/* TODO: - * Fragment Program Stuff: - * ----------------------------------------------------- - * - * - things from Michal's email - * + overflow on atoi - * + not-overflowing floats (don't use parse_integer..) - * + can remove range checking in arbparse.c - * - * - check all limits of number of various variables - * + parameters - * - * - test! test! test! - * - * Vertex Program Stuff: - * ----------------------------------------------------- - * - Optimize param array usage and count limits correctly, see spec, - * section 2.14.3.7 - * + Record if an array is reference absolutly or relatively (or both) - * + For absolute arrays, store a bitmap of accesses - * + For single parameters, store an access flag - * + After parsing, make a parameter cleanup and merging pass, where - * relative arrays are layed out first, followed by abs arrays, and - * finally single state. - * + Remap offsets for param src and dst registers - * + Now we can properly count parameter usage - * - * - Multiple state binding errors in param arrays (see spec, just before - * section 2.14.3.3) - * - grep for XXX - * - * Mesa Stuff - * ----------------------------------------------------- - * - User clipping planes vs. PositionInvariant - * - Is it sufficient to just multiply by the mvp to transform in the - * PositionInvariant case? Or do we need something more involved? - * - * - vp_src swizzle is GLubyte, fp_src swizzle is GLuint - * - fetch state listed in program_parameters list - * + WTF should this go??? - * + currently in nvvertexec.c and s_nvfragprog.c - * - * - allow for multiple address registers (and fetch address regs properly) - * - * Cosmetic Stuff - * ----------------------------------------------------- - * - remove any leftover unused grammer.c stuff (dict_ ?) - * - fix grammer.c error handling so its not static - * - #ifdef around stuff pertaining to extentions - * - * Outstanding Questions: - * ----------------------------------------------------- - * - ARB_matrix_palette / ARB_vertex_blend -- not supported - * what gets hacked off because of this: - * + VERTEX_ATTRIB_MATRIXINDEX - * + VERTEX_ATTRIB_WEIGHT - * + MATRIX_MODELVIEW - * + MATRIX_PALETTE - * - * - When can we fetch env/local params from their own register files, and - * when to we have to fetch them into the main state register file? - * (think arrays) - * - * Grammar Changes: - * ----------------------------------------------------- - */ - -/* Changes since moving the file to shader directory - -2004-III-4 ------------------------------------------------------------ -- added #include "grammar_mesa.h" -- removed grammar specific code part (it resides now in grammar.c) -- added GL_ARB_fragment_program_shadow tokens -- modified #include "arbparse_syn.h" -- major changes inside _mesa_parse_arb_program() -- check the program string for '\0' characters -- copy the program string to a one-byte-longer location to have - it null-terminated -- position invariance test (not writing to result.position) moved - to syntax part -*/ - -typedef GLubyte *production; - - -/** - * This is the text describing the rules to parse the grammar - */ -LONGSTRING static char arb_grammar_text[] = -#include "arbprogram_syn.h" -; - -/** - * These should match up with the values defined in arbprogram.syn - */ - -/* - Changes: - - changed and merged V_* and F_* opcode values to OP_*. - - added GL_ARB_fragment_program_shadow specific tokens (michal) -*/ -#define REVISION 0x0a - -/* program type */ -#define FRAGMENT_PROGRAM 0x01 -#define VERTEX_PROGRAM 0x02 - -/* program section */ -#define OPTION 0x01 -#define INSTRUCTION 0x02 -#define DECLARATION 0x03 -#define END 0x04 - -/* GL_ARB_fragment_program option */ -#define ARB_PRECISION_HINT_FASTEST 0x00 -#define ARB_PRECISION_HINT_NICEST 0x01 -#define ARB_FOG_EXP 0x02 -#define ARB_FOG_EXP2 0x03 -#define ARB_FOG_LINEAR 0x04 - -/* GL_ARB_vertex_program option */ -#define ARB_POSITION_INVARIANT 0x05 - -/* GL_ARB_fragment_program_shadow option */ -#define ARB_FRAGMENT_PROGRAM_SHADOW 0x06 - -/* GL_ARB_draw_buffers option */ -#define ARB_DRAW_BUFFERS 0x07 - -/* GL_MESA_texture_array option */ -#define MESA_TEXTURE_ARRAY 0x08 - -/* GL_ARB_fragment_program instruction class */ -#define OP_ALU_INST 0x00 -#define OP_TEX_INST 0x01 - -/* GL_ARB_vertex_program instruction class */ -/* OP_ALU_INST */ - -/* GL_ARB_fragment_program instruction type */ -#define OP_ALU_VECTOR 0x00 -#define OP_ALU_SCALAR 0x01 -#define OP_ALU_BINSC 0x02 -#define OP_ALU_BIN 0x03 -#define OP_ALU_TRI 0x04 -#define OP_ALU_SWZ 0x05 -#define OP_TEX_SAMPLE 0x06 -#define OP_TEX_KIL 0x07 - -/* GL_ARB_vertex_program instruction type */ -#define OP_ALU_ARL 0x08 -/* OP_ALU_VECTOR */ -/* OP_ALU_SCALAR */ -/* OP_ALU_BINSC */ -/* OP_ALU_BIN */ -/* OP_ALU_TRI */ -/* OP_ALU_SWZ */ - -/* GL_ARB_fragment_program instruction code */ -#define OP_ABS 0x00 -#define OP_ABS_SAT 0x1B -#define OP_FLR 0x09 -#define OP_FLR_SAT 0x26 -#define OP_FRC 0x0A -#define OP_FRC_SAT 0x27 -#define OP_LIT 0x0C -#define OP_LIT_SAT 0x2A -#define OP_MOV 0x11 -#define OP_MOV_SAT 0x30 -#define OP_COS 0x1F -#define OP_COS_SAT 0x20 -#define OP_EX2 0x07 -#define OP_EX2_SAT 0x25 -#define OP_LG2 0x0B -#define OP_LG2_SAT 0x29 -#define OP_RCP 0x14 -#define OP_RCP_SAT 0x33 -#define OP_RSQ 0x15 -#define OP_RSQ_SAT 0x34 -#define OP_SIN 0x38 -#define OP_SIN_SAT 0x39 -#define OP_SCS 0x35 -#define OP_SCS_SAT 0x36 -#define OP_POW 0x13 -#define OP_POW_SAT 0x32 -#define OP_ADD 0x01 -#define OP_ADD_SAT 0x1C -#define OP_DP3 0x03 -#define OP_DP3_SAT 0x21 -#define OP_DP4 0x04 -#define OP_DP4_SAT 0x22 -#define OP_DPH 0x05 -#define OP_DPH_SAT 0x23 -#define OP_DST 0x06 -#define OP_DST_SAT 0x24 -#define OP_MAX 0x0F -#define OP_MAX_SAT 0x2E -#define OP_MIN 0x10 -#define OP_MIN_SAT 0x2F -#define OP_MUL 0x12 -#define OP_MUL_SAT 0x31 -#define OP_SGE 0x16 -#define OP_SGE_SAT 0x37 -#define OP_SLT 0x17 -#define OP_SLT_SAT 0x3A -#define OP_SUB 0x18 -#define OP_SUB_SAT 0x3B -#define OP_XPD 0x1A -#define OP_XPD_SAT 0x43 -#define OP_CMP 0x1D -#define OP_CMP_SAT 0x1E -#define OP_LRP 0x2B -#define OP_LRP_SAT 0x2C -#define OP_MAD 0x0E -#define OP_MAD_SAT 0x2D -#define OP_SWZ 0x19 -#define OP_SWZ_SAT 0x3C -#define OP_TEX 0x3D -#define OP_TEX_SAT 0x3E -#define OP_TXB 0x3F -#define OP_TXB_SAT 0x40 -#define OP_TXP 0x41 -#define OP_TXP_SAT 0x42 -#define OP_KIL 0x28 - -/* GL_ARB_vertex_program instruction code */ -#define OP_ARL 0x02 -/* OP_ABS */ -/* OP_FLR */ -/* OP_FRC */ -/* OP_LIT */ -/* OP_MOV */ -/* OP_EX2 */ -#define OP_EXP 0x08 -/* OP_LG2 */ -#define OP_LOG 0x0D -/* OP_RCP */ -/* OP_RSQ */ -/* OP_POW */ -/* OP_ADD */ -/* OP_DP3 */ -/* OP_DP4 */ -/* OP_DPH */ -/* OP_DST */ -/* OP_MAX */ -/* OP_MIN */ -/* OP_MUL */ -/* OP_SGE */ -/* OP_SLT */ -/* OP_SUB */ -/* OP_XPD */ -/* OP_MAD */ -/* OP_SWZ */ - -/* fragment attribute binding */ -#define FRAGMENT_ATTRIB_COLOR 0x01 -#define FRAGMENT_ATTRIB_TEXCOORD 0x02 -#define FRAGMENT_ATTRIB_FOGCOORD 0x03 -#define FRAGMENT_ATTRIB_POSITION 0x04 - -/* vertex attribute binding */ -#define VERTEX_ATTRIB_POSITION 0x01 -#define VERTEX_ATTRIB_WEIGHT 0x02 -#define VERTEX_ATTRIB_NORMAL 0x03 -#define VERTEX_ATTRIB_COLOR 0x04 -#define VERTEX_ATTRIB_FOGCOORD 0x05 -#define VERTEX_ATTRIB_TEXCOORD 0x06 -#define VERTEX_ATTRIB_MATRIXINDEX 0x07 -#define VERTEX_ATTRIB_GENERIC 0x08 - -/* fragment result binding */ -#define FRAGMENT_RESULT_COLOR 0x01 -#define FRAGMENT_RESULT_DEPTH 0x02 - -/* vertex result binding */ -#define VERTEX_RESULT_POSITION 0x01 -#define VERTEX_RESULT_COLOR 0x02 -#define VERTEX_RESULT_FOGCOORD 0x03 -#define VERTEX_RESULT_POINTSIZE 0x04 -#define VERTEX_RESULT_TEXCOORD 0x05 - -/* texture target */ -#define TEXTARGET_1D 0x01 -#define TEXTARGET_2D 0x02 -#define TEXTARGET_3D 0x03 -#define TEXTARGET_RECT 0x04 -#define TEXTARGET_CUBE 0x05 -/* GL_ARB_fragment_program_shadow */ -#define TEXTARGET_SHADOW1D 0x06 -#define TEXTARGET_SHADOW2D 0x07 -#define TEXTARGET_SHADOWRECT 0x08 -/* GL_MESA_texture_array */ -#define TEXTARGET_1D_ARRAY 0x09 -#define TEXTARGET_2D_ARRAY 0x0a -#define TEXTARGET_SHADOW1D_ARRAY 0x0b -#define TEXTARGET_SHADOW2D_ARRAY 0x0c - -/* face type */ -#define FACE_FRONT 0x00 -#define FACE_BACK 0x01 - -/* color type */ -#define COLOR_PRIMARY 0x00 -#define COLOR_SECONDARY 0x01 - -/* component */ -#define COMPONENT_X 0x00 -#define COMPONENT_Y 0x01 -#define COMPONENT_Z 0x02 -#define COMPONENT_W 0x03 -#define COMPONENT_0 0x04 -#define COMPONENT_1 0x05 - -/* array index type */ -#define ARRAY_INDEX_ABSOLUTE 0x00 -#define ARRAY_INDEX_RELATIVE 0x01 - -/* matrix name */ -#define MATRIX_MODELVIEW 0x01 -#define MATRIX_PROJECTION 0x02 -#define MATRIX_MVP 0x03 -#define MATRIX_TEXTURE 0x04 -#define MATRIX_PALETTE 0x05 -#define MATRIX_PROGRAM 0x06 - -/* matrix modifier */ -#define MATRIX_MODIFIER_IDENTITY 0x00 -#define MATRIX_MODIFIER_INVERSE 0x01 -#define MATRIX_MODIFIER_TRANSPOSE 0x02 -#define MATRIX_MODIFIER_INVTRANS 0x03 - -/* constant type */ -#define CONSTANT_SCALAR 0x01 -#define CONSTANT_VECTOR 0x02 - -/* program param type */ -#define PROGRAM_PARAM_ENV 0x01 -#define PROGRAM_PARAM_LOCAL 0x02 - -/* register type */ -#define REGISTER_ATTRIB 0x01 -#define REGISTER_PARAM 0x02 -#define REGISTER_RESULT 0x03 -#define REGISTER_ESTABLISHED_NAME 0x04 - -/* param binding */ -#define PARAM_NULL 0x00 -#define PARAM_ARRAY_ELEMENT 0x01 -#define PARAM_STATE_ELEMENT 0x02 -#define PARAM_PROGRAM_ELEMENT 0x03 -#define PARAM_PROGRAM_ELEMENTS 0x04 -#define PARAM_CONSTANT 0x05 - -/* param state property */ -#define STATE_MATERIAL_PARSER 0x01 -#define STATE_LIGHT_PARSER 0x02 -#define STATE_LIGHT_MODEL 0x03 -#define STATE_LIGHT_PROD 0x04 -#define STATE_FOG 0x05 -#define STATE_MATRIX_ROWS 0x06 -/* GL_ARB_fragment_program */ -#define STATE_TEX_ENV 0x07 -#define STATE_DEPTH 0x08 -/* GL_ARB_vertex_program */ -#define STATE_TEX_GEN 0x09 -#define STATE_CLIP_PLANE 0x0A -#define STATE_POINT 0x0B - -/* state material property */ -#define MATERIAL_AMBIENT 0x01 -#define MATERIAL_DIFFUSE 0x02 -#define MATERIAL_SPECULAR 0x03 -#define MATERIAL_EMISSION 0x04 -#define MATERIAL_SHININESS 0x05 - -/* state light property */ -#define LIGHT_AMBIENT 0x01 -#define LIGHT_DIFFUSE 0x02 -#define LIGHT_SPECULAR 0x03 -#define LIGHT_POSITION 0x04 -#define LIGHT_ATTENUATION 0x05 -#define LIGHT_HALF 0x06 -#define LIGHT_SPOT_DIRECTION 0x07 - -/* state light model property */ -#define LIGHT_MODEL_AMBIENT 0x01 -#define LIGHT_MODEL_SCENECOLOR 0x02 - -/* state light product property */ -#define LIGHT_PROD_AMBIENT 0x01 -#define LIGHT_PROD_DIFFUSE 0x02 -#define LIGHT_PROD_SPECULAR 0x03 - -/* state texture environment property */ -#define TEX_ENV_COLOR 0x01 - -/* state texture generation coord property */ -#define TEX_GEN_EYE 0x01 -#define TEX_GEN_OBJECT 0x02 - -/* state fog property */ -#define FOG_COLOR 0x01 -#define FOG_PARAMS 0x02 - -/* state depth property */ -#define DEPTH_RANGE 0x01 - -/* state point parameters property */ -#define POINT_SIZE 0x01 -#define POINT_ATTENUATION 0x02 - -/* declaration */ -#define ATTRIB 0x01 -#define PARAM 0x02 -#define TEMP 0x03 -#define OUTPUT 0x04 -#define ALIAS 0x05 -/* GL_ARB_vertex_program */ -#define ADDRESS 0x06 - -/*----------------------------------------------------------------------- - * From here on down is the semantic checking portion - * - */ - -/** - * Variable Table Handling functions - */ -typedef enum -{ - vt_none, - vt_address, - vt_attrib, - vt_param, - vt_temp, - vt_output, - vt_alias -} var_type; - - -/** - * Setting an explicit field for each of the binding properties is a bit - * wasteful of space, but it should be much more clear when reading later on.. - */ -struct var_cache -{ - const GLubyte *name; /* don't free() - no need */ - var_type type; - GLuint address_binding; /* The index of the address register we should - * be using */ - GLuint attrib_binding; /* For type vt_attrib, see nvfragprog.h for values */ - GLuint attrib_is_generic; /* If the attrib was specified through a generic - * vertex attrib */ - GLuint temp_binding; /* The index of the temp register we are to use */ - GLuint output_binding; /* Output/result register number */ - struct var_cache *alias_binding; /* For type vt_alias, points to the var_cache entry - * that this is aliased to */ - GLuint param_binding_type; /* {PROGRAM_STATE_VAR, PROGRAM_LOCAL_PARAM, - * PROGRAM_ENV_PARAM} */ - GLuint param_binding_begin; /* This is the offset into the program_parameter_list where - * the tokens representing our bound state (or constants) - * start */ - GLuint param_binding_length; /* This is how many entries in the the program_parameter_list - * we take up with our state tokens or constants. Note that - * this is _not_ the same as the number of param registers - * we eventually use */ - GLuint swizzle; /**< swizzle to access this variable */ - struct var_cache *next; -}; - -static GLvoid -var_cache_create (struct var_cache **va) -{ - *va = (struct var_cache *) _mesa_malloc (sizeof (struct var_cache)); - if (*va) { - (**va).name = NULL; - (**va).type = vt_none; - (**va).attrib_binding = ~0; - (**va).attrib_is_generic = 0; - (**va).temp_binding = ~0; - (**va).output_binding = ~0; - (**va).param_binding_type = ~0; - (**va).param_binding_begin = ~0; - (**va).param_binding_length = ~0; - (**va).alias_binding = NULL; - (**va).swizzle = SWIZZLE_XYZW; - (**va).next = NULL; - } -} - -static GLvoid -var_cache_destroy (struct var_cache **va) -{ - if (*va) { - var_cache_destroy (&(**va).next); - _mesa_free (*va); - *va = NULL; - } -} - -static GLvoid -var_cache_append (struct var_cache **va, struct var_cache *nv) -{ - if (*va) - var_cache_append (&(**va).next, nv); - else - *va = nv; -} - -static struct var_cache * -var_cache_find (struct var_cache *va, const GLubyte * name) -{ - /*struct var_cache *first = va;*/ - - while (va) { - if (!_mesa_strcmp ( (const char*) name, (const char*) va->name)) { - if (va->type == vt_alias) - return va->alias_binding; - return va; - } - - va = va->next; - } - - return NULL; -} - - - -/** - * Called when an error is detected while parsing/compiling a program. - * Sets the ctx->Program.ErrorString field to descript and records a - * GL_INVALID_OPERATION error. - * \param position position of error in program string - * \param descrip verbose error description - */ -static void -program_error(GLcontext *ctx, GLint position, const char *descrip) -{ - if (descrip) { - const char *prefix = "glProgramString(", *suffix = ")"; - char *str = (char *) _mesa_malloc(_mesa_strlen(descrip) + - _mesa_strlen(prefix) + - _mesa_strlen(suffix) + 1); - if (str) { - _mesa_sprintf(str, "%s%s%s", prefix, descrip, suffix); - _mesa_error(ctx, GL_INVALID_OPERATION, str); - _mesa_free(str); - } - } - _mesa_set_program_error(ctx, position, descrip); -} - - -/** - * As above, but with an extra string parameter for more info. - */ -static void -program_error2(GLcontext *ctx, GLint position, const char *descrip, - const char *var) -{ - if (descrip) { - const char *prefix = "glProgramString(", *suffix = ")"; - char *str = (char *) _mesa_malloc(_mesa_strlen(descrip) + - _mesa_strlen(": ") + - _mesa_strlen(var) + - _mesa_strlen(prefix) + - _mesa_strlen(suffix) + 1); - if (str) { - _mesa_sprintf(str, "%s%s: %s%s", prefix, descrip, var, suffix); - _mesa_error(ctx, GL_INVALID_OPERATION, str); - _mesa_free(str); - } - } - { - char *str = (char *) _mesa_malloc(_mesa_strlen(descrip) + - _mesa_strlen(": ") + - _mesa_strlen(var) + 1); - if (str) { - _mesa_sprintf(str, "%s: %s", descrip, var); - } - _mesa_set_program_error(ctx, position, str); - if (str) { - _mesa_free(str); - } - } -} - - - -/** - * constructs an integer from 4 GLubytes in LE format - */ -static GLuint -parse_position (const GLubyte ** inst) -{ - GLuint value; - - value = (GLuint) (*(*inst)++); - value += (GLuint) (*(*inst)++) * 0x100; - value += (GLuint) (*(*inst)++) * 0x10000; - value += (GLuint) (*(*inst)++) * 0x1000000; - - return value; -} - -/** - * This will, given a string, lookup the string as a variable name in the - * var cache. If the name is found, the var cache node corresponding to the - * var name is returned. If it is not found, a new entry is allocated - * - * \param I Points into the binary array where the string identifier begins - * \param found 1 if the string was found in the var_cache, 0 if it was allocated - * \return The location on the var_cache corresponding the the string starting at I - */ -static struct var_cache * -parse_string (const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program, GLuint * found) -{ - const GLubyte *i = *inst; - struct var_cache *va = NULL; - (void) Program; - - *inst += _mesa_strlen ((char *) i) + 1; - - va = var_cache_find (*vc_head, i); - - if (va) { - *found = 1; - return va; - } - - *found = 0; - var_cache_create (&va); - va->name = (const GLubyte *) i; - - var_cache_append (vc_head, va); - - return va; -} - -static char * -parse_string_without_adding (const GLubyte ** inst, struct arb_program *Program) -{ - const GLubyte *i = *inst; - (void) Program; - - *inst += _mesa_strlen ((char *) i) + 1; - - return (char *) i; -} - -/** - * \return -1 if we parse '-', return 1 otherwise - */ -static GLint -parse_sign (const GLubyte ** inst) -{ - /*return *(*inst)++ != '+'; */ - - if (**inst == '-') { - (*inst)++; - return -1; - } - else if (**inst == '+') { - (*inst)++; - return 1; - } - - return 1; -} - -/** - * parses and returns signed integer - */ -static GLint -parse_integer (const GLubyte ** inst, struct arb_program *Program) -{ - GLint sign; - GLint value; - - /* check if *inst points to '+' or '-' - * if yes, grab the sign and increment *inst - */ - sign = parse_sign (inst); - - /* now check if *inst points to 0 - * if yes, increment the *inst and return the default value - */ - if (**inst == 0) { - (*inst)++; - return 0; - } - - /* parse the integer as you normally would do it */ - value = _mesa_atoi (parse_string_without_adding (inst, Program)); - - /* now, after terminating 0 there is a position - * to parse it - parse_position() - */ - Program->Position = parse_position (inst); - - return value * sign; -} - -/** - Accumulate this string of digits, and return them as - a large integer represented in floating point (for range). - If scale is not NULL, also accumulates a power-of-ten - integer scale factor that represents the number of digits - in the string. -*/ -static GLdouble -parse_float_string(const GLubyte ** inst, struct arb_program *Program, GLdouble *scale) -{ - GLdouble value = 0.0; - GLdouble oscale = 1.0; - - if (**inst == 0) { /* this string of digits is empty-- do nothing */ - (*inst)++; - } - else { /* nonempty string-- parse out the digits */ - while (**inst >= '0' && **inst <= '9') { - GLubyte digit = *((*inst)++); - value = value * 10.0 + (GLint) (digit - '0'); - oscale *= 10.0; - } - assert(**inst == 0); /* integer string should end with 0 */ - (*inst)++; /* skip over terminating 0 */ - Program->Position = parse_position(inst); /* skip position (from integer) */ - } - if (scale) - *scale = oscale; - return value; -} - -/** - Parse an unsigned floating-point number from this stream of tokenized - characters. Example floating-point formats supported: - 12.34 - 12 - 0.34 - .34 - 12.34e-4 - */ -static GLfloat -parse_float (const GLubyte ** inst, struct arb_program *Program) -{ - GLint exponent; - GLdouble whole, fraction, fracScale = 1.0; - - whole = parse_float_string(inst, Program, 0); - fraction = parse_float_string(inst, Program, &fracScale); - - /* Parse signed exponent */ - exponent = parse_integer(inst, Program); /* This is the exponent */ - - /* Assemble parts of floating-point number: */ - return (GLfloat) ((whole + fraction / fracScale) * - _mesa_pow(10.0, (GLfloat) exponent)); -} - - -/** - */ -static GLfloat -parse_signed_float (const GLubyte ** inst, struct arb_program *Program) -{ - GLint sign = parse_sign (inst); - GLfloat value = parse_float (inst, Program); - return value * sign; -} - -/** - * This picks out a constant value from the parsed array. The constant vector is r - * returned in the *values array, which should be of length 4. - * - * \param values - return the vector constant values. - * \param size - returns the number elements in valuesOut [1..4] - */ -static GLvoid -parse_constant(const GLubyte ** inst, GLfloat *values, GLint *size, - struct arb_program *Program, - GLboolean use) -{ - GLuint components, i; - - switch (*(*inst)++) { - case CONSTANT_SCALAR: - if (use == GL_TRUE) { - values[0] = - values[1] = - values[2] = values[3] = parse_float (inst, Program); - } - else { - values[0] = - values[1] = - values[2] = values[3] = parse_signed_float (inst, Program); - } - *size = 1; - break; - case CONSTANT_VECTOR: - values[0] = values[1] = values[2] = 0; - values[3] = 1; - components = *(*inst)++; - for (i = 0; i < components; i++) { - values[i] = parse_signed_float (inst, Program); - } - *size = 4; - break; - default: - _mesa_problem(NULL, "unexpected case in parse_constant()"); - values[0] = 0.0F; - *size = 0; - } -} - -/** - * \param offset The offset from the address register that we should - * address - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_relative_offset(GLcontext *ctx, const GLubyte **inst, - struct arb_program *Program, GLint *offset) -{ - (void) ctx; - *offset = parse_integer(inst, Program); - return 0; -} - -/** - * \param color 0 if color type is primary, 1 if color type is secondary - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_color_type (GLcontext * ctx, const GLubyte ** inst, struct arb_program *Program, - GLint * color) -{ - (void) ctx; (void) Program; - *color = *(*inst)++ != COLOR_PRIMARY; - return 0; -} - -/** - * Get an integer corresponding to a generic vertex attribute. - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_generic_attrib_num(GLcontext *ctx, const GLubyte ** inst, - struct arb_program *Program, GLuint *attrib) -{ - GLint i = parse_integer(inst, Program); - - if ((i < 0) || (i >= MAX_VERTEX_GENERIC_ATTRIBS)) - { - program_error(ctx, Program->Position, - "Invalid generic vertex attribute index"); - return 1; - } - - *attrib = (GLuint) i; - - return 0; -} - - -/** - * \param color The index of the color buffer to write into - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_output_color_num (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, GLuint * color) -{ - GLint i = parse_integer (inst, Program); - - if ((i < 0) || (i >= (int)ctx->Const.MaxDrawBuffers)) { - *color = 0; - program_error(ctx, Program->Position, "Invalid draw buffer index"); - return 1; - } - - *color = (GLuint) i; - return 0; -} - - -/** - * Validate the index of a texture coordinate - * - * \param coord The texture unit index - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_texcoord_num (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, GLuint * coord) -{ - GLint i = parse_integer (inst, Program); - - if ((i < 0) || (i >= (int)ctx->Const.MaxTextureCoordUnits)) { - program_error(ctx, Program->Position, "Invalid texture coordinate index"); - return 1; - } - - *coord = (GLuint) i; - return 0; -} - - -/** - * Validate the index of a texture image unit - * - * \param coord The texture unit index - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_teximage_num (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, GLuint * coord) -{ - GLint i = parse_integer (inst, Program); - - if ((i < 0) || (i >= (int)ctx->Const.MaxTextureImageUnits)) { - char s[100]; - _mesa_snprintf(s, sizeof(s), "Invalid texture image index %d (%u is max)", - i, ctx->Const.MaxTextureImageUnits); - program_error(ctx, Program->Position, s); - return 1; - } - - *coord = (GLuint) i; - return 0; -} - - -/** - * \param coord The weight index - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_weight_num (GLcontext * ctx, const GLubyte ** inst, struct arb_program *Program, - GLint * coord) -{ - *coord = parse_integer (inst, Program); - - if ((*coord < 0) || (*coord >= 1)) { - program_error(ctx, Program->Position, "Invalid weight index"); - return 1; - } - - return 0; -} - -/** - * \param coord The clip plane index - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_clipplane_num (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, GLint * coord) -{ - *coord = parse_integer (inst, Program); - - if ((*coord < 0) || (*coord >= (GLint) ctx->Const.MaxClipPlanes)) { - program_error(ctx, Program->Position, "Invalid clip plane index"); - return 1; - } - - return 0; -} - - -/** - * \return 0 on front face, 1 on back face - */ -static GLuint -parse_face_type (const GLubyte ** inst) -{ - switch (*(*inst)++) { - case FACE_FRONT: - return 0; - - case FACE_BACK: - return 1; - } - return 0; -} - - -/** - * Given a matrix and a modifier token on the binary array, return tokens - * that _mesa_fetch_state() [program.c] can understand. - * - * \param matrix - the matrix we are talking about - * \param matrix_idx - the index of the matrix we have (for texture & program matricies) - * \param matrix_modifier - the matrix modifier (trans, inv, etc) - * \return 0 on sucess, 1 on failure - */ -static GLuint -parse_matrix (GLcontext * ctx, const GLubyte ** inst, struct arb_program *Program, - GLint * matrix, GLint * matrix_idx, GLint * matrix_modifier) -{ - GLubyte mat = *(*inst)++; - - *matrix_idx = 0; - - switch (mat) { - case MATRIX_MODELVIEW: - *matrix = STATE_MODELVIEW_MATRIX; - *matrix_idx = parse_integer (inst, Program); - if (*matrix_idx > 0) { - program_error(ctx, Program->Position, - "ARB_vertex_blend not supported"); - return 1; - } - break; - - case MATRIX_PROJECTION: - *matrix = STATE_PROJECTION_MATRIX; - break; - - case MATRIX_MVP: - *matrix = STATE_MVP_MATRIX; - break; - - case MATRIX_TEXTURE: - *matrix = STATE_TEXTURE_MATRIX; - *matrix_idx = parse_integer (inst, Program); - if (*matrix_idx >= (GLint) ctx->Const.MaxTextureUnits) { - program_error(ctx, Program->Position, "Invalid Texture Unit"); - /* bad *matrix_id */ - return 1; - } - break; - - /* This is not currently supported (ARB_matrix_palette) */ - case MATRIX_PALETTE: - *matrix_idx = parse_integer (inst, Program); - program_error(ctx, Program->Position, - "ARB_matrix_palette not supported"); - return 1; - break; - - case MATRIX_PROGRAM: - *matrix = STATE_PROGRAM_MATRIX; - *matrix_idx = parse_integer (inst, Program); - if (*matrix_idx >= (GLint) ctx->Const.MaxProgramMatrices) { - program_error(ctx, Program->Position, "Invalid Program Matrix"); - /* bad *matrix_idx */ - return 1; - } - break; - } - - switch (*(*inst)++) { - case MATRIX_MODIFIER_IDENTITY: - *matrix_modifier = 0; - break; - case MATRIX_MODIFIER_INVERSE: - *matrix_modifier = STATE_MATRIX_INVERSE; - break; - case MATRIX_MODIFIER_TRANSPOSE: - *matrix_modifier = STATE_MATRIX_TRANSPOSE; - break; - case MATRIX_MODIFIER_INVTRANS: - *matrix_modifier = STATE_MATRIX_INVTRANS; - break; - } - - return 0; -} - - -/** - * This parses a state string (rather, the binary version of it) into - * a 6-token sequence as described in _mesa_fetch_state() [program.c] - * - * \param inst - the start in the binary arry to start working from - * \param state_tokens - the storage for the 6-token state description - * \return - 0 on sucess, 1 on error - */ -static GLuint -parse_state_single_item (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, - gl_state_index state_tokens[STATE_LENGTH]) -{ - GLubyte token = *(*inst)++; - - switch (token) { - case STATE_MATERIAL_PARSER: - state_tokens[0] = STATE_MATERIAL; - state_tokens[1] = parse_face_type (inst); - switch (*(*inst)++) { - case MATERIAL_AMBIENT: - state_tokens[2] = STATE_AMBIENT; - break; - case MATERIAL_DIFFUSE: - state_tokens[2] = STATE_DIFFUSE; - break; - case MATERIAL_SPECULAR: - state_tokens[2] = STATE_SPECULAR; - break; - case MATERIAL_EMISSION: - state_tokens[2] = STATE_EMISSION; - break; - case MATERIAL_SHININESS: - state_tokens[2] = STATE_SHININESS; - break; - } - break; - - case STATE_LIGHT_PARSER: - state_tokens[0] = STATE_LIGHT; - state_tokens[1] = parse_integer (inst, Program); - - /* Check the value of state_tokens[1] against the # of lights */ - if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { - program_error(ctx, Program->Position, "Invalid Light Number"); - /* bad state_tokens[1] */ - return 1; - } - - switch (*(*inst)++) { - case LIGHT_AMBIENT: - state_tokens[2] = STATE_AMBIENT; - break; - case LIGHT_DIFFUSE: - state_tokens[2] = STATE_DIFFUSE; - break; - case LIGHT_SPECULAR: - state_tokens[2] = STATE_SPECULAR; - break; - case LIGHT_POSITION: - state_tokens[2] = STATE_POSITION; - break; - case LIGHT_ATTENUATION: - state_tokens[2] = STATE_ATTENUATION; - break; - case LIGHT_HALF: - state_tokens[2] = STATE_HALF_VECTOR; - break; - case LIGHT_SPOT_DIRECTION: - state_tokens[2] = STATE_SPOT_DIRECTION; - break; - } - break; - - case STATE_LIGHT_MODEL: - switch (*(*inst)++) { - case LIGHT_MODEL_AMBIENT: - state_tokens[0] = STATE_LIGHTMODEL_AMBIENT; - break; - case LIGHT_MODEL_SCENECOLOR: - state_tokens[0] = STATE_LIGHTMODEL_SCENECOLOR; - state_tokens[1] = parse_face_type (inst); - break; - } - break; - - case STATE_LIGHT_PROD: - state_tokens[0] = STATE_LIGHTPROD; - state_tokens[1] = parse_integer (inst, Program); - - /* Check the value of state_tokens[1] against the # of lights */ - if (state_tokens[1] >= (GLint) ctx->Const.MaxLights) { - program_error(ctx, Program->Position, "Invalid Light Number"); - /* bad state_tokens[1] */ - return 1; - } - - state_tokens[2] = parse_face_type (inst); - switch (*(*inst)++) { - case LIGHT_PROD_AMBIENT: - state_tokens[3] = STATE_AMBIENT; - break; - case LIGHT_PROD_DIFFUSE: - state_tokens[3] = STATE_DIFFUSE; - break; - case LIGHT_PROD_SPECULAR: - state_tokens[3] = STATE_SPECULAR; - break; - } - break; - - - case STATE_FOG: - switch (*(*inst)++) { - case FOG_COLOR: - state_tokens[0] = STATE_FOG_COLOR; - break; - case FOG_PARAMS: - state_tokens[0] = STATE_FOG_PARAMS; - break; - } - break; - - case STATE_TEX_ENV: - state_tokens[1] = parse_integer (inst, Program); - switch (*(*inst)++) { - case TEX_ENV_COLOR: - state_tokens[0] = STATE_TEXENV_COLOR; - break; - } - break; - - case STATE_TEX_GEN: - { - GLuint type, coord; - - state_tokens[0] = STATE_TEXGEN; - /*state_tokens[1] = parse_integer (inst, Program);*/ /* Texture Unit */ - - if (parse_texcoord_num (ctx, inst, Program, &coord)) - return 1; - state_tokens[1] = coord; - - /* EYE or OBJECT */ - type = *(*inst)++; - - /* 0 - s, 1 - t, 2 - r, 3 - q */ - coord = *(*inst)++; - - if (type == TEX_GEN_EYE) { - switch (coord) { - case COMPONENT_X: - state_tokens[2] = STATE_TEXGEN_EYE_S; - break; - case COMPONENT_Y: - state_tokens[2] = STATE_TEXGEN_EYE_T; - break; - case COMPONENT_Z: - state_tokens[2] = STATE_TEXGEN_EYE_R; - break; - case COMPONENT_W: - state_tokens[2] = STATE_TEXGEN_EYE_Q; - break; - default: - _mesa_problem(ctx, "bad texgen component in " - "parse_state_single_item()"); - } - } - else { - switch (coord) { - case COMPONENT_X: - state_tokens[2] = STATE_TEXGEN_OBJECT_S; - break; - case COMPONENT_Y: - state_tokens[2] = STATE_TEXGEN_OBJECT_T; - break; - case COMPONENT_Z: - state_tokens[2] = STATE_TEXGEN_OBJECT_R; - break; - case COMPONENT_W: - state_tokens[2] = STATE_TEXGEN_OBJECT_Q; - break; - default: - _mesa_problem(ctx, "bad texgen component in " - "parse_state_single_item()"); - } - } - } - break; - - case STATE_DEPTH: - switch (*(*inst)++) { - case DEPTH_RANGE: - state_tokens[0] = STATE_DEPTH_RANGE; - break; - } - break; - - case STATE_CLIP_PLANE: - state_tokens[0] = STATE_CLIPPLANE; - if (parse_clipplane_num (ctx, inst, Program, - (GLint *) &state_tokens[1])) - return 1; - break; - - case STATE_POINT: - switch (*(*inst)++) { - case POINT_SIZE: - state_tokens[0] = STATE_POINT_SIZE; - break; - - case POINT_ATTENUATION: - state_tokens[0] = STATE_POINT_ATTENUATION; - break; - } - break; - - /* XXX: I think this is the correct format for a matrix row */ - case STATE_MATRIX_ROWS: - if (parse_matrix(ctx, inst, Program, - (GLint *) &state_tokens[0], - (GLint *) &state_tokens[1], - (GLint *) &state_tokens[4])) - return 1; - - state_tokens[2] = parse_integer (inst, Program); /* The first row to grab */ - - if ((**inst) != 0) { /* Either the last row, 0 */ - state_tokens[3] = parse_integer (inst, Program); - if (state_tokens[3] < state_tokens[2]) { - program_error(ctx, Program->Position, - "Second matrix index less than the first"); - /* state_tokens[4] vs. state_tokens[3] */ - return 1; - } - } - else { - state_tokens[3] = state_tokens[2]; - (*inst)++; - } - break; - } - - return 0; -} - -/** - * This parses a state string (rather, the binary version of it) into - * a 6-token similar for the state fetching code in program.c - * - * One might ask, why fetch these parameters into just like you fetch - * state when they are already stored in other places? - * - * Because of array offsets -> We can stick env/local parameters in the - * middle of a parameter array and then index someplace into the array - * when we execute. - * - * One optimization might be to only do this for the cases where the - * env/local parameters end up inside of an array, and leave the - * single parameters (or arrays of pure env/local pareameters) in their - * respective register files. - * - * For ENV parameters, the format is: - * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM - * state_tokens[1] = STATE_ENV - * state_tokens[2] = the parameter index - * - * for LOCAL parameters, the format is: - * state_tokens[0] = STATE_FRAGMENT_PROGRAM / STATE_VERTEX_PROGRAM - * state_tokens[1] = STATE_LOCAL - * state_tokens[2] = the parameter index - * - * \param inst - the start in the binary arry to start working from - * \param state_tokens - the storage for the 6-token state description - * \return - 0 on sucess, 1 on failure - */ -static GLuint -parse_program_single_item (GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, - gl_state_index state_tokens[STATE_LENGTH]) -{ - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) - state_tokens[0] = STATE_FRAGMENT_PROGRAM; - else - state_tokens[0] = STATE_VERTEX_PROGRAM; - - - switch (*(*inst)++) { - case PROGRAM_PARAM_ENV: - state_tokens[1] = STATE_ENV; - state_tokens[2] = parse_integer (inst, Program); - - /* Check state_tokens[2] against the number of ENV parameters available */ - if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && - (state_tokens[2] >= (GLint) ctx->Const.FragmentProgram.MaxEnvParams)) - || - ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && - (state_tokens[2] >= (GLint) ctx->Const.VertexProgram.MaxEnvParams))) { - program_error(ctx, Program->Position, - "Invalid Program Env Parameter"); - /* bad state_tokens[2] */ - return 1; - } - - break; - - case PROGRAM_PARAM_LOCAL: - state_tokens[1] = STATE_LOCAL; - state_tokens[2] = parse_integer (inst, Program); - - /* Check state_tokens[2] against the number of LOCAL parameters available */ - if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && - (state_tokens[2] >= (GLint) ctx->Const.FragmentProgram.MaxLocalParams)) - || - ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && - (state_tokens[2] >= (GLint) ctx->Const.VertexProgram.MaxLocalParams))) { - program_error(ctx, Program->Position, - "Invalid Program Local Parameter"); - /* bad state_tokens[2] */ - return 1; - } - break; - } - - return 0; -} - -/** - * For ARB_vertex_program, programs are not allowed to use both an explicit - * vertex attribute and a generic vertex attribute corresponding to the same - * state. See section 2.14.3.1 of the GL_ARB_vertex_program spec. - * - * This will walk our var_cache and make sure that nobody does anything fishy. - * - * \return 0 on sucess, 1 on error - */ -static GLuint -generic_attrib_check(struct var_cache *vc_head) -{ - int a; - struct var_cache *curr; - GLboolean explicitAttrib[MAX_VERTEX_GENERIC_ATTRIBS], - genericAttrib[MAX_VERTEX_GENERIC_ATTRIBS]; - - for (a=0; a<MAX_VERTEX_GENERIC_ATTRIBS; a++) { - explicitAttrib[a] = GL_FALSE; - genericAttrib[a] = GL_FALSE; - } - - curr = vc_head; - while (curr) { - if (curr->type == vt_attrib) { - if (curr->attrib_is_generic) { - GLuint attr = (curr->attrib_binding == 0) - ? 0 : (curr->attrib_binding - VERT_ATTRIB_GENERIC0); - assert(attr < MAX_VERTEX_GENERIC_ATTRIBS); - genericAttrib[attr] = GL_TRUE; - } - else { - assert(curr->attrib_binding < MAX_VERTEX_GENERIC_ATTRIBS); - explicitAttrib[ curr->attrib_binding ] = GL_TRUE; - } - } - - curr = curr->next; - } - - for (a=0; a<MAX_VERTEX_GENERIC_ATTRIBS; a++) { - if ((explicitAttrib[a]) && (genericAttrib[a])) - return 1; - } - - return 0; -} - -/** - * This will handle the binding side of an ATTRIB var declaration - * - * \param inputReg returns the input register index, one of the - * VERT_ATTRIB_* or FRAG_ATTRIB_* values. - * \return returns 0 on success, 1 on error - */ -static GLuint -parse_attrib_binding(GLcontext * ctx, const GLubyte ** inst, - struct arb_program *Program, - GLuint *inputReg, GLuint *is_generic) -{ - GLint err = 0; - - *is_generic = 0; - - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - switch (*(*inst)++) { - case FRAGMENT_ATTRIB_COLOR: - { - GLint coord; - err = parse_color_type (ctx, inst, Program, &coord); - *inputReg = FRAG_ATTRIB_COL0 + coord; - } - break; - case FRAGMENT_ATTRIB_TEXCOORD: - { - GLuint texcoord = 0; - err = parse_texcoord_num (ctx, inst, Program, &texcoord); - *inputReg = FRAG_ATTRIB_TEX0 + texcoord; - } - break; - case FRAGMENT_ATTRIB_FOGCOORD: - *inputReg = FRAG_ATTRIB_FOGC; - break; - case FRAGMENT_ATTRIB_POSITION: - *inputReg = FRAG_ATTRIB_WPOS; - break; - default: - err = 1; - break; - } - } - else { - switch (*(*inst)++) { - case VERTEX_ATTRIB_POSITION: - *inputReg = VERT_ATTRIB_POS; - break; - - case VERTEX_ATTRIB_WEIGHT: - { - GLint weight; - err = parse_weight_num (ctx, inst, Program, &weight); - *inputReg = VERT_ATTRIB_WEIGHT; -#if 1 - /* hack for Warcraft (see bug 8060) */ - _mesa_warning(ctx, "Application error: vertex program uses 'vertex.weight' but GL_ARB_vertex_blend not supported."); - break; -#else - program_error(ctx, Program->Position, - "ARB_vertex_blend not supported"); - return 1; -#endif - } - - case VERTEX_ATTRIB_NORMAL: - *inputReg = VERT_ATTRIB_NORMAL; - break; - - case VERTEX_ATTRIB_COLOR: - { - GLint color; - err = parse_color_type (ctx, inst, Program, &color); - if (color) { - *inputReg = VERT_ATTRIB_COLOR1; - } - else { - *inputReg = VERT_ATTRIB_COLOR0; - } - } - break; - - case VERTEX_ATTRIB_FOGCOORD: - *inputReg = VERT_ATTRIB_FOG; - break; - - case VERTEX_ATTRIB_TEXCOORD: - { - GLuint unit = 0; - err = parse_texcoord_num (ctx, inst, Program, &unit); - *inputReg = VERT_ATTRIB_TEX0 + unit; - } - break; - - case VERTEX_ATTRIB_MATRIXINDEX: - /* Not supported at this time */ - { - const char *msg = "ARB_palette_matrix not supported"; - parse_integer (inst, Program); - program_error(ctx, Program->Position, msg); - } - return 1; - - case VERTEX_ATTRIB_GENERIC: - { - GLuint attrib; - err = parse_generic_attrib_num(ctx, inst, Program, &attrib); - if (!err) { - *is_generic = 1; - /* Add VERT_ATTRIB_GENERIC0 here because ARB_vertex_program's - * attributes do not alias the conventional vertex - * attributes. - */ - if (attrib > 0) - *inputReg = attrib + VERT_ATTRIB_GENERIC0; - else - *inputReg = 0; - } - } - break; - - default: - err = 1; - break; - } - } - - if (err) { - program_error(ctx, Program->Position, "Bad attribute binding"); - } - - return err; -} - - -/** - * This translates between a binary token for an output variable type - * and the mesa token for the same thing. - * - * \param inst The parsed tokens - * \param outputReg Returned index/number of the output register, - * one of the VERT_RESULT_* or FRAG_RESULT_* values. - */ -static GLuint -parse_result_binding(GLcontext *ctx, const GLubyte **inst, - GLuint *outputReg, struct arb_program *Program) -{ - const GLubyte token = *(*inst)++; - - switch (token) { - case FRAGMENT_RESULT_COLOR: - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - GLuint out_color; - - /* This gets result of the color buffer we're supposed to - * draw into. This pertains to GL_ARB_draw_buffers. - */ - parse_output_color_num(ctx, inst, Program, &out_color); - ASSERT(out_color < MAX_DRAW_BUFFERS); - *outputReg = FRAG_RESULT_COLOR; - } - else { - /* for vtx programs, this is VERTEX_RESULT_POSITION */ - *outputReg = VERT_RESULT_HPOS; - } - break; - - case FRAGMENT_RESULT_DEPTH: - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - /* for frag programs, this is FRAGMENT_RESULT_DEPTH */ - *outputReg = FRAG_RESULT_DEPTH; - } - else { - /* for vtx programs, this is VERTEX_RESULT_COLOR */ - GLint color_type; - GLuint face_type = parse_face_type(inst); - GLint err = parse_color_type(ctx, inst, Program, &color_type); - if (err) - return 1; - - if (face_type) { - /* back face */ - if (color_type) { - *outputReg = VERT_RESULT_BFC1; /* secondary color */ - } - else { - *outputReg = VERT_RESULT_BFC0; /* primary color */ - } - } - else { - /* front face */ - if (color_type) { - *outputReg = VERT_RESULT_COL1; /* secondary color */ - } - /* primary color */ - else { - *outputReg = VERT_RESULT_COL0; /* primary color */ - } - } - } - break; - - case VERTEX_RESULT_FOGCOORD: - *outputReg = VERT_RESULT_FOGC; - break; - - case VERTEX_RESULT_POINTSIZE: - *outputReg = VERT_RESULT_PSIZ; - break; - - case VERTEX_RESULT_TEXCOORD: - { - GLuint unit; - if (parse_texcoord_num (ctx, inst, Program, &unit)) - return 1; - *outputReg = VERT_RESULT_TEX0 + unit; - } - break; - } - - Program->Base.OutputsWritten |= (1 << *outputReg); - - return 0; -} - - -/** - * This handles the declaration of ATTRIB variables - * - * XXX: Still needs - * parse_vert_attrib_binding(), or something like that - * - * \return 0 on sucess, 1 on error - */ -static GLint -parse_attrib (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found; - struct var_cache *attrib_var; - - attrib_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) attrib_var->name); - return 1; - } - - attrib_var->type = vt_attrib; - - if (parse_attrib_binding(ctx, inst, Program, &attrib_var->attrib_binding, - &attrib_var->attrib_is_generic)) - return 1; - - if (generic_attrib_check(*vc_head)) { - program_error(ctx, Program->Position, - "Cannot use both a generic vertex attribute " - "and a specific attribute of the same type"); - return 1; - } - - Program->Base.NumAttributes++; - return 0; -} - -/** - * \param use -- TRUE if we're called when declaring implicit parameters, - * FALSE if we're declaraing variables. This has to do with - * if we get a signed or unsigned float for scalar constants - */ -static GLuint -parse_param_elements (GLcontext * ctx, const GLubyte ** inst, - struct var_cache *param_var, - struct arb_program *Program, GLboolean use) -{ - GLint idx; - GLuint err = 0; - gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0}; - - GLubyte token = *(*inst)++; - - switch (token) { - case PARAM_STATE_ELEMENT: - if (parse_state_single_item (ctx, inst, Program, state_tokens)) - return 1; - - /* If we adding STATE_MATRIX that has multiple rows, we need to - * unroll it and call _mesa_add_state_reference() for each row - */ - if ((state_tokens[0] == STATE_MODELVIEW_MATRIX || - state_tokens[0] == STATE_PROJECTION_MATRIX || - state_tokens[0] == STATE_MVP_MATRIX || - state_tokens[0] == STATE_TEXTURE_MATRIX || - state_tokens[0] == STATE_PROGRAM_MATRIX) - && (state_tokens[2] != state_tokens[3])) { - GLint row; - const GLint first_row = state_tokens[2]; - const GLint last_row = state_tokens[3]; - - for (row = first_row; row <= last_row; row++) { - state_tokens[2] = state_tokens[3] = row; - - idx = _mesa_add_state_reference(Program->Base.Parameters, - state_tokens); - if (param_var->param_binding_begin == ~0U) - param_var->param_binding_begin = idx; - param_var->param_binding_length++; - } - } - else { - idx = _mesa_add_state_reference(Program->Base.Parameters, - state_tokens); - if (param_var->param_binding_begin == ~0U) - param_var->param_binding_begin = idx; - param_var->param_binding_length++; - } - break; - - case PARAM_PROGRAM_ELEMENT: - if (parse_program_single_item (ctx, inst, Program, state_tokens)) - return 1; - idx = _mesa_add_state_reference (Program->Base.Parameters, state_tokens); - if (param_var->param_binding_begin == ~0U) - param_var->param_binding_begin = idx; - param_var->param_binding_length++; - - /* Check if there is more: 0 -> we're done, else its an integer */ - if (**inst) { - GLuint out_of_range, new_idx; - GLuint start_idx = state_tokens[2] + 1; - GLuint end_idx = parse_integer (inst, Program); - - out_of_range = 0; - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - if (((state_tokens[1] == STATE_ENV) - && (end_idx >= ctx->Const.FragmentProgram.MaxEnvParams)) - || ((state_tokens[1] == STATE_LOCAL) - && (end_idx >= - ctx->Const.FragmentProgram.MaxLocalParams))) - out_of_range = 1; - } - else { - if (((state_tokens[1] == STATE_ENV) - && (end_idx >= ctx->Const.VertexProgram.MaxEnvParams)) - || ((state_tokens[1] == STATE_LOCAL) - && (end_idx >= - ctx->Const.VertexProgram.MaxLocalParams))) - out_of_range = 1; - } - if (out_of_range) { - program_error(ctx, Program->Position, - "Invalid Program Parameter"); /*end_idx*/ - return 1; - } - - for (new_idx = start_idx; new_idx <= end_idx; new_idx++) { - state_tokens[2] = new_idx; - idx = _mesa_add_state_reference(Program->Base.Parameters, - state_tokens); - param_var->param_binding_length++; - } - } - else { - (*inst)++; - } - break; - - case PARAM_CONSTANT: - /* parsing something like {1.0, 2.0, 3.0, 4.0} */ - { - GLfloat const_values[4]; - GLint size; - parse_constant(inst, const_values, &size, Program, use); - if (param_var->name[0] == ' ') { - /* this is an unnamed constant */ - idx = _mesa_add_unnamed_constant(Program->Base.Parameters, - const_values, size, - ¶m_var->swizzle); - } - else { - /* named parameter/constant */ - idx = _mesa_add_named_constant(Program->Base.Parameters, - (char *) param_var->name, - const_values, size); - } - if (param_var->param_binding_begin == ~0U) - param_var->param_binding_begin = idx; - param_var->param_binding_type = PROGRAM_STATE_VAR; - /* Note: when we reference this parameter in an instruction later, - * we'll check if it's really a constant/immediate and set the - * instruction register type appropriately. - */ - param_var->param_binding_length++; - } - break; - - default: - program_error(ctx, Program->Position, - "Unexpected token (in parse_param_elements())"); - return 1; - } - - Program->Base.NumParameters = Program->Base.Parameters->NumParameters; - - /* Make sure we haven't blown past our parameter limits */ - if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) && - (Program->Base.NumParameters > - ctx->Const.VertexProgram.MaxLocalParams)) - || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) - && (Program->Base.NumParameters > - ctx->Const.FragmentProgram.MaxLocalParams))) { - program_error(ctx, Program->Position, "Too many parameter variables"); - return 1; - } - - return err; -} - - -/** - * This picks out PARAM program parameter bindings. - * - * XXX: This needs to be stressed & tested - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_param (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found, err; - GLint specified_length; - struct var_cache *param_var; - - err = 0; - param_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) param_var->name); - return 1; - } - - specified_length = parse_integer (inst, Program); - - if (specified_length < 0) { - program_error(ctx, Program->Position, "Negative parameter array length"); - return 1; - } - - param_var->type = vt_param; - param_var->param_binding_length = 0; - - /* Right now, everything is shoved into the main state register file. - * - * In the future, it would be nice to leave things ENV/LOCAL params - * in their respective register files, if possible - */ - param_var->param_binding_type = PROGRAM_STATE_VAR; - - /* Remember to: - * * - add each guy to the parameter list - * * - increment the param_var->param_binding_len - * * - store the param_var->param_binding_begin for the first one - * * - compare the actual len to the specified len at the end - */ - while (**inst != PARAM_NULL) { - if (parse_param_elements (ctx, inst, param_var, Program, GL_FALSE)) - return 1; - } - - /* Test array length here! */ - if (specified_length) { - if (specified_length != (int)param_var->param_binding_length) { - program_error(ctx, Program->Position, - "Declared parameter array length does not match parameter list"); - } - } - - (*inst)++; - - return 0; -} - -/** - * - */ -static GLuint -parse_param_use (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program, struct var_cache **new_var) -{ - struct var_cache *param_var; - - /* First, insert a dummy entry into the var_cache */ - var_cache_create (¶m_var); - param_var->name = (const GLubyte *) " "; - param_var->type = vt_param; - - param_var->param_binding_length = 0; - /* Don't fill in binding_begin; We use the default value of -1 - * to tell if its already initialized, elsewhere. - * - * param_var->param_binding_begin = 0; - */ - param_var->param_binding_type = PROGRAM_STATE_VAR; - - var_cache_append (vc_head, param_var); - - /* Then fill it with juicy parameter goodness */ - if (parse_param_elements (ctx, inst, param_var, Program, GL_TRUE)) - return 1; - - *new_var = param_var; - - return 0; -} - - -/** - * This handles the declaration of TEMP variables - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_temp (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found; - struct var_cache *temp_var; - - while (**inst != 0) { - temp_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) temp_var->name); - return 1; - } - - temp_var->type = vt_temp; - - if (((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) && - (Program->Base.NumTemporaries >= - ctx->Const.FragmentProgram.MaxTemps)) - || ((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) - && (Program->Base.NumTemporaries >= - ctx->Const.VertexProgram.MaxTemps))) { - program_error(ctx, Program->Position, - "Too many TEMP variables declared"); - return 1; - } - - temp_var->temp_binding = Program->Base.NumTemporaries; - Program->Base.NumTemporaries++; - } - (*inst)++; - - return 0; -} - -/** - * This handles variables of the OUTPUT variety - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_output (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found; - struct var_cache *output_var; - GLuint err; - - output_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) output_var->name); - return 1; - } - - output_var->type = vt_output; - - err = parse_result_binding(ctx, inst, &output_var->output_binding, Program); - return err; -} - -/** - * This handles variables of the ALIAS kind - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_alias (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found; - struct var_cache *temp_var; - - temp_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) temp_var->name); - return 1; - } - - temp_var->type = vt_alias; - temp_var->alias_binding = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - - if (!found) - { - program_error2(ctx, Program->Position, - "Undefined alias value", - (char *) temp_var->alias_binding->name); - return 1; - } - - return 0; -} - -/** - * This handles variables of the ADDRESS kind - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_address (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLuint found; - struct var_cache *temp_var; - - while (**inst != 0) { - temp_var = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - if (found) { - program_error2(ctx, Program->Position, - "Duplicate variable declaration", - (char *) temp_var->name); - return 1; - } - - temp_var->type = vt_address; - - if (Program->Base.NumAddressRegs >= - ctx->Const.VertexProgram.MaxAddressRegs) { - const char *msg = "Too many ADDRESS variables declared"; - program_error(ctx, Program->Position, msg); - return 1; - } - - temp_var->address_binding = Program->Base.NumAddressRegs; - Program->Base.NumAddressRegs++; - } - (*inst)++; - - return 0; -} - -/** - * Parse a program declaration - * - * \return 0 on sucess, 1 on error - */ -static GLint -parse_declaration (GLcontext * ctx, const GLubyte ** inst, struct var_cache **vc_head, - struct arb_program *Program) -{ - GLint err = 0; - - switch (*(*inst)++) { - case ADDRESS: - err = parse_address (ctx, inst, vc_head, Program); - break; - - case ALIAS: - err = parse_alias (ctx, inst, vc_head, Program); - break; - - case ATTRIB: - err = parse_attrib (ctx, inst, vc_head, Program); - break; - - case OUTPUT: - err = parse_output (ctx, inst, vc_head, Program); - break; - - case PARAM: - err = parse_param (ctx, inst, vc_head, Program); - break; - - case TEMP: - err = parse_temp (ctx, inst, vc_head, Program); - break; - } - - return err; -} - -/** - * Handle the parsing out of a masked destination register, either for a - * vertex or fragment program. - * - * If we are a vertex program, make sure we don't write to - * result.position if we have specified that the program is - * position invariant - * - * \param File - The register file we write to - * \param Index - The register index we write to - * \param WriteMask - The mask controlling which components we write (1->write) - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_masked_dst_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *Program, - gl_register_file *File, GLuint *Index, GLint *WriteMask) -{ - GLuint tmp, result; - struct var_cache *dst; - - /* We either have a result register specified, or a - * variable that may or may not be writable - */ - switch (*(*inst)++) { - case REGISTER_RESULT: - if (parse_result_binding(ctx, inst, Index, Program)) - return 1; - *File = PROGRAM_OUTPUT; - break; - - case REGISTER_ESTABLISHED_NAME: - dst = parse_string (inst, vc_head, Program, &result); - Program->Position = parse_position (inst); - - /* If the name has never been added to our symbol table, we're hosed */ - if (!result) { - program_error(ctx, Program->Position, "0: Undefined variable"); - return 1; - } - - switch (dst->type) { - case vt_output: - *File = PROGRAM_OUTPUT; - *Index = dst->output_binding; - break; - - case vt_temp: - *File = PROGRAM_TEMPORARY; - *Index = dst->temp_binding; - break; - - /* If the var type is not vt_output or vt_temp, no go */ - default: - program_error(ctx, Program->Position, - "Destination register is read only"); - return 1; - } - break; - - default: - program_error(ctx, Program->Position, - "Unexpected opcode in parse_masked_dst_reg()"); - return 1; - } - - - /* Position invariance test */ - /* This test is done now in syntax portion - when position invariance OPTION - is specified, "result.position" rule is disabled so there is no way - to write the position - */ - /*if ((Program->HintPositionInvariant) && (*File == PROGRAM_OUTPUT) && - (*Index == 0)) { - program_error(ctx, Program->Position, - "Vertex program specified position invariance and wrote vertex position"); - }*/ - - /* And then the mask. - * w,a -> bit 0 - * z,b -> bit 1 - * y,g -> bit 2 - * x,r -> bit 3 - * - * ==> Need to reverse the order of bits for this! - */ - tmp = (GLint) *(*inst)++; - *WriteMask = (((tmp>>3) & 0x1) | - ((tmp>>1) & 0x2) | - ((tmp<<1) & 0x4) | - ((tmp<<3) & 0x8)); - - return 0; -} - - -/** - * Handle the parsing of a address register - * - * \param Index - The register index we write to - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_address_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, GLint * Index) -{ - struct var_cache *dst; - GLuint result; - - *Index = 0; /* XXX */ - - dst = parse_string (inst, vc_head, Program, &result); - Program->Position = parse_position (inst); - - /* If the name has never been added to our symbol table, we're hosed */ - if (!result) { - program_error(ctx, Program->Position, "Undefined variable"); - return 1; - } - - if (dst->type != vt_address) { - program_error(ctx, Program->Position, "Variable is not of type ADDRESS"); - return 1; - } - - return 0; -} - -#if 0 /* unused */ -/** - * Handle the parsing out of a masked address register - * - * \param Index - The register index we write to - * \param WriteMask - The mask controlling which components we write (1->write) - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_masked_address_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, GLint * Index, - GLboolean * WriteMask) -{ - if (parse_address_reg (ctx, inst, vc_head, Program, Index)) - return 1; - - /* This should be 0x8 */ - (*inst)++; - - /* Writemask of .x is implied */ - WriteMask[0] = 1; - WriteMask[1] = WriteMask[2] = WriteMask[3] = 0; - - return 0; -} -#endif - -/** - * Parse out a swizzle mask. - * - * Basically convert COMPONENT_X/Y/Z/W to SWIZZLE_X/Y/Z/W - * - * The len parameter allows us to grab 4 components for a vector - * swizzle, or just 1 component for a scalar src register selection - */ -static void -parse_swizzle_mask(const GLubyte ** inst, GLubyte *swizzle, GLint len) -{ - GLint i; - - for (i = 0; i < 4; i++) - swizzle[i] = i; - - for (i = 0; i < len; i++) { - switch (*(*inst)++) { - case COMPONENT_X: - swizzle[i] = SWIZZLE_X; - break; - case COMPONENT_Y: - swizzle[i] = SWIZZLE_Y; - break; - case COMPONENT_Z: - swizzle[i] = SWIZZLE_Z; - break; - case COMPONENT_W: - swizzle[i] = SWIZZLE_W; - break; - default: - _mesa_problem(NULL, "bad component in parse_swizzle_mask()"); - return; - } - } - - if (len == 1) - swizzle[1] = swizzle[2] = swizzle[3] = swizzle[0]; -} - - -/** - * Parse an extended swizzle mask which is a sequence of - * four x/y/z/w/0/1 tokens. - * \return swizzle four swizzle values - * \return negateMask four element bitfield - */ -static void -parse_extended_swizzle_mask(const GLubyte **inst, GLubyte swizzle[4], - GLubyte *negateMask) -{ - GLint i; - - *negateMask = 0x0; - for (i = 0; i < 4; i++) { - GLubyte swz; - if (parse_sign(inst) == -1) - *negateMask |= (1 << i); - - swz = *(*inst)++; - - switch (swz) { - case COMPONENT_0: - swizzle[i] = SWIZZLE_ZERO; - break; - case COMPONENT_1: - swizzle[i] = SWIZZLE_ONE; - break; - case COMPONENT_X: - swizzle[i] = SWIZZLE_X; - break; - case COMPONENT_Y: - swizzle[i] = SWIZZLE_Y; - break; - case COMPONENT_Z: - swizzle[i] = SWIZZLE_Z; - break; - case COMPONENT_W: - swizzle[i] = SWIZZLE_W; - break; - default: - _mesa_problem(NULL, "bad case in parse_extended_swizzle_mask()"); - return; - } - } -} - - -static GLuint -parse_src_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, - gl_register_file * File, GLint * Index, GLuint *swizzle, - GLboolean *IsRelOffset ) -{ - struct var_cache *src; - GLuint binding, is_generic, found; - GLint offset; - - *IsRelOffset = 0; - - *swizzle = SWIZZLE_XYZW; /* default */ - - /* And the binding for the src */ - switch (*(*inst)++) { - case REGISTER_ATTRIB: - if (parse_attrib_binding - (ctx, inst, Program, &binding, &is_generic)) - return 1; - *File = PROGRAM_INPUT; - *Index = binding; - - /* We need to insert a dummy variable into the var_cache so we can - * catch generic vertex attrib aliasing errors - */ - var_cache_create(&src); - src->type = vt_attrib; - src->name = (const GLubyte *) "Dummy Attrib Variable"; - src->attrib_binding = binding; - src->attrib_is_generic = is_generic; - var_cache_append(vc_head, src); - if (generic_attrib_check(*vc_head)) { - program_error(ctx, Program->Position, - "Cannot use both a generic vertex attribute " - "and a specific attribute of the same type"); - return 1; - } - break; - - case REGISTER_PARAM: - switch (**inst) { - case PARAM_ARRAY_ELEMENT: - (*inst)++; - src = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - - if (!found) { - program_error2(ctx, Program->Position, - "Undefined variable", - (char *) src->name); - return 1; - } - - *File = (gl_register_file) src->param_binding_type; - - switch (*(*inst)++) { - case ARRAY_INDEX_ABSOLUTE: - offset = parse_integer (inst, Program); - - if ((offset < 0) - || (offset >= (int)src->param_binding_length)) { - program_error(ctx, Program->Position, - "Index out of range"); - /* offset, src->name */ - return 1; - } - - *Index = src->param_binding_begin + offset; - *swizzle = src->swizzle; - break; - - case ARRAY_INDEX_RELATIVE: - { - GLint addr_reg_idx, rel_off; - - /* First, grab the address regiseter */ - if (parse_address_reg (ctx, inst, vc_head, Program, &addr_reg_idx)) - return 1; - - /* And the .x */ - ((*inst)++); - ((*inst)++); - ((*inst)++); - ((*inst)++); - - /* Then the relative offset */ - if (parse_relative_offset(ctx, inst, Program, &rel_off)) return 1; - - /* And store it properly */ - *Index = src->param_binding_begin + rel_off; - *IsRelOffset = 1; - *swizzle = src->swizzle; - } - break; - } - break; - - default: - if (parse_param_use (ctx, inst, vc_head, Program, &src)) - return 1; - - *File = (gl_register_file) src->param_binding_type; - *Index = src->param_binding_begin; - *swizzle = src->swizzle; - break; - } - break; - - case REGISTER_ESTABLISHED_NAME: - src = parse_string (inst, vc_head, Program, &found); - Program->Position = parse_position (inst); - - /* If the name has never been added to our symbol table, we're hosed */ - if (!found) { - program_error(ctx, Program->Position, - "3: Undefined variable"); /* src->name */ - return 1; - } - - switch (src->type) { - case vt_attrib: - *File = PROGRAM_INPUT; - *Index = src->attrib_binding; - break; - - /* XXX: We have to handle offsets someplace in here! -- or are those above? */ - case vt_param: - *File = (gl_register_file) src->param_binding_type; - *Index = src->param_binding_begin; - break; - - case vt_temp: - *File = PROGRAM_TEMPORARY; - *Index = src->temp_binding; - break; - - /* If the var type is vt_output no go */ - default: - program_error(ctx, Program->Position, - "destination register is read only"); - /* bad src->name */ - return 1; - } - break; - - default: - program_error(ctx, Program->Position, - "Unknown token in parse_src_reg"); - return 1; - } - - if (*File == PROGRAM_STATE_VAR) { - gl_register_file file; - - /* If we're referencing the Program->Parameters[] array, check if the - * parameter is really a constant/literal. If so, set File to CONSTANT. - */ - assert(*Index < (GLint) Program->Base.Parameters->NumParameters); - file = Program->Base.Parameters->Parameters[*Index].Type; - if (file == PROGRAM_CONSTANT) - *File = PROGRAM_CONSTANT; - } - - /* Add attributes to InputsRead only if they are used the program. - * This avoids the handling of unused ATTRIB declarations in the drivers. */ - if (*File == PROGRAM_INPUT) - Program->Base.InputsRead |= (1 << *Index); - - return 0; -} - - -static GLuint -swizzle_swizzle(GLuint baseSwizzle, const GLubyte swizzle[4]) -{ - GLuint i, swz, s[4]; - for (i = 0; i < 4; i++) { - GLuint c = swizzle[i]; - if (c <= SWIZZLE_W) - s[i] = GET_SWZ(baseSwizzle, c); - else - s[i] = c; - } - swz = MAKE_SWIZZLE4(s[0], s[1], s[2], s[3]); - return swz; -} - -/** - * Parse vertex/fragment program vector source register. - */ -static GLuint -parse_vector_src_reg(GLcontext *ctx, const GLubyte **inst, - struct var_cache **vc_head, - struct arb_program *program, - struct prog_src_register *reg) -{ - gl_register_file file; - GLint index; - GLubyte negateMask; - GLubyte swizzle[4]; - GLboolean isRelOffset; - GLuint baseSwizzle; - - /* Grab the sign */ - negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; - - /* And the src reg */ - if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &baseSwizzle, - &isRelOffset)) - return 1; - - /* finally, the swizzle */ - parse_swizzle_mask(inst, swizzle, 4); - - reg->File = file; - reg->Index = index; - reg->Swizzle = swizzle_swizzle(baseSwizzle, swizzle); - reg->Negate = negateMask; - reg->RelAddr = isRelOffset; - return 0; -} - - -/** - * Parse vertex/fragment program scalar source register. - */ -static GLuint -parse_scalar_src_reg(GLcontext *ctx, const GLubyte **inst, - struct var_cache **vc_head, - struct arb_program *program, - struct prog_src_register *reg) -{ - gl_register_file file; - GLint index; - GLubyte negateMask; - GLubyte swizzle[4]; - GLboolean isRelOffset; - GLuint baseSwizzle; - - /* Grab the sign */ - negateMask = (parse_sign (inst) == -1) ? NEGATE_XYZW : NEGATE_NONE; - - /* And the src reg */ - if (parse_src_reg(ctx, inst, vc_head, program, &file, &index, &baseSwizzle, - &isRelOffset)) - return 1; - - /* finally, the swizzle */ - parse_swizzle_mask(inst, swizzle, 1); - - reg->File = file; - reg->Index = index; - reg->Swizzle = swizzle_swizzle(baseSwizzle, swizzle); - reg->Negate = negateMask; - reg->RelAddr = isRelOffset; - return 0; -} - - -/** - * Parse vertex/fragment program destination register. - * \return 1 if error, 0 if no error. - */ -static GLuint -parse_dst_reg(GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *program, - struct prog_dst_register *reg ) -{ - GLint mask; - GLuint idx; - gl_register_file file; - - if (parse_masked_dst_reg (ctx, inst, vc_head, program, &file, &idx, &mask)) - return 1; - - reg->File = file; - reg->Index = idx; - reg->WriteMask = mask; - return 0; -} - - -/** - * This is a big mother that handles getting opcodes into the instruction - * and handling the src & dst registers for fragment program instructions - * \return 1 if error, 0 if no error - */ -static GLuint -parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *Program, - struct prog_instruction *fp) -{ - GLint a; - GLuint texcoord; - GLubyte instClass, type, code; - GLboolean rel; - GLuint shadow_tex = 0; - - _mesa_init_instructions(fp, 1); - - /* OP_ALU_INST or OP_TEX_INST */ - instClass = *(*inst)++; - - /* OP_ALU_{VECTOR, SCALAR, BINSC, BIN, TRI, SWZ}, - * OP_TEX_{SAMPLE, KIL} - */ - type = *(*inst)++; - - /* The actual opcode name */ - code = *(*inst)++; - - /* Increment the correct count */ - switch (instClass) { - case OP_ALU_INST: - Program->NumAluInstructions++; - break; - case OP_TEX_INST: - Program->NumTexInstructions++; - break; - } - - switch (type) { - case OP_ALU_VECTOR: - switch (code) { - case OP_ABS_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_ABS: - fp->Opcode = OPCODE_ABS; - break; - - case OP_FLR_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_FLR: - fp->Opcode = OPCODE_FLR; - break; - - case OP_FRC_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_FRC: - fp->Opcode = OPCODE_FRC; - break; - - case OP_LIT_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_LIT: - fp->Opcode = OPCODE_LIT; - break; - - case OP_MOV_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_MOV: - fp->Opcode = OPCODE_MOV; - break; - } - - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) - return 1; - break; - - case OP_ALU_SCALAR: - switch (code) { - case OP_COS_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_COS: - fp->Opcode = OPCODE_COS; - break; - - case OP_EX2_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_EX2: - fp->Opcode = OPCODE_EX2; - break; - - case OP_LG2_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_LG2: - fp->Opcode = OPCODE_LG2; - break; - - case OP_RCP_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_RCP: - fp->Opcode = OPCODE_RCP; - break; - - case OP_RSQ_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_RSQ: - fp->Opcode = OPCODE_RSQ; - break; - - case OP_SIN_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SIN: - fp->Opcode = OPCODE_SIN; - break; - - case OP_SCS_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SCS: - - fp->Opcode = OPCODE_SCS; - break; - } - - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) - return 1; - break; - - case OP_ALU_BINSC: - switch (code) { - case OP_POW_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_POW: - fp->Opcode = OPCODE_POW; - break; - } - - if (parse_dst_reg(ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - for (a = 0; a < 2; a++) { - if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) - return 1; - } - break; - - - case OP_ALU_BIN: - switch (code) { - case OP_ADD_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_ADD: - fp->Opcode = OPCODE_ADD; - break; - - case OP_DP3_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_DP3: - fp->Opcode = OPCODE_DP3; - break; - - case OP_DP4_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_DP4: - fp->Opcode = OPCODE_DP4; - break; - - case OP_DPH_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_DPH: - fp->Opcode = OPCODE_DPH; - break; - - case OP_DST_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_DST: - fp->Opcode = OPCODE_DST; - break; - - case OP_MAX_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_MAX: - fp->Opcode = OPCODE_MAX; - break; - - case OP_MIN_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_MIN: - fp->Opcode = OPCODE_MIN; - break; - - case OP_MUL_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_MUL: - fp->Opcode = OPCODE_MUL; - break; - - case OP_SGE_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SGE: - fp->Opcode = OPCODE_SGE; - break; - - case OP_SLT_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SLT: - fp->Opcode = OPCODE_SLT; - break; - - case OP_SUB_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SUB: - fp->Opcode = OPCODE_SUB; - break; - - case OP_XPD_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_XPD: - fp->Opcode = OPCODE_XPD; - break; - } - - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - for (a = 0; a < 2; a++) { - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) - return 1; - } - break; - - case OP_ALU_TRI: - switch (code) { - case OP_CMP_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_CMP: - fp->Opcode = OPCODE_CMP; - break; - - case OP_LRP_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_LRP: - fp->Opcode = OPCODE_LRP; - break; - - case OP_MAD_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_MAD: - fp->Opcode = OPCODE_MAD; - break; - } - - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - for (a = 0; a < 3; a++) { - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[a])) - return 1; - } - break; - - case OP_ALU_SWZ: - switch (code) { - case OP_SWZ_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_SWZ: - fp->Opcode = OPCODE_SWZ; - break; - } - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - { - GLubyte swizzle[4]; - GLubyte negateMask; - gl_register_file file; - GLint index; - GLuint baseSwizzle; - - if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, - &baseSwizzle, &rel)) - return 1; - parse_extended_swizzle_mask(inst, swizzle, &negateMask); - fp->SrcReg[0].File = file; - fp->SrcReg[0].Index = index; - fp->SrcReg[0].Negate = negateMask; - fp->SrcReg[0].Swizzle = MAKE_SWIZZLE4(swizzle[0], - swizzle[1], - swizzle[2], - swizzle[3]); - } - break; - - case OP_TEX_SAMPLE: - switch (code) { - case OP_TEX_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_TEX: - fp->Opcode = OPCODE_TEX; - break; - - case OP_TXP_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_TXP: - fp->Opcode = OPCODE_TXP; - break; - - case OP_TXB_SAT: - fp->SaturateMode = SATURATE_ZERO_ONE; - case OP_TXB: - fp->Opcode = OPCODE_TXB; - break; - } - - if (parse_dst_reg (ctx, inst, vc_head, Program, &fp->DstReg)) - return 1; - - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) - return 1; - - /* texImageUnit */ - if (parse_teximage_num (ctx, inst, Program, &texcoord)) - return 1; - fp->TexSrcUnit = texcoord; - - /* texTarget */ - switch (*(*inst)++) { - case TEXTARGET_SHADOW1D: - shadow_tex = 1 << texcoord; - /* FALLTHROUGH */ - case TEXTARGET_1D: - fp->TexSrcTarget = TEXTURE_1D_INDEX; - break; - case TEXTARGET_SHADOW2D: - shadow_tex = 1 << texcoord; - /* FALLTHROUGH */ - case TEXTARGET_2D: - fp->TexSrcTarget = TEXTURE_2D_INDEX; - break; - case TEXTARGET_3D: - fp->TexSrcTarget = TEXTURE_3D_INDEX; - break; - case TEXTARGET_SHADOWRECT: - shadow_tex = 1 << texcoord; - /* FALLTHROUGH */ - case TEXTARGET_RECT: - fp->TexSrcTarget = TEXTURE_RECT_INDEX; - break; - case TEXTARGET_CUBE: - fp->TexSrcTarget = TEXTURE_CUBE_INDEX; - break; - case TEXTARGET_SHADOW1D_ARRAY: - shadow_tex = 1 << texcoord; - /* FALLTHROUGH */ - case TEXTARGET_1D_ARRAY: - fp->TexSrcTarget = TEXTURE_1D_ARRAY_INDEX; - break; - case TEXTARGET_SHADOW2D_ARRAY: - shadow_tex = 1 << texcoord; - /* FALLTHROUGH */ - case TEXTARGET_2D_ARRAY: - fp->TexSrcTarget = TEXTURE_2D_ARRAY_INDEX; - break; - } - - if (shadow_tex) - fp->TexShadow = 1; - - /* Don't test the first time a particular sampler is seen. Each time - * after that, make sure the shadow state is the same. - */ - if ((_mesa_bitcount(Program->TexturesUsed[texcoord]) > 0) - && ((Program->ShadowSamplers & (1 << texcoord)) != shadow_tex)) { - program_error(ctx, Program->Position, - "texture image unit used for shadow sampling and non-shadow sampling"); - return 1; - } - - Program->TexturesUsed[texcoord] |= (1 << fp->TexSrcTarget); - /* Check that both "2D" and "CUBE" (for example) aren't both used */ - if (_mesa_bitcount(Program->TexturesUsed[texcoord]) > 1) { - program_error(ctx, Program->Position, - "multiple targets used on one texture image unit"); - return 1; - } - - - Program->ShadowSamplers |= shadow_tex; - break; - - case OP_TEX_KIL: - Program->UsesKill = 1; - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &fp->SrcReg[0])) - return 1; - fp->Opcode = OPCODE_KIL; - break; - default: - _mesa_problem(ctx, "bad type 0x%x in parse_fp_instruction()", type); - return 1; - } - - return 0; -} - - -/** - * Handle the parsing out of a masked address register - * - * \param Index - The register index we write to - * \param WriteMask - The mask controlling which components we write (1->write) - * - * \return 0 on sucess, 1 on error - */ -static GLuint -parse_vp_address_reg (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, - struct arb_program *Program, - struct prog_dst_register *reg) -{ - GLint idx; - - if (parse_address_reg (ctx, inst, vc_head, Program, &idx)) - return 1; - - /* This should be 0x8 */ - (*inst)++; - - reg->File = PROGRAM_ADDRESS; - reg->Index = idx; - - /* Writemask of .x is implied */ - reg->WriteMask = 0x1; - return 0; -} - - -/** - * This is a big mother that handles getting opcodes into the instruction - * and handling the src & dst registers for vertex program instructions - */ -static GLuint -parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst, - struct var_cache **vc_head, struct arb_program *Program, - struct prog_instruction *vp) -{ - GLint a; - GLubyte type, code; - - /* OP_ALU_{ARL, VECTOR, SCALAR, BINSC, BIN, TRI, SWZ} */ - type = *(*inst)++; - - /* The actual opcode name */ - code = *(*inst)++; - - _mesa_init_instructions(vp, 1); - - switch (type) { - /* XXX: */ - case OP_ALU_ARL: - vp->Opcode = OPCODE_ARL; - - /* Remember to set SrcReg.RelAddr; */ - - /* Get the masked address register [dst] */ - if (parse_vp_address_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - vp->DstReg.File = PROGRAM_ADDRESS; - - /* Get a scalar src register */ - if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) - return 1; - - break; - - case OP_ALU_VECTOR: - switch (code) { - case OP_ABS: - vp->Opcode = OPCODE_ABS; - break; - case OP_FLR: - vp->Opcode = OPCODE_FLR; - break; - case OP_FRC: - vp->Opcode = OPCODE_FRC; - break; - case OP_LIT: - vp->Opcode = OPCODE_LIT; - break; - case OP_MOV: - vp->Opcode = OPCODE_MOV; - break; - } - - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) - return 1; - break; - - case OP_ALU_SCALAR: - switch (code) { - case OP_EX2: - vp->Opcode = OPCODE_EX2; - break; - case OP_EXP: - vp->Opcode = OPCODE_EXP; - break; - case OP_LG2: - vp->Opcode = OPCODE_LG2; - break; - case OP_LOG: - vp->Opcode = OPCODE_LOG; - break; - case OP_RCP: - vp->Opcode = OPCODE_RCP; - break; - case OP_RSQ: - vp->Opcode = OPCODE_RSQ; - break; - } - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[0])) - return 1; - break; - - case OP_ALU_BINSC: - switch (code) { - case OP_POW: - vp->Opcode = OPCODE_POW; - break; - } - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - for (a = 0; a < 2; a++) { - if (parse_scalar_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) - return 1; - } - break; - - case OP_ALU_BIN: - switch (code) { - case OP_ADD: - vp->Opcode = OPCODE_ADD; - break; - case OP_DP3: - vp->Opcode = OPCODE_DP3; - break; - case OP_DP4: - vp->Opcode = OPCODE_DP4; - break; - case OP_DPH: - vp->Opcode = OPCODE_DPH; - break; - case OP_DST: - vp->Opcode = OPCODE_DST; - break; - case OP_MAX: - vp->Opcode = OPCODE_MAX; - break; - case OP_MIN: - vp->Opcode = OPCODE_MIN; - break; - case OP_MUL: - vp->Opcode = OPCODE_MUL; - break; - case OP_SGE: - vp->Opcode = OPCODE_SGE; - break; - case OP_SLT: - vp->Opcode = OPCODE_SLT; - break; - case OP_SUB: - vp->Opcode = OPCODE_SUB; - break; - case OP_XPD: - vp->Opcode = OPCODE_XPD; - break; - } - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - for (a = 0; a < 2; a++) { - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) - return 1; - } - break; - - case OP_ALU_TRI: - switch (code) { - case OP_MAD: - vp->Opcode = OPCODE_MAD; - break; - } - - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - for (a = 0; a < 3; a++) { - if (parse_vector_src_reg(ctx, inst, vc_head, Program, &vp->SrcReg[a])) - return 1; - } - break; - - case OP_ALU_SWZ: - switch (code) { - case OP_SWZ: - vp->Opcode = OPCODE_SWZ; - break; - } - { - GLubyte swizzle[4]; - GLubyte negateMask; - GLboolean relAddr; - gl_register_file file; - GLint index; - GLuint baseSwizzle; - - if (parse_dst_reg(ctx, inst, vc_head, Program, &vp->DstReg)) - return 1; - - if (parse_src_reg(ctx, inst, vc_head, Program, &file, &index, - &baseSwizzle, &relAddr)) - return 1; - parse_extended_swizzle_mask (inst, swizzle, &negateMask); - vp->SrcReg[0].File = file; - vp->SrcReg[0].Index = index; - vp->SrcReg[0].Negate = negateMask; - vp->SrcReg[0].Swizzle = MAKE_SWIZZLE4(swizzle[0], - swizzle[1], - swizzle[2], - swizzle[3]); - vp->SrcReg[0].RelAddr = relAddr; - } - break; - } - return 0; -} - -#if DEBUG_PARSING - -static GLvoid -debug_variables (GLcontext * ctx, struct var_cache *vc_head, - struct arb_program *Program) -{ - struct var_cache *vc; - GLint a, b; - - fprintf (stderr, "debug_variables, vc_head: %p\n", (void*) vc_head); - - /* First of all, print out the contents of the var_cache */ - vc = vc_head; - while (vc) { - fprintf (stderr, "[%p]\n", (void*) vc); - switch (vc->type) { - case vt_none: - fprintf (stderr, "UNDEFINED %s\n", vc->name); - break; - case vt_attrib: - fprintf (stderr, "ATTRIB %s\n", vc->name); - fprintf (stderr, " binding: 0x%x\n", vc->attrib_binding); - break; - case vt_param: - fprintf (stderr, "PARAM %s begin: %d len: %d\n", vc->name, - vc->param_binding_begin, vc->param_binding_length); - b = vc->param_binding_begin; - for (a = 0; a < vc->param_binding_length; a++) { - fprintf (stderr, "%s\n", - Program->Base.Parameters->Parameters[a + b].Name); - if (Program->Base.Parameters->Parameters[a + b].Type == PROGRAM_STATE_VAR) { - char *s; - s = _mesa_program_state_string(Program->Base.Parameters->Parameters - [a + b].StateIndexes); - fprintf(stderr, "%s\n", s); - _mesa_free(s); - } - else - fprintf (stderr, "%f %f %f %f\n", - Program->Base.Parameters->ParameterValues[a + b][0], - Program->Base.Parameters->ParameterValues[a + b][1], - Program->Base.Parameters->ParameterValues[a + b][2], - Program->Base.Parameters->ParameterValues[a + b][3]); - } - break; - case vt_temp: - fprintf (stderr, "TEMP %s\n", vc->name); - fprintf (stderr, " binding: 0x%x\n", vc->temp_binding); - break; - case vt_output: - fprintf (stderr, "OUTPUT %s\n", vc->name); - fprintf (stderr, " binding: 0x%x\n", vc->output_binding); - break; - case vt_alias: - fprintf (stderr, "ALIAS %s\n", vc->name); - fprintf (stderr, " binding: 0x%p (%s)\n", - (void*) vc->alias_binding, vc->alias_binding->name); - break; - default: - /* nothing */ - ; - } - vc = vc->next; - } -} - -#endif /* DEBUG_PARSING */ - - -/** - * The main loop for parsing a fragment or vertex program - * - * \return 1 on error, 0 on success - */ -static GLint -parse_instructions(GLcontext * ctx, const GLubyte * inst, - struct var_cache **vc_head, struct arb_program *Program) -{ - const GLuint maxInst = (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) - ? ctx->Const.FragmentProgram.MaxInstructions - : ctx->Const.VertexProgram.MaxInstructions; - GLint err = 0; - - ASSERT(MAX_PROGRAM_INSTRUCTIONS >= maxInst); - - Program->MajorVersion = (GLuint) * inst++; - Program->MinorVersion = (GLuint) * inst++; - - while (*inst != END) { - switch (*inst++) { - - case OPTION: - switch (*inst++) { - case ARB_PRECISION_HINT_FASTEST: - Program->PrecisionOption = GL_FASTEST; - break; - - case ARB_PRECISION_HINT_NICEST: - Program->PrecisionOption = GL_NICEST; - break; - - case ARB_FOG_EXP: - Program->FogOption = GL_EXP; - break; - - case ARB_FOG_EXP2: - Program->FogOption = GL_EXP2; - break; - - case ARB_FOG_LINEAR: - Program->FogOption = GL_LINEAR; - break; - - case ARB_POSITION_INVARIANT: - if (Program->Base.Target == GL_VERTEX_PROGRAM_ARB) - Program->HintPositionInvariant = GL_TRUE; - break; - - case ARB_FRAGMENT_PROGRAM_SHADOW: - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - /* TODO ARB_fragment_program_shadow code */ - } - break; - - case ARB_DRAW_BUFFERS: - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - /* do nothing for now */ - } - break; - - case MESA_TEXTURE_ARRAY: - /* do nothing for now */ - break; - } - break; - - case INSTRUCTION: - /* check length */ - if (Program->Base.NumInstructions + 1 >= maxInst) { - program_error(ctx, Program->Position, - "Max instruction count exceeded"); - return 1; - } - Program->Position = parse_position (&inst); - /* parse the current instruction */ - if (Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - err = parse_fp_instruction (ctx, &inst, vc_head, Program, - &Program->Base.Instructions[Program->Base.NumInstructions]); - } - else { - err = parse_vp_instruction (ctx, &inst, vc_head, Program, - &Program->Base.Instructions[Program->Base.NumInstructions]); - } - - /* increment instuction count */ - Program->Base.NumInstructions++; - break; - - case DECLARATION: - err = parse_declaration (ctx, &inst, vc_head, Program); - break; - - default: - break; - } - - if (err) - break; - } - - /* Finally, tag on an OPCODE_END instruction */ - { - const GLuint numInst = Program->Base.NumInstructions; - _mesa_init_instructions(Program->Base.Instructions + numInst, 1); - Program->Base.Instructions[numInst].Opcode = OPCODE_END; - } - Program->Base.NumInstructions++; - - /* - * Initialize native counts to logical counts. The device driver may - * change them if program is translated into a hardware program. - */ - Program->Base.NumNativeInstructions = Program->Base.NumInstructions; - Program->Base.NumNativeTemporaries = Program->Base.NumTemporaries; - Program->Base.NumNativeParameters = Program->Base.NumParameters; - Program->Base.NumNativeAttributes = Program->Base.NumAttributes; - Program->Base.NumNativeAddressRegs = Program->Base.NumAddressRegs; - - return err; -} - - -/* XXX temporary */ -LONGSTRING static char core_grammar_text[] = -#include "shader/grammar/grammar_syn.h" -; - - -/** - * Set a grammar parameter. - * \param name the grammar parameter - * \param value the new parameter value - * \return 0 if OK, 1 if error - */ -static int -set_reg8 (GLcontext *ctx, grammar id, const char *name, GLubyte value) -{ - char error_msg[300]; - GLint error_pos; - - if (grammar_set_reg8 (id, (const byte *) name, value)) - return 0; - - grammar_get_last_error ((byte *) error_msg, 300, &error_pos); - _mesa_set_program_error (ctx, error_pos, error_msg); - _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar Register Error"); - return 1; -} - - -/** - * Enable support for the given language option in the parser. - * \return 1 if OK, 0 if error - */ -static int -enable_ext(GLcontext *ctx, grammar id, const char *name) -{ - return !set_reg8(ctx, id, name, 1); -} - - -/** - * Enable parser extensions based on which OpenGL extensions are supported - * by this rendering context. - * - * \return GL_TRUE if OK, GL_FALSE if error. - */ -static GLboolean -enable_parser_extensions(GLcontext *ctx, grammar id) -{ -#if 0 - /* These are not supported at this time */ - if ((ctx->Extensions.ARB_vertex_blend || - ctx->Extensions.EXT_vertex_weighting) - && !enable_ext(ctx, id, "vertex_blend")) - return GL_FALSE; - if (ctx->Extensions.ARB_matrix_palette - && !enable_ext(ctx, id, "matrix_palette")) - return GL_FALSE; -#endif - if (ctx->Extensions.ARB_fragment_program_shadow - && !enable_ext(ctx, id, "fragment_program_shadow")) - return GL_FALSE; - if (ctx->Extensions.EXT_point_parameters - && !enable_ext(ctx, id, "point_parameters")) - return GL_FALSE; - if (ctx->Extensions.EXT_secondary_color - && !enable_ext(ctx, id, "secondary_color")) - return GL_FALSE; - if (ctx->Extensions.EXT_fog_coord - && !enable_ext(ctx, id, "fog_coord")) - return GL_FALSE; - if (ctx->Extensions.NV_texture_rectangle - && !enable_ext(ctx, id, "texture_rectangle")) - return GL_FALSE; - if (!enable_ext(ctx, id, "draw_buffers")) - return GL_FALSE; - if (ctx->Extensions.MESA_texture_array - && !enable_ext(ctx, id, "texture_array")) - return GL_FALSE; -#if 1 - /* hack for Warcraft (see bug 8060) */ - enable_ext(ctx, id, "vertex_blend"); -#endif - - return GL_TRUE; -} - - -/** - * This kicks everything off. - * - * \param ctx - The GL Context - * \param str - The program string - * \param len - The program string length - * \param program - The arb_program struct to return all the parsed info in - * \return GL_TRUE on sucess, GL_FALSE on error - */ -static GLboolean -_mesa_parse_arb_program(GLcontext *ctx, GLenum target, - const GLubyte *str, GLsizei len, - struct arb_program *program) -{ - GLint a, err, error_pos; - char error_msg[300]; - GLuint parsed_len; - struct var_cache *vc_head; - grammar arbprogram_syn_id; - GLubyte *parsed, *inst; - GLubyte *strz = NULL; - static int arbprogram_syn_is_ok = 0; /* XXX temporary */ - - /* set the program target before parsing */ - program->Base.Target = target; - - /* Reset error state */ - _mesa_set_program_error(ctx, -1, NULL); - - /* check if arb_grammar_text (arbprogram.syn) is syntactically correct */ - if (!arbprogram_syn_is_ok) { - /* One-time initialization of parsing system */ - grammar grammar_syn_id; - GLuint parsed_len; - - grammar_syn_id = grammar_load_from_text ((byte *) core_grammar_text); - if (grammar_syn_id == 0) { - grammar_get_last_error ((byte *) error_msg, 300, &error_pos); - /* XXX this is not a GL error - it's an implementation bug! - FIX */ - _mesa_set_program_error (ctx, error_pos, error_msg); - _mesa_error (ctx, GL_INVALID_OPERATION, - "glProgramStringARB(Error loading grammar rule set)"); - return GL_FALSE; - } - - err = !grammar_check(grammar_syn_id, (byte *) arb_grammar_text, - &parsed, &parsed_len); - - /* 'parsed' is unused here */ - _mesa_free (parsed); - parsed = NULL; - - /* NOTE: we can't destroy grammar_syn_id right here because - * grammar_destroy() can reset the last error - */ - if (err) { - /* XXX this is not a GL error - it's an implementation bug! - FIX */ - grammar_get_last_error ((byte *) error_msg, 300, &error_pos); - _mesa_set_program_error (ctx, error_pos, error_msg); - _mesa_error (ctx, GL_INVALID_OPERATION, - "glProgramString(Error loading grammar rule set"); - grammar_destroy (grammar_syn_id); - return GL_FALSE; - } - - grammar_destroy (grammar_syn_id); - - arbprogram_syn_is_ok = 1; - } - - /* create the grammar object */ - arbprogram_syn_id = grammar_load_from_text ((byte *) arb_grammar_text); - if (arbprogram_syn_id == 0) { - /* XXX this is not a GL error - it's an implementation bug! - FIX */ - grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); - _mesa_set_program_error (ctx, error_pos, error_msg); - _mesa_error (ctx, GL_INVALID_OPERATION, - "glProgramString(Error loading grammer rule set)"); - return GL_FALSE; - } - - /* Set program_target register value */ - if (set_reg8 (ctx, arbprogram_syn_id, "program_target", - program->Base.Target == GL_FRAGMENT_PROGRAM_ARB ? 0x10 : 0x20)) { - grammar_destroy (arbprogram_syn_id); - return GL_FALSE; - } - - if (!enable_parser_extensions(ctx, arbprogram_syn_id)) { - grammar_destroy(arbprogram_syn_id); - return GL_FALSE; - } - - /* check for NULL character occurences */ - { - GLint i; - for (i = 0; i < len; i++) { - if (str[i] == '\0') { - program_error(ctx, i, "illegal character"); - grammar_destroy (arbprogram_syn_id); - return GL_FALSE; - } - } - } - - /* copy the program string to a null-terminated string */ - strz = (GLubyte *) _mesa_malloc (len + 1); - if (!strz) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); - grammar_destroy (arbprogram_syn_id); - return GL_FALSE; - } - _mesa_memcpy (strz, str, len); - strz[len] = '\0'; - - /* do a fast check on program string - initial production buffer is 4K */ - err = !grammar_fast_check(arbprogram_syn_id, strz, - &parsed, &parsed_len, 0x1000); - - /* Syntax parse error */ - if (err) { - grammar_get_last_error((GLubyte *) error_msg, 300, &error_pos); - program_error(ctx, error_pos, error_msg); - -#if DEBUG_PARSING - /* useful for debugging */ - do { - int line, col; - char *s; - fprintf(stderr, "program: %s\n", (char *) strz); - fprintf(stderr, "Error Pos: %d\n", ctx->Program.ErrorPos); - s = (char *) _mesa_find_line_column(strz, strz+ctx->Program.ErrorPos, - &line, &col); - fprintf(stderr, "line %d col %d: %s\n", line, col, s); - } while (0); -#endif - - _mesa_free(strz); - _mesa_free(parsed); - - grammar_destroy (arbprogram_syn_id); - return GL_FALSE; - } - - grammar_destroy (arbprogram_syn_id); - - /* - * Program string is syntactically correct at this point - * Parse the tokenized version of the program now, generating - * vertex/fragment program instructions. - */ - - /* Initialize the arb_program struct */ - program->Base.String = strz; - program->Base.Instructions = _mesa_alloc_instructions(MAX_PROGRAM_INSTRUCTIONS); - program->Base.NumInstructions = - program->Base.NumTemporaries = - program->Base.NumParameters = - program->Base.NumAttributes = program->Base.NumAddressRegs = 0; - program->Base.Parameters = _mesa_new_parameter_list (); - program->Base.InputsRead = 0x0; - program->Base.OutputsWritten = 0x0; - program->Position = 0; - program->MajorVersion = program->MinorVersion = 0; - program->PrecisionOption = GL_DONT_CARE; - program->FogOption = GL_NONE; - program->HintPositionInvariant = GL_FALSE; - for (a = 0; a < MAX_TEXTURE_IMAGE_UNITS; a++) - program->TexturesUsed[a] = 0x0; - program->ShadowSamplers = 0x0; - program->NumAluInstructions = - program->NumTexInstructions = - program->NumTexIndirections = 0; - program->UsesKill = 0; - - vc_head = NULL; - err = GL_FALSE; - - /* Start examining the tokens in the array */ - inst = parsed; - - /* Check the grammer rev */ - if (*inst++ != REVISION) { - program_error (ctx, 0, "Grammar version mismatch"); - err = GL_TRUE; - } - else { - /* ignore program target */ - inst++; - err = parse_instructions(ctx, inst, &vc_head, program); - } - - /*debug_variables(ctx, vc_head, program); */ - - /* We're done with the parsed binary array */ - var_cache_destroy (&vc_head); - - _mesa_free (parsed); - - /* Reallocate the instruction array from size [MAX_PROGRAM_INSTRUCTIONS] - * to size [ap.Base.NumInstructions]. - */ - program->Base.Instructions - = _mesa_realloc_instructions(program->Base.Instructions, - MAX_PROGRAM_INSTRUCTIONS, - program->Base.NumInstructions); - - return !err; -} -#endif - void _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, diff --git a/src/mesa/shader/arbprogram.syn b/src/mesa/shader/arbprogram.syn deleted file mode 100644 index b12c6a0eda5..00000000000 --- a/src/mesa/shader/arbprogram.syn +++ /dev/null @@ -1,2824 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.2 - * - * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - /** - * \file arbprogram.syn - * ARB_fragment/vertex_program syntax - * \author Michal Krol - */ - -.syntax program; - -/* - This value must be incremented every time emit code values or structure of the production - array changes. This value is placed at the beginning of the production array. The loader - compares the value with its REVISION value. If they do not match, the loader is not up - to date. -*/ -.emtcode REVISION 0x0a - -/* program type */ -.emtcode FRAGMENT_PROGRAM 0x01 -.emtcode VERTEX_PROGRAM 0x02 - -/* program section */ -.emtcode OPTION 0x01 -.emtcode INSTRUCTION 0x02 -.emtcode DECLARATION 0x03 -.emtcode END 0x04 - -/* GL_ARB_fragment_program option */ -.emtcode ARB_PRECISION_HINT_FASTEST 0x00 -.emtcode ARB_PRECISION_HINT_NICEST 0x01 -.emtcode ARB_FOG_EXP 0x02 -.emtcode ARB_FOG_EXP2 0x03 -.emtcode ARB_FOG_LINEAR 0x04 - -/* GL_ARB_vertex_program option */ -.emtcode ARB_POSITION_INVARIANT 0x05 - -/* GL_ARB_fragment_program_shadow option */ -.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06 - -/* GL_ARB_draw_buffers option */ -.emtcode ARB_DRAW_BUFFERS 0x07 - -/* GL_MESA_texture_array option */ -.emtcode MESA_TEXTURE_ARRAY 0x08 - -/* GL_ARB_fragment_program instruction class */ -.emtcode OP_ALU_INST 0x00 -.emtcode OP_TEX_INST 0x01 - -/* GL_ARB_vertex_program instruction class */ -/* OP_ALU_INST */ - -/* GL_ARB_fragment_program instruction type */ -.emtcode OP_ALU_VECTOR 0x00 -.emtcode OP_ALU_SCALAR 0x01 -.emtcode OP_ALU_BINSC 0x02 -.emtcode OP_ALU_BIN 0x03 -.emtcode OP_ALU_TRI 0x04 -.emtcode OP_ALU_SWZ 0x05 -.emtcode OP_TEX_SAMPLE 0x06 -.emtcode OP_TEX_KIL 0x07 - -/* GL_ARB_vertex_program instruction type */ -.emtcode OP_ALU_ARL 0x08 -/* OP_ALU_VECTOR */ -/* OP_ALU_SCALAR */ -/* OP_ALU_BINSC */ -/* OP_ALU_BIN */ -/* OP_ALU_TRI */ -/* OP_ALU_SWZ */ - -/* GL_ARB_fragment_program instruction code */ -.emtcode OP_ABS 0x00 -.emtcode OP_ABS_SAT 0x1B -.emtcode OP_FLR 0x09 -.emtcode OP_FLR_SAT 0x26 -.emtcode OP_FRC 0x0A -.emtcode OP_FRC_SAT 0x27 -.emtcode OP_LIT 0x0C -.emtcode OP_LIT_SAT 0x2A -.emtcode OP_MOV 0x11 -.emtcode OP_MOV_SAT 0x30 -.emtcode OP_COS 0x1F -.emtcode OP_COS_SAT 0x20 -.emtcode OP_EX2 0x07 -.emtcode OP_EX2_SAT 0x25 -.emtcode OP_LG2 0x0B -.emtcode OP_LG2_SAT 0x29 -.emtcode OP_RCP 0x14 -.emtcode OP_RCP_SAT 0x33 -.emtcode OP_RSQ 0x15 -.emtcode OP_RSQ_SAT 0x34 -.emtcode OP_SIN 0x38 -.emtcode OP_SIN_SAT 0x39 -.emtcode OP_SCS 0x35 -.emtcode OP_SCS_SAT 0x36 -.emtcode OP_POW 0x13 -.emtcode OP_POW_SAT 0x32 -.emtcode OP_ADD 0x01 -.emtcode OP_ADD_SAT 0x1C -.emtcode OP_DP3 0x03 -.emtcode OP_DP3_SAT 0x21 -.emtcode OP_DP4 0x04 -.emtcode OP_DP4_SAT 0x22 -.emtcode OP_DPH 0x05 -.emtcode OP_DPH_SAT 0x23 -.emtcode OP_DST 0x06 -.emtcode OP_DST_SAT 0x24 -.emtcode OP_MAX 0x0F -.emtcode OP_MAX_SAT 0x2E -.emtcode OP_MIN 0x10 -.emtcode OP_MIN_SAT 0x2F -.emtcode OP_MUL 0x12 -.emtcode OP_MUL_SAT 0x31 -.emtcode OP_SGE 0x16 -.emtcode OP_SGE_SAT 0x37 -.emtcode OP_SLT 0x17 -.emtcode OP_SLT_SAT 0x3A -.emtcode OP_SUB 0x18 -.emtcode OP_SUB_SAT 0x3B -.emtcode OP_XPD 0x1A -.emtcode OP_XPD_SAT 0x43 -.emtcode OP_CMP 0x1D -.emtcode OP_CMP_SAT 0x1E -.emtcode OP_LRP 0x2B -.emtcode OP_LRP_SAT 0x2C -.emtcode OP_MAD 0x0E -.emtcode OP_MAD_SAT 0x2D -.emtcode OP_SWZ 0x19 -.emtcode OP_SWZ_SAT 0x3C -.emtcode OP_TEX 0x3D -.emtcode OP_TEX_SAT 0x3E -.emtcode OP_TXB 0x3F -.emtcode OP_TXB_SAT 0x40 -.emtcode OP_TXP 0x41 -.emtcode OP_TXP_SAT 0x42 -.emtcode OP_KIL 0x28 - -/* GL_ARB_vertex_program instruction code */ -.emtcode OP_ARL 0x02 -/* OP_ABS */ -/* OP_FLR */ -/* OP_FRC */ -/* OP_LIT */ -/* OP_MOV */ -/* OP_EX2 */ -.emtcode OP_EXP 0x08 -/* OP_LG2 */ -.emtcode OP_LOG 0x0D -/* OP_RCP */ -/* OP_RSQ */ -/* OP_POW */ -/* OP_ADD */ -/* OP_DP3 */ -/* OP_DP4 */ -/* OP_DPH */ -/* OP_DST */ -/* OP_MAX */ -/* OP_MIN */ -/* OP_MUL */ -/* OP_SGE */ -/* OP_SLT */ -/* OP_SUB */ -/* OP_XPD */ -/* OP_MAD */ -/* OP_SWZ */ - -/* fragment attribute binding */ -.emtcode FRAGMENT_ATTRIB_COLOR 0x01 -.emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02 -.emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03 -.emtcode FRAGMENT_ATTRIB_POSITION 0x04 - -/* vertex attribute binding */ -.emtcode VERTEX_ATTRIB_POSITION 0x01 -.emtcode VERTEX_ATTRIB_WEIGHT 0x02 -.emtcode VERTEX_ATTRIB_NORMAL 0x03 -.emtcode VERTEX_ATTRIB_COLOR 0x04 -.emtcode VERTEX_ATTRIB_FOGCOORD 0x05 -.emtcode VERTEX_ATTRIB_TEXCOORD 0x06 -.emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07 -.emtcode VERTEX_ATTRIB_GENERIC 0x08 - -/* fragment result binding */ -.emtcode FRAGMENT_RESULT_COLOR 0x01 -.emtcode FRAGMENT_RESULT_DEPTH 0x02 - -/* vertex result binding */ -.emtcode VERTEX_RESULT_POSITION 0x01 -.emtcode VERTEX_RESULT_COLOR 0x02 -.emtcode VERTEX_RESULT_FOGCOORD 0x03 -.emtcode VERTEX_RESULT_POINTSIZE 0x04 -.emtcode VERTEX_RESULT_TEXCOORD 0x05 - -/* texture target */ -.emtcode TEXTARGET_1D 0x01 -.emtcode TEXTARGET_2D 0x02 -.emtcode TEXTARGET_3D 0x03 -.emtcode TEXTARGET_RECT 0x04 -.emtcode TEXTARGET_CUBE 0x05 -/* GL_ARB_fragment_program_shadow */ -.emtcode TEXTARGET_SHADOW1D 0x06 -.emtcode TEXTARGET_SHADOW2D 0x07 -.emtcode TEXTARGET_SHADOWRECT 0x08 -/* GL_MESA_texture_array */ -.emtcode TEXTARGET_1D_ARRAY 0x09 -.emtcode TEXTARGET_2D_ARRAY 0x0a -.emtcode TEXTARGET_SHADOW1D_ARRAY 0x0b -.emtcode TEXTARGET_SHADOW2D_ARRAY 0x0c - -/* face type */ -.emtcode FACE_FRONT 0x00 -.emtcode FACE_BACK 0x01 - -/* color type */ -.emtcode COLOR_PRIMARY 0x00 -.emtcode COLOR_SECONDARY 0x01 - -/* component */ -.emtcode COMPONENT_X 0x00 -.emtcode COMPONENT_Y 0x01 -.emtcode COMPONENT_Z 0x02 -.emtcode COMPONENT_W 0x03 -.emtcode COMPONENT_0 0x04 -.emtcode COMPONENT_1 0x05 - -/* array index type */ -.emtcode ARRAY_INDEX_ABSOLUTE 0x00 -.emtcode ARRAY_INDEX_RELATIVE 0x01 - -/* matrix name */ -.emtcode MATRIX_MODELVIEW 0x01 -.emtcode MATRIX_PROJECTION 0x02 -.emtcode MATRIX_MVP 0x03 -.emtcode MATRIX_TEXTURE 0x04 -.emtcode MATRIX_PALETTE 0x05 -.emtcode MATRIX_PROGRAM 0x06 - -/* matrix modifier */ -.emtcode MATRIX_MODIFIER_IDENTITY 0x00 -.emtcode MATRIX_MODIFIER_INVERSE 0x01 -.emtcode MATRIX_MODIFIER_TRANSPOSE 0x02 -.emtcode MATRIX_MODIFIER_INVTRANS 0x03 - -/* constant type */ -.emtcode CONSTANT_SCALAR 0x01 -.emtcode CONSTANT_VECTOR 0x02 - -/* program param type */ -.emtcode PROGRAM_PARAM_ENV 0x01 -.emtcode PROGRAM_PARAM_LOCAL 0x02 - -/* register type */ -.emtcode REGISTER_ATTRIB 0x01 -.emtcode REGISTER_PARAM 0x02 -.emtcode REGISTER_RESULT 0x03 -.emtcode REGISTER_ESTABLISHED_NAME 0x04 - -/* param binding */ -.emtcode PARAM_NULL 0x00 -.emtcode PARAM_ARRAY_ELEMENT 0x01 -.emtcode PARAM_STATE_ELEMENT 0x02 -.emtcode PARAM_PROGRAM_ELEMENT 0x03 -.emtcode PARAM_PROGRAM_ELEMENTS 0x04 -.emtcode PARAM_CONSTANT 0x05 - -/* param state property */ -.emtcode STATE_MATERIAL 0x01 -.emtcode STATE_LIGHT 0x02 -.emtcode STATE_LIGHT_MODEL 0x03 -.emtcode STATE_LIGHT_PROD 0x04 -.emtcode STATE_FOG 0x05 -.emtcode STATE_MATRIX_ROWS 0x06 -/* GL_ARB_fragment_program */ -.emtcode STATE_TEX_ENV 0x07 -.emtcode STATE_DEPTH 0x08 -/* GL_ARB_vertex_program */ -.emtcode STATE_TEX_GEN 0x09 -.emtcode STATE_CLIP_PLANE 0x0A -.emtcode STATE_POINT 0x0B - -/* state material property */ -.emtcode MATERIAL_AMBIENT 0x01 -.emtcode MATERIAL_DIFFUSE 0x02 -.emtcode MATERIAL_SPECULAR 0x03 -.emtcode MATERIAL_EMISSION 0x04 -.emtcode MATERIAL_SHININESS 0x05 - -/* state light property */ -.emtcode LIGHT_AMBIENT 0x01 -.emtcode LIGHT_DIFFUSE 0x02 -.emtcode LIGHT_SPECULAR 0x03 -.emtcode LIGHT_POSITION 0x04 -.emtcode LIGHT_ATTENUATION 0x05 -.emtcode LIGHT_HALF 0x06 -.emtcode LIGHT_SPOT_DIRECTION 0x07 - -/* state light model property */ -.emtcode LIGHT_MODEL_AMBIENT 0x01 -.emtcode LIGHT_MODEL_SCENECOLOR 0x02 - -/* state light product property */ -.emtcode LIGHT_PROD_AMBIENT 0x01 -.emtcode LIGHT_PROD_DIFFUSE 0x02 -.emtcode LIGHT_PROD_SPECULAR 0x03 - -/* state texture environment property */ -.emtcode TEX_ENV_COLOR 0x01 - -/* state texture generation coord property */ -.emtcode TEX_GEN_EYE 0x01 -.emtcode TEX_GEN_OBJECT 0x02 - -/* state fog property */ -.emtcode FOG_COLOR 0x01 -.emtcode FOG_PARAMS 0x02 - -/* state depth property */ -.emtcode DEPTH_RANGE 0x01 - -/* state point parameters property */ -.emtcode POINT_SIZE 0x01 -.emtcode POINT_ATTENUATION 0x02 - -/* declaration */ -.emtcode ATTRIB 0x01 -.emtcode PARAM 0x02 -.emtcode TEMP 0x03 -.emtcode OUTPUT 0x04 -.emtcode ALIAS 0x05 -/* GL_ARB_vertex_program */ -.emtcode ADDRESS 0x06 - -/* error messages */ -.errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature" -.errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement" -.errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword" -.errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option" -.errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found" -.errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found" -.errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found" -.errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found" -.errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found" -.errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component" -.errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask" -.errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component" -.errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix" -.errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask" -.errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found" -.errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found" -.errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property" -.errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property" -.errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property" -.errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property" -.errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property" -.errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property" -.errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property" -.errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property" -.errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property" -.errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property" -.errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord" -.errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property" -.errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property" -.errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property" -.errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property" -.errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found" -.errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name" -.errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property" -.errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found" -.errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property" -.errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property" -.errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property" -.errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found" -.errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier" -.errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found" -.errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found" -.errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found" -.errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found" -.errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found" -.errtext MISSING_DOT "1046: '.' expected but '$e_token$' found" -.errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found" -.errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found" -.errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found" -.errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found" -.errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent" -.errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent" -.errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected" -.errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range" -.errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable" -.errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable" -.errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found" -.errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found" - -/* extension presence condition registers */ - -/* GL_ARB_vertex_blend */ -/* GL_EXT_vertex_weighting */ -.regbyte vertex_blend 0x00 - -/* GL_ARB_matrix_palette */ -.regbyte matrix_palette 0x00 - -/* GL_ARB_point_parameters */ -/* GL_EXT_point_parameters */ -.regbyte point_parameters 0x00 - -/* GL_EXT_secondary_color */ -.regbyte secondary_color 0x00 - -/* GL_EXT_fog_coord */ -.regbyte fog_coord 0x00 - -/* GL_EXT_texture_rectangle */ -/* GL_NV_texture_rectangle */ -.regbyte texture_rectangle 0x00 - -/* GL_ARB_fragment_program_shadow */ -.regbyte fragment_program_shadow 0x00 - -/* GL_ARB_draw_buffers */ -.regbyte draw_buffers 0x00 - -/* GL_MESA_texture_array */ -.regbyte texture_array 0x00 - -/* option presence condition registers */ -/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */ -/* register is set to 1 to indicate that the OPTION was specified. */ - -/* GL_ARB_fragment_program */ -.regbyte ARB_precision_hint_fastest 0x00 -.regbyte ARB_precision_hint_nicest 0x00 -.regbyte ARB_fog_exp 0x00 -.regbyte ARB_fog_exp2 0x00 -.regbyte ARB_fog_linear 0x00 - -/* GL_ARB_vertex_program */ -.regbyte ARB_position_invariant 0x00 - -/* GL_ARB_fragment_program_shadow */ -.regbyte ARB_fragment_program_shadow 0x00 - -/* GL_ARB_draw_buffers */ -.regbyte ARB_draw_buffers 0x00 - -/* GL_MESA_texture_array */ -.regbyte MESA_texture_array 0x00 - -/* program target condition register */ -/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */ -/* to distinguish between them we need a register that will store for us the current target. */ -/* the client will typically set the register to apropriate value before parsing a particular */ -/* program. the mapping between program targets and their values is listed below. */ -/* */ -/* program target register value */ -/* ---------------------------------------------- */ -/* FRAGMENT_PROGRAM 0x10 */ -/* VERTEX_PROGRAM 0x20 */ -/* */ -/* the initial value of the register is 0 to catch potential errors with not setting the register */ -/* with the proper value. */ -.regbyte program_target 0x00 - -/* - <program> ::= <optionSequence> <statementSequence> "END" -*/ -program - programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION; -programs - .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or - .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00; -frag_program_1_0 - '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and - optional_space .and fp_optionSequence .and fp_statementSequence .and - "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and - '\0' .error CODE_AFTER_END; -vert_program_1_0 - '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and - optional_space .and vp_optionSequence .and vp_statementSequence .and - "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and - '\0' .error CODE_AFTER_END; - -/* - <optionSequence> ::= <optionSequence> <option> - | "" -*/ -fp_optionSequence - .loop fp_option; -vp_optionSequence - .loop vp_option; - -/* - <option> ::= "OPTION" <identifier> ";" - -NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of - these options is encountered, the other one is automatically disabled. - the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear. -*/ -fp_option - "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and - fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon; -vp_option - "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and - vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon; -fp_optionString - .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest" - .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or - .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest" - .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or - fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or - fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or - fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or - .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow" - .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or - .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS - .load ARB_draw_buffers 0x01 .or - .if (texture_array != 0x00) "MESA_texture_array" .emit MESA_TEXTURE_ARRAY - .load MESA_texture_array 0x01; -vp_optionString - "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01; -fp_ARB_fog_exp - .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp"; -fp_ARB_fog_exp2 - .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2"; -fp_ARB_fog_linear - .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear"; - -/* - <statementSequence> ::= <statementSequence> <statement> - | "" -*/ -fp_statementSequence - .loop fp_statement; -vp_statementSequence - .loop vp_statement; - -/* - <statement> ::= <instruction> ";" - | <namingStatement> ";" - -NOTE: ".emit $" in the definitions below means that we output instruction position (offset of - the first character of instruction) for program debugging purposes. -*/ -fp_statement - fp_statement_1 .or fp_statement_2; -vp_statement - vp_statement_1 .or vp_statement_2; -fp_statement_1 - fp_instruction .emit INSTRUCTION .emit $ .and semicolon; -fp_statement_2 - fp_namingStatement .emit DECLARATION .and semicolon; -vp_statement_1 - vp_instruction .emit INSTRUCTION .emit $ .and semicolon; -vp_statement_2 - vp_namingStatement .emit DECLARATION .and semicolon; - -/* -fragment program - <instruction> ::= <ALUInstruction> - | <TexInstruction> - -vertex program - <instruction> ::= <ARL_instruction> - | <VECTORop_instruction> - | <SCALARop_instruction> - | <BINSCop_instruction> - | <BINop_instruction> - | <TRIop_instruction> - | <SWZ_instruction> -*/ -fp_instruction - ALUInstruction .emit OP_ALU_INST .or - TexInstruction .emit OP_TEX_INST; -vp_instruction - ARL_instruction .emit OP_ALU_ARL .or - vp_VECTORop_instruction .emit OP_ALU_VECTOR .or - vp_SCALARop_instruction .emit OP_ALU_SCALAR .or - vp_BINSCop_instruction .emit OP_ALU_BINSC .or - vp_BINop_instruction .emit OP_ALU_BIN .or - vp_TRIop_instruction .emit OP_ALU_TRI .or - vp_SWZ_instruction .emit OP_ALU_SWZ; - -/* -fragment program - <ALUInstruction> ::= <VECTORop_instruction> - | <SCALARop_instruction> - | <BINSCop_instruction> - | <BINop_instruction> - | <TRIop_instruction> - | <SWZ_instruction> -*/ -ALUInstruction - fp_VECTORop_instruction .emit OP_ALU_VECTOR .or - fp_SCALARop_instruction .emit OP_ALU_SCALAR .or - fp_BINSCop_instruction .emit OP_ALU_BINSC .or - fp_BINop_instruction .emit OP_ALU_BIN .or - fp_TRIop_instruction .emit OP_ALU_TRI .or - fp_SWZ_instruction .emit OP_ALU_SWZ; - -/* -fragment program - <TexInstruction> ::= <SAMPLE_instruction> - | <KIL_instruction> -*/ -TexInstruction - SAMPLE_instruction .emit OP_TEX_SAMPLE .or - KIL_instruction .emit OP_TEX_KIL; - -/* -vertex program - <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg> -*/ -ARL_instruction - "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg; - -/* -fragment program - <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," - <vectorSrcReg> - -vertex program - <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg> -*/ -fp_VECTORop_instruction - fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg; -vp_VECTORop_instruction - vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg; - -/* -fragment program - <VECTORop> ::= "ABS" | "ABS_SAT" - | "FLR" | "FLR_SAT" - | "FRC" | "FRC_SAT" - | "LIT" | "LIT_SAT" - | "MOV" | "MOV_SAT" - -vertex program - <VECTORop> ::= "ABS" - | "FLR" - | "FRC" - | "LIT" - | "MOV" -*/ -fp_VECTORop - "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or - "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or - "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or - "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or - "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT; -vp_VECTORop - "ABS" .emit OP_ABS .or - "FLR" .emit OP_FLR .or - "FRC" .emit OP_FRC .or - "LIT" .emit OP_LIT .or - "MOV" .emit OP_MOV; - -/* - <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg> -*/ -fp_SCALARop_instruction - fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg; -vp_SCALARop_instruction - vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg; - -/* -fragment program - <SCALARop> ::= "COS" | "COS_SAT" - | "EX2" | "EX2_SAT" - | "LG2" | "LG2_SAT" - | "RCP" | "RCP_SAT" - | "RSQ" | "RSQ_SAT" - | "SIN" | "SIN_SAT" - | "SCS" | "SCS_SAT" - -vertex program - <SCALARop> ::= "EX2" - | "EXP" - | "LG2" - | "LOG" - | "RCP" - | "RSQ" -*/ -fp_SCALARop - "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or - "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or - "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or - "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or - "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or - "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or - "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT; -vp_SCALARop - "EX2" .emit OP_EX2 .or - "EXP" .emit OP_EXP .or - "LG2" .emit OP_LG2 .or - "LOG" .emit OP_LOG .or - "RCP" .emit OP_RCP .or - "RSQ" .emit OP_RSQ; - -/* - <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> "," - <scalarSrcReg> -*/ -fp_BINSCop_instruction - fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and - fp_scalarSrcReg; -vp_BINSCop_instruction - vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and - vp_scalarSrcReg; - -/* -fragment program - <BINSCop> ::= "POW" | "POW_SAT" - -vertex program - <BINSCop> ::= "POW" -*/ -fp_BINSCop - "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT; -vp_BINSCop - "POW" .emit OP_POW; - -/* -fragment program - <BINop_instruction> ::= <BINop> <maskedDstReg> "," - <vectorSrcReg> "," <vectorSrcReg> - -vertex program - <BINop_instruction> ::= <BINop> <maskedDstReg> "," - <swizzleSrcReg> "," <swizzleSrcReg> -*/ -fp_BINop_instruction - fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and - vectorSrcReg; -vp_BINop_instruction - vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and - swizzleSrcReg; - -/* -fragment program - <BINop> ::= "ADD" | "ADD_SAT" - | "DP3" | "DP3_SAT" - | "DP4" | "DP4_SAT" - | "DPH" | "DPH_SAT" - | "DST" | "DST_SAT" - | "MAX" | "MAX_SAT" - | "MIN" | "MIN_SAT" - | "MUL" | "MUL_SAT" - | "SGE" | "SGE_SAT" - | "SLT" | "SLT_SAT" - | "SUB" | "SUB_SAT" - | "XPD" | "XPD_SAT" - -vertex program - <BINop> ::= "ADD" - | "DP3" - | "DP4" - | "DPH" - | "DST" - | "MAX" - | "MIN" - | "MUL" - | "SGE" - | "SLT" - | "SUB" - | "XPD" -*/ -fp_BINop - "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or - "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or - "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or - "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or - "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or - "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or - "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or - "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or - "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or - "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or - "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or - "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT; -vp_BINop - "ADD" .emit OP_ADD .or - "DP3" .emit OP_DP3 .or - "DP4" .emit OP_DP4 .or - "DPH" .emit OP_DPH .or - "DST" .emit OP_DST .or - "MAX" .emit OP_MAX .or - "MIN" .emit OP_MIN .or - "MUL" .emit OP_MUL .or - "SGE" .emit OP_SGE .or - "SLT" .emit OP_SLT .or - "SUB" .emit OP_SUB .or - "XPD" .emit OP_XPD; - -/* -fragment program - <TRIop_instruction> ::= <TRIop> <maskedDstReg> "," - <vectorSrcReg> "," <vectorSrcReg> "," - <vectorSrcReg> - -vertex program - <TRIop_instruction> ::= <TRIop> <maskedDstReg> "," - <swizzleSrcReg> "," <swizzleSrcReg> "," - <swizzleSrcReg> -*/ -fp_TRIop_instruction - fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and - vectorSrcReg .and comma .and vectorSrcReg; -vp_TRIop_instruction - vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and - swizzleSrcReg .and comma .and swizzleSrcReg; - -/* -fragment program - <TRIop> ::= "CMP" | "CMP_SAT" - | "LRP" | "LRP_SAT" - | "MAD" | "MAD_SAT" - -vertex program - <TRIop> ::= "MAD" -*/ -fp_TRIop - "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or - "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or - "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT; -vp_TRIop - "MAD" .emit OP_MAD; - -/* -fragment program - <SWZ_instruction> ::= <SWZop> <maskedDstReg> "," - <srcReg> "," <extendedSwizzle> - -vertex program - <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> "," - <extendedSwizzle> -*/ -fp_SWZ_instruction - SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and - fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED; -vp_SWZ_instruction - "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and - vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED; - -/* -fragment program - <SWZop> ::= "SWZ" | "SWZ_SAT" -*/ -SWZop - "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT; - -/* -fragment program - <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> "," - <vectorSrcReg> "," <texImageUnit> "," - <texTarget> -*/ -SAMPLE_instruction - SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and - texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED; - -/* -fragment program - <SAMPLEop> ::= "TEX" | "TEX_SAT" - | "TXP" | "TXP_SAT" - | "TXB" | "TXB_SAT" -*/ -SAMPLEop - "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or - "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or - "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT; - -/* -fragment program - <KIL_instruction> ::= "KIL" <vectorSrcReg> -*/ -KIL_instruction - "KIL" .emit OP_KIL .and space_src .and vectorSrcReg; - -/* -fragment program - <texImageUnit> ::= "texture" <optTexImageUnitNum> -*/ -texImageUnit - "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum; - -/* -fragment program - <texTarget> ::= "1D" - | "2D" - | "3D" - | "CUBE" - | "RECT" - | <shadowTarget> (if option ARB_fragment_program_shadow present) - | <arrayTarget> (if option MESA_texture_array present) -*/ -texTarget - "1D" .emit TEXTARGET_1D .or - "2D" .emit TEXTARGET_2D .or - "3D" .emit TEXTARGET_3D .or - .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or - "CUBE" .emit TEXTARGET_CUBE .or - .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or - .if (MESA_texture_array != 0x00) arrayTarget; - -/* -GL_ARB_fragment_program_shadow - <shadowTarget> ::= "SHADOW1D" - | "SHADOW2D" - | "SHADOWRECT" - | <shadowArrayTarget> (if option MESA_texture_array present) -*/ -shadowTarget - "SHADOW1D" .emit TEXTARGET_SHADOW1D .or - "SHADOW2D" .emit TEXTARGET_SHADOW2D .or - .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT .or - .if (MESA_texture_array != 0x00) shadowArrayTarget; - -/* -GL_MESA_texture_array - - <arrayTarget> ::= "ARRAY1D" - | "ARRAY2D" - - <shadowArrayTarget> ::= "SHADOWARRAY1D" - | "SHADOWARRAY2D" -*/ - -arrayTarget - "ARRAY1D" .emit TEXTARGET_1D_ARRAY .or - "ARRAY2D" .emit TEXTARGET_2D_ARRAY; - -shadowArrayTarget - "SHADOWARRAY1D" .emit TEXTARGET_SHADOW1D_ARRAY .or - "SHADOWARRAY2D" .emit TEXTARGET_SHADOW2D_ARRAY; - -/* -fragment program - <optTexImageUnitNum> ::= "" - | "[" <texImageUnitNum> "]" -*/ -optTexImageUnitNum - optTexImageUnitNum_1 .or .true .emit 0x00; -optTexImageUnitNum_1 - lbracket_ne .and texImageUnitNum .and rbracket; - -/* -fragment program - <texImageUnitNum> ::= <integer> from 0 to - MAX_TEXTURE_IMAGE_UNITS_ARB-1 -*/ -texImageUnitNum - integer; - -/* - <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix> -*/ -fp_scalarSrcReg - optionalSign .and fp_srcReg .and fp_scalarSuffix; -vp_scalarSrcReg - optionalSign .and vp_srcReg .and vp_scalarSuffix; - -/* -vertex program - <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix> -*/ -swizzleSrcReg - optionalSign .and vp_srcReg .and swizzleSuffix; - -/* -fragment program - <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix> -*/ -vectorSrcReg - optionalSign .and fp_srcReg .and optionalSuffix; - -/* - <maskedDstReg> ::= <dstReg> <optionalMask> -*/ -fp_maskedDstReg - fp_dstReg .and fp_optionalMask; -vp_maskedDstReg - vp_dstReg .and vp_optionalMask; - -/* -vertex program - <maskedAddrReg> ::= <addrReg> <addrWriteMask> -*/ -maskedAddrReg - addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask; - -/* -fragment program - <extendedSwizzle> ::= <xyzwExtendedSwizzle> - | <rgbaExtendedSwizzle> - -vertex program - <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> "," - <extSwizComp> "," <extSwizComp> - -NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez -*/ -fp_extendedSwizzle - rgbaExtendedSwizzle .or xyzwExtendedSwizzle; -vp_extendedSwizzle - extSwizComp .and comma .and - extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - extSwizComp .error EXT_SWIZ_COMP_EXPECTED; - -/* -fragment program - <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> "," - <xyzwExtSwizComp> "," <xyzwExtSwizComp> -*/ -xyzwExtendedSwizzle - xyzwExtSwizComp .and comma .and - xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED; - -/* -fragment program - <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> "," - <rgbaExtSwizComp> "," <rgbaExtSwizComp> -*/ -rgbaExtendedSwizzle - rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or - rgbaExtendedSwizzle_4; -rgbaExtendedSwizzle_1 - rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and - rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp; -rgbaExtendedSwizzle_2 - rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and - rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED; -rgbaExtendedSwizzle_3 - rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and - rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED; -rgbaExtendedSwizzle_4 - rgbaExtSwizComp_alpha .and comma .and - rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and - rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED; - -/* -fragment program - <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel> -*/ -xyzwExtSwizComp - optionalSign .and xyzwExtSwizSel; - -/* -fragment program - <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel> -*/ -rgbaExtSwizComp - optionalSign .and rgbaExtSwizSel; -rgbaExtSwizComp_digit - optionalSign .and rgbaExtSwizSel_digit; -rgbaExtSwizComp_alpha - optionalSign .and rgbaExtSwizSel_alpha; - -/* -vertex program - <extSwizComp> ::= <optionalSign> <extSwizSel> -*/ -extSwizComp - optionalSign .and extSwizSel; - -/* -fragment program - <xyzwExtSwizSel> ::= "0" - | "1" - | <xyzwComponent> -*/ -xyzwExtSwizSel - "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single; - -/* -fragment program - <rgbaExtSwizSel> ::= "0" - | "1" - | <rgbaComponent> -*/ -rgbaExtSwizSel - rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha; -rgbaExtSwizSel_digit - "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1; -rgbaExtSwizSel_alpha - rgbaComponent_single; - -/* -vertex program - <extSwizSel> ::= "0" - | "1" - | <component> -*/ -extSwizSel - "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single; - -/* -fragment program - <srcReg> ::= <fragmentAttribReg> - | <temporaryReg> - | <progParamReg> - -vertex program - <srcReg> ::= <vertexAttribReg> - | <temporaryReg> - | <progParamReg> -*/ -fp_srcReg - fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED; -vp_srcReg - vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED; -fp_srcReg_1 - fragmentAttribReg .emit REGISTER_ATTRIB .or - fp_progParamReg .emit REGISTER_PARAM .or - fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME; -vp_srcReg_1 - vertexAttribReg .emit REGISTER_ATTRIB .or - vp_progParamReg .emit REGISTER_PARAM .or - vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME; - -/* -fragment program - <dstReg> ::= <temporaryReg> - | <fragmentResultReg> - -vertex program - <dstReg> ::= <temporaryReg> - | <vertexResultReg> -*/ -fp_dstReg - fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED; -vp_dstReg - vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED; -fp_dstReg_1 - fragmentResultReg .emit REGISTER_RESULT .or - fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME; -vp_dstReg_1 - vertexResultReg .emit REGISTER_RESULT .or - vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME; - -/* -fragment program - <fragmentAttribReg> ::= <establishedName> - | <fragAttribBinding> - -NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg> -*/ -fragmentAttribReg - /*fp_establishedName .or */fragAttribBinding; - -/* -vertex program - <vertexAttribReg> ::= <establishedName> - | <vtxAttribBinding> - -NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg> -*/ -vertexAttribReg - vtxAttribBinding; - -/* - <temporaryReg> ::= <establishedName> -*/ -fp_temporaryReg - fp_establishedName_no_error_on_identifier; -vp_temporaryReg - vp_establishedName_no_error_on_identifier; - -/* -fragment program - <progParamReg> ::= <progParamSingle> - | <progParamArray> "[" <progParamArrayAbs> "]" - | <paramSingleItemUse> - -vertex program - <progParamReg> ::= <progParamSingle> - | <progParamArray> "[" <progParamArrayMem> "]" - | <paramSingleItemUse> -*/ -fp_progParamReg - fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle; -vp_progParamReg - vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle; -fp_progParamReg_1 - fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and - rbracket; -vp_progParamReg_1 - vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and - rbracket; - -/* - <progParamSingle> ::= <establishedName> - -NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg> -*/ -fp_progParamSingle - .false; -vp_progParamSingle - .false; - -/* - <progParamArray> ::= <establishedName> -*/ -fp_progParamArray - fp_establishedName_no_error_on_identifier; -vp_progParamArray - vp_establishedName_no_error_on_identifier; - -/* -vertex program - <progParamArrayMem> ::= <progParamArrayAbs> - | <progParamArrayRel> -*/ -progParamArrayMem - progParamArrayAbs .or progParamArrayRel; - -/* - <progParamArrayAbs> ::= <integer> -*/ -progParamArrayAbs - integer_ne .emit ARRAY_INDEX_ABSOLUTE; - -/* -vertex program - <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset> -*/ -progParamArrayRel - addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and - addrComponent .and addrRegRelOffset; - -/* -vertex program - <addrRegRelOffset> ::= "" - | "+" <addrRegPosOffset> - | "-" <addrRegNegOffset> -*/ -addrRegRelOffset - addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00; -addrRegRelOffset_1 - plus_ne .and addrRegPosOffset; -addrRegRelOffset_2 - minus_ne .and addrRegNegOffset; - -/* -vertex program - <addrRegPosOffset> ::= <integer> from 0 to 63 -*/ -addrRegPosOffset - integer_0_63; - -/* -vertex program - <addrRegNegOffset> ::= <integer> from 0 to 64 -*/ -addrRegNegOffset - integer_0_64; - -/* -fragment program - <fragmentResultReg> ::= <establishedName> - | <resultBinding> - -NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg> -*/ -fragmentResultReg - fp_resultBinding; - -/* -vertex program - <vertexResultReg> ::= <establishedName> - | <resultBinding> - -NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg> -*/ -vertexResultReg - vp_resultBinding; - -/* -vertex program - <addrReg> ::= <establishedName> -*/ -addrReg - vp_establishedName_no_error_on_identifier; - -/* -vertex program - <addrComponent> ::= "." "x" -*/ -addrComponent - dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X - .emit COMPONENT_X .emit COMPONENT_X; - -/* -vertex program - <addrWriteMask> ::= "." "x" -*/ -addrWriteMask - dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08; - -/* - <scalarSuffix> ::= "." <component> -*/ -fp_scalarSuffix - dot .and fp_component_single .error INVALID_COMPONENT; -vp_scalarSuffix - dot .and vp_component_single .error INVALID_COMPONENT; - -/* -vertex program - <swizzleSuffix> ::= "" - | "." <component> - | "." <component> <component> - <component> <component> -*/ -swizzleSuffix - swizzleSuffix_1 .or - .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W; -swizzleSuffix_1 - dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX; -swizzleSuffix_2 - swizzleSuffix_3 .or swizzleSuffix_4; -swizzleSuffix_3 - vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and - vp_component_multi .error INVALID_COMPONENT; -swizzleSuffix_4 - "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or - "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or - "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or - "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W; - -/* -fragment program - <optionalSuffix> ::= "" - | "." <component> - | "." <xyzwComponent> <xyzwComponent> - <xyzwComponent> <xyzwComponent> - | "." <rgbaComponent> <rgbaComponent> - <rgbaComponent> <rgbaComponent> -*/ -optionalSuffix - optionalSuffix_1 .or - .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W; -optionalSuffix_1 - dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX; -optionalSuffix_2 - optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5; -optionalSuffix_3 - xyzwComponent_multi .and xyzwComponent_multi .and - xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT; -optionalSuffix_4 - rgbaComponent_multi .and rgbaComponent_multi .and - rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT; -optionalSuffix_5 - "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or - "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or - "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or - "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or - "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or - "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or - "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or - "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W; - -/* -fragment program - <component> ::= <xyzwComponent> - | <rgbaComponent> - -vertex program - <component> ::= "x" - | "y" - | "z" - | "w" -*/ -fp_component_single - xyzwComponent_single .or rgbaComponent_single; -vp_component_multi - 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or - 'w' .emit COMPONENT_W; -vp_component_single - "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or - "w" .emit COMPONENT_W; - -/* -fragment program - <xyzwComponent> ::= "x" | "y" | "z" | "w" -*/ -xyzwComponent_multi - 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or - 'w' .emit COMPONENT_W; -xyzwComponent_single - "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or - "w" .emit COMPONENT_W; - -/* -fragment program - <rgbaComponent> ::= "r" | "g" | "b" | "a" -*/ -rgbaComponent_multi - 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or - 'a' .emit COMPONENT_W; -rgbaComponent_single - "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or - "a" .emit COMPONENT_W; - -/* -fragment program - <optionalMask> ::= "" - | <xyzwMask> - | <rgbaMask> - -vertex program - <optionalMask> ::= "" - | "." "x" - | "." "y" - | "." "xy" - | "." "z" - | "." "xz" - | "." "yz" - | "." "xyz" - | "." "w" - | "." "xw" - | "." "yw" - | "." "xyw" - | "." "zw" - | "." "xzw" - | "." "yzw" - | "." "xyzw" - -NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez -*/ -fp_optionalMask - rgbaMask .or xyzwMask .or .true .emit 0x0F; -vp_optionalMask - xyzwMask .or .true .emit 0x0F; - -/* -fragment program - <xyzwMask> ::= "." "x" - | "." "y" - | "." "xy" - | "." "z" - | "." "xz" - | "." "yz" - | "." "xyz" - | "." "w" - | "." "xw" - | "." "yw" - | "." "xyw" - | "." "zw" - | "." "xzw" - | "." "yzw" - | "." "xyzw" - -NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>. -*/ -xyzwMask - dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK; -xyzwMask_1 - "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or - "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or - "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or - "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01; - -/* -fragment program - <rgbaMask> ::= "." "r" - | "." "g" - | "." "rg" - | "." "b" - | "." "rb" - | "." "gb" - | "." "rgb" - | "." "a" - | "." "ra" - | "." "ga" - | "." "rga" - | "." "ba" - | "." "rba" - | "." "gba" - | "." "rgba" -*/ -rgbaMask - dot_ne .and rgbaMask_1; -rgbaMask_1 - "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or - "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or - "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or - "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01; - -/* -fragment program - <namingStatement> ::= <ATTRIB_statement> - | <PARAM_statement> - | <TEMP_statement> - | <OUTPUT_statement> - | <ALIAS_statement> - -vertex program - <namingStatement> ::= <ATTRIB_statement> - | <PARAM_statement> - | <TEMP_statement> - | <ADDRESS_statement> - | <OUTPUT_statement> - | <ALIAS_statement> -*/ -fp_namingStatement - fp_ATTRIB_statement .emit ATTRIB .or - fp_PARAM_statement .emit PARAM .or - fp_TEMP_statement .emit TEMP .or - fp_OUTPUT_statement .emit OUTPUT .or - fp_ALIAS_statement .emit ALIAS; -vp_namingStatement - vp_ATTRIB_statement .emit ATTRIB .or - vp_PARAM_statement .emit PARAM .or - vp_TEMP_statement .emit TEMP .or - ADDRESS_statement .emit ADDRESS .or - vp_OUTPUT_statement .emit OUTPUT .or - vp_ALIAS_statement .emit ALIAS; - -/* -fragment program - <ATTRIB_statement> ::= "ATTRIB" <establishName> "=" - <fragAttribBinding> - -vertex program - <ATTRIB_statement> ::= "ATTRIB" <establishName> "=" - <vtxAttribBinding> -*/ -fp_ATTRIB_statement - "ATTRIB" .and space .and fp_establishName .and equal .and - fragAttribBinding .error FRAGMENT_EXPECTED; -vp_ATTRIB_statement - "ATTRIB" .and space .and vp_establishName .and equal .and - vtxAttribBinding .error VERTEX_EXPECTED; - -/* -fragment program - <fragAttribBinding> ::= "fragment" "." <fragAttribItem> -*/ -fragAttribBinding - "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY; - -/* -vertex program - <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem> -*/ -vtxAttribBinding - "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY; - -/* -fragment program - <fragAttribItem> ::= "color" <optColorType> - | "texcoord" <optTexCoordNum> - | "fogcoord" - | "position" -*/ -fragAttribItem - fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or - fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or - .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or - "position" .emit FRAGMENT_ATTRIB_POSITION; -fragAttribItem_1 - "color" .and optColorType; -fragAttribItem_2 - "texcoord" .and optTexCoordNum; - -/* -vertex program - <vtxAttribItem> ::= "position" - | "weight" <vtxOptWeightNum> - | "normal" - | "color" <optColorType> - | "fogcoord" - | "texcoord" <optTexCoordNum> - | "matrixindex" "[" <vtxWeightNum> "]" - | "attrib" "[" <vtxAttribNum> "]" -*/ -vtxAttribItem - "position" .emit VERTEX_ATTRIB_POSITION .or - .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or - "normal" .emit VERTEX_ATTRIB_NORMAL .or - vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or - "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or - vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or - .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or - vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC; -vtxAttribItem_1 - "weight" .and vtxOptWeightNum; -vtxAttribItem_2 - "color" .and optColorType; -vtxAttribItem_3 - "texcoord" .and optTexCoordNum; -vtxAttribItem_4 - "matrixindex" .and lbracket .and vtxWeightNum .and rbracket; -vtxAttribItem_5 - "attrib" .and lbracket .and vtxAttribNum .and rbracket; - -/* -vertex program - <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1 -*/ -vtxAttribNum - integer; - -/* -vertex program - <vtxOptWeightNum> ::= "" - | "[" <vtxWeightNum> "]" -*/ -vtxOptWeightNum - vtxOptWeightNum_1 .or .true .emit 0x00; -vtxOptWeightNum_1 - lbracket_ne .and vtxWeightNum .and rbracket; - -/* -vertex program - <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1, - must be divisible by four -*/ -vtxWeightNum - integer; - -/* - <PARAM_statement> ::= <PARAM_singleStmt> - | <PARAM_multipleStmt> -*/ -fp_PARAM_statement - fp_PARAM_multipleStmt .or fp_PARAM_singleStmt; -vp_PARAM_statement - vp_PARAM_multipleStmt .or vp_PARAM_singleStmt; - -/* - <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit> -*/ -fp_PARAM_singleStmt - "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and - .true .emit PARAM_NULL; -vp_PARAM_singleStmt - "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and - .true .emit PARAM_NULL; - -/* - <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]" - <paramMultipleInit> -*/ -fp_PARAM_multipleStmt - "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and - fp_paramMultipleInit .and .true .emit PARAM_NULL; -vp_PARAM_multipleStmt - "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and - vp_paramMultipleInit .and .true .emit PARAM_NULL; - -/* - <optArraySize> ::= "" - | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB - (maximum number of allowed program - parameter bindings) -*/ -optArraySize - optional_integer; - -/* - <paramSingleInit> ::= "=" <paramSingleItemDecl> -*/ -fp_paramSingleInit - equal .and fp_paramSingleItemDecl; -vp_paramSingleInit - equal .and vp_paramSingleItemDecl; - -/* - <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}" -*/ -fp_paramMultipleInit - equal .and lbrace .and fp_paramMultInitList .and rbrace; -vp_paramMultipleInit - equal .and lbrace .and vp_paramMultInitList .and rbrace; - -/* - <paramMultInitList> ::= <paramMultipleItem> - | <paramMultipleItem> "," <paramMultiInitList> -*/ -fp_paramMultInitList - fp_paramMultInitList_1 .or fp_paramMultipleItem; -vp_paramMultInitList - vp_paramMultInitList_1 .or vp_paramMultipleItem; -fp_paramMultInitList_1 - fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList; -vp_paramMultInitList_1 - vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList; - -/* - <paramSingleItemDecl> ::= <stateSingleItem> - | <programSingleItem> - | <paramConstDecl> -*/ -fp_paramSingleItemDecl - fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or - programSingleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstDecl .emit PARAM_CONSTANT; -vp_paramSingleItemDecl - vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or - programSingleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstDecl .emit PARAM_CONSTANT; - -/* - <paramSingleItemUse> ::= <stateSingleItem> - | <programSingleItem> - | <paramConstUse> -*/ -fp_paramSingleItemUse - fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or - programSingleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstUse .emit PARAM_CONSTANT; -vp_paramSingleItemUse - vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or - programSingleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstUse .emit PARAM_CONSTANT; - -/* - <paramMultipleItem> ::= <stateMultipleItem> - | <programMultipleItem> - | <paramConstDecl> -*/ -fp_paramMultipleItem - fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or - programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstDecl .emit PARAM_CONSTANT; -vp_paramMultipleItem - vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or - programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or - paramConstDecl .emit PARAM_CONSTANT; - -/* - <stateMultipleItem> ::= <stateSingleItem> - | "state" "." <stateMatrixRows> -*/ -fp_stateMultipleItem - stateMultipleItem_1 .or fp_stateSingleItem; -vp_stateMultipleItem - stateMultipleItem_1 .or vp_stateSingleItem; -stateMultipleItem_1 - "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS; - -/* -fragment program - <stateSingleItem> ::= "state" "." <stateMaterialItem> - | "state" "." <stateLightItem> - | "state" "." <stateLightModelItem> - | "state" "." <stateLightProdItem> - | "state" "." <stateTexEnvItem> - | "state" "." <stateFogItem> - | "state" "." <stateDepthItem> - | "state" "." <stateMatrixRow> - -vertex program - <stateSingleItem> ::= "state" "." <stateMaterialItem> - | "state" "." <stateLightItem> - | "state" "." <stateLightModelItem> - | "state" "." <stateLightProdItem> - | "state" "." <stateTexGenItem> - | "state" "." <stateFogItem> - | "state" "." <stateClipPlaneItem> - | "state" "." <statePointItem> - | "state" "." <stateMatrixRow> -*/ -fp_stateSingleItem - "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY; -vp_stateSingleItem - "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY; -fp_stateSingleItem_1 - stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or - stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11; -vp_stateSingleItem_1 - stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or - stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or - stateSingleItem_11; -stateSingleItem_1 - stateMaterialItem .emit STATE_MATERIAL; -stateSingleItem_2 - stateLightItem .emit STATE_LIGHT; -stateSingleItem_3 - stateLightModelItem .emit STATE_LIGHT_MODEL; -stateSingleItem_4 - stateLightProdItem .emit STATE_LIGHT_PROD; -stateSingleItem_5 - stateTexEnvItem .emit STATE_TEX_ENV; -stateSingleItem_6 - stateTexGenItem .emit STATE_TEX_GEN; -stateSingleItem_7 - stateFogItem .emit STATE_FOG; -stateSingleItem_8 - stateDepthItem .emit STATE_DEPTH; -stateSingleItem_9 - stateClipPlaneItem .emit STATE_CLIP_PLANE; -stateSingleItem_10 - statePointItem .emit STATE_POINT; -stateSingleItem_11 - stateMatrixRow .emit STATE_MATRIX_ROWS; - -/* - <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty> -*/ -stateMaterialItem - "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY; - -/* - <stateMatProperty> ::= "ambient" - | "diffuse" - | "specular" - | "emission" - | "shininess" -*/ -stateMatProperty - "ambient" .emit MATERIAL_AMBIENT .or - "diffuse" .emit MATERIAL_DIFFUSE .or - "specular" .emit MATERIAL_SPECULAR .or - "emission" .emit MATERIAL_EMISSION .or - "shininess" .emit MATERIAL_SHININESS; - -/* - <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "." - <stateLightProperty> -*/ -stateLightItem - "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and - stateLightProperty .error INVALID_LIGHT_PROPERTY; - -/* - <stateLightProperty> ::= "ambient" - | "diffuse" - | "specular" - | "position" - | "attenuation" - | "spot" "." <stateSpotProperty> - | "half" -*/ -stateLightProperty - "ambient" .emit LIGHT_AMBIENT .or - "diffuse" .emit LIGHT_DIFFUSE .or - "specular" .emit LIGHT_SPECULAR .or - "position" .emit LIGHT_POSITION .or - "attenuation" .emit LIGHT_ATTENUATION .or - stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or - "half" .emit LIGHT_HALF; -stateLightProperty_1 - "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY; - -/* - <stateSpotProperty> ::= "direction" -*/ -stateSpotProperty - "direction"; - -/* - <stateLightModelItem> ::= "lightmodel" <stateLModProperty> -*/ -stateLightModelItem - "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY; - -/* - <stateLModProperty> ::= "." "ambient" - | <optFaceType> "." "scenecolor" -*/ -stateLModProperty - stateLModProperty_1 .or stateLModProperty_2; -stateLModProperty_1 - dot .and "ambient" .emit LIGHT_MODEL_AMBIENT; -stateLModProperty_2 - stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR; -stateLModProperty_3 - optFaceType .and dot .and "scenecolor"; - -/* - <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]" - <optFaceType> "." <stateLProdProperty> -*/ -stateLightProdItem - "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and - stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY; - -/* - <stateLProdProperty> ::= "ambient" - | "diffuse" - | "specular" -*/ -stateLProdProperty - "ambient" .emit LIGHT_PROD_AMBIENT .or - "diffuse" .emit LIGHT_PROD_DIFFUSE .or - "specular" .emit LIGHT_PROD_SPECULAR; - -/* - <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1 -*/ -stateLightNumber - integer; - -/* -fragment program - <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "." - <stateTexEnvProperty> -*/ -stateTexEnvItem - "texenv" .and optLegacyTexUnitNum .and dot .and - stateTexEnvProperty .error INVALID_TEXENV_PROPERTY; - -/* -fragment program - <stateTexEnvProperty> ::= "color" -*/ -stateTexEnvProperty - "color" .emit TEX_ENV_COLOR; - -/* -fragment program - <optLegacyTexUnitNum> ::= "" - | "[" <legacyTexUnitNum> "]" -*/ -optLegacyTexUnitNum - optLegacyTexUnitNum_1 .or .true .emit 0x00; -optLegacyTexUnitNum_1 - lbracket_ne .and legacyTexUnitNum .and rbracket; - -/* -fragment program - <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1 -*/ -legacyTexUnitNum - integer; - -/* -vertex program - <stateTexGenItem> ::= "texgen" <optTexCoordNum> "." - <stateTexGenType> "." <stateTexGenCoord> -*/ -stateTexGenItem - "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and - dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD; - -/* -vertex program - <stateTexGenType> ::= "eye" - | "object" -*/ -stateTexGenType - "eye" .emit TEX_GEN_EYE .or - "object" .emit TEX_GEN_OBJECT; - -/* -vertex program - <stateTexGenCoord> ::= "s" - | "t" - | "r" - | "q" -*/ -stateTexGenCoord - "s" .emit COMPONENT_X .or - "t" .emit COMPONENT_Y .or - "r" .emit COMPONENT_Z .or - "q" .emit COMPONENT_W; - -/* - <stateFogItem> ::= "fog" "." <stateFogProperty> -*/ -stateFogItem - "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY; - -/* - <stateFogProperty> ::= "color" - | "params" -*/ -stateFogProperty - "color" .emit FOG_COLOR .or - "params" .emit FOG_PARAMS; - -/* -fragment program - <stateDepthItem> ::= "depth" "." <stateDepthProperty> -*/ -stateDepthItem - "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY; - -/* -fragment program - <stateDepthProperty> ::= "range" -*/ -stateDepthProperty - "range" .emit DEPTH_RANGE; - -/* -vertex program - <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane" -*/ -stateClipPlaneItem - "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and - "plane" .error INVALID_CLIPPLANE_PROPERTY; - -/* -vertex program - <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1 -*/ -stateClipPlaneNum - integer; - -/* -vertex program - <statePointItem> ::= "point" "." <statePointProperty> -*/ -statePointItem - "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY; - -/* -vertex program - <statePointProperty> ::= "size" - | "attenuation" -*/ -statePointProperty - "size" .emit POINT_SIZE .or - .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION; - -/* - <stateMatrixRow> ::= <stateMatrixItem> "." "row" "[" - <stateMatrixRowNum> "]" -*/ -stateMatrixRow - stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and - lbracket .and stateMatrixRowNum .and rbracket .emit 0x0; - -/* - <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows> -*/ -stateMatrixRows - stateMatrixItem .and optMatrixRows; - -/* - <optMatrixRows> ::= "" - | "." "row" "[" <stateMatrixRowNum> ".." - <stateMatrixRowNum> "]" -*/ -optMatrixRows - optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $; -optMatrixRows_1 - dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and - stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket; - -/* - <stateMatrixItem> ::= "matrix" "." <stateMatrixName> - <stateOptMatModifier> -*/ -stateMatrixItem - "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier; - -/* - <stateOptMatModifier> ::= "" - | "." <stateMatModifier> -*/ -stateOptMatModifier - stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY; -stateOptMatModifier_1 - dot_ne .and stateMatModifier; - -/* - <stateMatModifier> ::= "inverse" - | "transpose" - | "invtrans" -*/ -stateMatModifier - "inverse" .emit MATRIX_MODIFIER_INVERSE .or - "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or - "invtrans" .emit MATRIX_MODIFIER_INVTRANS; - -/* - <stateMatrixRowNum> ::= <integer> from 0 to 3 -*/ -stateMatrixRowNum - integer_0_3; - -/* - <stateMatrixName> ::= "modelview" <stateOptModMatNum> - | "projection" - | "mvp" - | "texture" <optTexCoordNum> - | "palette" "[" <statePaletteMatNum> "]" - | "program" "[" <stateProgramMatNum> "]" -*/ -stateMatrixName - stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or - "projection" .emit MATRIX_PROJECTION .or - "mvp" .emit MATRIX_MVP .or - stateMatrixName_1_2 .emit MATRIX_TEXTURE .or - .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or - stateMatrixName_1_4 .emit MATRIX_PROGRAM; -stateMatrixName_1_1 - "modelview" .and stateOptModMatNum; -stateMatrixName_1_2 - "texture" .and optTexCoordNum; -stateMatrixName_1_3 - "palette" .and lbracket .and statePaletteMatNum .and rbracket; -stateMatrixName_1_4 - "program" .and lbracket .and stateProgramMatNum .and rbracket; - -/* - <stateOptModMatNum> ::= "" - | "[" <stateModMatNum> "]" -*/ -stateOptModMatNum - .if (vertex_blend != 0x00) stateOptModMatNum_1 .or - .true .emit 0x00; -stateOptModMatNum_1 - lbracket_ne .and stateModMatNum .and rbracket; - -/* - <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1 -*/ -stateModMatNum - integer; - -/* - <optTexCoordNum> ::= "" - | "[" <texCoordNum> "]" -*/ -optTexCoordNum - optTexCoordNum_1 .or .true .emit 0x00; -optTexCoordNum_1 - lbracket_ne .and texCoordNum .and rbracket; - -/* - <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1 -*/ -texCoordNum - integer; - -/* - <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1 -*/ -statePaletteMatNum - integer; - -/* - <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1 -*/ -stateProgramMatNum - integer; - -/* - <programSingleItem> ::= <progEnvParam> - | <progLocalParam> - -NOTE: <programSingleItem> has been modified for correct error handling. If program property - is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated. -*/ -programSingleItem - "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY; -programSingleItem_1 - progEnvParam .or progLocalParam; - -/* - <programMultipleItem> ::= <progEnvParams> - | <progLocalParams> - -NOTE: <programMultipleItem> has been modified for correct error handling. If program property - is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated. -*/ -programMultipleItem - "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY; -programMultipleItem_1 - progEnvParams .or progLocalParams; - -/* - <progEnvParams> ::= "program" "." "env" - "[" <progEnvParamNums> "]" - -NOTE: "program" "." has been moved to <programMultipleItem>. -*/ -progEnvParams - "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket; - -/* - <progEnvParamNums> ::= <progEnvParamNum> - | <progEnvParamNum> ".." <progEnvParamNum> -*/ -progEnvParamNums - progEnvParamNums_1 .or progEnvParamNums_2; -progEnvParamNums_1 - progEnvParamNum .and dotdot_ne .and progEnvParamNum; -progEnvParamNums_2 - progEnvParamNum .and .true .emit 0x00; - -/* - <progEnvParam> ::= "program" "." "env" - "[" <progEnvParamNum> "]" - -NOTE: "program" "." has been moved to <programSingleItem>. -*/ -progEnvParam - "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00; - -/* - <progLocalParams> ::= "program" "." "local" - "[" <progLocalParamNums> "]" - -NOTE: "program" "." has been moved to <programMultipleItem>. -*/ -progLocalParams - "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket; - -/* - <progLocalParamNums> ::= <progLocalParamNum> - | <progLocalParamNum> ".." <progLocalParamNum> -*/ -progLocalParamNums - progLocalParamNums_1 .or progLocalParamNums_2; -progLocalParamNums_1 - progLocalParamNum .and dotdot_ne .and progLocalParamNum; -progLocalParamNums_2 - progLocalParamNum .and .true .emit 0x00; - -/* - <progLocalParam> ::= "program" "." "local" - "[" <progLocalParamNum> "]" - -NOTE: "program" "." has been moved to <programSingleItem>. -*/ -progLocalParam - "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00; - -/* - <progEnvParamNum> ::= <integer> from 0 to - MAX_PROGRAM_ENV_PARAMETERS_ARB - 1 -*/ -progEnvParamNum - integer; - -/* - <progLocalParamNum> ::= <integer> from 0 to - MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1 -*/ -progLocalParamNum - integer; - -/* - <paramConstDecl> ::= <paramConstScalarDecl> - | <paramConstVector> -*/ -paramConstDecl - paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR; - -/* - <paramConstUse> ::= <paramConstScalarUse> - | <paramConstVector> -*/ -paramConstUse - paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR; - -/* - <paramConstScalarDecl> ::= <signedFloatConstant> -*/ -paramConstScalarDecl - signedFloatConstant; - -/* - <paramConstScalarUse> ::= <floatConstant> -*/ -paramConstScalarUse - floatConstant; - -/* - <paramConstVector> ::= "{" <signedFloatConstant> "}" - | "{" <signedFloatConstant> "," - <signedFloatConstant> "}" - | "{" <signedFloatConstant> "," - <signedFloatConstant> "," - <signedFloatConstant> "}" - | "{" <signedFloatConstant> "," - <signedFloatConstant> "," - <signedFloatConstant> "," - <signedFloatConstant> "}" -*/ -paramConstVector - paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or - paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01; -paramConstVector_1 - lbrace_ne .and signedFloatConstant .and rbrace; -paramConstVector_2 - lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace; -paramConstVector_3 - lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and - signedFloatConstant .and rbrace; -paramConstVector_4 - lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and - signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace; - -/* - <signedFloatConstant> ::= <optionalSign> <floatConstant> -*/ -signedFloatConstant - optionalSign .and floatConstant; - -/* - <floatConstant> ::= see text - The <floatConstant> rule matches a floating-point constant consisting - of an integer part, a decimal point, a fraction part, an "e" or - "E", and an optionally signed integer exponent. The integer and - fraction parts both consist of a sequence of one or more digits ("0" - through "9"). Either the integer part or the fraction parts (not - both) may be missing; either the decimal point or the "e" (or "E") - and the exponent (not both) may be missing. -*/ -floatConstant - float; - -/* - <optionalSign> ::= "" - | "-" - | "+" -*/ -optionalSign - optional_sign_ne; - -/* - <TEMP_statement> ::= "TEMP" <varNameList> -*/ -fp_TEMP_statement - "TEMP" .and space .and fp_varNameList .and .true .emit 0x00; -vp_TEMP_statement - "TEMP" .and space .and vp_varNameList .and .true .emit 0x00; - -/* -vertex program - <ADDRESS_statement> ::= "ADDRESS" <varNameList> -*/ -ADDRESS_statement - "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00; - -/* - <varNameList> ::= <establishName> - | <establishName> "," <varNameList> -*/ -fp_varNameList - fp_varNameList_1 .or fp_establishName; -vp_varNameList - vp_varNameList_1 .or vp_establishName; -fp_varNameList_1 - fp_establishName .and comma_ne .and fp_varNameList; -vp_varNameList_1 - vp_establishName .and comma_ne .and vp_varNameList; - -/* - <OUTPUT_statement> ::= "OUTPUT" <establishName> "=" - <resultBinding> -*/ -fp_OUTPUT_statement - "OUTPUT" .and space .and fp_establishName .and equal .and - fp_resultBinding .error RESULT_EXPECTED; -vp_OUTPUT_statement - "OUTPUT" .and space .and vp_establishName .and equal .and - vp_resultBinding .error RESULT_EXPECTED; - -/* -fragment program - <resultBinding> ::= "result" "." "color" - | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present) - | "result" "." "depth" - -vertex program - <resultBinding> ::= "result" "." "position" - | "result" "." <resultColBinding> - | "result" "." "fogcoord" - | "result" "." "pointsize" - | "result" "." "texcoord" <optTexCoordNum> -*/ -fp_resultBinding - "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY; -vp_resultBinding - "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY; -fp_resultBinding_1 - fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or - "depth" .emit FRAGMENT_RESULT_DEPTH; -fp_resultBinding_2 - "color" .and optOutputColorNum; -vp_resultBinding_1 - .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or - resultColBinding .emit VERTEX_RESULT_COLOR .or - "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or - "pointsize" .emit VERTEX_RESULT_POINTSIZE .or - vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD; -vp_resultBinding_2 - "texcoord" .and optTexCoordNum; - -/* -GL_ARB_draw_buffers - <optOutputColorNum> ::= "" - | "[" <outputColorNum> "]" -*/ -optOutputColorNum - .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00; -optOutputColorNum_1 - lbracket_ne .and outputColorNum .and rbracket; - -/* -GL_ARB_draw_buffers - <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1 -*/ -outputColorNum - integer; - -/* -vertex program - <resultColBinding> ::= "color" <optFaceType> <optColorType> -*/ -resultColBinding - "color" .and optFaceType .and optColorType; - -/* - <optFaceType> ::= "" - | "." "front" - | "." "back" -*/ -optFaceType - FaceType .or .true .emit FACE_FRONT; -FaceType - dot_ne .and FaceProperty; -FaceProperty - "front" .emit FACE_FRONT .or "back" .emit FACE_BACK; - -/* - <optColorType> ::= "" - | "." "primary" - | "." "secondary" -*/ -optColorType - ColorType .or .true .emit COLOR_PRIMARY; -ColorType - dot_ne .and ColorProperty; -ColorProperty - "primary" .emit COLOR_PRIMARY .or - .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY; - -/* - <ALIAS_statement> ::= "ALIAS" <establishName> "=" - <establishedName> -*/ -fp_ALIAS_statement - "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName; -vp_ALIAS_statement - "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName; -fp_ALIAS_statement_1 - space .and fp_establishName; -vp_ALIAS_statement_1 - space .and vp_establishName; - -/* - <establishName> ::= <identifier> -*/ -fp_establishName - fp_identifier; -vp_establishName - vp_identifier; - -/* - <establishedName> ::= <identifier> -*/ -fp_establishedName - fp_identifier; -vp_establishedName - vp_identifier; -fp_establishedName_no_error_on_identifier - fp_identifier_ne; -vp_establishedName_no_error_on_identifier - vp_identifier_ne; - -/* -fragment program - <identifier> ::= see text - The <identifier> rule matches a sequence of one or more letters ("A" - through "Z", "a" through "z"), digits ("0" through "9), underscores - ("_"), or dollar signs ("$"); the first character must not be a - number. Upper and lower case letters are considered different - (names are case-sensitive). The following strings are reserved - keywords and may not be used as identifiers: - - ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS, - COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT, - END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2, - LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT, - MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM, - POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS, - SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT, - TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT, - fragment, program, result, state, and texture. - -vertex program - <identifier> ::= see text - The <identifier> rule matches a sequence of one or more letters ("A" - through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"), - or dollar signs ("$"); the first character must not be a number. Upper - and lower case letters are considered different (names are - case-sensitive). The following strings are reserved keywords and may not - be used as identifiers: - - ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2, - EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT, - PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result, - state, and vertex. -*/ -fp_identifier - fp_identifier_ne .error IDENTIFIER_EXPECTED; -vp_identifier - vp_identifier_ne .error IDENTIFIER_EXPECTED; -fp_identifier_ne - fp_not_reserved_identifier .and identifier_ne; -vp_identifier_ne - vp_not_reserved_identifier .and identifier_ne; - -fp_not_reserved_identifier - fp_not_reserved_identifier_1 .or .true; -fp_not_reserved_identifier_1 - fp_reserved_identifier .and .false .error RESERVED_KEYWORD; -vp_not_reserved_identifier - vp_not_reserved_identifier_1 .or .true; -vp_not_reserved_identifier_1 - vp_reserved_identifier .and .false .error RESERVED_KEYWORD; - -fp_reserved_identifier - "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or - "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or - "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or - "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or - "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or - "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or - "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or - "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or - "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or - "fragment" .or "program" .or "result" .or "state" .or "texture"; -vp_reserved_identifier - "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or - "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or - "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or - "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or - "XPD" .or "program" .or "result" .or "state" .or "vertex"; - -/* - The <integer> rule matches an integer constant. The integer consists - of a sequence of one or more digits ("0" through "9"). -*/ -integer - integer_ne .error INTEGER_EXPECTED; - -zero - '0'; - -leading_zeroes - .loop zero; - -no_digit - no_digit_1 .or .true; -no_digit_1 - digit10 .and .false .error INTEGER_OUT_OF_RANGE; - -all_zeroes - all_zeroes_1 .or no_digit_1; -all_zeroes_1 - '0' .and .loop zero .and no_digit; - -integer_0_3 - integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $; -integer_0_3_1 - integer_0_3_2 .or all_zeroes .emit '0'; -integer_0_3_2 /* [1, 3] */ - leading_zeroes .and '1'-'3' .emit * .and no_digit; - -integer_0_63 - integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $; -integer_0_63_1 - integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or - all_zeroes .emit '0'; -integer_0_63_2 /* [7, 9] */ - leading_zeroes .and '7'-'9' .emit * .and no_digit; -integer_0_63_3 /* [10, 59] */ - leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit; -integer_0_63_4 /* [60, 63] */ - leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit; -integer_0_63_5 /* [1, 6] */ - leading_zeroes .and '1'-'6' .emit * .and no_digit; - -integer_0_64 - integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $; -integer_0_64_1 - integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or - all_zeroes .emit '0'; -integer_0_64_2 /* [7, 9] */ - leading_zeroes .and '7'-'9' .emit * .and no_digit; -integer_0_64_3 /* [10, 59] */ - leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit; -integer_0_64_4 /* [60, 64] */ - leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit; -integer_0_64_5 /* [1, 6] */ - leading_zeroes .and '1'-'6' .emit * .and no_digit; - -optional_space - space .or .true; - -space_dst - space .error OPERATION_NEEDS_DESTINATION_VARIABLE; - -space_src - space .error OPERATION_NEEDS_SOURCE_VARIABLE; - -space - single_space .and .loop single_space; - -single_space - white_char .or comment_block; - -white_char - ' ' .or '\t' .or '\n' .or '\r'; - -comment_block - '#' .and .loop comment_char .and optional_new_line; - -/* All ASCII characters except '\r', '\n' and '\0' */ -comment_char - '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C'; - -optional_new_line - '\n' .or crlf .or .true; - -crlf - '\r' .and '\n'; - -semicolon - optional_space .and ';' .error MISSING_SEMICOLON .and optional_space; - -comma - optional_space .and ',' .error MISSING_COMMA .and optional_space; - -comma_ne - optional_space .and ',' .and optional_space; - -lbracket - optional_space .and '[' .error MISSING_LBRACKET .and optional_space; - -lbracket_ne - optional_space .and '[' .and optional_space; - -rbracket - optional_space .and ']' .error MISSING_RBRACKET .and optional_space; - -dot - optional_space .and '.' .error MISSING_DOT .and optional_space; - -dot_ne - optional_space .and '.' .and optional_space; - -equal - optional_space .and '=' .error MISSING_EQUAL .and optional_space; - -lbrace - optional_space .and '{' .error MISSING_LBRACE .and optional_space; - -lbrace_ne - optional_space .and '{' .and optional_space; - -rbrace - optional_space .and '}' .error MISSING_RBRACE .and optional_space; - -dotdot - optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space; - -dotdot_ne - optional_space .and '.' .and '.' .and optional_space; - -/* - The definition below accepts the following floating point number formats: - .99 .99e99 99. 99.99 99.99e99 99.e99 99e99 - Also 99 format was considered and accepted because of a large number of existing program - strings with such a format. -*/ -float - float_1 .or float_2 .or float_legacy; -float_1 - '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent; -float_2 - integer_ne .and float_3; -float_3 - float_4 .or float_5; -float_4 - '.' .and optional_integer .and optional_exponent; -float_5 - exponent .emit 0x00; -float_legacy - integer_ne .and .true .emit 0x00 .emit 0x00; - -/* - Below is a correct version of <float> definiton. -*/ -/* -float - float_1 .or float_2; -float_1 - '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent; -float_2 - integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT; -float_3 - float_4 .or float_5; -float_4 - '.' .and optional_integer .and optional_exponent; -float_5 - exponent .emit 0x00; -*/ - -integer_ne - integer_ne_1 .and .true .emit 0x00 .emit $; -integer_ne_1 - digit10 .emit * .and .loop digit10 .emit *; - -optional_integer - integer_ne .or .true .emit 0x00; - -/* -NOTE: If exponent part is omited we treat it as if it was "E+1". -*/ -optional_exponent - exponent .or .true .emit 0x00; - -exponent - exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED; -exponent_1 - 'e' .or 'E'; - -optional_sign_ne - minus_ne .or plus_ne .or .true; - -plus_ne - optional_space .and '+' .and optional_space; - -minus_ne - optional_space .and '-' .emit '-' .and optional_space; - -identifier_ne - first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $; - -follow_idchar - first_idchar .or digit10; - -first_idchar - 'a'-'z' .or 'A'-'Z' .or '_' .or '$'; - -digit10 - '0'-'9'; - -/* - string filtering - if a string is encountered in grammar ("blabla"), the symbol below is - executed to create the string. The symbol must not throw any errors and emit bytes - it should - stop if it encounters invalid character. After this the resulting string (from starting - position up to the invalid character (but without it) is compared with the grammar string. -*/ -.string __string_filter; - -__string_filter - .loop __identifier_char; - -__identifier_char - 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9'; - -/* - error token filtering -*/ -e_signature - e_signature_char .and .loop e_signature_char; -e_signature_char - '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9'; - -e_statement - .loop e_statement_not_term; -/* All ASCII characters to one of '\r', '\n', '\0' and ';' */ -e_statement_not_term - '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C'; - -e_identifier - e_identifier_first .and .loop e_identifier_next; -e_identifier_first - 'a'-'z' .or 'A'-'Z' .or '_' .or '$'; -e_identifier_next - e_identifier_first .or '0'-'9'; - -e_token - e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or - '-' .or ',' .or ';'; -e_token_number - e_token_digit .and .loop e_token_digit; -e_token_digit - '0'-'9'; - -e_charordigit - 'A'-'Z' .or 'a'-'z' .or '0'-'9'; - diff --git a/src/mesa/shader/arbprogram_syn.h b/src/mesa/shader/arbprogram_syn.h deleted file mode 100644 index d95a5dede4a..00000000000 --- a/src/mesa/shader/arbprogram_syn.h +++ /dev/null @@ -1,1350 +0,0 @@ - -/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED FROM THE .syn FILE */ - -" \n" -".syntax program;\n" -".emtcode REVISION 0x0a\n" -".emtcode FRAGMENT_PROGRAM 0x01\n" -".emtcode VERTEX_PROGRAM 0x02\n" -".emtcode OPTION 0x01\n" -".emtcode INSTRUCTION 0x02\n" -".emtcode DECLARATION 0x03\n" -".emtcode END 0x04\n" -".emtcode ARB_PRECISION_HINT_FASTEST 0x00\n" -".emtcode ARB_PRECISION_HINT_NICEST 0x01\n" -".emtcode ARB_FOG_EXP 0x02\n" -".emtcode ARB_FOG_EXP2 0x03\n" -".emtcode ARB_FOG_LINEAR 0x04\n" -".emtcode ARB_POSITION_INVARIANT 0x05\n" -".emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06\n" -".emtcode ARB_DRAW_BUFFERS 0x07\n" -".emtcode MESA_TEXTURE_ARRAY 0x08\n" -".emtcode OP_ALU_INST 0x00\n" -".emtcode OP_TEX_INST 0x01\n" -".emtcode OP_ALU_VECTOR 0x00\n" -".emtcode OP_ALU_SCALAR 0x01\n" -".emtcode OP_ALU_BINSC 0x02\n" -".emtcode OP_ALU_BIN 0x03\n" -".emtcode OP_ALU_TRI 0x04\n" -".emtcode OP_ALU_SWZ 0x05\n" -".emtcode OP_TEX_SAMPLE 0x06\n" -".emtcode OP_TEX_KIL 0x07\n" -".emtcode OP_ALU_ARL 0x08\n" -".emtcode OP_ABS 0x00\n" -".emtcode OP_ABS_SAT 0x1B\n" -".emtcode OP_FLR 0x09\n" -".emtcode OP_FLR_SAT 0x26\n" -".emtcode OP_FRC 0x0A\n" -".emtcode OP_FRC_SAT 0x27\n" -".emtcode OP_LIT 0x0C\n" -".emtcode OP_LIT_SAT 0x2A\n" -".emtcode OP_MOV 0x11\n" -".emtcode OP_MOV_SAT 0x30\n" -".emtcode OP_COS 0x1F\n" -".emtcode OP_COS_SAT 0x20\n" -".emtcode OP_EX2 0x07\n" -".emtcode OP_EX2_SAT 0x25\n" -".emtcode OP_LG2 0x0B\n" -".emtcode OP_LG2_SAT 0x29\n" -".emtcode OP_RCP 0x14\n" -".emtcode OP_RCP_SAT 0x33\n" -".emtcode OP_RSQ 0x15\n" -".emtcode OP_RSQ_SAT 0x34\n" -".emtcode OP_SIN 0x38\n" -".emtcode OP_SIN_SAT 0x39\n" -".emtcode OP_SCS 0x35\n" -".emtcode OP_SCS_SAT 0x36\n" -".emtcode OP_POW 0x13\n" -".emtcode OP_POW_SAT 0x32\n" -".emtcode OP_ADD 0x01\n" -".emtcode OP_ADD_SAT 0x1C\n" -".emtcode OP_DP3 0x03\n" -".emtcode OP_DP3_SAT 0x21\n" -".emtcode OP_DP4 0x04\n" -".emtcode OP_DP4_SAT 0x22\n" -".emtcode OP_DPH 0x05\n" -".emtcode OP_DPH_SAT 0x23\n" -".emtcode OP_DST 0x06\n" -".emtcode OP_DST_SAT 0x24\n" -".emtcode OP_MAX 0x0F\n" -".emtcode OP_MAX_SAT 0x2E\n" -".emtcode OP_MIN 0x10\n" -".emtcode OP_MIN_SAT 0x2F\n" -".emtcode OP_MUL 0x12\n" -".emtcode OP_MUL_SAT 0x31\n" -".emtcode OP_SGE 0x16\n" -".emtcode OP_SGE_SAT 0x37\n" -".emtcode OP_SLT 0x17\n" -".emtcode OP_SLT_SAT 0x3A\n" -".emtcode OP_SUB 0x18\n" -".emtcode OP_SUB_SAT 0x3B\n" -".emtcode OP_XPD 0x1A\n" -".emtcode OP_XPD_SAT 0x43\n" -".emtcode OP_CMP 0x1D\n" -".emtcode OP_CMP_SAT 0x1E\n" -".emtcode OP_LRP 0x2B\n" -".emtcode OP_LRP_SAT 0x2C\n" -".emtcode OP_MAD 0x0E\n" -".emtcode OP_MAD_SAT 0x2D\n" -".emtcode OP_SWZ 0x19\n" -".emtcode OP_SWZ_SAT 0x3C\n" -".emtcode OP_TEX 0x3D\n" -".emtcode OP_TEX_SAT 0x3E\n" -".emtcode OP_TXB 0x3F\n" -".emtcode OP_TXB_SAT 0x40\n" -".emtcode OP_TXP 0x41\n" -".emtcode OP_TXP_SAT 0x42\n" -".emtcode OP_KIL 0x28\n" -".emtcode OP_ARL 0x02\n" -".emtcode OP_EXP 0x08\n" -".emtcode OP_LOG 0x0D\n" -".emtcode FRAGMENT_ATTRIB_COLOR 0x01\n" -".emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02\n" -".emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03\n" -".emtcode FRAGMENT_ATTRIB_POSITION 0x04\n" -".emtcode VERTEX_ATTRIB_POSITION 0x01\n" -".emtcode VERTEX_ATTRIB_WEIGHT 0x02\n" -".emtcode VERTEX_ATTRIB_NORMAL 0x03\n" -".emtcode VERTEX_ATTRIB_COLOR 0x04\n" -".emtcode VERTEX_ATTRIB_FOGCOORD 0x05\n" -".emtcode VERTEX_ATTRIB_TEXCOORD 0x06\n" -".emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07\n" -".emtcode VERTEX_ATTRIB_GENERIC 0x08\n" -".emtcode FRAGMENT_RESULT_COLOR 0x01\n" -".emtcode FRAGMENT_RESULT_DEPTH 0x02\n" -".emtcode VERTEX_RESULT_POSITION 0x01\n" -".emtcode VERTEX_RESULT_COLOR 0x02\n" -".emtcode VERTEX_RESULT_FOGCOORD 0x03\n" -".emtcode VERTEX_RESULT_POINTSIZE 0x04\n" -".emtcode VERTEX_RESULT_TEXCOORD 0x05\n" -".emtcode TEXTARGET_1D 0x01\n" -".emtcode TEXTARGET_2D 0x02\n" -".emtcode TEXTARGET_3D 0x03\n" -".emtcode TEXTARGET_RECT 0x04\n" -".emtcode TEXTARGET_CUBE 0x05\n" -".emtcode TEXTARGET_SHADOW1D 0x06\n" -".emtcode TEXTARGET_SHADOW2D 0x07\n" -".emtcode TEXTARGET_SHADOWRECT 0x08\n" -".emtcode TEXTARGET_1D_ARRAY 0x09\n" -".emtcode TEXTARGET_2D_ARRAY 0x0a\n" -".emtcode TEXTARGET_SHADOW1D_ARRAY 0x0b\n" -".emtcode TEXTARGET_SHADOW2D_ARRAY 0x0c\n" -".emtcode FACE_FRONT 0x00\n" -".emtcode FACE_BACK 0x01\n" -".emtcode COLOR_PRIMARY 0x00\n" -".emtcode COLOR_SECONDARY 0x01\n" -".emtcode COMPONENT_X 0x00\n" -".emtcode COMPONENT_Y 0x01\n" -".emtcode COMPONENT_Z 0x02\n" -".emtcode COMPONENT_W 0x03\n" -".emtcode COMPONENT_0 0x04\n" -".emtcode COMPONENT_1 0x05\n" -".emtcode ARRAY_INDEX_ABSOLUTE 0x00\n" -".emtcode ARRAY_INDEX_RELATIVE 0x01\n" -".emtcode MATRIX_MODELVIEW 0x01\n" -".emtcode MATRIX_PROJECTION 0x02\n" -".emtcode MATRIX_MVP 0x03\n" -".emtcode MATRIX_TEXTURE 0x04\n" -".emtcode MATRIX_PALETTE 0x05\n" -".emtcode MATRIX_PROGRAM 0x06\n" -".emtcode MATRIX_MODIFIER_IDENTITY 0x00\n" -".emtcode MATRIX_MODIFIER_INVERSE 0x01\n" -".emtcode MATRIX_MODIFIER_TRANSPOSE 0x02\n" -".emtcode MATRIX_MODIFIER_INVTRANS 0x03\n" -".emtcode CONSTANT_SCALAR 0x01\n" -".emtcode CONSTANT_VECTOR 0x02\n" -".emtcode PROGRAM_PARAM_ENV 0x01\n" -".emtcode PROGRAM_PARAM_LOCAL 0x02\n" -".emtcode REGISTER_ATTRIB 0x01\n" -".emtcode REGISTER_PARAM 0x02\n" -".emtcode REGISTER_RESULT 0x03\n" -".emtcode REGISTER_ESTABLISHED_NAME 0x04\n" -".emtcode PARAM_NULL 0x00\n" -".emtcode PARAM_ARRAY_ELEMENT 0x01\n" -".emtcode PARAM_STATE_ELEMENT 0x02\n" -".emtcode PARAM_PROGRAM_ELEMENT 0x03\n" -".emtcode PARAM_PROGRAM_ELEMENTS 0x04\n" -".emtcode PARAM_CONSTANT 0x05\n" -".emtcode STATE_MATERIAL 0x01\n" -".emtcode STATE_LIGHT 0x02\n" -".emtcode STATE_LIGHT_MODEL 0x03\n" -".emtcode STATE_LIGHT_PROD 0x04\n" -".emtcode STATE_FOG 0x05\n" -".emtcode STATE_MATRIX_ROWS 0x06\n" -".emtcode STATE_TEX_ENV 0x07\n" -".emtcode STATE_DEPTH 0x08\n" -".emtcode STATE_TEX_GEN 0x09\n" -".emtcode STATE_CLIP_PLANE 0x0A\n" -".emtcode STATE_POINT 0x0B\n" -".emtcode MATERIAL_AMBIENT 0x01\n" -".emtcode MATERIAL_DIFFUSE 0x02\n" -".emtcode MATERIAL_SPECULAR 0x03\n" -".emtcode MATERIAL_EMISSION 0x04\n" -".emtcode MATERIAL_SHININESS 0x05\n" -".emtcode LIGHT_AMBIENT 0x01\n" -".emtcode LIGHT_DIFFUSE 0x02\n" -".emtcode LIGHT_SPECULAR 0x03\n" -".emtcode LIGHT_POSITION 0x04\n" -".emtcode LIGHT_ATTENUATION 0x05\n" -".emtcode LIGHT_HALF 0x06\n" -".emtcode LIGHT_SPOT_DIRECTION 0x07\n" -".emtcode LIGHT_MODEL_AMBIENT 0x01\n" -".emtcode LIGHT_MODEL_SCENECOLOR 0x02\n" -".emtcode LIGHT_PROD_AMBIENT 0x01\n" -".emtcode LIGHT_PROD_DIFFUSE 0x02\n" -".emtcode LIGHT_PROD_SPECULAR 0x03\n" -".emtcode TEX_ENV_COLOR 0x01\n" -".emtcode TEX_GEN_EYE 0x01\n" -".emtcode TEX_GEN_OBJECT 0x02\n" -".emtcode FOG_COLOR 0x01\n" -".emtcode FOG_PARAMS 0x02\n" -".emtcode DEPTH_RANGE 0x01\n" -".emtcode POINT_SIZE 0x01\n" -".emtcode POINT_ATTENUATION 0x02\n" -".emtcode ATTRIB 0x01\n" -".emtcode PARAM 0x02\n" -".emtcode TEMP 0x03\n" -".emtcode OUTPUT 0x04\n" -".emtcode ALIAS 0x05\n" -".emtcode ADDRESS 0x06\n" -".errtext UNKNOWN_PROGRAM_SIGNATURE \"1001: '$e_signature$': unknown program signature\"\n" -".errtext MISSING_END_OR_INVALID_STATEMENT \"1002: '$e_statement$': invalid statement\"\n" -".errtext CODE_AFTER_END \"1003: '$e_statement$': code after 'END' keyword\"\n" -".errtext INVALID_PROGRAM_OPTION \"1004: '$e_identifier$': invalid program option\"\n" -".errtext EXT_SWIZ_COMP_EXPECTED \"1005: extended swizzle component expected but '$e_token$' found\"\n" -".errtext TEX_TARGET_EXPECTED \"1006: texture target expected but '$e_token$' found\"\n" -".errtext TEXTURE_EXPECTED \"1007: 'texture' expected but '$e_identifier$' found\"\n" -".errtext SOURCE_REGISTER_EXPECTED \"1008: source register expected but '$e_token$' found\"\n" -".errtext DESTINATION_REGISTER_EXPECTED \"1009: destination register expected but '$e_token$' found\"\n" -".errtext INVALID_ADDRESS_COMPONENT \"1010: '$e_identifier$': invalid address component\"\n" -".errtext INVALID_ADDRESS_WRITEMASK \"1011: '$e_identifier$': invalid address writemask\"\n" -".errtext INVALID_COMPONENT \"1012: '$e_charordigit$': invalid component\"\n" -".errtext INVALID_SUFFIX \"1013: '$e_identifier$': invalid suffix\"\n" -".errtext INVALID_WRITEMASK \"1014: '$e_identifier$': invalid writemask\"\n" -".errtext FRAGMENT_EXPECTED \"1015: 'fragment' expected but '$e_identifier$' found\"\n" -".errtext VERTEX_EXPECTED \"1016: 'vertex' expected but '$e_identifier$' found\"\n" -".errtext INVALID_FRAGMENT_PROPERTY \"1017: '$e_identifier$': invalid fragment property\"\n" -".errtext INVALID_VERTEX_PROPERTY \"1018: '$e_identifier$': invalid vertex property\"\n" -".errtext INVALID_STATE_PROPERTY \"1019: '$e_identifier$': invalid state property\"\n" -".errtext INVALID_MATERIAL_PROPERTY \"1020: '$e_identifier$': invalid material property\"\n" -".errtext INVALID_LIGHT_PROPERTY \"1021: '$e_identifier$': invalid light property\"\n" -".errtext INVALID_SPOT_PROPERTY \"1022: '$e_identifier$': invalid spot property\"\n" -".errtext INVALID_LIGHTMODEL_PROPERTY \"1023: '$e_identifier$': invalid light model property\"\n" -".errtext INVALID_LIGHTPROD_PROPERTY \"1024: '$e_identifier$': invalid light product property\"\n" -".errtext INVALID_TEXENV_PROPERTY \"1025: '$e_identifier$': invalid texture environment property\"\n" -".errtext INVALID_TEXGEN_PROPERTY \"1026: '$e_identifier$': invalid texture generating property\"\n" -".errtext INVALID_TEXGEN_COORD \"1027: '$e_identifier$': invalid texture generating coord\"\n" -".errtext INVALID_FOG_PROPERTY \"1028: '$e_identifier$': invalid fog property\"\n" -".errtext INVALID_DEPTH_PROPERTY \"1029: '$e_identifier$': invalid depth property\"\n" -".errtext INVALID_CLIPPLANE_PROPERTY \"1030: '$e_identifier$': invalid clip plane property\"\n" -".errtext INVALID_POINT_PROPERTY \"1031: '$e_identifier$': invalid point property\"\n" -".errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED \"1032: matrix row selector or modifier expected but '$e_token$' found\"\n" -".errtext INVALID_MATRIX_NAME \"1033: '$e_identifier$': invalid matrix name\"\n" -".errtext INVALID_PROGRAM_PROPERTY \"1034: '$e_identifier$': invalid program property\"\n" -".errtext RESULT_EXPECTED \"1035: 'result' expected but '$e_token$' found\"\n" -".errtext INVALID_RESULT_PROPERTY \"1036: '$e_identifier$': invalid result property\"\n" -".errtext INVALID_FACE_PROPERTY \"1037: '$e_identifier$': invalid face property\"\n" -".errtext INVALID_COLOR_PROPERTY \"1038: '$e_identifier$': invalid color property\"\n" -".errtext IDENTIFIER_EXPECTED \"1039: identifier expected but '$e_token$' found\"\n" -".errtext RESERVED_KEYWORD \"1040: use of reserved keyword as an identifier\"\n" -".errtext INTEGER_EXPECTED \"1041: integer value expected but '$e_token$' found\"\n" -".errtext MISSING_SEMICOLON \"1042: ';' expected but '$e_token$' found\"\n" -".errtext MISSING_COMMA \"1043: ',' expected but '$e_token$' found\"\n" -".errtext MISSING_LBRACKET \"1044: '[' expected but '$e_token$' found\"\n" -".errtext MISSING_RBRACKET \"1045: ']' expected but '$e_token$' found\"\n" -".errtext MISSING_DOT \"1046: '.' expected but '$e_token$' found\"\n" -".errtext MISSING_EQUAL \"1047: '=' expected but '$e_token$' found\"\n" -".errtext MISSING_LBRACE \"1048: '{' expected but '$e_token$' found\"\n" -".errtext MISSING_RBRACE \"1049: '}' expected but '$e_token$' found\"\n" -".errtext MISSING_DOTDOT \"1050: '..' expected but '$e_token$' found\"\n" -".errtext MISSING_FRACTION_OR_EXPONENT \"1051: missing fraction part or exponent\"\n" -".errtext MISSING_DOT_OR_EXPONENT \"1052: missing '.' or exponent\"\n" -".errtext EXPONENT_VALUE_EXPECTED \"1053: exponent value expected\"\n" -".errtext INTEGER_OUT_OF_RANGE \"1054: integer value out of range\"\n" -".errtext OPERATION_NEEDS_DESTINATION_VARIABLE \"1055: operation needs destination variable\"\n" -".errtext OPERATION_NEEDS_SOURCE_VARIABLE \"1056: operation needs source variable\"\n" -".errtext ADDRESS_REGISTER_EXPECTED \"1057: address register expected but '$e_token$' found\"\n" -".errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED \"1058: address register or integer literal expected but '$e_token$' found\"\n" -".regbyte vertex_blend 0x00\n" -".regbyte matrix_palette 0x00\n" -".regbyte point_parameters 0x00\n" -".regbyte secondary_color 0x00\n" -".regbyte fog_coord 0x00\n" -".regbyte texture_rectangle 0x00\n" -".regbyte fragment_program_shadow 0x00\n" -".regbyte draw_buffers 0x00\n" -".regbyte texture_array 0x00\n" -".regbyte ARB_precision_hint_fastest 0x00\n" -".regbyte ARB_precision_hint_nicest 0x00\n" -".regbyte ARB_fog_exp 0x00\n" -".regbyte ARB_fog_exp2 0x00\n" -".regbyte ARB_fog_linear 0x00\n" -".regbyte ARB_position_invariant 0x00\n" -".regbyte ARB_fragment_program_shadow 0x00\n" -".regbyte ARB_draw_buffers 0x00\n" -".regbyte MESA_texture_array 0x00\n" -".regbyte program_target 0x00\n" -"program\n" -" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n" -"programs\n" -" .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or\n" -" .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;\n" -"frag_program_1_0\n" -" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and\n" -" optional_space .and fp_optionSequence .and fp_statementSequence .and\n" -" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" -" '\\0' .error CODE_AFTER_END;\n" -"vert_program_1_0\n" -" '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and\n" -" optional_space .and vp_optionSequence .and vp_statementSequence .and\n" -" \"END\" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and\n" -" '\\0' .error CODE_AFTER_END;\n" -"fp_optionSequence\n" -" .loop fp_option;\n" -"vp_optionSequence\n" -" .loop vp_option;\n" -"fp_option\n" -" \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" -" fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" -"vp_option\n" -" \"OPTION\" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and\n" -" vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;\n" -"fp_optionString\n" -" .if (ARB_precision_hint_nicest == 0x00) \"ARB_precision_hint_fastest\"\n" -" .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or\n" -" .if (ARB_precision_hint_fastest == 0x00) \"ARB_precision_hint_nicest\"\n" -" .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or\n" -" fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or\n" -" fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or\n" -" fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or\n" -" .if (fragment_program_shadow != 0x00) \"ARB_fragment_program_shadow\"\n" -" .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or\n" -" .if (draw_buffers != 0x00) \"ARB_draw_buffers\" .emit ARB_DRAW_BUFFERS\n" -" .load ARB_draw_buffers 0x01 .or\n" -" .if (texture_array != 0x00) \"MESA_texture_array\" .emit MESA_TEXTURE_ARRAY\n" -" .load MESA_texture_array 0x01;\n" -"vp_optionString\n" -" \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;\n" -"fp_ARB_fog_exp\n" -" .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp\";\n" -"fp_ARB_fog_exp2\n" -" .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) \"ARB_fog_exp2\";\n" -"fp_ARB_fog_linear\n" -" .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) \"ARB_fog_linear\";\n" -"fp_statementSequence\n" -" .loop fp_statement;\n" -"vp_statementSequence\n" -" .loop vp_statement;\n" -"fp_statement\n" -" fp_statement_1 .or fp_statement_2;\n" -"vp_statement\n" -" vp_statement_1 .or vp_statement_2;\n" -"fp_statement_1\n" -" fp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" -"fp_statement_2\n" -" fp_namingStatement .emit DECLARATION .and semicolon;\n" -"vp_statement_1\n" -" vp_instruction .emit INSTRUCTION .emit $ .and semicolon;\n" -"vp_statement_2\n" -" vp_namingStatement .emit DECLARATION .and semicolon;\n" -"fp_instruction\n" -" ALUInstruction .emit OP_ALU_INST .or\n" -" TexInstruction .emit OP_TEX_INST;\n" -"vp_instruction\n" -" ARL_instruction .emit OP_ALU_ARL .or\n" -" vp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" -" vp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" -" vp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" -" vp_BINop_instruction .emit OP_ALU_BIN .or\n" -" vp_TRIop_instruction .emit OP_ALU_TRI .or\n" -" vp_SWZ_instruction .emit OP_ALU_SWZ;\n" -"ALUInstruction\n" -" fp_VECTORop_instruction .emit OP_ALU_VECTOR .or\n" -" fp_SCALARop_instruction .emit OP_ALU_SCALAR .or\n" -" fp_BINSCop_instruction .emit OP_ALU_BINSC .or\n" -" fp_BINop_instruction .emit OP_ALU_BIN .or\n" -" fp_TRIop_instruction .emit OP_ALU_TRI .or\n" -" fp_SWZ_instruction .emit OP_ALU_SWZ;\n" -"TexInstruction\n" -" SAMPLE_instruction .emit OP_TEX_SAMPLE .or\n" -" KIL_instruction .emit OP_TEX_KIL;\n" -"ARL_instruction\n" -" \"ARL\" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;\n" -"fp_VECTORop_instruction\n" -" fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;\n" -"vp_VECTORop_instruction\n" -" vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;\n" -"fp_VECTORop\n" -" \"ABS\" .emit OP_ABS .or \"ABS_SAT\" .emit OP_ABS_SAT .or\n" -" \"FLR\" .emit OP_FLR .or \"FLR_SAT\" .emit OP_FLR_SAT .or\n" -" \"FRC\" .emit OP_FRC .or \"FRC_SAT\" .emit OP_FRC_SAT .or\n" -" \"LIT\" .emit OP_LIT .or \"LIT_SAT\" .emit OP_LIT_SAT .or\n" -" \"MOV\" .emit OP_MOV .or \"MOV_SAT\" .emit OP_MOV_SAT;\n" -"vp_VECTORop\n" -" \"ABS\" .emit OP_ABS .or\n" -" \"FLR\" .emit OP_FLR .or\n" -" \"FRC\" .emit OP_FRC .or\n" -" \"LIT\" .emit OP_LIT .or\n" -" \"MOV\" .emit OP_MOV;\n" -"fp_SCALARop_instruction\n" -" fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;\n" -"vp_SCALARop_instruction\n" -" vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;\n" -"fp_SCALARop\n" -" \"COS\" .emit OP_COS .or \"COS_SAT\" .emit OP_COS_SAT .or\n" -" \"EX2\" .emit OP_EX2 .or \"EX2_SAT\" .emit OP_EX2_SAT .or\n" -" \"LG2\" .emit OP_LG2 .or \"LG2_SAT\" .emit OP_LG2_SAT .or\n" -" \"RCP\" .emit OP_RCP .or \"RCP_SAT\" .emit OP_RCP_SAT .or\n" -" \"RSQ\" .emit OP_RSQ .or \"RSQ_SAT\" .emit OP_RSQ_SAT .or\n" -" \"SIN\" .emit OP_SIN .or \"SIN_SAT\" .emit OP_SIN_SAT .or\n" -" \"SCS\" .emit OP_SCS .or \"SCS_SAT\" .emit OP_SCS_SAT;\n" -"vp_SCALARop\n" -" \"EX2\" .emit OP_EX2 .or\n" -" \"EXP\" .emit OP_EXP .or\n" -" \"LG2\" .emit OP_LG2 .or\n" -" \"LOG\" .emit OP_LOG .or\n" -" \"RCP\" .emit OP_RCP .or\n" -" \"RSQ\" .emit OP_RSQ;\n" -"fp_BINSCop_instruction\n" -" fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and\n" -" fp_scalarSrcReg;\n" -"vp_BINSCop_instruction\n" -" vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and\n" -" vp_scalarSrcReg;\n" -"fp_BINSCop\n" -" \"POW\" .emit OP_POW .or \"POW_SAT\" .emit OP_POW_SAT;\n" -"vp_BINSCop\n" -" \"POW\" .emit OP_POW;\n" -"fp_BINop_instruction\n" -" fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" -" vectorSrcReg;\n" -"vp_BINop_instruction\n" -" vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" -" swizzleSrcReg;\n" -"fp_BINop\n" -" \"ADD\" .emit OP_ADD .or \"ADD_SAT\" .emit OP_ADD_SAT .or\n" -" \"DP3\" .emit OP_DP3 .or \"DP3_SAT\" .emit OP_DP3_SAT .or\n" -" \"DP4\" .emit OP_DP4 .or \"DP4_SAT\" .emit OP_DP4_SAT .or\n" -" \"DPH\" .emit OP_DPH .or \"DPH_SAT\" .emit OP_DPH_SAT .or\n" -" \"DST\" .emit OP_DST .or \"DST_SAT\" .emit OP_DST_SAT .or\n" -" \"MAX\" .emit OP_MAX .or \"MAX_SAT\" .emit OP_MAX_SAT .or\n" -" \"MIN\" .emit OP_MIN .or \"MIN_SAT\" .emit OP_MIN_SAT .or\n" -" \"MUL\" .emit OP_MUL .or \"MUL_SAT\" .emit OP_MUL_SAT .or\n" -" \"SGE\" .emit OP_SGE .or \"SGE_SAT\" .emit OP_SGE_SAT .or\n" -" \"SLT\" .emit OP_SLT .or \"SLT_SAT\" .emit OP_SLT_SAT .or\n" -" \"SUB\" .emit OP_SUB .or \"SUB_SAT\" .emit OP_SUB_SAT .or\n" -" \"XPD\" .emit OP_XPD .or \"XPD_SAT\" .emit OP_XPD_SAT;\n" -"vp_BINop\n" -" \"ADD\" .emit OP_ADD .or\n" -" \"DP3\" .emit OP_DP3 .or\n" -" \"DP4\" .emit OP_DP4 .or\n" -" \"DPH\" .emit OP_DPH .or\n" -" \"DST\" .emit OP_DST .or\n" -" \"MAX\" .emit OP_MAX .or\n" -" \"MIN\" .emit OP_MIN .or\n" -" \"MUL\" .emit OP_MUL .or\n" -" \"SGE\" .emit OP_SGE .or\n" -" \"SLT\" .emit OP_SLT .or\n" -" \"SUB\" .emit OP_SUB .or\n" -" \"XPD\" .emit OP_XPD;\n" -"fp_TRIop_instruction\n" -" fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" -" vectorSrcReg .and comma .and vectorSrcReg;\n" -"vp_TRIop_instruction\n" -" vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and\n" -" swizzleSrcReg .and comma .and swizzleSrcReg;\n" -"fp_TRIop\n" -" \"CMP\" .emit OP_CMP .or \"CMP_SAT\" .emit OP_CMP_SAT .or\n" -" \"LRP\" .emit OP_LRP .or \"LRP_SAT\" .emit OP_LRP_SAT .or\n" -" \"MAD\" .emit OP_MAD .or \"MAD_SAT\" .emit OP_MAD_SAT;\n" -"vp_TRIop\n" -" \"MAD\" .emit OP_MAD;\n" -"fp_SWZ_instruction\n" -" SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and\n" -" fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" -"vp_SWZ_instruction\n" -" \"SWZ\" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and\n" -" vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;\n" -"SWZop\n" -" \"SWZ\" .emit OP_SWZ .or \"SWZ_SAT\" .emit OP_SWZ_SAT;\n" -"SAMPLE_instruction\n" -" SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and\n" -" texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;\n" -"SAMPLEop\n" -" \"TEX\" .emit OP_TEX .or \"TEX_SAT\" .emit OP_TEX_SAT .or\n" -" \"TXB\" .emit OP_TXB .or \"TXB_SAT\" .emit OP_TXB_SAT .or\n" -" \"TXP\" .emit OP_TXP .or \"TXP_SAT\" .emit OP_TXP_SAT;\n" -"KIL_instruction\n" -" \"KIL\" .emit OP_KIL .and space_src .and vectorSrcReg;\n" -"texImageUnit\n" -" \"texture\" .error TEXTURE_EXPECTED .and optTexImageUnitNum;\n" -"texTarget\n" -" \"1D\" .emit TEXTARGET_1D .or\n" -" \"2D\" .emit TEXTARGET_2D .or\n" -" \"3D\" .emit TEXTARGET_3D .or\n" -" .if (texture_rectangle != 0x00) \"RECT\" .emit TEXTARGET_RECT .or\n" -" \"CUBE\" .emit TEXTARGET_CUBE .or\n" -" .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or\n" -" .if (MESA_texture_array != 0x00) arrayTarget;\n" -"shadowTarget\n" -" \"SHADOW1D\" .emit TEXTARGET_SHADOW1D .or\n" -" \"SHADOW2D\" .emit TEXTARGET_SHADOW2D .or\n" -" .if (texture_rectangle != 0x00) \"SHADOWRECT\" .emit TEXTARGET_SHADOWRECT .or\n" -" .if (MESA_texture_array != 0x00) shadowArrayTarget;\n" -"arrayTarget\n" -" \"ARRAY1D\" .emit TEXTARGET_1D_ARRAY .or\n" -" \"ARRAY2D\" .emit TEXTARGET_2D_ARRAY;\n" -"shadowArrayTarget\n" -" \"SHADOWARRAY1D\" .emit TEXTARGET_SHADOW1D_ARRAY .or\n" -" \"SHADOWARRAY2D\" .emit TEXTARGET_SHADOW2D_ARRAY;\n" -"optTexImageUnitNum\n" -" optTexImageUnitNum_1 .or .true .emit 0x00;\n" -"optTexImageUnitNum_1\n" -" lbracket_ne .and texImageUnitNum .and rbracket;\n" -"texImageUnitNum\n" -" integer;\n" -"fp_scalarSrcReg\n" -" optionalSign .and fp_srcReg .and fp_scalarSuffix;\n" -"vp_scalarSrcReg\n" -" optionalSign .and vp_srcReg .and vp_scalarSuffix;\n" -"swizzleSrcReg\n" -" optionalSign .and vp_srcReg .and swizzleSuffix;\n" -"vectorSrcReg\n" -" optionalSign .and fp_srcReg .and optionalSuffix;\n" -"fp_maskedDstReg\n" -" fp_dstReg .and fp_optionalMask;\n" -"vp_maskedDstReg\n" -" vp_dstReg .and vp_optionalMask;\n" -"maskedAddrReg\n" -" addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;\n" -"fp_extendedSwizzle\n" -" rgbaExtendedSwizzle .or xyzwExtendedSwizzle;\n" -"vp_extendedSwizzle\n" -" extSwizComp .and comma .and\n" -" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" extSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" -"xyzwExtendedSwizzle\n" -" xyzwExtSwizComp .and comma .and\n" -" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" -"rgbaExtendedSwizzle\n" -" rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or\n" -" rgbaExtendedSwizzle_4;\n" -"rgbaExtendedSwizzle_1\n" -" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" -" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;\n" -"rgbaExtendedSwizzle_2\n" -" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and\n" -" rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" -"rgbaExtendedSwizzle_3\n" -" rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and\n" -" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" -"rgbaExtendedSwizzle_4\n" -" rgbaExtSwizComp_alpha .and comma .and \n" -"rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and\n" -" rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;\n" -"xyzwExtSwizComp\n" -" optionalSign .and xyzwExtSwizSel;\n" -"rgbaExtSwizComp\n" -" optionalSign .and rgbaExtSwizSel;\n" -"rgbaExtSwizComp_digit\n" -" optionalSign .and rgbaExtSwizSel_digit;\n" -"rgbaExtSwizComp_alpha\n" -" optionalSign .and rgbaExtSwizSel_alpha;\n" -"extSwizComp\n" -" optionalSign .and extSwizSel;\n" -"xyzwExtSwizSel\n" -" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or xyzwComponent_single;\n" -"rgbaExtSwizSel\n" -" rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;\n" -"rgbaExtSwizSel_digit\n" -" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1;\n" -"rgbaExtSwizSel_alpha\n" -" rgbaComponent_single;\n" -"extSwizSel\n" -" \"0\" .emit COMPONENT_0 .or \"1\" .emit COMPONENT_1 .or vp_component_single;\n" -"fp_srcReg\n" -" fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" -"vp_srcReg\n" -" vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;\n" -"fp_srcReg_1\n" -" fragmentAttribReg .emit REGISTER_ATTRIB .or\n" -" fp_progParamReg .emit REGISTER_PARAM .or\n" -" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" -"vp_srcReg_1\n" -" vertexAttribReg .emit REGISTER_ATTRIB .or\n" -" vp_progParamReg .emit REGISTER_PARAM .or\n" -" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" -"fp_dstReg\n" -" fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" -"vp_dstReg\n" -" vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;\n" -"fp_dstReg_1\n" -" fragmentResultReg .emit REGISTER_RESULT .or\n" -" fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" -"vp_dstReg_1\n" -" vertexResultReg .emit REGISTER_RESULT .or\n" -" vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;\n" -"fragmentAttribReg\n" -" fragAttribBinding;\n" -"vertexAttribReg\n" -" vtxAttribBinding;\n" -"fp_temporaryReg\n" -" fp_establishedName_no_error_on_identifier;\n" -"vp_temporaryReg\n" -" vp_establishedName_no_error_on_identifier;\n" -"fp_progParamReg\n" -" fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;\n" -"vp_progParamReg\n" -" vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;\n" -"fp_progParamReg_1\n" -" fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and\n" -" rbracket;\n" -"vp_progParamReg_1\n" -" vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and\n" -" rbracket;\n" -"fp_progParamSingle\n" -" .false;\n" -"vp_progParamSingle\n" -" .false;\n" -"fp_progParamArray\n" -" fp_establishedName_no_error_on_identifier;\n" -"vp_progParamArray\n" -" vp_establishedName_no_error_on_identifier;\n" -"progParamArrayMem\n" -" progParamArrayAbs .or progParamArrayRel;\n" -"progParamArrayAbs\n" -" integer_ne .emit ARRAY_INDEX_ABSOLUTE;\n" -"progParamArrayRel\n" -" addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and\n" -" addrComponent .and addrRegRelOffset;\n" -"addrRegRelOffset\n" -" addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;\n" -"addrRegRelOffset_1\n" -" plus_ne .and addrRegPosOffset;\n" -"addrRegRelOffset_2\n" -" minus_ne .and addrRegNegOffset;\n" -"addrRegPosOffset\n" -" integer_0_63;\n" -"addrRegNegOffset\n" -" integer_0_64;\n" -"fragmentResultReg\n" -" fp_resultBinding;\n" -"vertexResultReg\n" -" vp_resultBinding;\n" -"addrReg\n" -" vp_establishedName_no_error_on_identifier;\n" -"addrComponent\n" -" dot .and \"x\" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X\n" -" .emit COMPONENT_X .emit COMPONENT_X;\n" -"addrWriteMask\n" -" dot .and \"x\" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;\n" -"fp_scalarSuffix\n" -" dot .and fp_component_single .error INVALID_COMPONENT;\n" -"vp_scalarSuffix\n" -" dot .and vp_component_single .error INVALID_COMPONENT;\n" -"swizzleSuffix\n" -" swizzleSuffix_1 .or\n" -" .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" -"swizzleSuffix_1\n" -" dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;\n" -"swizzleSuffix_2\n" -" swizzleSuffix_3 .or swizzleSuffix_4;\n" -"swizzleSuffix_3\n" -" vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and\n" -" vp_component_multi .error INVALID_COMPONENT;\n" -"swizzleSuffix_4\n" -" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" -" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" -" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" -" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" -"optionalSuffix\n" -" optionalSuffix_1 .or\n" -" .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;\n" -"optionalSuffix_1\n" -" dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;\n" -"optionalSuffix_2\n" -" optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;\n" -"optionalSuffix_3\n" -" xyzwComponent_multi .and xyzwComponent_multi .and\n" -" xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;\n" -"optionalSuffix_4\n" -" rgbaComponent_multi .and rgbaComponent_multi .and\n" -" rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;\n" -"optionalSuffix_5\n" -" \"x\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" -" \"y\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" -" \"z\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" -" \"w\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or\n" -" \"r\" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or\n" -" \"g\" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or\n" -" \"b\" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or\n" -" \"a\" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;\n" -"fp_component_single\n" -" xyzwComponent_single .or rgbaComponent_single;\n" -"vp_component_multi\n" -" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" -" 'w' .emit COMPONENT_W;\n" -"vp_component_single\n" -" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" -" \"w\" .emit COMPONENT_W;\n" -"xyzwComponent_multi\n" -" 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or\n" -" 'w' .emit COMPONENT_W;\n" -"xyzwComponent_single\n" -" \"x\" .emit COMPONENT_X .or \"y\" .emit COMPONENT_Y .or \"z\" .emit COMPONENT_Z .or\n" -" \"w\" .emit COMPONENT_W;\n" -"rgbaComponent_multi\n" -" 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or\n" -" 'a' .emit COMPONENT_W;\n" -"rgbaComponent_single\n" -" \"r\" .emit COMPONENT_X .or \"g\" .emit COMPONENT_Y .or \"b\" .emit COMPONENT_Z .or\n" -" \"a\" .emit COMPONENT_W;\n" -"fp_optionalMask\n" -" rgbaMask .or xyzwMask .or .true .emit 0x0F;\n" -"vp_optionalMask\n" -" xyzwMask .or .true .emit 0x0F;\n" -"xyzwMask\n" -" dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;\n" -"xyzwMask_1\n" -" \"xyzw\" .emit 0x0F .or \"xyz\" .emit 0x0E .or \"xyw\" .emit 0x0D .or \"xy\" .emit 0x0C .or\n" -" \"xzw\" .emit 0x0B .or \"xz\" .emit 0x0A .or \"xw\" .emit 0x09 .or \"x\" .emit 0x08 .or\n" -" \"yzw\" .emit 0x07 .or \"yz\" .emit 0x06 .or \"yw\" .emit 0x05 .or \"y\" .emit 0x04 .or\n" -" \"zw\" .emit 0x03 .or \"z\" .emit 0x02 .or \"w\" .emit 0x01;\n" -"rgbaMask\n" -" dot_ne .and rgbaMask_1;\n" -"rgbaMask_1\n" -" \"rgba\" .emit 0x0F .or \"rgb\" .emit 0x0E .or \"rga\" .emit 0x0D .or \"rg\" .emit 0x0C .or\n" -" \"rba\" .emit 0x0B .or \"rb\" .emit 0x0A .or \"ra\" .emit 0x09 .or \"r\" .emit 0x08 .or\n" -" \"gba\" .emit 0x07 .or \"gb\" .emit 0x06 .or \"ga\" .emit 0x05 .or \"g\" .emit 0x04 .or\n" -" \"ba\" .emit 0x03 .or \"b\" .emit 0x02 .or \"a\" .emit 0x01;\n" -"fp_namingStatement\n" -" fp_ATTRIB_statement .emit ATTRIB .or\n" -" fp_PARAM_statement .emit PARAM .or\n" -" fp_TEMP_statement .emit TEMP .or\n" -" fp_OUTPUT_statement .emit OUTPUT .or\n" -" fp_ALIAS_statement .emit ALIAS;\n" -"vp_namingStatement\n" -" vp_ATTRIB_statement .emit ATTRIB .or\n" -" vp_PARAM_statement .emit PARAM .or\n" -" vp_TEMP_statement .emit TEMP .or\n" -" ADDRESS_statement .emit ADDRESS .or\n" -" vp_OUTPUT_statement .emit OUTPUT .or\n" -" vp_ALIAS_statement .emit ALIAS;\n" -"fp_ATTRIB_statement\n" -" \"ATTRIB\" .and space .and fp_establishName .and equal .and\n" -" fragAttribBinding .error FRAGMENT_EXPECTED;\n" -"vp_ATTRIB_statement\n" -" \"ATTRIB\" .and space .and vp_establishName .and equal .and\n" -" vtxAttribBinding .error VERTEX_EXPECTED;\n" -"fragAttribBinding\n" -" \"fragment\" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;\n" -"vtxAttribBinding\n" -" \"vertex\" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;\n" -"fragAttribItem\n" -" fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or\n" -" fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or\n" -" .if (fog_coord != 0x00) \"fogcoord\" .emit FRAGMENT_ATTRIB_FOGCOORD .or\n" -" \"position\" .emit FRAGMENT_ATTRIB_POSITION;\n" -"fragAttribItem_1\n" -" \"color\" .and optColorType;\n" -"fragAttribItem_2\n" -" \"texcoord\" .and optTexCoordNum;\n" -"vtxAttribItem\n" -" \"position\" .emit VERTEX_ATTRIB_POSITION .or\n" -" .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or\n" -" \"normal\" .emit VERTEX_ATTRIB_NORMAL .or\n" -" vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or\n" -" \"fogcoord\" .emit VERTEX_ATTRIB_FOGCOORD .or\n" -" vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or\n" -" .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or\n" -" vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;\n" -"vtxAttribItem_1\n" -" \"weight\" .and vtxOptWeightNum;\n" -"vtxAttribItem_2\n" -" \"color\" .and optColorType;\n" -"vtxAttribItem_3\n" -" \"texcoord\" .and optTexCoordNum;\n" -"vtxAttribItem_4\n" -" \"matrixindex\" .and lbracket .and vtxWeightNum .and rbracket;\n" -"vtxAttribItem_5\n" -" \"attrib\" .and lbracket .and vtxAttribNum .and rbracket;\n" -"vtxAttribNum\n" -" integer;\n" -"vtxOptWeightNum\n" -" vtxOptWeightNum_1 .or .true .emit 0x00;\n" -"vtxOptWeightNum_1\n" -" lbracket_ne .and vtxWeightNum .and rbracket;\n" -"vtxWeightNum\n" -" integer;\n" -"fp_PARAM_statement\n" -" fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;\n" -"vp_PARAM_statement\n" -" vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;\n" -"fp_PARAM_singleStmt\n" -" \"PARAM\" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and\n" -" .true .emit PARAM_NULL;\n" -"vp_PARAM_singleStmt\n" -" \"PARAM\" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and\n" -" .true .emit PARAM_NULL;\n" -"fp_PARAM_multipleStmt\n" -" \"PARAM\" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" -" fp_paramMultipleInit .and .true .emit PARAM_NULL;\n" -"vp_PARAM_multipleStmt\n" -" \"PARAM\" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and\n" -" vp_paramMultipleInit .and .true .emit PARAM_NULL;\n" -"optArraySize\n" -" optional_integer;\n" -"fp_paramSingleInit\n" -" equal .and fp_paramSingleItemDecl;\n" -"vp_paramSingleInit\n" -" equal .and vp_paramSingleItemDecl;\n" -"fp_paramMultipleInit\n" -" equal .and lbrace .and fp_paramMultInitList .and rbrace;\n" -"vp_paramMultipleInit\n" -" equal .and lbrace .and vp_paramMultInitList .and rbrace;\n" -"fp_paramMultInitList\n" -" fp_paramMultInitList_1 .or fp_paramMultipleItem;\n" -"vp_paramMultInitList\n" -" vp_paramMultInitList_1 .or vp_paramMultipleItem;\n" -"fp_paramMultInitList_1\n" -" fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;\n" -"vp_paramMultInitList_1\n" -" vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;\n" -"fp_paramSingleItemDecl\n" -" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" -" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstDecl .emit PARAM_CONSTANT;\n" -"vp_paramSingleItemDecl\n" -" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" -" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstDecl .emit PARAM_CONSTANT;\n" -"fp_paramSingleItemUse\n" -" fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" -" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstUse .emit PARAM_CONSTANT;\n" -"vp_paramSingleItemUse\n" -" vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or\n" -" programSingleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstUse .emit PARAM_CONSTANT;\n" -"fp_paramMultipleItem\n" -" fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" -" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstDecl .emit PARAM_CONSTANT;\n" -"vp_paramMultipleItem\n" -" vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or\n" -" programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or\n" -" paramConstDecl .emit PARAM_CONSTANT;\n" -"fp_stateMultipleItem\n" -" stateMultipleItem_1 .or fp_stateSingleItem;\n" -"vp_stateMultipleItem\n" -" stateMultipleItem_1 .or vp_stateSingleItem;\n" -"stateMultipleItem_1\n" -" \"state\" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;\n" -"fp_stateSingleItem\n" -" \"state\" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" -"vp_stateSingleItem\n" -" \"state\" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;\n" -"fp_stateSingleItem_1\n" -" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" -" stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;\n" -"vp_stateSingleItem_1\n" -" stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or\n" -" stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or\n" -" stateSingleItem_11;\n" -"stateSingleItem_1\n" -" stateMaterialItem .emit STATE_MATERIAL;\n" -"stateSingleItem_2\n" -" stateLightItem .emit STATE_LIGHT;\n" -"stateSingleItem_3\n" -" stateLightModelItem .emit STATE_LIGHT_MODEL;\n" -"stateSingleItem_4\n" -" stateLightProdItem .emit STATE_LIGHT_PROD;\n" -"stateSingleItem_5\n" -" stateTexEnvItem .emit STATE_TEX_ENV;\n" -"stateSingleItem_6\n" -" stateTexGenItem .emit STATE_TEX_GEN;\n" -"stateSingleItem_7\n" -" stateFogItem .emit STATE_FOG;\n" -"stateSingleItem_8\n" -" stateDepthItem .emit STATE_DEPTH;\n" -"stateSingleItem_9\n" -" stateClipPlaneItem .emit STATE_CLIP_PLANE;\n" -"stateSingleItem_10\n" -" statePointItem .emit STATE_POINT;\n" -"stateSingleItem_11\n" -" stateMatrixRow .emit STATE_MATRIX_ROWS;\n" -"stateMaterialItem\n" -" \"material\" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;\n" -"stateMatProperty\n" -" \"ambient\" .emit MATERIAL_AMBIENT .or\n" -" \"diffuse\" .emit MATERIAL_DIFFUSE .or\n" -" \"specular\" .emit MATERIAL_SPECULAR .or\n" -" \"emission\" .emit MATERIAL_EMISSION .or\n" -" \"shininess\" .emit MATERIAL_SHININESS;\n" -"stateLightItem\n" -" \"light\" .and lbracket .and stateLightNumber .and rbracket .and dot .and\n" -" stateLightProperty .error INVALID_LIGHT_PROPERTY;\n" -"stateLightProperty\n" -" \"ambient\" .emit LIGHT_AMBIENT .or\n" -" \"diffuse\" .emit LIGHT_DIFFUSE .or\n" -" \"specular\" .emit LIGHT_SPECULAR .or\n" -" \"position\" .emit LIGHT_POSITION .or\n" -" \"attenuation\" .emit LIGHT_ATTENUATION .or\n" -" stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or\n" -" \"half\" .emit LIGHT_HALF;\n" -"stateLightProperty_1\n" -" \"spot\" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;\n" -"stateSpotProperty\n" -" \"direction\";\n" -"stateLightModelItem\n" -" \"lightmodel\" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;\n" -"stateLModProperty\n" -" stateLModProperty_1 .or stateLModProperty_2;\n" -"stateLModProperty_1\n" -" dot .and \"ambient\" .emit LIGHT_MODEL_AMBIENT;\n" -"stateLModProperty_2\n" -" stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;\n" -"stateLModProperty_3\n" -" optFaceType .and dot .and \"scenecolor\";\n" -"stateLightProdItem\n" -" \"lightprod\" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and\n" -" stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;\n" -"stateLProdProperty\n" -" \"ambient\" .emit LIGHT_PROD_AMBIENT .or\n" -" \"diffuse\" .emit LIGHT_PROD_DIFFUSE .or\n" -" \"specular\" .emit LIGHT_PROD_SPECULAR;\n" -"stateLightNumber\n" -" integer;\n" -"stateTexEnvItem\n" -" \"texenv\" .and optLegacyTexUnitNum .and dot .and\n" -" stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;\n" -"stateTexEnvProperty\n" -" \"color\" .emit TEX_ENV_COLOR;\n" -"optLegacyTexUnitNum\n" -" optLegacyTexUnitNum_1 .or .true .emit 0x00;\n" -"optLegacyTexUnitNum_1\n" -" lbracket_ne .and legacyTexUnitNum .and rbracket;\n" -"legacyTexUnitNum\n" -" integer;\n" -"stateTexGenItem\n" -" \"texgen\" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and\n" -" dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;\n" -"stateTexGenType\n" -" \"eye\" .emit TEX_GEN_EYE .or\n" -" \"object\" .emit TEX_GEN_OBJECT;\n" -"stateTexGenCoord\n" -" \"s\" .emit COMPONENT_X .or\n" -" \"t\" .emit COMPONENT_Y .or\n" -" \"r\" .emit COMPONENT_Z .or\n" -" \"q\" .emit COMPONENT_W;\n" -"stateFogItem\n" -" \"fog\" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;\n" -"stateFogProperty\n" -" \"color\" .emit FOG_COLOR .or\n" -" \"params\" .emit FOG_PARAMS;\n" -"stateDepthItem\n" -" \"depth\" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;\n" -"stateDepthProperty\n" -" \"range\" .emit DEPTH_RANGE;\n" -"stateClipPlaneItem\n" -" \"clip\" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and\n" -" \"plane\" .error INVALID_CLIPPLANE_PROPERTY;\n" -"stateClipPlaneNum\n" -" integer;\n" -"statePointItem\n" -" \"point\" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;\n" -"statePointProperty\n" -" \"size\" .emit POINT_SIZE .or\n" -" .if (point_parameters != 0x00) \"attenuation\" .emit POINT_ATTENUATION;\n" -"stateMatrixRow\n" -" stateMatrixItem .and dot .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and\n" -" lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;\n" -"stateMatrixRows\n" -" stateMatrixItem .and optMatrixRows;\n" -"optMatrixRows\n" -" optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;\n" -"optMatrixRows_1\n" -" dot_ne .and \"row\" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and\n" -" stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;\n" -"stateMatrixItem\n" -" \"matrix\" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;\n" -"stateOptMatModifier\n" -" stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;\n" -"stateOptMatModifier_1\n" -" dot_ne .and stateMatModifier;\n" -"stateMatModifier\n" -" \"inverse\" .emit MATRIX_MODIFIER_INVERSE .or\n" -" \"transpose\" .emit MATRIX_MODIFIER_TRANSPOSE .or\n" -" \"invtrans\" .emit MATRIX_MODIFIER_INVTRANS;\n" -"stateMatrixRowNum\n" -" integer_0_3;\n" -"stateMatrixName\n" -" stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or\n" -" \"projection\" .emit MATRIX_PROJECTION .or\n" -" \"mvp\" .emit MATRIX_MVP .or\n" -" stateMatrixName_1_2 .emit MATRIX_TEXTURE .or\n" -" .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or\n" -" stateMatrixName_1_4 .emit MATRIX_PROGRAM;\n" -"stateMatrixName_1_1\n" -" \"modelview\" .and stateOptModMatNum;\n" -"stateMatrixName_1_2\n" -" \"texture\" .and optTexCoordNum;\n" -"stateMatrixName_1_3\n" -" \"palette\" .and lbracket .and statePaletteMatNum .and rbracket;\n" -"stateMatrixName_1_4\n" -" \"program\" .and lbracket .and stateProgramMatNum .and rbracket;\n" -"stateOptModMatNum\n" -" .if (vertex_blend != 0x00) stateOptModMatNum_1 .or\n" -" .true .emit 0x00;\n" -"stateOptModMatNum_1\n" -" lbracket_ne .and stateModMatNum .and rbracket;\n" -"stateModMatNum\n" -" integer;\n" -"optTexCoordNum\n" -" optTexCoordNum_1 .or .true .emit 0x00;\n" -"optTexCoordNum_1\n" -" lbracket_ne .and texCoordNum .and rbracket;\n" -"texCoordNum\n" -" integer;\n" -"statePaletteMatNum\n" -" integer;\n" -"stateProgramMatNum\n" -" integer;\n" -"programSingleItem\n" -" \"program\" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" -"programSingleItem_1\n" -" progEnvParam .or progLocalParam;\n" -"programMultipleItem\n" -" \"program\" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;\n" -"programMultipleItem_1\n" -" progEnvParams .or progLocalParams;\n" -"progEnvParams\n" -" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;\n" -"progEnvParamNums\n" -" progEnvParamNums_1 .or progEnvParamNums_2;\n" -"progEnvParamNums_1\n" -" progEnvParamNum .and dotdot_ne .and progEnvParamNum;\n" -"progEnvParamNums_2\n" -" progEnvParamNum .and .true .emit 0x00;\n" -"progEnvParam\n" -" \"env\" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;\n" -"progLocalParams\n" -" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;\n" -"progLocalParamNums\n" -" progLocalParamNums_1 .or progLocalParamNums_2;\n" -"progLocalParamNums_1\n" -" progLocalParamNum .and dotdot_ne .and progLocalParamNum;\n" -"progLocalParamNums_2\n" -" progLocalParamNum .and .true .emit 0x00;\n" -"progLocalParam\n" -" \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;\n" -"progEnvParamNum\n" -" integer;\n" -"progLocalParamNum\n" -" integer;\n" -"paramConstDecl\n" -" paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" -"paramConstUse\n" -" paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;\n" -"paramConstScalarDecl\n" -" signedFloatConstant;\n" -"paramConstScalarUse\n" -" floatConstant;\n" -"paramConstVector\n" -" paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or\n" -" paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;\n" -"paramConstVector_1\n" -" lbrace_ne .and signedFloatConstant .and rbrace;\n" -"paramConstVector_2\n" -" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" -"paramConstVector_3\n" -" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" -" signedFloatConstant .and rbrace;\n" -"paramConstVector_4\n" -" lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and\n" -" signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;\n" -"signedFloatConstant\n" -" optionalSign .and floatConstant;\n" -"floatConstant\n" -" float;\n" -"optionalSign\n" -" optional_sign_ne;\n" -"fp_TEMP_statement\n" -" \"TEMP\" .and space .and fp_varNameList .and .true .emit 0x00;\n" -"vp_TEMP_statement\n" -" \"TEMP\" .and space .and vp_varNameList .and .true .emit 0x00;\n" -"ADDRESS_statement\n" -" \"ADDRESS\" .and space .and vp_varNameList .and .true .emit 0x00;\n" -"fp_varNameList\n" -" fp_varNameList_1 .or fp_establishName;\n" -"vp_varNameList\n" -" vp_varNameList_1 .or vp_establishName;\n" -"fp_varNameList_1\n" -" fp_establishName .and comma_ne .and fp_varNameList;\n" -"vp_varNameList_1\n" -" vp_establishName .and comma_ne .and vp_varNameList;\n" -"fp_OUTPUT_statement\n" -" \"OUTPUT\" .and space .and fp_establishName .and equal .and\n" -" fp_resultBinding .error RESULT_EXPECTED;\n" -"vp_OUTPUT_statement\n" -" \"OUTPUT\" .and space .and vp_establishName .and equal .and\n" -" vp_resultBinding .error RESULT_EXPECTED;\n" -"fp_resultBinding\n" -" \"result\" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" -"vp_resultBinding\n" -" \"result\" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;\n" -"fp_resultBinding_1\n" -" fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or\n" -" \"depth\" .emit FRAGMENT_RESULT_DEPTH;\n" -"fp_resultBinding_2\n" -" \"color\" .and optOutputColorNum;\n" -"vp_resultBinding_1\n" -" .if (ARB_position_invariant == 0x00) \"position\" .emit VERTEX_RESULT_POSITION .or\n" -" resultColBinding .emit VERTEX_RESULT_COLOR .or\n" -" \"fogcoord\" .emit VERTEX_RESULT_FOGCOORD .or\n" -" \"pointsize\" .emit VERTEX_RESULT_POINTSIZE .or\n" -" vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;\n" -"vp_resultBinding_2\n" -" \"texcoord\" .and optTexCoordNum;\n" -"optOutputColorNum\n" -" .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;\n" -"optOutputColorNum_1\n" -" lbracket_ne .and outputColorNum .and rbracket;\n" -"outputColorNum\n" -" integer;\n" -"resultColBinding\n" -" \"color\" .and optFaceType .and optColorType;\n" -"optFaceType\n" -" FaceType .or .true .emit FACE_FRONT;\n" -"FaceType\n" -" dot_ne .and FaceProperty;\n" -"FaceProperty\n" -" \"front\" .emit FACE_FRONT .or \"back\" .emit FACE_BACK;\n" -"optColorType\n" -" ColorType .or .true .emit COLOR_PRIMARY;\n" -"ColorType\n" -" dot_ne .and ColorProperty;\n" -"ColorProperty\n" -" \"primary\" .emit COLOR_PRIMARY .or\n" -" .if (secondary_color != 0x00) \"secondary\" .emit COLOR_SECONDARY;\n" -"fp_ALIAS_statement\n" -" \"ALIAS\" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;\n" -"vp_ALIAS_statement\n" -" \"ALIAS\" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;\n" -"fp_ALIAS_statement_1\n" -" space .and fp_establishName;\n" -"vp_ALIAS_statement_1\n" -" space .and vp_establishName;\n" -"fp_establishName\n" -" fp_identifier;\n" -"vp_establishName\n" -" vp_identifier;\n" -"fp_establishedName\n" -" fp_identifier;\n" -"vp_establishedName\n" -" vp_identifier;\n" -"fp_establishedName_no_error_on_identifier\n" -" fp_identifier_ne;\n" -"vp_establishedName_no_error_on_identifier\n" -" vp_identifier_ne;\n" -"fp_identifier\n" -" fp_identifier_ne .error IDENTIFIER_EXPECTED;\n" -"vp_identifier\n" -" vp_identifier_ne .error IDENTIFIER_EXPECTED;\n" -"fp_identifier_ne\n" -" fp_not_reserved_identifier .and identifier_ne;\n" -"vp_identifier_ne\n" -" vp_not_reserved_identifier .and identifier_ne;\n" -"fp_not_reserved_identifier\n" -" fp_not_reserved_identifier_1 .or .true;\n" -"fp_not_reserved_identifier_1\n" -" fp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" -"vp_not_reserved_identifier\n" -" vp_not_reserved_identifier_1 .or .true;\n" -"vp_not_reserved_identifier_1\n" -" vp_reserved_identifier .and .false .error RESERVED_KEYWORD;\n" -"fp_reserved_identifier\n" -" \"ABS\" .or \"ABS_SAT\" .or \"ADD\" .or \"ADD_SAT\" .or \"ALIAS\" .or \"ATTRIB\" .or \"CMP\" .or \"CMP_SAT\" .or\n" -" \"COS\" .or \"COS_SAT\" .or \"DP3\" .or \"DP3_SAT\" .or \"DP4\" .or \"DP4_SAT\" .or \"DPH\" .or \"DPH_SAT\" .or\n" -" \"DST\" .or \"DST_SAT\" .or \"END\" .or \"EX2\" .or \"EX2_SAT\" .or \"FLR\" .or \"FLR_SAT\" .or \"FRC\" .or\n" -" \"FRC_SAT\" .or \"KIL\" .or \"LG2\" .or \"LG2_SAT\" .or \"LIT\" .or \"LIT_SAT\" .or \"LRP\" .or \"LRP_SAT\" .or\n" -" \"MAD\" .or \"MAD_SAT\" .or \"MAX\" .or \"MAX_SAT\" .or \"MIN\" .or \"MIN_SAT\" .or \"MOV\" .or \"MOV_SAT\" .or\n" -" \"MUL\" .or \"MUL_SAT\" .or \"OPTION\" .or \"OUTPUT\" .or \"PARAM\" .or \"POW\" .or \"POW_SAT\" .or \"RCP\" .or\n" -" \"RCP_SAT\" .or \"RSQ\" .or \"RSQ_SAT\" .or \"SIN\" .or \"SIN_SAT\" .or \"SCS\" .or \"SCS_SAT\" .or \"SGE\" .or\n" -" \"SGE_SAT\" .or \"SLT\" .or \"SLT_SAT\" .or \"SUB\" .or \"SUB_SAT\" .or \"SWZ\" .or \"SWZ_SAT\" .or \"TEMP\" .or\n" -" \"TEX\" .or \"TEX_SAT\" .or \"TXB\" .or \"TXB_SAT\" .or \"TXP\" .or \"TXP_SAT\" .or \"XPD\" .or \"XPD_SAT\" .or\n" -" \"fragment\" .or \"program\" .or \"result\" .or \"state\" .or \"texture\";\n" -"vp_reserved_identifier\n" -" \"ABS\" .or \"ADD\" .or \"ADDRESS\" .or \"ALIAS\" .or \"ARL\" .or \"ATTRIB\" .or \"DP3\" .or \"DP4\" .or\n" -" \"DPH\" .or \"DST\" .or \"END\" .or \"EX2\" .or \"EXP\" .or \"FLR\" .or \"FRC\" .or \"LG2\" .or \"LIT\" .or\n" -" \"LOG\" .or \"MAD\" .or \"MAX\" .or \"MIN\" .or \"MOV\" .or \"MUL\" .or \"OPTION\" .or \"OUTPUT\" .or\n" -" \"PARAM\" .or \"POW\" .or \"RCP\" .or \"RSQ\" .or \"SGE\" .or \"SLT\" .or \"SUB\" .or \"SWZ\" .or \"TEMP\" .or\n" -" \"XPD\" .or \"program\" .or \"result\" .or \"state\" .or \"vertex\";\n" -"integer\n" -" integer_ne .error INTEGER_EXPECTED;\n" -"zero\n" -" '0';\n" -"leading_zeroes\n" -" .loop zero;\n" -"no_digit\n" -" no_digit_1 .or .true;\n" -"no_digit_1\n" -" digit10 .and .false .error INTEGER_OUT_OF_RANGE;\n" -"all_zeroes\n" -" all_zeroes_1 .or no_digit_1;\n" -"all_zeroes_1\n" -" '0' .and .loop zero .and no_digit;\n" -"integer_0_3\n" -" integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" -"integer_0_3_1\n" -" integer_0_3_2 .or all_zeroes .emit '0';\n" -"integer_0_3_2 \n" -" leading_zeroes .and '1'-'3' .emit * .and no_digit;\n" -"integer_0_63\n" -" integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" -"integer_0_63_1\n" -" integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or\n" -" all_zeroes .emit '0';\n" -"integer_0_63_2 \n" -" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" -"integer_0_63_3 \n" -" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" -"integer_0_63_4 \n" -" leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;\n" -"integer_0_63_5 \n" -" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" -"integer_0_64\n" -" integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;\n" -"integer_0_64_1\n" -" integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or\n" -" all_zeroes .emit '0';\n" -"integer_0_64_2 \n" -" leading_zeroes .and '7'-'9' .emit * .and no_digit;\n" -"integer_0_64_3 \n" -" leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;\n" -"integer_0_64_4 \n" -" leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;\n" -"integer_0_64_5 \n" -" leading_zeroes .and '1'-'6' .emit * .and no_digit;\n" -"optional_space\n" -" space .or .true;\n" -"space_dst\n" -" space .error OPERATION_NEEDS_DESTINATION_VARIABLE;\n" -"space_src\n" -" space .error OPERATION_NEEDS_SOURCE_VARIABLE;\n" -"space\n" -" single_space .and .loop single_space;\n" -"single_space\n" -" white_char .or comment_block;\n" -"white_char\n" -" ' ' .or '\\t' .or '\\n' .or '\\r';\n" -"comment_block\n" -" '#' .and .loop comment_char .and optional_new_line;\n" -"comment_char\n" -" '\\x0E'-'\\xFF' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" -"optional_new_line\n" -" '\\n' .or crlf .or .true;\n" -"crlf\n" -" '\\r' .and '\\n';\n" -"semicolon\n" -" optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;\n" -"comma\n" -" optional_space .and ',' .error MISSING_COMMA .and optional_space;\n" -"comma_ne\n" -" optional_space .and ',' .and optional_space;\n" -"lbracket\n" -" optional_space .and '[' .error MISSING_LBRACKET .and optional_space;\n" -"lbracket_ne\n" -" optional_space .and '[' .and optional_space;\n" -"rbracket\n" -" optional_space .and ']' .error MISSING_RBRACKET .and optional_space;\n" -"dot\n" -" optional_space .and '.' .error MISSING_DOT .and optional_space;\n" -"dot_ne\n" -" optional_space .and '.' .and optional_space;\n" -"equal\n" -" optional_space .and '=' .error MISSING_EQUAL .and optional_space;\n" -"lbrace\n" -" optional_space .and '{' .error MISSING_LBRACE .and optional_space;\n" -"lbrace_ne\n" -" optional_space .and '{' .and optional_space;\n" -"rbrace\n" -" optional_space .and '}' .error MISSING_RBRACE .and optional_space;\n" -"dotdot\n" -" optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;\n" -"dotdot_ne\n" -" optional_space .and '.' .and '.' .and optional_space;\n" -"float\n" -" float_1 .or float_2 .or float_legacy;\n" -"float_1\n" -" '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;\n" -"float_2\n" -" integer_ne .and float_3;\n" -"float_3\n" -" float_4 .or float_5;\n" -"float_4\n" -" '.' .and optional_integer .and optional_exponent;\n" -"float_5\n" -" exponent .emit 0x00;\n" -"float_legacy\n" -" integer_ne .and .true .emit 0x00 .emit 0x00;\n" -"integer_ne\n" -" integer_ne_1 .and .true .emit 0x00 .emit $;\n" -"integer_ne_1\n" -" digit10 .emit * .and .loop digit10 .emit *;\n" -"optional_integer\n" -" integer_ne .or .true .emit 0x00;\n" -"optional_exponent\n" -" exponent .or .true .emit 0x00;\n" -"exponent\n" -" exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;\n" -"exponent_1\n" -" 'e' .or 'E';\n" -"optional_sign_ne\n" -" minus_ne .or plus_ne .or .true;\n" -"plus_ne\n" -" optional_space .and '+' .and optional_space;\n" -"minus_ne\n" -" optional_space .and '-' .emit '-' .and optional_space;\n" -"identifier_ne\n" -" first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;\n" -"follow_idchar\n" -" first_idchar .or digit10;\n" -"first_idchar\n" -" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" -"digit10\n" -" '0'-'9';\n" -".string __string_filter;\n" -"__string_filter\n" -" .loop __identifier_char;\n" -"__identifier_char\n" -" 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';\n" -"e_signature\n" -" e_signature_char .and .loop e_signature_char;\n" -"e_signature_char\n" -" '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" -"e_statement\n" -" .loop e_statement_not_term;\n" -"e_statement_not_term\n" -" '\\x3C'-'\\xFF' .or '\\x0E'-'\\x3A' .or '\\x01'-'\\x09' .or '\\x0B'-'\\x0C';\n" -"e_identifier\n" -" e_identifier_first .and .loop e_identifier_next;\n" -"e_identifier_first\n" -" 'a'-'z' .or 'A'-'Z' .or '_' .or '$';\n" -"e_identifier_next\n" -" e_identifier_first .or '0'-'9';\n" -"e_token\n" -" e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or\n" -" '-' .or ',' .or ';';\n" -"e_token_number\n" -" e_token_digit .and .loop e_token_digit;\n" -"e_token_digit\n" -" '0'-'9';\n" -"e_charordigit\n" -" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n" -"" |