i965/fs: Remove direct fs_visitor gl_fragment_program 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 18:17:53 +0000 (11:17 -0700)
Instead we cast backend_visitor::prog 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_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_wm_iz.cpp

index 502e6c7418757a0ee84cf15ce29f838f3d89949a..d40a2e38f82feb246b707f4b102c1241f62ed495 100644 (file)
@@ -469,7 +469,6 @@ public:
 
    void visit_atomic_counter_intrinsic(ir_call *ir);
 
-   struct gl_fragment_program *fp;
    const struct brw_wm_prog_key *const key;
    struct brw_wm_prog_data *prog_data;
    unsigned int sanity_param_count;
index 4db3f1697e7514b57e387261f492c6426f5f77d4..526c8171ff097bb058b6c90b827985ca89018bd2 100644 (file)
@@ -602,8 +602,12 @@ fs_visitor::setup_fp_regs()
 
          switch (i) {
          case VARYING_SLOT_POS:
-            ir->data.pixel_center_integer = fp->PixelCenterInteger;
-            ir->data.origin_upper_left = fp->OriginUpperLeft;
+            {
+               assert(stage == MESA_SHADER_FRAGMENT);
+               gl_fragment_program *fp = (gl_fragment_program*) prog;
+               ir->data.pixel_center_integer = fp->PixelCenterInteger;
+               ir->data.origin_upper_left = fp->OriginUpperLeft;
+            }
             fp_input_regs[i] = *emit_fragcoord_interpolation(ir);
             break;
          case VARYING_SLOT_FACE:
index 7ec8fd8aaa33603d928f220a1dd345d3e9df2452..2a097f6588ae7efb53e21f4faeb9eea6d7477711 100644 (file)
@@ -3267,7 +3267,6 @@ fs_visitor::fs_visitor(struct brw_context *brw,
      key(key), prog_data(prog_data),
      dispatch_width(dispatch_width)
 {
-   this->fp = fp;
    this->mem_ctx = mem_ctx;
    init();
 }
index 0a639f176e1b89e4cd2340cab97dc30cac76c485..47823a764de1beb840ab9c87139ce16938ddb694 100644 (file)
@@ -125,6 +125,8 @@ void fs_visitor::setup_payload_gen4()
    GLuint reg = 2;
    bool kill_stats_promoted_workaround = false;
    int lookup = key->iz_lookup;
+   assert(stage == MESA_SHADER_FRAGMENT);
+   gl_fragment_program *fp = (gl_fragment_program*) prog;
    bool uses_depth =
       (fp->Base.InputsRead & (1 << VARYING_SLOT_POS)) != 0;