From f96a02c7ca7377e3152856a5bf889b0bdf17933c Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Fri, 29 Aug 2014 12:50:46 -0700 Subject: [PATCH] i965/fs: Don't store gl_fragment_program* in fs_generator gl_program* is named prog similar to backend_visitor. Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs.h | 2 +- src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 3a916fea7bc..91741fc30fe 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -684,7 +684,7 @@ private: struct brw_wm_prog_data *prog_data; struct gl_shader_program * const shader_prog; - const struct gl_fragment_program *fp; + const struct gl_program *prog; unsigned dispatch_width; /**< 8 or 16 */ diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp index d78997285a0..4b8ac4a8126 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp @@ -46,7 +46,7 @@ fs_generator::fs_generator(struct brw_context *brw, bool debug_flag) : brw(brw), stage(MESA_SHADER_FRAGMENT), key(key), - prog_data(prog_data), shader_prog(shader_prog), fp(fp), + prog_data(prog_data), shader_prog(shader_prog), prog(&fp->Base), runtime_check_aads_emit(runtime_check_aads_emit), debug_flag(debug_flag), mem_ctx(mem_ctx) { @@ -145,6 +145,8 @@ fs_generator::fire_fb_write(fs_inst *inst, void fs_generator::generate_fb_write(fs_inst *inst) { + assert(stage == MESA_SHADER_FRAGMENT); + gl_fragment_program *fp = (gl_fragment_program *) prog; struct brw_reg implied_header; /* Header is 2 regs, g0 and g1 are the contents. g0 will be implied @@ -1808,7 +1810,8 @@ fs_generator::generate_code(const cfg_t *cfg) /* Make sure fp->UsesDFdy flag got set (otherwise there's no * guarantee that key->render_to_fbo is set). */ - assert(fp->UsesDFdy); + assert(stage == MESA_SHADER_FRAGMENT && + ((gl_fragment_program *) prog)->UsesDFdy); generate_ddy(inst, dst, src[0], src[1], key->render_to_fbo); break; @@ -1961,10 +1964,10 @@ fs_generator::generate_code(const cfg_t *cfg) "Native code for %s fragment shader %d (SIMD%d dispatch):\n", shader_prog->Label ? shader_prog->Label : "unnamed", shader_prog->Name, dispatch_width); - } else if (fp) { + } else if (prog) { fprintf(stderr, "Native code for fragment program %d (SIMD%d dispatch):\n", - fp->Base.Id, dispatch_width); + prog->Id, dispatch_width); } else { fprintf(stderr, "Native code for blorp program (SIMD%d dispatch):\n", dispatch_width); @@ -1974,8 +1977,6 @@ fs_generator::generate_code(const cfg_t *cfg) dispatch_width, before_size / 16, loop_count, before_size, after_size, 100.0f * (before_size - after_size) / before_size); - const struct gl_program *prog = fp ? &fp->Base : NULL; - dump_assembly(p->store, annotation.ann_count, annotation.ann, brw, prog); ralloc_free(annotation.ann); } -- 2.30.2