i965: add some texture unit/target assertions

This commit is contained in:
Brian Paul 2009-08-25 16:12:46 -06:00
parent f9ce0a91dc
commit b7d2023cf9
2 changed files with 10 additions and 0 deletions

View file

@ -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:

View file

@ -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++)