[Mesa-dev] [PATCH 12/17] i965/vs: Generalize data structures pointed to by vec4_generator.

Paul Berry stereotype441 at gmail.com
Sun Apr 7 15:54:05 PDT 2013


This patch removes the following field from vec4_generator, since it
is not used:

- struct brw_vs_compile *c

And changes the following field:

- struct gl_vertex_program *vp => struct gl_program *glprog

With these changes, vec4_generator no longer refers to any VS-specific
data structures.  This will pave the way for re-using it for geometry
shaders.
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp      | 2 +-
 src/mesa/drivers/dri/i965/brw_vec4.h        | 5 ++---
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp | 9 ++++-----
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 847adc7..e601bda 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1525,7 +1525,7 @@ brw_vs_emit(struct brw_context *brw,
       return NULL;
    }
 
-   vec4_generator g(brw, c, prog, mem_ctx);
+   vec4_generator g(brw, prog, &c->vp->program.Base, mem_ctx);
    const unsigned *generated =g.generate_assembly(&v.instructions,
                                                   final_assembly_size);
 
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index a5aa996..9fc4e64 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -523,8 +523,8 @@ class vec4_generator
 {
 public:
    vec4_generator(struct brw_context *brw,
-                  struct brw_vs_compile *c,
                   struct gl_shader_program *prog,
+                  struct gl_program *glprog,
                   void *mem_ctx);
    ~vec4_generator();
 
@@ -579,11 +579,10 @@ private:
    struct gl_context *ctx;
 
    struct brw_compile *p;
-   struct brw_vs_compile *c;
 
    struct gl_shader_program *prog;
    struct gl_shader *shader;
-   const struct gl_vertex_program *vp;
+   const struct gl_program *glprog;
 
    void *mem_ctx;
 };
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index e378f7f..847bb2b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -133,13 +133,12 @@ vec4_instruction::get_src(int i)
 }
 
 vec4_generator::vec4_generator(struct brw_context *brw,
-                               struct brw_vs_compile *c,
                                struct gl_shader_program *prog,
+                               struct gl_program *glprog,
                                void *mem_ctx)
-   : brw(brw), c(c), prog(prog), mem_ctx(mem_ctx)
+   : brw(brw), prog(prog), glprog(glprog), mem_ctx(mem_ctx)
 {
    intel = &brw->intel;
-   vp = &c->vp->program;
 
    shader = prog ? prog->_LinkedShaders[MESA_SHADER_VERTEX] : NULL;
 
@@ -699,7 +698,7 @@ vec4_generator::generate_code(exec_list *instructions)
       if (shader) {
          printf("Native code for vertex shader %d:\n", prog->Name);
       } else {
-         printf("Native code for vertex program %d:\n", c->vp->program.Base.Id);
+         printf("Native code for vertex program %d:\n", glprog->Id);
       }
    }
 
@@ -717,7 +716,7 @@ vec4_generator::generate_code(exec_list *instructions)
                } else {
                   const prog_instruction *vpi;
                   vpi = (const prog_instruction *) inst->ir;
-                  printf("%d: ", (int)(vpi - vp->Base.Instructions));
+                  printf("%d: ", (int)(vpi - glprog->Instructions));
                   _mesa_fprint_instruction_opt(stdout, vpi, 0,
                                                PROG_PRINT_DEBUG, NULL);
                }
-- 
1.8.2



More information about the mesa-dev mailing list