2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * \file arbprogram.syn
27 * ARB_fragment/vertex_program syntax
34 This value must be incremented every time emit code values or structure of the production
35 array changes. This value is placed at the beginning of the production array. The loader
36 compares the value with its REVISION value. If they do not match, the loader is not up
39 .emtcode REVISION 0x08
42 .emtcode FRAGMENT_PROGRAM 0x01
43 .emtcode VERTEX_PROGRAM 0x02
47 .emtcode INSTRUCTION 0x02
48 .emtcode DECLARATION 0x03
51 /* GL_ARB_fragment_program option */
52 .emtcode ARB_PRECISION_HINT_FASTEST 0x00
53 .emtcode ARB_PRECISION_HINT_NICEST 0x01
54 .emtcode ARB_FOG_EXP 0x02
55 .emtcode ARB_FOG_EXP2 0x03
56 .emtcode ARB_FOG_LINEAR 0x04
58 /* GL_ARB_vertex_program option */
59 .emtcode ARB_POSITION_INVARIANT 0x05
61 /* GL_ARB_fragment_program_shadow option */
62 .emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
64 /* GL_ARB_draw_buffers option */
65 .emtcode ARB_DRAW_BUFFERS 0x07
67 /* GL_ARB_fragment_program instruction class */
68 .emtcode OP_ALU_INST 0x00
69 .emtcode OP_TEX_INST 0x01
71 /* GL_ARB_vertex_program instruction class */
74 /* GL_ARB_fragment_program instruction type */
75 .emtcode OP_ALU_VECTOR 0x00
76 .emtcode OP_ALU_SCALAR 0x01
77 .emtcode OP_ALU_BINSC 0x02
78 .emtcode OP_ALU_BIN 0x03
79 .emtcode OP_ALU_TRI 0x04
80 .emtcode OP_ALU_SWZ 0x05
81 .emtcode OP_TEX_SAMPLE 0x06
82 .emtcode OP_TEX_KIL 0x07
84 /* GL_ARB_vertex_program instruction type */
85 .emtcode OP_ALU_ARL 0x08
93 /* GL_ARB_fragment_program instruction code */
95 .emtcode OP_ABS_SAT 0x1B
97 .emtcode OP_FLR_SAT 0x26
99 .emtcode OP_FRC_SAT 0x27
101 .emtcode OP_LIT_SAT 0x2A
103 .emtcode OP_MOV_SAT 0x30
105 .emtcode OP_COS_SAT 0x20
107 .emtcode OP_EX2_SAT 0x25
109 .emtcode OP_LG2_SAT 0x29
111 .emtcode OP_RCP_SAT 0x33
113 .emtcode OP_RSQ_SAT 0x34
115 .emtcode OP_SIN_SAT 0x39
117 .emtcode OP_SCS_SAT 0x36
119 .emtcode OP_POW_SAT 0x32
121 .emtcode OP_ADD_SAT 0x1C
123 .emtcode OP_DP3_SAT 0x21
125 .emtcode OP_DP4_SAT 0x22
127 .emtcode OP_DPH_SAT 0x23
129 .emtcode OP_DST_SAT 0x24
131 .emtcode OP_MAX_SAT 0x2E
133 .emtcode OP_MIN_SAT 0x2F
135 .emtcode OP_MUL_SAT 0x31
137 .emtcode OP_SGE_SAT 0x37
139 .emtcode OP_SLT_SAT 0x3A
141 .emtcode OP_SUB_SAT 0x3B
143 .emtcode OP_XPD_SAT 0x43
145 .emtcode OP_CMP_SAT 0x1E
147 .emtcode OP_LRP_SAT 0x2C
149 .emtcode OP_MAD_SAT 0x2D
151 .emtcode OP_SWZ_SAT 0x3C
153 .emtcode OP_TEX_SAT 0x3E
155 .emtcode OP_TXB_SAT 0x40
157 .emtcode OP_TXP_SAT 0x42
160 /* GL_ARB_vertex_program instruction code */
189 /* fragment attribute binding */
190 .emtcode FRAGMENT_ATTRIB_COLOR 0x01
191 .emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
192 .emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
193 .emtcode FRAGMENT_ATTRIB_POSITION 0x04
195 /* vertex attribute binding */
196 .emtcode VERTEX_ATTRIB_POSITION 0x01
197 .emtcode VERTEX_ATTRIB_WEIGHT 0x02
198 .emtcode VERTEX_ATTRIB_NORMAL 0x03
199 .emtcode VERTEX_ATTRIB_COLOR 0x04
200 .emtcode VERTEX_ATTRIB_FOGCOORD 0x05
201 .emtcode VERTEX_ATTRIB_TEXCOORD 0x06
202 .emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
203 .emtcode VERTEX_ATTRIB_GENERIC 0x08
205 /* fragment result binding */
206 .emtcode FRAGMENT_RESULT_COLOR 0x01
207 .emtcode FRAGMENT_RESULT_DEPTH 0x02
209 /* vertex result binding */
210 .emtcode VERTEX_RESULT_POSITION 0x01
211 .emtcode VERTEX_RESULT_COLOR 0x02
212 .emtcode VERTEX_RESULT_FOGCOORD 0x03
213 .emtcode VERTEX_RESULT_POINTSIZE 0x04
214 .emtcode VERTEX_RESULT_TEXCOORD 0x05
217 .emtcode TEXTARGET_1D 0x01
218 .emtcode TEXTARGET_2D 0x02
219 .emtcode TEXTARGET_3D 0x03
220 .emtcode TEXTARGET_RECT 0x04
221 .emtcode TEXTARGET_CUBE 0x05
222 /* GL_ARB_fragment_program_shadow */
223 .emtcode TEXTARGET_SHADOW1D 0x06
224 .emtcode TEXTARGET_SHADOW2D 0x07
225 .emtcode TEXTARGET_SHADOWRECT 0x08
228 .emtcode FACE_FRONT 0x00
229 .emtcode FACE_BACK 0x01
232 .emtcode COLOR_PRIMARY 0x00
233 .emtcode COLOR_SECONDARY 0x01
236 .emtcode COMPONENT_X 0x00
237 .emtcode COMPONENT_Y 0x01
238 .emtcode COMPONENT_Z 0x02
239 .emtcode COMPONENT_W 0x03
240 .emtcode COMPONENT_0 0x04
241 .emtcode COMPONENT_1 0x05
243 /* array index type */
244 .emtcode ARRAY_INDEX_ABSOLUTE 0x00
245 .emtcode ARRAY_INDEX_RELATIVE 0x01
248 .emtcode MATRIX_MODELVIEW 0x01
249 .emtcode MATRIX_PROJECTION 0x02
250 .emtcode MATRIX_MVP 0x03
251 .emtcode MATRIX_TEXTURE 0x04
252 .emtcode MATRIX_PALETTE 0x05
253 .emtcode MATRIX_PROGRAM 0x06
255 /* matrix modifier */
256 .emtcode MATRIX_MODIFIER_IDENTITY 0x00
257 .emtcode MATRIX_MODIFIER_INVERSE 0x01
258 .emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
259 .emtcode MATRIX_MODIFIER_INVTRANS 0x03
262 .emtcode CONSTANT_SCALAR 0x01
263 .emtcode CONSTANT_VECTOR 0x02
265 /* program param type */
266 .emtcode PROGRAM_PARAM_ENV 0x01
267 .emtcode PROGRAM_PARAM_LOCAL 0x02
270 .emtcode REGISTER_ATTRIB 0x01
271 .emtcode REGISTER_PARAM 0x02
272 .emtcode REGISTER_RESULT 0x03
273 .emtcode REGISTER_ESTABLISHED_NAME 0x04
276 .emtcode PARAM_NULL 0x00
277 .emtcode PARAM_ARRAY_ELEMENT 0x01
278 .emtcode PARAM_STATE_ELEMENT 0x02
279 .emtcode PARAM_PROGRAM_ELEMENT 0x03
280 .emtcode PARAM_PROGRAM_ELEMENTS 0x04
281 .emtcode PARAM_CONSTANT 0x05
283 /* param state property */
284 .emtcode STATE_MATERIAL 0x01
285 .emtcode STATE_LIGHT 0x02
286 .emtcode STATE_LIGHT_MODEL 0x03
287 .emtcode STATE_LIGHT_PROD 0x04
288 .emtcode STATE_FOG 0x05
289 .emtcode STATE_MATRIX_ROWS 0x06
290 /* GL_ARB_fragment_program */
291 .emtcode STATE_TEX_ENV 0x07
292 .emtcode STATE_DEPTH 0x08
293 /* GL_ARB_vertex_program */
294 .emtcode STATE_TEX_GEN 0x09
295 .emtcode STATE_CLIP_PLANE 0x0A
296 .emtcode STATE_POINT 0x0B
298 /* state material property */
299 .emtcode MATERIAL_AMBIENT 0x01
300 .emtcode MATERIAL_DIFFUSE 0x02
301 .emtcode MATERIAL_SPECULAR 0x03
302 .emtcode MATERIAL_EMISSION 0x04
303 .emtcode MATERIAL_SHININESS 0x05
305 /* state light property */
306 .emtcode LIGHT_AMBIENT 0x01
307 .emtcode LIGHT_DIFFUSE 0x02
308 .emtcode LIGHT_SPECULAR 0x03
309 .emtcode LIGHT_POSITION 0x04
310 .emtcode LIGHT_ATTENUATION 0x05
311 .emtcode LIGHT_HALF 0x06
312 .emtcode LIGHT_SPOT_DIRECTION 0x07
314 /* state light model property */
315 .emtcode LIGHT_MODEL_AMBIENT 0x01
316 .emtcode LIGHT_MODEL_SCENECOLOR 0x02
318 /* state light product property */
319 .emtcode LIGHT_PROD_AMBIENT 0x01
320 .emtcode LIGHT_PROD_DIFFUSE 0x02
321 .emtcode LIGHT_PROD_SPECULAR 0x03
323 /* state texture environment property */
324 .emtcode TEX_ENV_COLOR 0x01
326 /* state texture generation coord property */
327 .emtcode TEX_GEN_EYE 0x01
328 .emtcode TEX_GEN_OBJECT 0x02
330 /* state fog property */
331 .emtcode FOG_COLOR 0x01
332 .emtcode FOG_PARAMS 0x02
334 /* state depth property */
335 .emtcode DEPTH_RANGE 0x01
337 /* state point parameters property */
338 .emtcode POINT_SIZE 0x01
339 .emtcode POINT_ATTENUATION 0x02
347 /* GL_ARB_vertex_program */
348 .emtcode ADDRESS 0x06
351 .errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
352 .errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
353 .errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
354 .errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
355 .errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
356 .errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
357 .errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
358 .errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
359 .errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
360 .errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
361 .errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
362 .errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
363 .errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
364 .errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
365 .errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
366 .errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
367 .errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
368 .errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
369 .errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
370 .errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
371 .errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
372 .errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
373 .errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
374 .errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
375 .errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
376 .errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
377 .errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
378 .errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
379 .errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
380 .errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
381 .errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
382 .errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
383 .errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
384 .errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
385 .errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
386 .errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
387 .errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
388 .errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
389 .errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
390 .errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
391 .errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
392 .errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
393 .errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
394 .errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
395 .errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
396 .errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
397 .errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
398 .errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
399 .errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
400 .errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
401 .errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
402 .errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
403 .errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
404 .errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
405 .errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
406 .errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
407 .errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
408 .errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
410 /* extension presence condition registers */
412 /* GL_ARB_vertex_blend */
413 /* GL_EXT_vertex_weighting */
414 .regbyte vertex_blend 0x00
416 /* GL_ARB_matrix_palette */
417 .regbyte matrix_palette 0x00
419 /* GL_ARB_point_parameters */
420 /* GL_EXT_point_parameters */
421 .regbyte point_parameters 0x00
423 /* GL_EXT_secondary_color */
424 .regbyte secondary_color 0x00
426 /* GL_EXT_fog_coord */
427 .regbyte fog_coord 0x00
429 /* GL_EXT_texture_rectangle */
430 /* GL_NV_texture_rectangle */
431 .regbyte texture_rectangle 0x00
433 /* GL_ARB_fragment_program_shadow */
434 .regbyte fragment_program_shadow 0x00
436 /* GL_ARB_draw_buffers */
437 .regbyte draw_buffers 0x00
439 /* option presence condition registers */
440 /* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
441 /* register is set to 1 to indicate that the OPTION was specified. */
443 /* GL_ARB_fragment_program */
444 .regbyte ARB_precision_hint_fastest 0x00
445 .regbyte ARB_precision_hint_nicest 0x00
446 .regbyte ARB_fog_exp 0x00
447 .regbyte ARB_fog_exp2 0x00
448 .regbyte ARB_fog_linear 0x00
450 /* GL_ARB_vertex_program */
451 .regbyte ARB_position_invariant 0x00
453 /* GL_ARB_fragment_program_shadow */
454 .regbyte ARB_fragment_program_shadow 0x00
456 /* GL_ARB_draw_buffers */
457 .regbyte ARB_draw_buffers 0x00
459 /* program target condition register */
460 /* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
461 /* to distinguish between them we need a register that will store for us the current target. */
462 /* the client will typically set the register to apropriate value before parsing a particular */
463 /* program. the mapping between program targets and their values is listed below. */
465 /* program target register value */
466 /* ---------------------------------------------- */
467 /* FRAGMENT_PROGRAM 0x10 */
468 /* VERTEX_PROGRAM 0x20 */
470 /* the initial value of the register is 0 to catch potential errors with not setting the register */
471 /* with the proper value. */
472 .regbyte program_target 0x00
475 <program> ::= <optionSequence> <statementSequence> "END"
478 programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
480 .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
481 .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
483 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
484 optional_space .and fp_optionSequence .and fp_statementSequence .and
485 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
486 '\0' .error CODE_AFTER_END;
488 '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
489 optional_space .and vp_optionSequence .and vp_statementSequence .and
490 "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
491 '\0' .error CODE_AFTER_END;
494 <optionSequence> ::= <optionSequence> <option>
503 <option> ::= "OPTION" <identifier> ";"
505 NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
506 these options is encountered, the other one is automatically disabled.
507 the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
510 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
511 fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
513 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
514 vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
516 .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
517 .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
518 .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
519 .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
520 fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
521 fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
522 fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
523 .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
524 .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
525 .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
526 .load ARB_draw_buffers 0x01;
528 "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
530 .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
532 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
534 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
537 <statementSequence> ::= <statementSequence> <statement>
546 <statement> ::= <instruction> ";"
547 | <namingStatement> ";"
549 NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
550 the first character of instruction) for program debugging purposes.
553 fp_statement_1 .or fp_statement_2;
555 vp_statement_1 .or vp_statement_2;
557 fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
559 fp_namingStatement .emit DECLARATION .and semicolon;
561 vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
563 vp_namingStatement .emit DECLARATION .and semicolon;
567 <instruction> ::= <ALUInstruction>
571 <instruction> ::= <ARL_instruction>
572 | <VECTORop_instruction>
573 | <SCALARop_instruction>
574 | <BINSCop_instruction>
575 | <BINop_instruction>
576 | <TRIop_instruction>
580 ALUInstruction .emit OP_ALU_INST .or
581 TexInstruction .emit OP_TEX_INST;
583 ARL_instruction .emit OP_ALU_ARL .or
584 vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
585 vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
586 vp_BINSCop_instruction .emit OP_ALU_BINSC .or
587 vp_BINop_instruction .emit OP_ALU_BIN .or
588 vp_TRIop_instruction .emit OP_ALU_TRI .or
589 vp_SWZ_instruction .emit OP_ALU_SWZ;
593 <ALUInstruction> ::= <VECTORop_instruction>
594 | <SCALARop_instruction>
595 | <BINSCop_instruction>
596 | <BINop_instruction>
597 | <TRIop_instruction>
601 fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
602 fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
603 fp_BINSCop_instruction .emit OP_ALU_BINSC .or
604 fp_BINop_instruction .emit OP_ALU_BIN .or
605 fp_TRIop_instruction .emit OP_ALU_TRI .or
606 fp_SWZ_instruction .emit OP_ALU_SWZ;
610 <TexInstruction> ::= <SAMPLE_instruction>
614 SAMPLE_instruction .emit OP_TEX_SAMPLE .or
615 KIL_instruction .emit OP_TEX_KIL;
619 <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
622 "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
626 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
630 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
632 fp_VECTORop_instruction
633 fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
634 vp_VECTORop_instruction
635 vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
639 <VECTORop> ::= "ABS" | "ABS_SAT"
653 "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
654 "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
655 "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
656 "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
657 "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
659 "ABS" .emit OP_ABS .or
660 "FLR" .emit OP_FLR .or
661 "FRC" .emit OP_FRC .or
662 "LIT" .emit OP_LIT .or
666 <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
668 fp_SCALARop_instruction
669 fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
670 vp_SCALARop_instruction
671 vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
675 <SCALARop> ::= "COS" | "COS_SAT"
692 "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
693 "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
694 "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
695 "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
696 "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
697 "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
698 "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
700 "EX2" .emit OP_EX2 .or
701 "EXP" .emit OP_EXP .or
702 "LG2" .emit OP_LG2 .or
703 "LOG" .emit OP_LOG .or
704 "RCP" .emit OP_RCP .or
708 <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
711 fp_BINSCop_instruction
712 fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
714 vp_BINSCop_instruction
715 vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
720 <BINSCop> ::= "POW" | "POW_SAT"
726 "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
732 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
733 <vectorSrcReg> "," <vectorSrcReg>
736 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
737 <swizzleSrcReg> "," <swizzleSrcReg>
740 fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
743 vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
748 <BINop> ::= "ADD" | "ADD_SAT"
776 "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
777 "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
778 "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
779 "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
780 "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
781 "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
782 "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
783 "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
784 "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
785 "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
786 "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
787 "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
789 "ADD" .emit OP_ADD .or
790 "DP3" .emit OP_DP3 .or
791 "DP4" .emit OP_DP4 .or
792 "DPH" .emit OP_DPH .or
793 "DST" .emit OP_DST .or
794 "MAX" .emit OP_MAX .or
795 "MIN" .emit OP_MIN .or
796 "MUL" .emit OP_MUL .or
797 "SGE" .emit OP_SGE .or
798 "SLT" .emit OP_SLT .or
799 "SUB" .emit OP_SUB .or
804 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
805 <vectorSrcReg> "," <vectorSrcReg> ","
809 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
810 <swizzleSrcReg> "," <swizzleSrcReg> ","
814 fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
815 vectorSrcReg .and comma .and vectorSrcReg;
817 vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
818 swizzleSrcReg .and comma .and swizzleSrcReg;
822 <TRIop> ::= "CMP" | "CMP_SAT"
830 "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
831 "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
832 "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
838 <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
839 <srcReg> "," <extendedSwizzle>
842 <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
846 SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
847 fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
849 "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
850 vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
854 <SWZop> ::= "SWZ" | "SWZ_SAT"
857 "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
861 <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
862 <vectorSrcReg> "," <texImageUnit> ","
866 SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
867 texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
871 <SAMPLEop> ::= "TEX" | "TEX_SAT"
876 "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
877 "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
878 "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
882 <KIL_instruction> ::= "KIL" <vectorSrcReg>
885 "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
889 <texImageUnit> ::= "texture" <optTexImageUnitNum>
892 "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
901 | <shadowTarget> (if option ARB_fragment_program_shadow present)
904 "1D" .emit TEXTARGET_1D .or
905 "2D" .emit TEXTARGET_2D .or
906 "3D" .emit TEXTARGET_3D .or
907 .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
908 "CUBE" .emit TEXTARGET_CUBE .or
909 .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
912 GL_ARB_fragment_program_shadow
913 <shadowTarget> ::= "SHADOW1D"
918 "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
919 "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
920 .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
924 <optTexImageUnitNum> ::= ""
925 | "[" <texImageUnitNum> "]"
928 optTexImageUnitNum_1 .or .true .emit 0x00;
930 lbracket_ne .and texImageUnitNum .and rbracket;
934 <texImageUnitNum> ::= <integer> from 0 to
935 MAX_TEXTURE_IMAGE_UNITS_ARB-1
941 <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
944 optionalSign .and fp_srcReg .and fp_scalarSuffix;
946 optionalSign .and vp_srcReg .and vp_scalarSuffix;
950 <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
953 optionalSign .and vp_srcReg .and swizzleSuffix;
957 <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
960 optionalSign .and fp_srcReg .and optionalSuffix;
963 <maskedDstReg> ::= <dstReg> <optionalMask>
966 fp_dstReg .and fp_optionalMask;
968 vp_dstReg .and vp_optionalMask;
972 <maskedAddrReg> ::= <addrReg> <addrWriteMask>
975 addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
979 <extendedSwizzle> ::= <xyzwExtendedSwizzle>
980 | <rgbaExtendedSwizzle>
983 <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
984 <extSwizComp> "," <extSwizComp>
986 NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
989 rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
991 extSwizComp .and comma .and
992 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
993 extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
994 extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
998 <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
999 <xyzwExtSwizComp> "," <xyzwExtSwizComp>
1002 xyzwExtSwizComp .and comma .and
1003 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1004 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1005 xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1009 <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
1010 <rgbaExtSwizComp> "," <rgbaExtSwizComp>
1013 rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
1014 rgbaExtendedSwizzle_4;
1015 rgbaExtendedSwizzle_1
1016 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
1017 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
1018 rgbaExtendedSwizzle_2
1019 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
1020 rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1021 rgbaExtendedSwizzle_3
1022 rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
1023 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1024 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1025 rgbaExtendedSwizzle_4
1026 rgbaExtSwizComp_alpha .and comma .and
1027 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1028 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
1029 rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
1033 <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
1036 optionalSign .and xyzwExtSwizSel;
1040 <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
1043 optionalSign .and rgbaExtSwizSel;
1044 rgbaExtSwizComp_digit
1045 optionalSign .and rgbaExtSwizSel_digit;
1046 rgbaExtSwizComp_alpha
1047 optionalSign .and rgbaExtSwizSel_alpha;
1051 <extSwizComp> ::= <optionalSign> <extSwizSel>
1054 optionalSign .and extSwizSel;
1058 <xyzwExtSwizSel> ::= "0"
1063 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
1067 <rgbaExtSwizSel> ::= "0"
1072 rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
1073 rgbaExtSwizSel_digit
1074 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
1075 rgbaExtSwizSel_alpha
1076 rgbaComponent_single;
1080 <extSwizSel> ::= "0"
1085 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
1089 <srcReg> ::= <fragmentAttribReg>
1094 <srcReg> ::= <vertexAttribReg>
1099 fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1101 vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1103 fragmentAttribReg .emit REGISTER_ATTRIB .or
1104 fp_progParamReg .emit REGISTER_PARAM .or
1105 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1107 vertexAttribReg .emit REGISTER_ATTRIB .or
1108 vp_progParamReg .emit REGISTER_PARAM .or
1109 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1113 <dstReg> ::= <temporaryReg>
1114 | <fragmentResultReg>
1117 <dstReg> ::= <temporaryReg>
1121 fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1123 vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1125 fragmentResultReg .emit REGISTER_RESULT .or
1126 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1128 vertexResultReg .emit REGISTER_RESULT .or
1129 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1133 <fragmentAttribReg> ::= <establishedName>
1134 | <fragAttribBinding>
1136 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1139 /*fp_establishedName .or */fragAttribBinding;
1143 <vertexAttribReg> ::= <establishedName>
1144 | <vtxAttribBinding>
1146 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1152 <temporaryReg> ::= <establishedName>
1155 fp_establishedName_no_error_on_identifier;
1157 vp_establishedName_no_error_on_identifier;
1161 <progParamReg> ::= <progParamSingle>
1162 | <progParamArray> "[" <progParamArrayAbs> "]"
1163 | <paramSingleItemUse>
1166 <progParamReg> ::= <progParamSingle>
1167 | <progParamArray> "[" <progParamArrayMem> "]"
1168 | <paramSingleItemUse>
1171 fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
1173 vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
1175 fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
1178 vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
1182 <progParamSingle> ::= <establishedName>
1184 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1192 <progParamArray> ::= <establishedName>
1195 fp_establishedName_no_error_on_identifier;
1197 vp_establishedName_no_error_on_identifier;
1201 <progParamArrayMem> ::= <progParamArrayAbs>
1202 | <progParamArrayRel>
1205 progParamArrayAbs .or progParamArrayRel;
1208 <progParamArrayAbs> ::= <integer>
1211 integer_ne .emit ARRAY_INDEX_ABSOLUTE;
1215 <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
1218 addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
1219 addrComponent .and addrRegRelOffset;
1223 <addrRegRelOffset> ::= ""
1224 | "+" <addrRegPosOffset>
1225 | "-" <addrRegNegOffset>
1228 addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
1230 plus_ne .and addrRegPosOffset;
1232 minus_ne .and addrRegNegOffset;
1236 <addrRegPosOffset> ::= <integer> from 0 to 63
1243 <addrRegNegOffset> ::= <integer> from 0 to 64
1250 <fragmentResultReg> ::= <establishedName>
1253 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1260 <vertexResultReg> ::= <establishedName>
1263 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1270 <addrReg> ::= <establishedName>
1273 vp_establishedName_no_error_on_identifier;
1277 <addrComponent> ::= "." "x"
1280 dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
1281 .emit COMPONENT_X .emit COMPONENT_X;
1285 <addrWriteMask> ::= "." "x"
1288 dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
1291 <scalarSuffix> ::= "." <component>
1294 dot .and fp_component_single .error INVALID_COMPONENT;
1296 dot .and vp_component_single .error INVALID_COMPONENT;
1300 <swizzleSuffix> ::= ""
1302 | "." <component> <component>
1303 <component> <component>
1307 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1309 dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
1311 swizzleSuffix_3 .or swizzleSuffix_4;
1313 vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
1314 vp_component_multi .error INVALID_COMPONENT;
1316 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1317 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1318 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1319 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1323 <optionalSuffix> ::= ""
1325 | "." <xyzwComponent> <xyzwComponent>
1326 <xyzwComponent> <xyzwComponent>
1327 | "." <rgbaComponent> <rgbaComponent>
1328 <rgbaComponent> <rgbaComponent>
1331 optionalSuffix_1 .or
1332 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1334 dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
1336 optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
1338 xyzwComponent_multi .and xyzwComponent_multi .and
1339 xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
1341 rgbaComponent_multi .and rgbaComponent_multi .and
1342 rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
1344 "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1345 "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1346 "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1347 "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
1348 "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
1349 "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
1350 "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
1351 "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
1355 <component> ::= <xyzwComponent>
1365 xyzwComponent_single .or rgbaComponent_single;
1367 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1368 'w' .emit COMPONENT_W;
1370 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1371 "w" .emit COMPONENT_W;
1375 <xyzwComponent> ::= "x" | "y" | "z" | "w"
1378 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1379 'w' .emit COMPONENT_W;
1380 xyzwComponent_single
1381 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1382 "w" .emit COMPONENT_W;
1386 <rgbaComponent> ::= "r" | "g" | "b" | "a"
1389 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
1390 'a' .emit COMPONENT_W;
1391 rgbaComponent_single
1392 "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
1393 "a" .emit COMPONENT_W;
1397 <optionalMask> ::= ""
1402 <optionalMask> ::= ""
1419 NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
1422 rgbaMask .or xyzwMask .or .true .emit 0x0F;
1424 xyzwMask .or .true .emit 0x0F;
1428 <xyzwMask> ::= "." "x"
1444 NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
1447 dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
1449 "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
1450 "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
1451 "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
1452 "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
1456 <rgbaMask> ::= "." "r"
1473 dot_ne .and rgbaMask_1;
1475 "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
1476 "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
1477 "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
1478 "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
1482 <namingStatement> ::= <ATTRIB_statement>
1485 | <OUTPUT_statement>
1489 <namingStatement> ::= <ATTRIB_statement>
1492 | <ADDRESS_statement>
1493 | <OUTPUT_statement>
1497 fp_ATTRIB_statement .emit ATTRIB .or
1498 fp_PARAM_statement .emit PARAM .or
1499 fp_TEMP_statement .emit TEMP .or
1500 fp_OUTPUT_statement .emit OUTPUT .or
1501 fp_ALIAS_statement .emit ALIAS;
1503 vp_ATTRIB_statement .emit ATTRIB .or
1504 vp_PARAM_statement .emit PARAM .or
1505 vp_TEMP_statement .emit TEMP .or
1506 ADDRESS_statement .emit ADDRESS .or
1507 vp_OUTPUT_statement .emit OUTPUT .or
1508 vp_ALIAS_statement .emit ALIAS;
1512 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1516 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1520 "ATTRIB" .and space .and fp_establishName .and equal .and
1521 fragAttribBinding .error FRAGMENT_EXPECTED;
1523 "ATTRIB" .and space .and vp_establishName .and equal .and
1524 vtxAttribBinding .error VERTEX_EXPECTED;
1528 <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
1531 "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
1535 <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
1538 "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
1542 <fragAttribItem> ::= "color" <optColorType>
1543 | "texcoord" <optTexCoordNum>
1548 fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
1549 fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
1550 .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
1551 "position" .emit FRAGMENT_ATTRIB_POSITION;
1553 "color" .and optColorType;
1555 "texcoord" .and optTexCoordNum;
1559 <vtxAttribItem> ::= "position"
1560 | "weight" <vtxOptWeightNum>
1562 | "color" <optColorType>
1564 | "texcoord" <optTexCoordNum>
1565 | "matrixindex" "[" <vtxWeightNum> "]"
1566 | "attrib" "[" <vtxAttribNum> "]"
1569 "position" .emit VERTEX_ATTRIB_POSITION .or
1570 .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
1571 "normal" .emit VERTEX_ATTRIB_NORMAL .or
1572 vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
1573 "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
1574 vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
1575 .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
1576 vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
1578 "weight" .and vtxOptWeightNum;
1580 "color" .and optColorType;
1582 "texcoord" .and optTexCoordNum;
1584 "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
1586 "attrib" .and lbracket .and vtxAttribNum .and rbracket;
1590 <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
1597 <vtxOptWeightNum> ::= ""
1598 | "[" <vtxWeightNum> "]"
1601 vtxOptWeightNum_1 .or .true .emit 0x00;
1603 lbracket_ne .and vtxWeightNum .and rbracket;
1607 <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
1608 must be divisible by four
1614 <PARAM_statement> ::= <PARAM_singleStmt>
1615 | <PARAM_multipleStmt>
1618 fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
1620 vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
1623 <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
1626 "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
1627 .true .emit PARAM_NULL;
1629 "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
1630 .true .emit PARAM_NULL;
1633 <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
1636 fp_PARAM_multipleStmt
1637 "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1638 fp_paramMultipleInit .and .true .emit PARAM_NULL;
1639 vp_PARAM_multipleStmt
1640 "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
1641 vp_paramMultipleInit .and .true .emit PARAM_NULL;
1644 <optArraySize> ::= ""
1645 | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
1646 (maximum number of allowed program
1653 <paramSingleInit> ::= "=" <paramSingleItemDecl>
1656 equal .and fp_paramSingleItemDecl;
1658 equal .and vp_paramSingleItemDecl;
1661 <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
1663 fp_paramMultipleInit
1664 equal .and lbrace .and fp_paramMultInitList .and rbrace;
1665 vp_paramMultipleInit
1666 equal .and lbrace .and vp_paramMultInitList .and rbrace;
1669 <paramMultInitList> ::= <paramMultipleItem>
1670 | <paramMultipleItem> "," <paramMultiInitList>
1672 fp_paramMultInitList
1673 fp_paramMultInitList_1 .or fp_paramMultipleItem;
1674 vp_paramMultInitList
1675 vp_paramMultInitList_1 .or vp_paramMultipleItem;
1676 fp_paramMultInitList_1
1677 fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
1678 vp_paramMultInitList_1
1679 vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
1682 <paramSingleItemDecl> ::= <stateSingleItem>
1683 | <programSingleItem>
1686 fp_paramSingleItemDecl
1687 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1688 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1689 paramConstDecl .emit PARAM_CONSTANT;
1690 vp_paramSingleItemDecl
1691 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1692 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1693 paramConstDecl .emit PARAM_CONSTANT;
1696 <paramSingleItemUse> ::= <stateSingleItem>
1697 | <programSingleItem>
1700 fp_paramSingleItemUse
1701 fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1702 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1703 paramConstUse .emit PARAM_CONSTANT;
1704 vp_paramSingleItemUse
1705 vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
1706 programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
1707 paramConstUse .emit PARAM_CONSTANT;
1710 <paramMultipleItem> ::= <stateMultipleItem>
1711 | <programMultipleItem>
1714 fp_paramMultipleItem
1715 fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1716 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1717 paramConstDecl .emit PARAM_CONSTANT;
1718 vp_paramMultipleItem
1719 vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
1720 programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
1721 paramConstDecl .emit PARAM_CONSTANT;
1724 <stateMultipleItem> ::= <stateSingleItem>
1725 | "state" "." <stateMatrixRows>
1727 fp_stateMultipleItem
1728 stateMultipleItem_1 .or fp_stateSingleItem;
1729 vp_stateMultipleItem
1730 stateMultipleItem_1 .or vp_stateSingleItem;
1732 "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
1736 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1737 | "state" "." <stateLightItem>
1738 | "state" "." <stateLightModelItem>
1739 | "state" "." <stateLightProdItem>
1740 | "state" "." <stateTexEnvItem>
1741 | "state" "." <stateFogItem>
1742 | "state" "." <stateDepthItem>
1743 | "state" "." <stateMatrixRow>
1746 <stateSingleItem> ::= "state" "." <stateMaterialItem>
1747 | "state" "." <stateLightItem>
1748 | "state" "." <stateLightModelItem>
1749 | "state" "." <stateLightProdItem>
1750 | "state" "." <stateTexGenItem>
1751 | "state" "." <stateFogItem>
1752 | "state" "." <stateClipPlaneItem>
1753 | "state" "." <statePointItem>
1754 | "state" "." <stateMatrixRow>
1757 "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1759 "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1760 fp_stateSingleItem_1
1761 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1762 stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
1763 vp_stateSingleItem_1
1764 stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
1765 stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
1768 stateMaterialItem .emit STATE_MATERIAL;
1770 stateLightItem .emit STATE_LIGHT;
1772 stateLightModelItem .emit STATE_LIGHT_MODEL;
1774 stateLightProdItem .emit STATE_LIGHT_PROD;
1776 stateTexEnvItem .emit STATE_TEX_ENV;
1778 stateTexGenItem .emit STATE_TEX_GEN;
1780 stateFogItem .emit STATE_FOG;
1782 stateDepthItem .emit STATE_DEPTH;
1784 stateClipPlaneItem .emit STATE_CLIP_PLANE;
1786 statePointItem .emit STATE_POINT;
1788 stateMatrixRow .emit STATE_MATRIX_ROWS;
1791 <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
1794 "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
1797 <stateMatProperty> ::= "ambient"
1804 "ambient" .emit MATERIAL_AMBIENT .or
1805 "diffuse" .emit MATERIAL_DIFFUSE .or
1806 "specular" .emit MATERIAL_SPECULAR .or
1807 "emission" .emit MATERIAL_EMISSION .or
1808 "shininess" .emit MATERIAL_SHININESS;
1811 <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
1812 <stateLightProperty>
1815 "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
1816 stateLightProperty .error INVALID_LIGHT_PROPERTY;
1819 <stateLightProperty> ::= "ambient"
1824 | "spot" "." <stateSpotProperty>
1828 "ambient" .emit LIGHT_AMBIENT .or
1829 "diffuse" .emit LIGHT_DIFFUSE .or
1830 "specular" .emit LIGHT_SPECULAR .or
1831 "position" .emit LIGHT_POSITION .or
1832 "attenuation" .emit LIGHT_ATTENUATION .or
1833 stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
1834 "half" .emit LIGHT_HALF;
1835 stateLightProperty_1
1836 "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
1839 <stateSpotProperty> ::= "direction"
1845 <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
1848 "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
1851 <stateLModProperty> ::= "." "ambient"
1852 | <optFaceType> "." "scenecolor"
1855 stateLModProperty_1 .or stateLModProperty_2;
1857 dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
1859 stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
1861 optFaceType .and dot .and "scenecolor";
1864 <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
1865 <optFaceType> "." <stateLProdProperty>
1868 "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
1869 stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
1872 <stateLProdProperty> ::= "ambient"
1877 "ambient" .emit LIGHT_PROD_AMBIENT .or
1878 "diffuse" .emit LIGHT_PROD_DIFFUSE .or
1879 "specular" .emit LIGHT_PROD_SPECULAR;
1882 <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
1889 <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
1890 <stateTexEnvProperty>
1893 "texenv" .and optLegacyTexUnitNum .and dot .and
1894 stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
1898 <stateTexEnvProperty> ::= "color"
1901 "color" .emit TEX_ENV_COLOR;
1905 <optLegacyTexUnitNum> ::= ""
1906 | "[" <legacyTexUnitNum> "]"
1908 NOTE: <optLegaceTexUnitNum> is not optional.
1911 lbracket_ne .and legacyTexUnitNum .and rbracket;
1915 <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
1922 <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
1923 <stateTexGenType> "." <stateTexGenCoord>
1926 "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
1927 dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
1931 <stateTexGenType> ::= "eye"
1935 "eye" .emit TEX_GEN_EYE .or
1936 "object" .emit TEX_GEN_OBJECT;
1940 <stateTexGenCoord> ::= "s"
1946 "s" .emit COMPONENT_X .or
1947 "t" .emit COMPONENT_Y .or
1948 "r" .emit COMPONENT_Z .or
1949 "q" .emit COMPONENT_W;
1952 <stateFogItem> ::= "fog" "." <stateFogProperty>
1955 "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
1958 <stateFogProperty> ::= "color"
1962 "color" .emit FOG_COLOR .or
1963 "params" .emit FOG_PARAMS;
1967 <stateDepthItem> ::= "depth" "." <stateDepthProperty>
1970 "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
1974 <stateDepthProperty> ::= "range"
1977 "range" .emit DEPTH_RANGE;
1981 <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
1984 "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
1985 "plane" .error INVALID_CLIPPLANE_PROPERTY;
1989 <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
1996 <statePointItem> ::= "point" "." <statePointProperty>
1999 "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
2003 <statePointProperty> ::= "size"
2007 "size" .emit POINT_SIZE .or
2008 .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
2011 <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
2012 <stateMatrixRowNum> "]"
2015 stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
2016 lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
2019 <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
2022 stateMatrixItem .and optMatrixRows;
2025 <optMatrixRows> ::= ""
2026 | "." "row" "[" <stateMatrixRowNum> ".."
2027 <stateMatrixRowNum> "]"
2030 optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
2032 dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
2033 stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
2036 <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
2037 <stateOptMatModifier>
2040 "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
2043 <stateOptMatModifier> ::= ""
2044 | "." <stateMatModifier>
2047 stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
2048 stateOptMatModifier_1
2049 dot_ne .and stateMatModifier;
2052 <stateMatModifier> ::= "inverse"
2057 "inverse" .emit MATRIX_MODIFIER_INVERSE .or
2058 "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
2059 "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
2062 <stateMatrixRowNum> ::= <integer> from 0 to 3
2068 <stateMatrixName> ::= "modelview" <stateOptModMatNum>
2071 | "texture" <optTexCoordNum>
2072 | "palette" "[" <statePaletteMatNum> "]"
2073 | "program" "[" <stateProgramMatNum> "]"
2076 stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
2077 "projection" .emit MATRIX_PROJECTION .or
2078 "mvp" .emit MATRIX_MVP .or
2079 stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
2080 .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
2081 stateMatrixName_1_4 .emit MATRIX_PROGRAM;
2083 "modelview" .and stateOptModMatNum;
2085 "texture" .and optTexCoordNum;
2087 "palette" .and lbracket .and statePaletteMatNum .and rbracket;
2089 "program" .and lbracket .and stateProgramMatNum .and rbracket;
2092 <stateOptModMatNum> ::= ""
2093 | "[" <stateModMatNum> "]"
2096 .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
2099 lbracket_ne .and stateModMatNum .and rbracket;
2102 <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
2108 <optTexCoordNum> ::= ""
2109 | "[" <texCoordNum> "]"
2112 optTexCoordNum_1 .or .true .emit 0x00;
2114 lbracket_ne .and texCoordNum .and rbracket;
2117 <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
2123 <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
2129 <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
2135 <programSingleItem> ::= <progEnvParam>
2138 NOTE: <programSingleItem> has been modified for correct error handling. If program property
2139 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2142 "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
2144 progEnvParam .or progLocalParam;
2147 <programMultipleItem> ::= <progEnvParams>
2150 NOTE: <programMultipleItem> has been modified for correct error handling. If program property
2151 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2154 "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
2155 programMultipleItem_1
2156 progEnvParams .or progLocalParams;
2159 <progEnvParams> ::= "program" "." "env"
2160 "[" <progEnvParamNums> "]"
2162 NOTE: "program" "." has been moved to <programMultipleItem>.
2165 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
2168 <progEnvParamNums> ::= <progEnvParamNum>
2169 | <progEnvParamNum> ".." <progEnvParamNum>
2172 progEnvParamNums_1 .or progEnvParamNums_2;
2174 progEnvParamNum .and dotdot_ne .and progEnvParamNum;
2176 progEnvParamNum .and .true .emit 0x00;
2179 <progEnvParam> ::= "program" "." "env"
2180 "[" <progEnvParamNum> "]"
2182 NOTE: "program" "." has been moved to <programSingleItem>.
2185 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
2188 <progLocalParams> ::= "program" "." "local"
2189 "[" <progLocalParamNums> "]"
2191 NOTE: "program" "." has been moved to <programMultipleItem>.
2194 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
2197 <progLocalParamNums> ::= <progLocalParamNum>
2198 | <progLocalParamNum> ".." <progLocalParamNum>
2201 progLocalParamNums_1 .or progLocalParamNums_2;
2202 progLocalParamNums_1
2203 progLocalParamNum .and dotdot_ne .and progLocalParamNum;
2204 progLocalParamNums_2
2205 progLocalParamNum .and .true .emit 0x00;
2208 <progLocalParam> ::= "program" "." "local"
2209 "[" <progLocalParamNum> "]"
2211 NOTE: "program" "." has been moved to <programSingleItem>.
2214 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
2217 <progEnvParamNum> ::= <integer> from 0 to
2218 MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
2224 <progLocalParamNum> ::= <integer> from 0 to
2225 MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
2231 <paramConstDecl> ::= <paramConstScalarDecl>
2232 | <paramConstVector>
2235 paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2238 <paramConstUse> ::= <paramConstScalarUse>
2239 | <paramConstVector>
2242 paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2245 <paramConstScalarDecl> ::= <signedFloatConstant>
2247 paramConstScalarDecl
2248 signedFloatConstant;
2251 <paramConstScalarUse> ::= <floatConstant>
2257 <paramConstVector> ::= "{" <signedFloatConstant> "}"
2258 | "{" <signedFloatConstant> ","
2259 <signedFloatConstant> "}"
2260 | "{" <signedFloatConstant> ","
2261 <signedFloatConstant> ","
2262 <signedFloatConstant> "}"
2263 | "{" <signedFloatConstant> ","
2264 <signedFloatConstant> ","
2265 <signedFloatConstant> ","
2266 <signedFloatConstant> "}"
2269 paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
2270 paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
2272 lbrace_ne .and signedFloatConstant .and rbrace;
2274 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2276 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2277 signedFloatConstant .and rbrace;
2279 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2280 signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2283 <signedFloatConstant> ::= <optionalSign> <floatConstant>
2286 optionalSign .and floatConstant;
2289 <floatConstant> ::= see text
2290 The <floatConstant> rule matches a floating-point constant consisting
2291 of an integer part, a decimal point, a fraction part, an "e" or
2292 "E", and an optionally signed integer exponent. The integer and
2293 fraction parts both consist of a sequence of one or more digits ("0"
2294 through "9"). Either the integer part or the fraction parts (not
2295 both) may be missing; either the decimal point or the "e" (or "E")
2296 and the exponent (not both) may be missing.
2302 <optionalSign> ::= ""
2310 <TEMP_statement> ::= "TEMP" <varNameList>
2313 "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
2315 "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
2319 <ADDRESS_statement> ::= "ADDRESS" <varNameList>
2322 "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
2325 <varNameList> ::= <establishName>
2326 | <establishName> "," <varNameList>
2329 fp_varNameList_1 .or fp_establishName;
2331 vp_varNameList_1 .or vp_establishName;
2333 fp_establishName .and comma_ne .and fp_varNameList;
2335 vp_establishName .and comma_ne .and vp_varNameList;
2338 <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
2342 "OUTPUT" .and space .and fp_establishName .and equal .and
2343 fp_resultBinding .error RESULT_EXPECTED;
2345 "OUTPUT" .and space .and vp_establishName .and equal .and
2346 vp_resultBinding .error RESULT_EXPECTED;
2350 <resultBinding> ::= "result" "." "color"
2351 | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
2352 | "result" "." "depth"
2355 <resultBinding> ::= "result" "." "position"
2356 | "result" "." <resultColBinding>
2357 | "result" "." "fogcoord"
2358 | "result" "." "pointsize"
2359 | "result" "." "texcoord" <optTexCoordNum>
2362 "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2364 "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2366 fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
2367 "depth" .emit FRAGMENT_RESULT_DEPTH;
2369 "color" .and optOutputColorNum;
2371 .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
2372 resultColBinding .emit VERTEX_RESULT_COLOR .or
2373 "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
2374 "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
2375 vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
2377 "texcoord" .and optTexCoordNum;
2381 <optOutputColorNum> ::= ""
2382 | "[" <outputColorNum> "]"
2385 .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
2387 lbracket_ne .and outputColorNum .and rbracket;
2391 <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
2398 <resultColBinding> ::= "color" <optFaceType> <optColorType>
2401 "color" .and optFaceType .and optColorType;
2404 <optFaceType> ::= ""
2409 FaceType .or .true .emit FACE_FRONT;
2411 dot_ne .and FaceProperty;
2413 "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
2416 <optColorType> ::= ""
2421 ColorType .or .true .emit COLOR_PRIMARY;
2423 dot_ne .and ColorProperty;
2425 "primary" .emit COLOR_PRIMARY .or
2426 .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
2429 <ALIAS_statement> ::= "ALIAS" <establishName> "="
2433 "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
2435 "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
2436 fp_ALIAS_statement_1
2437 space .and fp_establishName;
2438 vp_ALIAS_statement_1
2439 space .and vp_establishName;
2442 <establishName> ::= <identifier>
2450 <establishedName> ::= <identifier>
2456 fp_establishedName_no_error_on_identifier
2458 vp_establishedName_no_error_on_identifier
2463 <identifier> ::= see text
2464 The <identifier> rule matches a sequence of one or more letters ("A"
2465 through "Z", "a" through "z"), digits ("0" through "9), underscores
2466 ("_"), or dollar signs ("$"); the first character must not be a
2467 number. Upper and lower case letters are considered different
2468 (names are case-sensitive). The following strings are reserved
2469 keywords and may not be used as identifiers:
2471 ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
2472 COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
2473 END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
2474 LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
2475 MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
2476 POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
2477 SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
2478 TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
2479 fragment, program, result, state, and texture.
2482 <identifier> ::= see text
2483 The <identifier> rule matches a sequence of one or more letters ("A"
2484 through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
2485 or dollar signs ("$"); the first character must not be a number. Upper
2486 and lower case letters are considered different (names are
2487 case-sensitive). The following strings are reserved keywords and may not
2488 be used as identifiers:
2490 ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
2491 EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
2492 PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
2496 fp_identifier_ne .error IDENTIFIER_EXPECTED;
2498 vp_identifier_ne .error IDENTIFIER_EXPECTED;
2500 fp_not_reserved_identifier .and identifier_ne;
2502 vp_not_reserved_identifier .and identifier_ne;
2504 fp_not_reserved_identifier
2505 fp_not_reserved_identifier_1 .or .true;
2506 fp_not_reserved_identifier_1
2507 fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2508 vp_not_reserved_identifier
2509 vp_not_reserved_identifier_1 .or .true;
2510 vp_not_reserved_identifier_1
2511 vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
2513 fp_reserved_identifier
2514 "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
2515 "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
2516 "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
2517 "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
2518 "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
2519 "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
2520 "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
2521 "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
2522 "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
2523 "fragment" .or "program" .or "result" .or "state" .or "texture";
2524 vp_reserved_identifier
2525 "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
2526 "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
2527 "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
2528 "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
2529 "XPD" .or "program" .or "result" .or "state" .or "vertex";
2532 The <integer> rule matches an integer constant. The integer consists
2533 of a sequence of one or more digits ("0" through "9").
2536 integer_ne .error INTEGER_EXPECTED;
2545 no_digit_1 .or .true;
2547 digit10 .and .false .error INTEGER_OUT_OF_RANGE;
2550 all_zeroes_1 .or no_digit_1;
2552 '0' .and .loop zero .and no_digit;
2555 integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2557 integer_0_3_2 .or all_zeroes .emit '0';
2558 integer_0_3_2 /* [1, 3] */
2559 leading_zeroes .and '1'-'3' .emit * .and no_digit;
2562 integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2564 integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
2565 all_zeroes .emit '0';
2566 integer_0_63_2 /* [7, 9] */
2567 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2568 integer_0_63_3 /* [10, 59] */
2569 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2570 integer_0_63_4 /* [60, 63] */
2571 leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
2572 integer_0_63_5 /* [1, 6] */
2573 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2576 integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2578 integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
2579 all_zeroes .emit '0';
2580 integer_0_64_2 /* [7, 9] */
2581 leading_zeroes .and '7'-'9' .emit * .and no_digit;
2582 integer_0_64_3 /* [10, 59] */
2583 leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
2584 integer_0_64_4 /* [60, 64] */
2585 leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
2586 integer_0_64_5 /* [1, 6] */
2587 leading_zeroes .and '1'-'6' .emit * .and no_digit;
2593 space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
2596 space .error OPERATION_NEEDS_SOURCE_VARIABLE;
2599 single_space .and .loop single_space;
2602 white_char .or comment_block;
2605 ' ' .or '\t' .or '\n' .or '\r';
2608 '#' .and .loop comment_char .and new_line;
2610 /* All ASCII characters except '\r', '\n' and '\0' */
2612 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2615 '\n' .or crlf .or '\0';
2621 optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
2624 optional_space .and ',' .error MISSING_COMMA .and optional_space;
2627 optional_space .and ',' .and optional_space;
2630 optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
2633 optional_space .and '[' .and optional_space;
2636 optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
2639 optional_space .and '.' .error MISSING_DOT .and optional_space;
2642 optional_space .and '.' .and optional_space;
2645 optional_space .and '=' .error MISSING_EQUAL .and optional_space;
2648 optional_space .and '{' .error MISSING_LBRACE .and optional_space;
2651 optional_space .and '{' .and optional_space;
2654 optional_space .and '}' .error MISSING_RBRACE .and optional_space;
2657 optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
2660 optional_space .and '.' .and '.' .and optional_space;
2663 The definition below accepts the following floating point number formats:
2664 .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
2665 Also 99 format was considered and accepted because of a large number of existing program
2666 strings with such a format.
2669 float_1 .or float_2 .or float_legacy;
2671 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2673 integer_ne .and float_3;
2675 float_4 .or float_5;
2677 '.' .and optional_integer .and optional_exponent;
2679 exponent .emit 0x00;
2681 integer_ne .and .true .emit 0x00 .emit 0x00;
2684 Below is a correct version of <float> definiton.
2688 float_1 .or float_2;
2690 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2692 integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
2694 float_4 .or float_5;
2696 '.' .and optional_integer .and optional_exponent;
2698 exponent .emit 0x00;
2702 integer_ne_1 .and .true .emit 0x00 .emit $;
2704 digit10 .emit * .and .loop digit10 .emit *;
2707 integer_ne .or .true .emit 0x00;
2710 NOTE: If exponent part is omited we treat it as if it was "E+1".
2713 exponent .or .true .emit 0x00;
2716 exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
2721 minus_ne .or plus_ne .or .true;
2724 optional_space .and '+' .and optional_space;
2727 optional_space .and '-' .emit '-' .and optional_space;
2730 first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
2733 first_idchar .or digit10;
2736 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2742 string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
2743 executed to create the string. The symbol must not throw any errors and emit bytes - it should
2744 stop if it encounters invalid character. After this the resulting string (from starting
2745 position up to the invalid character (but without it) is compared with the grammar string.
2747 .string __string_filter;
2750 .loop __identifier_char;
2753 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
2756 error token filtering
2759 e_signature_char .and .loop e_signature_char;
2761 '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2764 .loop e_statement_not_term;
2765 /* All ASCII characters to one of '\r', '\n', '\0' and ';' */
2766 e_statement_not_term
2767 '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2770 e_identifier_first .and .loop e_identifier_next;
2772 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2774 e_identifier_first .or '0'-'9';
2777 e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
2778 '-' .or ',' .or ';';
2780 e_token_digit .and .loop e_token_digit;
2785 'A'-'Z' .or 'a'-'z' .or '0'-'9';