i965/fs: Remove direct fs_generator brw_wm_prog_key dependence
authorJordan Justen <jordan.l.justen@intel.com>
Fri, 29 Aug 2014 19:50:46 +0000 (12:50 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sat, 6 Sep 2014 05:15:06 +0000 (22:15 -0700)
Instead we store a void pointer to the key, and cast it to
brw_wm_prog_key for fragment shader specific code paths.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index f40357f438da2b1be21e472a5061828f2e210bf7..502e6c7418757a0ee84cf15ce29f838f3d89949a 100644 (file)
@@ -680,7 +680,7 @@ private:
 
    struct brw_compile *p;
    gl_shader_stage stage;
-   const struct brw_wm_prog_key *const key;
+   const void * const key;
    struct brw_stage_prog_data * const prog_data;
 
    struct gl_shader_program * const shader_prog;
index 826b83a1bbbcebd5a19125121217106f6495f9f1..1bc10f5614b3682f75af7b96dc70a8d226d831cd 100644 (file)
@@ -154,6 +154,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
 
    assert(stage == MESA_SHADER_FRAGMENT);
    brw_wm_prog_data *prog_data = (brw_wm_prog_data*) this->prog_data;
+   const brw_wm_prog_key * const key = (brw_wm_prog_key * const) this->key;
 
    /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied
     * move, here's g1.
@@ -700,6 +701,9 @@ fs_generator::generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src
    assert(quality.file == BRW_IMMEDIATE_VALUE);
    assert(quality.type == BRW_REGISTER_TYPE_D);
 
+   assert(stage == MESA_SHADER_FRAGMENT);
+   const brw_wm_prog_key * const key = (brw_wm_prog_key * const) this->key;
+
    int quality_value = quality.dw1.d;
 
    if (quality_value == BRW_DERIVATIVE_FINE ||
@@ -740,6 +744,9 @@ fs_generator::generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src
    assert(quality.file == BRW_IMMEDIATE_VALUE);
    assert(quality.type == BRW_REGISTER_TYPE_D);
 
+   assert(stage == MESA_SHADER_FRAGMENT);
+   const brw_wm_prog_key * const key = (brw_wm_prog_key * const) this->key;
+
    int quality_value = quality.dw1.d;
 
    if (quality_value == BRW_DERIVATIVE_FINE ||
@@ -1818,7 +1825,8 @@ fs_generator::generate_code(const cfg_t *cfg)
           */
          assert(stage == MESA_SHADER_FRAGMENT &&
                 ((gl_fragment_program *) prog)->UsesDFdy);
-        generate_ddy(inst, dst, src[0], src[1], key->render_to_fbo);
+         generate_ddy(inst, dst, src[0], src[1],
+                      ((brw_wm_prog_key * const) this->key)->render_to_fbo);
         break;
 
       case SHADER_OPCODE_GEN4_SCRATCH_WRITE: