[Mesa-dev] [RFC] [PATCH] mesa: Remove the CompileShader driver hook; it's just a no-op.

Kenneth Graunke kenneth at whitecape.org
Sat Feb 26 00:50:42 PST 2011


---
The CompileShader driver hook has a comment saying that it could be removed
since it literally does nothing.  This patch removes it as a cleanup.

I'm not sure if this is a good idea or not.  Do we foresee using it in the
future?  Presumably it breaks the ABI...perhaps needlessly.

 src/mesa/drivers/dri/i965/brw_fs.cpp    |    9 ---------
 src/mesa/drivers/dri/i965/brw_program.c |    1 -
 src/mesa/drivers/dri/i965/brw_wm.h      |    2 --
 src/mesa/main/dd.h                      |    9 ---------
 src/mesa/main/shaderobj.c               |    1 -
 src/mesa/program/ir_to_mesa.cpp         |   20 --------------------
 6 files changed, 0 insertions(+), 42 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 9bdcda7..44e60b4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -78,15 +78,6 @@ brw_new_shader_program(struct gl_context *ctx, GLuint name)
 }
 
 GLboolean
-brw_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
-{
-   if (!_mesa_ir_compile_shader(ctx, shader))
-      return GL_FALSE;
-
-   return GL_TRUE;
-}
-
-GLboolean
 brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
 {
    struct brw_context *brw = brw_context(ctx);
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 7d65332..ee68095 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -243,7 +243,6 @@ void brwInitFragProgFuncs( struct dd_function_table *functions )
 
    functions->NewShader = brw_new_shader;
    functions->NewShaderProgram = brw_new_shader_program;
-   functions->CompileShader = brw_compile_shader;
    functions->LinkShader = brw_link_shader;
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index d9cae75..1bcf66a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -467,8 +467,6 @@ void emit_xpd(struct brw_compile *p,
 	      const struct brw_reg *arg0,
 	      const struct brw_reg *arg1);
 
-GLboolean brw_compile_shader(struct gl_context *ctx,
-			     struct gl_shader *shader);
 GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
 struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
 struct gl_shader_program *brw_new_shader_program(struct gl_context *ctx, GLuint name);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 749c30a..06b6426 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -602,15 +602,6 @@ struct dd_function_table {
     */
    /*@{*/
    /**
-    * Called when a shader is compiled.
-    *
-    * Note that not all shader objects get ShaderCompile called on
-    * them.  Notably, the shaders containing builtin functions do not
-    * have CompileShader() called, so if lowering passes are done they
-    * need to also be performed in LinkShader().
-    */
-   GLboolean (*CompileShader)(struct gl_context *ctx, struct gl_shader *shader);
-   /**
     * Called when a shader program is linked.
     *
     * This gives drivers an opportunity to clone the IR and make their
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 1d75845..2a3b2fa 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -408,6 +408,5 @@ _mesa_init_shader_object_functions(struct dd_function_table *driver)
    driver->DeleteShader = _mesa_delete_shader;
    driver->NewShaderProgram = _mesa_new_shader_program;
    driver->DeleteShaderProgram = _mesa_delete_shader_program;
-   driver->CompileShader = _mesa_ir_compile_shader;
    driver->LinkShader = _mesa_ir_link_shader;
 }
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 33c262f..d6eb232 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3038,21 +3038,6 @@ get_mesa_program(struct gl_context *ctx,
 extern "C" {
 
 /**
- * Called via ctx->Driver.CompilerShader().
- * This is a no-op.
- * XXX can we remove the ctx->Driver.CompileShader() hook?
- */
-GLboolean
-_mesa_ir_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
-{
-   assert(shader->CompileStatus);
-   (void) ctx;
-
-   return GL_TRUE;
-}
-
-
-/**
  * Link a shader.
  * Called via ctx->Driver.LinkShader()
  * This actually involves converting GLSL IR into Mesa gl_programs with
@@ -3237,11 +3222,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
    reparent_ir(shader->ir, shader->ir);
 
    ralloc_free(state);
-
-   if (shader->CompileStatus) {
-      if (!ctx->Driver.CompileShader(ctx, shader))
-	 shader->CompileStatus = GL_FALSE;
-   }
 }
 
 
-- 
1.7.4.1



More information about the mesa-dev mailing list