[Mesa-dev] [PATCH 6/6] mesa: remove dd_function_table::BindProgram

Marek Olšák maraeo at gmail.com
Thu Mar 23 23:42:06 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/mesa/drivers/common/driverfuncs.c |  1 -
 src/mesa/main/arbprogram.c            |  3 --
 src/mesa/main/atifragshader.c         |  3 --
 src/mesa/main/dd.h                    |  3 --
 src/mesa/main/state.c                 | 55 +++++------------------------------
 src/mesa/tnl/t_vp_build.c             |  8 -----
 6 files changed, 7 insertions(+), 66 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 642cd91..db0a107 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -106,21 +106,20 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->DeleteTexture = _mesa_delete_texture_object;
    driver->NewTextureImage = _swrast_new_texture_image;
    driver->DeleteTextureImage = _swrast_delete_texture_image;
    driver->AllocTextureImageBuffer = _swrast_alloc_texture_image_buffer;
    driver->FreeTextureImageBuffer = _swrast_free_texture_image_buffer;
    driver->MapTextureImage = _swrast_map_teximage;
    driver->UnmapTextureImage = _swrast_unmap_teximage;
    driver->DrawTex = _mesa_meta_DrawTex;
 
    /* Vertex/fragment programs */
-   driver->BindProgram = NULL;
    driver->NewProgram = _mesa_new_program;
    driver->DeleteProgram = _mesa_delete_program;
 
    /* ATI_fragment_shader */
    driver->NewATIfs = NULL;
 
    /* simple state commands */
    driver->AlphaFunc = NULL;
    driver->BlendColor = NULL;
    driver->BlendEquationSeparate = NULL;
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c
index 2c60310..f3a0a54c 100644
--- a/src/mesa/main/arbprogram.c
+++ b/src/mesa/main/arbprogram.c
@@ -111,23 +111,20 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
    if (target == GL_VERTEX_PROGRAM_ARB) {
       _mesa_reference_program(ctx, &ctx->VertexProgram.Current, newProg);
    }
    else if (target == GL_FRAGMENT_PROGRAM_ARB) {
       _mesa_reference_program(ctx, &ctx->FragmentProgram.Current, newProg);
    }
 
    /* Never null pointers */
    assert(ctx->VertexProgram.Current);
    assert(ctx->FragmentProgram.Current);
-
-   if (ctx->Driver.BindProgram)
-      ctx->Driver.BindProgram(ctx, target, newProg);
 }
 
 
 /**
  * Delete a list of programs.
  * \note Not compiled into display lists.
  * \note Called by both glDeleteProgramsNV and glDeleteProgramsARB.
  */
 void GLAPIENTRY 
 _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c
index 83a449a..27d8b86 100644
--- a/src/mesa/main/atifragshader.c
+++ b/src/mesa/main/atifragshader.c
@@ -257,23 +257,20 @@ _mesa_BindFragmentShaderATI(GLuint id)
       }
 
    }
 
    /* do actual bind */
    ctx->ATIFragmentShader.Current = newProg;
 
    assert(ctx->ATIFragmentShader.Current);
    if (newProg)
       newProg->RefCount++;
