remove some test code;
[mesa.git] / src / mesa / shader / arbprogram.syn
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.2
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
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:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
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.
23 */
24
25 /**
26 * \file arbprogram.syn
27 * ARB_fragment/vertex_program syntax
28 * \author Michal Krol
29 */
30
31 .syntax program;
32
33 /*
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
37 to date.
38 */
39 .emtcode REVISION 0x09
40
41 /* program type */
42 .emtcode FRAGMENT_PROGRAM 0x01
43 .emtcode VERTEX_PROGRAM 0x02
44
45 /* program section */
46 .emtcode OPTION 0x01
47 .emtcode INSTRUCTION 0x02
48 .emtcode DECLARATION 0x03
49 .emtcode END 0x04
50
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
57
58 /* GL_ARB_vertex_program option */
59 .emtcode ARB_POSITION_INVARIANT 0x05
60
61 /* GL_ARB_fragment_program_shadow option */
62 .emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
63
64 /* GL_ARB_draw_buffers option */
65 .emtcode ARB_DRAW_BUFFERS 0x07
66
67 /* GL_ARB_fragment_program instruction class */
68 .emtcode OP_ALU_INST 0x00
69 .emtcode OP_TEX_INST 0x01
70
71 /* GL_ARB_vertex_program instruction class */
72 /* OP_ALU_INST */
73
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
83
84 /* GL_ARB_vertex_program instruction type */
85 .emtcode OP_ALU_ARL 0x08
86 /* OP_ALU_VECTOR */
87 /* OP_ALU_SCALAR */
88 /* OP_ALU_BINSC */
89 /* OP_ALU_BIN */
90 /* OP_ALU_TRI */
91 /* OP_ALU_SWZ */
92
93 /* GL_ARB_fragment_program instruction code */
94 .emtcode OP_ABS 0x00
95 .emtcode OP_ABS_SAT 0x1B
96 .emtcode OP_FLR 0x09
97 .emtcode OP_FLR_SAT 0x26
98 .emtcode OP_FRC 0x0A
99 .emtcode OP_FRC_SAT 0x27
100 .emtcode OP_LIT 0x0C
101 .emtcode OP_LIT_SAT 0x2A
102 .emtcode OP_MOV 0x11
103 .emtcode OP_MOV_SAT 0x30
104 .emtcode OP_COS 0x1F
105 .emtcode OP_COS_SAT 0x20
106 .emtcode OP_EX2 0x07
107 .emtcode OP_EX2_SAT 0x25
108 .emtcode OP_LG2 0x0B
109 .emtcode OP_LG2_SAT 0x29
110 .emtcode OP_RCP 0x14
111 .emtcode OP_RCP_SAT 0x33
112 .emtcode OP_RSQ 0x15
113 .emtcode OP_RSQ_SAT 0x34
114 .emtcode OP_SIN 0x38
115 .emtcode OP_SIN_SAT 0x39
116 .emtcode OP_SCS 0x35
117 .emtcode OP_SCS_SAT 0x36
118 .emtcode OP_POW 0x13
119 .emtcode OP_POW_SAT 0x32
120 .emtcode OP_ADD 0x01
121 .emtcode OP_ADD_SAT 0x1C
122 .emtcode OP_DP3 0x03
123 .emtcode OP_DP3_SAT 0x21
124 .emtcode OP_DP4 0x04
125 .emtcode OP_DP4_SAT 0x22
126 .emtcode OP_DPH 0x05
127 .emtcode OP_DPH_SAT 0x23
128 .emtcode OP_DST 0x06
129 .emtcode OP_DST_SAT 0x24
130 .emtcode OP_MAX 0x0F
131 .emtcode OP_MAX_SAT 0x2E
132 .emtcode OP_MIN 0x10
133 .emtcode OP_MIN_SAT 0x2F
134 .emtcode OP_MUL 0x12
135 .emtcode OP_MUL_SAT 0x31
136 .emtcode OP_SGE 0x16
137 .emtcode OP_SGE_SAT 0x37
138 .emtcode OP_SLT 0x17
139 .emtcode OP_SLT_SAT 0x3A
140 .emtcode OP_SUB 0x18
141 .emtcode OP_SUB_SAT 0x3B
142 .emtcode OP_XPD 0x1A
143 .emtcode OP_XPD_SAT 0x43
144 .emtcode OP_CMP 0x1D
145 .emtcode OP_CMP_SAT 0x1E
146 .emtcode OP_LRP 0x2B
147 .emtcode OP_LRP_SAT 0x2C
148 .emtcode OP_MAD 0x0E
149 .emtcode OP_MAD_SAT 0x2D
150 .emtcode OP_SWZ 0x19
151 .emtcode OP_SWZ_SAT 0x3C
152 .emtcode OP_TEX 0x3D
153 .emtcode OP_TEX_SAT 0x3E
154 .emtcode OP_TXB 0x3F
155 .emtcode OP_TXB_SAT 0x40
156 .emtcode OP_TXP 0x41
157 .emtcode OP_TXP_SAT 0x42
158 .emtcode OP_KIL 0x28
159
160 /* GL_ARB_vertex_program instruction code */
161 .emtcode OP_ARL 0x02
162 /* OP_ABS */
163 /* OP_FLR */
164 /* OP_FRC */
165 /* OP_LIT */
166 /* OP_MOV */
167 /* OP_EX2 */
168 .emtcode OP_EXP 0x08
169 /* OP_LG2 */
170 .emtcode OP_LOG 0x0D
171 /* OP_RCP */
172 /* OP_RSQ */
173 /* OP_POW */
174 /* OP_ADD */
175 /* OP_DP3 */
176 /* OP_DP4 */
177 /* OP_DPH */
178 /* OP_DST */
179 /* OP_MAX */
180 /* OP_MIN */
181 /* OP_MUL */
182 /* OP_SGE */
183 /* OP_SLT */
184 /* OP_SUB */
185 /* OP_XPD */
186 /* OP_MAD */
187 /* OP_SWZ */
188
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
194
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
204
205 /* fragment result binding */
206 .emtcode FRAGMENT_RESULT_COLOR 0x01
207 .emtcode FRAGMENT_RESULT_DEPTH 0x02
208
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
215
216 /* texture target */
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
226
227 /* face type */
228 .emtcode FACE_FRONT 0x00
229 .emtcode FACE_BACK 0x01
230
231 /* color type */
232 .emtcode COLOR_PRIMARY 0x00
233 .emtcode COLOR_SECONDARY 0x01
234
235 /* component */
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
242
243 /* array index type */
244 .emtcode ARRAY_INDEX_ABSOLUTE 0x00
245 .emtcode ARRAY_INDEX_RELATIVE 0x01
246
247 /* matrix name */
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
254
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
260
261 /* constant type */
262 .emtcode CONSTANT_SCALAR 0x01
263 .emtcode CONSTANT_VECTOR 0x02
264
265 /* program param type */
266 .emtcode PROGRAM_PARAM_ENV 0x01
267 .emtcode PROGRAM_PARAM_LOCAL 0x02
268
269 /* register type */
270 .emtcode REGISTER_ATTRIB 0x01
271 .emtcode REGISTER_PARAM 0x02
272 .emtcode REGISTER_RESULT 0x03
273 .emtcode REGISTER_ESTABLISHED_NAME 0x04
274
275 /* param binding */
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
282
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
297
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
304
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
313
314 /* state light model property */
315 .emtcode LIGHT_MODEL_AMBIENT 0x01
316 .emtcode LIGHT_MODEL_SCENECOLOR 0x02
317
318 /* state light product property */
319 .emtcode LIGHT_PROD_AMBIENT 0x01
320 .emtcode LIGHT_PROD_DIFFUSE 0x02
321 .emtcode LIGHT_PROD_SPECULAR 0x03
322
323 /* state texture environment property */
324 .emtcode TEX_ENV_COLOR 0x01
325
326 /* state texture generation coord property */
327 .emtcode TEX_GEN_EYE 0x01
328 .emtcode TEX_GEN_OBJECT 0x02
329
330 /* state fog property */
331 .emtcode FOG_COLOR 0x01
332 .emtcode FOG_PARAMS 0x02
333
334 /* state depth property */
335 .emtcode DEPTH_RANGE 0x01
336
337 /* state point parameters property */
338 .emtcode POINT_SIZE 0x01
339 .emtcode POINT_ATTENUATION 0x02
340
341 /* declaration */
342 .emtcode ATTRIB 0x01
343 .emtcode PARAM 0x02
344 .emtcode TEMP 0x03
345 .emtcode OUTPUT 0x04
346 .emtcode ALIAS 0x05
347 /* GL_ARB_vertex_program */
348 .emtcode ADDRESS 0x06
349
350 /* error messages */
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"
409
410 /* extension presence condition registers */
411
412 /* GL_ARB_vertex_blend */
413 /* GL_EXT_vertex_weighting */
414 .regbyte vertex_blend 0x00
415
416 /* GL_ARB_matrix_palette */
417 .regbyte matrix_palette 0x00
418
419 /* GL_ARB_point_parameters */
420 /* GL_EXT_point_parameters */
421 .regbyte point_parameters 0x00
422
423 /* GL_EXT_secondary_color */
424 .regbyte secondary_color 0x00
425
426 /* GL_EXT_fog_coord */
427 .regbyte fog_coord 0x00
428
429 /* GL_EXT_texture_rectangle */
430 /* GL_NV_texture_rectangle */
431 .regbyte texture_rectangle 0x00
432
433 /* GL_ARB_fragment_program_shadow */
434 .regbyte fragment_program_shadow 0x00
435
436 /* GL_ARB_draw_buffers */
437 .regbyte draw_buffers 0x00
438
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. */
442
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
449
450 /* GL_ARB_vertex_program */
451 .regbyte ARB_position_invariant 0x00
452
453 /* GL_ARB_fragment_program_shadow */
454 .regbyte ARB_fragment_program_shadow 0x00
455
456 /* GL_ARB_draw_buffers */
457 .regbyte ARB_draw_buffers 0x00
458
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. */
464 /* */
465 /* program target register value */
466 /* ---------------------------------------------- */
467 /* FRAGMENT_PROGRAM 0x10 */
468 /* VERTEX_PROGRAM 0x20 */
469 /* */
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
473
474 /*
475 <program> ::= <optionSequence> <statementSequence> "END"
476 */
477 program
478 programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
479 programs
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;
482 frag_program_1_0
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;
487 vert_program_1_0
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;
492
493 /*
494 <optionSequence> ::= <optionSequence> <option>
495 | ""
496 */
497 fp_optionSequence
498 .loop fp_option;
499 vp_optionSequence
500 .loop vp_option;
501
502 /*
503 <option> ::= "OPTION" <identifier> ";"
504
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.
508 */
509 fp_option
510 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
511 fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
512 vp_option
513 "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
514 vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
515 fp_optionString
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;
527 vp_optionString
528 "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
529 fp_ARB_fog_exp
530 .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
531 fp_ARB_fog_exp2
532 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
533 fp_ARB_fog_linear
534 .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
535
536 /*
537 <statementSequence> ::= <statementSequence> <statement>
538 | ""
539 */
540 fp_statementSequence
541 .loop fp_statement;
542 vp_statementSequence
543 .loop vp_statement;
544
545 /*
546 <statement> ::= <instruction> ";"
547 | <namingStatement> ";"
548
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.
551 */
552 fp_statement
553 fp_statement_1 .or fp_statement_2;
554 vp_statement
555 vp_statement_1 .or vp_statement_2;
556 fp_statement_1
557 fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
558 fp_statement_2
559 fp_namingStatement .emit DECLARATION .and semicolon;
560 vp_statement_1
561 vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
562 vp_statement_2
563 vp_namingStatement .emit DECLARATION .and semicolon;
564
565 /*
566 fragment program
567 <instruction> ::= <ALUInstruction>
568 | <TexInstruction>
569
570 vertex program
571 <instruction> ::= <ARL_instruction>
572 | <VECTORop_instruction>
573 | <SCALARop_instruction>
574 | <BINSCop_instruction>
575 | <BINop_instruction>
576 | <TRIop_instruction>
577 | <SWZ_instruction>
578 */
579 fp_instruction
580 ALUInstruction .emit OP_ALU_INST .or
581 TexInstruction .emit OP_TEX_INST;
582 vp_instruction
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;
590
591 /*
592 fragment program
593 <ALUInstruction> ::= <VECTORop_instruction>
594 | <SCALARop_instruction>
595 | <BINSCop_instruction>
596 | <BINop_instruction>
597 | <TRIop_instruction>
598 | <SWZ_instruction>
599 */
600 ALUInstruction
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;
607
608 /*
609 fragment program
610 <TexInstruction> ::= <SAMPLE_instruction>
611 | <KIL_instruction>
612 */
613 TexInstruction
614 SAMPLE_instruction .emit OP_TEX_SAMPLE .or
615 KIL_instruction .emit OP_TEX_KIL;
616
617 /*
618 vertex program
619 <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
620 */
621 ARL_instruction
622 "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
623
624 /*
625 fragment program
626 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
627 <vectorSrcReg>
628
629 vertex program
630 <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
631 */
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;
636
637 /*
638 fragment program
639 <VECTORop> ::= "ABS" | "ABS_SAT"
640 | "FLR" | "FLR_SAT"
641 | "FRC" | "FRC_SAT"
642 | "LIT" | "LIT_SAT"
643 | "MOV" | "MOV_SAT"
644
645 vertex program
646 <VECTORop> ::= "ABS"
647 | "FLR"
648 | "FRC"
649 | "LIT"
650 | "MOV"
651 */
652 fp_VECTORop
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;
658 vp_VECTORop
659 "ABS" .emit OP_ABS .or
660 "FLR" .emit OP_FLR .or
661 "FRC" .emit OP_FRC .or
662 "LIT" .emit OP_LIT .or
663 "MOV" .emit OP_MOV;
664
665 /*
666 <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
667 */
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;
672
673 /*
674 fragment program
675 <SCALARop> ::= "COS" | "COS_SAT"
676 | "EX2" | "EX2_SAT"
677 | "LG2" | "LG2_SAT"
678 | "RCP" | "RCP_SAT"
679 | "RSQ" | "RSQ_SAT"
680 | "SIN" | "SIN_SAT"
681 | "SCS" | "SCS_SAT"
682
683 vertex program
684 <SCALARop> ::= "EX2"
685 | "EXP"
686 | "LG2"
687 | "LOG"
688 | "RCP"
689 | "RSQ"
690 */
691 fp_SCALARop
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;
699 vp_SCALARop
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
705 "RSQ" .emit OP_RSQ;
706
707 /*
708 <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
709 <scalarSrcReg>
710 */
711 fp_BINSCop_instruction
712 fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
713 fp_scalarSrcReg;
714 vp_BINSCop_instruction
715 vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
716 vp_scalarSrcReg;
717
718 /*
719 fragment program
720 <BINSCop> ::= "POW" | "POW_SAT"
721
722 vertex program
723 <BINSCop> ::= "POW"
724 */
725 fp_BINSCop
726 "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
727 vp_BINSCop
728 "POW" .emit OP_POW;
729
730 /*
731 fragment program
732 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
733 <vectorSrcReg> "," <vectorSrcReg>
734
735 vertex program
736 <BINop_instruction> ::= <BINop> <maskedDstReg> ","
737 <swizzleSrcReg> "," <swizzleSrcReg>
738 */
739 fp_BINop_instruction
740 fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
741 vectorSrcReg;
742 vp_BINop_instruction
743 vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
744 swizzleSrcReg;
745
746 /*
747 fragment program
748 <BINop> ::= "ADD" | "ADD_SAT"
749 | "DP3" | "DP3_SAT"
750 | "DP4" | "DP4_SAT"
751 | "DPH" | "DPH_SAT"
752 | "DST" | "DST_SAT"
753 | "MAX" | "MAX_SAT"
754 | "MIN" | "MIN_SAT"
755 | "MUL" | "MUL_SAT"
756 | "SGE" | "SGE_SAT"
757 | "SLT" | "SLT_SAT"
758 | "SUB" | "SUB_SAT"
759 | "XPD" | "XPD_SAT"
760
761 vertex program
762 <BINop> ::= "ADD"
763 | "DP3"
764 | "DP4"
765 | "DPH"
766 | "DST"
767 | "MAX"
768 | "MIN"
769 | "MUL"
770 | "SGE"
771 | "SLT"
772 | "SUB"
773 | "XPD"
774 */
775 fp_BINop
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;
788 vp_BINop
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
800 "XPD" .emit OP_XPD;
801
802 /*
803 fragment program
804 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
805 <vectorSrcReg> "," <vectorSrcReg> ","
806 <vectorSrcReg>
807
808 vertex program
809 <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
810 <swizzleSrcReg> "," <swizzleSrcReg> ","
811 <swizzleSrcReg>
812 */
813 fp_TRIop_instruction
814 fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
815 vectorSrcReg .and comma .and vectorSrcReg;
816 vp_TRIop_instruction
817 vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
818 swizzleSrcReg .and comma .and swizzleSrcReg;
819
820 /*
821 fragment program
822 <TRIop> ::= "CMP" | "CMP_SAT"
823 | "LRP" | "LRP_SAT"
824 | "MAD" | "MAD_SAT"
825
826 vertex program
827 <TRIop> ::= "MAD"
828 */
829 fp_TRIop
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;
833 vp_TRIop
834 "MAD" .emit OP_MAD;
835
836 /*
837 fragment program
838 <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
839 <srcReg> "," <extendedSwizzle>
840
841 vertex program
842 <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
843 <extendedSwizzle>
844 */
845 fp_SWZ_instruction
846 SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
847 fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
848 vp_SWZ_instruction
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;
851
852 /*
853 fragment program
854 <SWZop> ::= "SWZ" | "SWZ_SAT"
855 */
856 SWZop
857 "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
858
859 /*
860 fragment program
861 <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
862 <vectorSrcReg> "," <texImageUnit> ","
863 <texTarget>
864 */
865 SAMPLE_instruction
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;
868
869 /*
870 fragment program
871 <SAMPLEop> ::= "TEX" | "TEX_SAT"
872 | "TXP" | "TXP_SAT"
873 | "TXB" | "TXB_SAT"
874 */
875 SAMPLEop
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;
879
880 /*
881 fragment program
882 <KIL_instruction> ::= "KIL" <vectorSrcReg>
883 */
884 KIL_instruction
885 "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
886
887 /*
888 fragment program
889 <texImageUnit> ::= "texture" <optTexImageUnitNum>
890 */
891 texImageUnit
892 "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
893
894 /*
895 fragment program
896 <texTarget> ::= "1D"
897 | "2D"
898 | "3D"
899 | "CUBE"
900 | "RECT"
901 | <shadowTarget> (if option ARB_fragment_program_shadow present)
902 */
903 texTarget
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;
910
911 /*
912 GL_ARB_fragment_program_shadow
913 <shadowTarget> ::= "SHADOW1D"
914 | "SHADOW2D"
915 | "SHADOWRECT"
916 */
917 shadowTarget
918 "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
919 "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
920 .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
921
922 /*
923 fragment program
924 <optTexImageUnitNum> ::= ""
925 | "[" <texImageUnitNum> "]"
926 */
927 optTexImageUnitNum
928 optTexImageUnitNum_1 .or .true .emit 0x00;
929 optTexImageUnitNum_1
930 lbracket_ne .and texImageUnitNum .and rbracket;
931
932 /*
933 fragment program
934 <texImageUnitNum> ::= <integer> from 0 to
935 MAX_TEXTURE_IMAGE_UNITS_ARB-1
936 */
937 texImageUnitNum
938 integer;
939
940 /*
941 <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
942 */
943 fp_scalarSrcReg
944 optionalSign .and fp_srcReg .and fp_scalarSuffix;
945 vp_scalarSrcReg
946 optionalSign .and vp_srcReg .and vp_scalarSuffix;
947
948 /*
949 vertex program
950 <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
951 */
952 swizzleSrcReg
953 optionalSign .and vp_srcReg .and swizzleSuffix;
954
955 /*
956 fragment program
957 <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
958 */
959 vectorSrcReg
960 optionalSign .and fp_srcReg .and optionalSuffix;
961
962 /*
963 <maskedDstReg> ::= <dstReg> <optionalMask>
964 */
965 fp_maskedDstReg
966 fp_dstReg .and fp_optionalMask;
967 vp_maskedDstReg
968 vp_dstReg .and vp_optionalMask;
969
970 /*
971 vertex program
972 <maskedAddrReg> ::= <addrReg> <addrWriteMask>
973 */
974 maskedAddrReg
975 addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
976
977 /*
978 fragment program
979 <extendedSwizzle> ::= <xyzwExtendedSwizzle>
980 | <rgbaExtendedSwizzle>
981
982 vertex program
983 <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
984 <extSwizComp> "," <extSwizComp>
985
986 NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
987 */
988 fp_extendedSwizzle
989 rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
990 vp_extendedSwizzle
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;
995
996 /*
997 fragment program
998 <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
999 <xyzwExtSwizComp> "," <xyzwExtSwizComp>
1000 */
1001 xyzwExtendedSwizzle
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;
1006
1007 /*
1008 fragment program
1009 <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
1010 <rgbaExtSwizComp> "," <rgbaExtSwizComp>
1011 */
1012 rgbaExtendedSwizzle
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;
1030
1031 /*
1032 fragment program
1033 <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
1034 */
1035 xyzwExtSwizComp
1036 optionalSign .and xyzwExtSwizSel;
1037
1038 /*
1039 fragment program
1040 <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
1041 */
1042 rgbaExtSwizComp
1043 optionalSign .and rgbaExtSwizSel;
1044 rgbaExtSwizComp_digit
1045 optionalSign .and rgbaExtSwizSel_digit;
1046 rgbaExtSwizComp_alpha
1047 optionalSign .and rgbaExtSwizSel_alpha;
1048
1049 /*
1050 vertex program
1051 <extSwizComp> ::= <optionalSign> <extSwizSel>
1052 */
1053 extSwizComp
1054 optionalSign .and extSwizSel;
1055
1056 /*
1057 fragment program
1058 <xyzwExtSwizSel> ::= "0"
1059 | "1"
1060 | <xyzwComponent>
1061 */
1062 xyzwExtSwizSel
1063 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
1064
1065 /*
1066 fragment program
1067 <rgbaExtSwizSel> ::= "0"
1068 | "1"
1069 | <rgbaComponent>
1070 */
1071 rgbaExtSwizSel
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;
1077
1078 /*
1079 vertex program
1080 <extSwizSel> ::= "0"
1081 | "1"
1082 | <component>
1083 */
1084 extSwizSel
1085 "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
1086
1087 /*
1088 fragment program
1089 <srcReg> ::= <fragmentAttribReg>
1090 | <temporaryReg>
1091 | <progParamReg>
1092
1093 vertex program
1094 <srcReg> ::= <vertexAttribReg>
1095 | <temporaryReg>
1096 | <progParamReg>
1097 */
1098 fp_srcReg
1099 fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1100 vp_srcReg
1101 vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
1102 fp_srcReg_1
1103 fragmentAttribReg .emit REGISTER_ATTRIB .or
1104 fp_progParamReg .emit REGISTER_PARAM .or
1105 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1106 vp_srcReg_1
1107 vertexAttribReg .emit REGISTER_ATTRIB .or
1108 vp_progParamReg .emit REGISTER_PARAM .or
1109 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1110
1111 /*
1112 fragment program
1113 <dstReg> ::= <temporaryReg>
1114 | <fragmentResultReg>
1115
1116 vertex program
1117 <dstReg> ::= <temporaryReg>
1118 | <vertexResultReg>
1119 */
1120 fp_dstReg
1121 fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1122 vp_dstReg
1123 vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
1124 fp_dstReg_1
1125 fragmentResultReg .emit REGISTER_RESULT .or
1126 fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1127 vp_dstReg_1
1128 vertexResultReg .emit REGISTER_RESULT .or
1129 vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
1130
1131 /*
1132 fragment program
1133 <fragmentAttribReg> ::= <establishedName>
1134 | <fragAttribBinding>
1135
1136 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1137 */
1138 fragmentAttribReg
1139 /*fp_establishedName .or */fragAttribBinding;
1140
1141 /*
1142 vertex program
1143 <vertexAttribReg> ::= <establishedName>
1144 | <vtxAttribBinding>
1145
1146 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1147 */
1148 vertexAttribReg
1149 vtxAttribBinding;
1150
1151 /*
1152 <temporaryReg> ::= <establishedName>
1153 */
1154 fp_temporaryReg
1155 fp_establishedName_no_error_on_identifier;
1156 vp_temporaryReg
1157 vp_establishedName_no_error_on_identifier;
1158
1159 /*
1160 fragment program
1161 <progParamReg> ::= <progParamSingle>
1162 | <progParamArray> "[" <progParamArrayAbs> "]"
1163 | <paramSingleItemUse>
1164
1165 vertex program
1166 <progParamReg> ::= <progParamSingle>
1167 | <progParamArray> "[" <progParamArrayMem> "]"
1168 | <paramSingleItemUse>
1169 */
1170 fp_progParamReg
1171 fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
1172 vp_progParamReg
1173 vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
1174 fp_progParamReg_1
1175 fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
1176 rbracket;
1177 vp_progParamReg_1
1178 vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
1179 rbracket;
1180
1181 /*
1182 <progParamSingle> ::= <establishedName>
1183
1184 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
1185 */
1186 fp_progParamSingle
1187 .false;
1188 vp_progParamSingle
1189 .false;
1190
1191 /*
1192 <progParamArray> ::= <establishedName>
1193 */
1194 fp_progParamArray
1195 fp_establishedName_no_error_on_identifier;
1196 vp_progParamArray
1197 vp_establishedName_no_error_on_identifier;
1198
1199 /*
1200 vertex program
1201 <progParamArrayMem> ::= <progParamArrayAbs>
1202 | <progParamArrayRel>
1203 */
1204 progParamArrayMem
1205 progParamArrayAbs .or progParamArrayRel;
1206
1207 /*
1208 <progParamArrayAbs> ::= <integer>
1209 */
1210 progParamArrayAbs
1211 integer_ne .emit ARRAY_INDEX_ABSOLUTE;
1212
1213 /*
1214 vertex program
1215 <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
1216 */
1217 progParamArrayRel
1218 addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
1219 addrComponent .and addrRegRelOffset;
1220
1221 /*
1222 vertex program
1223 <addrRegRelOffset> ::= ""
1224 | "+" <addrRegPosOffset>
1225 | "-" <addrRegNegOffset>
1226 */
1227 addrRegRelOffset
1228 addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
1229 addrRegRelOffset_1
1230 plus_ne .and addrRegPosOffset;
1231 addrRegRelOffset_2
1232 minus_ne .and addrRegNegOffset;
1233
1234 /*
1235 vertex program
1236 <addrRegPosOffset> ::= <integer> from 0 to 63
1237 */
1238 addrRegPosOffset
1239 integer_0_63;
1240
1241 /*
1242 vertex program
1243 <addrRegNegOffset> ::= <integer> from 0 to 64
1244 */
1245 addrRegNegOffset
1246 integer_0_64;
1247
1248 /*
1249 fragment program
1250 <fragmentResultReg> ::= <establishedName>
1251 | <resultBinding>
1252
1253 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1254 */
1255 fragmentResultReg
1256 fp_resultBinding;
1257
1258 /*
1259 vertex program
1260 <vertexResultReg> ::= <establishedName>
1261 | <resultBinding>
1262
1263 NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
1264 */
1265 vertexResultReg
1266 vp_resultBinding;
1267
1268 /*
1269 vertex program
1270 <addrReg> ::= <establishedName>
1271 */
1272 addrReg
1273 vp_establishedName_no_error_on_identifier;
1274
1275 /*
1276 vertex program
1277 <addrComponent> ::= "." "x"
1278 */
1279 addrComponent
1280 dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
1281 .emit COMPONENT_X .emit COMPONENT_X;
1282
1283 /*
1284 vertex program
1285 <addrWriteMask> ::= "." "x"
1286 */
1287 addrWriteMask
1288 dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
1289
1290 /*
1291 <scalarSuffix> ::= "." <component>
1292 */
1293 fp_scalarSuffix
1294 dot .and fp_component_single .error INVALID_COMPONENT;
1295 vp_scalarSuffix
1296 dot .and vp_component_single .error INVALID_COMPONENT;
1297
1298 /*
1299 vertex program
1300 <swizzleSuffix> ::= ""
1301 | "." <component>
1302 | "." <component> <component>
1303 <component> <component>
1304 */
1305 swizzleSuffix
1306 swizzleSuffix_1 .or
1307 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1308 swizzleSuffix_1
1309 dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
1310 swizzleSuffix_2
1311 swizzleSuffix_3 .or swizzleSuffix_4;
1312 swizzleSuffix_3
1313 vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
1314 vp_component_multi .error INVALID_COMPONENT;
1315 swizzleSuffix_4
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;
1320
1321 /*
1322 fragment program
1323 <optionalSuffix> ::= ""
1324 | "." <component>
1325 | "." <xyzwComponent> <xyzwComponent>
1326 <xyzwComponent> <xyzwComponent>
1327 | "." <rgbaComponent> <rgbaComponent>
1328 <rgbaComponent> <rgbaComponent>
1329 */
1330 optionalSuffix
1331 optionalSuffix_1 .or
1332 .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
1333 optionalSuffix_1
1334 dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
1335 optionalSuffix_2
1336 optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
1337 optionalSuffix_3
1338 xyzwComponent_multi .and xyzwComponent_multi .and
1339 xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
1340 optionalSuffix_4
1341 rgbaComponent_multi .and rgbaComponent_multi .and
1342 rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
1343 optionalSuffix_5
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;
1352
1353 /*
1354 fragment program
1355 <component> ::= <xyzwComponent>
1356 | <rgbaComponent>
1357
1358 vertex program
1359 <component> ::= "x"
1360 | "y"
1361 | "z"
1362 | "w"
1363 */
1364 fp_component_single
1365 xyzwComponent_single .or rgbaComponent_single;
1366 vp_component_multi
1367 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
1368 'w' .emit COMPONENT_W;
1369 vp_component_single
1370 "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
1371 "w" .emit COMPONENT_W;
1372
1373 /*
1374 fragment program
1375 <xyzwComponent> ::= "x" | "y" | "z" | "w"
1376 */
1377 xyzwComponent_multi
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;
1383
1384 /*
1385 fragment program
1386 <rgbaComponent> ::= "r" | "g" | "b" | "a"
1387 */
1388 rgbaComponent_multi
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;
1394
1395 /*
1396 fragment program
1397 <optionalMask> ::= ""
1398 | <xyzwMask>
1399 | <rgbaMask>
1400
1401 vertex program
1402 <optionalMask> ::= ""
1403 | "." "x"
1404 | "." "y"
1405 | "." "xy"
1406 | "." "z"
1407 | "." "xz"
1408 | "." "yz"
1409 | "." "xyz"
1410 | "." "w"
1411 | "." "xw"
1412 | "." "yw"
1413 | "." "xyw"
1414 | "." "zw"
1415 | "." "xzw"
1416 | "." "yzw"
1417 | "." "xyzw"
1418
1419 NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
1420 */
1421 fp_optionalMask
1422 rgbaMask .or xyzwMask .or .true .emit 0x0F;
1423 vp_optionalMask
1424 xyzwMask .or .true .emit 0x0F;
1425
1426 /*
1427 fragment program
1428 <xyzwMask> ::= "." "x"
1429 | "." "y"
1430 | "." "xy"
1431 | "." "z"
1432 | "." "xz"
1433 | "." "yz"
1434 | "." "xyz"
1435 | "." "w"
1436 | "." "xw"
1437 | "." "yw"
1438 | "." "xyw"
1439 | "." "zw"
1440 | "." "xzw"
1441 | "." "yzw"
1442 | "." "xyzw"
1443
1444 NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
1445 */
1446 xyzwMask
1447 dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
1448 xyzwMask_1
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;
1453
1454 /*
1455 fragment program
1456 <rgbaMask> ::= "." "r"
1457 | "." "g"
1458 | "." "rg"
1459 | "." "b"
1460 | "." "rb"
1461 | "." "gb"
1462 | "." "rgb"
1463 | "." "a"
1464 | "." "ra"
1465 | "." "ga"
1466 | "." "rga"
1467 | "." "ba"
1468 | "." "rba"
1469 | "." "gba"
1470 | "." "rgba"
1471 */
1472 rgbaMask
1473 dot_ne .and rgbaMask_1;
1474 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;
1479
1480 /*
1481 fragment program
1482 <namingStatement> ::= <ATTRIB_statement>
1483 | <PARAM_statement>
1484 | <TEMP_statement>
1485 | <OUTPUT_statement>
1486 | <ALIAS_statement>
1487
1488 vertex program
1489 <namingStatement> ::= <ATTRIB_statement>
1490 | <PARAM_statement>
1491 | <TEMP_statement>
1492 | <ADDRESS_statement>
1493 | <OUTPUT_statement>
1494 | <ALIAS_statement>
1495 */
1496 fp_namingStatement
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;
1502 vp_namingStatement
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;
1509
1510 /*
1511 fragment program
1512 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1513 <fragAttribBinding>
1514
1515 vertex program
1516 <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
1517 <vtxAttribBinding>
1518 */
1519 fp_ATTRIB_statement
1520 "ATTRIB" .and space .and fp_establishName .and equal .and
1521 fragAttribBinding .error FRAGMENT_EXPECTED;
1522 vp_ATTRIB_statement
1523 "ATTRIB" .and space .and vp_establishName .and equal .and
1524 vtxAttribBinding .error VERTEX_EXPECTED;
1525
1526 /*
1527 fragment program
1528 <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
1529 */
1530 fragAttribBinding
1531 "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
1532
1533 /*
1534 vertex program
1535 <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
1536 */
1537 vtxAttribBinding
1538 "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
1539
1540 /*
1541 fragment program
1542 <fragAttribItem> ::= "color" <optColorType>
1543 | "texcoord" <optTexCoordNum>
1544 | "fogcoord"
1545 | "position"
1546 */
1547 fragAttribItem
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;
1552 fragAttribItem_1
1553 "color" .and optColorType;
1554 fragAttribItem_2
1555 "texcoord" .and optTexCoordNum;
1556
1557 /*
1558 vertex program
1559 <vtxAttribItem> ::= "position"
1560 | "weight" <vtxOptWeightNum>
1561 | "normal"
1562 | "color" <optColorType>
1563 | "fogcoord"
1564 | "texcoord" <optTexCoordNum>
1565 | "matrixindex" "[" <vtxWeightNum> "]"
1566 | "attrib" "[" <vtxAttribNum> "]"
1567 */
1568 vtxAttribItem
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;
1577 vtxAttribItem_1
1578 "weight" .and vtxOptWeightNum;
1579 vtxAttribItem_2
1580 "color" .and optColorType;
1581 vtxAttribItem_3
1582 "texcoord" .and optTexCoordNum;
1583 vtxAttribItem_4
1584 "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
1585 vtxAttribItem_5
1586 "attrib" .and lbracket .and vtxAttribNum .and rbracket;
1587
1588 /*
1589 vertex program
1590 <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
1591 */
1592 vtxAttribNum
1593 integer;
1594
1595 /*
1596 vertex program
1597 <vtxOptWeightNum> ::= ""
1598 | "[" <vtxWeightNum> "]"
1599 */
1600 vtxOptWeightNum
1601 vtxOptWeightNum_1 .or .true .emit 0x00;
1602 vtxOptWeightNum_1
1603 lbracket_ne .and vtxWeightNum .and rbracket;
1604
1605 /*
1606 vertex program
1607 <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
1608 must be divisible by four
1609 */
1610 vtxWeightNum
1611 integer;
1612
1613 /*
1614 <PARAM_statement> ::= <PARAM_singleStmt>
1615 | <PARAM_multipleStmt>
1616 */
1617 fp_PARAM_statement
1618 fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
1619 vp_PARAM_statement
1620 vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
1621
1622 /*
1623 <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
1624 */
1625 fp_PARAM_singleStmt
1626 "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
1627 .true .emit PARAM_NULL;
1628 vp_PARAM_singleStmt
1629 "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
1630 .true .emit PARAM_NULL;
1631
1632 /*
1633 <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
1634 <paramMultipleInit>
1635 */
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;
1642
1643 /*
1644 <optArraySize> ::= ""
1645 | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
1646 (maximum number of allowed program
1647 parameter bindings)
1648 */
1649 optArraySize
1650 optional_integer;
1651
1652 /*
1653 <paramSingleInit> ::= "=" <paramSingleItemDecl>
1654 */
1655 fp_paramSingleInit
1656 equal .and fp_paramSingleItemDecl;
1657 vp_paramSingleInit
1658 equal .and vp_paramSingleItemDecl;
1659
1660 /*
1661 <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
1662 */
1663 fp_paramMultipleInit
1664 equal .and lbrace .and fp_paramMultInitList .and rbrace;
1665 vp_paramMultipleInit
1666 equal .and lbrace .and vp_paramMultInitList .and rbrace;
1667
1668 /*
1669 <paramMultInitList> ::= <paramMultipleItem>
1670 | <paramMultipleItem> "," <paramMultiInitList>
1671 */
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;
1680
1681 /*
1682 <paramSingleItemDecl> ::= <stateSingleItem>
1683 | <programSingleItem>
1684 | <paramConstDecl>
1685 */
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;
1694
1695 /*
1696 <paramSingleItemUse> ::= <stateSingleItem>
1697 | <programSingleItem>
1698 | <paramConstUse>
1699 */
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;
1708
1709 /*
1710 <paramMultipleItem> ::= <stateMultipleItem>
1711 | <programMultipleItem>
1712 | <paramConstDecl>
1713 */
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;
1722
1723 /*
1724 <stateMultipleItem> ::= <stateSingleItem>
1725 | "state" "." <stateMatrixRows>
1726 */
1727 fp_stateMultipleItem
1728 stateMultipleItem_1 .or fp_stateSingleItem;
1729 vp_stateMultipleItem
1730 stateMultipleItem_1 .or vp_stateSingleItem;
1731 stateMultipleItem_1
1732 "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
1733
1734 /*
1735 fragment program
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>
1744
1745 vertex program
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>
1755 */
1756 fp_stateSingleItem
1757 "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
1758 vp_stateSingleItem
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
1766 stateSingleItem_11;
1767 stateSingleItem_1
1768 stateMaterialItem .emit STATE_MATERIAL;
1769 stateSingleItem_2
1770 stateLightItem .emit STATE_LIGHT;
1771 stateSingleItem_3
1772 stateLightModelItem .emit STATE_LIGHT_MODEL;
1773 stateSingleItem_4
1774 stateLightProdItem .emit STATE_LIGHT_PROD;
1775 stateSingleItem_5
1776 stateTexEnvItem .emit STATE_TEX_ENV;
1777 stateSingleItem_6
1778 stateTexGenItem .emit STATE_TEX_GEN;
1779 stateSingleItem_7
1780 stateFogItem .emit STATE_FOG;
1781 stateSingleItem_8
1782 stateDepthItem .emit STATE_DEPTH;
1783 stateSingleItem_9
1784 stateClipPlaneItem .emit STATE_CLIP_PLANE;
1785 stateSingleItem_10
1786 statePointItem .emit STATE_POINT;
1787 stateSingleItem_11
1788 stateMatrixRow .emit STATE_MATRIX_ROWS;
1789
1790 /*
1791 <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
1792 */
1793 stateMaterialItem
1794 "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
1795
1796 /*
1797 <stateMatProperty> ::= "ambient"
1798 | "diffuse"
1799 | "specular"
1800 | "emission"
1801 | "shininess"
1802 */
1803 stateMatProperty
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;
1809
1810 /*
1811 <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
1812 <stateLightProperty>
1813 */
1814 stateLightItem
1815 "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
1816 stateLightProperty .error INVALID_LIGHT_PROPERTY;
1817
1818 /*
1819 <stateLightProperty> ::= "ambient"
1820 | "diffuse"
1821 | "specular"
1822 | "position"
1823 | "attenuation"
1824 | "spot" "." <stateSpotProperty>
1825 | "half"
1826 */
1827 stateLightProperty
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;
1837
1838 /*
1839 <stateSpotProperty> ::= "direction"
1840 */
1841 stateSpotProperty
1842 "direction";
1843
1844 /*
1845 <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
1846 */
1847 stateLightModelItem
1848 "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
1849
1850 /*
1851 <stateLModProperty> ::= "." "ambient"
1852 | <optFaceType> "." "scenecolor"
1853 */
1854 stateLModProperty
1855 stateLModProperty_1 .or stateLModProperty_2;
1856 stateLModProperty_1
1857 dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
1858 stateLModProperty_2
1859 stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
1860 stateLModProperty_3
1861 optFaceType .and dot .and "scenecolor";
1862
1863 /*
1864 <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
1865 <optFaceType> "." <stateLProdProperty>
1866 */
1867 stateLightProdItem
1868 "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
1869 stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
1870
1871 /*
1872 <stateLProdProperty> ::= "ambient"
1873 | "diffuse"
1874 | "specular"
1875 */
1876 stateLProdProperty
1877 "ambient" .emit LIGHT_PROD_AMBIENT .or
1878 "diffuse" .emit LIGHT_PROD_DIFFUSE .or
1879 "specular" .emit LIGHT_PROD_SPECULAR;
1880
1881 /*
1882 <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
1883 */
1884 stateLightNumber
1885 integer;
1886
1887 /*
1888 fragment program
1889 <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
1890 <stateTexEnvProperty>
1891 */
1892 stateTexEnvItem
1893 "texenv" .and optLegacyTexUnitNum .and dot .and
1894 stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
1895
1896 /*
1897 fragment program
1898 <stateTexEnvProperty> ::= "color"
1899 */
1900 stateTexEnvProperty
1901 "color" .emit TEX_ENV_COLOR;
1902
1903 /*
1904 fragment program
1905 <optLegacyTexUnitNum> ::= ""
1906 | "[" <legacyTexUnitNum> "]"
1907
1908 NOTE: <optLegaceTexUnitNum> is not optional.
1909 */
1910 optLegacyTexUnitNum
1911 lbracket_ne .and legacyTexUnitNum .and rbracket;
1912
1913 /*
1914 fragment program
1915 <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
1916 */
1917 legacyTexUnitNum
1918 integer;
1919
1920 /*
1921 vertex program
1922 <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
1923 <stateTexGenType> "." <stateTexGenCoord>
1924 */
1925 stateTexGenItem
1926 "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
1927 dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
1928
1929 /*
1930 vertex program
1931 <stateTexGenType> ::= "eye"
1932 | "object"
1933 */
1934 stateTexGenType
1935 "eye" .emit TEX_GEN_EYE .or
1936 "object" .emit TEX_GEN_OBJECT;
1937
1938 /*
1939 vertex program
1940 <stateTexGenCoord> ::= "s"
1941 | "t"
1942 | "r"
1943 | "q"
1944 */
1945 stateTexGenCoord
1946 "s" .emit COMPONENT_X .or
1947 "t" .emit COMPONENT_Y .or
1948 "r" .emit COMPONENT_Z .or
1949 "q" .emit COMPONENT_W;
1950
1951 /*
1952 <stateFogItem> ::= "fog" "." <stateFogProperty>
1953 */
1954 stateFogItem
1955 "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
1956
1957 /*
1958 <stateFogProperty> ::= "color"
1959 | "params"
1960 */
1961 stateFogProperty
1962 "color" .emit FOG_COLOR .or
1963 "params" .emit FOG_PARAMS;
1964
1965 /*
1966 fragment program
1967 <stateDepthItem> ::= "depth" "." <stateDepthProperty>
1968 */
1969 stateDepthItem
1970 "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
1971
1972 /*
1973 fragment program
1974 <stateDepthProperty> ::= "range"
1975 */
1976 stateDepthProperty
1977 "range" .emit DEPTH_RANGE;
1978
1979 /*
1980 vertex program
1981 <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
1982 */
1983 stateClipPlaneItem
1984 "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
1985 "plane" .error INVALID_CLIPPLANE_PROPERTY;
1986
1987 /*
1988 vertex program
1989 <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
1990 */
1991 stateClipPlaneNum
1992 integer;
1993
1994 /*
1995 vertex program
1996 <statePointItem> ::= "point" "." <statePointProperty>
1997 */
1998 statePointItem
1999 "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
2000
2001 /*
2002 vertex program
2003 <statePointProperty> ::= "size"
2004 | "attenuation"
2005 */
2006 statePointProperty
2007 "size" .emit POINT_SIZE .or
2008 .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
2009
2010 /*
2011 <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
2012 <stateMatrixRowNum> "]"
2013 */
2014 stateMatrixRow
2015 stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
2016 lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
2017
2018 /*
2019 <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
2020 */
2021 stateMatrixRows
2022 stateMatrixItem .and optMatrixRows;
2023
2024 /*
2025 <optMatrixRows> ::= ""
2026 | "." "row" "[" <stateMatrixRowNum> ".."
2027 <stateMatrixRowNum> "]"
2028 */
2029 optMatrixRows
2030 optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
2031 optMatrixRows_1
2032 dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
2033 stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
2034
2035 /*
2036 <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
2037 <stateOptMatModifier>
2038 */
2039 stateMatrixItem
2040 "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
2041
2042 /*
2043 <stateOptMatModifier> ::= ""
2044 | "." <stateMatModifier>
2045 */
2046 stateOptMatModifier
2047 stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
2048 stateOptMatModifier_1
2049 dot_ne .and stateMatModifier;
2050
2051 /*
2052 <stateMatModifier> ::= "inverse"
2053 | "transpose"
2054 | "invtrans"
2055 */
2056 stateMatModifier
2057 "inverse" .emit MATRIX_MODIFIER_INVERSE .or
2058 "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
2059 "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
2060
2061 /*
2062 <stateMatrixRowNum> ::= <integer> from 0 to 3
2063 */
2064 stateMatrixRowNum
2065 integer_0_3;
2066
2067 /*
2068 <stateMatrixName> ::= "modelview" <stateOptModMatNum>
2069 | "projection"
2070 | "mvp"
2071 | "texture" <optTexCoordNum>
2072 | "palette" "[" <statePaletteMatNum> "]"
2073 | "program" "[" <stateProgramMatNum> "]"
2074 */
2075 stateMatrixName
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;
2082 stateMatrixName_1_1
2083 "modelview" .and stateOptModMatNum;
2084 stateMatrixName_1_2
2085 "texture" .and optTexCoordNum;
2086 stateMatrixName_1_3
2087 "palette" .and lbracket .and statePaletteMatNum .and rbracket;
2088 stateMatrixName_1_4
2089 "program" .and lbracket .and stateProgramMatNum .and rbracket;
2090
2091 /*
2092 <stateOptModMatNum> ::= ""
2093 | "[" <stateModMatNum> "]"
2094 */
2095 stateOptModMatNum
2096 .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
2097 .true .emit 0x00;
2098 stateOptModMatNum_1
2099 lbracket_ne .and stateModMatNum .and rbracket;
2100
2101 /*
2102 <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
2103 */
2104 stateModMatNum
2105 integer;
2106
2107 /*
2108 <optTexCoordNum> ::= ""
2109 | "[" <texCoordNum> "]"
2110 */
2111 optTexCoordNum
2112 optTexCoordNum_1 .or .true .emit 0x00;
2113 optTexCoordNum_1
2114 lbracket_ne .and texCoordNum .and rbracket;
2115
2116 /*
2117 <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
2118 */
2119 texCoordNum
2120 integer;
2121
2122 /*
2123 <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
2124 */
2125 statePaletteMatNum
2126 integer;
2127
2128 /*
2129 <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
2130 */
2131 stateProgramMatNum
2132 integer;
2133
2134 /*
2135 <programSingleItem> ::= <progEnvParam>
2136 | <progLocalParam>
2137
2138 NOTE: <programSingleItem> has been modified for correct error handling. If program property
2139 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2140 */
2141 programSingleItem
2142 "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
2143 programSingleItem_1
2144 progEnvParam .or progLocalParam;
2145
2146 /*
2147 <programMultipleItem> ::= <progEnvParams>
2148 | <progLocalParams>
2149
2150 NOTE: <programMultipleItem> has been modified for correct error handling. If program property
2151 is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
2152 */
2153 programMultipleItem
2154 "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
2155 programMultipleItem_1
2156 progEnvParams .or progLocalParams;
2157
2158 /*
2159 <progEnvParams> ::= "program" "." "env"
2160 "[" <progEnvParamNums> "]"
2161
2162 NOTE: "program" "." has been moved to <programMultipleItem>.
2163 */
2164 progEnvParams
2165 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
2166
2167 /*
2168 <progEnvParamNums> ::= <progEnvParamNum>
2169 | <progEnvParamNum> ".." <progEnvParamNum>
2170 */
2171 progEnvParamNums
2172 progEnvParamNums_1 .or progEnvParamNums_2;
2173 progEnvParamNums_1
2174 progEnvParamNum .and dotdot_ne .and progEnvParamNum;
2175 progEnvParamNums_2
2176 progEnvParamNum .and .true .emit 0x00;
2177
2178 /*
2179 <progEnvParam> ::= "program" "." "env"
2180 "[" <progEnvParamNum> "]"
2181
2182 NOTE: "program" "." has been moved to <programSingleItem>.
2183 */
2184 progEnvParam
2185 "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
2186
2187 /*
2188 <progLocalParams> ::= "program" "." "local"
2189 "[" <progLocalParamNums> "]"
2190
2191 NOTE: "program" "." has been moved to <programMultipleItem>.
2192 */
2193 progLocalParams
2194 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
2195
2196 /*
2197 <progLocalParamNums> ::= <progLocalParamNum>
2198 | <progLocalParamNum> ".." <progLocalParamNum>
2199 */
2200 progLocalParamNums
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;
2206
2207 /*
2208 <progLocalParam> ::= "program" "." "local"
2209 "[" <progLocalParamNum> "]"
2210
2211 NOTE: "program" "." has been moved to <programSingleItem>.
2212 */
2213 progLocalParam
2214 "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
2215
2216 /*
2217 <progEnvParamNum> ::= <integer> from 0 to
2218 MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
2219 */
2220 progEnvParamNum
2221 integer;
2222
2223 /*
2224 <progLocalParamNum> ::= <integer> from 0 to
2225 MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
2226 */
2227 progLocalParamNum
2228 integer;
2229
2230 /*
2231 <paramConstDecl> ::= <paramConstScalarDecl>
2232 | <paramConstVector>
2233 */
2234 paramConstDecl
2235 paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2236
2237 /*
2238 <paramConstUse> ::= <paramConstScalarUse>
2239 | <paramConstVector>
2240 */
2241 paramConstUse
2242 paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
2243
2244 /*
2245 <paramConstScalarDecl> ::= <signedFloatConstant>
2246 */
2247 paramConstScalarDecl
2248 signedFloatConstant;
2249
2250 /*
2251 <paramConstScalarUse> ::= <floatConstant>
2252 */
2253 paramConstScalarUse
2254 floatConstant;
2255
2256 /*
2257 <paramConstVector> ::= "{" <signedFloatConstant> "}"
2258 | "{" <signedFloatConstant> ","
2259 <signedFloatConstant> "}"
2260 | "{" <signedFloatConstant> ","
2261 <signedFloatConstant> ","
2262 <signedFloatConstant> "}"
2263 | "{" <signedFloatConstant> ","
2264 <signedFloatConstant> ","
2265 <signedFloatConstant> ","
2266 <signedFloatConstant> "}"
2267 */
2268 paramConstVector
2269 paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
2270 paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
2271 paramConstVector_1
2272 lbrace_ne .and signedFloatConstant .and rbrace;
2273 paramConstVector_2
2274 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2275 paramConstVector_3
2276 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2277 signedFloatConstant .and rbrace;
2278 paramConstVector_4
2279 lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
2280 signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
2281
2282 /*
2283 <signedFloatConstant> ::= <optionalSign> <floatConstant>
2284 */
2285 signedFloatConstant
2286 optionalSign .and floatConstant;
2287
2288 /*
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.
2297 */
2298 floatConstant
2299 float;
2300
2301 /*
2302 <optionalSign> ::= ""
2303 | "-"
2304 | "+"
2305 */
2306 optionalSign
2307 optional_sign_ne;
2308
2309 /*
2310 <TEMP_statement> ::= "TEMP" <varNameList>
2311 */
2312 fp_TEMP_statement
2313 "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
2314 vp_TEMP_statement
2315 "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
2316
2317 /*
2318 vertex program
2319 <ADDRESS_statement> ::= "ADDRESS" <varNameList>
2320 */
2321 ADDRESS_statement
2322 "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
2323
2324 /*
2325 <varNameList> ::= <establishName>
2326 | <establishName> "," <varNameList>
2327 */
2328 fp_varNameList
2329 fp_varNameList_1 .or fp_establishName;
2330 vp_varNameList
2331 vp_varNameList_1 .or vp_establishName;
2332 fp_varNameList_1
2333 fp_establishName .and comma_ne .and fp_varNameList;
2334 vp_varNameList_1
2335 vp_establishName .and comma_ne .and vp_varNameList;
2336
2337 /*
2338 <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
2339 <resultBinding>
2340 */
2341 fp_OUTPUT_statement
2342 "OUTPUT" .and space .and fp_establishName .and equal .and
2343 fp_resultBinding .error RESULT_EXPECTED;
2344 vp_OUTPUT_statement
2345 "OUTPUT" .and space .and vp_establishName .and equal .and
2346 vp_resultBinding .error RESULT_EXPECTED;
2347
2348 /*
2349 fragment program
2350 <resultBinding> ::= "result" "." "color"
2351 | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
2352 | "result" "." "depth"
2353
2354 vertex program
2355 <resultBinding> ::= "result" "." "position"
2356 | "result" "." <resultColBinding>
2357 | "result" "." "fogcoord"
2358 | "result" "." "pointsize"
2359 | "result" "." "texcoord" <optTexCoordNum>
2360 */
2361 fp_resultBinding
2362 "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2363 vp_resultBinding
2364 "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
2365 fp_resultBinding_1
2366 fp_resultBinding_2 .emit FRAGMENT_RESULT_COLOR .or
2367 "depth" .emit FRAGMENT_RESULT_DEPTH;
2368 fp_resultBinding_2
2369 "color" .and optOutputColorNum;
2370 vp_resultBinding_1
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;
2376 vp_resultBinding_2
2377 "texcoord" .and optTexCoordNum;
2378
2379 /*
2380 GL_ARB_draw_buffers
2381 <optOutputColorNum> ::= ""
2382 | "[" <outputColorNum> "]"
2383 */
2384 optOutputColorNum
2385 .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
2386 optOutputColorNum_1
2387 lbracket_ne .and outputColorNum .and rbracket;
2388
2389 /*
2390 GL_ARB_draw_buffers
2391 <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
2392 */
2393 outputColorNum
2394 integer;
2395
2396 /*
2397 vertex program
2398 <resultColBinding> ::= "color" <optFaceType> <optColorType>
2399 */
2400 resultColBinding
2401 "color" .and optFaceType .and optColorType;
2402
2403 /*
2404 <optFaceType> ::= ""
2405 | "." "front"
2406 | "." "back"
2407 */
2408 optFaceType
2409 FaceType .or .true .emit FACE_FRONT;
2410 FaceType
2411 dot_ne .and FaceProperty;
2412 FaceProperty
2413 "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
2414
2415 /*
2416 <optColorType> ::= ""
2417 | "." "primary"
2418 | "." "secondary"
2419 */
2420 optColorType
2421 ColorType .or .true .emit COLOR_PRIMARY;
2422 ColorType
2423 dot_ne .and ColorProperty;
2424 ColorProperty
2425 "primary" .emit COLOR_PRIMARY .or
2426 .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
2427
2428 /*
2429 <ALIAS_statement> ::= "ALIAS" <establishName> "="
2430 <establishedName>
2431 */
2432 fp_ALIAS_statement
2433 "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
2434 vp_ALIAS_statement
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;
2440
2441 /*
2442 <establishName> ::= <identifier>
2443 */
2444 fp_establishName
2445 fp_identifier;
2446 vp_establishName
2447 vp_identifier;
2448
2449 /*
2450 <establishedName> ::= <identifier>
2451 */
2452 fp_establishedName
2453 fp_identifier;
2454 vp_establishedName
2455 vp_identifier;
2456 fp_establishedName_no_error_on_identifier
2457 fp_identifier_ne;
2458 vp_establishedName_no_error_on_identifier
2459 vp_identifier_ne;
2460
2461 /*
2462 fragment program
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:
2470
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.
2480
2481 vertex program
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:
2489
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,
2493 state, and vertex.
2494 */
2495 fp_identifier
2496 fp_identifier_ne .error IDENTIFIER_EXPECTED;
2497 vp_identifier
2498 vp_identifier_ne .error IDENTIFIER_EXPECTED;
2499 fp_identifier_ne
2500 fp_not_reserved_identifier .and identifier_ne;
2501 vp_identifier_ne
2502 vp_not_reserved_identifier .and identifier_ne;
2503
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;
2512
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";
2530
2531 /*
2532 The <integer> rule matches an integer constant. The integer consists
2533 of a sequence of one or more digits ("0" through "9").
2534 */
2535 integer
2536 integer_ne .error INTEGER_EXPECTED;
2537
2538 zero
2539 '0';
2540
2541 leading_zeroes
2542 .loop zero;
2543
2544 no_digit
2545 no_digit_1 .or .true;
2546 no_digit_1
2547 digit10 .and .false .error INTEGER_OUT_OF_RANGE;
2548
2549 all_zeroes
2550 all_zeroes_1 .or no_digit_1;
2551 all_zeroes_1
2552 '0' .and .loop zero .and no_digit;
2553
2554 integer_0_3
2555 integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2556 integer_0_3_1
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;
2560
2561 integer_0_63
2562 integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2563 integer_0_63_1
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;
2574
2575 integer_0_64
2576 integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
2577 integer_0_64_1
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;
2588
2589 optional_space
2590 space .or .true;
2591
2592 space_dst
2593 space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
2594
2595 space_src
2596 space .error OPERATION_NEEDS_SOURCE_VARIABLE;
2597
2598 space
2599 single_space .and .loop single_space;
2600
2601 single_space
2602 white_char .or comment_block;
2603
2604 white_char
2605 ' ' .or '\t' .or '\n' .or '\r';
2606
2607 comment_block
2608 '#' .and .loop comment_char .and new_line;
2609
2610 /* All ASCII characters except '\r', '\n' and '\0' */
2611 comment_char
2612 '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
2613
2614 new_line
2615 '\n' .or crlf .or '\0';
2616
2617 crlf
2618 '\r' .and '\n';
2619
2620 semicolon
2621 optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
2622
2623 comma
2624 optional_space .and ',' .error MISSING_COMMA .and optional_space;
2625
2626 comma_ne
2627 optional_space .and ',' .and optional_space;
2628
2629 lbracket
2630 optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
2631
2632 lbracket_ne
2633 optional_space .and '[' .and optional_space;
2634
2635 rbracket
2636 optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
2637
2638 dot
2639 optional_space .and '.' .error MISSING_DOT .and optional_space;
2640
2641 dot_ne
2642 optional_space .and '.' .and optional_space;
2643
2644 equal
2645 optional_space .and '=' .error MISSING_EQUAL .and optional_space;
2646
2647 lbrace
2648 optional_space .and '{' .error MISSING_LBRACE .and optional_space;
2649
2650 lbrace_ne
2651 optional_space .and '{' .and optional_space;
2652
2653 rbrace
2654 optional_space .and '}' .error MISSING_RBRACE .and optional_space;
2655
2656 dotdot
2657 optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
2658
2659 dotdot_ne
2660 optional_space .and '.' .and '.' .and optional_space;
2661
2662 /*
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.
2667 */
2668 float
2669 float_1 .or float_2 .or float_legacy;
2670 float_1
2671 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2672 float_2
2673 integer_ne .and float_3;
2674 float_3
2675 float_4 .or float_5;
2676 float_4
2677 '.' .and optional_integer .and optional_exponent;
2678 float_5
2679 exponent .emit 0x00;
2680 float_legacy
2681 integer_ne .and .true .emit 0x00 .emit 0x00;
2682
2683 /*
2684 Below is a correct version of <float> definiton.
2685 */
2686 /*
2687 float
2688 float_1 .or float_2;
2689 float_1
2690 '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
2691 float_2
2692 integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
2693 float_3
2694 float_4 .or float_5;
2695 float_4
2696 '.' .and optional_integer .and optional_exponent;
2697 float_5
2698 exponent .emit 0x00;
2699 */
2700
2701 integer_ne
2702 integer_ne_1 .and .true .emit 0x00 .emit $;
2703 integer_ne_1
2704 digit10 .emit * .and .loop digit10 .emit *;
2705
2706 optional_integer
2707 integer_ne .or .true .emit 0x00;
2708
2709 /*
2710 NOTE: If exponent part is omited we treat it as if it was "E+1".
2711 */
2712 optional_exponent
2713 exponent .or .true .emit 0x00;
2714
2715 exponent
2716 exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
2717 exponent_1
2718 'e' .or 'E';
2719
2720 optional_sign_ne
2721 minus_ne .or plus_ne .or .true;
2722
2723 plus_ne
2724 optional_space .and '+' .and optional_space;
2725
2726 minus_ne
2727 optional_space .and '-' .emit '-' .and optional_space;
2728
2729 identifier_ne
2730 first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
2731
2732 follow_idchar
2733 first_idchar .or digit10;
2734
2735 first_idchar
2736 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2737
2738 digit10
2739 '0'-'9';
2740
2741 /*
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.
2746 */
2747 .string __string_filter;
2748
2749 __string_filter
2750 .loop __identifier_char;
2751
2752 __identifier_char
2753 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
2754
2755 /*
2756 error token filtering
2757 */
2758 e_signature
2759 e_signature_char .and .loop e_signature_char;
2760 e_signature_char
2761 '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2762
2763 e_statement
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';
2768
2769 e_identifier
2770 e_identifier_first .and .loop e_identifier_next;
2771 e_identifier_first
2772 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
2773 e_identifier_next
2774 e_identifier_first .or '0'-'9';
2775
2776 e_token
2777 e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
2778 '-' .or ',' .or ';';
2779 e_token_number
2780 e_token_digit .and .loop e_token_digit;
2781 e_token_digit
2782 '0'-'9';
2783
2784 e_charordigit
2785 'A'-'Z' .or 'a'-'z' .or '0'-'9';
2786