Michal Krol | e05d4fb | 2004-03-03 18:01:58 +0000 | [diff] [blame] | 1 | .syntax program;
|
| 2 |
|
| 3 | /*
|
| 4 | This value must be incremented every time emit code values or structure of the production
|
| 5 | array changes. This value is placed at the beginning of the production array. The loader
|
| 6 | compares the value with its REVISION value. If they do not match, the loader is not up
|
| 7 | to date.
|
| 8 | */
|
| 9 | .emtcode REVISION 0x07
|
| 10 |
|
| 11 | /* program type */
|
| 12 | .emtcode FRAGMENT_PROGRAM 0x01
|
| 13 | .emtcode VERTEX_PROGRAM 0x02
|
| 14 |
|
| 15 | /* program section */
|
| 16 | .emtcode OPTION 0x01
|
| 17 | .emtcode INSTRUCTION 0x02
|
| 18 | .emtcode DECLARATION 0x03
|
| 19 | .emtcode END 0x04
|
| 20 |
|
| 21 | /* GL_ARB_fragment_program option flags */
|
| 22 | .emtcode ARB_PRECISION_HINT_FASTEST 0x01
|
| 23 | .emtcode ARB_PRECISION_HINT_NICEST 0x02
|
| 24 | .emtcode ARB_FOG_EXP 0x04
|
| 25 | .emtcode ARB_FOG_EXP2 0x08
|
| 26 | .emtcode ARB_FOG_LINEAR 0x10
|
| 27 |
|
| 28 | /* GL_ARB_vertex_program option flags */
|
| 29 | .emtcode ARB_POSITION_INVARIANT 0x20
|
| 30 |
|
| 31 | /* GL_ARB_fragment_program_shadow option flags */
|
| 32 | .emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40
|
| 33 |
|
| 34 | /* GL_ARB_fragment_program instruction class */
|
| 35 | .emtcode OP_ALU_INST 0x00
|
| 36 | .emtcode OP_TEX_INST 0x01
|
| 37 |
|
| 38 | /* GL_ARB_vertex_program instruction class */
|
| 39 | /* OP_ALU_INST */
|
| 40 |
|
| 41 | /* GL_ARB_fragment_program instruction type */
|
| 42 | .emtcode OP_ALU_VECTOR 0x00
|
| 43 | .emtcode OP_ALU_SCALAR 0x01
|
| 44 | .emtcode OP_ALU_BINSC 0x02
|
| 45 | .emtcode OP_ALU_BIN 0x03
|
| 46 | .emtcode OP_ALU_TRI 0x04
|
| 47 | .emtcode OP_ALU_SWZ 0x05
|
| 48 | .emtcode OP_TEX_SAMPLE 0x06
|
| 49 | .emtcode OP_TEX_KIL 0x07
|
| 50 |
|
| 51 | /* GL_ARB_vertex_program instruction type */
|
| 52 | .emtcode OP_ALU_ARL 0x08
|
| 53 | /* OP_ALU_VECTOR */
|
| 54 | /* OP_ALU_SCALAR */
|
| 55 | /* OP_ALU_BINSC */
|
| 56 | /* OP_ALU_BIN */
|
| 57 | /* OP_ALU_TRI */
|
| 58 | /* OP_ALU_SWZ */
|
| 59 |
|
| 60 | /* GL_ARB_fragment_program instruction code */
|
| 61 | .emtcode OP_ABS 0x00
|
| 62 | .emtcode OP_ABS_SAT 0x1B
|
| 63 | .emtcode OP_FLR 0x09
|
| 64 | .emtcode OP_FLR_SAT 0x26
|
| 65 | .emtcode OP_FRC 0x0A
|
| 66 | .emtcode OP_FRC_SAT 0x27
|
| 67 | .emtcode OP_LIT 0x0C
|
| 68 | .emtcode OP_LIT_SAT 0x2A
|
| 69 | .emtcode OP_MOV 0x11
|
| 70 | .emtcode OP_MOV_SAT 0x30
|
| 71 | .emtcode OP_COS 0x1F
|
| 72 | .emtcode OP_COS_SAT 0x20
|
| 73 | .emtcode OP_EX2 0x07
|
| 74 | .emtcode OP_EX2_SAT 0x25
|
| 75 | .emtcode OP_LG2 0x0B
|
| 76 | .emtcode OP_LG2_SAT 0x29
|
| 77 | .emtcode OP_RCP 0x14
|
| 78 | .emtcode OP_RCP_SAT 0x33
|
| 79 | .emtcode OP_RSQ 0x15
|
| 80 | .emtcode OP_RSQ_SAT 0x34
|
| 81 | .emtcode OP_SIN 0x38
|
| 82 | .emtcode OP_SIN_SAT 0x39
|
| 83 | .emtcode OP_SCS 0x35
|
| 84 | .emtcode OP_SCS_SAT 0x36
|
| 85 | .emtcode OP_POW 0x13
|
| 86 | .emtcode OP_POW_SAT 0x32
|
| 87 | .emtcode OP_ADD 0x01
|
| 88 | .emtcode OP_ADD_SAT 0x1C
|
| 89 | .emtcode OP_DP3 0x03
|
| 90 | .emtcode OP_DP3_SAT 0x21
|
| 91 | .emtcode OP_DP4 0x04
|
| 92 | .emtcode OP_DP4_SAT 0x22
|
| 93 | .emtcode OP_DPH 0x05
|
| 94 | .emtcode OP_DPH_SAT 0x23
|
| 95 | .emtcode OP_DST 0x06
|
| 96 | .emtcode OP_DST_SAT 0x24
|
| 97 | .emtcode OP_MAX 0x0F
|
| 98 | .emtcode OP_MAX_SAT 0x2E
|
| 99 | .emtcode OP_MIN 0x10
|
| 100 | .emtcode OP_MIN_SAT 0x2F
|
| 101 | .emtcode OP_MUL 0x12
|
| 102 | .emtcode OP_MUL_SAT 0x31
|
| 103 | .emtcode OP_SGE 0x16
|
| 104 | .emtcode OP_SGE_SAT 0x37
|
| 105 | .emtcode OP_SLT 0x17
|
| 106 | .emtcode OP_SLT_SAT 0x3A
|
| 107 | .emtcode OP_SUB 0x18
|
| 108 | .emtcode OP_SUB_SAT 0x3B
|
| 109 | .emtcode OP_XPD 0x1A
|
| 110 | .emtcode OP_XPD_SAT 0x43
|
| 111 | .emtcode OP_CMP 0x1D
|
| 112 | .emtcode OP_CMP_SAT 0x1E
|
| 113 | .emtcode OP_LRP 0x2B
|
| 114 | .emtcode OP_LRP_SAT 0x2C
|
| 115 | .emtcode OP_MAD 0x0E
|
| 116 | .emtcode OP_MAD_SAT 0x2D
|
| 117 | .emtcode OP_SWZ 0x19
|
| 118 | .emtcode OP_SWZ_SAT 0x3C
|
| 119 | .emtcode OP_TEX 0x3D
|
| 120 | .emtcode OP_TEX_SAT 0x3E
|
| 121 | .emtcode OP_TXB 0x3F
|
| 122 | .emtcode OP_TXB_SAT 0x40
|
| 123 | .emtcode OP_TXP 0x41
|
| 124 | .emtcode OP_TXP_SAT 0x42
|
| 125 | .emtcode OP_KIL 0x28
|
| 126 |
|
| 127 | /* GL_ARB_vertex_program instruction code */
|
| 128 | .emtcode OP_ARL 0x02
|
| 129 | /* OP_ABS */
|
| 130 | /* OP_FLR */
|
| 131 | /* OP_FRC */
|
| 132 | /* OP_LIT */
|
| 133 | /* OP_MOV */
|
| 134 | /* OP_EX2 */
|
| 135 | .emtcode OP_EXP 0x08
|
| 136 | /* OP_LG2 */
|
| 137 | .emtcode OP_LOG 0x0D
|
| 138 | /* OP_RCP */
|
| 139 | /* OP_RSQ */
|
| 140 | /* OP_POW */
|
| 141 | /* OP_ADD */
|
| 142 | /* OP_DP3 */
|
| 143 | /* OP_DP4 */
|
| 144 | /* OP_DPH */
|
| 145 | /* OP_DST */
|
| 146 | /* OP_MAX */
|
| 147 | /* OP_MIN */
|
| 148 | /* OP_MUL */
|
| 149 | /* OP_SGE */
|
| 150 | /* OP_SLT */
|
| 151 | /* OP_SUB */
|
| 152 | /* OP_XPD */
|
| 153 | /* OP_MAD */
|
| 154 | /* OP_SWZ */
|
| 155 |
|
| 156 | /* fragment attribute binding */
|
| 157 | .emtcode FRAGMENT_ATTRIB_COLOR 0x01
|
| 158 | .emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
|
| 159 | .emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
|
| 160 | .emtcode FRAGMENT_ATTRIB_POSITION 0x04
|
| 161 |
|
| 162 | /* vertex attribute binding */
|
| 163 | .emtcode VERTEX_ATTRIB_POSITION 0x01
|
| 164 | .emtcode VERTEX_ATTRIB_WEIGHT 0x02
|
| 165 | .emtcode VERTEX_ATTRIB_NORMAL 0x03
|
| 166 | .emtcode VERTEX_ATTRIB_COLOR 0x04
|
| 167 | .emtcode VERTEX_ATTRIB_FOGCOORD 0x05
|
| 168 | .emtcode VERTEX_ATTRIB_TEXCOORD 0x06
|
| 169 | .emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
|
| 170 | .emtcode VERTEX_ATTRIB_GENERIC 0x08
|
| 171 |
|
| 172 | /* fragment result binding */
|
| 173 | .emtcode FRAGMENT_RESULT_COLOR 0x01
|
| 174 | .emtcode FRAGMENT_RESULT_DEPTH 0x02
|
| 175 |
|
| 176 | /* vertex result binding */
|
| 177 | .emtcode VERTEX_RESULT_POSITION 0x01
|
| 178 | .emtcode VERTEX_RESULT_COLOR 0x02
|
| 179 | .emtcode VERTEX_RESULT_FOGCOORD 0x03
|
| 180 | .emtcode VERTEX_RESULT_POINTSIZE 0x04
|
| 181 | .emtcode VERTEX_RESULT_TEXCOORD 0x05
|
| 182 |
|
| 183 | /* texture target */
|
| 184 | .emtcode TEXTARGET_1D 0x01
|
| 185 | .emtcode TEXTARGET_2D 0x02
|
| 186 | .emtcode TEXTARGET_3D 0x03
|
| 187 | .emtcode TEXTARGET_RECT 0x04
|
| 188 | .emtcode TEXTARGET_CUBE 0x05
|
| 189 | /* GL_ARB_fragment_program_shadow */
|
| 190 | .emtcode TEXTARGET_SHADOW1D 0x06
|
| 191 | .emtcode TEXTARGET_SHADOW2D 0x07
|
| 192 | .emtcode TEXTARGET_SHADOWRECT 0x08
|
| 193 |
|
| 194 | /* face type */
|
| 195 | .emtcode FACE_FRONT 0x00
|
| 196 | .emtcode FACE_BACK 0x01
|
| 197 |
|
| 198 | /* color type */
|
| 199 | .emtcode COLOR_PRIMARY 0x00
|
| 200 | .emtcode COLOR_SECONDARY 0x01
|
| 201 |
|
| 202 | /* component */
|
| 203 | .emtcode COMPONENT_X 0x00
|
| 204 | .emtcode COMPONENT_Y 0x01
|
| 205 | .emtcode COMPONENT_Z 0x02
|
| 206 | .emtcode COMPONENT_W 0x03
|
| 207 | .emtcode COMPONENT_0 0x04
|
| 208 | .emtcode COMPONENT_1 0x05
|
| 209 |
|
| 210 | /* array index type */
|
| 211 | .emtcode ARRAY_INDEX_ABSOLUTE 0x00
|
| 212 | .emtcode ARRAY_INDEX_RELATIVE 0x01
|
| 213 |
|
| 214 | /* matrix name */
|
| 215 | .emtcode MATRIX_MODELVIEW 0x01
|
| 216 | .emtcode MATRIX_PROJECTION 0x02
|
| 217 | .emtcode MATRIX_MVP 0x03
|
| 218 | .emtcode MATRIX_TEXTURE 0x04
|
| 219 | .emtcode MATRIX_PALETTE 0x05
|
| 220 | .emtcode MATRIX_PROGRAM 0x06
|
| 221 |
|
| 222 | /* matrix modifier */
|
| 223 | .emtcode MATRIX_MODIFIER_IDENTITY 0x00
|
| 224 | .emtcode MATRIX_MODIFIER_INVERSE 0x01
|
| 225 | .emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
|
| 226 | .emtcode MATRIX_MODIFIER_INVTRANS 0x03
|
| 227 |
|
| 228 | /* constant type */
|
| 229 | .emtcode CONSTANT_SCALAR 0x01
|
| 230 | .emtcode CONSTANT_VECTOR 0x02
|
| 231 |
|
| 232 | /* program param type */
|
| 233 | .emtcode PROGRAM_PARAM_ENV 0x01
|
| 234 | .emtcode PROGRAM_PARAM_LOCAL 0x02
|
| 235 |
|
| 236 | /* register type */
|
| 237 | .emtcode REGISTER_ATTRIB 0x01
|
| 238 | .emtcode REGISTER_PARAM 0x02
|
| 239 | .emtcode REGISTER_RESULT 0x03
|
| 240 | .emtcode REGISTER_ESTABLISHED_NAME 0x04
|
| 241 |
|
| 242 | /* param binding */
|
| 243 | .emtcode PARAM_NULL 0x00
|
| 244 | .emtcode PARAM_ARRAY_ELEMENT 0x01
|
| 245 | .emtcode PARAM_STATE_ELEMENT 0x02
|
| 246 | .emtcode PARAM_PROGRAM_ELEMENT 0x03
|
| 247 | .emtcode PARAM_PROGRAM_ELEMENTS 0x04
|
| 248 | .emtcode PARAM_CONSTANT 0x05
|
| 249 |
|
| 250 | /* param state property */
|
| 251 | .emtcode STATE_MATERIAL 0x01
|
| 252 | .emtcode STATE_LIGHT 0x02
|
| 253 | .emtcode STATE_LIGHT_MODEL 0x03
|
| 254 | .emtcode STATE_LIGHT_PROD 0x04
|
| 255 | .emtcode STATE_FOG 0x05
|
| 256 | .emtcode STATE_MATRIX_ROWS 0x06
|
| 257 | /* GL_ARB_fragment_program */
|
| 258 | .emtcode STATE_TEX_ENV 0x07
|
| 259 | .emtcode STATE_DEPTH 0x08
|
| 260 | /* GL_ARB_vertex_program */
|
| 261 | .emtcode STATE_TEX_GEN 0x09
|
| 262 | .emtcode STATE_CLIP_PLANE 0x0A
|
| 263 | .emtcode STATE_POINT 0x0B
|
| 264 |
|
| 265 | /* state material property */
|
| 266 | .emtcode MATERIAL_AMBIENT 0x01
|
| 267 | .emtcode MATERIAL_DIFFUSE 0x02
|
| 268 | .emtcode MATERIAL_SPECULAR 0x03
|
| 269 | .emtcode MATERIAL_EMISSION 0x04
|
| 270 | .emtcode MATERIAL_SHININESS 0x05
|
| 271 |
|
| 272 | /* state light property */
|
| 273 | .emtcode LIGHT_AMBIENT 0x01
|
| 274 | .emtcode LIGHT_DIFFUSE 0x02
|
| 275 | .emtcode LIGHT_SPECULAR 0x03
|
| 276 | .emtcode LIGHT_POSITION 0x04
|
| 277 | .emtcode LIGHT_ATTENUATION 0x05
|
| 278 | .emtcode LIGHT_HALF 0x06
|
| 279 | .emtcode LIGHT_SPOT_DIRECTION 0x07
|
| 280 |
|
| 281 | /* state light model property */
|
| 282 | .emtcode LIGHT_MODEL_AMBIENT 0x01
|
| 283 | .emtcode LIGHT_MODEL_SCENECOLOR 0x02
|
| 284 |
|
| 285 | /* state light product property */
|
| 286 | .emtcode LIGHT_PROD_AMBIENT 0x01
|
| 287 | .emtcode LIGHT_PROD_DIFFUSE 0x02
|
| 288 | .emtcode LIGHT_PROD_SPECULAR 0x03
|
| 289 |
|
| 290 | /* state texture environment property */
|
| 291 | .emtcode TEX_ENV_COLOR 0x01
|
| 292 |
|
| 293 | /* state texture generation coord property */
|
| 294 | .emtcode TEX_GEN_EYE 0x01
|
| 295 | .emtcode TEX_GEN_OBJECT 0x02
|
| 296 |
|
| 297 | /* state fog property */
|
| 298 | .emtcode FOG_COLOR 0x01
|
| 299 | .emtcode FOG_PARAMS 0x02
|
| 300 |
|
| 301 | /* state depth property */
|
| 302 | .emtcode DEPTH_RANGE 0x01
|
| 303 |
|
| 304 | /* state point parameters property */
|
| 305 | .emtcode POINT_SIZE 0x01
|
| 306 | .emtcode POINT_ATTENUATION 0x02
|
| 307 |
|
| 308 | /* declaration */
|
| 309 | .emtcode ATTRIB 0x01
|
| 310 | .emtcode PARAM 0x02
|
| 311 | .emtcode TEMP 0x03
|
| 312 | .emtcode OUTPUT 0x04
|
| 313 | .emtcode ALIAS 0x05
|
| 314 | /* GL_ARB_vertex_program */
|
| 315 | .emtcode ADDRESS 0x06
|
| 316 |
|
| 317 | /* error messages */
|
| 318 | .errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
|
| 319 | .errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
|
| 320 | .errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
|
| 321 | .errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
|
| 322 | .errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
|
| 323 | .errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
|
| 324 | .errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
|
| 325 | .errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
|
| 326 | .errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
|
| 327 | .errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
|
| 328 | .errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
|
| 329 | .errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
|
| 330 | .errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
|
| 331 | .errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
|
| 332 | .errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
|
| 333 | .errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
|
| 334 | .errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
|
| 335 | .errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
|
| 336 | .errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
|
| 337 | .errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
|
| 338 | .errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
|
| 339 | .errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
|
| 340 | .errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
|
| 341 | .errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
|
| 342 | .errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
|
| 343 | .errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
|
| 344 | .errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
|
| 345 | .errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
|
| 346 | .errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
|
| 347 | .errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
|
| 348 | .errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
|
| 349 | .errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
|
| 350 | .errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
|
| 351 | .errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
|
| 352 | .errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
|
| 353 | .errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
|
| 354 | .errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
|
| 355 | .errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
|
| 356 | .errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
|
| 357 | .errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
|
| 358 | .errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
|
| 359 | .errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
|
| 360 | .errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
|
| 361 | .errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
|
| 362 | .errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
|
| 363 | .errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
|
| 364 | .errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
|
| 365 | .errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
|
| 366 | .errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
|
| 367 | .errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
|
| 368 | .errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
|
| 369 | .errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
|
| 370 | .errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
|
| 371 | .errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
|
| 372 | .errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
|
| 373 | .errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
|
| 374 | .errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
|
| 375 | .errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
|
| 376 |
|
| 377 | /* extension presence condition registers */
|
| 378 |
|
| 379 | /* GL_ARB_vertex_blend */
|
| 380 | /* GL_EXT_vertex_weighting */
|
| 381 | .regbyte vertex_blend 0x00
|
| 382 |
|
| 383 | /* GL_ARB_matrix_palette */
|
| 384 | .regbyte matrix_palette 0x00
|
| 385 |
|
| 386 | /* GL_ARB_point_parameters */
|
| 387 | /* GL_EXT_point_parameters */
|
| 388 | .regbyte point_parameters 0x01
|
| 389 |
|
| 390 | /* GL_EXT_secondary_color */
|
| 391 | .regbyte secondary_color 0x01
|
| 392 |
|
| 393 | /* GL_EXT_fog_coord */
|
| 394 | .regbyte fog_coord 0x01
|
| 395 |
|
| 396 | /* GL_EXT_texture_rectangle */
|
| 397 | /* GL_NV_texture_rectangle */
|
| 398 | .regbyte texture_rectangle 0x01
|
| 399 |
|
| 400 | /* GL_ARB_fragment_program_shadow */
|
| 401 | .regbyte fragment_program_shadow 0x00
|
| 402 |
|
| 403 | /* option presence condition registers */
|
| 404 | /* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
|
| 405 | /* register is set to 1 to indicate that the OPTION was specified. */
|
| 406 |
|
| 407 | /* GL_ARB_fragment_program */
|
| 408 | .regbyte ARB_precision_hint_fastest 0x00
|
| 409 | .regbyte ARB_precision_hint_nicest 0x00
|
| 410 | .regbyte ARB_fog_exp 0x00
|
| 411 | .regbyte ARB_fog_exp2 0x00
|
| 412 | .regbyte ARB_fog_linear 0x00
|
| 413 |
|
| 414 | /* GL_ARB_vertex_program */
|
| 415 | .regbyte ARB_position_invariant 0x00
|
| 416 |
|
| 417 | /* GL_ARB_fragment_program_shadow */
|
| 418 | .regbyte ARB_fragment_program_shadow 0x00
|
| 419 |
|
| 420 | /* program target condition register */
|
| 421 | /* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
|
| 422 | /* to distinguish between them we need a register that will store for us the current target. */
|
| 423 | /* the client will typically set the register to apropriate value before parsing a particular */
|
| 424 | /* program. the mapping between program targets and their values is listed below. */
|
| 425 | /* */
|
| 426 | /* program target register value */
|
| 427 | /* ---------------------------------------------- */
|
| 428 | /* FRAGMENT_PROGRAM 0x10 */
|
| 429 | /* VERTEX_PROGRAM 0x20 */
|
| 430 | /* */
|
| 431 | /* the initial value of the register is 0 to catch potential errors with not setting the register */
|
| 432 | /* with the proper value. */
|
| 433 | .regbyte program_target 0x00
|
| 434 |
|
| 435 | /*
|
| 436 | <program> ::= <optionSequence> <statementSequence> "END"
|
| 437 | */
|
| 438 | program
|
| 439 | programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
|
| 440 | programs
|
| 441 | .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
|
| 442 | .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
|
| 443 | frag_program_1_0
|
| 444 | '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
|
| 445 | optional_space .and fp_optionSequence .and fp_statementSequence .and
|
| 446 | "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
|
| 447 | '\0' .error CODE_AFTER_END;
|
| 448 | vert_program_1_0
|
| 449 | '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
|
| 450 | optional_space .and vp_optionSequence .and vp_statementSequence .and
|
| 451 | "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
|
| 452 | '\0' .error CODE_AFTER_END;
|
| 453 |
|
| 454 | /*
|
| 455 | <optionSequence> ::= <optionSequence> <option>
|
| 456 | | ""
|
| 457 | */
|
| 458 | fp_optionSequence
|
| 459 | .loop fp_option;
|
| 460 | vp_optionSequence
|
| 461 | .loop vp_option;
|
| 462 |
|
| 463 | /*
|
| 464 | <option> ::= "OPTION" <identifier> ";"
|
| 465 |
|
| 466 | NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
|
| 467 | these options is encountered, the other one is automatically disabled.
|
| 468 | the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
|
| 469 | */
|
| 470 | fp_option
|
| 471 | "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
|
| 472 | fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
|
| 473 | vp_option
|
| 474 | "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
|
| 475 | vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
|
| 476 | fp_optionString
|
| 477 | .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
|
| 478 | .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
|
| 479 | .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
|
| 480 | .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
|
| 481 | fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
|
| 482 | fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
|
| 483 | fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
|
| 484 | .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
|
| 485 | .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01;
|
| 486 | vp_optionString
|
| 487 | "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
|
| 488 | fp_ARB_fog_exp
|
| 489 | .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
|
| 490 | fp_ARB_fog_exp2
|
| 491 | .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
|
| 492 | fp_ARB_fog_linear
|
| 493 | .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
|
| 494 |
|
| 495 | /*
|
| 496 | <statementSequence> ::= <statementSequence> <statement>
|
| 497 | | ""
|
| 498 | */
|
| 499 | fp_statementSequence
|
| 500 | .loop fp_statement;
|
| 501 | vp_statementSequence
|
| 502 | .loop vp_statement;
|
| 503 |
|
| 504 | /*
|
| 505 | <statement> ::= <instruction> ";"
|
| 506 | | <namingStatement> ";"
|
| 507 |
|
| 508 | NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
|
| 509 | the first character of instruction) for program debugging purposes.
|
| 510 | */
|
| 511 | fp_statement
|
| 512 | fp_statement_1 .or fp_statement_2;
|
| 513 | vp_statement
|
| 514 | vp_statement_1 .or vp_statement_2;
|
| 515 | fp_statement_1
|
| 516 | fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
|
| 517 | fp_statement_2
|
| 518 | fp_namingStatement .emit DECLARATION .and semicolon;
|
| 519 | vp_statement_1
|
| 520 | vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
|
| 521 | vp_statement_2
|
| 522 | vp_namingStatement .emit DECLARATION .and semicolon;
|
| 523 |
|
| 524 | /*
|
| 525 | fragment program
|
| 526 | <instruction> ::= <ALUInstruction>
|
| 527 | | <TexInstruction>
|
| 528 |
|
| 529 | vertex program
|
| 530 | <instruction> ::= <ARL_instruction>
|
| 531 | | <VECTORop_instruction>
|
| 532 | | <SCALARop_instruction>
|
| 533 | | <BINSCop_instruction>
|
| 534 | | <BINop_instruction>
|
| 535 | | <TRIop_instruction>
|
| 536 | | <SWZ_instruction>
|
| 537 | */
|
| 538 | fp_instruction
|
| 539 | ALUInstruction .emit OP_ALU_INST .or
|
| 540 | TexInstruction .emit OP_TEX_INST;
|
| 541 | vp_instruction
|
| 542 | ARL_instruction .emit OP_ALU_ARL .or
|
| 543 | vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
|
| 544 | vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
|
| 545 | vp_BINSCop_instruction .emit OP_ALU_BINSC .or
|
| 546 | vp_BINop_instruction .emit OP_ALU_BIN .or
|
| 547 | vp_TRIop_instruction .emit OP_ALU_TRI .or
|
| 548 | vp_SWZ_instruction .emit OP_ALU_SWZ;
|
| 549 |
|
| 550 | /*
|
| 551 | fragment program
|
| 552 | <ALUInstruction> ::= <VECTORop_instruction>
|
| 553 | | <SCALARop_instruction>
|
| 554 | | <BINSCop_instruction>
|
| 555 | | <BINop_instruction>
|
| 556 | | <TRIop_instruction>
|
| 557 | | <SWZ_instruction>
|
| 558 | */
|
| 559 | ALUInstruction
|
| 560 | fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
|
| 561 | fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
|
| 562 | fp_BINSCop_instruction .emit OP_ALU_BINSC .or
|
| 563 | fp_BINop_instruction .emit OP_ALU_BIN .or
|
| 564 | fp_TRIop_instruction .emit OP_ALU_TRI .or
|
| 565 | fp_SWZ_instruction .emit OP_ALU_SWZ;
|
| 566 |
|
| 567 | /*
|
| 568 | fragment program
|
| 569 | <TexInstruction> ::= <SAMPLE_instruction>
|
| 570 | | <KIL_instruction>
|
| 571 | */
|
| 572 | TexInstruction
|
| 573 | SAMPLE_instruction .emit OP_TEX_SAMPLE .or
|
| 574 | KIL_instruction .emit OP_TEX_KIL;
|
| 575 |
|
| 576 | /*
|
| 577 | vertex program
|
| 578 | <ARL_instruction> ::= "ARL" <maskedAddrReg> "," <scalarSrcReg>
|
| 579 | */
|
| 580 | ARL_instruction
|
| 581 | "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
|
| 582 |
|
| 583 | /*
|
| 584 | fragment program
|
| 585 | <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> ","
|
| 586 | <vectorSrcReg>
|
| 587 |
|
| 588 | vertex program
|
| 589 | <VECTORop_instruction> ::= <VECTORop> <maskedDstReg> "," <swizzleSrcReg>
|
| 590 | */
|
| 591 | fp_VECTORop_instruction
|
| 592 | fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
|
| 593 | vp_VECTORop_instruction
|
| 594 | vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
|
| 595 |
|
| 596 | /*
|
| 597 | fragment program
|
| 598 | <VECTORop> ::= "ABS" | "ABS_SAT"
|
| 599 | | "FLR" | "FLR_SAT"
|
| 600 | | "FRC" | "FRC_SAT"
|
| 601 | | "LIT" | "LIT_SAT"
|
| 602 | | "MOV" | "MOV_SAT"
|
| 603 |
|
| 604 | vertex program
|
| 605 | <VECTORop> ::= "ABS"
|
| 606 | | "FLR"
|
| 607 | | "FRC"
|
| 608 | | "LIT"
|
| 609 | | "MOV"
|
| 610 | */
|
| 611 | fp_VECTORop
|
| 612 | "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
|
| 613 | "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
|
| 614 | "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
|
| 615 | "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
|
| 616 | "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
|
| 617 | vp_VECTORop
|
| 618 | "ABS" .emit OP_ABS .or
|
| 619 | "FLR" .emit OP_FLR .or
|
| 620 | "FRC" .emit OP_FRC .or
|
| 621 | "LIT" .emit OP_LIT .or
|
| 622 | "MOV" .emit OP_MOV;
|
| 623 |
|
| 624 | /*
|
| 625 | <SCALARop_instruction> ::= <SCALARop> <maskedDstReg> "," <scalarSrcReg>
|
| 626 | */
|
| 627 | fp_SCALARop_instruction
|
| 628 | fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
|
| 629 | vp_SCALARop_instruction
|
| 630 | vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
|
| 631 |
|
| 632 | /*
|
| 633 | fragment program
|
| 634 | <SCALARop> ::= "COS" | "COS_SAT"
|
| 635 | | "EX2" | "EX2_SAT"
|
| 636 | | "LG2" | "LG2_SAT"
|
| 637 | | "RCP" | "RCP_SAT"
|
| 638 | | "RSQ" | "RSQ_SAT"
|
| 639 | | "SIN" | "SIN_SAT"
|
| 640 | | "SCS" | "SCS_SAT"
|
| 641 |
|
| 642 | vertex program
|
| 643 | <SCALARop> ::= "EX2"
|
| 644 | | "EXP"
|
| 645 | | "LG2"
|
| 646 | | "LOG"
|
| 647 | | "RCP"
|
| 648 | | "RSQ"
|
| 649 | */
|
| 650 | fp_SCALARop
|
| 651 | "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
|
| 652 | "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
|
| 653 | "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
|
| 654 | "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
|
| 655 | "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
|
| 656 | "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
|
| 657 | "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
|
| 658 | vp_SCALARop
|
| 659 | "EX2" .emit OP_EX2 .or
|
| 660 | "EXP" .emit OP_EXP .or
|
| 661 | "LG2" .emit OP_LG2 .or
|
| 662 | "LOG" .emit OP_LOG .or
|
| 663 | "RCP" .emit OP_RCP .or
|
| 664 | "RSQ" .emit OP_RSQ;
|
| 665 |
|
| 666 | /*
|
| 667 | <BINSCop_instruction> ::= <BINSCop> <maskedDstReg> "," <scalarSrcReg> ","
|
| 668 | <scalarSrcReg>
|
| 669 | */
|
| 670 | fp_BINSCop_instruction
|
| 671 | fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
|
| 672 | fp_scalarSrcReg;
|
| 673 | vp_BINSCop_instruction
|
| 674 | vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
|
| 675 | vp_scalarSrcReg;
|
| 676 |
|
| 677 | /*
|
| 678 | fragment program
|
| 679 | <BINSCop> ::= "POW" | "POW_SAT"
|
| 680 |
|
| 681 | vertex program
|
| 682 | <BINSCop> ::= "POW"
|
| 683 | */
|
| 684 | fp_BINSCop
|
| 685 | "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
|
| 686 | vp_BINSCop
|
| 687 | "POW" .emit OP_POW;
|
| 688 |
|
| 689 | /*
|
| 690 | fragment program
|
| 691 | <BINop_instruction> ::= <BINop> <maskedDstReg> ","
|
| 692 | <vectorSrcReg> "," <vectorSrcReg>
|
| 693 |
|
| 694 | vertex program
|
| 695 | <BINop_instruction> ::= <BINop> <maskedDstReg> ","
|
| 696 | <swizzleSrcReg> "," <swizzleSrcReg>
|
| 697 | */
|
| 698 | fp_BINop_instruction
|
| 699 | fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
|
| 700 | vectorSrcReg;
|
| 701 | vp_BINop_instruction
|
| 702 | vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
|
| 703 | swizzleSrcReg;
|
| 704 |
|
| 705 | /*
|
| 706 | fragment program
|
| 707 | <BINop> ::= "ADD" | "ADD_SAT"
|
| 708 | | "DP3" | "DP3_SAT"
|
| 709 | | "DP4" | "DP4_SAT"
|
| 710 | | "DPH" | "DPH_SAT"
|
| 711 | | "DST" | "DST_SAT"
|
| 712 | | "MAX" | "MAX_SAT"
|
| 713 | | "MIN" | "MIN_SAT"
|
| 714 | | "MUL" | "MUL_SAT"
|
| 715 | | "SGE" | "SGE_SAT"
|
| 716 | | "SLT" | "SLT_SAT"
|
| 717 | | "SUB" | "SUB_SAT"
|
| 718 | | "XPD" | "XPD_SAT"
|
| 719 |
|
| 720 | vertex program
|
| 721 | <BINop> ::= "ADD"
|
| 722 | | "DP3"
|
| 723 | | "DP4"
|
| 724 | | "DPH"
|
| 725 | | "DST"
|
| 726 | | "MAX"
|
| 727 | | "MIN"
|
| 728 | | "MUL"
|
| 729 | | "SGE"
|
| 730 | | "SLT"
|
| 731 | | "SUB"
|
| 732 | | "XPD"
|
| 733 | */
|
| 734 | fp_BINop
|
| 735 | "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
|
| 736 | "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
|
| 737 | "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
|
| 738 | "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
|
| 739 | "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
|
| 740 | "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
|
| 741 | "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
|
| 742 | "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
|
| 743 | "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
|
| 744 | "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
|
| 745 | "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
|
| 746 | "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
|
| 747 | vp_BINop
|
| 748 | "ADD" .emit OP_ADD .or
|
| 749 | "DP3" .emit OP_DP3 .or
|
| 750 | "DP4" .emit OP_DP4 .or
|
| 751 | "DPH" .emit OP_DPH .or
|
| 752 | "DST" .emit OP_DST .or
|
| 753 | "MAX" .emit OP_MAX .or
|
| 754 | "MIN" .emit OP_MIN .or
|
| 755 | "MUL" .emit OP_MUL .or
|
| 756 | "SGE" .emit OP_SGE .or
|
| 757 | "SLT" .emit OP_SLT .or
|
| 758 | "SUB" .emit OP_SUB .or
|
| 759 | "XPD" .emit OP_XPD;
|
| 760 |
|
| 761 | /*
|
| 762 | fragment program
|
| 763 | <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
|
| 764 | <vectorSrcReg> "," <vectorSrcReg> ","
|
| 765 | <vectorSrcReg>
|
| 766 |
|
| 767 | vertex program
|
| 768 | <TRIop_instruction> ::= <TRIop> <maskedDstReg> ","
|
| 769 | <swizzleSrcReg> "," <swizzleSrcReg> ","
|
| 770 | <swizzleSrcReg>
|
| 771 | */
|
| 772 | fp_TRIop_instruction
|
| 773 | fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
|
| 774 | vectorSrcReg .and comma .and vectorSrcReg;
|
| 775 | vp_TRIop_instruction
|
| 776 | vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
|
| 777 | swizzleSrcReg .and comma .and swizzleSrcReg;
|
| 778 |
|
| 779 | /*
|
| 780 | fragment program
|
| 781 | <TRIop> ::= "CMP" | "CMP_SAT"
|
| 782 | | "LRP" | "LRP_SAT"
|
| 783 | | "MAD" | "MAD_SAT"
|
| 784 |
|
| 785 | vertex program
|
| 786 | <TRIop> ::= "MAD"
|
| 787 | */
|
| 788 | fp_TRIop
|
| 789 | "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
|
| 790 | "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
|
| 791 | "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
|
| 792 | vp_TRIop
|
| 793 | "MAD" .emit OP_MAD;
|
| 794 |
|
| 795 | /*
|
| 796 | fragment program
|
| 797 | <SWZ_instruction> ::= <SWZop> <maskedDstReg> ","
|
| 798 | <srcReg> "," <extendedSwizzle>
|
| 799 |
|
| 800 | vertex program
|
| 801 | <SWZ_instruction> ::= "SWZ" <maskedDstReg> "," <srcReg> ","
|
| 802 | <extendedSwizzle>
|
| 803 | */
|
| 804 | fp_SWZ_instruction
|
| 805 | SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
|
| 806 | fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
|
| 807 | vp_SWZ_instruction
|
| 808 | "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
|
| 809 | vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
|
| 810 |
|
| 811 | /*
|
| 812 | fragment program
|
| 813 | <SWZop> ::= "SWZ" | "SWZ_SAT"
|
| 814 | */
|
| 815 | SWZop
|
| 816 | "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
|
| 817 |
|
| 818 | /*
|
| 819 | fragment program
|
| 820 | <SAMPLE_instruction> ::= <SAMPLEop> <maskedDstReg> ","
|
| 821 | <vectorSrcReg> "," <texImageUnit> ","
|
| 822 | <texTarget>
|
| 823 | */
|
| 824 | SAMPLE_instruction
|
| 825 | SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
|
| 826 | texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
|
| 827 |
|
| 828 | /*
|
| 829 | fragment program
|
| 830 | <SAMPLEop> ::= "TEX" | "TEX_SAT"
|
| 831 | | "TXP" | "TXP_SAT"
|
| 832 | | "TXB" | "TXB_SAT"
|
| 833 | */
|
| 834 | SAMPLEop
|
| 835 | "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
|
| 836 | "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
|
| 837 | "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
|
| 838 |
|
| 839 | /*
|
| 840 | fragment program
|
| 841 | <KIL_instruction> ::= "KIL" <vectorSrcReg>
|
| 842 | */
|
| 843 | KIL_instruction
|
| 844 | "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
|
| 845 |
|
| 846 | /*
|
| 847 | fragment program
|
| 848 | <texImageUnit> ::= "texture" <optTexImageUnitNum>
|
| 849 | */
|
| 850 | texImageUnit
|
| 851 | "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
|
| 852 |
|
| 853 | /*
|
| 854 | fragment program
|
| 855 | <texTarget> ::= "1D"
|
| 856 | | "2D"
|
| 857 | | "3D"
|
| 858 | | "CUBE"
|
| 859 | | "RECT"
|
| 860 | | <shadowTarget> (if option ARB_fragment_program_shadow present)
|
| 861 | */
|
| 862 | texTarget
|
| 863 | "1D" .emit TEXTARGET_1D .or
|
| 864 | "2D" .emit TEXTARGET_2D .or
|
| 865 | "3D" .emit TEXTARGET_3D .or
|
| 866 | .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
|
| 867 | "CUBE" .emit TEXTARGET_CUBE .or
|
| 868 | .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
|
| 869 |
|
| 870 | /*
|
| 871 | GL_ARB_fragment_program_shadow
|
| 872 | <shadowTarget> ::= "SHADOW1D"
|
| 873 | | "SHADOW2D"
|
| 874 | | "SHADOWRECT"
|
| 875 | */
|
| 876 | shadowTarget
|
| 877 | "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
|
| 878 | "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
|
| 879 | .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
|
| 880 |
|
| 881 | /*
|
| 882 | fragment program
|
| 883 | <optTexImageUnitNum> ::= ""
|
| 884 | | "[" <texImageUnitNum> "]"
|
| 885 | */
|
| 886 | optTexImageUnitNum
|
| 887 | optTexImageUnitNum_1 .or .true .emit 0x00;
|
| 888 | optTexImageUnitNum_1
|
| 889 | lbracket_ne .and texImageUnitNum .and rbracket;
|
| 890 |
|
| 891 | /*
|
| 892 | fragment program
|
| 893 | <texImageUnitNum> ::= <integer> from 0 to
|
| 894 | MAX_TEXTURE_IMAGE_UNITS_ARB-1
|
| 895 | */
|
| 896 | texImageUnitNum
|
| 897 | integer;
|
| 898 |
|
| 899 | /*
|
| 900 | <scalarSrcReg> ::= <optionalSign> <srcReg> <scalarSuffix>
|
| 901 | */
|
| 902 | fp_scalarSrcReg
|
| 903 | optionalSign .and fp_srcReg .and fp_scalarSuffix;
|
| 904 | vp_scalarSrcReg
|
| 905 | optionalSign .and vp_srcReg .and vp_scalarSuffix;
|
| 906 |
|
| 907 | /*
|
| 908 | vertex program
|
| 909 | <swizzleSrcReg> ::= <optionalSign> <srcReg> <swizzleSuffix>
|
| 910 | */
|
| 911 | swizzleSrcReg
|
| 912 | optionalSign .and vp_srcReg .and swizzleSuffix;
|
| 913 |
|
| 914 | /*
|
| 915 | fragment program
|
| 916 | <vectorSrcReg> ::= <optionalSign> <srcReg> <optionalSuffix>
|
| 917 | */
|
| 918 | vectorSrcReg
|
| 919 | optionalSign .and fp_srcReg .and optionalSuffix;
|
| 920 |
|
| 921 | /*
|
| 922 | <maskedDstReg> ::= <dstReg> <optionalMask>
|
| 923 | */
|
| 924 | fp_maskedDstReg
|
| 925 | fp_dstReg .and fp_optionalMask;
|
| 926 | vp_maskedDstReg
|
| 927 | vp_dstReg .and vp_optionalMask;
|
| 928 |
|
| 929 | /*
|
| 930 | vertex program
|
| 931 | <maskedAddrReg> ::= <addrReg> <addrWriteMask>
|
| 932 | */
|
| 933 | maskedAddrReg
|
| 934 | addrReg .error ADDRESS_REGISTER_EXPECTED .and addrWriteMask;
|
| 935 |
|
| 936 | /*
|
| 937 | fragment program
|
| 938 | <extendedSwizzle> ::= <xyzwExtendedSwizzle>
|
| 939 | | <rgbaExtendedSwizzle>
|
| 940 |
|
| 941 | vertex program
|
| 942 | <extendedSwizzle> ::= <extSwizComp> "," <extSwizComp> ","
|
| 943 | <extSwizComp> "," <extSwizComp>
|
| 944 |
|
| 945 | NOTE: do NOT change the order of <rgbaExtendedSwizzle> and <xyzwExtendedSwizzle> rulez
|
| 946 | */
|
| 947 | fp_extendedSwizzle
|
| 948 | rgbaExtendedSwizzle .or xyzwExtendedSwizzle;
|
| 949 | vp_extendedSwizzle
|
| 950 | extSwizComp .and comma .and
|
| 951 | extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 952 | extSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 953 | extSwizComp .error EXT_SWIZ_COMP_EXPECTED;
|
| 954 |
|
| 955 | /*
|
| 956 | fragment program
|
| 957 | <xyzwExtendedSwizzle> ::= <xyzwExtSwizComp> "," <xyzwExtSwizComp> ","
|
| 958 | <xyzwExtSwizComp> "," <xyzwExtSwizComp>
|
| 959 | */
|
| 960 | xyzwExtendedSwizzle
|
| 961 | xyzwExtSwizComp .and comma .and
|
| 962 | xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 963 | xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 964 | xyzwExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
|
| 965 |
|
| 966 | /*
|
| 967 | fragment program
|
| 968 | <rgbaExtendedSwizzle> ::= <rgbaExtSwizComp> "," <rgbaExtSwizComp> ","
|
| 969 | <rgbaExtSwizComp> "," <rgbaExtSwizComp>
|
| 970 | */
|
| 971 | rgbaExtendedSwizzle
|
| 972 | rgbaExtendedSwizzle_1 .or rgbaExtendedSwizzle_2 .or rgbaExtendedSwizzle_3 .or
|
| 973 | rgbaExtendedSwizzle_4;
|
| 974 | rgbaExtendedSwizzle_1
|
| 975 | rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
|
| 976 | rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp;
|
| 977 | rgbaExtendedSwizzle_2
|
| 978 | rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_digit .and comma .and
|
| 979 | rgbaExtSwizComp_alpha .and comma .and rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
|
| 980 | rgbaExtendedSwizzle_3
|
| 981 | rgbaExtSwizComp_digit .and comma .and rgbaExtSwizComp_alpha .and comma .and
|
| 982 | rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 983 | rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
|
| 984 | rgbaExtendedSwizzle_4
|
| 985 | rgbaExtSwizComp_alpha .and comma .and
|
| 986 | rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 987 | rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED .and comma .and
|
| 988 | rgbaExtSwizComp .error EXT_SWIZ_COMP_EXPECTED;
|
| 989 |
|
| 990 | /*
|
| 991 | fragment program
|
| 992 | <xyzwExtSwizComp> ::= <optionalSign> <xyzwExtSwizSel>
|
| 993 | */
|
| 994 | xyzwExtSwizComp
|
| 995 | optionalSign .and xyzwExtSwizSel;
|
| 996 |
|
| 997 | /*
|
| 998 | fragment program
|
| 999 | <rgbaExtSwizComp> ::= <optionalSign> <rgbaExtSwizSel>
|
| 1000 | */
|
| 1001 | rgbaExtSwizComp
|
| 1002 | optionalSign .and rgbaExtSwizSel;
|
| 1003 | rgbaExtSwizComp_digit
|
| 1004 | optionalSign .and rgbaExtSwizSel_digit;
|
| 1005 | rgbaExtSwizComp_alpha
|
| 1006 | optionalSign .and rgbaExtSwizSel_alpha;
|
| 1007 |
|
| 1008 | /*
|
| 1009 | vertex program
|
| 1010 | <extSwizComp> ::= <optionalSign> <extSwizSel>
|
| 1011 | */
|
| 1012 | extSwizComp
|
| 1013 | optionalSign .and extSwizSel;
|
| 1014 |
|
| 1015 | /*
|
| 1016 | fragment program
|
| 1017 | <xyzwExtSwizSel> ::= "0"
|
| 1018 | | "1"
|
| 1019 | | <xyzwComponent>
|
| 1020 | */
|
| 1021 | xyzwExtSwizSel
|
| 1022 | "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or xyzwComponent_single;
|
| 1023 |
|
| 1024 | /*
|
| 1025 | fragment program
|
| 1026 | <rgbaExtSwizSel> ::= "0"
|
| 1027 | | "1"
|
| 1028 | | <rgbaComponent>
|
| 1029 | */
|
| 1030 | rgbaExtSwizSel
|
| 1031 | rgbaExtSwizSel_digit .or rgbaExtSwizSel_alpha;
|
| 1032 | rgbaExtSwizSel_digit
|
| 1033 | "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1;
|
| 1034 | rgbaExtSwizSel_alpha
|
| 1035 | rgbaComponent_single;
|
| 1036 |
|
| 1037 | /*
|
| 1038 | vertex program
|
| 1039 | <extSwizSel> ::= "0"
|
| 1040 | | "1"
|
| 1041 | | <component>
|
| 1042 | */
|
| 1043 | extSwizSel
|
| 1044 | "0" .emit COMPONENT_0 .or "1" .emit COMPONENT_1 .or vp_component_single;
|
| 1045 |
|
| 1046 | /*
|
| 1047 | fragment program
|
| 1048 | <srcReg> ::= <fragmentAttribReg>
|
| 1049 | | <temporaryReg>
|
| 1050 | | <progParamReg>
|
| 1051 |
|
| 1052 | vertex program
|
| 1053 | <srcReg> ::= <vertexAttribReg>
|
| 1054 | | <temporaryReg>
|
| 1055 | | <progParamReg>
|
| 1056 | */
|
| 1057 | fp_srcReg
|
| 1058 | fp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
|
| 1059 | vp_srcReg
|
| 1060 | vp_srcReg_1 .error SOURCE_REGISTER_EXPECTED;
|
| 1061 | fp_srcReg_1
|
| 1062 | fragmentAttribReg .emit REGISTER_ATTRIB .or
|
| 1063 | fp_progParamReg .emit REGISTER_PARAM .or
|
| 1064 | fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
|
| 1065 | vp_srcReg_1
|
| 1066 | vertexAttribReg .emit REGISTER_ATTRIB .or
|
| 1067 | vp_progParamReg .emit REGISTER_PARAM .or
|
| 1068 | vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
|
| 1069 |
|
| 1070 | /*
|
| 1071 | fragment program
|
| 1072 | <dstReg> ::= <temporaryReg>
|
| 1073 | | <fragmentResultReg>
|
| 1074 |
|
| 1075 | vertex program
|
| 1076 | <dstReg> ::= <temporaryReg>
|
| 1077 | | <vertexResultReg>
|
| 1078 | */
|
| 1079 | fp_dstReg
|
| 1080 | fp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
|
| 1081 | vp_dstReg
|
| 1082 | vp_dstReg_1 .error DESTINATION_REGISTER_EXPECTED;
|
| 1083 | fp_dstReg_1
|
| 1084 | fragmentResultReg .emit REGISTER_RESULT .or
|
| 1085 | fp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
|
| 1086 | vp_dstReg_1
|
| 1087 | vertexResultReg .emit REGISTER_RESULT .or
|
| 1088 | vp_temporaryReg .emit REGISTER_ESTABLISHED_NAME;
|
| 1089 |
|
| 1090 | /*
|
| 1091 | fragment program
|
| 1092 | <fragmentAttribReg> ::= <establishedName>
|
| 1093 | | <fragAttribBinding>
|
| 1094 |
|
| 1095 | NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
|
| 1096 | */
|
| 1097 | fragmentAttribReg
|
| 1098 | /*fp_establishedName .or */fragAttribBinding;
|
| 1099 |
|
| 1100 | /*
|
| 1101 | vertex program
|
| 1102 | <vertexAttribReg> ::= <establishedName>
|
| 1103 | | <vtxAttribBinding>
|
| 1104 |
|
| 1105 | NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
|
| 1106 | */
|
| 1107 | vertexAttribReg
|
| 1108 | vtxAttribBinding;
|
| 1109 |
|
| 1110 | /*
|
| 1111 | <temporaryReg> ::= <establishedName>
|
| 1112 | */
|
| 1113 | fp_temporaryReg
|
| 1114 | fp_establishedName_no_error_on_identifier;
|
| 1115 | vp_temporaryReg
|
| 1116 | vp_establishedName_no_error_on_identifier;
|
| 1117 |
|
| 1118 | /*
|
| 1119 | fragment program
|
| 1120 | <progParamReg> ::= <progParamSingle>
|
| 1121 | | <progParamArray> "[" <progParamArrayAbs> "]"
|
| 1122 | | <paramSingleItemUse>
|
| 1123 |
|
| 1124 | vertex program
|
| 1125 | <progParamReg> ::= <progParamSingle>
|
| 1126 | | <progParamArray> "[" <progParamArrayMem> "]"
|
| 1127 | | <paramSingleItemUse>
|
| 1128 | */
|
| 1129 | fp_progParamReg
|
| 1130 | fp_paramSingleItemUse .or fp_progParamReg_1 .or fp_progParamSingle;
|
| 1131 | vp_progParamReg
|
| 1132 | vp_paramSingleItemUse .or vp_progParamReg_1 .or vp_progParamSingle;
|
| 1133 | fp_progParamReg_1
|
| 1134 | fp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayAbs .and
|
| 1135 | rbracket;
|
| 1136 | vp_progParamReg_1
|
| 1137 | vp_progParamArray .emit PARAM_ARRAY_ELEMENT .and lbracket_ne .and progParamArrayMem .and
|
| 1138 | rbracket;
|
| 1139 |
|
| 1140 | /*
|
| 1141 | <progParamSingle> ::= <establishedName>
|
| 1142 |
|
| 1143 | NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <srcReg>
|
| 1144 | */
|
| 1145 | fp_progParamSingle
|
| 1146 | .false;
|
| 1147 | vp_progParamSingle
|
| 1148 | .false;
|
| 1149 |
|
| 1150 | /*
|
| 1151 | <progParamArray> ::= <establishedName>
|
| 1152 | */
|
| 1153 | fp_progParamArray
|
| 1154 | fp_establishedName_no_error_on_identifier;
|
| 1155 | vp_progParamArray
|
| 1156 | vp_establishedName_no_error_on_identifier;
|
| 1157 |
|
| 1158 | /*
|
| 1159 | vertex program
|
| 1160 | <progParamArrayMem> ::= <progParamArrayAbs>
|
| 1161 | | <progParamArrayRel>
|
| 1162 | */
|
| 1163 | progParamArrayMem
|
| 1164 | progParamArrayAbs .or progParamArrayRel;
|
| 1165 |
|
| 1166 | /*
|
| 1167 | <progParamArrayAbs> ::= <integer>
|
| 1168 | */
|
| 1169 | progParamArrayAbs
|
| 1170 | integer_ne .emit ARRAY_INDEX_ABSOLUTE;
|
| 1171 |
|
| 1172 | /*
|
| 1173 | vertex program
|
| 1174 | <progParamArrayRel> ::= <addrReg> <addrComponent> <addrRegRelOffset>
|
| 1175 | */
|
| 1176 | progParamArrayRel
|
| 1177 | addrReg .error ADDRESS_REGISTER_OR_INTEGER_EXPECTED .emit ARRAY_INDEX_RELATIVE .and
|
| 1178 | addrComponent .and addrRegRelOffset;
|
| 1179 |
|
| 1180 | /*
|
| 1181 | vertex program
|
| 1182 | <addrRegRelOffset> ::= ""
|
| 1183 | | "+" <addrRegPosOffset>
|
| 1184 | | "-" <addrRegNegOffset>
|
| 1185 | */
|
| 1186 | addrRegRelOffset
|
| 1187 | addrRegRelOffset_1 .or addrRegRelOffset_2 .or .true .emit 0x00;
|
| 1188 | addrRegRelOffset_1
|
| 1189 | plus_ne .and addrRegPosOffset;
|
| 1190 | addrRegRelOffset_2
|
| 1191 | minus_ne .and addrRegNegOffset;
|
| 1192 |
|
| 1193 | /*
|
| 1194 | vertex program
|
| 1195 | <addrRegPosOffset> ::= <integer> from 0 to 63
|
| 1196 | */
|
| 1197 | addrRegPosOffset
|
| 1198 | integer_0_63;
|
| 1199 |
|
| 1200 | /*
|
| 1201 | vertex program
|
| 1202 | <addrRegNegOffset> ::= <integer> from 0 to 64
|
| 1203 | */
|
| 1204 | addrRegNegOffset
|
| 1205 | integer_0_64;
|
| 1206 |
|
| 1207 | /*
|
| 1208 | fragment program
|
| 1209 | <fragmentResultReg> ::= <establishedName>
|
| 1210 | | <resultBinding>
|
| 1211 |
|
| 1212 | NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
|
| 1213 | */
|
| 1214 | fragmentResultReg
|
| 1215 | fp_resultBinding;
|
| 1216 |
|
| 1217 | /*
|
| 1218 | vertex program
|
| 1219 | <vertexResultReg> ::= <establishedName>
|
| 1220 | | <resultBinding>
|
| 1221 |
|
| 1222 | NOTE: <establishedName> is driven by <temporaryReg> rule at the end of <dstReg>
|
| 1223 | */
|
| 1224 | vertexResultReg
|
| 1225 | vp_resultBinding;
|
| 1226 |
|
| 1227 | /*
|
| 1228 | vertex program
|
| 1229 | <addrReg> ::= <establishedName>
|
| 1230 | */
|
| 1231 | addrReg
|
| 1232 | vp_establishedName_no_error_on_identifier;
|
| 1233 |
|
| 1234 | /*
|
| 1235 | vertex program
|
| 1236 | <addrComponent> ::= "." "x"
|
| 1237 | */
|
| 1238 | addrComponent
|
| 1239 | dot .and "x" .error INVALID_ADDRESS_COMPONENT .emit COMPONENT_X .emit COMPONENT_X
|
| 1240 | .emit COMPONENT_X .emit COMPONENT_X;
|
| 1241 |
|
| 1242 | /*
|
| 1243 | vertex program
|
| 1244 | <addrWriteMask> ::= "." "x"
|
| 1245 | */
|
| 1246 | addrWriteMask
|
| 1247 | dot .and "x" .error INVALID_ADDRESS_WRITEMASK .emit 0x08;
|
| 1248 |
|
| 1249 | /*
|
| 1250 | <scalarSuffix> ::= "." <component>
|
| 1251 | */
|
| 1252 | fp_scalarSuffix
|
| 1253 | dot .and fp_component_single .error INVALID_COMPONENT;
|
| 1254 | vp_scalarSuffix
|
| 1255 | dot .and vp_component_single .error INVALID_COMPONENT;
|
| 1256 |
|
| 1257 | /*
|
| 1258 | vertex program
|
| 1259 | <swizzleSuffix> ::= ""
|
| 1260 | | "." <component>
|
| 1261 | | "." <component> <component>
|
| 1262 | <component> <component>
|
| 1263 | */
|
| 1264 | swizzleSuffix
|
| 1265 | swizzleSuffix_1 .or
|
| 1266 | .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
|
| 1267 | swizzleSuffix_1
|
| 1268 | dot_ne .and swizzleSuffix_2 .error INVALID_SUFFIX;
|
| 1269 | swizzleSuffix_2
|
| 1270 | swizzleSuffix_3 .or swizzleSuffix_4;
|
| 1271 | swizzleSuffix_3
|
| 1272 | vp_component_multi .and vp_component_multi .and vp_component_multi .error INVALID_COMPONENT .and
|
| 1273 | vp_component_multi .error INVALID_COMPONENT;
|
| 1274 | swizzleSuffix_4
|
| 1275 | "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
|
| 1276 | "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
|
| 1277 | "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
|
| 1278 | "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
|
| 1279 |
|
| 1280 | /*
|
| 1281 | fragment program
|
| 1282 | <optionalSuffix> ::= ""
|
| 1283 | | "." <component>
|
| 1284 | | "." <xyzwComponent> <xyzwComponent>
|
| 1285 | <xyzwComponent> <xyzwComponent>
|
| 1286 | | "." <rgbaComponent> <rgbaComponent>
|
| 1287 | <rgbaComponent> <rgbaComponent>
|
| 1288 | */
|
| 1289 | optionalSuffix
|
| 1290 | optionalSuffix_1 .or
|
| 1291 | .true .emit COMPONENT_X .emit COMPONENT_Y .emit COMPONENT_Z .emit COMPONENT_W;
|
| 1292 | optionalSuffix_1
|
| 1293 | dot_ne .and optionalSuffix_2 .error INVALID_SUFFIX;
|
| 1294 | optionalSuffix_2
|
| 1295 | optionalSuffix_3 .or optionalSuffix_4 .or optionalSuffix_5;
|
| 1296 | optionalSuffix_3
|
| 1297 | xyzwComponent_multi .and xyzwComponent_multi .and
|
| 1298 | xyzwComponent_multi .error INVALID_COMPONENT .and xyzwComponent_multi .error INVALID_COMPONENT;
|
| 1299 | optionalSuffix_4
|
| 1300 | rgbaComponent_multi .and rgbaComponent_multi .and
|
| 1301 | rgbaComponent_multi .error INVALID_COMPONENT .and rgbaComponent_multi .error INVALID_COMPONENT;
|
| 1302 | optionalSuffix_5
|
| 1303 | "x" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
|
| 1304 | "y" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
|
| 1305 | "z" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
|
| 1306 | "w" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .or
|
| 1307 | "r" .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .emit COMPONENT_X .or
|
| 1308 | "g" .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .emit COMPONENT_Y .or
|
| 1309 | "b" .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .emit COMPONENT_Z .or
|
| 1310 | "a" .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W .emit COMPONENT_W;
|
| 1311 |
|
| 1312 | /*
|
| 1313 | fragment program
|
| 1314 | <component> ::= <xyzwComponent>
|
| 1315 | | <rgbaComponent>
|
| 1316 |
|
| 1317 | vertex program
|
| 1318 | <component> ::= "x"
|
| 1319 | | "y"
|
| 1320 | | "z"
|
| 1321 | | "w"
|
| 1322 | */
|
| 1323 | fp_component_single
|
| 1324 | xyzwComponent_single .or rgbaComponent_single;
|
| 1325 | vp_component_multi
|
| 1326 | 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
|
| 1327 | 'w' .emit COMPONENT_W;
|
| 1328 | vp_component_single
|
| 1329 | "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
|
| 1330 | "w" .emit COMPONENT_W;
|
| 1331 |
|
| 1332 | /*
|
| 1333 | fragment program
|
| 1334 | <xyzwComponent> ::= "x" | "y" | "z" | "w"
|
| 1335 | */
|
| 1336 | xyzwComponent_multi
|
| 1337 | 'x' .emit COMPONENT_X .or 'y' .emit COMPONENT_Y .or 'z' .emit COMPONENT_Z .or
|
| 1338 | 'w' .emit COMPONENT_W;
|
| 1339 | xyzwComponent_single
|
| 1340 | "x" .emit COMPONENT_X .or "y" .emit COMPONENT_Y .or "z" .emit COMPONENT_Z .or
|
| 1341 | "w" .emit COMPONENT_W;
|
| 1342 |
|
| 1343 | /*
|
| 1344 | fragment program
|
| 1345 | <rgbaComponent> ::= "r" | "g" | "b" | "a"
|
| 1346 | */
|
| 1347 | rgbaComponent_multi
|
| 1348 | 'r' .emit COMPONENT_X .or 'g' .emit COMPONENT_Y .or 'b' .emit COMPONENT_Z .or
|
| 1349 | 'a' .emit COMPONENT_W;
|
| 1350 | rgbaComponent_single
|
| 1351 | "r" .emit COMPONENT_X .or "g" .emit COMPONENT_Y .or "b" .emit COMPONENT_Z .or
|
| 1352 | "a" .emit COMPONENT_W;
|
| 1353 |
|
| 1354 | /*
|
| 1355 | fragment program
|
| 1356 | <optionalMask> ::= ""
|
| 1357 | | <xyzwMask>
|
| 1358 | | <rgbaMask>
|
| 1359 |
|
| 1360 | vertex program
|
| 1361 | <optionalMask> ::= ""
|
| 1362 | | "." "x"
|
| 1363 | | "." "y"
|
| 1364 | | "." "xy"
|
| 1365 | | "." "z"
|
| 1366 | | "." "xz"
|
| 1367 | | "." "yz"
|
| 1368 | | "." "xyz"
|
| 1369 | | "." "w"
|
| 1370 | | "." "xw"
|
| 1371 | | "." "yw"
|
| 1372 | | "." "xyw"
|
| 1373 | | "." "zw"
|
| 1374 | | "." "xzw"
|
| 1375 | | "." "yzw"
|
| 1376 | | "." "xyzw"
|
| 1377 |
|
| 1378 | NOTE: do NOT change the order of <rgbaMask> and <xyzwMask> rulez
|
| 1379 | */
|
| 1380 | fp_optionalMask
|
| 1381 | rgbaMask .or xyzwMask .or .true .emit 0x0F;
|
| 1382 | vp_optionalMask
|
| 1383 | xyzwMask .or .true .emit 0x0F;
|
| 1384 |
|
| 1385 | /*
|
| 1386 | fragment program
|
| 1387 | <xyzwMask> ::= "." "x"
|
| 1388 | | "." "y"
|
| 1389 | | "." "xy"
|
| 1390 | | "." "z"
|
| 1391 | | "." "xz"
|
| 1392 | | "." "yz"
|
| 1393 | | "." "xyz"
|
| 1394 | | "." "w"
|
| 1395 | | "." "xw"
|
| 1396 | | "." "yw"
|
| 1397 | | "." "xyw"
|
| 1398 | | "." "zw"
|
| 1399 | | "." "xzw"
|
| 1400 | | "." "yzw"
|
| 1401 | | "." "xyzw"
|
| 1402 |
|
| 1403 | NOTE: <xyzwMask> is also referenced by the vertex program symbol <optionalMask>.
|
| 1404 | */
|
| 1405 | xyzwMask
|
| 1406 | dot_ne .and xyzwMask_1 .error INVALID_WRITEMASK;
|
| 1407 | xyzwMask_1
|
| 1408 | "xyzw" .emit 0x0F .or "xyz" .emit 0x0E .or "xyw" .emit 0x0D .or "xy" .emit 0x0C .or
|
| 1409 | "xzw" .emit 0x0B .or "xz" .emit 0x0A .or "xw" .emit 0x09 .or "x" .emit 0x08 .or
|
| 1410 | "yzw" .emit 0x07 .or "yz" .emit 0x06 .or "yw" .emit 0x05 .or "y" .emit 0x04 .or
|
| 1411 | "zw" .emit 0x03 .or "z" .emit 0x02 .or "w" .emit 0x01;
|
| 1412 |
|
| 1413 | /*
|
| 1414 | fragment program
|
| 1415 | <rgbaMask> ::= "." "r"
|
| 1416 | | "." "g"
|
| 1417 | | "." "rg"
|
| 1418 | | "." "b"
|
| 1419 | | "." "rb"
|
| 1420 | | "." "gb"
|
| 1421 | | "." "rgb"
|
| 1422 | | "." "a"
|
| 1423 | | "." "ra"
|
| 1424 | | "." "ga"
|
| 1425 | | "." "rga"
|
| 1426 | | "." "ba"
|
| 1427 | | "." "rba"
|
| 1428 | | "." "gba"
|
| 1429 | | "." "rgba"
|
| 1430 | */
|
| 1431 | rgbaMask
|
| 1432 | dot_ne .and rgbaMask_1;
|
| 1433 | rgbaMask_1
|
| 1434 | "rgba" .emit 0x0F .or "rgb" .emit 0x0E .or "rga" .emit 0x0D .or "rg" .emit 0x0C .or
|
| 1435 | "rba" .emit 0x0B .or "rb" .emit 0x0A .or "ra" .emit 0x09 .or "r" .emit 0x08 .or
|
| 1436 | "gba" .emit 0x07 .or "gb" .emit 0x06 .or "ga" .emit 0x05 .or "g" .emit 0x04 .or
|
| 1437 | "ba" .emit 0x03 .or "b" .emit 0x02 .or "a" .emit 0x01;
|
| 1438 |
|
| 1439 | /*
|
| 1440 | fragment program
|
| 1441 | <namingStatement> ::= <ATTRIB_statement>
|
| 1442 | | <PARAM_statement>
|
| 1443 | | <TEMP_statement>
|
| 1444 | | <OUTPUT_statement>
|
| 1445 | | <ALIAS_statement>
|
| 1446 |
|
| 1447 | vertex program
|
| 1448 | <namingStatement> ::= <ATTRIB_statement>
|
| 1449 | | <PARAM_statement>
|
| 1450 | | <TEMP_statement>
|
| 1451 | | <ADDRESS_statement>
|
| 1452 | | <OUTPUT_statement>
|
| 1453 | | <ALIAS_statement>
|
| 1454 | */
|
| 1455 | fp_namingStatement
|
| 1456 | fp_ATTRIB_statement .emit ATTRIB .or
|
| 1457 | fp_PARAM_statement .emit PARAM .or
|
| 1458 | fp_TEMP_statement .emit TEMP .or
|
| 1459 | fp_OUTPUT_statement .emit OUTPUT .or
|
| 1460 | fp_ALIAS_statement .emit ALIAS;
|
| 1461 | vp_namingStatement
|
| 1462 | vp_ATTRIB_statement .emit ATTRIB .or
|
| 1463 | vp_PARAM_statement .emit PARAM .or
|
| 1464 | vp_TEMP_statement .emit TEMP .or
|
| 1465 | ADDRESS_statement .emit ADDRESS .or
|
| 1466 | vp_OUTPUT_statement .emit OUTPUT .or
|
| 1467 | vp_ALIAS_statement .emit ALIAS;
|
| 1468 |
|
| 1469 | /*
|
| 1470 | fragment program
|
| 1471 | <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
|
| 1472 | <fragAttribBinding>
|
| 1473 |
|
| 1474 | vertex program
|
| 1475 | <ATTRIB_statement> ::= "ATTRIB" <establishName> "="
|
| 1476 | <vtxAttribBinding>
|
| 1477 | */
|
| 1478 | fp_ATTRIB_statement
|
| 1479 | "ATTRIB" .and space .and fp_establishName .and equal .and
|
| 1480 | fragAttribBinding .error FRAGMENT_EXPECTED;
|
| 1481 | vp_ATTRIB_statement
|
| 1482 | "ATTRIB" .and space .and vp_establishName .and equal .and
|
| 1483 | vtxAttribBinding .error VERTEX_EXPECTED;
|
| 1484 |
|
| 1485 | /*
|
| 1486 | fragment program
|
| 1487 | <fragAttribBinding> ::= "fragment" "." <fragAttribItem>
|
| 1488 | */
|
| 1489 | fragAttribBinding
|
| 1490 | "fragment" .and dot .and fragAttribItem .error INVALID_FRAGMENT_PROPERTY;
|
| 1491 |
|
| 1492 | /*
|
| 1493 | vertex program
|
| 1494 | <vtxAttribBinding> ::= "vertex" "." <vtxAttribItem>
|
| 1495 | */
|
| 1496 | vtxAttribBinding
|
| 1497 | "vertex" .and dot .and vtxAttribItem .error INVALID_VERTEX_PROPERTY;
|
| 1498 |
|
| 1499 | /*
|
| 1500 | fragment program
|
| 1501 | <fragAttribItem> ::= "color" <optColorType>
|
| 1502 | | "texcoord" <optTexCoordNum>
|
| 1503 | | "fogcoord"
|
| 1504 | | "position"
|
| 1505 | */
|
| 1506 | fragAttribItem
|
| 1507 | fragAttribItem_1 .emit FRAGMENT_ATTRIB_COLOR .or
|
| 1508 | fragAttribItem_2 .emit FRAGMENT_ATTRIB_TEXCOORD .or
|
| 1509 | .if (fog_coord != 0x00) "fogcoord" .emit FRAGMENT_ATTRIB_FOGCOORD .or
|
| 1510 | "position" .emit FRAGMENT_ATTRIB_POSITION;
|
| 1511 | fragAttribItem_1
|
| 1512 | "color" .and optColorType;
|
| 1513 | fragAttribItem_2
|
| 1514 | "texcoord" .and optTexCoordNum;
|
| 1515 |
|
| 1516 | /*
|
| 1517 | vertex program
|
| 1518 | <vtxAttribItem> ::= "position"
|
| 1519 | | "weight" <vtxOptWeightNum>
|
| 1520 | | "normal"
|
| 1521 | | "color" <optColorType>
|
| 1522 | | "fogcoord"
|
| 1523 | | "texcoord" <optTexCoordNum>
|
| 1524 | | "matrixindex" "[" <vtxWeightNum> "]"
|
| 1525 | | "attrib" "[" <vtxAttribNum> "]"
|
| 1526 | */
|
| 1527 | vtxAttribItem
|
| 1528 | "position" .emit VERTEX_ATTRIB_POSITION .or
|
| 1529 | .if (vertex_blend != 0x00) vtxAttribItem_1 .emit VERTEX_ATTRIB_WEIGHT .or
|
| 1530 | "normal" .emit VERTEX_ATTRIB_NORMAL .or
|
| 1531 | vtxAttribItem_2 .emit VERTEX_ATTRIB_COLOR .or
|
| 1532 | "fogcoord" .emit VERTEX_ATTRIB_FOGCOORD .or
|
| 1533 | vtxAttribItem_3 .emit VERTEX_ATTRIB_TEXCOORD .or
|
| 1534 | .if (matrix_palette != 0x00) vtxAttribItem_4 .emit VERTEX_ATTRIB_MATRIXINDEX .or
|
| 1535 | vtxAttribItem_5 .emit VERTEX_ATTRIB_GENERIC;
|
| 1536 | vtxAttribItem_1
|
| 1537 | "weight" .and vtxOptWeightNum;
|
| 1538 | vtxAttribItem_2
|
| 1539 | "color" .and optColorType;
|
| 1540 | vtxAttribItem_3
|
| 1541 | "texcoord" .and optTexCoordNum;
|
| 1542 | vtxAttribItem_4
|
| 1543 | "matrixindex" .and lbracket .and vtxWeightNum .and rbracket;
|
| 1544 | vtxAttribItem_5
|
| 1545 | "attrib" .and lbracket .and vtxAttribNum .and rbracket;
|
| 1546 |
|
| 1547 | /*
|
| 1548 | vertex program
|
| 1549 | <vtxAttribNum> ::= <integer> from 0 to MAX_VERTEX_ATTRIBS_ARB-1
|
| 1550 | */
|
| 1551 | vtxAttribNum
|
| 1552 | integer;
|
| 1553 |
|
| 1554 | /*
|
| 1555 | vertex program
|
| 1556 | <vtxOptWeightNum> ::= ""
|
| 1557 | | "[" <vtxWeightNum> "]"
|
| 1558 | */
|
| 1559 | vtxOptWeightNum
|
| 1560 | vtxOptWeightNum_1 .or .true .emit 0x00;
|
| 1561 | vtxOptWeightNum_1
|
| 1562 | lbracket_ne .and vtxWeightNum .and rbracket;
|
| 1563 |
|
| 1564 | /*
|
| 1565 | vertex program
|
| 1566 | <vtxWeightNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1,
|
| 1567 | must be divisible by four
|
| 1568 | */
|
| 1569 | vtxWeightNum
|
| 1570 | integer;
|
| 1571 |
|
| 1572 | /*
|
| 1573 | <PARAM_statement> ::= <PARAM_singleStmt>
|
| 1574 | | <PARAM_multipleStmt>
|
| 1575 | */
|
| 1576 | fp_PARAM_statement
|
| 1577 | fp_PARAM_multipleStmt .or fp_PARAM_singleStmt;
|
| 1578 | vp_PARAM_statement
|
| 1579 | vp_PARAM_multipleStmt .or vp_PARAM_singleStmt;
|
| 1580 |
|
| 1581 | /*
|
| 1582 | <PARAM_singleStmt> ::= "PARAM" <establishName> <paramSingleInit>
|
| 1583 | */
|
| 1584 | fp_PARAM_singleStmt
|
| 1585 | "PARAM" .and space .and fp_establishName .and .true .emit 0x00 .and fp_paramSingleInit .and
|
| 1586 | .true .emit PARAM_NULL;
|
| 1587 | vp_PARAM_singleStmt
|
| 1588 | "PARAM" .and space .and vp_establishName .and .true .emit 0x00 .and vp_paramSingleInit .and
|
| 1589 | .true .emit PARAM_NULL;
|
| 1590 |
|
| 1591 | /*
|
| 1592 | <PARAM_multipleStmt> ::= "PARAM" <establishName> "[" <optArraySize> "]"
|
| 1593 | <paramMultipleInit>
|
| 1594 | */
|
| 1595 | fp_PARAM_multipleStmt
|
| 1596 | "PARAM" .and space .and fp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
|
| 1597 | fp_paramMultipleInit .and .true .emit PARAM_NULL;
|
| 1598 | vp_PARAM_multipleStmt
|
| 1599 | "PARAM" .and space .and vp_establishName .and lbracket_ne .and optArraySize .and rbracket .and
|
| 1600 | vp_paramMultipleInit .and .true .emit PARAM_NULL;
|
| 1601 |
|
| 1602 | /*
|
| 1603 | <optArraySize> ::= ""
|
| 1604 | | <integer> from 1 to MAX_PROGRAM_PARAMETERS_ARB
|
| 1605 | (maximum number of allowed program
|
| 1606 | parameter bindings)
|
| 1607 | */
|
| 1608 | optArraySize
|
| 1609 | optional_integer;
|
| 1610 |
|
| 1611 | /*
|
| 1612 | <paramSingleInit> ::= "=" <paramSingleItemDecl>
|
| 1613 | */
|
| 1614 | fp_paramSingleInit
|
| 1615 | equal .and fp_paramSingleItemDecl;
|
| 1616 | vp_paramSingleInit
|
| 1617 | equal .and vp_paramSingleItemDecl;
|
| 1618 |
|
| 1619 | /*
|
| 1620 | <paramMultipleInit> ::= "=" "{" <paramMultInitList> "}"
|
| 1621 | */
|
| 1622 | fp_paramMultipleInit
|
| 1623 | equal .and lbrace .and fp_paramMultInitList .and rbrace;
|
| 1624 | vp_paramMultipleInit
|
| 1625 | equal .and lbrace .and vp_paramMultInitList .and rbrace;
|
| 1626 |
|
| 1627 | /*
|
| 1628 | <paramMultInitList> ::= <paramMultipleItem>
|
| 1629 | | <paramMultipleItem> "," <paramMultiInitList>
|
| 1630 | */
|
| 1631 | fp_paramMultInitList
|
| 1632 | fp_paramMultInitList_1 .or fp_paramMultipleItem;
|
| 1633 | vp_paramMultInitList
|
| 1634 | vp_paramMultInitList_1 .or vp_paramMultipleItem;
|
| 1635 | fp_paramMultInitList_1
|
| 1636 | fp_paramMultipleItem .and comma_ne .and fp_paramMultInitList;
|
| 1637 | vp_paramMultInitList_1
|
| 1638 | vp_paramMultipleItem .and comma_ne .and vp_paramMultInitList;
|
| 1639 |
|
| 1640 | /*
|
| 1641 | <paramSingleItemDecl> ::= <stateSingleItem>
|
| 1642 | | <programSingleItem>
|
| 1643 | | <paramConstDecl>
|
| 1644 | */
|
| 1645 | fp_paramSingleItemDecl
|
| 1646 | fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
|
| 1647 | programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1648 | paramConstDecl .emit PARAM_CONSTANT;
|
| 1649 | vp_paramSingleItemDecl
|
| 1650 | vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
|
| 1651 | programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1652 | paramConstDecl .emit PARAM_CONSTANT;
|
| 1653 |
|
| 1654 | /*
|
| 1655 | <paramSingleItemUse> ::= <stateSingleItem>
|
| 1656 | | <programSingleItem>
|
| 1657 | | <paramConstUse>
|
| 1658 | */
|
| 1659 | fp_paramSingleItemUse
|
| 1660 | fp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
|
| 1661 | programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1662 | paramConstUse .emit PARAM_CONSTANT;
|
| 1663 | vp_paramSingleItemUse
|
| 1664 | vp_stateSingleItem .emit PARAM_STATE_ELEMENT .or
|
| 1665 | programSingleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1666 | paramConstUse .emit PARAM_CONSTANT;
|
| 1667 |
|
| 1668 | /*
|
| 1669 | <paramMultipleItem> ::= <stateMultipleItem>
|
| 1670 | | <programMultipleItem>
|
| 1671 | | <paramConstDecl>
|
| 1672 | */
|
| 1673 | fp_paramMultipleItem
|
| 1674 | fp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
|
| 1675 | programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1676 | paramConstDecl .emit PARAM_CONSTANT;
|
| 1677 | vp_paramMultipleItem
|
| 1678 | vp_stateMultipleItem .emit PARAM_STATE_ELEMENT .or
|
| 1679 | programMultipleItem .emit PARAM_PROGRAM_ELEMENT .or
|
| 1680 | paramConstDecl .emit PARAM_CONSTANT;
|
| 1681 |
|
| 1682 | /*
|
| 1683 | <stateMultipleItem> ::= <stateSingleItem>
|
| 1684 | | "state" "." <stateMatrixRows>
|
| 1685 | */
|
| 1686 | fp_stateMultipleItem
|
| 1687 | stateMultipleItem_1 .or fp_stateSingleItem;
|
| 1688 | vp_stateMultipleItem
|
| 1689 | stateMultipleItem_1 .or vp_stateSingleItem;
|
| 1690 | stateMultipleItem_1
|
| 1691 | "state" .and dot .and stateMatrixRows .emit STATE_MATRIX_ROWS;
|
| 1692 |
|
| 1693 | /*
|
| 1694 | fragment program
|
| 1695 | <stateSingleItem> ::= "state" "." <stateMaterialItem>
|
| 1696 | | "state" "." <stateLightItem>
|
| 1697 | | "state" "." <stateLightModelItem>
|
| 1698 | | "state" "." <stateLightProdItem>
|
| 1699 | | "state" "." <stateTexEnvItem>
|
| 1700 | | "state" "." <stateFogItem>
|
| 1701 | | "state" "." <stateDepthItem>
|
| 1702 | | "state" "." <stateMatrixRow>
|
| 1703 |
|
| 1704 | vertex program
|
| 1705 | <stateSingleItem> ::= "state" "." <stateMaterialItem>
|
| 1706 | | "state" "." <stateLightItem>
|
| 1707 | | "state" "." <stateLightModelItem>
|
| 1708 | | "state" "." <stateLightProdItem>
|
| 1709 | | "state" "." <stateTexGenItem>
|
| 1710 | | "state" "." <stateFogItem>
|
| 1711 | | "state" "." <stateClipPlaneItem>
|
| 1712 | | "state" "." <statePointItem>
|
| 1713 | | "state" "." <stateMatrixRow>
|
| 1714 | */
|
| 1715 | fp_stateSingleItem
|
| 1716 | "state" .and dot .and fp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
|
| 1717 | vp_stateSingleItem
|
| 1718 | "state" .and dot .and vp_stateSingleItem_1 .error INVALID_STATE_PROPERTY;
|
| 1719 | fp_stateSingleItem_1
|
| 1720 | stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
|
| 1721 | stateSingleItem_5 .or stateSingleItem_7 .or stateSingleItem_8 .or stateSingleItem_11;
|
| 1722 | vp_stateSingleItem_1
|
| 1723 | stateSingleItem_1 .or stateSingleItem_2 .or stateSingleItem_3 .or stateSingleItem_4 .or
|
| 1724 | stateSingleItem_6 .or stateSingleItem_7 .or stateSingleItem_9 .or stateSingleItem_10 .or
|
| 1725 | stateSingleItem_11;
|
| 1726 | stateSingleItem_1
|
| 1727 | stateMaterialItem .emit STATE_MATERIAL;
|
| 1728 | stateSingleItem_2
|
| 1729 | stateLightItem .emit STATE_LIGHT;
|
| 1730 | stateSingleItem_3
|
| 1731 | stateLightModelItem .emit STATE_LIGHT_MODEL;
|
| 1732 | stateSingleItem_4
|
| 1733 | stateLightProdItem .emit STATE_LIGHT_PROD;
|
| 1734 | stateSingleItem_5
|
| 1735 | stateTexEnvItem .emit STATE_TEX_ENV;
|
| 1736 | stateSingleItem_6
|
| 1737 | stateTexGenItem .emit STATE_TEX_GEN;
|
| 1738 | stateSingleItem_7
|
| 1739 | stateFogItem .emit STATE_FOG;
|
| 1740 | stateSingleItem_8
|
| 1741 | stateDepthItem .emit STATE_DEPTH;
|
| 1742 | stateSingleItem_9
|
| 1743 | stateClipPlaneItem .emit STATE_CLIP_PLANE;
|
| 1744 | stateSingleItem_10
|
| 1745 | statePointItem .emit STATE_POINT;
|
| 1746 | stateSingleItem_11
|
| 1747 | stateMatrixRow .emit STATE_MATRIX_ROWS;
|
| 1748 |
|
| 1749 | /*
|
| 1750 | <stateMaterialItem> ::= "material" <optFaceType> "." <stateMatProperty>
|
| 1751 | */
|
| 1752 | stateMaterialItem
|
| 1753 | "material" .and optFaceType .and dot .and stateMatProperty .error INVALID_MATERIAL_PROPERTY;
|
| 1754 |
|
| 1755 | /*
|
| 1756 | <stateMatProperty> ::= "ambient"
|
| 1757 | | "diffuse"
|
| 1758 | | "specular"
|
| 1759 | | "emission"
|
| 1760 | | "shininess"
|
| 1761 | */
|
| 1762 | stateMatProperty
|
| 1763 | "ambient" .emit MATERIAL_AMBIENT .or
|
| 1764 | "diffuse" .emit MATERIAL_DIFFUSE .or
|
| 1765 | "specular" .emit MATERIAL_SPECULAR .or
|
| 1766 | "emission" .emit MATERIAL_EMISSION .or
|
| 1767 | "shininess" .emit MATERIAL_SHININESS;
|
| 1768 |
|
| 1769 | /*
|
| 1770 | <stateLightItem> ::= "light" "[" <stateLightNumber> "]" "."
|
| 1771 | <stateLightProperty>
|
| 1772 | */
|
| 1773 | stateLightItem
|
| 1774 | "light" .and lbracket .and stateLightNumber .and rbracket .and dot .and
|
| 1775 | stateLightProperty .error INVALID_LIGHT_PROPERTY;
|
| 1776 |
|
| 1777 | /*
|
| 1778 | <stateLightProperty> ::= "ambient"
|
| 1779 | | "diffuse"
|
| 1780 | | "specular"
|
| 1781 | | "position"
|
| 1782 | | "attenuation"
|
| 1783 | | "spot" "." <stateSpotProperty>
|
| 1784 | | "half"
|
| 1785 | */
|
| 1786 | stateLightProperty
|
| 1787 | "ambient" .emit LIGHT_AMBIENT .or
|
| 1788 | "diffuse" .emit LIGHT_DIFFUSE .or
|
| 1789 | "specular" .emit LIGHT_SPECULAR .or
|
| 1790 | "position" .emit LIGHT_POSITION .or
|
| 1791 | "attenuation" .emit LIGHT_ATTENUATION .or
|
| 1792 | stateLightProperty_1 .emit LIGHT_SPOT_DIRECTION .or
|
| 1793 | "half" .emit LIGHT_HALF;
|
| 1794 | stateLightProperty_1
|
| 1795 | "spot" .and dot .and stateSpotProperty .error INVALID_SPOT_PROPERTY;
|
| 1796 |
|
| 1797 | /*
|
| 1798 | <stateSpotProperty> ::= "direction"
|
| 1799 | */
|
| 1800 | stateSpotProperty
|
| 1801 | "direction";
|
| 1802 |
|
| 1803 | /*
|
| 1804 | <stateLightModelItem> ::= "lightmodel" <stateLModProperty>
|
| 1805 | */
|
| 1806 | stateLightModelItem
|
| 1807 | "lightmodel" .and stateLModProperty .error INVALID_LIGHTMODEL_PROPERTY;
|
| 1808 |
|
| 1809 | /*
|
| 1810 | <stateLModProperty> ::= "." "ambient"
|
| 1811 | | <optFaceType> "." "scenecolor"
|
| 1812 | */
|
| 1813 | stateLModProperty
|
| 1814 | stateLModProperty_1 .or stateLModProperty_2;
|
| 1815 | stateLModProperty_1
|
| 1816 | dot .and "ambient" .emit LIGHT_MODEL_AMBIENT;
|
| 1817 | stateLModProperty_2
|
| 1818 | stateLModProperty_3 .emit LIGHT_MODEL_SCENECOLOR;
|
| 1819 | stateLModProperty_3
|
| 1820 | optFaceType .and dot .and "scenecolor";
|
| 1821 |
|
| 1822 | /*
|
| 1823 | <stateLightProdItem> ::= "lightprod" "[" <stateLightNumber> "]"
|
| 1824 | <optFaceType> "." <stateLProdProperty>
|
| 1825 | */
|
| 1826 | stateLightProdItem
|
| 1827 | "lightprod" .and lbracket .and stateLightNumber .and rbracket .and optFaceType .and dot .and
|
| 1828 | stateLProdProperty .error INVALID_LIGHTPROD_PROPERTY;
|
| 1829 |
|
| 1830 | /*
|
| 1831 | <stateLProdProperty> ::= "ambient"
|
| 1832 | | "diffuse"
|
| 1833 | | "specular"
|
| 1834 | */
|
| 1835 | stateLProdProperty
|
| 1836 | "ambient" .emit LIGHT_PROD_AMBIENT .or
|
| 1837 | "diffuse" .emit LIGHT_PROD_DIFFUSE .or
|
| 1838 | "specular" .emit LIGHT_PROD_SPECULAR;
|
| 1839 |
|
| 1840 | /*
|
| 1841 | <stateLightNumber> ::= <integer> from 0 to MAX_LIGHTS-1
|
| 1842 | */
|
| 1843 | stateLightNumber
|
| 1844 | integer;
|
| 1845 |
|
| 1846 | /*
|
| 1847 | fragment program
|
| 1848 | <stateTexEnvItem> ::= "texenv" <optLegacyTexUnitNum> "."
|
| 1849 | <stateTexEnvProperty>
|
| 1850 | */
|
| 1851 | stateTexEnvItem
|
| 1852 | "texenv" .and optLegacyTexUnitNum .and dot .and
|
| 1853 | stateTexEnvProperty .error INVALID_TEXENV_PROPERTY;
|
| 1854 |
|
| 1855 | /*
|
| 1856 | fragment program
|
| 1857 | <stateTexEnvProperty> ::= "color"
|
| 1858 | */
|
| 1859 | stateTexEnvProperty
|
| 1860 | "color" .emit TEX_ENV_COLOR;
|
| 1861 |
|
| 1862 | /*
|
| 1863 | fragment program
|
| 1864 | <optLegacyTexUnitNum> ::= ""
|
| 1865 | | "[" <legacyTexUnitNum> "]"
|
| 1866 |
|
| 1867 | NOTE: <optLegaceTexUnitNum> is not optional.
|
| 1868 | */
|
| 1869 | optLegacyTexUnitNum
|
| 1870 | lbracket_ne .and legacyTexUnitNum .and rbracket;
|
| 1871 |
|
| 1872 | /*
|
| 1873 | fragment program
|
| 1874 | <legacyTexUnitNum> ::= <integer> from 0 to MAX_TEXTURE_UNITS-1
|
| 1875 | */
|
| 1876 | legacyTexUnitNum
|
| 1877 | integer;
|
| 1878 |
|
| 1879 | /*
|
| 1880 | vertex program
|
| 1881 | <stateTexGenItem> ::= "texgen" <optTexCoordNum> "."
|
| 1882 | <stateTexGenType> "." <stateTexGenCoord>
|
| 1883 | */
|
| 1884 | stateTexGenItem
|
| 1885 | "texgen" .and optTexCoordNum .and dot .and stateTexGenType .error INVALID_TEXGEN_PROPERTY .and
|
| 1886 | dot .and stateTexGenCoord .error INVALID_TEXGEN_COORD;
|
| 1887 |
|
| 1888 | /*
|
| 1889 | vertex program
|
| 1890 | <stateTexGenType> ::= "eye"
|
| 1891 | | "object"
|
| 1892 | */
|
| 1893 | stateTexGenType
|
| 1894 | "eye" .emit TEX_GEN_EYE .or
|
| 1895 | "object" .emit TEX_GEN_OBJECT;
|
| 1896 |
|
| 1897 | /*
|
| 1898 | vertex program
|
| 1899 | <stateTexGenCoord> ::= "s"
|
| 1900 | | "t"
|
| 1901 | | "r"
|
| 1902 | | "q"
|
| 1903 | */
|
| 1904 | stateTexGenCoord
|
| 1905 | "s" .emit COMPONENT_X .or
|
| 1906 | "t" .emit COMPONENT_Y .or
|
| 1907 | "r" .emit COMPONENT_Z .or
|
| 1908 | "q" .emit COMPONENT_W;
|
| 1909 |
|
| 1910 | /*
|
| 1911 | <stateFogItem> ::= "fog" "." <stateFogProperty>
|
| 1912 | */
|
| 1913 | stateFogItem
|
| 1914 | "fog" .and dot .and stateFogProperty .error INVALID_FOG_PROPERTY;
|
| 1915 |
|
| 1916 | /*
|
| 1917 | <stateFogProperty> ::= "color"
|
| 1918 | | "params"
|
| 1919 | */
|
| 1920 | stateFogProperty
|
| 1921 | "color" .emit FOG_COLOR .or
|
| 1922 | "params" .emit FOG_PARAMS;
|
| 1923 |
|
| 1924 | /*
|
| 1925 | fragment program
|
| 1926 | <stateDepthItem> ::= "depth" "." <stateDepthProperty>
|
| 1927 | */
|
| 1928 | stateDepthItem
|
| 1929 | "depth" .and dot .and stateDepthProperty .error INVALID_DEPTH_PROPERTY;
|
| 1930 |
|
| 1931 | /*
|
| 1932 | fragment program
|
| 1933 | <stateDepthProperty> ::= "range"
|
| 1934 | */
|
| 1935 | stateDepthProperty
|
| 1936 | "range" .emit DEPTH_RANGE;
|
| 1937 |
|
| 1938 | /*
|
| 1939 | vertex program
|
| 1940 | <stateClipPlaneItem> ::= "clip" "[" <stateClipPlaneNum> "]" "." "plane"
|
| 1941 | */
|
| 1942 | stateClipPlaneItem
|
| 1943 | "clip" .and lbracket .and stateClipPlaneNum .and rbracket .and dot .and
|
| 1944 | "plane" .error INVALID_CLIPPLANE_PROPERTY;
|
| 1945 |
|
| 1946 | /*
|
| 1947 | vertex program
|
| 1948 | <stateClipPlaneNum> ::= <integer> from 0 to MAX_CLIP_PLANES-1
|
| 1949 | */
|
| 1950 | stateClipPlaneNum
|
| 1951 | integer;
|
| 1952 |
|
| 1953 | /*
|
| 1954 | vertex program
|
| 1955 | <statePointItem> ::= "point" . <statePointProperty>
|
| 1956 | */
|
| 1957 | statePointItem
|
| 1958 | "point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
|
| 1959 |
|
| 1960 | /*
|
| 1961 | vertex program
|
| 1962 | <statePointProperty> ::= "size"
|
| 1963 | | "attenuation"
|
| 1964 | */
|
| 1965 | statePointProperty
|
| 1966 | "size" .emit POINT_SIZE .or
|
| 1967 | .if (point_parameters != 0x00) "attenuation" .emit POINT_ATTENUATION;
|
| 1968 |
|
| 1969 | /*
|
| 1970 | <stateMatrixRow> ::= <stateMatrixItem> "." "row" "["
|
| 1971 | <stateMatrixRowNum> "]"
|
| 1972 | */
|
| 1973 | stateMatrixRow
|
| 1974 | stateMatrixItem .and dot .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and
|
| 1975 | lbracket .and stateMatrixRowNum .and rbracket .emit 0x0;
|
| 1976 |
|
| 1977 | /*
|
| 1978 | <stateMatrixRows> ::= <stateMatrixItem> <optMatrixRows>
|
| 1979 | */
|
| 1980 | stateMatrixRows
|
| 1981 | stateMatrixItem .and optMatrixRows;
|
| 1982 |
|
| 1983 | /*
|
| 1984 | <optMatrixRows> ::= ""
|
| 1985 | | "." "row" "[" <stateMatrixRowNum> ".."
|
| 1986 | <stateMatrixRowNum> "]"
|
| 1987 | */
|
| 1988 | optMatrixRows
|
| 1989 | optMatrixRows_1 .or .true .emit 0x0 .emit '3' .emit 0x0 .emit $;
|
| 1990 | optMatrixRows_1
|
| 1991 | dot_ne .and "row" .error MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED .and lbracket .and
|
| 1992 | stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
|
| 1993 |
|
| 1994 | /*
|
| 1995 | <stateMatrixItem> ::= "matrix" . <stateMatrixName>
|
| 1996 | <stateOptMatModifier>
|
| 1997 | */
|
| 1998 | stateMatrixItem
|
| 1999 | "matrix" .and dot .and stateMatrixName .error INVALID_MATRIX_NAME .and stateOptMatModifier;
|
| 2000 |
|
| 2001 | /*
|
| 2002 | <stateOptMatModifier> ::= ""
|
| 2003 | | "." <stateMatModifier>
|
| 2004 | */
|
| 2005 | stateOptMatModifier
|
| 2006 | stateOptMatModifier_1 .or .true .emit MATRIX_MODIFIER_IDENTITY;
|
| 2007 | stateOptMatModifier_1
|
| 2008 | dot_ne .and stateMatModifier;
|
| 2009 |
|
| 2010 | /*
|
| 2011 | <stateMatModifier> ::= "inverse"
|
| 2012 | | "transpose"
|
| 2013 | | "invtrans"
|
| 2014 | */
|
| 2015 | stateMatModifier
|
| 2016 | "inverse" .emit MATRIX_MODIFIER_INVERSE .or
|
| 2017 | "transpose" .emit MATRIX_MODIFIER_TRANSPOSE .or
|
| 2018 | "invtrans" .emit MATRIX_MODIFIER_INVTRANS;
|
| 2019 |
|
| 2020 | /*
|
| 2021 | <stateMatrixRowNum> ::= <integer> from 0 to 3
|
| 2022 | */
|
| 2023 | stateMatrixRowNum
|
| 2024 | integer_0_3;
|
| 2025 |
|
| 2026 | /*
|
| 2027 | <stateMatrixName> ::= "modelview" <stateOptModMatNum>
|
| 2028 | | "projection"
|
| 2029 | | "mvp"
|
| 2030 | | "texture" <optTexCoordNum>
|
| 2031 | | "palette" "[" <statePaletteMatNum> "]"
|
| 2032 | | "program" "[" <stateProgramMatNum> "]"
|
| 2033 | */
|
| 2034 | stateMatrixName
|
| 2035 | stateMatrixName_1_1 .emit MATRIX_MODELVIEW .or
|
| 2036 | "projection" .emit MATRIX_PROJECTION .or
|
| 2037 | "mvp" .emit MATRIX_MVP .or
|
| 2038 | stateMatrixName_1_2 .emit MATRIX_TEXTURE .or
|
| 2039 | .if (matrix_palette != 0x00) stateMatrixName_1_3 .emit MATRIX_PALETTE .or
|
| 2040 | stateMatrixName_1_4 .emit MATRIX_PROGRAM;
|
| 2041 | stateMatrixName_1_1
|
| 2042 | "modelview" .and stateOptModMatNum;
|
| 2043 | stateMatrixName_1_2
|
| 2044 | "texture" .and optTexCoordNum;
|
| 2045 | stateMatrixName_1_3
|
| 2046 | "palette" .and lbracket .and statePaletteMatNum .and rbracket;
|
| 2047 | stateMatrixName_1_4
|
| 2048 | "program" .and lbracket .and stateProgramMatNum .and rbracket;
|
| 2049 |
|
| 2050 | /*
|
| 2051 | <stateOptModMatNum> ::= ""
|
| 2052 | | "[" <stateModMatNum> "]"
|
| 2053 | */
|
| 2054 | stateOptModMatNum
|
| 2055 | .if (vertex_blend != 0x00) stateOptModMatNum_1 .or
|
| 2056 | .true .emit 0x00;
|
| 2057 | stateOptModMatNum_1
|
| 2058 | lbracket_ne .and stateModMatNum .and rbracket;
|
| 2059 |
|
| 2060 | /*
|
| 2061 | <stateModMatNum> ::= <integer> from 0 to MAX_VERTEX_UNITS_ARB-1
|
| 2062 | */
|
| 2063 | stateModMatNum
|
| 2064 | integer;
|
| 2065 |
|
| 2066 | /*
|
| 2067 | <optTexCoordNum> ::= ""
|
| 2068 | | "[" <texCoordNum> "]"
|
| 2069 | */
|
| 2070 | optTexCoordNum
|
| 2071 | optTexCoordNum_1 .or .true .emit 0x00;
|
| 2072 | optTexCoordNum_1
|
| 2073 | lbracket_ne .and texCoordNum .and rbracket;
|
| 2074 |
|
| 2075 | /*
|
| 2076 | <texCoordNum> ::= <integer> from 0 to MAX_TEXTURE_COORDS_ARB-1
|
| 2077 | */
|
| 2078 | texCoordNum
|
| 2079 | integer;
|
| 2080 |
|
| 2081 | /*
|
| 2082 | <statePaletteMatNum> ::= <integer> from 0 to MAX_PALETTE_MATRICES_ARB-1
|
| 2083 | */
|
| 2084 | statePaletteMatNum
|
| 2085 | integer;
|
| 2086 |
|
| 2087 | /*
|
| 2088 | <stateProgramMatNum> ::= <integer> from 0 to MAX_PROGRAM_MATRICES_ARB-1
|
| 2089 | */
|
| 2090 | stateProgramMatNum
|
| 2091 | integer;
|
| 2092 |
|
| 2093 | /*
|
| 2094 | <programSingleItem> ::= <progEnvParam>
|
| 2095 | | <progLocalParam>
|
| 2096 |
|
| 2097 | NOTE: <programSingleItem> has been modified for correct error handling. If program property
|
| 2098 | is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
|
| 2099 | */
|
| 2100 | programSingleItem
|
| 2101 | "program" .and dot .and programSingleItem_1 .error INVALID_PROGRAM_PROPERTY;
|
| 2102 | programSingleItem_1
|
| 2103 | progEnvParam .or progLocalParam;
|
| 2104 |
|
| 2105 | /*
|
| 2106 | <programMultipleItem> ::= <progEnvParams>
|
| 2107 | | <progLocalParams>
|
| 2108 |
|
| 2109 | NOTE: <programMultipleItem> has been modified for correct error handling. If program property
|
| 2110 | is neither "env" nor "local" INVALID_PROGRAM_PROPERTY is generated.
|
| 2111 | */
|
| 2112 | programMultipleItem
|
| 2113 | "program" .and dot .and programMultipleItem_1 .error INVALID_PROGRAM_PROPERTY;
|
| 2114 | programMultipleItem_1
|
| 2115 | progEnvParams .or progLocalParams;
|
| 2116 |
|
| 2117 | /*
|
| 2118 | <progEnvParams> ::= "program" "." "env"
|
| 2119 | "[" <progEnvParamNums> "]"
|
| 2120 |
|
| 2121 | NOTE: "program" "." has been moved to <programMultipleItem>.
|
| 2122 | */
|
| 2123 | progEnvParams
|
| 2124 | "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNums .and rbracket;
|
| 2125 |
|
| 2126 | /*
|
| 2127 | <progEnvParamNums> ::= <progEnvParamNum>
|
| 2128 | | <progEnvParamNum> ".." <progEnvParamNum>
|
| 2129 | */
|
| 2130 | progEnvParamNums
|
| 2131 | progEnvParamNums_1 .or progEnvParamNums_2;
|
| 2132 | progEnvParamNums_1
|
| 2133 | progEnvParamNum .and dotdot_ne .and progEnvParamNum;
|
| 2134 | progEnvParamNums_2
|
| 2135 | progEnvParamNum .and .true .emit 0x00;
|
| 2136 |
|
| 2137 | /*
|
| 2138 | <progEnvParam> ::= "program" "." "env"
|
| 2139 | "[" <progEnvParamNum> "]"
|
| 2140 |
|
| 2141 | NOTE: "program" "." has been moved to <programSingleItem>.
|
| 2142 | */
|
| 2143 | progEnvParam
|
| 2144 | "env" .emit PROGRAM_PARAM_ENV .and lbracket .and progEnvParamNum .and rbracket .emit 0x00;
|
| 2145 |
|
| 2146 | /*
|
| 2147 | <progLocalParams> ::= "program" "." "local"
|
| 2148 | "[" <progLocalParamNums> "]"
|
| 2149 |
|
| 2150 | NOTE: "program" "." has been moved to <programMultipleItem>.
|
| 2151 | */
|
| 2152 | progLocalParams
|
| 2153 | "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNums .and rbracket;
|
| 2154 |
|
| 2155 | /*
|
| 2156 | <progLocalParamNums> ::= <progLocalParamNum>
|
| 2157 | | <progLocalParamNum> ".." <progLocalParamNum>
|
| 2158 | */
|
| 2159 | progLocalParamNums
|
| 2160 | progLocalParamNums_1 .or progLocalParamNums_2;
|
| 2161 | progLocalParamNums_1
|
| 2162 | progLocalParamNum .and dotdot_ne .and progLocalParamNum;
|
| 2163 | progLocalParamNums_2
|
| 2164 | progLocalParamNum .and .true .emit 0x00;
|
| 2165 |
|
| 2166 | /*
|
| 2167 | <progLocalParam> ::= "program" "." "local"
|
| 2168 | "[" <progLocalParamNum> "]"
|
| 2169 |
|
| 2170 | NOTE: "program" "." has been moved to <programSingleItem>.
|
| 2171 | */
|
| 2172 | progLocalParam
|
| 2173 | "local" .emit PROGRAM_PARAM_LOCAL .and lbracket .and progLocalParamNum .and rbracket .emit 0x00;
|
| 2174 |
|
| 2175 | /*
|
| 2176 | <progEnvParamNum> ::= <integer> from 0 to
|
| 2177 | MAX_PROGRAM_ENV_PARAMETERS_ARB - 1
|
| 2178 | */
|
| 2179 | progEnvParamNum
|
| 2180 | integer;
|
| 2181 |
|
| 2182 | /*
|
| 2183 | <progLocalParamNum> ::= <integer> from 0 to
|
| 2184 | MAX_PROGRAM_LOCAL_PARAMETERS_ARB - 1
|
| 2185 | */
|
| 2186 | progLocalParamNum
|
| 2187 | integer;
|
| 2188 |
|
| 2189 | /*
|
| 2190 | <paramConstDecl> ::= <paramConstScalarDecl>
|
| 2191 | | <paramConstVector>
|
| 2192 | */
|
| 2193 | paramConstDecl
|
| 2194 | paramConstScalarDecl .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
|
| 2195 |
|
| 2196 | /*
|
| 2197 | <paramConstUse> ::= <paramConstScalarUse>
|
| 2198 | | <paramConstVector>
|
| 2199 | */
|
| 2200 | paramConstUse
|
| 2201 | paramConstScalarUse .emit CONSTANT_SCALAR .or paramConstVector .emit CONSTANT_VECTOR;
|
| 2202 |
|
| 2203 | /*
|
| 2204 | <paramConstScalarDecl> ::= <signedFloatConstant>
|
| 2205 | */
|
| 2206 | paramConstScalarDecl
|
| 2207 | signedFloatConstant;
|
| 2208 |
|
| 2209 | /*
|
| 2210 | <paramConstScalarUse> ::= <floatConstant>
|
| 2211 | */
|
| 2212 | paramConstScalarUse
|
| 2213 | floatConstant;
|
| 2214 |
|
| 2215 | /*
|
| 2216 | <paramConstVector> ::= "{" <signedFloatConstant> "}"
|
| 2217 | | "{" <signedFloatConstant> ","
|
| 2218 | <signedFloatConstant> "}"
|
| 2219 | | "{" <signedFloatConstant> ","
|
| 2220 | <signedFloatConstant> ","
|
| 2221 | <signedFloatConstant> "}"
|
| 2222 | | "{" <signedFloatConstant> ","
|
| 2223 | <signedFloatConstant> ","
|
| 2224 | <signedFloatConstant> ","
|
| 2225 | <signedFloatConstant> "}"
|
| 2226 | */
|
| 2227 | paramConstVector
|
| 2228 | paramConstVector_4 .emit 0x04 .or paramConstVector_3 .emit 0x03 .or
|
| 2229 | paramConstVector_2 .emit 0x02 .or paramConstVector_1 .emit 0x01;
|
| 2230 | paramConstVector_1
|
| 2231 | lbrace_ne .and signedFloatConstant .and rbrace;
|
| 2232 | paramConstVector_2
|
| 2233 | lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
|
| 2234 | paramConstVector_3
|
| 2235 | lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
|
| 2236 | signedFloatConstant .and rbrace;
|
| 2237 | paramConstVector_4
|
| 2238 | lbrace_ne .and signedFloatConstant .and comma_ne .and signedFloatConstant .and comma_ne .and
|
| 2239 | signedFloatConstant .and comma_ne .and signedFloatConstant .and rbrace;
|
| 2240 |
|
| 2241 | /*
|
| 2242 | <signedFloatConstant> ::= <optionalSign> <floatConstant>
|
| 2243 | */
|
| 2244 | signedFloatConstant
|
| 2245 | optionalSign .and floatConstant;
|
| 2246 |
|
| 2247 | /*
|
| 2248 | <floatConstant> ::= see text
|
| 2249 | The <floatConstant> rule matches a floating-point constant consisting
|
| 2250 | of an integer part, a decimal point, a fraction part, an "e" or
|
| 2251 | "E", and an optionally signed integer exponent. The integer and
|
| 2252 | fraction parts both consist of a sequence of one or more digits ("0"
|
| 2253 | through "9"). Either the integer part or the fraction parts (not
|
| 2254 | both) may be missing; either the decimal point or the "e" (or "E")
|
| 2255 | and the exponent (not both) may be missing.
|
| 2256 | */
|
| 2257 | floatConstant
|
| 2258 | float;
|
| 2259 |
|
| 2260 | /*
|
| 2261 | <optionalSign> ::= ""
|
| 2262 | | "-"
|
| 2263 | | "+"
|
| 2264 | */
|
| 2265 | optionalSign
|
| 2266 | optional_sign_ne;
|
| 2267 |
|
| 2268 | /*
|
| 2269 | <TEMP_statement> ::= "TEMP" <varNameList>
|
| 2270 | */
|
| 2271 | fp_TEMP_statement
|
| 2272 | "TEMP" .and space .and fp_varNameList .and .true .emit 0x00;
|
| 2273 | vp_TEMP_statement
|
| 2274 | "TEMP" .and space .and vp_varNameList .and .true .emit 0x00;
|
| 2275 |
|
| 2276 | /*
|
| 2277 | vertex program
|
| 2278 | <ADDRESS_statement> ::= "ADDRESS" <varNameList>
|
| 2279 | */
|
| 2280 | ADDRESS_statement
|
| 2281 | "ADDRESS" .and space .and vp_varNameList .and .true .emit 0x00;
|
| 2282 |
|
| 2283 | /*
|
| 2284 | <varNameList> ::= <establishName>
|
| 2285 | | <establishName> "," <varNameList>
|
| 2286 | */
|
| 2287 | fp_varNameList
|
| 2288 | fp_varNameList_1 .or fp_establishName;
|
| 2289 | vp_varNameList
|
| 2290 | vp_varNameList_1 .or vp_establishName;
|
| 2291 | fp_varNameList_1
|
| 2292 | fp_establishName .and comma_ne .and fp_varNameList;
|
| 2293 | vp_varNameList_1
|
| 2294 | vp_establishName .and comma_ne .and vp_varNameList;
|
| 2295 |
|
| 2296 | /*
|
| 2297 | <OUTPUT_statement> ::= "OUTPUT" <establishName> "="
|
| 2298 | <resultBinding>
|
| 2299 | */
|
| 2300 | fp_OUTPUT_statement
|
| 2301 | "OUTPUT" .and space .and fp_establishName .and equal .and
|
| 2302 | fp_resultBinding .error RESULT_EXPECTED;
|
| 2303 | vp_OUTPUT_statement
|
| 2304 | "OUTPUT" .and space .and vp_establishName .and equal .and
|
| 2305 | vp_resultBinding .error RESULT_EXPECTED;
|
| 2306 |
|
| 2307 | /*
|
| 2308 | fragment program
|
| 2309 | <resultBinding> ::= "result" "." "color"
|
| 2310 | | "result" "." "depth"
|
| 2311 |
|
| 2312 | vertex program
|
| 2313 | <resultBinding> ::= "result" "." "position"
|
| 2314 | | "result" "." <resultColBinding>
|
| 2315 | | "result" "." "fogcoord"
|
| 2316 | | "result" "." "pointsize"
|
| 2317 | | "result" "." "texcoord" <optTexCoordNum>
|
| 2318 | */
|
| 2319 | fp_resultBinding
|
| 2320 | "result" .and dot .and fp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
|
| 2321 | vp_resultBinding
|
| 2322 | "result" .and dot .and vp_resultBinding_1 .error INVALID_RESULT_PROPERTY;
|
| 2323 | fp_resultBinding_1
|
| 2324 | "color" .emit FRAGMENT_RESULT_COLOR .or
|
| 2325 | "depth" .emit FRAGMENT_RESULT_DEPTH;
|
| 2326 | vp_resultBinding_1
|
| 2327 | .if (ARB_position_invariant == 0x00) "position" .emit VERTEX_RESULT_POSITION .or
|
| 2328 | resultColBinding .emit VERTEX_RESULT_COLOR .or
|
| 2329 | "fogcoord" .emit VERTEX_RESULT_FOGCOORD .or
|
| 2330 | "pointsize" .emit VERTEX_RESULT_POINTSIZE .or
|
| 2331 | vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;
|
| 2332 | vp_resultBinding_2
|
| 2333 | "texcoord" .and optTexCoordNum;
|
| 2334 |
|
| 2335 | /*
|
| 2336 | vertex program
|
| 2337 | <resultColBinding> ::= "color" <optFaceType> <optColorType>
|
| 2338 | */
|
| 2339 | resultColBinding
|
| 2340 | "color" .and optFaceType .and optColorType;
|
| 2341 |
|
| 2342 | /*
|
| 2343 | <optFaceType> ::= ""
|
| 2344 | | "." "front"
|
| 2345 | | "." "back"
|
| 2346 | */
|
| 2347 | optFaceType
|
| 2348 | FaceType .or .true .emit FACE_FRONT;
|
| 2349 | FaceType
|
| 2350 | dot_ne .and FaceProperty;
|
| 2351 | FaceProperty
|
| 2352 | "front" .emit FACE_FRONT .or "back" .emit FACE_BACK;
|
| 2353 |
|
| 2354 | /*
|
| 2355 | <optColorType> ::= ""
|
| 2356 | | "." "primary"
|
| 2357 | | "." "secondary"
|
| 2358 | */
|
| 2359 | optColorType
|
| 2360 | ColorType .or .true .emit COLOR_PRIMARY;
|
| 2361 | ColorType
|
| 2362 | dot_ne .and ColorProperty;
|
| 2363 | ColorProperty
|
| 2364 | "primary" .emit COLOR_PRIMARY .or
|
| 2365 | .if (secondary_color != 0x00) "secondary" .emit COLOR_SECONDARY;
|
| 2366 |
|
| 2367 | /*
|
| 2368 | <ALIAS_statement> ::= "ALIAS" <establishName> "="
|
| 2369 | <establishedName>
|
| 2370 | */
|
| 2371 | fp_ALIAS_statement
|
| 2372 | "ALIAS" .and fp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and fp_establishedName;
|
| 2373 | vp_ALIAS_statement
|
| 2374 | "ALIAS" .and vp_ALIAS_statement_1 .error IDENTIFIER_EXPECTED .and equal .and vp_establishedName;
|
| 2375 | fp_ALIAS_statement_1
|
| 2376 | space .and fp_establishName;
|
| 2377 | vp_ALIAS_statement_1
|
| 2378 | space .and vp_establishName;
|
| 2379 |
|
| 2380 | /*
|
| 2381 | <establishName> ::= <identifier>
|
| 2382 | */
|
| 2383 | fp_establishName
|
| 2384 | fp_identifier;
|
| 2385 | vp_establishName
|
| 2386 | vp_identifier;
|
| 2387 |
|
| 2388 | /*
|
| 2389 | <establishedName> ::= <identifier>
|
| 2390 | */
|
| 2391 | fp_establishedName
|
| 2392 | fp_identifier;
|
| 2393 | vp_establishedName
|
| 2394 | vp_identifier;
|
| 2395 | fp_establishedName_no_error_on_identifier
|
| 2396 | fp_identifier_ne;
|
| 2397 | vp_establishedName_no_error_on_identifier
|
| 2398 | vp_identifier_ne;
|
| 2399 |
|
| 2400 | /*
|
| 2401 | fragment program
|
| 2402 | <identifier> ::= see text
|
| 2403 | The <identifier> rule matches a sequence of one or more letters ("A"
|
| 2404 | through "Z", "a" through "z"), digits ("0" through "9), underscores
|
| 2405 | ("_"), or dollar signs ("$"); the first character must not be a
|
| 2406 | number. Upper and lower case letters are considered different
|
| 2407 | (names are case-sensitive). The following strings are reserved
|
| 2408 | keywords and may not be used as identifiers:
|
| 2409 |
|
| 2410 | ABS, ABS_SAT, ADD, ADD_SAT, ALIAS, ATTRIB, CMP, CMP_SAT, COS,
|
| 2411 | COS_SAT, DP3, DP3_SAT, DP4, DP4_SAT, DPH, DPH_SAT, DST, DST_SAT,
|
| 2412 | END, EX2, EX2_SAT, FLR, FLR_SAT, FRC, FRC_SAT, KIL, LG2,
|
| 2413 | LG2_SAT, LIT, LIT_SAT, LRP, LRP_SAT, MAD, MAD_SAT, MAX, MAX_SAT,
|
| 2414 | MIN, MIN_SAT, MOV, MOV_SAT, MUL, MUL_SAT, OPTION, OUTPUT, PARAM,
|
| 2415 | POW, POW_SAT, RCP, RCP_SAT, RSQ, RSQ_SAT, SIN, SIN_SAT, SCS,
|
| 2416 | SCS_SAT, SGE, SGE_SAT, SLT, SLT_SAT, SUB, SUB_SAT, SWZ, SWZ_SAT,
|
| 2417 | TEMP, TEX, TEX_SAT, TXB, TXB_SAT, TXP, TXP_SAT, XPD, XPD_SAT,
|
| 2418 | fragment, program, result, state, and texture.
|
| 2419 |
|
| 2420 | vertex program
|
| 2421 | <identifier> ::= see text
|
| 2422 | The <identifier> rule matches a sequence of one or more letters ("A"
|
| 2423 | through "Z", "a" through "z"), digits ("0" through "9), underscores ("_"),
|
| 2424 | or dollar signs ("$"); the first character must not be a number. Upper
|
| 2425 | and lower case letters are considered different (names are
|
| 2426 | case-sensitive). The following strings are reserved keywords and may not
|
| 2427 | be used as identifiers:
|
| 2428 |
|
| 2429 | ABS, ADD, ADDRESS, ALIAS, ARL, ATTRIB, DP3, DP4, DPH, DST, END, EX2,
|
| 2430 | EXP, FLR, FRC, LG2, LIT, LOG, MAD, MAX, MIN, MOV, MUL, OPTION, OUTPUT,
|
| 2431 | PARAM, POW, RCP, RSQ, SGE, SLT, SUB, SWZ, TEMP, XPD, program, result,
|
| 2432 | state, and vertex.
|
| 2433 | */
|
| 2434 | fp_identifier
|
| 2435 | fp_identifier_ne .error IDENTIFIER_EXPECTED;
|
| 2436 | vp_identifier
|
| 2437 | vp_identifier_ne .error IDENTIFIER_EXPECTED;
|
| 2438 | fp_identifier_ne
|
| 2439 | fp_not_reserved_identifier .and identifier_ne;
|
| 2440 | vp_identifier_ne
|
| 2441 | vp_not_reserved_identifier .and identifier_ne;
|
| 2442 |
|
| 2443 | fp_not_reserved_identifier
|
| 2444 | fp_not_reserved_identifier_1 .or .true;
|
| 2445 | fp_not_reserved_identifier_1
|
| 2446 | fp_reserved_identifier .and .false .error RESERVED_KEYWORD;
|
| 2447 | vp_not_reserved_identifier
|
| 2448 | vp_not_reserved_identifier_1 .or .true;
|
| 2449 | vp_not_reserved_identifier_1
|
| 2450 | vp_reserved_identifier .and .false .error RESERVED_KEYWORD;
|
| 2451 |
|
| 2452 | fp_reserved_identifier
|
| 2453 | "ABS" .or "ABS_SAT" .or "ADD" .or "ADD_SAT" .or "ALIAS" .or "ATTRIB" .or "CMP" .or "CMP_SAT" .or
|
| 2454 | "COS" .or "COS_SAT" .or "DP3" .or "DP3_SAT" .or "DP4" .or "DP4_SAT" .or "DPH" .or "DPH_SAT" .or
|
| 2455 | "DST" .or "DST_SAT" .or "END" .or "EX2" .or "EX2_SAT" .or "FLR" .or "FLR_SAT" .or "FRC" .or
|
| 2456 | "FRC_SAT" .or "KIL" .or "LG2" .or "LG2_SAT" .or "LIT" .or "LIT_SAT" .or "LRP" .or "LRP_SAT" .or
|
| 2457 | "MAD" .or "MAD_SAT" .or "MAX" .or "MAX_SAT" .or "MIN" .or "MIN_SAT" .or "MOV" .or "MOV_SAT" .or
|
| 2458 | "MUL" .or "MUL_SAT" .or "OPTION" .or "OUTPUT" .or "PARAM" .or "POW" .or "POW_SAT" .or "RCP" .or
|
| 2459 | "RCP_SAT" .or "RSQ" .or "RSQ_SAT" .or "SIN" .or "SIN_SAT" .or "SCS" .or "SCS_SAT" .or "SGE" .or
|
| 2460 | "SGE_SAT" .or "SLT" .or "SLT_SAT" .or "SUB" .or "SUB_SAT" .or "SWZ" .or "SWZ_SAT" .or "TEMP" .or
|
| 2461 | "TEX" .or "TEX_SAT" .or "TXB" .or "TXB_SAT" .or "TXP" .or "TXP_SAT" .or "XPD" .or "XPD_SAT" .or
|
| 2462 | "fragment" .or "program" .or "result" .or "state" .or "texture";
|
| 2463 | vp_reserved_identifier
|
| 2464 | "ABS" .or "ADD" .or "ADDRESS" .or "ALIAS" .or "ARL" .or "ATTRIB" .or "DP3" .or "DP4" .or
|
| 2465 | "DPH" .or "DST" .or "END" .or "EX2" .or "EXP" .or "FLR" .or "FRC" .or "LG2" .or "LIT" .or
|
| 2466 | "LOG" .or "MAD" .or "MAX" .or "MIN" .or "MOV" .or "MUL" .or "OPTION" .or "OUTPUT" .or
|
| 2467 | "PARAM" .or "POW" .or "RCP" .or "RSQ" .or "SGE" .or "SLT" .or "SUB" .or "SWZ" .or "TEMP" .or
|
| 2468 | "XPD" .or "program" .or "result" .or "state" .or "vertex";
|
| 2469 |
|
| 2470 | /*
|
| 2471 | The <integer> rule matches an integer constant. The integer consists
|
| 2472 | of a sequence of one or more digits ("0" through "9").
|
| 2473 | */
|
| 2474 | integer
|
| 2475 | integer_ne .error INTEGER_EXPECTED;
|
| 2476 |
|
| 2477 | zero
|
| 2478 | '0';
|
| 2479 |
|
| 2480 | leading_zeroes
|
| 2481 | .loop zero;
|
| 2482 |
|
| 2483 | no_digit
|
| 2484 | no_digit_1 .or .true;
|
| 2485 | no_digit_1
|
| 2486 | digit10 .and .false .error INTEGER_OUT_OF_RANGE;
|
| 2487 |
|
| 2488 | all_zeroes
|
| 2489 | all_zeroes_1 .or no_digit_1;
|
| 2490 | all_zeroes_1
|
| 2491 | '0' .and .loop zero .and no_digit;
|
| 2492 |
|
| 2493 | integer_0_3
|
| 2494 | integer_0_3_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
|
| 2495 | integer_0_3_1
|
| 2496 | integer_0_3_2 .or all_zeroes .emit '0';
|
| 2497 | integer_0_3_2 /* [1, 3] */
|
| 2498 | leading_zeroes .and '1'-'3' .emit * .and no_digit;
|
| 2499 |
|
| 2500 | integer_0_63
|
| 2501 | integer_0_63_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
|
| 2502 | integer_0_63_1
|
| 2503 | integer_0_63_2 .or integer_0_63_3 .or integer_0_63_4 .or integer_0_63_5 .or
|
| 2504 | all_zeroes .emit '0';
|
| 2505 | integer_0_63_2 /* [7, 9] */
|
| 2506 | leading_zeroes .and '7'-'9' .emit * .and no_digit;
|
| 2507 | integer_0_63_3 /* [10, 59] */
|
| 2508 | leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
|
| 2509 | integer_0_63_4 /* [60, 63] */
|
| 2510 | leading_zeroes .and '6' .emit * .and '0'-'3' .emit * .and no_digit;
|
| 2511 | integer_0_63_5 /* [1, 6] */
|
| 2512 | leading_zeroes .and '1'-'6' .emit * .and no_digit;
|
| 2513 |
|
| 2514 | integer_0_64
|
| 2515 | integer_0_64_1 .error INTEGER_EXPECTED .and .true .emit 0x00 .emit $;
|
| 2516 | integer_0_64_1
|
| 2517 | integer_0_64_2 .or integer_0_64_3 .or integer_0_64_4 .or integer_0_64_5 .or
|
| 2518 | all_zeroes .emit '0';
|
| 2519 | integer_0_64_2 /* [7, 9] */
|
| 2520 | leading_zeroes .and '7'-'9' .emit * .and no_digit;
|
| 2521 | integer_0_64_3 /* [10, 59] */
|
| 2522 | leading_zeroes .and '1'-'5' .emit * .and '0'-'9' .emit * .and no_digit;
|
| 2523 | integer_0_64_4 /* [60, 64] */
|
| 2524 | leading_zeroes .and '6' .emit * .and '0'-'4' .emit * .and no_digit;
|
| 2525 | integer_0_64_5 /* [1, 6] */
|
| 2526 | leading_zeroes .and '1'-'6' .emit * .and no_digit;
|
| 2527 |
|
| 2528 | optional_space
|
| 2529 | space .or .true;
|
| 2530 |
|
| 2531 | space_dst
|
| 2532 | space .error OPERATION_NEEDS_DESTINATION_VARIABLE;
|
| 2533 |
|
| 2534 | space_src
|
| 2535 | space .error OPERATION_NEEDS_SOURCE_VARIABLE;
|
| 2536 |
|
| 2537 | space
|
| 2538 | single_space .and .loop single_space;
|
| 2539 |
|
| 2540 | single_space
|
| 2541 | white_char .or comment_block;
|
| 2542 |
|
| 2543 | white_char
|
| 2544 | ' ' .or '\t' .or '\n' .or '\r';
|
| 2545 |
|
| 2546 | comment_block
|
| 2547 | '#' .and .loop comment_char .and new_line;
|
| 2548 |
|
| 2549 | /* All ASCII characters except '\r', '\n' and '\0' */
|
| 2550 | comment_char
|
| 2551 | '\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
|
| 2552 |
|
| 2553 | new_line
|
| 2554 | '\n' .or crlf .or '\0';
|
| 2555 |
|
| 2556 | crlf
|
| 2557 | '\r' .and '\n';
|
| 2558 |
|
| 2559 | semicolon
|
| 2560 | optional_space .and ';' .error MISSING_SEMICOLON .and optional_space;
|
| 2561 |
|
| 2562 | comma
|
| 2563 | optional_space .and ',' .error MISSING_COMMA .and optional_space;
|
| 2564 |
|
| 2565 | comma_ne
|
| 2566 | optional_space .and ',' .and optional_space;
|
| 2567 |
|
| 2568 | lbracket
|
| 2569 | optional_space .and '[' .error MISSING_LBRACKET .and optional_space;
|
| 2570 |
|
| 2571 | lbracket_ne
|
| 2572 | optional_space .and '[' .and optional_space;
|
| 2573 |
|
| 2574 | rbracket
|
| 2575 | optional_space .and ']' .error MISSING_RBRACKET .and optional_space;
|
| 2576 |
|
| 2577 | dot
|
| 2578 | optional_space .and '.' .error MISSING_DOT .and optional_space;
|
| 2579 |
|
| 2580 | dot_ne
|
| 2581 | optional_space .and '.' .and optional_space;
|
| 2582 |
|
| 2583 | equal
|
| 2584 | optional_space .and '=' .error MISSING_EQUAL .and optional_space;
|
| 2585 |
|
| 2586 | lbrace
|
| 2587 | optional_space .and '{' .error MISSING_LBRACE .and optional_space;
|
| 2588 |
|
| 2589 | lbrace_ne
|
| 2590 | optional_space .and '{' .and optional_space;
|
| 2591 |
|
| 2592 | rbrace
|
| 2593 | optional_space .and '}' .error MISSING_RBRACE .and optional_space;
|
| 2594 |
|
| 2595 | dotdot
|
| 2596 | optional_space .and '.' .and '.' .error MISSING_DOTDOT .and optional_space;
|
| 2597 |
|
| 2598 | dotdot_ne
|
| 2599 | optional_space .and '.' .and '.' .and optional_space;
|
| 2600 |
|
| 2601 | /*
|
| 2602 | The definition below accepts the following floating point number formats:
|
| 2603 | .99 .99e99 99. 99.99 99.99e99 99.e99 99e99
|
| 2604 | Also 99 format was considered and accepted because of a large number of existing program
|
| 2605 | strings with such a format.
|
| 2606 | */
|
| 2607 | float
|
| 2608 | float_1 .or float_2 .or float_legacy;
|
| 2609 | float_1
|
| 2610 | '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
|
| 2611 | float_2
|
| 2612 | integer_ne .and float_3;
|
| 2613 | float_3
|
| 2614 | float_4 .or float_5;
|
| 2615 | float_4
|
| 2616 | '.' .and optional_integer .and optional_exponent;
|
| 2617 | float_5
|
| 2618 | exponent .emit 0x00;
|
| 2619 | float_legacy
|
| 2620 | integer_ne .and .true .emit 0x00 .emit 0x00;
|
| 2621 |
|
| 2622 | /*
|
| 2623 | Below is a correct version of <float> definiton.
|
| 2624 | */
|
| 2625 | /*
|
| 2626 | float
|
| 2627 | float_1 .or float_2;
|
| 2628 | float_1
|
| 2629 | '.' .emit 0x00 .and integer_ne .error MISSING_FRACTION_OR_EXPONENT .and optional_exponent;
|
| 2630 | float_2
|
| 2631 | integer_ne .and float_3 .error MISSING_DOT_OR_EXPONENT;
|
| 2632 | float_3
|
| 2633 | float_4 .or float_5;
|
| 2634 | float_4
|
| 2635 | '.' .and optional_integer .and optional_exponent;
|
| 2636 | float_5
|
| 2637 | exponent .emit 0x00;
|
| 2638 | */
|
| 2639 |
|
| 2640 | integer_ne
|
| 2641 | integer_ne_1 .and .true .emit 0x00 .emit $;
|
| 2642 | integer_ne_1
|
| 2643 | digit10 .emit * .and .loop digit10 .emit *;
|
| 2644 |
|
| 2645 | optional_integer
|
| 2646 | integer_ne .or .true .emit 0x00;
|
| 2647 |
|
| 2648 | /*
|
| 2649 | NOTE: If exponent part is omited we treat it as if it was "E+1".
|
| 2650 | */
|
| 2651 | optional_exponent
|
| 2652 | exponent .or .true .emit 0x00;
|
| 2653 |
|
| 2654 | exponent
|
| 2655 | exponent_1 .and optional_sign_ne .and integer_ne .error EXPONENT_VALUE_EXPECTED;
|
| 2656 | exponent_1
|
| 2657 | 'e' .or 'E';
|
| 2658 |
|
| 2659 | optional_sign_ne
|
| 2660 | minus_ne .or plus_ne .or .true;
|
| 2661 |
|
| 2662 | plus_ne
|
| 2663 | optional_space .and '+' .and optional_space;
|
| 2664 |
|
| 2665 | minus_ne
|
| 2666 | optional_space .and '-' .emit '-' .and optional_space;
|
| 2667 |
|
| 2668 | identifier_ne
|
| 2669 | first_idchar .emit * .and .loop follow_idchar .emit * .and .true .emit 0x00 .emit $;
|
| 2670 |
|
| 2671 | follow_idchar
|
| 2672 | first_idchar .or digit10;
|
| 2673 |
|
| 2674 | first_idchar
|
| 2675 | 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
|
| 2676 |
|
| 2677 | digit10
|
| 2678 | '0'-'9';
|
| 2679 |
|
| 2680 | /*
|
| 2681 | string filtering - if a string is encountered in grammar ("blabla"), the symbol below is
|
| 2682 | executed to create the string. The symbol must not throw any errors and emit bytes - it should
|
| 2683 | stop if it encounters invalid character. After this the resulting string (from starting
|
| 2684 | position up to the invalid character (but without it) is compared with the grammar string.
|
| 2685 | */
|
| 2686 | .string __string_filter;
|
| 2687 |
|
| 2688 | __string_filter
|
| 2689 | .loop __identifier_char;
|
| 2690 |
|
| 2691 | __identifier_char
|
| 2692 | 'a'-'z' .or 'A'-'Z' .or '_' .or '$' .or '0'-'9';
|
| 2693 |
|
| 2694 | /*
|
| 2695 | error token filtering
|
| 2696 | */
|
| 2697 | e_signature
|
| 2698 | e_signature_char .and .loop e_signature_char;
|
| 2699 | e_signature_char
|
| 2700 | '!' .or '.' .or 'A'-'Z' .or 'a'-'z' .or '0'-'9';
|
| 2701 |
|
| 2702 | e_statement
|
| 2703 | .loop e_statement_not_term;
|
| 2704 | /* All ASCII characters to one of '\r', '\n', '\0' and ';' */
|
| 2705 | e_statement_not_term
|
| 2706 | '\x3C'-'\xFF' .or '\x0E'-'\x3A' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
|
| 2707 |
|
| 2708 | e_identifier
|
| 2709 | e_identifier_first .and .loop e_identifier_next;
|
| 2710 | e_identifier_first
|
| 2711 | 'a'-'z' .or 'A'-'Z' .or '_' .or '$';
|
| 2712 | e_identifier_next
|
| 2713 | e_identifier_first .or '0'-'9';
|
| 2714 |
|
| 2715 | e_token
|
| 2716 | e_identifier .or e_token_number .or '[' .or ']' .or '.' .or '{' .or '}' .or '=' .or '+' .or
|
| 2717 | '-' .or ',' .or ';';
|
| 2718 | e_token_number
|
| 2719 | e_token_digit .and .loop e_token_digit;
|
| 2720 | e_token_digit
|
| 2721 | '0'-'9';
|
| 2722 |
|
| 2723 | e_charordigit
|
| 2724 | 'A'-'Z' .or 'a'-'z' .or '0'-'9';
|
| 2725 |
|