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_draw_buffers option flags */
35 .emtcode ARB_DRAW_BUFFERS 0x80
37 /* if we need more flags, we have three options:
38 1) change the existing flags to indicate an option to a shift, so 0x01 becomes 0 (because
39 1 << 0 is 0x01), 0x02 becomes 1 (1 << 1 == 0x02), and so on - this would give us
41 2) mark special value of 0 to say "the following byte will hold the upper 8 bit flags",
42 3) expand all the existing flags to be 2 bytes long
45 /* GL_ARB_fragment_program instruction class */
46 .emtcode OP_ALU_INST 0x00
47 .emtcode OP_TEX_INST 0x01
49 /* GL_ARB_vertex_program instruction class */
52 /* GL_ARB_fragment_program instruction type */
53 .emtcode OP_ALU_VECTOR 0x00
54 .emtcode OP_ALU_SCALAR 0x01
55 .emtcode OP_ALU_BINSC 0x02
56 .emtcode OP_ALU_BIN 0x03
57 .emtcode OP_ALU_TRI 0x04
58 .emtcode OP_ALU_SWZ 0x05
59 .emtcode OP_TEX_SAMPLE 0x06
60 .emtcode OP_TEX_KIL 0x07
62 /* GL_ARB_vertex_program instruction type */
63 .emtcode OP_ALU_ARL 0x08
71 /* GL_ARB_fragment_program instruction code */
73 .emtcode OP_ABS_SAT 0x1B
75 .emtcode OP_FLR_SAT 0x26
77 .emtcode OP_FRC_SAT 0x27
79 .emtcode OP_LIT_SAT 0x2A
81 .emtcode OP_MOV_SAT 0x30
83 .emtcode OP_COS_SAT 0x20
85 .emtcode OP_EX2_SAT 0x25
87 .emtcode OP_LG2_SAT 0x29
89 .emtcode OP_RCP_SAT 0x33
91 .emtcode OP_RSQ_SAT 0x34
93 .emtcode OP_SIN_SAT 0x39
95 .emtcode OP_SCS_SAT 0x36
97 .emtcode OP_POW_SAT 0x32
99 .emtcode OP_ADD_SAT 0x1C
101 .emtcode OP_DP3_SAT 0x21
103 .emtcode OP_DP4_SAT 0x22
105 .emtcode OP_DPH_SAT 0x23
107 .emtcode OP_DST_SAT 0x24
109 .emtcode OP_MAX_SAT 0x2E
111 .emtcode OP_MIN_SAT 0x2F
113 .emtcode OP_MUL_SAT 0x31
115 .emtcode OP_SGE_SAT 0x37
117 .emtcode OP_SLT_SAT 0x3A
119 .emtcode OP_SUB_SAT 0x3B
121 .emtcode OP_XPD_SAT 0x43
123 .emtcode OP_CMP_SAT 0x1E
125 .emtcode OP_LRP_SAT 0x2C
127 .emtcode OP_MAD_SAT 0x2D
129 .emtcode OP_SWZ_SAT 0x3C
131 .emtcode OP_TEX_SAT 0x3E
133 .emtcode OP_TXB_SAT 0x40
135 .emtcode OP_TXP_SAT 0x42
138 /* GL_ARB_vertex_program instruction code */
167 /* fragment attribute binding */
168 .emtcode FRAGMENT_ATTRIB_COLOR 0x01
169 .emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
170 .emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
171 .emtcode FRAGMENT_ATTRIB_POSITION 0x04
173 /* vertex attribute binding */
174 .emtcode VERTEX_ATTRIB_POSITION 0x01
175 .emtcode VERTEX_ATTRIB_WEIGHT 0x02
176 .emtcode VERTEX_ATTRIB_NORMAL 0x03
177 .emtcode VERTEX_ATTRIB_COLOR 0x04
178 .emtcode VERTEX_ATTRIB_FOGCOORD 0x05
179 .emtcode VERTEX_ATTRIB_TEXCOORD 0x06
180 .emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
181 .emtcode VERTEX_ATTRIB_GENERIC 0x08
183 /* fragment result binding */
184 .emtcode FRAGMENT_RESULT_COLOR 0x01
185 .emtcode FRAGMENT_RESULT_DEPTH 0x02
187 /* vertex result binding */
188 .emtcode VERTEX_RESULT_POSITION 0x01
189 .emtcode VERTEX_RESULT_COLOR 0x02
190 .emtcode VERTEX_RESULT_FOGCOORD 0x03
191 .emtcode VERTEX_RESULT_POINTSIZE 0x04
192 .emtcode VERTEX_RESULT_TEXCOORD 0x05
195 .emtcode TEXTARGET_1D 0x01
196 .emtcode TEXTARGET_2D 0x02
197 .emtcode TEXTARGET_3D 0x03
198 .emtcode TEXTARGET_RECT 0x04
199 .emtcode TEXTARGET_CUBE 0x05
200 /* GL_ARB_fragment_program_shadow */
201 .emtcode TEXTARGET_SHADOW1D 0x06
202 .emtcode TEXTARGET_SHADOW2D 0x07
203 .emtcode TEXTARGET_SHADOWRECT 0x08
206 .emtcode FACE_FRONT 0x00
207 .emtcode FACE_BACK 0x01
210 .emtcode COLOR_PRIMARY 0x00
211 .emtcode COLOR_SECONDARY 0x01
214 .emtcode COMPONENT_X 0x00
215 .emtcode COMPONENT_Y 0x01
216 .emtcode COMPONENT_Z 0x02
217 .emtcode COMPONENT_W 0x03
218 .emtcode COMPONENT_0 0x04
219 .emtcode COMPONENT_1 0x05
221 /* array index type */
222 .emtcode ARRAY_INDEX_ABSOLUTE 0x00
223 .emtcode ARRAY_INDEX_RELATIVE 0x01
226 .emtcode MATRIX_MODELVIEW 0x01
227 .emtcode MATRIX_PROJECTION 0x02
228 .emtcode MATRIX_MVP 0x03
229 .emtcode MATRIX_TEXTURE 0x04
230 .emtcode MATRIX_PALETTE 0x05
231 .emtcode MATRIX_PROGRAM 0x06
233 /* matrix modifier */
234 .emtcode MATRIX_MODIFIER_IDENTITY 0x00
235 .emtcode MATRIX_MODIFIER_INVERSE 0x01
236 .emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
237 .emtcode MATRIX_MODIFIER_INVTRANS 0x03
240 .emtcode CONSTANT_SCALAR 0x01
241 .emtcode CONSTANT_VECTOR 0x02
243 /* program param type */
244 .emtcode PROGRAM_PARAM_ENV 0x01
245 .emtcode PROGRAM_PARAM_LOCAL 0x02
248 .emtcode REGISTER_ATTRIB 0x01
249 .emtcode REGISTER_PARAM 0x02
250 .emtcode REGISTER_RESULT 0x03
251 .emtcode REGISTER_ESTABLISHED_NAME 0x04
254 .emtcode PARAM_NULL 0x00
255 .emtcode PARAM_ARRAY_ELEMENT 0x01
256 .emtcode PARAM_STATE_ELEMENT 0x02
257 .emtcode PARAM_PROGRAM_ELEMENT 0x03
258 .emtcode PARAM_PROGRAM_ELEMENTS 0x04
259 .emtcode PARAM_CONSTANT 0x05
261 /* param state property */
262 .emtcode STATE_MATERIAL 0x01
263 .emtcode STATE_LIGHT 0x02
264 .emtcode STATE_LIGHT_MODEL 0x03
265 .emtcode STATE_LIGHT_PROD 0x04
266 .emtcode STATE_FOG 0x05
267 .emtcode STATE_MATRIX_ROWS 0x06
268 /* GL_ARB_fragment_program */
269 .emtcode STATE_TEX_ENV 0x07
270 .emtcode STATE_DEPTH 0x08
271 /* GL_ARB_vertex_program */
272 .emtcode STATE_TEX_GEN 0x09
273 .emtcode STATE_CLIP_PLANE 0x0A
274 .emtcode STATE_POINT 0x0B
276 /* state material property */
277 .emtcode MATERIAL_AMBIENT 0x01
278 .emtcode MATERIAL_DIFFUSE 0x02
279 .emtcode MATERIAL_SPECULAR 0x03
280 .emtcode MATERIAL_EMISSION 0x04
281 .emtcode MATERIAL_SHININESS 0x05
283 /* state light property */
284 .emtcode LIGHT_AMBIENT 0x01
285 .emtcode LIGHT_DIFFUSE 0x02
286 .emtcode LIGHT_SPECULAR 0x03
287 .emtcode LIGHT_POSITION 0x04
288 .emtcode LIGHT_ATTENUATION 0x05
289 .emtcode LIGHT_HALF 0x06
290 .emtcode LIGHT_SPOT_DIRECTION 0x07
292 /* state light model property */
293 .emtcode LIGHT_MODEL_AMBIENT 0x01
294 .emtcode LIGHT_MODEL_SCENECOLOR 0x02
296 /* state light product property */
297 .emtcode LIGHT_PROD_AMBIENT 0x01
298 .emtcode LIGHT_PROD_DIFFUSE 0x02
299 .emtcode LIGHT_PROD_SPECULAR 0x03
301 /* state texture environment property */
302 .emtcode TEX_ENV_COLOR 0x01
304 /* state texture generation coord property */
305 .emtcode TEX_GEN_EYE 0x01
306 .emtcode TEX_GEN_OBJECT 0x02
308 /* state fog property */
309 .emtcode FOG_COLOR 0x01
310 .emtcode FOG_PARAMS 0x02
312 /* state depth property */
313 .emtcode DEPTH_RANGE 0x01
315 /* state point parameters property */
316 .emtcode POINT_SIZE 0x01
317 .emtcode POINT_ATTENUATION 0x02
325 /* GL_ARB_vertex_program */
326 .emtcode ADDRESS 0x06
329 .errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
330 .errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
331 .errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
332 .errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
333 .errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
334 .errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
335 .errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
336 .errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
337 .errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
338 .errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
339 .errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
340 .errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
341 .errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
342 .errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
343 .errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
344 .errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
345 .errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
346 .errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
347 .errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
348 .errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
349 .errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
350 .errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
351 .errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
352 .errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
353 .errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
354 .errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
355 .errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
356 .errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
357 .errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
358 .errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
359 .errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
360 .errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
361 .errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
362 .errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
363 .errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
364 .errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
365 .errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
366 .errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
367 .errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
368 .errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
369 .errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
370 .errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
371 .errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
372 .errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
373 .errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
374 .errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
375 .errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
376 .errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
377 .errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
378 .errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
379 .errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
380 .errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
381 .errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
382 .errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
383 .errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
384 .errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
385 .errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
386 .errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
388 /* extension presence condition registers */
390 /* GL_ARB_vertex_blend */
391 /* GL_EXT_vertex_weighting */
392 .regbyte vertex_blend 0x00
394 /* GL_ARB_matrix_palette */
395 .regbyte matrix_palette 0x00
397 /* GL_ARB_point_parameters */
398 /* GL_EXT_point_parameters */
399 .regbyte point_parameters 0x00
401 /* GL_EXT_secondary_color */
402 .regbyte secondary_color 0x00
404 /* GL_EXT_fog_coord */
405 .regbyte fog_coord 0x00
407 /* GL_EXT_texture_rectangle */
408 /* GL_NV_texture_rectangle */
409 .regbyte texture_rectangle 0x00
411 /* GL_ARB_fragment_program_shadow */
412 .regbyte fragment_program_shadow 0x00
414 /* GL_ARB_draw_buffers */
415 .regbyte draw_buffers 0x00
417 /* option presence condition registers */
418 /* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
419 /* register is set to 1 to indicate that the OPTION was specified. */
421 /* GL_ARB_fragment_program */
422 .regbyte ARB_precision_hint_fastest 0x00
423 .regbyte ARB_precision_hint_nicest 0x00
424 .regbyte ARB_fog_exp 0x00
425 .regbyte ARB_fog_exp2 0x00
426 .regbyte ARB_fog_linear 0x00
428 /* GL_ARB_vertex_program */
429 .regbyte ARB_position_invariant 0x00
431 /* GL_ARB_fragment_program_shadow */
432 .regbyte ARB_fragment_program_shadow 0x00
434 /* GL_ARB_draw_buffers */
435 .regbyte ARB_draw_buffers 0x00
437 /* program target condition register */
438 /* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
439 /* to distinguish between them we need a register that will store for us the current target. */
440 /* the client will typically set the register to apropriate value before parsing a particular */
441 /* program. the mapping between program targets and their values is listed below. */
443 /* program target register value */
444 /* ---------------------------------------------- */
445 /* FRAGMENT_PROGRAM 0x10 */
446 /* VERTEX_PROGRAM 0x20 */
448 /* the initial value of the register is 0 to catch potential errors with not setting the register */
449 /* with the proper value. */
450 .regbyte program_target 0x00
453 <program> ::= <optionSequence> <statementSequence> "END"
456 programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
458 .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
459 .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
461 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
462 optional_space .and fp_optionSequence .and fp_statementSequence .and
463 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
464 '\0' .error CODE_AFTER_END;
466 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
467 optional_space .and vp_optionSequence .and vp_statementSequence .and
468 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
469 '\0' .error CODE_AFTER_END;
472 <optionSequence> ::= <optionSequence> <option>
481 <option> ::= "OPTION" <identifier> ";"
483 NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
484 these options is encountered, the other one is automatically disabled.
485 the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
488 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
489 fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
491 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
492 vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
494 .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
495 .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
496 .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
497 .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
498 fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
499 fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
500 fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
501 .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
502 .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
503 .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
504 .load ARB_draw_buffers 0x01;
506 "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
508 .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
510 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
512 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
515 <statementSequence> ::= <statementSequence> <statement>
524 <statement> ::= <instruction> ";"
525 | <namingStatement> ";"
527 NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
528 the first character of instruction) for program debugging purposes.
531 fp_statement_1 .or fp_statement_2;
533 vp_statement_1 .or vp_statement_2;
535 fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
537 fp_namingStatement .emit DECLARATION .and semicolon;
539 vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
541 vp_namingStatement .emit DECLARATION .and semicolon;
545 <instruction> ::= <ALUInstruction>
549 <instruction> ::= <ARL_instruction>
550 | <VECTORop_instruction>
551 | <SCALARop_instruction>
552 | <BINSCop_instruction>
553 | <BINop_instruction>
554 | <TRIop_instruction>
558 ALUInstruction .emit OP_ALU_INST .or
559 TexInstruction .emit OP_TEX_INST;
561 ARL_instruction .emit OP_ALU_ARL .or
562 vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
563 vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
564 vp_BINSCop_instruction .emit OP_ALU_BINSC .or
565 vp_BINop_instruction .emit OP_ALU_BIN .or
566 vp_TRIop_instruction .emit OP_ALU_TRI .or
567 vp_SWZ_instruction .emit OP_ALU_SWZ;
571 <ALUInstruction> ::= <VECTORop_instruction>
572 | <SCALARop_instruction>
573 | <BINSCop_instruction>
574 | <BINop_instruction>
575 | <TRIop_instruction>
579 fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
580 fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
581 fp_BINSCop_instruction .emit OP_ALU_BINSC .or
582 fp_BINop_instruction .emit OP_ALU_BIN .or
583 fp_TRIop_instruction .emit OP_ALU_TRI .or
584 fp_SWZ_instruction .emit OP_ALU_SWZ;
588 <TexInstruction> ::= <SAMPLE_instruction>
592 SAMPLE_instruction .emit OP_TEX_SAMPLE .or
593 KIL_instruction .emit OP_TEX_KIL;
597 <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
600 "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
604 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
608 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
610 fp_VECTORop_instruction
611 fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
612 vp_VECTORop_instruction
613 vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
617 <VECTORop> ::= "ABS" | "ABS_SAT"
631 "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
632 "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
633 "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
634 "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
635 "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
637 "ABS" .emit OP_ABS .or
638 "FLR" .emit OP_FLR .or
639 "FRC" .emit OP_FRC .or
640 "LIT" .emit OP_LIT .or
644 <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
646 fp_SCALARop_instruction
647 fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
648 vp_SCALARop_instruction
649 vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
653 <SCALARop> ::= "COS" | "COS_SAT"
670 "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
671 "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
672 "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
673 "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
674 "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
675 "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
676 "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
678 "EX2" .emit OP_EX2 .or
679 "EXP" .emit OP_EXP .or
680 "LG2" .emit OP_LG2 .or
681 "LOG" .emit OP_LOG .or
682 "RCP" .emit OP_RCP .or
686 <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
689 fp_BINSCop_instruction
690 fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
692 vp_BINSCop_instruction
693 vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
698 <BINSCop> ::= "POW" | "POW_SAT"
704 "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
710 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
711 <vectorSrcReg> "," <vectorSrcReg>
714 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
715 <swizzleSrcReg> "," <swizzleSrcReg>
718 fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
721 vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
726 <BINop> ::= "ADD" | "ADD_SAT"
754 "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
755 "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
756 "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
757 "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
758 "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
759 "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
760 "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
761 "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
762 "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
763 "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
764 "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
765 "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
767 "ADD" .emit OP_ADD .or
768 "DP3" .emit OP_DP3 .or
769 "DP4" .emit OP_DP4 .or
770 "DPH" .emit OP_DPH .or
771 "DST" .emit OP_DST .or
772 "MAX" .emit OP_MAX .or
773 "MIN" .emit OP_MIN .or
774 "MUL" .emit OP_MUL .or
775 "SGE" .emit OP_SGE .or
776 "SLT" .emit OP_SLT .or
777 "SUB" .emit OP_SUB .or
782 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
783 <vectorSrcReg> "," <vectorSrcReg> ","
787 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
788 <swizzleSrcReg> "," <swizzleSrcReg> ","
792 fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
793 vectorSrcReg .and comma .and vectorSrcReg;
795 vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
796 swizzleSrcReg .and comma .and swizzleSrcReg;
800 <TRIop> ::= "CMP" | "CMP_SAT"
808 "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
809 "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
810 "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
816 <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
817 <srcReg> "," <extendedSwizzle>
820 <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
824 SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
825 fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
827 "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
828 vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
832 <SWZop> ::= "SWZ" | "SWZ_SAT"
835 "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
839 <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
840 <vectorSrcReg> "," <texImageUnit> ","
844 SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
845 texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
849 <SAMPLEop> ::= "TEX" | "TEX_SAT"
854 "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
855 "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
856 "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
860 <KIL_instruction> ::= "KIL" <vectorSrcReg>
863 "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
867 <texImageUnit> ::= "texture" <optTexImageUnitNum>
870 "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
879 | <shadowTarget> (if option ARB_fragment_program_shadow present)
882 "1D" .emit TEXTARGET_1D .or
883 "2D" .emit TEXTARGET_2D .or
884 "3D" .emit TEXTARGET_3D .or
885 .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
886 "CUBE" .emit TEXTARGET_CUBE .or
887 .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
890 GL_ARB_fragment_program_shadow
891 <shadowTarget> ::= "SHADOW1D"
896 "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
897 "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
898 .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
902 <optTexImageUnitNum> ::= ""
903 | "[" <texImageUnitNum> "]"
906 optTexImageUnitNum_1 .or .true .emit 0x00;
908 lbracket_ne .and texImageUnitNum .and rbracket;
912 <texImageUnitNum> ::= <integer> from 0 to
913 MAX_TEXTURE_IMAGE_UNITS_ARB-1
919 <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
922 optionalSign .and fp_srcReg .and fp_scalarSuffix;
924 optionalSign .and vp_srcReg .and vp_scalarSuffix;
928 <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
931 optionalSign .and vp_srcReg .and swizzleSuffix;
935 <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
938 optionalSign .and fp_srcReg .and optionalSuffix;
941 <maskedDstReg> ::= <dstReg> <optionalMask>
944 fp_dstReg .and fp_optionalMask;
946 vp_dstReg .and vp_optionalMask;
950 <maskedAddrReg> ::= <addrReg> <addrWriteMask>
953 addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
957 <extendedSwizzle> ::= <xyzwExtendedSwizzle>
958 | <rgbaExtendedSwizzle>
961 <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
962 <extSwizComp> "," <extSwizComp>
964 NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
967 rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
969 extSwizComp .and comma .and
970 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
971 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
972 extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
976 <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
977 <xyzwExtSwizComp> "," <xyzwExtSwizComp>
980 xyzwExtSwizComp .and comma .and
981 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
982 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
983 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
987 <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
988 <rgbaExtSwizComp> "," <rgbaExtSwizComp>
991 rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
992 rgbaExtendedSwizzle_4;
993 rgbaExtendedSwizzle_1
994 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
995 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
996 rgbaExtendedSwizzle_2
997 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
998 rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
999 rgbaExtendedSwizzle_3
1000 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
1001 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1002 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1003 rgbaExtendedSwizzle_4
1004 rgbaExtSwizComp_alpha .and comma .and
1005 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1006 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1007 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1011 <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
1014 optionalSign .and xyzwExtSwizSel;
1018 <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
1021 optionalSign .and rgbaExtSwizSel;
1022 rgbaExtSwizComp_digit
1023 optionalSign .and rgbaExtSwizSel_digit;
1024 rgbaExtSwizComp_alpha
1025 optionalSign .and rgbaExtSwizSel_alpha;
1029 <extSwizComp> ::= <optionalSign> <extSwizSel>
1032 optionalSign .and extSwizSel;
1036 <xyzwExtSwizSel> ::= "0"
1041 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
1045 <rgbaExtSwizSel> ::= "0"
1050 rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
1051 rgbaExtSwizSel_digit
1052 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
1053 rgbaExtSwizSel_alpha
1054 rgbaComponent_single;
1058 <extSwizSel> ::= "0"
1063 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
1067 <srcReg> ::= <fragmentAttribReg>
1072 <srcReg> ::= <vertexAttribReg>
1077 fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1079 vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1081 fragmentAttribReg .emit REGISTER_ATTRIB .or
1082 fp_progParamReg .emit REGISTER_PARAM .or
1083 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1085 vertexAttribReg .emit REGISTER_ATTRIB .or
1086 vp_progParamReg .emit REGISTER_PARAM .or
1087 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1091 <dstReg> ::= <temporaryReg>
1092 | <fragmentResultReg>
1095 <dstReg> ::= <temporaryReg>
1099 fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1101 vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1103 fragmentResultReg .emit REGISTER_RESULT .or
1104 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1106 vertexResultReg .emit REGISTER_RESULT .or
1107 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1111 <fragmentAttribReg> ::= <establishedName>
1112 | <fragAttribBinding>
1114 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1117 /*fp_establishedName .or */fragAttribBinding;
1121 <vertexAttribReg> ::= <establishedName>
1122 | <vtxAttribBinding>
1124 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1130 <temporaryReg> ::= <establishedName>
1133 fp_establishedName_no_error_on_identifier;
1135 vp_establishedName_no_error_on_identifier;
1139 <progParamReg> ::= <progParamSingle>
1140 | <progParamArray> "[" <progParamArrayAbs> "]"
1141 | <paramSingleItemUse>
1144 <progParamReg> ::= <progParamSingle>
1145 | <progParamArray> "[" <progParamArrayMem> "]"
1146 | <paramSingleItemUse>
1149 fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
1151 vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
1153 fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
1156 vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
1160 <progParamSingle> ::= <establishedName>
1162 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1170 <progParamArray> ::= <establishedName>
1173 fp_establishedName_no_error_on_identifier;
1175 vp_establishedName_no_error_on_identifier;
1179 <progParamArrayMem> ::= <progParamArrayAbs>
1180 | <progParamArrayRel>
1183 progParamArrayAbs .or progParamArrayRel;
1186 <progParamArrayAbs> ::= <integer>
1189 integer_ne .emit ARRAY_INDEX_ABSOLUTE;
1193 <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
1196 addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
1197 addrComponent .and addrRegRelOffset;
1201 <addrRegRelOffset> ::= ""
1202 | "+" <addrRegPosOffset>
1203 | "-" <addrRegNegOffset>
1206 addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
1208 plus_ne .and addrRegPosOffset;
1210 minus_ne .and addrRegNegOffset;
1214 <addrRegPosOffset> ::= <integer> from 0 to 63
1221 <addrRegNegOffset> ::= <integer> from 0 to 64
1228 <fragmentResultReg> ::= <establishedName>
1231 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1238 <vertexResultReg> ::= <establishedName>
1241 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1248 <addrReg> ::= <establishedName>
1251 vp_establishedName_no_error_on_identifier;
1255 <addrComponent> ::= "." "x"
1258 dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
1259 .emit COMPONENT_X .emit COMPONENT_X;
1263 <addrWriteMask> ::= "." "x"
1266 dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
1269 <scalarSuffix> ::= "." <component>
1272 dot .and fp_component_single .error INVALID_COMPONENT;
1274 dot .and vp_component_single .error INVALID_COMPONENT;
1278 <swizzleSuffix> ::= ""
1280 | "." <component> <component>
1281 <component> <component>
1285 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1287 dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
1289 swizzleSuffix_3 .or swizzleSuffix_4;
1291 vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
1292 vp_component_multi .error INVALID_COMPONENT;
1294 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1295 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1296 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1297 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1301 <optionalSuffix> ::= ""
1303 | "." <xyzwComponent> <xyzwComponent>
1304 <xyzwComponent> <xyzwComponent>
1305 | "." <rgbaComponent> <rgbaComponent>
1306 <rgbaComponent> <rgbaComponent>
1309 optionalSuffix_1 .or
1310 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1312 dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
1314 optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
1316 xyzwComponent_multi .and xyzwComponent_multi .and
1317 xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
1319 rgbaComponent_multi .and rgbaComponent_multi .and
1320 rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
1322 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1323 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1324 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1325 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
1326 "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1327 "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1328 "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1329 "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1333 <component> ::= <xyzwComponent>
1343 xyzwComponent_single .or rgbaComponent_single;
1345 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1346 'w' .emit COMPONENT_W;
1348 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1349 "w" .emit COMPONENT_W;
1353 <xyzwComponent> ::= "x" | "y" | "z" | "w"
1356 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1357 'w' .emit COMPONENT_W;
1358 xyzwComponent_single
1359 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1360 "w" .emit COMPONENT_W;
1364 <rgbaComponent> ::= "r" | "g" | "b" | "a"
1367 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
1368 'a' .emit COMPONENT_W;
1369 rgbaComponent_single
1370 "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
1371 "a" .emit COMPONENT_W;
1375 <optionalMask> ::= ""
1380 <optionalMask> ::= ""
1397 NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
1400 rgbaMask .or xyzwMask .or .true .emit 0x0F;
1402 xyzwMask .or .true .emit 0x0F;
1406 <xyzwMask> ::= "." "x"
1422 NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
1425 dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
1427 "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
1428 "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
1429 "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
1430 "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
1434 <rgbaMask> ::= "." "r"
1451 dot_ne .and rgbaMask_1;
1453 "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
1454 "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
1455 "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
1456 "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
1460 <namingStatement> ::= <ATTRIB_statement>
1463 | <OUTPUT_statement>
1467 <namingStatement> ::= <ATTRIB_statement>
1470 | <ADDRESS_statement>
1471 | <OUTPUT_statement>
1475 fp_ATTRIB_statement .emit ATTRIB .or
1476 fp_PARAM_statement .emit PARAM .or
1477 fp_TEMP_statement .emit TEMP .or
1478 fp_OUTPUT_statement .emit OUTPUT .or
1479 fp_ALIAS_statement .emit ALIAS;
1481 vp_ATTRIB_statement .emit ATTRIB .or
1482 vp_PARAM_statement .emit PARAM .or
1483 vp_TEMP_statement .emit TEMP .or
1484 ADDRESS_statement .emit ADDRESS .or
1485 vp_OUTPUT_statement .emit OUTPUT .or
1486 vp_ALIAS_statement .emit ALIAS;
1490 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1494 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1498 "ATTRIB" .and space .and fp_establishName .and equal .and
1499 fragAttribBinding .error FRAGMENT_EXPECTED;
1501 "ATTRIB" .and space .and vp_establishName .and equal .and
1502 vtxAttribBinding .error VERTEX_EXPECTED;
1506 <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
1509 "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
1513 <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
1516 "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
1520 <fragAttribItem> ::= "color" <optColorType>
1521 | "texcoord" <optTexCoordNum>
1526 fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
1527 fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
1528 .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
1529 "position" .emit FRAGMENT_ATTRIB_POSITION;
1531 "color" .and optColorType;
1533 "texcoord" .and optTexCoordNum;
1537 <vtxAttribItem> ::= "position"
1538 | "weight" <vtxOptWeightNum>
1540 | "color" <optColorType>
1542 | "texcoord" <optTexCoordNum>
1543 | "matrixindex" "[" <vtxWeightNum> "]"
1544 | "attrib" "[" <vtxAttribNum> "]"
1547 "position" .emit VERTEX_ATTRIB_POSITION .or
1548 .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
1549 "normal" .emit VERTEX_ATTRIB_NORMAL .or
1550 vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
1551 "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
1552 vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
1553 .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
1554 vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
1556 "weight" .and vtxOptWeightNum;
1558 "color" .and optColorType;
1560 "texcoord" .and optTexCoordNum;
1562 "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
1564 "attrib" .and lbracket .and vtxAttribNum .and rbracket;
1568 <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
1575 <vtxOptWeightNum> ::= ""
1576 | "[" <vtxWeightNum> "]"
1579 vtxOptWeightNum_1 .or .true .emit 0x00;
1581 lbracket_ne .and vtxWeightNum .and rbracket;
1585 <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
1586 must be divisible by four
1592 <PARAM_statement> ::= <PARAM_singleStmt>
1593 | <PARAM_multipleStmt>
1596 fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
1598 vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
1601 <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
1604 "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
1605 .true .emit PARAM_NULL;
1607 "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
1608 .true .emit PARAM_NULL;
1611 <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
1614 fp_PARAM_multipleStmt
1615 "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1616 fp_paramMultipleInit .and .true .emit PARAM_NULL;
1617 vp_PARAM_multipleStmt
1618 "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1619 vp_paramMultipleInit .and .true .emit PARAM_NULL;
1622 <optArraySize> ::= ""
1623 | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
1624 (maximum number of allowed program
1631 <paramSingleInit> ::= "=" <paramSingleItemDecl>
1634 equal .and fp_paramSingleItemDecl;
1636 equal .and vp_paramSingleItemDecl;
1639 <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
1641 fp_paramMultipleInit
1642 equal .and lbrace .and fp_paramMultInitList .and rbrace;
1643 vp_paramMultipleInit
1644 equal .and lbrace .and vp_paramMultInitList .and rbrace;
1647 <paramMultInitList> ::= <paramMultipleItem>
1648 | <paramMultipleItem> "," <paramMultiInitList>
1650 fp_paramMultInitList
1651 fp_paramMultInitList_1 .or fp_paramMultipleItem;
1652 vp_paramMultInitList
1653 vp_paramMultInitList_1 .or vp_paramMultipleItem;
1654 fp_paramMultInitList_1
1655 fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
1656 vp_paramMultInitList_1
1657 vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
1660 <paramSingleItemDecl> ::= <stateSingleItem>
1661 | <programSingleItem>
1664 fp_paramSingleItemDecl
1665 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1666 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1667 paramConstDecl .emit PARAM_CONSTANT;
1668 vp_paramSingleItemDecl
1669 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1670 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1671 paramConstDecl .emit PARAM_CONSTANT;
1674 <paramSingleItemUse> ::= <stateSingleItem>
1675 | <programSingleItem>
1678 fp_paramSingleItemUse
1679 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1680 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1681 paramConstUse .emit PARAM_CONSTANT;
1682 vp_paramSingleItemUse
1683 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1684 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1685 paramConstUse .emit PARAM_CONSTANT;
1688 <paramMultipleItem> ::= <stateMultipleItem>
1689 | <programMultipleItem>
1692 fp_paramMultipleItem
1693 fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1694 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1695 paramConstDecl .emit PARAM_CONSTANT;
1696 vp_paramMultipleItem
1697 vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1698 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1699 paramConstDecl .emit PARAM_CONSTANT;
1702 <stateMultipleItem> ::= <stateSingleItem>
1703 | "state" "." <stateMatrixRows>
1705 fp_stateMultipleItem
1706 stateMultipleItem_1 .or fp_stateSingleItem;
1707 vp_stateMultipleItem
1708 stateMultipleItem_1 .or vp_stateSingleItem;
1710 "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
1714 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1715 | "state" "." <stateLightItem>
1716 | "state" "." <stateLightModelItem>
1717 | "state" "." <stateLightProdItem>
1718 | "state" "." <stateTexEnvItem>
1719 | "state" "." <stateFogItem>
1720 | "state" "." <stateDepthItem>
1721 | "state" "." <stateMatrixRow>
1724 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1725 | "state" "." <stateLightItem>
1726 | "state" "." <stateLightModelItem>
1727 | "state" "." <stateLightProdItem>
1728 | "state" "." <stateTexGenItem>
1729 | "state" "." <stateFogItem>
1730 | "state" "." <stateClipPlaneItem>
1731 | "state" "." <statePointItem>
1732 | "state" "." <stateMatrixRow>
1735 "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1737 "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1738 fp_stateSingleItem_1
1739 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1740 stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
1741 vp_stateSingleItem_1
1742 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1743 stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
1746 stateMaterialItem .emit STATE_MATERIAL;
1748 stateLightItem .emit STATE_LIGHT;
1750 stateLightModelItem .emit STATE_LIGHT_MODEL;
1752 stateLightProdItem .emit STATE_LIGHT_PROD;
1754 stateTexEnvItem .emit STATE_TEX_ENV;
1756 stateTexGenItem .emit STATE_TEX_GEN;
1758 stateFogItem .emit STATE_FOG;
1760 stateDepthItem .emit STATE_DEPTH;
1762 stateClipPlaneItem .emit STATE_CLIP_PLANE;
1764 statePointItem .emit STATE_POINT;
1766 stateMatrixRow .emit STATE_MATRIX_ROWS;
1769 <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
1772 "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
1775 <stateMatProperty> ::= "ambient"
1782 "ambient" .emit MATERIAL_AMBIENT .or
1783 "diffuse" .emit MATERIAL_DIFFUSE .or
1784 "specular" .emit MATERIAL_SPECULAR .or
1785 "emission" .emit MATERIAL_EMISSION .or
1786 "shininess" .emit MATERIAL_SHININESS;
1789 <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
1790 <stateLightProperty>
1793 "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
1794 stateLightProperty .error INVALID_LIGHT_PROPERTY;
1797 <stateLightProperty> ::= "ambient"
1802 | "spot" "." <stateSpotProperty>
1806 "ambient" .emit LIGHT_AMBIENT .or
1807 "diffuse" .emit LIGHT_DIFFUSE .or
1808 "specular" .emit LIGHT_SPECULAR .or
1809 "position" .emit LIGHT_POSITION .or
1810 "attenuation" .emit LIGHT_ATTENUATION .or
1811 stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
1812 "half" .emit LIGHT_HALF;
1813 stateLightProperty_1
1814 "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
1817 <stateSpotProperty> ::= "direction"
1823 <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
1826 "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
1829 <stateLModProperty> ::= "." "ambient"
1830 | <optFaceType> "." "scenecolor"
1833 stateLModProperty_1 .or stateLModProperty_2;
1835 dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
1837 stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
1839 optFaceType .and dot .and "scenecolor";
1842 <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
1843 <optFaceType> "." <stateLProdProperty>
1846 "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
1847 stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
1850 <stateLProdProperty> ::= "ambient"
1855 "ambient" .emit LIGHT_PROD_AMBIENT .or
1856 "diffuse" .emit LIGHT_PROD_DIFFUSE .or
1857 "specular" .emit LIGHT_PROD_SPECULAR;
1860 <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
1867 <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
1868 <stateTexEnvProperty>
1871 "texenv" .and optLegacyTexUnitNum .and dot .and
1872 stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
1876 <stateTexEnvProperty> ::= "color"
1879 "color" .emit TEX_ENV_COLOR;
1883 <optLegacyTexUnitNum> ::= ""
1884 | "[" <legacyTexUnitNum> "]"
1886 NOTE: <optLegaceTexUnitNum> is not optional.
1889 lbracket_ne .and legacyTexUnitNum .and rbracket;
1893 <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
1900 <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
1901 <stateTexGenType> "." <stateTexGenCoord>
1904 "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
1905 dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
1909 <stateTexGenType> ::= "eye"
1913 "eye" .emit TEX_GEN_EYE .or
1914 "object" .emit TEX_GEN_OBJECT;
1918 <stateTexGenCoord> ::= "s"
1924 "s" .emit COMPONENT_X .or
1925 "t" .emit COMPONENT_Y .or
1926 "r" .emit COMPONENT_Z .or
1927 "q" .emit COMPONENT_W;
1930 <stateFogItem> ::= "fog" "." <stateFogProperty>
1933 "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
1936 <stateFogProperty> ::= "color"
1940 "color" .emit FOG_COLOR .or
1941 "params" .emit FOG_PARAMS;
1945 <stateDepthItem> ::= "depth" "." <stateDepthProperty>
1948 "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
1952 <stateDepthProperty> ::= "range"
1955 "range" .emit DEPTH_RANGE;
1959 <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
1962 "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
1963 "plane" .error INVALID_CLIPPLANE_PROPERTY;
1967 <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
1974 <statePointItem> ::= "point" "." <statePointProperty>
1977 "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
1981 <statePointProperty> ::= "size"
1985 "size" .emit POINT_SIZE .or
1986 .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
1989 <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
1990 <stateMatrixRowNum> "]"
1993 stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
1994 lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
1997 <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
2000 stateMatrixItem .and optMatrixRows;
2003 <optMatrixRows> ::= ""
2004 | "." "row" "[" <stateMatrixRowNum> ".."
2005 <stateMatrixRowNum> "]"
2008 optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
2010 dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
2011 stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
2014 <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
2015 <stateOptMatModifier>
2018 "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
2021 <stateOptMatModifier> ::= ""
2022 | "." <stateMatModifier>
2025 stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
2026 stateOptMatModifier_1
2027 dot_ne .and stateMatModifier;
2030 <stateMatModifier> ::= "inverse"
2035 "inverse" .emit MATRIX_MODIFIER_INVERSE .or
2036 "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
2037 "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
2040 <stateMatrixRowNum> ::= <integer> from 0 to 3
2046 <stateMatrixName> ::= "modelview" <stateOptModMatNum>
2049 | "texture" <optTexCoordNum>
2050 | "palette" "[" <statePaletteMatNum> "]"
2051 | "program" "[" <stateProgramMatNum> "]"
2054 stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
2055 "projection" .emit MATRIX_PROJECTION .or
2056 "mvp" .emit MATRIX_MVP .or
2057 stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
2058 .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
2059 stateMatrixName_1_4 .emit MATRIX_PROGRAM;
2061 "modelview" .and stateOptModMatNum;
2063 "texture" .and optTexCoordNum;
2065 "palette" .and lbracket .and statePaletteMatNum .and rbracket;
2067 "program" .and lbracket .and stateProgramMatNum .and rbracket;
2070 <stateOptModMatNum> ::= ""
2071 | "[" <stateModMatNum> "]"
2074 .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
2077 lbracket_ne .and stateModMatNum .and rbracket;
2080 <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
2086 <optTexCoordNum> ::= ""
2087 | "[" <texCoordNum> "]"
2090 optTexCoordNum_1 .or .true .emit 0x00;
2092 lbracket_ne .and texCoordNum .and rbracket;
2095 <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
2101 <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
2107 <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
2113 <programSingleItem> ::= <progEnvParam>
2116 NOTE: <programSingleItem> has been modified for correct error handling. If program property
2117 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2120 "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
2122 progEnvParam .or progLocalParam;
2125 <programMultipleItem> ::= <progEnvParams>
2128 NOTE: <programMultipleItem> has been modified for correct error handling. If program property
2129 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2132 "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
2133 programMultipleItem_1
2134 progEnvParams .or progLocalParams;
2137 <progEnvParams> ::= "program" "." "env"
2138 "[" <progEnvParamNums> "]"
2140 NOTE: "program" "." has been moved to <programMultipleItem>.
2143 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
2146 <progEnvParamNums> ::= <progEnvParamNum>
2147 | <progEnvParamNum> ".." <progEnvParamNum>
2150 progEnvParamNums_1 .or progEnvParamNums_2;
2152 progEnvParamNum .and dotdot_ne .and progEnvParamNum;
2154 progEnvParamNum .and .true .emit 0x00;
2157 <progEnvParam> ::= "program" "." "env"
2158 "[" <progEnvParamNum> "]"
2160 NOTE: "program" "." has been moved to <programSingleItem>.
2163 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
2166 <progLocalParams> ::= "program" "." "local"
2167 "[" <progLocalParamNums> "]"
2169 NOTE: "program" "." has been moved to <programMultipleItem>.
2172 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
2175 <progLocalParamNums> ::= <progLocalParamNum>
2176 | <progLocalParamNum> ".." <progLocalParamNum>
2179 progLocalParamNums_1 .or progLocalParamNums_2;
2180 progLocalParamNums_1
2181 progLocalParamNum .and dotdot_ne .and progLocalParamNum;
2182 progLocalParamNums_2
2183 progLocalParamNum .and .true .emit 0x00;
2186 <progLocalParam> ::= "program" "." "local"
2187 "[" <progLocalParamNum> "]"
2189 NOTE: "program" "." has been moved to <programSingleItem>.
2192 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
2195 <progEnvParamNum> ::= <integer> from 0 to
2196 MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
2202 <progLocalParamNum> ::= <integer> from 0 to
2203 MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
2209 <paramConstDecl> ::= <paramConstScalarDecl>
2210 | <paramConstVector>
2213 paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2216 <paramConstUse> ::= <paramConstScalarUse>
2217 | <paramConstVector>
2220 paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2223 <paramConstScalarDecl> ::= <signedFloatConstant>
2225 paramConstScalarDecl
2226 signedFloatConstant;
2229 <paramConstScalarUse> ::= <floatConstant>
2235 <paramConstVector> ::= "{" <signedFloatConstant> "}"
2236 | "{" <signedFloatConstant> ","
2237 <signedFloatConstant> "}"
2238 | "{" <signedFloatConstant> ","
2239 <signedFloatConstant> ","
2240 <signedFloatConstant> "}"
2241 | "{" <signedFloatConstant> ","
2242 <signedFloatConstant> ","
2243 <signedFloatConstant> ","
2244 <signedFloatConstant> "}"
2247 paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
2248 paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
2250 lbrace_ne .and signedFloatConstant .and rbrace;
2252 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2254 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2255 signedFloatConstant .and rbrace;
2257 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2258 signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2261 <signedFloatConstant> ::= <optionalSign> <floatConstant>
2264 optionalSign .and floatConstant;
2267 <floatConstant> ::= see text
2268 The <floatConstant> rule matches a floating-point constant consisting
2269 of an integer part, a decimal point, a fraction part, an "e" or
2270 "E", and an optionally signed integer exponent. The integer and
2271 fraction parts both consist of a sequence of one or more digits ("0"
2272 through "9"). Either the integer part or the fraction parts (not
2273 both) may be missing; either the decimal point or the "e" (or "E")
2274 and the exponent (not both) may be missing.
2280 <optionalSign> ::= ""
2288 <TEMP_statement> ::= "TEMP" <varNameList>
2291 "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
2293 "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
2297 <ADDRESS_statement> ::= "ADDRESS" <varNameList>
2300 "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
2303 <varNameList> ::= <establishName>
2304 | <establishName> "," <varNameList>
2307 fp_varNameList_1 .or fp_establishName;
2309 vp_varNameList_1 .or vp_establishName;
2311 fp_establishName .and comma_ne .and fp_varNameList;
2313 vp_establishName .and comma_ne .and vp_varNameList;
2316 <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
2320 "OUTPUT" .and space .and fp_establishName .and equal .and
2321 fp_resultBinding .error RESULT_EXPECTED;
2323 "OUTPUT" .and space .and vp_establishName .and equal .and
2324 vp_resultBinding .error RESULT_EXPECTED;
2328 <resultBinding> ::= "result" "." "color"
2329 | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
2330 | "result" "." "depth"
2333 <resultBinding> ::= "result" "." "position"
2334 | "result" "." <resultColBinding>
2335 | "result" "." "fogcoord"
2336 | "result" "." "pointsize"
2337 | "result" "." "texcoord" <optTexCoordNum>
2340 "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2342 "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2344 fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
2345 "depth" .emit FRAGMENT_RESULT_DEPTH;
2347 "color" .and optOutputColorNum;
2349 .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
2350 resultColBinding .emit VERTEX_RESULT_COLOR .or
2351 "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
2352 "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
2353 vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
2355 "texcoord" .and optTexCoordNum;
2359 <optOutputColorNum> ::= ""
2360 | "[" <outputColorNum> "]"
2363 .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
2365 lbracket_ne .and outputColorNum .and rbracket;
2369 <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
2376 <resultColBinding> ::= "color" <optFaceType> <optColorType>
2379 "color" .and optFaceType .and optColorType;
2382 <optFaceType> ::= ""
2387 FaceType .or .true .emit FACE_FRONT;
2389 dot_ne .and FaceProperty;
2391 "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
2394 <optColorType> ::= ""
2399 ColorType .or .true .emit COLOR_PRIMARY;
2401 dot_ne .and ColorProperty;
2403 "primary" .emit COLOR_PRIMARY .or
2404 .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
2407 <ALIAS_statement> ::= "ALIAS" <establishName> "="
2411 "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
2413 "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
2414 fp_ALIAS_statement_1
2415 space .and fp_establishName;
2416 vp_ALIAS_statement_1
2417 space .and vp_establishName;
2420 <establishName> ::= <identifier>
2428 <establishedName> ::= <identifier>
2434 fp_establishedName_no_error_on_identifier
2436 vp_establishedName_no_error_on_identifier
2441 <identifier> ::= see text
2442 The <identifier> rule matches a sequence of one or more letters ("A"
2443 through "Z", "a" through "z"), digits ("0" through "9), underscores
2444 ("_"), or dollar signs ("$"); the first character must not be a
2445 number. Upper and lower case letters are considered different
2446 (names are case-sensitive). The following strings are reserved
2447 keywords and may not be used as identifiers:
2449 ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
2450 COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
2451 END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
2452 LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
2453 MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
2454 POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
2455 SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
2456 TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
2457 fragment, program, result, state, and texture.
2460 <identifier> ::= see text
2461 The <identifier> rule matches a sequence of one or more letters ("A"
2462 through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
2463 or dollar signs ("$"); the first character must not be a number. Upper
2464 and lower case letters are considered different (names are
2465 case-sensitive). The following strings are reserved keywords and may not
2466 be used as identifiers:
2468 ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
2469 EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
2470 PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
2474 fp_identifier_ne .error IDENTIFIER_EXPECTED;
2476 vp_identifier_ne .error IDENTIFIER_EXPECTED;
2478 fp_not_reserved_identifier .and identifier_ne;
2480 vp_not_reserved_identifier .and identifier_ne;
2482 fp_not_reserved_identifier
2483 fp_not_reserved_identifier_1 .or .true;
2484 fp_not_reserved_identifier_1
2485 fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2486 vp_not_reserved_identifier
2487 vp_not_reserved_identifier_1 .or .true;
2488 vp_not_reserved_identifier_1
2489 vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2491 fp_reserved_identifier
2492 "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
2493 "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
2494 "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
2495 "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
2496 "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
2497 "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
2498 "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
2499 "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
2500 "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
2501 "fragment" .or "program" .or "result" .or "state" .or "texture";
2502 vp_reserved_identifier
2503 "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
2504 "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
2505 "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
2506 "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
2507 "XPD" .or "program" .or "result" .or "state" .or "vertex";
2510 The <integer> rule matches an integer constant. The integer consists
2511 of a sequence of one or more digits ("0" through "9").
2514 integer_ne .error INTEGER_EXPECTED;
2523 no_digit_1 .or .true;
2525 digit10 .and .false .error INTEGER_OUT_OF_RANGE;
2528 all_zeroes_1 .or no_digit_1;
2530 '0' .and .loop zero .and no_digit;
2533 integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2535 integer_0_3_2 .or all_zeroes .emit '0';
2536 integer_0_3_2 /* [1, 3] */
2537 leading_zeroes .and '1'-'3' .emit * .and no_digit;
2540 integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2542 integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
2543 all_zeroes .emit '0';
2544 integer_0_63_2 /* [7, 9] */
2545 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2546 integer_0_63_3 /* [10, 59] */
2547 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2548 integer_0_63_4 /* [60, 63] */
2549 leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
2550 integer_0_63_5 /* [1, 6] */
2551 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2554 integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2556 integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
2557 all_zeroes .emit '0';
2558 integer_0_64_2 /* [7, 9] */
2559 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2560 integer_0_64_3 /* [10, 59] */
2561 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2562 integer_0_64_4 /* [60, 64] */
2563 leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
2564 integer_0_64_5 /* [1, 6] */
2565 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2571 space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
2574 space .error OPERATION_NEEDS_SOURCE_VARIABLE;
2577 single_space .and .loop single_space;
2580 white_char .or comment_block;
2583 ' ' .or '\t' .or '\n' .or '\r';
2586 '#' .and .loop comment_char .and new_line;
2588 /* All ASCII characters except '\r', '\n' and '\0' */
2590 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2593 '\n' .or crlf .or '\0';
2599 optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
2602 optional_space .and ',' .error MISSING_COMMA .and optional_space;
2605 optional_space .and ',' .and optional_space;
2608 optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
2611 optional_space .and '[' .and optional_space;
2614 optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
2617 optional_space .and '.' .error MISSING_DOT .and optional_space;
2620 optional_space .and '.' .and optional_space;
2623 optional_space .and '=' .error MISSING_EQUAL .and optional_space;
2626 optional_space .and '{' .error MISSING_LBRACE .and optional_space;
2629 optional_space .and '{' .and optional_space;
2632 optional_space .and '}' .error MISSING_RBRACE .and optional_space;
2635 optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
2638 optional_space .and '.' .and '.' .and optional_space;
2641 The definition below accepts the following floating point number formats:
2642 .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
2643 Also 99 format was considered and accepted because of a large number of existing program
2644 strings with such a format.
2647 float_1 .or float_2 .or float_legacy;
2649 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2651 integer_ne .and float_3;
2653 float_4 .or float_5;
2655 '.' .and optional_integer .and optional_exponent;
2657 exponent .emit 0x00;
2659 integer_ne .and .true .emit 0x00 .emit 0x00;
2662 Below is a correct version of <float> definiton.
2666 float_1 .or float_2;
2668 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2670 integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
2672 float_4 .or float_5;
2674 '.' .and optional_integer .and optional_exponent;
2676 exponent .emit 0x00;
2680 integer_ne_1 .and .true .emit 0x00 .emit $;
2682 digit10 .emit * .and .loop digit10 .emit *;
2685 integer_ne .or .true .emit 0x00;
2688 NOTE: If exponent part is omited we treat it as if it was "E+1".
2691 exponent .or .true .emit 0x00;
2694 exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
2699 minus_ne .or plus_ne .or .true;
2702 optional_space .and '+' .and optional_space;
2705 optional_space .and '-' .emit '-' .and optional_space;
2708 first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
2711 first_idchar .or digit10;
2714 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2720 string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
2721 executed to create the string. The symbol must not throw any errors and emit bytes - it should
2722 stop if it encounters invalid character. After this the resulting string (from starting
2723 position up to the invalid character (but without it) is compared with the grammar string.
2725 .string __string_filter;
2728 .loop __identifier_char;
2731 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
2734 error token filtering
2737 e_signature_char .and .loop e_signature_char;
2739 '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2742 .loop e_statement_not_term;
2743 /* All ASCII characters to one of '\r', '\n', '\0' and ';' */
2744 e_statement_not_term
2745 '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2748 e_identifier_first .and .loop e_identifier_next;
2750 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2752 e_identifier_first .or '0'-'9';
2755 e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
2756 '-' .or ',' .or ';';
2758 e_token_digit .and .loop e_token_digit;
2763 'A'-'Z' .or 'a'-'z' .or '0'-'9';