i965/vs: Generalize data structures pointed to by vec4_generator.
authorPaul Berry <stereotype441@gmail.com>
Sun, 17 Feb 2013 19:25:37 +0000 (11:25 -0800)
committerPaul Berry <stereotype441@gmail.com>
Thu, 11 Apr 2013 16:25:25 +0000 (09:25 -0700)
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 *prog

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.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
v2: Use the name "prog" rather than "p".

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp

index 3148f308d311adb40d65d27718c30dfa687868d8..693f1dd872f32fb1d5e7d53e33135e5db375bde0 100644 (file)
@@ -1539,7 +1539,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);
 
index 152e4078a69f5076524cecb63a1924b0f9bcb88e..d56e68b49724cabc48f328b5b132c470784d79ee 100644 (file)
@@ -523,8 +523,8 @@ class vec4_generator
 {
 public:
    vec4_generator(struct brw_context *brw,
-                  struct brw_vs_compile *c,
                   struct gl_shader_program *shader_prog,
+                  struct gl_program *prog,
                   void *mem_ctx);
    ~vec4_generator();
 
@@ -583,11 +583,10 @@ private:
    struct gl_context *ctx;
 
    struct brw_compile *p;
-   struct brw_vs_compile *c;
 
    struct gl_shader_program *shader_prog;
    struct gl_shader *shader;
-   const struct gl_vertex_program *vp;
+   const struct gl_program *prog;
 
    void *mem_ctx;
 };
index 9f985b0b8ad1bd53462e618457b4d5bf9d10bf83..4fec4e49bf62985e97e34c28daca0d6db0fc935b 100644 (file)
@@ -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 *shader_prog,
+                               struct gl_program *prog,
                                void *mem_ctx)
-   : brw(brw), c(c), shader_prog(shader_prog), mem_ctx(mem_ctx)
+   : brw(brw), shader_prog(shader_prog), prog(prog), mem_ctx(mem_ctx)
 {
    intel = &brw->intel;
-   vp = &c->vp->program;
 
    shader = shader_prog ? shader_prog->_LinkedShaders[MESA_SHADER_VERTEX] : NULL;
 
@@ -710,7 +709,7 @@ vec4_generator::generate_code(exec_list *instructions)
       if (shader) {
          printf("Native code for vertex shader %d:\n", shader_prog->Name);
       } else {
-         printf("Native code for vertex program %d:\n", c->vp->program.Base.Id);
+         printf("Native code for vertex program %d:\n", prog->Id);
       }
    }
 
@@ -728,7 +727,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 - prog->Instructions));
                   _mesa_fprint_instruction_opt(stdout, vpi, 0,
                                                PROG_PRINT_DEBUG, NULL);
                }