more hooks for mga driver, including an immediate fastpath
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 30 Sep 1999 11:18:21 +0000 (11:18 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 30 Sep 1999 11:18:21 +0000 (11:18 +0000)
src/mesa/main/blend.c
src/mesa/main/dd.h
src/mesa/main/light.c
src/mesa/main/texobj.c

index deac05c..6bf3581 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: blend.c,v 1.2 1999/08/19 15:48:01 brianp Exp $ */
+/* $Id: blend.c,v 1.3 1999/09/30 11:18:21 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -203,6 +203,11 @@ gl_BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB, GLenum dfactorRGB,
 
    ctx->Color.BlendFunc = NULL;
    ctx->NewState |= NEW_RASTER_OPS;
+
+   if (ctx->Driver.BlendFuncSeparate) {
+      (*ctx->Driver.BlendFuncSeparate)( ctx, sfactorRGB, dfactorRGB,
+                                       sfactorA, dfactorA );
+   }
 }
 
 
@@ -243,6 +248,9 @@ void gl_BlendEquation( GLcontext *ctx, GLenum mode )
 
    ctx->Color.BlendFunc = NULL;
    ctx->NewState |= NEW_RASTER_OPS;
+   
+   if (ctx->Driver.BlendEquation)
+      ctx->Driver.BlendEquation( ctx, mode );
 }
 
 
index aae4d71..64b031e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dd.h,v 1.2 1999/09/18 20:41:22 keithw Exp $ */
+/* $Id: dd.h,v 1.3 1999/09/30 11:18:21 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -563,6 +563,23 @@ struct dd_function_table {
     */
 
 
+   GLboolean (*IsTextureResident)( GLcontext *ctx, 
+                                  struct gl_texture_object *t );
+   /*
+    * Allows the driver to implement the AreTexturesResident tests without
+    * knowing about Mesa's internal hash tables for textures.
+    */
+
+   void (*PrioritizeTexture)( GLcontext *ctx, 
+                             struct gl_texture_object *t,
+                             GLclampf priority );
+   /*
+    * Notify driver of priority change for a texture.
+    */
+
+
+
+
    /***
     *** NEW in Mesa 3.x
     ***/
@@ -616,7 +633,11 @@ struct dd_function_table {
     * the driver's UpdateState() function must do.
     */
    void (*AlphaFunc)(GLcontext *ctx, GLenum func, GLclampf ref);
+   void (*BlendEquation)(GLcontext *ctx, GLenum mode);
    void (*BlendFunc)(GLcontext *ctx, GLenum sfactor, GLenum dfactor);
+   void (*BlendFuncSeparate)( GLcontext *ctx, GLenum sfactorRGB, 
+                             GLenum dfactorRGB, GLenum sfactorA,
+                             GLenum dfactorA );
    void (*ClearDepth)(GLcontext *ctx, GLclampd d);
    void (*CullFace)(GLcontext *ctx, GLenum mode);
    void (*FrontFace)(GLcontext *ctx, GLenum mode);
@@ -626,6 +647,9 @@ struct dd_function_table {
    void (*Enable)(GLcontext* ctx, GLenum cap, GLboolean state);
    void (*Fogfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
    void (*Hint)(GLcontext *ctx, GLenum target, GLenum mode);
+   void (*Lightfv)(GLcontext *ctx, GLenum light,
+                  GLenum pname, const GLfloat *params, GLint nparams );
+   void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
    void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode);
    void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
    void (*ShadeModel)(GLcontext *ctx, GLenum mode);
index 893438d..715084b 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.2 1999/09/18 20:41:23 keithw Exp $ */
+/* $Id: light.c,v 1.3 1999/09/30 11:18:22 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -168,6 +168,9 @@ void gl_Lightfv( GLcontext *ctx,
          break;
    }
 
+   if (ctx->Driver.Lightfv)
+      ctx->Driver.Lightfv( ctx, light, pname, params, nparams );
+
    ctx->NewState |= NEW_LIGHTING;
 }
 
@@ -328,6 +331,10 @@ void gl_LightModelfv( GLcontext *ctx, GLenum pname, const GLfloat *params )
          gl_error( ctx, GL_INVALID_ENUM, "glLightModel" );
          break;
    }
+
+   if (ctx->Driver.LightModelfv) 
+      ctx->Driver.LightModelfv( ctx, pname, params );
+
    ctx->NewState |= NEW_LIGHTING;
 }
 
index 78691d2..d94618d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: texobj.c,v 1.1 1999/08/19 00:55:41 jtg Exp $ */
+/* $Id: texobj.c,v 1.2 1999/09/30 11:18:22 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -507,6 +507,9 @@ void gl_PrioritizeTextures( GLcontext *ctx,
             HashLookup(ctx->Shared->TexObjects, texName[i]);
          if (t) {
             t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
+
+           if (ctx->Driver.PrioritizeTexture)
+              ctx->Driver.PrioritizeTexture( ctx, t, t->Priority );
          }
       }
    }
@@ -515,7 +518,7 @@ void gl_PrioritizeTextures( GLcontext *ctx,
 
 
 /*
- * Execute glAreTexturesResident
+ * Execute glAreTexturesResident 
  */
 GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
                                   const GLuint *texName,
@@ -541,8 +544,10 @@ GLboolean gl_AreTexturesResident( GLcontext *ctx, GLsizei n,
       t = (struct gl_texture_object *)
          HashLookup(ctx->Shared->TexObjects, texName[i]);
       if (t) {
-         /* we consider all valid texture objects to be resident */
-         residences[i] = GL_TRUE;
+        if (ctx->Driver.IsTextureResident)
+           residences[i] = ctx->Driver.IsTextureResident( ctx, t );
+        else 
+           residences[i] = GL_TRUE;
       }
       else {
          gl_error( ctx, GL_INVALID_VALUE, "glAreTexturesResident(textures)" );