Mesa (arb_geometry_shader4): gs: better builtins

Zack Rusin zack at kemper.freedesktop.org
Sun Feb 15 15:22:37 PST 2009


Module: Mesa
Branch: arb_geometry_shader4
Commit: ef5b801f027be6b8085ca6737d3612d5843509ef
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ef5b801f027be6b8085ca6737d3612d5843509ef

Author: Zack Rusin <zackr at vmware.com>
Date:   Sun Feb 15 18:19:44 2009 -0500

gs: better builtins

this is obviously broken but currently slang does not allow
global int's and variable sized arrays...

---

 .../shader/slang/library/slang_geometry_builtin.gc |   23 ++++++++++---------
 src/mesa/shader/slang/slang_compile.c              |    5 ++-
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/mesa/shader/slang/library/slang_geometry_builtin.gc b/src/mesa/shader/slang/library/slang_geometry_builtin.gc
index b6c96da..7273062 100644
--- a/src/mesa/shader/slang/library/slang_geometry_builtin.gc
+++ b/src/mesa/shader/slang/library/slang_geometry_builtin.gc
@@ -20,21 +20,22 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-attribute int gl_VerticesIn;
+const int gl_VerticesIn = 6;
 
-varying vec4 gl_FrontColorIn[];
-varying vec4 gl_BackColorIn[];
-varying vec4 gl_FrontSecondaryColorIn[];
-varying vec4 gl_BackSecondaryColorIn[];
-//varying vec4 gl_TexCoordIn[][];
-varying float gl_FogFragCoordIn[];
-varying vec4 gl_PositionIn[];
-varying float gl_PointSizeIn[];
-varying vec4 gl_ClipVertexIn[];
+varying vec4 gl_FrontColorIn[gl_VerticesIn];
+varying vec4 gl_BackColorIn[gl_VerticesIn];
+varying vec4 gl_FrontSecondaryColorIn[gl_VerticesIn];
+varying vec4 gl_BackSecondaryColorIn[gl_VerticesIn];
+//varying vec4 gl_TexCoordIn[gl_VerticesIn][gl_MaxTextureCoords];
+varying float gl_FogFragCoordIn[gl_VerticesIn];
+varying vec4 gl_PositionIn[gl_VerticesIn];
+varying float gl_PointSizeIn[gl_VerticesIn];
+varying vec4 gl_ClipVertexIn[gl_VerticesIn];
 
 varying vec4 gl_FrontColor;
 varying vec4 gl_BackColor;
 varying vec4 gl_FrontSecondaryColor;
 varying vec4 gl_BackSecondaryColor;
-varying vec4 gl_TexCoord[];
+varying vec4 gl_TexCoord[gl_VerticesIn];
 varying float gl_FogFragCoord;
+
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index b9dc6f7..01f5448 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -2618,7 +2618,8 @@ compile_object(grammar * id, const char *source, slang_code_object * object,
    grammar_set_reg8(*id, (const byte *) "parsing_builtin", 1);
 
    /* if parsing user-specified shader, load built-in library */
-   if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_VERTEX_SHADER) {
+   if (type == SLANG_UNIT_FRAGMENT_SHADER || type == SLANG_UNIT_VERTEX_SHADER ||
+       type == SLANG_UNIT_GEOMETRY_SHADER) {
       /* compile core functionality first */
       if (!compile_binary(slang_core_gc,
                           &object->builtin[SLANG_BUILTIN_CORE],
@@ -2709,7 +2710,7 @@ compile_shader(GLcontext *ctx, slang_code_object * object,
    GLboolean success;
    grammar id = 0;
 
-#if 0 /* for debug */
+#if 1 /* for debug */
    _mesa_printf("********* COMPILE SHADER ***********\n");
    _mesa_printf("%s\n", shader->Source);
    _mesa_printf("************************************\n");



More information about the mesa-commit mailing list