-
-   /*if (ctx->Driver.BindProgram)
-      ctx->Driver.BindProgram(ctx, target, prog); */
 }
 
 void GLAPIENTRY
 _mesa_DeleteFragmentShaderATI(GLuint id)
 {
    GET_CURRENT_CONTEXT(ctx);
 
    if (ctx->ATIFragmentShader.Compiling) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteFragmentShaderATI(insideShader)");
       return;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index f300ad6..b3a85f1 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -462,23 +462,20 @@ struct dd_function_table {
    GLboolean (*BindRenderbufferTexImage)(struct gl_context *ctx,
                                          struct gl_renderbuffer *rb,
                                          struct gl_texture_image *texImage);
    /*@}*/
 
 
    /**
     * \name Vertex/fragment program functions
     */
    /*@{*/
-   /** Bind a vertex/fragment program */
-   void (*BindProgram)(struct gl_context *ctx, GLenum target,
-                       struct gl_program *prog);
    /** Allocate a new program */
    struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target,
                                      GLuint id, bool is_arb_asm);
    /** Delete a program */
    void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog);   
    /**
     * Allocate a program to associate with the new ATI fragment shader (optional)
     */
    struct gl_program * (*NewATIfs)(struct gl_context *ctx,
                                    struct ati_fragment_shader *curProg);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 07629d8..5a760f5 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -73,22 +73,21 @@ update_program_enables(struct gl_context *ctx)
       && ctx->VertexProgram.Current->arb.Instructions;
    ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
       && ctx->FragmentProgram.Current->arb.Instructions;
    ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
       && ctx->ATIFragmentShader.Current->Instructions[0];
 }
 
 
 /**
  * Update the ctx->*Program._Current pointers to point to the
- * current/active programs.  Then call ctx->Driver.BindProgram() to
- * tell the driver which programs to use.
+ * current/active programs.
  *
  * Programs may come from 3 sources: GLSL shaders, ARB/NV_vertex/fragment
  * programs or programs derived from fixed-function state.
  *
  * This function needs to be called after texture state validation in case
  * we're generating a fragment program from fixed-function texture state.
  *
  * \return bitfield which will indicate _NEW_PROGRAM state if a new vertex
  * or fragment program is being used.
  */
@@ -231,67 +230,27 @@ update_program(struct gl_context *ctx)
    if (csProg) {
       /* Use GLSL compute shader */
       _mesa_reference_program(ctx, &ctx->ComputeProgram._Current, csProg);
    } else {
       /* no compute program */
       _mesa_reference_program(ctx, &ctx->ComputeProgram._Current, NULL);
    }
 
    /* Let the driver know what's happening:
     */
-   if (ctx->FragmentProgram._Current != prevFP) {
+   if (ctx->FragmentProgram._Current != prevFP ||
+       ctx->VertexProgram._Current != prevVP ||
+       ctx->GeometryProgram._Current != prevGP ||
+       ctx->TessEvalProgram._Current != prevTEP ||
+       ctx->TessCtrlProgram._Current != prevTCP ||
+       ctx->ComputeProgram._Current != prevCP)
       new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB,
-                                 ctx->FragmentProgram._Current);
-      }
-   }
-
-   if (ctx->GeometryProgram._Current != prevGP) {
-      new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_GEOMETRY_PROGRAM_NV,
-                                 ctx->GeometryProgram._Current);
-      }
-   }
-
-   if (ctx->TessEvalProgram._Current != prevTEP) {
-      new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_TESS_EVALUATION_PROGRAM_NV,
-                                 ctx->TessEvalProgram._Current);
-      }
-   }
-
-   if (ctx->TessCtrlProgram._Current != prevTCP) {
-      new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_TESS_CONTROL_PROGRAM_NV,
-                                 ctx->TessCtrlProgram._Current);
-      }
-   }
-
-   if (ctx->VertexProgram._Current != prevVP) {
-      new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
-                                 ctx->VertexProgram._Current);
-      }
-   }
-
-   if (ctx->ComputeProgram._Current != prevCP) {
-      new_state |= _NEW_PROGRAM;
-      if (ctx->Driver.BindProgram) {
-         ctx->Driver.BindProgram(ctx, GL_COMPUTE_PROGRAM_NV,
-                                 ctx->ComputeProgram._Current);
-      }
-   }
 
    return new_state;
 }
 
 
 /**
  * Examine shader constants and return either _NEW_PROGRAM_CONSTANTS or 0.
  */
 static GLbitfield
 update_program_constants(struct gl_context *ctx)
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 18d105f..3d8210c 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -41,19 +41,11 @@
 void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
 {
    const struct gl_program *prev = ctx->VertexProgram._Current;
 
    if (!ctx->VertexProgram._Current ||
        ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
       ctx->VertexProgram._Current
          = ctx->VertexProgram._TnlProgram
          = _mesa_get_fixed_func_vertex_program(ctx);
    }
-
-   /* Tell the driver about the change.  Could define a new target for
-    * this?
-    */
-   if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) {
-      ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
-                              ctx->VertexProgram._Current);
-   }
 }
-- 
2.7.4



More information about the mesa-dev mailing list