X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=docs%2Fshading.html;h=aba3959742929273b8792b2c98d4fdcea6349cbe;hb=509ddb0a0414cfc83102c463da542d95d83eabad;hp=64ec9990d0a72220f8942efd97b22a07f54fb1f5;hpb=ba3d384e94faaedd4b1e0a90c1a765452bf594f3;p=mesa.git diff --git a/docs/shading.html b/docs/shading.html index 64ec9990d0a..aba39597429 100644 --- a/docs/shading.html +++ b/docs/shading.html @@ -14,37 +14,85 @@ This page describes the features and status of Mesa's support for the OpenGL Shading Language.

-

-Last updated on 28 March 2007. -

-

Contents

+ + +

Environment Variables

+ +

+The MESA_GLSL 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. +

+ +

+Example: export MESA_GLSL=dump,nopt +

+ + +
+

GLSL Version

+ +

+The GLSL compiler currently supports version 1.20 of the shading language. +

+ +

+Several GLSL extensions are also supported: +

+ + +

Unsupported Features

+

XXX update this section

+

-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:

@@ -67,7 +115,6 @@ All other major features of the shading language should function.

  • The quality of generated code is pretty good, register usage is fair.
  • Shader error detection and reporting of errors (InfoLog) is not very good yet. -
  • There are known memory leaks in the compiler.
  • The ftransform() function doesn't necessarily match the results of fixed-function transformation. @@ -81,39 +128,6 @@ These issues will be addressed/resolved in the future.

    Programming Hints

    -

    Stand-alone Compiler

    - -

    -A unique stand-alone GLSL compiler driver has been added to Mesa. -

    +

    Stand-alone GLSL Compiler

    -The stand-alone compiler (like a conventional command-line compiler) -is a tool that accepts Shading Language programs and emits low-level -GPU programs. +The stand-alone GLSL compiler program can be used to compile GLSL shaders +into low-level GPU code.

    @@ -152,48 +159,25 @@ This tool is useful for:

    -To build the glslcompiler program (this will be improved someday): +After building Mesa, the compiler can be found at src/glsl/glsl_compiler

    -
    -    cd src/mesa
    -    make libmesa.a
    -    cd drivers/glslcompiler
    -    make
    -
    -

    Here's an example of using the compiler to compile a vertex shader and emit GL_ARB_vertex_program-style instructions:

    -    glslcompiler --arb --linenumbers --vs vertshader.txt
    -
    -

    -The output may look similar to this: -

    -
    -!!ARBvp1.0
    -  0: MOV result.texcoord[0], vertex.texcoord[0];
    -  1: DP4 temp0.x, state.matrix.mvp.row[0], vertex.position;
    -  2: DP4 temp0.y, state.matrix.mvp.row[1], vertex.position;
    -  3: DP4 temp0.z, state.matrix.mvp.row[2], vertex.position;
    -  4: DP4 temp0.w, state.matrix.mvp.row[3], vertex.position;
    -  5: MOV result.position, temp0;
    -  6: END
    +    src/glsl/glsl_compiler --dump-ast myshader.vert
     
    -

    -Note that some shading language constructs (such as uniform and varying -variables) aren't expressible in ARB or NV-style programs. -Therefore, the resulting output is not always legal by definition of -those program languages. -

    -

    -Also note that this compiler driver is still under development. -Over time, the correctness of the GPU programs, with respect to the ARB -and NV languagues, should improve. -

    +Options include + + @@ -202,38 +186,12 @@ and NV languagues, should improve.

    The source code for Mesa's shading language compiler is in the -src/mesa/shader/slang/ directory. +src/glsl/ directory.

    -The compiler follows a fairly standard design and basically works as follows: +XXX provide some info about the compiler....

    -

    The final vertex and fragment programs may be interpreted in software @@ -291,20 +249,20 @@ Extra NOP instructions will also be inserted.

    Compiler Validation

    -A new Glean test has -been create to exercise the GLSL compiler. -

    -

    -The glsl1 test runs over 150 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 +Developers working on the GLSL compiler should test frequently to avoid regressions.

    +

    -The test coverage is reasonably broad and complete but additional tests -should be added. +The Piglit project +has many GLSL tests and the +Glean glsl1 test +tests GLSL features.

    +

    +The Mesa demos repository also has some good GLSL tests. +