i965/fs: Move brw_wm_compile::fp to fs_visitor.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 20 Nov 2012 22:41:21 +0000 (14:41 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 27 Nov 2012 03:52:33 +0000 (19:52 -0800)
Also change it from a brw_fragment_program to a gl_fragment_program,
since that seems to be what everything wants anyway.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_emit.cpp
src/mesa/drivers/dri/i965/brw_fs_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_iz.cpp

index a370bcd2c13a9196937ca94f00e9ab8502bc7128..638fbed33dcf1879a140a7ac317e1a3fe2eab98a 100644 (file)
@@ -2147,6 +2147,7 @@ fs_visitor::run()
 
 bool
 brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
+               struct gl_fragment_program *fp,
               struct gl_shader_program *prog)
 {
    struct intel_context *intel = &brw->intel;
@@ -2170,14 +2171,14 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
          printf("\n\n");
       } else {
          printf("ARB_fragment_program %d ir for native fragment shader\n",
-                c->fp->program.Base.Id);
-         _mesa_print_program(&c->fp->program.Base);
+                fp->Base.Id);
+         _mesa_print_program(&fp->Base);
       }
    }
 
    /* Now the main event: Visit the shader IR and generate our FS IR for it.
     */
-   fs_visitor v(c, prog, 8);
+   fs_visitor v(c, prog, fp, 8);
    if (!v.run()) {
       prog->LinkStatus = false;
       ralloc_strcat(&prog->InfoLog, v.fail_msg);
@@ -2189,7 +2190,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
    }
 
    if (intel->gen >= 5 && c->prog_data.nr_pull_params == 0) {
-      fs_visitor v2(c, prog, 16);
+      fs_visitor v2(c, prog, fp, 16);
       v2.import_uniforms(&v);
       if (!v2.run()) {
          perf_debug("16-wide shader failed to compile, falling back to "
index 30f2d63be8520f62319c252bc940d3c5ec1ddeff..850782547488f70952da2f86d6ccc13460fdd197 100644 (file)
@@ -184,7 +184,9 @@ class fs_visitor : public backend_visitor
 {
 public:
 
-   fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
+   fs_visitor(struct brw_wm_compile *c,
+              struct gl_shader_program *prog,
+              struct gl_fragment_program *fp,
               unsigned dispatch_width);
    ~fs_visitor();
 
index 7fdf5267163ebe4e0ecf1f0c5ccca08ed5ca6f27..4a1700b8fdb0d186bf84888bc1867b2cabe757ed 100644 (file)
@@ -734,7 +734,7 @@ fs_visitor::generate_code()
                 prog->Name, dispatch_width);
       } else {
          printf("Native code for fragment program %d (%d-wide dispatch):\n",
-                c->fp->program.Base.Id, dispatch_width);
+                fp->Base.Id, dispatch_width);
       }
    }
 
index 542d80a6b4026d423584794d4f8b785209a7c089..bb8cd9a79a8d85c1fb84065eab0791f2cfca2fc7 100644 (file)
@@ -591,7 +591,7 @@ fs_visitor::setup_fp_regs()
    /* PROGRAM_STATE_VAR etc. */
    if (dispatch_width == 8) {
       for (unsigned p = 0;
-           p < c->fp->program.Base.Parameters->NumParameters; p++) {
+           p < fp->Base.Parameters->NumParameters; p++) {
          for (unsigned int i = 0; i < 4; i++) {
             this->param_index[c->prog_data.nr_params] = p;
             this->param_offset[c->prog_data.nr_params] = i;
@@ -688,7 +688,7 @@ fs_visitor::get_fp_dst_reg(const prog_dst_register *dst)
 fs_reg
 fs_visitor::get_fp_src_reg(const prog_src_register *src)
 {
-   struct gl_program_parameter_list *plist = c->fp->program.Base.Parameters;
+   struct gl_program_parameter_list *plist = fp->Base.Parameters;
 
    fs_reg result;
 
index 43266cacfff94a4fc2cef50803d8e9483612fb84..6408bc8b4454419108d93d7f4a1680e46b02089b 100644 (file)
@@ -1140,7 +1140,7 @@ fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
        (intel->gen < 6 ||
        (intel->gen >= 6 && (c->key.tex.gl_clamp_mask[0] & (1 << sampler) ||
                             c->key.tex.gl_clamp_mask[1] & (1 << sampler))))) {
-      struct gl_program_parameter_list *params = c->fp->program.Base.Parameters;
+      struct gl_program_parameter_list *params = fp->Base.Parameters;
       int tokens[STATE_LENGTH] = {
         STATE_INTERNAL,
         STATE_TEXRECT_SCALE,
@@ -2174,14 +2174,16 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
    *reg = temp;
 }
 
-fs_visitor::fs_visitor(struct brw_wm_compile *c, struct gl_shader_program *prog,
+fs_visitor::fs_visitor(struct brw_wm_compile *c,
+                       struct gl_shader_program *prog,
+                       struct gl_fragment_program *fp,
                        unsigned dispatch_width)
    : dispatch_width(dispatch_width)
 {
    this->c = c;
    this->p = &c->func;
    this->brw = p->brw;
-   this->fp = &c->fp->program;
+   this->fp = fp;
    this->prog = prog;
    this->intel = &brw->intel;
    this->ctx = &intel->ctx;
index 00bd3fe0eb5bd18ae25a12368cbd9d5bccb4aca0..f22960330cf08a85a60399ca565cbdaa85e8a6ff 100644 (file)
@@ -168,15 +168,13 @@ bool do_wm_prog(struct brw_context *brw,
 
    memcpy(&c->key, key, sizeof(*key));
 
-   c->fp = fp;
-
    brw_init_compile(brw, &c->func, c);
 
    c->prog_data.barycentric_interp_modes =
       brw_compute_barycentric_interp_modes(brw, c->key.flat_shade,
                                            &fp->program);
 
-   brw_wm_fs_emit(brw, c, prog);
+   brw_wm_fs_emit(brw, c, &fp->program, prog);
 
    /* Scratch space is used for register spilling */
    if (c->last_scratch) {
index a5ebdddc732d0c3f59066c08be2e016edd9e2414..adc05a497f2a2950219429e079f954b3f307ab34 100644 (file)
@@ -81,8 +81,6 @@ struct brw_wm_compile {
    struct brw_wm_prog_key key;
    struct brw_wm_prog_data prog_data;
 
-   struct brw_fragment_program *fp;
-
    uint8_t source_depth_reg;
    uint8_t source_w_reg;
    uint8_t aa_dest_stencil_reg;
@@ -96,6 +94,7 @@ struct brw_wm_compile {
 };
 
 bool brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
+                    struct gl_fragment_program *fp,
                    struct gl_shader_program *prog);
 
 GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
index 43cd74c360e2e7a989a90bdd8d1decc93f62d6dc..2fd1655267b554dba55dbfa1690b532c1385db63 100644 (file)
@@ -126,7 +126,7 @@ void fs_visitor::setup_payload_gen4()
    bool kill_stats_promoted_workaround = false;
    int lookup = c->key.iz_lookup;
    bool uses_depth =
-      (c->fp->program.Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
+      (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0;
 
    assert(lookup < IZ_BIT_MAX);