4 This value must be incremented every time emit code values or structure of the production
5 array changes. This value is placed at the beginning of the production array. The loader
6 compares the value with its REVISION value. If they do not match, the loader is not up
12 .emtcode FRAGMENT_PROGRAM 0x01
13 .emtcode VERTEX_PROGRAM 0x02
17 .emtcode INSTRUCTION 0x02
18 .emtcode DECLARATION 0x03
21 /* GL_ARB_fragment_program option flags */
22 .emtcode ARB_PRECISION_HINT_FASTEST 0x01
23 .emtcode ARB_PRECISION_HINT_NICEST 0x02
24 .emtcode ARB_FOG_EXP 0x04
25 .emtcode ARB_FOG_EXP2 0x08
26 .emtcode ARB_FOG_LINEAR 0x10
28 /* GL_ARB_vertex_program option flags */
29 .emtcode ARB_POSITION_INVARIANT 0x20
31 /* GL_ARB_fragment_program_shadow option flags */
32 .emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40
34 /* GL_ARB_fragment_program instruction class */
35 .emtcode OP_ALU_INST 0x00
36 .emtcode OP_TEX_INST 0x01
38 /* GL_ARB_vertex_program instruction class */
41 /* GL_ARB_fragment_program instruction type */
42 .emtcode OP_ALU_VECTOR 0x00
43 .emtcode OP_ALU_SCALAR 0x01
44 .emtcode OP_ALU_BINSC 0x02
45 .emtcode OP_ALU_BIN 0x03
46 .emtcode OP_ALU_TRI 0x04
47 .emtcode OP_ALU_SWZ 0x05
48 .emtcode OP_TEX_SAMPLE 0x06
49 .emtcode OP_TEX_KIL 0x07
51 /* GL_ARB_vertex_program instruction type */
52 .emtcode OP_ALU_ARL 0x08
60 /* GL_ARB_fragment_program instruction code */
62 .emtcode OP_ABS_SAT 0x1B
64 .emtcode OP_FLR_SAT 0x26
66 .emtcode OP_FRC_SAT 0x27
68 .emtcode OP_LIT_SAT 0x2A
70 .emtcode OP_MOV_SAT 0x30
72 .emtcode OP_COS_SAT 0x20
74 .emtcode OP_EX2_SAT 0x25
76 .emtcode OP_LG2_SAT 0x29
78 .emtcode OP_RCP_SAT 0x33
80 .emtcode OP_RSQ_SAT 0x34
82 .emtcode OP_SIN_SAT 0x39
84 .emtcode OP_SCS_SAT 0x36
86 .emtcode OP_POW_SAT 0x32
88 .emtcode OP_ADD_SAT 0x1C
90 .emtcode OP_DP3_SAT 0x21
92 .emtcode OP_DP4_SAT 0x22
94 .emtcode OP_DPH_SAT 0x23
96 .emtcode OP_DST_SAT 0x24
98 .emtcode OP_MAX_SAT 0x2E
100 .emtcode OP_MIN_SAT 0x2F
102 .emtcode OP_MUL_SAT 0x31
104 .emtcode OP_SGE_SAT 0x37
106 .emtcode OP_SLT_SAT 0x3A
108 .emtcode OP_SUB_SAT 0x3B
110 .emtcode OP_XPD_SAT 0x43
112 .emtcode OP_CMP_SAT 0x1E
114 .emtcode OP_LRP_SAT 0x2C
116 .emtcode OP_MAD_SAT 0x2D
118 .emtcode OP_SWZ_SAT 0x3C
120 .emtcode OP_TEX_SAT 0x3E
122 .emtcode OP_TXB_SAT 0x40
124 .emtcode OP_TXP_SAT 0x42
127 /* GL_ARB_vertex_program instruction code */
156 /* fragment attribute binding */
157 .emtcode FRAGMENT_ATTRIB_COLOR 0x01
158 .emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
159 .emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
160 .emtcode FRAGMENT_ATTRIB_POSITION 0x04
162 /* vertex attribute binding */
163 .emtcode VERTEX_ATTRIB_POSITION 0x01
164 .emtcode VERTEX_ATTRIB_WEIGHT 0x02
165 .emtcode VERTEX_ATTRIB_NORMAL 0x03
166 .emtcode VERTEX_ATTRIB_COLOR 0x04
167 .emtcode VERTEX_ATTRIB_FOGCOORD 0x05
168 .emtcode VERTEX_ATTRIB_TEXCOORD 0x06
169 .emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
170 .emtcode VERTEX_ATTRIB_GENERIC 0x08
172 /* fragment result binding */
173 .emtcode FRAGMENT_RESULT_COLOR 0x01
174 .emtcode FRAGMENT_RESULT_DEPTH 0x02
176 /* vertex result binding */
177 .emtcode VERTEX_RESULT_POSITION 0x01
178 .emtcode VERTEX_RESULT_COLOR 0x02
179 .emtcode VERTEX_RESULT_FOGCOORD 0x03
180 .emtcode VERTEX_RESULT_POINTSIZE 0x04
181 .emtcode VERTEX_RESULT_TEXCOORD 0x05
184 .emtcode TEXTARGET_1D 0x01
185 .emtcode TEXTARGET_2D 0x02
186 .emtcode TEXTARGET_3D 0x03
187 .emtcode TEXTARGET_RECT 0x04
188 .emtcode TEXTARGET_CUBE 0x05
189 /* GL_ARB_fragment_program_shadow */
190 .emtcode TEXTARGET_SHADOW1D 0x06
191 .emtcode TEXTARGET_SHADOW2D 0x07
192 .emtcode TEXTARGET_SHADOWRECT 0x08
195 .emtcode FACE_FRONT 0x00
196 .emtcode FACE_BACK 0x01
199 .emtcode COLOR_PRIMARY 0x00
200 .emtcode COLOR_SECONDARY 0x01
203 .emtcode COMPONENT_X 0x00
204 .emtcode COMPONENT_Y 0x01
205 .emtcode COMPONENT_Z 0x02
206 .emtcode COMPONENT_W 0x03
207 .emtcode COMPONENT_0 0x04
208 .emtcode COMPONENT_1 0x05
210 /* array index type */
211 .emtcode ARRAY_INDEX_ABSOLUTE 0x00
212 .emtcode ARRAY_INDEX_RELATIVE 0x01
215 .emtcode MATRIX_MODELVIEW 0x01
216 .emtcode MATRIX_PROJECTION 0x02
217 .emtcode MATRIX_MVP 0x03
218 .emtcode MATRIX_TEXTURE 0x04
219 .emtcode MATRIX_PALETTE 0x05
220 .emtcode MATRIX_PROGRAM 0x06
222 /* matrix modifier */
223 .emtcode MATRIX_MODIFIER_IDENTITY 0x00
224 .emtcode MATRIX_MODIFIER_INVERSE 0x01
225 .emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
226 .emtcode MATRIX_MODIFIER_INVTRANS 0x03
229 .emtcode CONSTANT_SCALAR 0x01
230 .emtcode CONSTANT_VECTOR 0x02
232 /* program param type */
233 .emtcode PROGRAM_PARAM_ENV 0x01
234 .emtcode PROGRAM_PARAM_LOCAL 0x02
237 .emtcode REGISTER_ATTRIB 0x01
238 .emtcode REGISTER_PARAM 0x02
239 .emtcode REGISTER_RESULT 0x03
240 .emtcode REGISTER_ESTABLISHED_NAME 0x04
243 .emtcode PARAM_NULL 0x00
244 .emtcode PARAM_ARRAY_ELEMENT 0x01
245 .emtcode PARAM_STATE_ELEMENT 0x02
246 .emtcode PARAM_PROGRAM_ELEMENT 0x03
247 .emtcode PARAM_PROGRAM_ELEMENTS 0x04
248 .emtcode PARAM_CONSTANT 0x05
250 /* param state property */
251 .emtcode STATE_MATERIAL 0x01
252 .emtcode STATE_LIGHT 0x02
253 .emtcode STATE_LIGHT_MODEL 0x03
254 .emtcode STATE_LIGHT_PROD 0x04
255 .emtcode STATE_FOG 0x05
256 .emtcode STATE_MATRIX_ROWS 0x06
257 /* GL_ARB_fragment_program */
258 .emtcode STATE_TEX_ENV 0x07
259 .emtcode STATE_DEPTH 0x08
260 /* GL_ARB_vertex_program */
261 .emtcode STATE_TEX_GEN 0x09
262 .emtcode STATE_CLIP_PLANE 0x0A
263 .emtcode STATE_POINT 0x0B
265 /* state material property */
266 .emtcode MATERIAL_AMBIENT 0x01
267 .emtcode MATERIAL_DIFFUSE 0x02
268 .emtcode MATERIAL_SPECULAR 0x03
269 .emtcode MATERIAL_EMISSION 0x04
270 .emtcode MATERIAL_SHININESS 0x05
272 /* state light property */
273 .emtcode LIGHT_AMBIENT 0x01
274 .emtcode LIGHT_DIFFUSE 0x02
275 .emtcode LIGHT_SPECULAR 0x03
276 .emtcode LIGHT_POSITION 0x04
277 .emtcode LIGHT_ATTENUATION 0x05
278 .emtcode LIGHT_HALF 0x06
279 .emtcode LIGHT_SPOT_DIRECTION 0x07
281 /* state light model property */
282 .emtcode LIGHT_MODEL_AMBIENT 0x01
283 .emtcode LIGHT_MODEL_SCENECOLOR 0x02
285 /* state light product property */
286 .emtcode LIGHT_PROD_AMBIENT 0x01
287 .emtcode LIGHT_PROD_DIFFUSE 0x02
288 .emtcode LIGHT_PROD_SPECULAR 0x03
290 /* state texture environment property */
291 .emtcode TEX_ENV_COLOR 0x01
293 /* state texture generation coord property */
294 .emtcode TEX_GEN_EYE 0x01
295 .emtcode TEX_GEN_OBJECT 0x02
297 /* state fog property */
298 .emtcode FOG_COLOR 0x01
299 .emtcode FOG_PARAMS 0x02
301 /* state depth property */
302 .emtcode DEPTH_RANGE 0x01
304 /* state point parameters property */
305 .emtcode POINT_SIZE 0x01
306 .emtcode POINT_ATTENUATION 0x02
314 /* GL_ARB_vertex_program */
315 .emtcode ADDRESS 0x06
318 .errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
319 .errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
320 .errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
321 .errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
322 .errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
323 .errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
324 .errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
325 .errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
326 .errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
327 .errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
328 .errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
329 .errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
330 .errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
331 .errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
332 .errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
333 .errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
334 .errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
335 .errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
336 .errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
337 .errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
338 .errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
339 .errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
340 .errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
341 .errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
342 .errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
343 .errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
344 .errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
345 .errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
346 .errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
347 .errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
348 .errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
349 .errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
350 .errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
351 .errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
352 .errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
353 .errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
354 .errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
355 .errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
356 .errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
357 .errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
358 .errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
359 .errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
360 .errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
361 .errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
362 .errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
363 .errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
364 .errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
365 .errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
366 .errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
367 .errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
368 .errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
369 .errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
370 .errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
371 .errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
372 .errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
373 .errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
374 .errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
375 .errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
377 /* extension presence condition registers */
379 /* GL_ARB_vertex_blend */
380 /* GL_EXT_vertex_weighting */
381 .regbyte vertex_blend 0x00
383 /* GL_ARB_matrix_palette */
384 .regbyte matrix_palette 0x00
386 /* GL_ARB_point_parameters */
387 /* GL_EXT_point_parameters */
388 .regbyte point_parameters 0x00
390 /* GL_EXT_secondary_color */
391 .regbyte secondary_color 0x00
393 /* GL_EXT_fog_coord */
394 .regbyte fog_coord 0x00
396 /* GL_EXT_texture_rectangle */
397 /* GL_NV_texture_rectangle */
398 .regbyte texture_rectangle 0x00
400 /* GL_ARB_fragment_program_shadow */
401 .regbyte fragment_program_shadow 0x00
403 /* option presence condition registers */
404 /* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
405 /* register is set to 1 to indicate that the OPTION was specified. */
407 /* GL_ARB_fragment_program */
408 .regbyte ARB_precision_hint_fastest 0x00
409 .regbyte ARB_precision_hint_nicest 0x00
410 .regbyte ARB_fog_exp 0x00
411 .regbyte ARB_fog_exp2 0x00
412 .regbyte ARB_fog_linear 0x00
414 /* GL_ARB_vertex_program */
415 .regbyte ARB_position_invariant 0x00
417 /* GL_ARB_fragment_program_shadow */
418 .regbyte ARB_fragment_program_shadow 0x00
420 /* program target condition register */
421 /* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
422 /* to distinguish between them we need a register that will store for us the current target. */
423 /* the client will typically set the register to apropriate value before parsing a particular */
424 /* program. the mapping between program targets and their values is listed below. */
426 /* program target register value */
427 /* ---------------------------------------------- */
428 /* FRAGMENT_PROGRAM 0x10 */
429 /* VERTEX_PROGRAM 0x20 */
431 /* the initial value of the register is 0 to catch potential errors with not setting the register */
432 /* with the proper value. */
433 .regbyte program_target 0x00
436 <program> ::= <optionSequence> <statementSequence> "END"
439 programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
441 .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
442 .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
444 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
445 optional_space .and fp_optionSequence .and fp_statementSequence .and
446 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
447 '\0' .error CODE_AFTER_END;
449 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
450 optional_space .and vp_optionSequence .and vp_statementSequence .and
451 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
452 '\0' .error CODE_AFTER_END;
455 <optionSequence> ::= <optionSequence> <option>
464 <option> ::= "OPTION" <identifier> ";"
466 NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
467 these options is encountered, the other one is automatically disabled.
468 the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
471 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
472 fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
474 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
475 vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
477 .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
478 .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
479 .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
480 .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
481 fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
482 fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
483 fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
484 .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
485 .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01;
487 "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
489 .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
491 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
493 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
496 <statementSequence> ::= <statementSequence> <statement>
505 <statement> ::= <instruction> ";"
506 | <namingStatement> ";"
508 NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
509 the first character of instruction) for program debugging purposes.
512 fp_statement_1 .or fp_statement_2;
514 vp_statement_1 .or vp_statement_2;
516 fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
518 fp_namingStatement .emit DECLARATION .and semicolon;
520 vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
522 vp_namingStatement .emit DECLARATION .and semicolon;
526 <instruction> ::= <ALUInstruction>
530 <instruction> ::= <ARL_instruction>
531 | <VECTORop_instruction>
532 | <SCALARop_instruction>
533 | <BINSCop_instruction>
534 | <BINop_instruction>
535 | <TRIop_instruction>
539 ALUInstruction .emit OP_ALU_INST .or
540 TexInstruction .emit OP_TEX_INST;
542 ARL_instruction .emit OP_ALU_ARL .or
543 vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
544 vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
545 vp_BINSCop_instruction .emit OP_ALU_BINSC .or
546 vp_BINop_instruction .emit OP_ALU_BIN .or
547 vp_TRIop_instruction .emit OP_ALU_TRI .or
548 vp_SWZ_instruction .emit OP_ALU_SWZ;
552 <ALUInstruction> ::= <VECTORop_instruction>
553 | <SCALARop_instruction>
554 | <BINSCop_instruction>
555 | <BINop_instruction>
556 | <TRIop_instruction>
560 fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
561 fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
562 fp_BINSCop_instruction .emit OP_ALU_BINSC .or
563 fp_BINop_instruction .emit OP_ALU_BIN .or
564 fp_TRIop_instruction .emit OP_ALU_TRI .or
565 fp_SWZ_instruction .emit OP_ALU_SWZ;
569 <TexInstruction> ::= <SAMPLE_instruction>
573 SAMPLE_instruction .emit OP_TEX_SAMPLE .or
574 KIL_instruction .emit OP_TEX_KIL;
578 <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
581 "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
585 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
589 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
591 fp_VECTORop_instruction
592 fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
593 vp_VECTORop_instruction
594 vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
598 <VECTORop> ::= "ABS" | "ABS_SAT"
612 "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
613 "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
614 "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
615 "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
616 "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
618 "ABS" .emit OP_ABS .or
619 "FLR" .emit OP_FLR .or
620 "FRC" .emit OP_FRC .or
621 "LIT" .emit OP_LIT .or
625 <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
627 fp_SCALARop_instruction
628 fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
629 vp_SCALARop_instruction
630 vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
634 <SCALARop> ::= "COS" | "COS_SAT"
651 "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
652 "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
653 "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
654 "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
655 "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
656 "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
657 "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
659 "EX2" .emit OP_EX2 .or
660 "EXP" .emit OP_EXP .or
661 "LG2" .emit OP_LG2 .or
662 "LOG" .emit OP_LOG .or
663 "RCP" .emit OP_RCP .or
667 <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
670 fp_BINSCop_instruction
671 fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
673 vp_BINSCop_instruction
674 vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
679 <BINSCop> ::= "POW" | "POW_SAT"
685 "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
691 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
692 <vectorSrcReg> "," <vectorSrcReg>
695 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
696 <swizzleSrcReg> "," <swizzleSrcReg>
699 fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
702 vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
707 <BINop> ::= "ADD" | "ADD_SAT"
735 "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
736 "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
737 "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
738 "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
739 "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
740 "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
741 "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
742 "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
743 "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
744 "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
745 "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
746 "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
748 "ADD" .emit OP_ADD .or
749 "DP3" .emit OP_DP3 .or
750 "DP4" .emit OP_DP4 .or
751 "DPH" .emit OP_DPH .or
752 "DST" .emit OP_DST .or
753 "MAX" .emit OP_MAX .or
754 "MIN" .emit OP_MIN .or
755 "MUL" .emit OP_MUL .or
756 "SGE" .emit OP_SGE .or
757 "SLT" .emit OP_SLT .or
758 "SUB" .emit OP_SUB .or
763 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
764 <vectorSrcReg> "," <vectorSrcReg> ","
768 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
769 <swizzleSrcReg> "," <swizzleSrcReg> ","
773 fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
774 vectorSrcReg .and comma .and vectorSrcReg;
776 vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
777 swizzleSrcReg .and comma .and swizzleSrcReg;
781 <TRIop> ::= "CMP" | "CMP_SAT"
789 "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
790 "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
791 "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
797 <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
798 <srcReg> "," <extendedSwizzle>
801 <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
805 SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
806 fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
808 "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
809 vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
813 <SWZop> ::= "SWZ" | "SWZ_SAT"
816 "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
820 <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
821 <vectorSrcReg> "," <texImageUnit> ","
825 SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
826 texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
830 <SAMPLEop> ::= "TEX" | "TEX_SAT"
835 "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
836 "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
837 "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
841 <KIL_instruction> ::= "KIL" <vectorSrcReg>
844 "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
848 <texImageUnit> ::= "texture" <optTexImageUnitNum>
851 "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
860 | <shadowTarget> (if option ARB_fragment_program_shadow present)
863 "1D" .emit TEXTARGET_1D .or
864 "2D" .emit TEXTARGET_2D .or
865 "3D" .emit TEXTARGET_3D .or
866 .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
867 "CUBE" .emit TEXTARGET_CUBE .or
868 .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
871 GL_ARB_fragment_program_shadow
872 <shadowTarget> ::= "SHADOW1D"
877 "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
878 "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
879 .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
883 <optTexImageUnitNum> ::= ""
884 | "[" <texImageUnitNum> "]"
887 optTexImageUnitNum_1 .or .true .emit 0x00;
889 lbracket_ne .and texImageUnitNum .and rbracket;
893 <texImageUnitNum> ::= <integer> from 0 to
894 MAX_TEXTURE_IMAGE_UNITS_ARB-1
900 <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
903 optionalSign .and fp_srcReg .and fp_scalarSuffix;
905 optionalSign .and vp_srcReg .and vp_scalarSuffix;
909 <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
912 optionalSign .and vp_srcReg .and swizzleSuffix;
916 <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
919 optionalSign .and fp_srcReg .and optionalSuffix;
922 <maskedDstReg> ::= <dstReg> <optionalMask>
925 fp_dstReg .and fp_optionalMask;
927 vp_dstReg .and vp_optionalMask;
931 <maskedAddrReg> ::= <addrReg> <addrWriteMask>
934 addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
938 <extendedSwizzle> ::= <xyzwExtendedSwizzle>
939 | <rgbaExtendedSwizzle>
942 <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
943 <extSwizComp> "," <extSwizComp>
945 NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
948 rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
950 extSwizComp .and comma .and
951 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
952 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
953 extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
957 <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
958 <xyzwExtSwizComp> "," <xyzwExtSwizComp>
961 xyzwExtSwizComp .and comma .and
962 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
963 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
964 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
968 <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
969 <rgbaExtSwizComp> "," <rgbaExtSwizComp>
972 rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
973 rgbaExtendedSwizzle_4;
974 rgbaExtendedSwizzle_1
975 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
976 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
977 rgbaExtendedSwizzle_2
978 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
979 rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
980 rgbaExtendedSwizzle_3
981 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
982 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
983 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
984 rgbaExtendedSwizzle_4
985 rgbaExtSwizComp_alpha .and comma .and
986 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
987 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
988 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
992 <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
995 optionalSign .and xyzwExtSwizSel;
999 <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
1002 optionalSign .and rgbaExtSwizSel;
1003 rgbaExtSwizComp_digit
1004 optionalSign .and rgbaExtSwizSel_digit;
1005 rgbaExtSwizComp_alpha
1006 optionalSign .and rgbaExtSwizSel_alpha;
1010 <extSwizComp> ::= <optionalSign> <extSwizSel>
1013 optionalSign .and extSwizSel;
1017 <xyzwExtSwizSel> ::= "0"
1022 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
1026 <rgbaExtSwizSel> ::= "0"
1031 rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
1032 rgbaExtSwizSel_digit
1033 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
1034 rgbaExtSwizSel_alpha
1035 rgbaComponent_single;
1039 <extSwizSel> ::= "0"
1044 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
1048 <srcReg> ::= <fragmentAttribReg>
1053 <srcReg> ::= <vertexAttribReg>
1058 fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1060 vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1062 fragmentAttribReg .emit REGISTER_ATTRIB .or
1063 fp_progParamReg .emit REGISTER_PARAM .or
1064 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1066 vertexAttribReg .emit REGISTER_ATTRIB .or
1067 vp_progParamReg .emit REGISTER_PARAM .or
1068 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1072 <dstReg> ::= <temporaryReg>
1073 | <fragmentResultReg>
1076 <dstReg> ::= <temporaryReg>
1080 fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1082 vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1084 fragmentResultReg .emit REGISTER_RESULT .or
1085 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1087 vertexResultReg .emit REGISTER_RESULT .or
1088 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1092 <fragmentAttribReg> ::= <establishedName>
1093 | <fragAttribBinding>
1095 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1098 /*fp_establishedName .or */fragAttribBinding;
1102 <vertexAttribReg> ::= <establishedName>
1103 | <vtxAttribBinding>
1105 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1111 <temporaryReg> ::= <establishedName>
1114 fp_establishedName_no_error_on_identifier;
1116 vp_establishedName_no_error_on_identifier;
1120 <progParamReg> ::= <progParamSingle>
1121 | <progParamArray> "[" <progParamArrayAbs> "]"
1122 | <paramSingleItemUse>
1125 <progParamReg> ::= <progParamSingle>
1126 | <progParamArray> "[" <progParamArrayMem> "]"
1127 | <paramSingleItemUse>
1130 fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
1132 vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
1134 fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
1137 vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
1141 <progParamSingle> ::= <establishedName>
1143 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1151 <progParamArray> ::= <establishedName>
1154 fp_establishedName_no_error_on_identifier;
1156 vp_establishedName_no_error_on_identifier;
1160 <progParamArrayMem> ::= <progParamArrayAbs>
1161 | <progParamArrayRel>
1164 progParamArrayAbs .or progParamArrayRel;
1167 <progParamArrayAbs> ::= <integer>
1170 integer_ne .emit ARRAY_INDEX_ABSOLUTE;
1174 <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
1177 addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
1178 addrComponent .and addrRegRelOffset;
1182 <addrRegRelOffset> ::= ""
1183 | "+" <addrRegPosOffset>
1184 | "-" <addrRegNegOffset>
1187 addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
1189 plus_ne .and addrRegPosOffset;
1191 minus_ne .and addrRegNegOffset;
1195 <addrRegPosOffset> ::= <integer> from 0 to 63
1202 <addrRegNegOffset> ::= <integer> from 0 to 64
1209 <fragmentResultReg> ::= <establishedName>
1212 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1219 <vertexResultReg> ::= <establishedName>
1222 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1229 <addrReg> ::= <establishedName>
1232 vp_establishedName_no_error_on_identifier;
1236 <addrComponent> ::= "." "x"
1239 dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
1240 .emit COMPONENT_X .emit COMPONENT_X;
1244 <addrWriteMask> ::= "." "x"
1247 dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
1250 <scalarSuffix> ::= "." <component>
1253 dot .and fp_component_single .error INVALID_COMPONENT;
1255 dot .and vp_component_single .error INVALID_COMPONENT;
1259 <swizzleSuffix> ::= ""
1261 | "." <component> <component>
1262 <component> <component>
1266 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1268 dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
1270 swizzleSuffix_3 .or swizzleSuffix_4;
1272 vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
1273 vp_component_multi .error INVALID_COMPONENT;
1275 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1276 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1277 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1278 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1282 <optionalSuffix> ::= ""
1284 | "." <xyzwComponent> <xyzwComponent>
1285 <xyzwComponent> <xyzwComponent>
1286 | "." <rgbaComponent> <rgbaComponent>
1287 <rgbaComponent> <rgbaComponent>
1290 optionalSuffix_1 .or
1291 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1293 dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
1295 optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
1297 xyzwComponent_multi .and xyzwComponent_multi .and
1298 xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
1300 rgbaComponent_multi .and rgbaComponent_multi .and
1301 rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
1303 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1304 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1305 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1306 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
1307 "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1308 "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1309 "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1310 "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1314 <component> ::= <xyzwComponent>
1324 xyzwComponent_single .or rgbaComponent_single;
1326 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1327 'w' .emit COMPONENT_W;
1329 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1330 "w" .emit COMPONENT_W;
1334 <xyzwComponent> ::= "x" | "y" | "z" | "w"
1337 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1338 'w' .emit COMPONENT_W;
1339 xyzwComponent_single
1340 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1341 "w" .emit COMPONENT_W;
1345 <rgbaComponent> ::= "r" | "g" | "b" | "a"
1348 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
1349 'a' .emit COMPONENT_W;
1350 rgbaComponent_single
1351 "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
1352 "a" .emit COMPONENT_W;
1356 <optionalMask> ::= ""
1361 <optionalMask> ::= ""
1378 NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
1381 rgbaMask .or xyzwMask .or .true .emit 0x0F;
1383 xyzwMask .or .true .emit 0x0F;
1387 <xyzwMask> ::= "." "x"
1403 NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
1406 dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
1408 "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
1409 "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
1410 "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
1411 "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
1415 <rgbaMask> ::= "." "r"
1432 dot_ne .and rgbaMask_1;
1434 "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
1435 "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
1436 "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
1437 "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
1441 <namingStatement> ::= <ATTRIB_statement>
1444 | <OUTPUT_statement>
1448 <namingStatement> ::= <ATTRIB_statement>
1451 | <ADDRESS_statement>
1452 | <OUTPUT_statement>
1456 fp_ATTRIB_statement .emit ATTRIB .or
1457 fp_PARAM_statement .emit PARAM .or
1458 fp_TEMP_statement .emit TEMP .or
1459 fp_OUTPUT_statement .emit OUTPUT .or
1460 fp_ALIAS_statement .emit ALIAS;
1462 vp_ATTRIB_statement .emit ATTRIB .or
1463 vp_PARAM_statement .emit PARAM .or
1464 vp_TEMP_statement .emit TEMP .or
1465 ADDRESS_statement .emit ADDRESS .or
1466 vp_OUTPUT_statement .emit OUTPUT .or
1467 vp_ALIAS_statement .emit ALIAS;
1471 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1475 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1479 "ATTRIB" .and space .and fp_establishName .and equal .and
1480 fragAttribBinding .error FRAGMENT_EXPECTED;
1482 "ATTRIB" .and space .and vp_establishName .and equal .and
1483 vtxAttribBinding .error VERTEX_EXPECTED;
1487 <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
1490 "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
1494 <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
1497 "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
1501 <fragAttribItem> ::= "color" <optColorType>
1502 | "texcoord" <optTexCoordNum>
1507 fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
1508 fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
1509 .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
1510 "position" .emit FRAGMENT_ATTRIB_POSITION;
1512 "color" .and optColorType;
1514 "texcoord" .and optTexCoordNum;
1518 <vtxAttribItem> ::= "position"
1519 | "weight" <vtxOptWeightNum>
1521 | "color" <optColorType>
1523 | "texcoord" <optTexCoordNum>
1524 | "matrixindex" "[" <vtxWeightNum> "]"
1525 | "attrib" "[" <vtxAttribNum> "]"
1528 "position" .emit VERTEX_ATTRIB_POSITION .or
1529 .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
1530 "normal" .emit VERTEX_ATTRIB_NORMAL .or
1531 vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
1532 "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
1533 vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
1534 .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
1535 vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
1537 "weight" .and vtxOptWeightNum;
1539 "color" .and optColorType;
1541 "texcoord" .and optTexCoordNum;
1543 "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
1545 "attrib" .and lbracket .and vtxAttribNum .and rbracket;
1549 <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
1556 <vtxOptWeightNum> ::= ""
1557 | "[" <vtxWeightNum> "]"
1560 vtxOptWeightNum_1 .or .true .emit 0x00;
1562 lbracket_ne .and vtxWeightNum .and rbracket;
1566 <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
1567 must be divisible by four
1573 <PARAM_statement> ::= <PARAM_singleStmt>
1574 | <PARAM_multipleStmt>
1577 fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
1579 vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
1582 <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
1585 "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
1586 .true .emit PARAM_NULL;
1588 "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
1589 .true .emit PARAM_NULL;
1592 <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
1595 fp_PARAM_multipleStmt
1596 "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1597 fp_paramMultipleInit .and .true .emit PARAM_NULL;
1598 vp_PARAM_multipleStmt
1599 "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1600 vp_paramMultipleInit .and .true .emit PARAM_NULL;
1603 <optArraySize> ::= ""
1604 | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
1605 (maximum number of allowed program
1612 <paramSingleInit> ::= "=" <paramSingleItemDecl>
1615 equal .and fp_paramSingleItemDecl;
1617 equal .and vp_paramSingleItemDecl;
1620 <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
1622 fp_paramMultipleInit
1623 equal .and lbrace .and fp_paramMultInitList .and rbrace;
1624 vp_paramMultipleInit
1625 equal .and lbrace .and vp_paramMultInitList .and rbrace;
1628 <paramMultInitList> ::= <paramMultipleItem>
1629 | <paramMultipleItem> "," <paramMultiInitList>
1631 fp_paramMultInitList
1632 fp_paramMultInitList_1 .or fp_paramMultipleItem;
1633 vp_paramMultInitList
1634 vp_paramMultInitList_1 .or vp_paramMultipleItem;
1635 fp_paramMultInitList_1
1636 fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
1637 vp_paramMultInitList_1
1638 vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
1641 <paramSingleItemDecl> ::= <stateSingleItem>
1642 | <programSingleItem>
1645 fp_paramSingleItemDecl
1646 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1647 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1648 paramConstDecl .emit PARAM_CONSTANT;
1649 vp_paramSingleItemDecl
1650 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1651 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1652 paramConstDecl .emit PARAM_CONSTANT;
1655 <paramSingleItemUse> ::= <stateSingleItem>
1656 | <programSingleItem>
1659 fp_paramSingleItemUse
1660 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1661 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1662 paramConstUse .emit PARAM_CONSTANT;
1663 vp_paramSingleItemUse
1664 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1665 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1666 paramConstUse .emit PARAM_CONSTANT;
1669 <paramMultipleItem> ::= <stateMultipleItem>
1670 | <programMultipleItem>
1673 fp_paramMultipleItem
1674 fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1675 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1676 paramConstDecl .emit PARAM_CONSTANT;
1677 vp_paramMultipleItem
1678 vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1679 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1680 paramConstDecl .emit PARAM_CONSTANT;
1683 <stateMultipleItem> ::= <stateSingleItem>
1684 | "state" "." <stateMatrixRows>
1686 fp_stateMultipleItem
1687 stateMultipleItem_1 .or fp_stateSingleItem;
1688 vp_stateMultipleItem
1689 stateMultipleItem_1 .or vp_stateSingleItem;
1691 "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
1695 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1696 | "state" "." <stateLightItem>
1697 | "state" "." <stateLightModelItem>
1698 | "state" "." <stateLightProdItem>
1699 | "state" "." <stateTexEnvItem>
1700 | "state" "." <stateFogItem>
1701 | "state" "." <stateDepthItem>
1702 | "state" "." <stateMatrixRow>
1705 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1706 | "state" "." <stateLightItem>
1707 | "state" "." <stateLightModelItem>
1708 | "state" "." <stateLightProdItem>
1709 | "state" "." <stateTexGenItem>
1710 | "state" "." <stateFogItem>
1711 | "state" "." <stateClipPlaneItem>
1712 | "state" "." <statePointItem>
1713 | "state" "." <stateMatrixRow>
1716 "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1718 "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1719 fp_stateSingleItem_1
1720 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1721 stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
1722 vp_stateSingleItem_1
1723 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1724 stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
1727 stateMaterialItem .emit STATE_MATERIAL;
1729 stateLightItem .emit STATE_LIGHT;
1731 stateLightModelItem .emit STATE_LIGHT_MODEL;
1733 stateLightProdItem .emit STATE_LIGHT_PROD;
1735 stateTexEnvItem .emit STATE_TEX_ENV;
1737 stateTexGenItem .emit STATE_TEX_GEN;
1739 stateFogItem .emit STATE_FOG;
1741 stateDepthItem .emit STATE_DEPTH;
1743 stateClipPlaneItem .emit STATE_CLIP_PLANE;
1745 statePointItem .emit STATE_POINT;
1747 stateMatrixRow .emit STATE_MATRIX_ROWS;
1750 <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
1753 "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
1756 <stateMatProperty> ::= "ambient"
1763 "ambient" .emit MATERIAL_AMBIENT .or
1764 "diffuse" .emit MATERIAL_DIFFUSE .or
1765 "specular" .emit MATERIAL_SPECULAR .or
1766 "emission" .emit MATERIAL_EMISSION .or
1767 "shininess" .emit MATERIAL_SHININESS;
1770 <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
1771 <stateLightProperty>
1774 "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
1775 stateLightProperty .error INVALID_LIGHT_PROPERTY;
1778 <stateLightProperty> ::= "ambient"
1783 | "spot" "." <stateSpotProperty>
1787 "ambient" .emit LIGHT_AMBIENT .or
1788 "diffuse" .emit LIGHT_DIFFUSE .or
1789 "specular" .emit LIGHT_SPECULAR .or
1790 "position" .emit LIGHT_POSITION .or
1791 "attenuation" .emit LIGHT_ATTENUATION .or
1792 stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
1793 "half" .emit LIGHT_HALF;
1794 stateLightProperty_1
1795 "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
1798 <stateSpotProperty> ::= "direction"
1804 <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
1807 "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
1810 <stateLModProperty> ::= "." "ambient"
1811 | <optFaceType> "." "scenecolor"
1814 stateLModProperty_1 .or stateLModProperty_2;
1816 dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
1818 stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
1820 optFaceType .and dot .and "scenecolor";
1823 <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
1824 <optFaceType> "." <stateLProdProperty>
1827 "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
1828 stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
1831 <stateLProdProperty> ::= "ambient"
1836 "ambient" .emit LIGHT_PROD_AMBIENT .or
1837 "diffuse" .emit LIGHT_PROD_DIFFUSE .or
1838 "specular" .emit LIGHT_PROD_SPECULAR;
1841 <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
1848 <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
1849 <stateTexEnvProperty>
1852 "texenv" .and optLegacyTexUnitNum .and dot .and
1853 stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
1857 <stateTexEnvProperty> ::= "color"
1860 "color" .emit TEX_ENV_COLOR;
1864 <optLegacyTexUnitNum> ::= ""
1865 | "[" <legacyTexUnitNum> "]"
1867 NOTE: <optLegaceTexUnitNum> is not optional.
1870 lbracket_ne .and legacyTexUnitNum .and rbracket;
1874 <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
1881 <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
1882 <stateTexGenType> "." <stateTexGenCoord>
1885 "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
1886 dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
1890 <stateTexGenType> ::= "eye"
1894 "eye" .emit TEX_GEN_EYE .or
1895 "object" .emit TEX_GEN_OBJECT;
1899 <stateTexGenCoord> ::= "s"
1905 "s" .emit COMPONENT_X .or
1906 "t" .emit COMPONENT_Y .or
1907 "r" .emit COMPONENT_Z .or
1908 "q" .emit COMPONENT_W;
1911 <stateFogItem> ::= "fog" "." <stateFogProperty>
1914 "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
1917 <stateFogProperty> ::= "color"
1921 "color" .emit FOG_COLOR .or
1922 "params" .emit FOG_PARAMS;
1926 <stateDepthItem> ::= "depth" "." <stateDepthProperty>
1929 "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
1933 <stateDepthProperty> ::= "range"
1936 "range" .emit DEPTH_RANGE;
1940 <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
1943 "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
1944 "plane" .error INVALID_CLIPPLANE_PROPERTY;
1948 <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
1955 <statePointItem> ::= "point" . <statePointProperty>
1958 "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
1962 <statePointProperty> ::= "size"
1966 "size" .emit POINT_SIZE .or
1967 .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
1970 <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
1971 <stateMatrixRowNum> "]"
1974 stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
1975 lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
1978 <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
1981 stateMatrixItem .and optMatrixRows;
1984 <optMatrixRows> ::= ""
1985 | "." "row" "[" <stateMatrixRowNum> ".."
1986 <stateMatrixRowNum> "]"
1989 optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
1991 dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
1992 stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
1995 <stateMatrixItem> ::= "matrix" . <stateMatrixName>
1996 <stateOptMatModifier>
1999 "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
2002 <stateOptMatModifier> ::= ""
2003 | "." <stateMatModifier>
2006 stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
2007 stateOptMatModifier_1
2008 dot_ne .and stateMatModifier;
2011 <stateMatModifier> ::= "inverse"
2016 "inverse" .emit MATRIX_MODIFIER_INVERSE .or
2017 "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
2018 "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
2021 <stateMatrixRowNum> ::= <integer> from 0 to 3
2027 <stateMatrixName> ::= "modelview" <stateOptModMatNum>
2030 | "texture" <optTexCoordNum>
2031 | "palette" "[" <statePaletteMatNum> "]"
2032 | "program" "[" <stateProgramMatNum> "]"
2035 stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
2036 "projection" .emit MATRIX_PROJECTION .or
2037 "mvp" .emit MATRIX_MVP .or
2038 stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
2039 .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
2040 stateMatrixName_1_4 .emit MATRIX_PROGRAM;
2042 "modelview" .and stateOptModMatNum;
2044 "texture" .and optTexCoordNum;
2046 "palette" .and lbracket .and statePaletteMatNum .and rbracket;
2048 "program" .and lbracket .and stateProgramMatNum .and rbracket;
2051 <stateOptModMatNum> ::= ""
2052 | "[" <stateModMatNum> "]"
2055 .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
2058 lbracket_ne .and stateModMatNum .and rbracket;
2061 <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
2067 <optTexCoordNum> ::= ""
2068 | "[" <texCoordNum> "]"
2071 optTexCoordNum_1 .or .true .emit 0x00;
2073 lbracket_ne .and texCoordNum .and rbracket;
2076 <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
2082 <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
2088 <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
2094 <programSingleItem> ::= <progEnvParam>
2097 NOTE: <programSingleItem> has been modified for correct error handling. If program property
2098 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2101 "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
2103 progEnvParam .or progLocalParam;
2106 <programMultipleItem> ::= <progEnvParams>
2109 NOTE: <programMultipleItem> has been modified for correct error handling. If program property
2110 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2113 "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
2114 programMultipleItem_1
2115 progEnvParams .or progLocalParams;
2118 <progEnvParams> ::= "program" "." "env"
2119 "[" <progEnvParamNums> "]"
2121 NOTE: "program" "." has been moved to <programMultipleItem>.
2124 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
2127 <progEnvParamNums> ::= <progEnvParamNum>
2128 | <progEnvParamNum> ".." <progEnvParamNum>
2131 progEnvParamNums_1 .or progEnvParamNums_2;
2133 progEnvParamNum .and dotdot_ne .and progEnvParamNum;
2135 progEnvParamNum .and .true .emit 0x00;
2138 <progEnvParam> ::= "program" "." "env"
2139 "[" <progEnvParamNum> "]"
2141 NOTE: "program" "." has been moved to <programSingleItem>.
2144 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
2147 <progLocalParams> ::= "program" "." "local"
2148 "[" <progLocalParamNums> "]"
2150 NOTE: "program" "." has been moved to <programMultipleItem>.
2153 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
2156 <progLocalParamNums> ::= <progLocalParamNum>
2157 | <progLocalParamNum> ".." <progLocalParamNum>
2160 progLocalParamNums_1 .or progLocalParamNums_2;
2161 progLocalParamNums_1
2162 progLocalParamNum .and dotdot_ne .and progLocalParamNum;
2163 progLocalParamNums_2
2164 progLocalParamNum .and .true .emit 0x00;
2167 <progLocalParam> ::= "program" "." "local"
2168 "[" <progLocalParamNum> "]"
2170 NOTE: "program" "." has been moved to <programSingleItem>.
2173 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
2176 <progEnvParamNum> ::= <integer> from 0 to
2177 MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
2183 <progLocalParamNum> ::= <integer> from 0 to
2184 MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
2190 <paramConstDecl> ::= <paramConstScalarDecl>
2191 | <paramConstVector>
2194 paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2197 <paramConstUse> ::= <paramConstScalarUse>
2198 | <paramConstVector>
2201 paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2204 <paramConstScalarDecl> ::= <signedFloatConstant>
2206 paramConstScalarDecl
2207 signedFloatConstant;
2210 <paramConstScalarUse> ::= <floatConstant>
2216 <paramConstVector> ::= "{" <signedFloatConstant> "}"
2217 | "{" <signedFloatConstant> ","
2218 <signedFloatConstant> "}"
2219 | "{" <signedFloatConstant> ","
2220 <signedFloatConstant> ","
2221 <signedFloatConstant> "}"
2222 | "{" <signedFloatConstant> ","
2223 <signedFloatConstant> ","
2224 <signedFloatConstant> ","
2225 <signedFloatConstant> "}"
2228 paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
2229 paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
2231 lbrace_ne .and signedFloatConstant .and rbrace;
2233 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2235 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2236 signedFloatConstant .and rbrace;
2238 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2239 signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2242 <signedFloatConstant> ::= <optionalSign> <floatConstant>
2245 optionalSign .and floatConstant;
2248 <floatConstant> ::= see text
2249 The <floatConstant> rule matches a floating-point constant consisting
2250 of an integer part, a decimal point, a fraction part, an "e" or
2251 "E", and an optionally signed integer exponent. The integer and
2252 fraction parts both consist of a sequence of one or more digits ("0"
2253 through "9"). Either the integer part or the fraction parts (not
2254 both) may be missing; either the decimal point or the "e" (or "E")
2255 and the exponent (not both) may be missing.
2261 <optionalSign> ::= ""
2269 <TEMP_statement> ::= "TEMP" <varNameList>
2272 "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
2274 "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
2278 <ADDRESS_statement> ::= "ADDRESS" <varNameList>
2281 "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
2284 <varNameList> ::= <establishName>
2285 | <establishName> "," <varNameList>
2288 fp_varNameList_1 .or fp_establishName;
2290 vp_varNameList_1 .or vp_establishName;
2292 fp_establishName .and comma_ne .and fp_varNameList;
2294 vp_establishName .and comma_ne .and vp_varNameList;
2297 <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
2301 "OUTPUT" .and space .and fp_establishName .and equal .and
2302 fp_resultBinding .error RESULT_EXPECTED;
2304 "OUTPUT" .and space .and vp_establishName .and equal .and
2305 vp_resultBinding .error RESULT_EXPECTED;
2309 <resultBinding> ::= "result" "." "color"
2310 | "result" "." "depth"
2313 <resultBinding> ::= "result" "." "position"
2314 | "result" "." <resultColBinding>
2315 | "result" "." "fogcoord"
2316 | "result" "." "pointsize"
2317 | "result" "." "texcoord" <optTexCoordNum>
2320 "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2322 "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2324 "color" .emit FRAGMENT_RESULT_COLOR .or
2325 "depth" .emit FRAGMENT_RESULT_DEPTH;
2327 .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
2328 resultColBinding .emit VERTEX_RESULT_COLOR .or
2329 "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
2330 "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
2331 vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
2333 "texcoord" .and optTexCoordNum;
2337 <resultColBinding> ::= "color" <optFaceType> <optColorType>
2340 "color" .and optFaceType .and optColorType;
2343 <optFaceType> ::= ""
2348 FaceType .or .true .emit FACE_FRONT;
2350 dot_ne .and FaceProperty;
2352 "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
2355 <optColorType> ::= ""
2360 ColorType .or .true .emit COLOR_PRIMARY;
2362 dot_ne .and ColorProperty;
2364 "primary" .emit COLOR_PRIMARY .or
2365 .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
2368 <ALIAS_statement> ::= "ALIAS" <establishName> "="
2372 "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
2374 "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
2375 fp_ALIAS_statement_1
2376 space .and fp_establishName;
2377 vp_ALIAS_statement_1
2378 space .and vp_establishName;
2381 <establishName> ::= <identifier>
2389 <establishedName> ::= <identifier>
2395 fp_establishedName_no_error_on_identifier
2397 vp_establishedName_no_error_on_identifier
2402 <identifier> ::= see text
2403 The <identifier> rule matches a sequence of one or more letters ("A"
2404 through "Z", "a" through "z"), digits ("0" through "9), underscores
2405 ("_"), or dollar signs ("$"); the first character must not be a
2406 number. Upper and lower case letters are considered different
2407 (names are case-sensitive). The following strings are reserved
2408 keywords and may not be used as identifiers:
2410 ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
2411 COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
2412 END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
2413 LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
2414 MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
2415 POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
2416 SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
2417 TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
2418 fragment, program, result, state, and texture.
2421 <identifier> ::= see text
2422 The <identifier> rule matches a sequence of one or more letters ("A"
2423 through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
2424 or dollar signs ("$"); the first character must not be a number. Upper
2425 and lower case letters are considered different (names are
2426 case-sensitive). The following strings are reserved keywords and may not
2427 be used as identifiers:
2429 ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
2430 EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
2431 PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
2435 fp_identifier_ne .error IDENTIFIER_EXPECTED;
2437 vp_identifier_ne .error IDENTIFIER_EXPECTED;
2439 fp_not_reserved_identifier .and identifier_ne;
2441 vp_not_reserved_identifier .and identifier_ne;
2443 fp_not_reserved_identifier
2444 fp_not_reserved_identifier_1 .or .true;
2445 fp_not_reserved_identifier_1
2446 fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2447 vp_not_reserved_identifier
2448 vp_not_reserved_identifier_1 .or .true;
2449 vp_not_reserved_identifier_1
2450 vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2452 fp_reserved_identifier
2453 "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
2454 "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
2455 "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
2456 "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
2457 "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
2458 "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
2459 "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
2460 "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
2461 "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
2462 "fragment" .or "program" .or "result" .or "state" .or "texture";
2463 vp_reserved_identifier
2464 "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
2465 "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
2466 "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
2467 "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
2468 "XPD" .or "program" .or "result" .or "state" .or "vertex";
2471 The <integer> rule matches an integer constant. The integer consists
2472 of a sequence of one or more digits ("0" through "9").
2475 integer_ne .error INTEGER_EXPECTED;
2484 no_digit_1 .or .true;
2486 digit10 .and .false .error INTEGER_OUT_OF_RANGE;
2489 all_zeroes_1 .or no_digit_1;
2491 '0' .and .loop zero .and no_digit;
2494 integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2496 integer_0_3_2 .or all_zeroes .emit '0';
2497 integer_0_3_2 /* [1, 3] */
2498 leading_zeroes .and '1'-'3' .emit * .and no_digit;
2501 integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2503 integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
2504 all_zeroes .emit '0';
2505 integer_0_63_2 /* [7, 9] */
2506 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2507 integer_0_63_3 /* [10, 59] */
2508 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2509 integer_0_63_4 /* [60, 63] */
2510 leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
2511 integer_0_63_5 /* [1, 6] */
2512 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2515 integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2517 integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
2518 all_zeroes .emit '0';
2519 integer_0_64_2 /* [7, 9] */
2520 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2521 integer_0_64_3 /* [10, 59] */
2522 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2523 integer_0_64_4 /* [60, 64] */
2524 leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
2525 integer_0_64_5 /* [1, 6] */
2526 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2532 space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
2535 space .error OPERATION_NEEDS_SOURCE_VARIABLE;
2538 single_space .and .loop single_space;
2541 white_char .or comment_block;
2544 ' ' .or '\t' .or '\n' .or '\r';
2547 '#' .and .loop comment_char .and new_line;
2549 /* All ASCII characters except '\r', '\n' and '\0' */
2551 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2554 '\n' .or crlf .or '\0';
2560 optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
2563 optional_space .and ',' .error MISSING_COMMA .and optional_space;
2566 optional_space .and ',' .and optional_space;
2569 optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
2572 optional_space .and '[' .and optional_space;
2575 optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
2578 optional_space .and '.' .error MISSING_DOT .and optional_space;
2581 optional_space .and '.' .and optional_space;
2584 optional_space .and '=' .error MISSING_EQUAL .and optional_space;
2587 optional_space .and '{' .error MISSING_LBRACE .and optional_space;
2590 optional_space .and '{' .and optional_space;
2593 optional_space .and '}' .error MISSING_RBRACE .and optional_space;
2596 optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
2599 optional_space .and '.' .and '.' .and optional_space;
2602 The definition below accepts the following floating point number formats:
2603 .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
2604 Also 99 format was considered and accepted because of a large number of existing program
2605 strings with such a format.
2608 float_1 .or float_2 .or float_legacy;
2610 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2612 integer_ne .and float_3;
2614 float_4 .or float_5;
2616 '.' .and optional_integer .and optional_exponent;
2618 exponent .emit 0x00;
2620 integer_ne .and .true .emit 0x00 .emit 0x00;
2623 Below is a correct version of <float> definiton.
2627 float_1 .or float_2;
2629 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2631 integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
2633 float_4 .or float_5;
2635 '.' .and optional_integer .and optional_exponent;
2637 exponent .emit 0x00;
2641 integer_ne_1 .and .true .emit 0x00 .emit $;
2643 digit10 .emit * .and .loop digit10 .emit *;
2646 integer_ne .or .true .emit 0x00;
2649 NOTE: If exponent part is omited we treat it as if it was "E+1".
2652 exponent .or .true .emit 0x00;
2655 exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
2660 minus_ne .or plus_ne .or .true;
2663 optional_space .and '+' .and optional_space;
2666 optional_space .and '-' .emit '-' .and optional_space;
2669 first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
2672 first_idchar .or digit10;
2675 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2681 string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
2682 executed to create the string. The symbol must not throw any errors and emit bytes - it should
2683 stop if it encounters invalid character. After this the resulting string (from starting
2684 position up to the invalid character (but without it) is compared with the grammar string.
2686 .string __string_filter;
2689 .loop __identifier_char;
2692 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
2695 error token filtering
2698 e_signature_char .and .loop e_signature_char;
2700 '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2703 .loop e_statement_not_term;
2704 /* All ASCII characters to one of '\r', '\n', '\0' and ';' */
2705 e_statement_not_term
2706 '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2709 e_identifier_first .and .loop e_identifier_next;
2711 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2713 e_identifier_first .or '0'-'9';
2716 e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
2717 '-' .or ',' .or ';';
2719 e_token_digit .and .loop e_token_digit;
2724 'A'-'Z' .or 'a'-'z' .or '0'-'9';