[Mesa-dev] [PATCH 6/6] i965/fs: Remove direct fs_generator brw_wm_prog_key dependence
Jordan Justen
jordan.l.justen at intel.com
Fri Sep 5 00:44:17 PDT 2014
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 at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index f40357f..502e6c7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -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;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 826b83a..1bc10f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -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:
--
2.1.0
More information about the mesa-dev
mailing list