mesa: added some assertions
authorBrian Paul <brianp@vmware.com>
Fri, 6 Mar 2009 00:14:29 +0000 (17:14 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 6 Mar 2009 00:25:25 +0000 (17:25 -0700)
src/mesa/shader/prog_instruction.c

index 4a6d0d670aca655d873985df9e50138365642369..6a21152c60be458c7680c9615c038c2ca199eb19 100644 (file)
@@ -254,6 +254,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
 GLuint
 _mesa_num_inst_src_regs(gl_inst_opcode opcode)
 {
+   ASSERT(opcode < MAX_OPCODE);
    ASSERT(opcode == InstInfo[opcode].Opcode);
    ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
    return InstInfo[opcode].NumSrcRegs;
@@ -266,6 +267,7 @@ _mesa_num_inst_src_regs(gl_inst_opcode opcode)
 GLuint
 _mesa_num_inst_dst_regs(gl_inst_opcode opcode)
 {
+   ASSERT(opcode < MAX_OPCODE);
    ASSERT(opcode == InstInfo[opcode].Opcode);
    ASSERT(OPCODE_XPD == InstInfo[OPCODE_XPD].Opcode);
    return InstInfo[opcode].NumDstRegs;