docs/release-calendar: Update for extended 19.3 rc period
[mesa.git] / docs / shading.html
index a12487bb86c7fee801ec865ab4f41aab13e18d99..839a61a0361380dd00ff829aafe23e9f97f53b42 100644 (file)
@@ -2,23 +2,23 @@
 <html lang="en">
 <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
-  <title>Shading Language Support</title>
+  <title>Shading Language</title>
   <link rel="stylesheet" type="text/css" href="mesa.css">
 </head>
 <body>
 
 <div class="header">
-  <h1>The Mesa 3D Graphics Library</h1>
+  The Mesa 3D Graphics Library
 </div>
 
 <iframe src="contents.html"></iframe>
 <div class="content">
 
-<h1>Shading Language Support</h1>
+<h1>Shading Language</h1>
 
 <p>
 This page describes the features and status of Mesa's support for the
-<a href="http://opengl.org/documentation/glsl/">
+<a href="https://opengl.org/documentation/glsl/">
 OpenGL Shading Language</a>.
 </p>
 
@@ -27,7 +27,7 @@ Contents
 </p>
 <ul>
 <li><a href="#envvars">Environment variables</a>
-<li><a href="#glsl120">GLSL 1.20 support</a>
+<li><a href="#support">GLSL 1.40 support</a>
 <li><a href="#unsup">Unsupported Features</a>
 <li><a href="#notes">Implementation Notes</a>
 <li><a href="#hints">Programming Hints</a>
@@ -49,8 +49,9 @@ execution.  These are generally used for debugging.
 <li><b>log</b> - log all GLSL shaders to files.
     The filenames will be "shader_X.vert" or "shader_X.frag" where X
     the shader ID.
-<li><b>nopt</b> - disable compiler optimizations
-<li><b>opt</b> - force compiler optimizations
+<li><b>cache_info</b> - print debug information about shader cache
+<li><b>cache_fb</b> - force cached shaders to be ignored and do a full
+    recompile via the fallback path</li>
 <li><b>uniform</b> - print message to stdout when glUniform is called
 <li><b>nopvert</b> - force vertex shaders to be a simple shader that just transforms
     the vertex position with ftransform() and passes through the color and
@@ -58,16 +59,46 @@ execution.  These are generally used for debugging.
 <li><b>nopfrag</b> - force fragment shader to be a simple shader that passes
     through the color attribute.
 <li><b>useprog</b> - log glUseProgram calls to stderr
+<li><b>errors</b> - GLSL compilation and link errors will be reported to stderr.
 </ul>
 <p>
 Example:  export MESA_GLSL=dump,nopt
 </p>
 
+<h3 id="replacement">Experimenting with Shader Replacements</h3>
+<p>
+Shaders can be dumped and replaced on runtime for debugging purposes. This
+feature is not currently supported by SCons build.
+
+This is controlled via following environment variables:
+</p>
+<ul>
+<li><b>MESA_SHADER_DUMP_PATH</b> - path where shader sources are dumped
+<li><b>MESA_SHADER_READ_PATH</b> - path where replacement shaders are read
+</ul>
+Note, path set must exist before running for dumping or replacing to work. 
+When both are set, these paths should be different so the dumped shaders do 
+not clobber the replacement shaders. Also, the filenames of the replacement shaders
+should match the filenames of the corresponding dumped shaders.
 
-<h2 id="glsl120">GLSL Version</h2>
+<h3 id="capture">Capturing Shaders</h3>
 
 <p>
-The GLSL compiler currently supports version 1.20 of the shading language.
+Setting <b>MESA_SHADER_CAPTURE_PATH</b> to a directory will cause the compiler
+to write <code>.shader_test</code> files for use with
+<a href="https://gitlab.freedesktop.org/mesa/shader-db">shader-db</a>, a tool
+which compiler developers can use to gather statistics about shaders
+(instructions, cycles, memory accesses, and so on).
+</p>
+<p>
+Notably, this captures linked GLSL shaders - with all stages together -
+as well as ARB programs.
+</p>
+
+<h2 id="support">GLSL Version</h2>
+
+<p>
+The GLSL compiler currently supports version 3.30 of the shading language.
 </p>
 
 <p>
