[Mesa-dev] [PATCH 09/17] i965/fs: Replace c->prog_data with a direct reference in the generators.
Kenneth Graunke
kenneth at whitecape.org
Thu May 15 23:19:40 PDT 2014
'c' is going away. This is also a bit shorter.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs.h | 2 ++
src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 31 +++++++++++++------------
src/mesa/drivers/dri/i965/gen8_fs_generator.cpp | 19 ++++++++-------
3 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index d24f3f1..0c3cb0f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -699,6 +699,7 @@ private:
struct brw_compile *p;
struct brw_wm_compile *c;
+ struct brw_wm_prog_data *prog_data;
struct gl_shader_program *prog;
const struct gl_fragment_program *fp;
@@ -783,6 +784,7 @@ private:
void patch_discard_jumps_to_fb_writes();
struct brw_wm_compile *c;
+ struct brw_wm_prog_data *prog_data;
const struct gl_fragment_program *fp;
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 6007b57..ded8fbd 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -45,6 +45,7 @@ fs_generator::fs_generator(struct brw_context *brw,
: brw(brw), c(c), prog(prog), fp(fp), dual_source_output(dual_source_output)
{
ctx = &brw->ctx;
+ prog_data = &c->prog_data;
mem_ctx = c;
@@ -168,7 +169,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
brw_pop_insn_state(p);
uint32_t surf_index =
- c->prog_data.binding_table.render_target_start + inst->target;
+ prog_data->binding_table.render_target_start + inst->target;
brw_fb_WRITE(p,
dispatch_width,
inst->base_mrf,
@@ -180,7 +181,7 @@ fs_generator::generate_fb_write(fs_inst *inst)
eot,
inst->header_present);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -594,8 +595,8 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
uint32_t surface_index = ((inst->opcode == SHADER_OPCODE_TG4 ||
inst->opcode == SHADER_OPCODE_TG4_OFFSET)
- ? c->prog_data.base.binding_table.gather_texture_start
- : c->prog_data.base.binding_table.texture_start) + inst->sampler;
+ ? prog_data->base.binding_table.gather_texture_start
+ : prog_data->base.binding_table.texture_start) + inst->sampler;
brw_SAMPLE(p,
retype(dst, BRW_REGISTER_TYPE_UW),
@@ -610,7 +611,7 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src
simd_mode,
return_format);
- brw_mark_surface_used(&c->prog_data.base, surface_index);
+ brw_mark_surface_used(&prog_data->base, surface_index);
}
@@ -822,7 +823,7 @@ fs_generator::generate_uniform_pull_constant_load(fs_inst *inst,
brw_oword_block_read(p, dst, brw_message_reg(inst->base_mrf),
read_offset, surf_index);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -864,7 +865,7 @@ fs_generator::generate_uniform_pull_constant_load_gen7(fs_inst *inst,
BRW_SAMPLER_SIMD_MODE_SIMD4X2,
0);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -931,7 +932,7 @@ fs_generator::generate_varying_pull_constant_load(fs_inst *inst,
simd_mode,
return_format);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -975,7 +976,7 @@ fs_generator::generate_varying_pull_constant_load_gen7(fs_inst *inst,
simd_mode,
0);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
/**
@@ -1279,11 +1280,11 @@ fs_generator::generate_shader_time_add(fs_inst *inst,
brw_MOV(p, payload_offset, offset);
brw_MOV(p, payload_value, value);
brw_shader_time_add(p, payload,
- c->prog_data.base.binding_table.shader_time_start);
+ prog_data->base.binding_table.shader_time_start);
brw_pop_insn_state(p);
- brw_mark_surface_used(&c->prog_data.base,
- c->prog_data.base.binding_table.shader_time_start);
+ brw_mark_surface_used(&prog_data->base,
+ prog_data->base.binding_table.shader_time_start);
}
void
@@ -1300,7 +1301,7 @@ fs_generator::generate_untyped_atomic(fs_inst *inst, struct brw_reg dst,
atomic_op.dw1.ud, surf_index.dw1.ud,
inst->mlen, dispatch_width / 8);
- brw_mark_surface_used(&c->prog_data.base, surf_index.dw1.ud);
+ brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud);
}
void
@@ -1314,7 +1315,7 @@ fs_generator::generate_untyped_surface_read(fs_inst *inst, struct brw_reg dst,
surf_index.dw1.ud,
inst->mlen, dispatch_width / 8);
- brw_mark_surface_used(&c->prog_data.base, surf_index.dw1.ud);
+ brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud);
}
void
@@ -1861,7 +1862,7 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
}
/* Save off the start of this SIMD16 program */
- c->prog_data.prog_offset_16 = p->nr_insn * sizeof(struct brw_instruction);
+ prog_data->prog_offset_16 = p->nr_insn * sizeof(struct brw_instruction);
brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED);
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index 228de0c..f6e4a4b 100644
--- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
@@ -43,6 +43,7 @@ gen8_fs_generator::gen8_fs_generator(struct brw_context *brw,
: gen8_generator(brw, shader_prog, fp ? &fp->Base : NULL, c), c(c), fp(fp),
dual_source_output(dual_source_output)
{
+ prog_data = &c->prog_data;
}
gen8_fs_generator::~gen8_fs_generator()
@@ -119,7 +120,7 @@ gen8_fs_generator::generate_fb_write(fs_inst *ir)
msg_control |= (1 << 4); /* Last Render Target Select */
uint32_t surf_index =
- c->prog_data.binding_table.render_target_start + ir->target;
+ prog_data->binding_table.render_target_start + ir->target;
gen8_set_dp_message(brw, inst,
GEN6_SFID_DATAPORT_RENDER_CACHE,
@@ -131,7 +132,7 @@ gen8_fs_generator::generate_fb_write(fs_inst *ir)
ir->header_present,
ir->eot);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -278,7 +279,7 @@ gen8_fs_generator::generate_tex(fs_inst *ir,
}
uint32_t surf_index =
- c->prog_data.base.binding_table.texture_start + ir->sampler;
+ prog_data->base.binding_table.texture_start + ir->sampler;
gen8_instruction *inst = next_inst(BRW_OPCODE_SEND);
gen8_set_dst(brw, inst, dst);
@@ -292,7 +293,7 @@ gen8_fs_generator::generate_tex(fs_inst *ir,
ir->header_present,
simd_mode);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
@@ -564,7 +565,7 @@ gen8_fs_generator::generate_uniform_pull_constant_load(fs_inst *inst,
false, /* no header */
BRW_SAMPLER_SIMD_MODE_SIMD4X2);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
void
@@ -606,7 +607,7 @@ gen8_fs_generator::generate_varying_pull_constant_load(fs_inst *ir,
false, /* no header */
simd_mode);
- brw_mark_surface_used(&c->prog_data.base, surf_index);
+ brw_mark_surface_used(&prog_data->base, surf_index);
}
/**
@@ -849,7 +850,7 @@ gen8_fs_generator::generate_untyped_atomic(fs_inst *ir,
ir->header_present,
false);
- brw_mark_surface_used(&c->prog_data.base, surf_index.dw1.ud);
+ brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud);
}
void
@@ -875,7 +876,7 @@ gen8_fs_generator::generate_untyped_surface_read(fs_inst *ir,
ir->header_present,
false);
- brw_mark_surface_used(&c->prog_data.base, surf_index.dw1.ud);
+ brw_mark_surface_used(&prog_data->base, surf_index.dw1.ud);
}
void
@@ -1349,7 +1350,7 @@ gen8_fs_generator::generate_assembly(exec_list *simd8_instructions,
NOP();
/* Save off the start of this SIMD16 program */
- c->prog_data.prog_offset_16 = nr_inst * sizeof(gen8_instruction);
+ prog_data->prog_offset_16 = nr_inst * sizeof(gen8_instruction);
dispatch_width = 16;
generate_code(simd16_instructions);
--
1.9.2
More information about the mesa-dev
mailing list