* Mesa 3-D graphics library\r
* Version: 6.2\r
*\r
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.\r
+ * Copyright (C) 2004-2005 Brian Paul All Rights Reserved.\r
*\r
* Permission is hereby granted, free of charge, to any person obtaining a\r
* copy of this software and associated documentation files (the "Software"),\r
\r
/*\r
* \file slang_shader.syn\r
- * slang shader syntax\r
+ * slang vertex/fragment shader syntax\r
* \author Michal Krol\r
*/\r
\r
.syntax translation_unit;\r
\r
/* revision number - increment after each change affecting emitted output */\r
-.emtcode REVISION 1\r
+.emtcode REVISION 2\r
\r
/* external declaration */\r
.emtcode EXTERNAL_NULL 0\r
.emtcode TYPE_QUALIFIER_ATTRIBUTE 2\r
.emtcode TYPE_QUALIFIER_VARYING 3\r
.emtcode TYPE_QUALIFIER_UNIFORM 4\r
+.emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\r
+.emtcode TYPE_QUALIFIER_FIXEDINPUT 6\r
\r
/* type specifier */\r
.emtcode TYPE_SPECIFIER_VOID 0\r
/* the implementation will set it to 1 when compiling internal built-in shaders */\r
.regbyte parsing_builtin 0\r
\r
-/* holds the type of shader that is being parsed, possible values are listed below */\r
+/* holds the type of the shader being parsed; possible values are listed below */\r
/* FRAGMENT_SHADER 1 */\r
/* VERTEX_SHADER 2 */\r
/* shader type is set by the caller before parsing */\r
| "attribute" // Vertex only.\r
| "varying"\r
| "uniform"\r
+ | "__fixed_output"\r
+ | "__fixed_input"\r
+\r
+note: this is an extension to the standard language specification - normally slang disallows\r
+ __fixed_output and __fixed_input type qualifiers\r
*/\r
type_qualifier\r
"const" .emit TYPE_QUALIFIER_CONST .or\r
.if (shader_type == 2) "attribute" .emit TYPE_QUALIFIER_ATTRIBUTE .or\r
"varying" .emit TYPE_QUALIFIER_VARYING .or\r
- "uniform" .emit TYPE_QUALIFIER_UNIFORM;\r
+ "uniform" .emit TYPE_QUALIFIER_UNIFORM .or\r
+ .if (parsing_builtin != 0) "__fixed_output" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\r
+ .if (parsing_builtin != 0) "__fixed_input" .emit TYPE_QUALIFIER_FIXEDINPUT;\r
\r
/*\r
<type_specifier> ::= "void"\r
| <declaration_statement>\r
*/\r
for_init_statement\r
- expression_statement .or declaration_statement;\r
+ expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\r
\r
/*\r
<conditionopt> ::= <condition>\r
".syntax translation_unit;\n"\r
-".emtcode REVISION 1\n"\r
+".emtcode REVISION 2\n"\r
".emtcode EXTERNAL_NULL 0\n"\r
".emtcode EXTERNAL_FUNCTION_DEFINITION 1\n"\r
".emtcode EXTERNAL_DECLARATION 2\n"\r
".emtcode TYPE_QUALIFIER_ATTRIBUTE 2\n"\r
".emtcode TYPE_QUALIFIER_VARYING 3\n"\r
".emtcode TYPE_QUALIFIER_UNIFORM 4\n"\r
+".emtcode TYPE_QUALIFIER_FIXEDOUTPUT 5\n"\r
+".emtcode TYPE_QUALIFIER_FIXEDINPUT 6\n"\r
".emtcode TYPE_SPECIFIER_VOID 0\n"\r
".emtcode TYPE_SPECIFIER_BOOL 1\n"\r
".emtcode TYPE_SPECIFIER_BVEC2 2\n"\r
" \"const\" .emit TYPE_QUALIFIER_CONST .or\n"\r
" .if (shader_type == 2) \"attribute\" .emit TYPE_QUALIFIER_ATTRIBUTE .or\n"\r
" \"varying\" .emit TYPE_QUALIFIER_VARYING .or\n"\r
-" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM;\n"\r
+" \"uniform\" .emit TYPE_QUALIFIER_UNIFORM .or\n"\r
+" .if (parsing_builtin != 0) \"__fixed_output\" .emit TYPE_QUALIFIER_FIXEDOUTPUT .or\n"\r
+" .if (parsing_builtin != 0) \"__fixed_input\" .emit TYPE_QUALIFIER_FIXEDINPUT;\n"\r
"type_specifier_space\n"\r
" \"void\" .emit TYPE_SPECIFIER_VOID .or\n"\r
" \"float\" .emit TYPE_SPECIFIER_FLOAT .or\n"\r
" \"for\" .emit OP_FOR .and lparen .error LPAREN_EXPECTED .and for_init_statement .and\n"\r
" for_rest_statement .and rparen .error RPAREN_EXPECTED .and statement_no_new_scope;\n"\r
"for_init_statement\n"\r
-" expression_statement .or declaration_statement;\n"\r
+" expression_statement .emit OP_EXPRESSION .or declaration_statement .emit OP_DECLARE;\n"\r
"conditionopt\n"\r
" condition .or\n"\r
" .true .emit OP_EXPRESSION .emit OP_PUSH_BOOL .emit 2 .emit '1' .emit '\\0' .emit OP_END;\n"\r