Mesa (master): gallivm: Cope with tgsi instruction reallocation failure.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Sun Sep 5 02:18:03 PDT 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Thu Sep  2 11:30:13 2010 +0100

gallivm: Cope with tgsi instruction reallocation failure.

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 0e07f7f..871bec2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -612,7 +612,6 @@ emit_fetch(
       break;
 
    case TGSI_UTIL_SIGN_SET:
-      /* TODO: Use bitwese OR for floating point */
       res = lp_build_abs( &bld->base, res );
       /* fall through */
    case TGSI_UTIL_SIGN_TOGGLE:
@@ -2063,11 +2062,16 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
          {
             /* save expanded instruction */
             if (num_instructions == bld.max_instructions) {
-               bld.instructions = REALLOC(bld.instructions,
-                                          bld.max_instructions
-                                          * sizeof(struct tgsi_full_instruction),
-                                          (bld.max_instructions + LP_MAX_INSTRUCTIONS)
-                                          * sizeof(struct tgsi_full_instruction));
+               struct tgsi_full_instruction *instructions;
+               instructions = REALLOC(bld.instructions,
+                                      bld.max_instructions
+                                      * sizeof(struct tgsi_full_instruction),
+                                      (bld.max_instructions + LP_MAX_INSTRUCTIONS)
+                                      * sizeof(struct tgsi_full_instruction));
+               if (!instructions) {
+                  break;
+               }
+               bld.instructions = instructions;
                bld.max_instructions += LP_MAX_INSTRUCTIONS;
             }
 



More information about the mesa-commit mailing list