From dc0bd799cabdd974b05bd217304944392169fb50 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 29 Aug 2014 12:50:46 -0700 Subject: [PATCH] i965/fs: Remove direct fs_visitor gl_fragment_program dependence Instead we cast backend_visitor::prog for fragment shader specific code paths. Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.h | 1 - src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 8 ++++++-- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 - src/mesa/drivers/dri/i965/brw_wm_iz.cpp | 2 ++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 502e6c74187..d40a2e38f82 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 4db3f1697e7..526c8171ff0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -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: diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 7ec8fd8aaa3..2a097f6588a 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -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(); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.cpp b/src/mesa/drivers/dri/i965/brw_wm_iz.cpp index 0a639f176e1..47823a764de 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.cpp +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.cpp @@ -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; -- 2.30.2