Mesa (master): mesa: added some assertions

Brian Paul brianp at kemper.freedesktop.org
Fri Mar 6 00:29:52 UTC 2009


Module: Mesa
Branch: master
Commit: be8c0b25eaf67b7deefe7844d0b8ed19abad8d86
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=be8c0b25eaf67b7deefe7844d0b8ed19abad8d86

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Mar  5 17:14:29 2009 -0700

mesa: added some assertions

---

 src/mesa/shader/prog_instruction.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c
index 4a6d0d6..6a21152 100644
--- a/src/mesa/shader/prog_instruction.c
+++ b/src/mesa/shader/prog_instruction.c
@@ -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;




More information about the mesa-commit mailing list