Merge branch 'mesa_7_7_branch'
[mesa.git] / docs / shading.html
index 2cd17c76ac927fede0709978942559766d26ed6a..bd02335a803d0ccd4bb9512c9b8bc0b59e0f1f16 100644 (file)
@@ -15,41 +15,90 @@ OpenGL Shading Language</a>.
 </p>
 
 <p>
-Last updated on 28 March 2007.
+Last updated on 15 December 2008.
 </p>
 
 <p>
 Contents
 </p>
 <ul>
+<li><a href="#envvars">Environment variables</a>
+<li><a href="#120">GLSL 1.20 support</a>
 <li><a href="#unsup">Unsupported Features</a>
 <li><a href="#notes">Implementation Notes</a>
 <li><a href="#hints">Programming Hints</a>
 <li><a href="#standalone">Stand-alone GLSL Compiler</a>
 <li><a href="#implementation">Compiler Implementation</a>
 <li><a href="#validation">Compiler Validation</a>
-<li><a href="#120">GLSL 1.20 support</a>
 </ul>
 
 
+
+<a name="envvars">
+<h2>Environment Variables</h2>
+
+<p>
+The <b>MESA_GLSL</b> environment variable can be set to a comma-separated
+list of keywords to control some aspects of the GLSL compiler and shader
+execution.  These are generally used for debugging.
+</p>
+<ul>
+<li>dump - print GLSL shader code to stdout at link time
+<li>log - log all GLSL shaders to files.
+    The filenames will be "shader_X.vert" or "shader_X.frag" where X
+    the shader ID.
+<li>nopt - disable compiler optimizations
+<li>opt - force compiler optimizations
+<li>uniform - print message to stdout when glUniform is called
+<li>nopvert - force vertex shaders to be a simple shader that just transforms
+    the vertex position with ftransform() and passes through the color and
+    texcoord[0] attributes.
+<li>nopfrag - force fragment shader to be a simple shader that passes
+    through the color attribute.
+<li>useprog - log glUseProgram calls to stderr
+</ul>
+<p>
+Example:  export MESA_GLSL=dump,nopt
+</p>
+
+
+<a name="120">
+<h2>GLSL 1.20 support</h2>
+
+<p>
+GLSL version 1.20 is supported in Mesa 7.3 and later.
+Among the features/differences of GLSL 1.20 are:
+<ul>
+<li><code>mat2x3, mat2x4</code>, etc. types and functions
+<li><code>transpose(), outerProduct(), matrixCompMult()</code> functions
+(but untested)
+<li>precision qualifiers (lowp, mediump, highp)
+<li><code>invariant</code> qualifier
+<li><code>array.length()</code> method
+<li><code>float[5] a;</code> array syntax
+<li><code>centroid</code> qualifier
+<li>unsized array constructors
+<li>initializers for uniforms
+<li>const initializers calling built-in functions
+</ul>
+
+
+
 <a name="unsup">
 <h2>Unsupported Features</h2>
 
 <p>
-The following features of the shading language are not yet supported
+The following features of the shading language are not yet fully supported
 in Mesa:
 </p>
 
 <ul>
-<li>Dereferencing arrays with non-constant indexes
-<li>Comparison of user-defined structs
-<li>Linking of multiple shaders is not supported
+<li>Linking of multiple shaders does not always work.  Currently, linking
+    is implemented through shader concatenation and re-compiling.  This
+    doesn't always work because of some #pragma and preprocessor issues.
 <li>gl_ClipVertex
-<li>The derivative functions such as dFdx() are not implemented
-<li>The inverse trig functions asin(), acos(), and atan() are not implemented
 <li>The gl_Color and gl_SecondaryColor varying vars are interpolated
     without perspective correction
-<li>Floating point literal suffixes 'f' and 'F' aren't allowed.
 </ul>
 
 <p>
@@ -159,6 +208,8 @@ This tool is useful for:
 After building Mesa, the glslcompiler can be built by manually running:
 </p>
 <pre>
+    make realclean
+    make linux
     cd src/mesa/drivers/glslcompiler
     make
 </pre>
@@ -304,11 +355,11 @@ Extra NOP instructions will also be inserted.
 <h2>Compiler Validation</h2>
 
 <p>
-A new <a href="http://glean.sf.net" target="_parent">Glean</a> test has
+A <a href="http://glean.sf.net" target="_parent">Glean</a> test has
 been create to exercise the GLSL compiler.
 </p>
 <p>
-The <em>glsl1</em> test runs over 150 sub-tests to check that the language
+The <em>glsl1</em> test runs over 170 sub-tests to check that the language
 features and built-in functions work properly.
 This test should be run frequently while working on the compiler to catch
 regressions.
@@ -319,39 +370,5 @@ should be added.
 </p>
 
 
-
-<a name="120">
-<h2>GLSL 1.20 support</h2>
-
-<p>
-Support for GLSL version 1.20 is underway.  Status as follows.
-</p>
-
-<h3>Supported</h3>
-<ul>
-<li><code>mat2x3, mat2x4</code>, etc. types and functions
-<li><code>transpose(), outerProduct(), matrixCompMult()</code> functions
-(but untested)
-<li>precision qualifiers (lowp, mediump, highp)
-</ul>
-
-<h3>Partially Complete</h3>
-<ul>
-<li><code>invariant</code> qualifier
-</ul>
-
-<h3>Not Completed</h3>
-<ul>
-<li><code>array.length()</code> method
-<li><code>float[5] a;</code> array syntax
-<li><code>centroid</code> qualifier
-<li>unsized array constructors
-<li>initializers for uniforms
-<li>const initializers calling built-in functions
-</ul>
-
-
-
-
 </BODY>
 </HTML>