diff options
author | Michal Krol <[email protected]> | 2009-11-10 18:27:20 +0100 |
---|---|---|
committer | Michal Krol <[email protected]> | 2009-11-10 18:30:10 +0100 |
commit | 413e933fd57c53e6d6659cfcf21aba42249f43ca (patch) | |
tree | 530c9f3535b0b7e3b92c609f250be2fa4762db9b /src/mesa/shader | |
parent | eef5a0b3a3e03abd1c69649763efc79575df650f (diff) |
slang: Check OOM conditions for alloc_node_storage().
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 5eabe615b93..18d0146277e 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -195,6 +195,9 @@ alloc_node_storage(slang_emit_info *emitInfo, slang_ir_node *n, if (!n->Store) { assert(defaultSize > 0); n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, defaultSize); + if (!n->Store) { + return GL_FALSE; + } } /* now allocate actual register(s). I.e. set n->Store->Index >= 0 */ @@ -799,7 +802,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[0]->Children[0]); /* A */ emit(emitInfo, n->Children[0]->Children[1]); /* B */ emit(emitInfo, n->Children[1]); /* C */ - alloc_node_storage(emitInfo, n, -1); /* dest */ + if (alloc_node_storage(emitInfo, n, -1)) { /* dest */ + return NULL; + } inst = emit_instruction(emitInfo, OPCODE_MAD, @@ -820,7 +825,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[0]); /* A */ emit(emitInfo, n->Children[1]->Children[0]); /* B */ emit(emitInfo, n->Children[1]->Children[1]); /* C */ - alloc_node_storage(emitInfo, n, -1); /* dest */ + if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ + return NULL; + } inst = emit_instruction(emitInfo, OPCODE_MAD, @@ -846,7 +853,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) } /* result storage */ - alloc_node_storage(emitInfo, n, -1); + if (!alloc_node_storage(emitInfo, n, -1)) { + return NULL; + } inst = emit_instruction(emitInfo, info->InstOpcode, @@ -1100,7 +1109,9 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) * the intermediate result. Use a temp register instead. */ _mesa_bzero(&tmpNode, sizeof(tmpNode)); - alloc_node_storage(emitInfo, &tmpNode, n->Store->Size); + if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) { + return NULL; + } /* tmp = max(ch[0], ch[1]) */ inst = emit_instruction(emitInfo, OPCODE_MAX, |