*
* Grammar Changes:
* -----------------------------------------------------
- * - changed optional_exponent rule from:
- * " exponent .or .true .emit '1' .emit 0x00;\n"
- * to
- * " exponent .or .true .emit '1' .emit 0x00 .emit $;\n"
- *
- * - XXX: need to recognize "1" as a valid float ?
- * - XXX: this fails:
- * "MUL result.color.xyz, R0, program.local[35] ;"
- * but this works:
- * "MUL result.color.primary.xyz, R0, program.local[35] ;"
- * -> see progs/tests/arbvptorus.c
- *
- * - changed "progLocalParam\n" changed from:
- * " \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum
- * .and rbracket;\n"
- * to:
- * " \"local\" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum
- * .and rbracket .emit 0x00;\n"
- * so we can distinguish between the progLocalParam and progLocalParams rules
- *
- * - made the same change as above to the progEnvParam rule
*/
typedef GLubyte *production;
* From here on down is the syntax checking portion
*/
-/* VERSION: 0.3 */
+/* VERSION: 0.4 */
/*
INTRODUCTION
* These should match up with the values defined in arbparse.syn.h
*/
-#define REVISION 0x03
+#define REVISION 0x04
/* program type */
#define FRAGMENT_PROGRAM 0x01
#define ARB_FOG_LINEAR 0x10
/* vertex program option flags */
-#define ARB_POSITION_INVARIANT 0x01
+/*
+$4: changed from 0x01 to 0x20.
+*/
+#define ARB_POSITION_INVARIANT 0x20
/* fragment program instruction class */
#define F_ALU_INST 0x01
#define STATE_TEX_ENV 0x07
#define STATE_DEPTH 0x08
/* vertex program only */
-#define STATE_TEX_GEN 0x07
-#define STATE_CLIP_PLANE 0x08
-#define STATE_POINT 0x09
+/*
+$4: incremented all the three emit codes by two to not collide with other STATE_* emit codes.
+*/
+#define STATE_TEX_GEN 0x09
+#define STATE_CLIP_PLANE 0x0A
+#define STATE_POINT 0x0B
/* state material property */
#define MATERIAL_AMBIENT 0x01
}
break;
- /* STATE_TEX_ENV == STATE_TEX_GEN */
case STATE_TEX_ENV:
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
- state_tokens[1] = parse_integer (inst, Program);
- switch (*(*inst)++) {
- case TEX_ENV_COLOR:
- state_tokens[0] = STATE_TEXENV_COLOR;
- break;
- }
+ state_tokens[1] = parse_integer (inst, Program);
+ switch (*(*inst)++) {
+ case TEX_ENV_COLOR:
+ state_tokens[0] = STATE_TEXENV_COLOR;
+ break;
}
- /* For vertex programs, this case is STATE_TEX_GEN */
- else {
+ break;
+
+ case STATE_TEX_GEN:
+ {
GLuint type, coord;
state_tokens[0] = STATE_TEXGEN;
}
break;
- /* STATE_DEPTH = STATE_CLIP_PLANE */
case STATE_DEPTH:
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
- switch (*(*inst)++) {
- case DEPTH_RANGE:
- state_tokens[0] = STATE_DEPTH_RANGE;
- break;
- }
- }
- /* for vertex programs, we want STATE_CLIP_PLANE */
- else {
- state_tokens[0] = STATE_CLIPPLANE;
- state_tokens[1] = parse_integer (inst, Program);
- if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1]))
- return 1;
+ switch (*(*inst)++) {
+ case DEPTH_RANGE:
+ state_tokens[0] = STATE_DEPTH_RANGE;
+ break;
}
break;
+ case STATE_CLIP_PLANE:
+ state_tokens[0] = STATE_CLIPPLANE;
+ state_tokens[1] = parse_integer (inst, Program);
+ if (parse_clipplane_num (ctx, inst, Program, &state_tokens[1]))
+ return 1;
+ break;
+
case STATE_POINT:
switch (*(*inst++)) {
case POINT_SIZE:
while (*inst != END) {
switch (*inst++) {
- /* XXX: */
+
case OPTION:
+ switch (*inst++) {
+ case ARB_PRECISION_HINT_FASTEST:
+ Program->HintPrecisionFastest = 1;
+ break;
- if (Program->type == GL_FRAGMENT_PROGRAM_ARB) {
- switch (*inst++) {
- case ARB_PRECISION_HINT_FASTEST:
- Program->HintPrecisionFastest = 1;
- break;
+ case ARB_PRECISION_HINT_NICEST:
+ Program->HintPrecisionNicest = 1;
+ break;
- case ARB_PRECISION_HINT_NICEST:
- Program->HintPrecisionNicest = 1;
- break;
+ case ARB_FOG_EXP:
+ Program->HintFogExp = 1;
+ break;
- case ARB_FOG_EXP:
- Program->HintFogExp = 1;
- break;
+ case ARB_FOG_EXP2:
+ Program->HintFogExp2 = 1;
+ break;
- case ARB_FOG_EXP2:
- Program->HintFogExp2 = 1;
- break;
+ case ARB_FOG_LINEAR:
+ Program->HintFogLinear = 1;
+ break;
- case ARB_FOG_LINEAR:
- Program->HintFogLinear = 1;
- break;
- }
- }
- else {
- switch (*inst++) {
- case ARB_POSITION_INVARIANT:
- Program->HintPositionInvariant = 1;
- break;
- }
+ case ARB_POSITION_INVARIANT:
+ Program->HintPositionInvariant = 1;
+ break;
}
break;
static char arb_grammar_text[] = ".syntax program;\n"
-".emtcode REVISION 0x03\n"
+".emtcode REVISION 0x04\n"
".emtcode FRAGMENT_PROGRAM 0x01\n"
".emtcode VERTEX_PROGRAM 0x02\n"
".emtcode OPTION 0x01\n"
".emtcode ARB_FOG_EXP 0x04\n"
".emtcode ARB_FOG_EXP2 0x08\n"
".emtcode ARB_FOG_LINEAR 0x10\n"
-".emtcode ARB_POSITION_INVARIANT 0x01\n"
+".emtcode ARB_POSITION_INVARIANT 0x20\n"
".emtcode F_ALU_INST 0x01\n"
".emtcode F_TEX_INST 0x02\n"
".emtcode F_ALU_VECTOR 0x01\n"
".emtcode STATE_MATRIX_ROWS 0x06\n"
".emtcode STATE_TEX_ENV 0x07\n"
".emtcode STATE_DEPTH 0x08\n"
-".emtcode STATE_TEX_GEN 0x07\n"
-".emtcode STATE_CLIP_PLANE 0x08\n"
-".emtcode STATE_POINT 0x09\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"
"optColorType\n"
" ColorType .or .true .emit COLOR_PRIMARY;\n"
"ColorType\n"
-" dot_ne .and ColorProperty .error INVALID_COLOR_PROPERTY;\n"
+" dot_ne .and ColorProperty;\n"
"ColorProperty\n"
" \"primary\" .emit COLOR_PRIMARY .or \"secondary\" .emit COLOR_SECONDARY;\n"
"fp_ALIAS_statement\n"
"dotdot_ne\n"
" optional_space .and '.' .and '.' .and optional_space;\n"
"float\n"
-" float_1 .or float_2;\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 .error MISSING_DOT_OR_EXPONENT;\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 '1' .emit 0x00 .emit $;\n"
"integer_ne\n"
" integer_ne_1 .and .true .emit 0x00 .emit $;\n"
"integer_ne_1\n"