summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-10-06 15:56:38 +0000
committerBrian Paul <[email protected]>2004-10-06 15:56:38 +0000
commitfb170c8bd71e649807a9e86e7290c973bc34b206 (patch)
tree3bc1358d0812ab359492454de10cb4c4b252afb0
parent0b89f7a93a234491b4fa967450de500c4e29e789 (diff)
more GL_ARB_draw_buffers updates from Michale Krol
-rw-r--r--src/mesa/shader/arbprogram.syn63
-rw-r--r--src/mesa/shader/arbprogram_syn.h54
2 files changed, 54 insertions, 63 deletions
diff --git a/src/mesa/shader/arbprogram.syn b/src/mesa/shader/arbprogram.syn
index a4e3a20222e..75db7a7942a 100644
--- a/src/mesa/shader/arbprogram.syn
+++ b/src/mesa/shader/arbprogram.syn
@@ -31,6 +31,17 @@
/* GL_ARB_fragment_program_shadow option flags */
.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40
+/* GL_ARB_draw_buffers option flags */
+.emtcode ARB_DRAW_BUFFERS 0x80
+
+/* if we need more flags, we have three options:
+ 1) change the existing flags to indicate an option to a shift, so 0x01 becomes 0 (because
+ 1 << 0 is 0x01), 0x02 becomes 1 (1 << 1 == 0x02), and so on - this would give us
+ 256 flags,
+ 2) mark special value of 0 to say "the following byte will hold the upper 8 bit flags",
+ 3) expand all the existing flags to be 2 bytes long
+*/
+
/* GL_ARB_fragment_program instruction class */
.emtcode OP_ALU_INST 0x00
.emtcode OP_TEX_INST 0x01
@@ -400,6 +411,9 @@
/* GL_ARB_fragment_program_shadow */
.regbyte fragment_program_shadow 0x00
+/* GL_ARB_draw_buffers */
+.regbyte draw_buffers 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. */
@@ -417,6 +431,9 @@
/* GL_ARB_fragment_program_shadow */
.regbyte ARB_fragment_program_shadow 0x00
+/* GL_ARB_draw_buffers */
+.regbyte ARB_draw_buffers 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. */
@@ -482,7 +499,9 @@ fp_optionString
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;
vp_optionString
"ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
fp_ARB_fog_exp
@@ -1952,7 +1971,7 @@ stateClipPlaneNum
/*
vertex program
- <statePointItem> ::= "point" . <statePointProperty>
+ <statePointItem> ::= "point" "." <statePointProperty>
*/
statePointItem
"point" .and dot .and statePointProperty .error INVALID_POINT_PROPERTY;
@@ -1992,7 +2011,7 @@ optMatrixRows_1
stateMatrixRowNum .and dotdot .and stateMatrixRowNum .and rbracket;
/*
- <stateMatrixItem> ::= "matrix" . <stateMatrixName>
+ <stateMatrixItem> ::= "matrix" "." <stateMatrixName>
<stateOptMatModifier>
*/
stateMatrixItem
@@ -2064,23 +2083,6 @@ 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> "]"
*/
@@ -2322,9 +2324,9 @@ vp_OUTPUT_statement
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
@@ -2353,6 +2355,23 @@ 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>
*/
diff --git a/src/mesa/shader/arbprogram_syn.h b/src/mesa/shader/arbprogram_syn.h
index f7bc69e9939..6bcf3989ef0 100644
--- a/src/mesa/shader/arbprogram_syn.h
+++ b/src/mesa/shader/arbprogram_syn.h
@@ -1,34 +1,3 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.1
- *
- * 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.h
- * ARB_fragment_program/ARB_vertex_program syntax
- * \author Michal Krol
- */
-
-
".syntax program;\n"
".emtcode REVISION 0x08\n"
".emtcode FRAGMENT_PROGRAM 0x01\n"
@@ -44,6 +13,7 @@
".emtcode ARB_FOG_LINEAR 0x10\n"
".emtcode ARB_POSITION_INVARIANT 0x20\n"
".emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x40\n"
+".emtcode ARB_DRAW_BUFFERS 0x80\n"
".emtcode OP_ALU_INST 0x00\n"
".emtcode OP_TEX_INST 0x01\n"
".emtcode OP_ALU_VECTOR 0x00\n"
@@ -293,6 +263,7 @@
".regbyte fog_coord 0x00\n"
".regbyte texture_rectangle 0x00\n"
".regbyte fragment_program_shadow 0x00\n"
+".regbyte draw_buffers 0x00\n"
".regbyte ARB_precision_hint_fastest 0x00\n"
".regbyte ARB_precision_hint_nicest 0x00\n"
".regbyte ARB_fog_exp 0x00\n"
@@ -300,6 +271,7 @@
".regbyte ARB_fog_linear 0x00\n"
".regbyte ARB_position_invariant 0x00\n"
".regbyte ARB_fragment_program_shadow 0x00\n"
+".regbyte ARB_draw_buffers 0x00\n"
".regbyte program_target 0x00\n"
"program\n"
" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n"
@@ -335,7 +307,9 @@
" fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or\n"
" fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or\n"
" .if (fragment_program_shadow != 0x00) \"ARB_fragment_program_shadow\"\n"
-" .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01;\n"
+" .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or\n"
+" .if (draw_buffers != 0x00) \"ARB_draw_buffers\" .emit ARB_DRAW_BUFFERS\n"
+" .load ARB_draw_buffers 0x01;\n"
"vp_optionString\n"
" \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;\n"
"fp_ARB_fog_exp\n"
@@ -1008,13 +982,6 @@
" lbracket_ne .and stateModMatNum .and rbracket;\n"
"stateModMatNum\n"
" integer;\n"
-"optOutputColorNum\n"
-" optOutputColorNum_1 .or .true .emit 0x00;\n"
-"optOutputColorNum_1\n"
-" lbracket_ne .and outputColorNum .and rbracket;\n"
-" \n"
-"outputColorNum\n"
-" integer;\n"
"optTexCoordNum\n"
" optTexCoordNum_1 .or .true .emit 0x00;\n"
"optTexCoordNum_1\n"
@@ -1121,6 +1088,12 @@
" vp_resultBinding_2 .emit VERTEX_RESULT_TEXCOORD;\n"
"vp_resultBinding_2\n"
" \"texcoord\" .and optTexCoordNum;\n"
+"optOutputColorNum\n"
+" .if (ARB_draw_buffers != 0x00) optOutputColorNum_1 .or .true .emit 0x00;\n"
+"optOutputColorNum_1\n"
+" lbracket_ne .and outputColorNum .and rbracket;\n"
+"outputColorNum\n"
+" integer;\n"
"resultColBinding\n"
" \"color\" .and optFaceType .and optColorType;\n"
"optFaceType\n"
@@ -1351,5 +1324,4 @@
" '0'-'9';\n"
"e_charordigit\n"
" 'A'-'Z' .or 'a'-'z' .or '0'-'9';\n"
-""
-
+"" \ No newline at end of file