diff options
author | Brian Paul <brianp@vmware.com> | 2009-08-25 16:12:46 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-08-25 17:46:10 -0600 |
commit | b7d2023cf99319c71a929c35478dff07d35df392 (patch) | |
tree | 5c8752770075604dd92f10dd3437f3a5ab2fc7c9 /src/mesa/drivers | |
parent | f9ce0a91dccdfc8b4fcb3020965cb6b2d0d2f6d0 (diff) |
i965: add some texture unit/target assertions
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_fp.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 5dc076a825..4ee2e97f17 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -199,6 +199,9 @@ 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); + memset(inst, 0, sizeof(*inst)); inst->Opcode = op; @@ -683,6 +686,8 @@ static void precalc_tex( struct brw_wm_compile *c, struct prog_dst_register tmpcoord; const GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]; + assert(unit < BRW_MAX_TEX_UNIT); + if (inst->TexSrcTarget == TEXTURE_CUBE_INDEX) { struct prog_instruction *out; struct prog_dst_register tmp0 = get_temp(c); @@ -1152,6 +1157,7 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) case OPCODE_TXB: out = emit_insn(c, inst); out->TexSrcUnit = fp->program.Base.SamplerUnits[inst->TexSrcUnit]; + assert(out->TexSrcUnit < BRW_MAX_TEX_UNIT); break; case OPCODE_XPD: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index a5b18ec7d7..2a31077a66 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2627,6 +2627,8 @@ static void emit_txb(struct brw_wm_compile *c, GLuint i; GLuint msg_type; + assert(unit < BRW_MAX_TEX_UNIT); + payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); for (i = 0; i < 4; i++) @@ -2690,6 +2692,8 @@ static void emit_tex(struct brw_wm_compile *c, GLboolean shadow = (c->key.shadowtex_mask & (1<<unit)) ? 1 : 0; GLuint msg_type; + assert(unit < BRW_MAX_TEX_UNIT); + payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0); for (i = 0; i < 4; i++) |