OSDN Git Service

gallium/i965: remove dependencies on pipe_shader_state's semantic info
authorBrian <brian@i915.localnet.net>
Wed, 27 Feb 2008 23:05:16 +0000 (16:05 -0700)
committerBrian <brian@i915.localnet.net>
Wed, 27 Feb 2008 23:05:16 +0000 (16:05 -0700)
The brw_shader_info struct is rendundant and could be removed...

src/gallium/drivers/i965simple/brw_context.h
src/gallium/drivers/i965simple/brw_draw_upload.c
src/gallium/drivers/i965simple/brw_sf.c
src/gallium/drivers/i965simple/brw_shader_info.c
src/gallium/drivers/i965simple/brw_state.c
src/gallium/drivers/i965simple/brw_wm_decl.c

index 65664d8..fbc89c8 100644 (file)
@@ -38,6 +38,8 @@
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
 
+#include "tgsi/util/tgsi_scan.h"
+
 #include "brw_structs.h"
 #include "brw_winsys.h"
 
@@ -203,7 +205,8 @@ struct brw_shader_info {
 
 struct brw_vertex_program {
    struct pipe_shader_state program;
-   struct brw_shader_info info;
+   struct tgsi_shader_info info;
+   struct brw_shader_info info2;  /* XXX get rid of this */
    int id;
 };
 
@@ -211,7 +214,8 @@ struct brw_vertex_program {
 
 struct brw_fragment_program {
    struct pipe_shader_state program;
-   struct brw_shader_info info;
+   struct tgsi_shader_info info;
+   struct brw_shader_info info2;  /* XXX get rid of this */
    
    boolean UsesDepth;
    boolean UsesKill;
index aa85d93..9c0c78c 100644 (file)
@@ -256,7 +256,7 @@ boolean brw_upload_vertex_elements( struct brw_context *brw )
    struct brw_vertex_element_packet vep;
 
    unsigned i;
-   unsigned nr_enabled = brw->attribs.VertexProgram->program.num_inputs;
+   unsigned nr_enabled = brw->attribs.VertexProgram->info.num_inputs;
 
    memset(&vep, 0, sizeof(vep));
 
index 7c83b81..54ce5ed 100644 (file)
@@ -133,7 +133,7 @@ static void upload_sf_prog( struct brw_context *brw )
    key.vp_output_count = brw->vs.prog_data->outputs_written;
 
    /* BRW_NEW_FS */
-   key.fp_input_count = brw->attribs.FragmentProgram->info.nr_regs[TGSI_FILE_INPUT];
+   key.fp_input_count = brw->attribs.FragmentProgram->info2.nr_regs[TGSI_FILE_INPUT];
 
 
    /* BRW_NEW_REDUCED_PRIMITIVE */
index a762a87..e7e063d 100644 (file)
@@ -6,8 +6,9 @@
 #include "tgsi/util/tgsi_parse.h"
 
 
-
-
+/**
+ * XXX try to get rid of this.  See tgsi_scan_shader() and tgsi_shader_info.
+ */
 void brw_shader_info(const struct tgsi_token *tokens,
                     struct brw_shader_info *info )
 {
index 7466fdc..6e46465 100644 (file)
@@ -175,8 +175,10 @@ static void * brw_create_fs_state(struct pipe_context *pipe,
    brw_fp->program = *shader;
    brw_fp->id = brw_context(pipe)->program_id++;
 
+   tgsi_scan_shader(shader->tokens, &brw_fp->info);
+
    brw_shader_info(shader->tokens,
-                  &brw_fp->info);
+                  &brw_fp->info2);
 
    tgsi_dump(shader->tokens, 0);
 
@@ -211,8 +213,11 @@ static void *brw_create_vs_state(struct pipe_context *pipe,
     */
    brw_vp->program = *shader;
    brw_vp->id = brw_context(pipe)->program_id++;
+
+   tgsi_scan_shader(shader->tokens, &brw_vp->info);
+
    brw_shader_info(shader->tokens,
-                  &brw_vp->info);
+                  &brw_vp->info2);
 
    tgsi_dump(shader->tokens, 0);
 
index 97418a5..afea042 100644 (file)
@@ -259,7 +259,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
    /* Then a copy of our part of the CURBE entry:
     */
    {
-      int nr_constants = c->fp->info.nr_regs[TGSI_FILE_CONSTANT];
+      int nr_constants = c->fp->info2.nr_regs[TGSI_FILE_CONSTANT];
       int index = 0;
 
       c->prog_data.max_const = 4*nr_constants;
@@ -282,7 +282,7 @@ static void prealloc_reg(struct brw_wm_compile *c)
    /* Next we receive the plane coefficients for parameter
     * interpolation:
     */
-   for (i = 0; i < c->fp->info.nr_regs[TGSI_FILE_INPUT]; i++) {
+   for (i = 0; i < c->fp->info2.nr_regs[TGSI_FILE_INPUT]; i++) {
       c->payload_coef[i] = brw_vec8_grf(c->reg_index, 0);
       c->reg_index += 2;
    }
@@ -302,11 +302,11 @@ static void prealloc_reg(struct brw_wm_compile *c)
    /* Now allocate room for the interpolated inputs and staging
     * registers for the outputs:
     */
-   for (i = 0; i < c->fp->info.nr_regs[TGSI_FILE_INPUT]; i++) 
+   for (i = 0; i < c->fp->info2.nr_regs[TGSI_FILE_INPUT]; i++) 
       for (j = 0; j < 4; j++)
         c->wm_regs[TGSI_FILE_INPUT][i][j] = brw_vec8_grf( c->reg_index++, 0 );
 
-   for (i = 0; i < c->fp->info.nr_regs[TGSI_FILE_OUTPUT]; i++) 
+   for (i = 0; i < c->fp->info2.nr_regs[TGSI_FILE_OUTPUT]; i++) 
       for (j = 0; j < 4; j++)
         c->wm_regs[TGSI_FILE_OUTPUT][i][j] = brw_vec8_grf( c->reg_index++, 0 );