@@ -75,9 +106,8 @@ Several GLSL extensions are also supported:
 </p>
 <ul>
 <li>GL_ARB_draw_buffers
-<li>GL_ARB_texture_rectangle
 <li>GL_ARB_fragment_coord_conventions
-<li>GL_EXT_texture_array
+<li>GL_ARB_shader_bit_encoding
 </ul>
 
 
@@ -94,7 +124,6 @@ in Mesa:
 <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 gl_Color and gl_SecondaryColor varying vars are interpolated
     without perspective correction
 </ul>
@@ -160,7 +189,7 @@ This tool is useful for:
 </ul>
 
 <p>
-After building Mesa, the compiler can be found at src/glsl/glsl_compiler
+After building Mesa, the compiler can be found at src/compiler/glsl/glsl_compiler
 </p>
 
 <p>
@@ -168,7 +197,7 @@ Here's an example of using the compiler to compile a vertex shader and
 emit GL_ARB_vertex_program-style instructions:
 </p>
 <pre>
-    src/glsl/glsl_compiler --dump-ast myshader.vert
+    src/compiler/glsl/glsl_compiler --version XXX --dump-ast myshader.vert
 </pre>
 
 Options include
@@ -176,7 +205,11 @@ Options include
 <li><b>--dump-ast</b> - dump GPU code
 <li><b>--dump-hir</b> - dump high-level IR code
 <li><b>--dump-lir</b> - dump low-level IR code
-<li><b>--link</b> - ???
+<li><b>--dump-builder</b> - dump GLSL IR code
+<li><b>--link</b> - link shaders
+<li><b>--just-log</b> - display only shader / linker info if exist,
+without any header or separator
+<li><b>--version</b> - [Mandatory] define the GLSL version to use
 </ul>
 
 
@@ -184,7 +217,7 @@ Options include
 
 <p>
 The source code for Mesa's shading language compiler is in the
-<code>src/glsl/</code> directory.
+<code>src/compiler/glsl/</code> directory.
 </p>
 
 <p>
@@ -197,51 +230,6 @@ The final vertex and fragment programs may be interpreted in software
 (see drivers/dri/i915/i915_fragprog.c for example).
 </p>
 
-<h3>Code Generation Options</h3>
-
-<p>
-Internally, there are several options that control the compiler's code
-generation and instruction selection.
-These options are seen in the gl_shader_state struct and may be set
-by the device driver to indicate its preferences:
-
-<pre>
-struct gl_shader_state
-{
-   ...
-   /** Driver-selectable options: */
-   GLboolean EmitHighLevelInstructions;
-   GLboolean EmitCondCodes;
-   GLboolean EmitComments;
-};
-</pre>
-
-<dl>
-<dt>EmitHighLevelInstructions</dt>
-<dd>
-This option controls instruction selection for loops and conditionals.
-If the option is set high-level IF/ELSE/ENDIF, LOOP/ENDLOOP, CONT/BRK
-instructions will be emitted.
-Otherwise, those constructs will be implemented with BRA instructions.
-</dd>
-
-<dt>EmitCondCodes</dt>
-<dd>
-If set, condition codes (ala GL_NV_fragment_program) will be used for
-branching and looping.
-Otherwise, ordinary registers will be used (the IF instruction will
-examine the first operand's X component and do the if-part if non-zero).
-This option is only relevant if EmitHighLevelInstructions is set.
-</dd>
-
-<dt>EmitComments</dt>
-<dd>
-If set, instructions will be annoted with comments to help with debugging.
-Extra NOP instructions will also be inserted.
-</dd>
-</dl>
-
-
 <h2 id="validation">Compiler Validation</h2>
 
 <p>
@@ -250,9 +238,8 @@ regressions.
 </p>
 
 <p>
-The <a href="http://piglit.freedesktop.org/">Piglit</a> project
-has many GLSL tests and the
-<a href="http://glean.sf.net">Glean</a> glsl1 test tests GLSL features.
+The <a href="https://piglit.freedesktop.org/">Piglit</a> project
+has many GLSL tests.
 </p>
 
 <p>