The reason to add a help function instead of just use 'insn - p->store' instead is that this help function includes an assert.
Signed-off-by: Yuanhan Liu <yuanhan....@linux.intel.com> --- src/mesa/drivers/dri/i965/brw_eu.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index dcb1fc9..c7eefe3 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -786,6 +786,13 @@ static INLINE struct brw_instruction *current_insn( struct brw_compile *p) return &p->store[p->nr_insn]; } +static INLINE int +brw_insn_index(struct brw_compile *p, struct brw_instruction *insn) +{ + assert((insn - p->store < (int)p->nr_insn) && (insn - p->store > 0)); + return insn - p->store; +} + void brw_pop_insn_state( struct brw_compile *p ); void brw_push_insn_state( struct brw_compile *p ); void brw_set_mask_control( struct brw_compile *p, GLuint value ); -- 1.7.4.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev