diff options
author | Karl Rasche <karlrasche@gmail.com> | 2003-11-25 02:08:05 +0000 |
---|---|---|
committer | Karl Rasche <karlrasche@gmail.com> | 2003-11-25 02:08:05 +0000 |
commit | e749be22b03312c3927964c85d589868e3292977 (patch) | |
tree | c85be2997ebd8046467be9ac8bc53cb35ad53082 | |
parent | 9bc3753a513f2045f3613389c2ddb604df8693e7 (diff) |
- New version of the syntax rules from Michal Krol
+ Handles '1' as a float, just like '1.'
+ Remove switch collision between vp and fp #defines
+ result.color.xyz no longer requires result.color.primary.xyz
-rw-r--r-- | src/mesa/main/arbparse.c | 129 | ||||
-rw-r--r-- | src/mesa/main/arbparse_syn.h | 18 |
2 files changed, 62 insertions, 85 deletions
diff --git a/src/mesa/main/arbparse.c b/src/mesa/main/arbparse.c index 24f76ce305..e520e69840 100644 --- a/src/mesa/main/arbparse.c +++ b/src/mesa/main/arbparse.c @@ -99,27 +99,6 @@ * * 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; @@ -128,7 +107,7 @@ typedef GLubyte *production; * From here on down is the syntax checking portion */ -/* VERSION: 0.3 */ +/* VERSION: 0.4 */ /* INTRODUCTION @@ -390,7 +369,7 @@ Little-Endian convention (the lowest byte comes first). */ * These should match up with the values defined in arbparse.syn.h */ -#define REVISION 0x03 +#define REVISION 0x04 /* program type */ #define FRAGMENT_PROGRAM 0x01 @@ -410,7 +389,10 @@ Little-Endian convention (the lowest byte comes first). */ #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 @@ -643,9 +625,12 @@ $3: Added enumerants. #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 @@ -3320,18 +3305,17 @@ parse_state_single_item (GLcontext * ctx, GLubyte ** inst, } 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; @@ -3382,24 +3366,21 @@ parse_state_single_item (GLcontext * ctx, GLubyte ** inst, } 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: @@ -5670,38 +5651,32 @@ parse_arb_program (GLcontext * ctx, GLubyte * inst, struct var_cache **vc_head, 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; diff --git a/src/mesa/main/arbparse_syn.h b/src/mesa/main/arbparse_syn.h index b6a05d7b40..e1b7731630 100644 --- a/src/mesa/main/arbparse_syn.h +++ b/src/mesa/main/arbparse_syn.h @@ -1,5 +1,5 @@ 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" @@ -11,7 +11,7 @@ static char arb_grammar_text[] = ".syntax program;\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" @@ -189,9 +189,9 @@ static char arb_grammar_text[] = ".syntax program;\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" @@ -1054,7 +1054,7 @@ static char arb_grammar_text[] = ".syntax program;\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" @@ -1151,17 +1151,19 @@ static char arb_grammar_text[] = ".syntax program;\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" |