X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=docs%2Fshading.html;h=bd02335a803d0ccd4bb9512c9b8bc0b59e0f1f16;hb=d2758f3b74838f4d4f1ae691fddca7dc9f4e8c0e;hp=40a6d7ac90b767f7c5674b7841004d3872d307f5;hpb=8f9db0f81c13c3244f07333f33a15bfe098e0f31;p=mesa.git diff --git a/docs/shading.html b/docs/shading.html index 40a6d7ac90b..bd02335a803 100644 --- a/docs/shading.html +++ b/docs/shading.html @@ -15,36 +15,90 @@ OpenGL Shading Language.
-Last updated on 17 Feb 2007. +Last updated on 15 December 2008.
Contents
+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 1.20 is supported in Mesa 7.3 and later. +Among the features/differences of GLSL 1.20 are: +
mat2x3, mat2x4
, etc. types and functions
+transpose(), outerProduct(), matrixCompMult()
functions
+(but untested)
+invariant
qualifier
+array.length()
method
+float[5] a;
array syntax
+centroid
qualifier
+-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 +121,8 @@ All other major features of the shading language should function.
@@ -121,11 +176,14 @@ These issues will be addressed/resolved in the future.
float x = inversesqrt(y);+
A unique stand-alone GLSL compiler driver has been added to Mesa. @@ -147,12 +205,12 @@ This tool is useful for:
-To build the glslcompiler program (this will be improved someday): +After building Mesa, the glslcompiler can be built by manually running:
- cd src/mesa - make libmesa.a - cd drivers/glslcompiler + make realclean + make linux + cd src/mesa/drivers/glslcompiler make@@ -162,20 +220,31 @@ 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 + bin/glslcompiler --debug --numbers --fs progs/glsl/CH06-brick.frag.txt
-The output may look similar to this: +results in:
-!!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 +# Fragment Program/Shader + 0: RCP TEMP[4].x, UNIFORM[2].xxxx; + 1: RCP TEMP[4].y, UNIFORM[2].yyyy; + 2: MUL TEMP[3].xy, VARYING[0], TEMP[4]; + 3: MOV TEMP[1], TEMP[3]; + 4: MUL TEMP[0].w, TEMP[1].yyyy, CONST[4].xxxx; + 5: FRC TEMP[1].z, TEMP[0].wwww; + 6: SGT.C TEMP[0].w, TEMP[1].zzzz, CONST[4].xxxx; + 7: IF (NE.wwww); # (if false, goto 9); + 8: ADD TEMP[1].x, TEMP[1].xxxx, CONST[4].xxxx; + 9: ENDIF; + 10: FRC TEMP[1].xy, TEMP[1]; + 11: SGT TEMP[2].xy, UNIFORM[3], TEMP[1]; + 12: MUL TEMP[1].z, TEMP[2].xxxx, TEMP[2].yyyy; + 13: LRP TEMP[0], TEMP[1].zzzz, UNIFORM[0], UNIFORM[1]; + 14: MUL TEMP[0].xyz, TEMP[0], VARYING[1].xxxx; + 15: MOV OUTPUT[0].xyz, TEMP[0]; + 16: MOV OUTPUT[0].w, CONST[4].yyyy; + 17: END
@@ -282,5 +351,24 @@ Extra NOP instructions will also be inserted.
+
+
+A Glean test has
+been create to exercise the GLSL compiler.
+
+The glsl1 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.
+
+The test coverage is reasonably broad and complete but additional tests
+should be added.
+Compiler Validation
+
+