Mesa (master): ir_to_mesa: Set up our instruction nodes with zeroed data.

Eric Anholt anholt at kemper.freedesktop.org
Tue Aug 31 18:36:05 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Aug 30 14:42:27 2010 -0700

ir_to_mesa: Set up our instruction nodes with zeroed data.

cond_update wasn't being set by emit_op3, leading to valgrind
complaints, and failures in several piglit tests when built with
clang.

---

 src/mesa/program/ir_to_mesa.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 516c991..768c11e 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -105,6 +105,18 @@ extern ir_to_mesa_src_reg ir_to_mesa_undef;
 
 class ir_to_mesa_instruction : public exec_node {
 public:
+   /* Callers of this talloc-based new need not call delete. It's
+    * easier to just talloc_free 'ctx' (or any of its ancestors). */
+   static void* operator new(size_t size, void *ctx)
+   {
+      void *node;
+
+      node = talloc_zero_size(ctx, size);
+      assert(node != NULL);
+
+      return node;
+   }
+
    enum prog_opcode op;
    ir_to_mesa_dst_reg dst_reg;
    ir_to_mesa_src_reg src_reg[3];




More information about the mesa-commit mailing list