From 3bfedb7ed4a35cfcc7187bc22314833ef1d96ec9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 17 Jul 2008 15:40:10 -0600 Subject: [PATCH] mesa: build the stand-alone glslcompiler by default, update the docs --- configs/default | 2 +- docs/shading.html | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/configs/default b/configs/default index a14078fa269..36dc483c9af 100644 --- a/configs/default +++ b/configs/default @@ -67,7 +67,7 @@ GLW_SOURCES = GLwDrawA.c LIB_DIR = lib SRC_DIRS = mesa glu glut/glx glw GLU_DIRS = sgi -DRIVER_DIRS = x11 osmesa +DRIVER_DIRS = x11 osmesa glslcompiler # Which subdirs under $(TOP)/progs/ to enter: PROGRAM_DIRS = demos redbook samples glsl xdemos diff --git a/docs/shading.html b/docs/shading.html index 0a9f5f36f40..1a60e5b708d 100644 --- a/docs/shading.html +++ b/docs/shading.html @@ -25,7 +25,7 @@ Contents
  • Unsupported Features
  • Implementation Notes
  • Programming Hints -
  • Stand-alone Compiler +
  • Stand-alone GLSL Compiler
  • Compiler Implementation
  • Compiler Validation @@ -133,7 +133,7 @@ These issues will be addressed/resolved in the future. -

    Stand-alone Compiler

    +

    Stand-alone GLSL Compiler

    A unique stand-alone GLSL compiler driver has been added to Mesa. @@ -155,12 +155,11 @@ This tool is useful for:

    -To build the glslcompiler program (this will be improved someday): +After building Mesa the glslcompiler should be found in the Mesa/bin/ directory. +If it's not there, it can be built manually:

    -    cd src/mesa
    -    make libmesa.a
    -    cd drivers/glslcompiler
    +    cd src/mesa/drivers/glslcompiler
         make
     
    @@ -170,20 +169,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
     

    -- 2.30.2