+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ /**
+ * \file arbprogram.syn
+ * ARB_fragment/vertex_program syntax
+ * \author Michal Krol
+ */
+
.syntax program;
/*
compares the value with its REVISION value. If they do not match, the loader is not up
to date.
*/
-.emtcode REVISION 0x08
+.emtcode REVISION 0x0a
/* program type */
.emtcode FRAGMENT_PROGRAM 0x01
.emtcode DECLARATION 0x03
.emtcode END 0x04
-/* GL_ARB_fragment_program option flags */
-.emtcode ARB_PRECISION_HINT_FASTEST 0x01
-.emtcode ARB_PRECISION_HINT_NICEST 0x02
-.emtcode ARB_FOG_EXP 0x04
-.emtcode ARB_FOG_EXP2 0x08
-.emtcode ARB_FOG_LINEAR 0x10
+/* GL_ARB_fragment_program option */
+.emtcode ARB_PRECISION_HINT_FASTEST 0x00
+.emtcode ARB_PRECISION_HINT_NICEST 0x01
+.emtcode ARB_FOG_EXP 0x02
+.emtcode ARB_FOG_EXP2 0x03
+.emtcode ARB_FOG_LINEAR 0x04
+
+/* GL_ARB_vertex_program option */
+.emtcode ARB_POSITION_INVARIANT 0x05
-/* GL_ARB_vertex_program option flags */
-.emtcode ARB_POSITION_INVARIANT 0x20
+/* GL_ARB_fragment_program_shadow option */
+.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
-/* GL_ARB_fragment_program_shadow option flags */
-.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40
+/* GL_ARB_draw_buffers option */
+.emtcode ARB_DRAW_BUFFERS 0x07
+
+/* GL_MESA_texture_array option */
+.emtcode MESA_TEXTURE_ARRAY 0x08
/* GL_ARB_fragment_program instruction class */
.emtcode OP_ALU_INST 0x00
.emtcode TEXTARGET_SHADOW1D 0x06
.emtcode TEXTARGET_SHADOW2D 0x07
.emtcode TEXTARGET_SHADOWRECT 0x08
+/* GL_MESA_texture_array */
+.emtcode TEXTARGET_1D_ARRAY 0x09
+.emtcode TEXTARGET_2D_ARRAY 0x0a
+.emtcode TEXTARGET_SHADOW1D_ARRAY 0x0b
+.emtcode TEXTARGET_SHADOW2D_ARRAY 0x0c
/* face type */
.emtcode FACE_FRONT 0x00
/* GL_ARB_fragment_program_shadow */
.regbyte fragment_program_shadow 0x00
+/* GL_ARB_draw_buffers */
+.regbyte draw_buffers 0x00
+
+/* GL_MESA_texture_array */
+.regbyte texture_array 0x00
+
/* option presence condition registers */
/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
/* register is set to 1 to indicate that the OPTION was specified. */
/* GL_ARB_fragment_program_shadow */
.regbyte ARB_fragment_program_shadow 0x00
+/* GL_ARB_draw_buffers */
+.regbyte ARB_draw_buffers 0x00
+
+/* GL_MESA_texture_array */
+.regbyte MESA_texture_array 0x00
+
/* program target condition register */
/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
/* to distinguish between them we need a register that will store for us the current target. */
fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
.if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
- .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01;
+ .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
+ .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
+ .load ARB_draw_buffers 0x01 .or
+ .if (texture_array != 0x00) "MESA_texture_array" .emit MESA_TEXTURE_ARRAY
+ .load MESA_texture_array 0x01;
vp_optionString
"ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
fp_ARB_fog_exp
| "CUBE"
| "RECT"
| <shadowTarget> (if option ARB_fragment_program_shadow present)
+ | <arrayTarget> (if option MESA_texture_array present)
*/
texTarget
"1D" .emit TEXTARGET_1D .or
"3D" .emit TEXTARGET_3D .or
.if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
"CUBE" .emit TEXTARGET_CUBE .or
- .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
+ .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or
+ .if (MESA_texture_array != 0x00) arrayTarget;
/*
GL_ARB_fragment_program_shadow
<shadowTarget> ::= "SHADOW1D"
| "SHADOW2D"
| "SHADOWRECT"
+ | <shadowArrayTarget> (if option MESA_texture_array present)
*/
shadowTarget
"SHADOW1D" .emit TEXTARGET_SHADOW1D .or
"SHADOW2D" .emit TEXTARGET_SHADOW2D .or
- .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
+ .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT .or
+ .if (MESA_texture_array != 0x00) shadowArrayTarget;
+
+/*
+GL_MESA_texture_array
+
+ <arrayTarget> ::= "ARRAY1D"
+ | "ARRAY2D"
+
+ <shadowArrayTarget> ::= "SHADOWARRAY1D"
+ | "SHADOWARRAY2D"
+*/
+
+arrayTarget
+ "ARRAY1D" .emit TEXTARGET_1D_ARRAY .or
+ "ARRAY2D" .emit TEXTARGET_2D_ARRAY;
+
+shadowArrayTarget
+ "SHADOWARRAY1D" .emit TEXTARGET_SHADOW1D_ARRAY .or
+ "SHADOWARRAY2D" .emit TEXTARGET_SHADOW2D_ARRAY;
/*
fragment program
fragment program
<optLegacyTexUnitNum> ::= ""
| "[" <legacyTexUnitNum> "]"
-
-NOTE: <optLegaceTexUnitNum> is not optional.
*/
optLegacyTexUnitNum
+ optLegacyTexUnitNum_1 .or .true .emit 0x00;
+optLegacyTexUnitNum_1
lbracket_ne .and legacyTexUnitNum .and rbracket;
/*
/*
vertex program
- <statePointItem> ::= "point" . <statePointProperty>
+ <statePointItem> ::= "point" "." <statePointProperty>
*/
statePointItem
"point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
/*
- <stateMatrixItem> ::= "matrix" . <stateMatrixName>
+ <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
<stateOptMatModifier>
*/
stateMatrixItem
stateModMatNum
integer;
-/*
- From ARB_draw_buffers:
- <optOutputColorNum> ::= ""
- | "[" <OutputColorNum> "]"
-*/
-optOutputColorNum
- optOutputColorNum_1 .or .true .emit 0x00;
-optOutputColorNum_1
- lbracket_ne .and outputColorNum .and rbracket;
-
-/*
- From ARB_draw_buffers:
- <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
-*/
-outputColorNum
- integer;
-
/*
<optTexCoordNum> ::= ""
| "[" <texCoordNum> "]"
vp_resultBinding .error RESULT_EXPECTED;
/*
- From ARB_draw_buffers:
fragment program
- <resultBinding> ::= "result" "." "color" <optOutputColorNum>
+ <resultBinding> ::= "result" "." "color"
+ | "result" "." "color" <optOutputColorNum> (if option ARB_draw_buffers present)
| "result" "." "depth"
vertex program
vp_resultBinding_2
"texcoord" .and optTexCoordNum;
+/*
+GL_ARB_draw_buffers
+ <optOutputColorNum> ::= ""
+ | "[" <outputColorNum> "]"
+*/
+optOutputColorNum
+ .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;
+optOutputColorNum_1
+ lbracket_ne .and outputColorNum .and rbracket;
+
+/*
+GL_ARB_draw_buffers
+ <outputColorNum> ::= <integer> from 0 to MAX_DRAW_BUFFERS_ARB-1
+*/
+outputColorNum
+ integer;
+
/*
vertex program
<resultColBinding> ::= "color" <optFaceType> <optColorType>
' ' .or '\t' .or '\n' .or '\r';
comment_block
- '#' .and .loop comment_char .and new_line;
+ '#' .and .loop comment_char .and optional_new_line;
/* All ASCII characters except '\r', '\n' and '\0' */
comment_char
'\x0E'-'\xFF' .or '\x01'-'\x09' .or '\x0B'-'\x0C';
-new_line
- '\n' .or crlf .or '\0';
+optional_new_line
+ '\n' .or crlf .or .true;
crlf
'\r' .and '\n';