mesa: Branch 'glsl-compiler-1' - 3 commits

Brian Paul brianp at kemper.freedesktop.org
Mon Mar 19 20:44:27 UTC 2007


 src/mesa/main/colortab.c |    8 ++++++--
 src/mesa/main/shaders.c  |   32 +++++++++++++++++++-------------
 src/mesa/tnl/t_context.c |   20 +++++++++++++-------
 3 files changed, 38 insertions(+), 22 deletions(-)

New commits:
diff-tree fdcbbeb55ecafe119bb98dcedb8492416f5bc966 (from e348016253582e6a31f7ee7149ff4999de33642d)
Author: Brian <brian at yutani.localnet.net>
Date:   Mon Mar 19 14:44:15 2007 -0600

    Properly compute render_inputs_bitset when using a vertex program/shader.
    
    This fixes a performance regression introduced early in glsl-compiler-1 work.

diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 3b2f91a..f665485 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -150,13 +150,19 @@ _tnl_InvalidateState( GLcontext *ctx, GL
        (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
       RENDERINPUTS_SET( tnl->render_inputs_bitset, _TNL_ATTRIB_POINTSIZE );
 
-#if 1 /* XXX NEW_SLANG */
-   RENDERINPUTS_SET_RANGE( tnl->render_inputs_bitset,
-                           _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC );
-#else
-   if (ctx->ShaderObjects._VertexShaderPresent || ctx->ShaderObjects._FragmentShaderPresent)
-      RENDERINPUTS_SET_RANGE( tnl->render_inputs_bitset, _TNL_FIRST_GENERIC, _TNL_LAST_GENERIC );
-#endif
+   /* check for varying vars which are written by the vertex program */
+   {
+      struct gl_vertex_program *vp = ctx->VertexProgram._Current;
+      if (vp) {
+         GLuint i;
+         for (i = 0; i < MAX_VARYING; i++) {
+            if (vp->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) {
+               RENDERINPUTS_SET(tnl->render_inputs_bitset,
+                                _TNL_ATTRIB_GENERIC(i));
+            }
+         }
+      }
+   }
 }
 
 
diff-tree e348016253582e6a31f7ee7149ff4999de33642d (from 7ed292a4e946fe43b04dd76d5f26df4e70765788)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Mar 15 16:07:39 2007 -0600

    silently ignore DeleteProgram/Shader(id=0)

diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c
index 4c8ba47..58be1f4 100644
--- a/src/mesa/main/shaders.c
+++ b/src/mesa/main/shaders.c
@@ -110,15 +110,17 @@ _mesa_CreateProgramObjectARB(void)
 void GLAPIENTRY
 _mesa_DeleteObjectARB(GLhandleARB obj)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   if (ctx->Driver.IsProgram(ctx, obj)) {
-      ctx->Driver.DeleteProgram2(ctx, obj);
-   }
-   else if (ctx->Driver.IsShader(ctx, obj)) {
-      ctx->Driver.DeleteShader(ctx, obj);
-   }
-   else {
-      /* error? */
+   if (obj) {
+      GET_CURRENT_CONTEXT(ctx);
+      if (ctx->Driver.IsProgram(ctx, obj)) {
+         ctx->Driver.DeleteProgram2(ctx, obj);
+      }
+      else if (ctx->Driver.IsShader(ctx, obj)) {
+         ctx->Driver.DeleteShader(ctx, obj);
+      }
+      else {
+         /* error? */
+      }
    }
 }
 
@@ -126,16 +128,20 @@ _mesa_DeleteObjectARB(GLhandleARB obj)
 void GLAPIENTRY
 _mesa_DeleteProgram(GLuint name)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   ctx->Driver.DeleteProgram2(ctx, name);
+   if (name) {
+      GET_CURRENT_CONTEXT(ctx);
+      ctx->Driver.DeleteProgram2(ctx, name);
+   }
 }
 
 
 void GLAPIENTRY
 _mesa_DeleteShader(GLuint name)
 {
-   GET_CURRENT_CONTEXT(ctx);
-   ctx->Driver.DeleteShader(ctx, name);
+   if (name) {
+      GET_CURRENT_CONTEXT(ctx);
+      ctx->Driver.DeleteShader(ctx, name);
+   }
 }
 
 
diff-tree 7ed292a4e946fe43b04dd76d5f26df4e70765788 (from 62b4601e53438096f362657bec2c4c238279509f)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Mar 15 16:06:58 2007 -0600

    in _mesa_GetColorTable, return silently if table size is 0

diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c
index 9fb0baf..2ad5c30 100644
--- a/src/mesa/main/colortab.c
+++ b/src/mesa/main/colortab.c
@@ -1,8 +1,8 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5.2
+ * Version:  6.5.3
  *
- * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -722,6 +722,10 @@ _mesa_GetColorTable( GLenum target, GLen
 
    ASSERT(table);
 
+   if (table->Size <= 0) {
+      return;
+   }
+
    switch (table->_BaseFormat) {
    case GL_ALPHA:
       {



More information about the mesa-commit mailing list