diff options
author | Brian Paul <[email protected]> | 2009-08-26 12:07:03 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-26 12:07:03 -0600 |
commit | 34da6024e3097684110cd1fd4da0f25adc415cd6 (patch) | |
tree | 9863d90d3fe54335426d342b7d52f3a254654faf | |
parent | f8b344114f4475ba267cbba320ab1c1d755d30a6 (diff) |
i965: keep track of which texture units the fragment shader accesses
We'll use this for debug/sanity checking.
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_fp.c | 18 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 847c44ed83a..26a64d65280 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -174,6 +174,9 @@ struct brw_fragment_program { dri_bo *const_buffer; /** Program constant buffer/surface */ GLboolean use_const_buffer; + + /** for debugging, which texture units are referenced */ + GLbitfield tex_units_used; }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 4ee2e97f17f..c5121266f98 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -42,6 +42,12 @@ #include "shader/prog_statevars.h" +/** An invalid texture target */ +#define TEX_TARGET_NONE NUM_TEXTURE_TARGETS + +/** An invalid texture unit */ +#define TEX_UNIT_NONE BRW_MAX_TEX_UNIT + #define FIRST_INTERNAL_TEMP MAX_NV_FRAGMENT_PROGRAM_TEMPS #define X 0 @@ -199,8 +205,14 @@ static struct prog_instruction * emit_tex_op(struct brw_wm_compile *c, { struct prog_instruction *inst = get_fp_inst(c); - assert(tex_src_unit < BRW_MAX_TEX_UNIT); - assert(tex_src_target < NUM_TEXTURE_TARGETS); + assert(tex_src_unit < BRW_MAX_TEX_UNIT || + tex_src_unit == TEX_UNIT_NONE); + assert(tex_src_target < NUM_TEXTURE_TARGETS || + tex_src_target == TEX_TARGET_NONE); + + /* update mask of which texture units are referenced by this program */ + if (tex_src_unit != TEX_UNIT_NONE) + c->fp->tex_units_used |= (1 << tex_src_unit); memset(inst, 0, sizeof(*inst)); @@ -226,7 +238,7 @@ static struct prog_instruction * emit_op(struct brw_wm_compile *c, struct prog_src_register src2 ) { return emit_tex_op(c, op, dest, saturate, - 0, 0, 0, /* tex unit, target, shadow */ + TEX_UNIT_NONE, TEX_TARGET_NONE, 0, /* unit, tgt, shadow */ src0, src1, src2); } |