[Mesa-dev] [PATCH 19/19] i965/fs: Add a function to resize fs_inst's sources array.

Matt Turner mattst88 at gmail.com
Thu Feb 20 13:41:32 PST 2014


---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 9 +++++++++
 src/mesa/drivers/dri/i965/brw_fs.h   | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 997b411..ce50e8b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -124,6 +124,15 @@ fs_inst::fs_inst(const fs_inst &that)
       this->src[i] = that.src[i];
 }
 
+void
+fs_inst::resize_sources(uint8_t num_sources)
+{
+   if (this->sources != num_sources) {
+      this->src = reralloc(mem_ctx, this->src, fs_reg, num_sources);
+      this->sources = num_sources;
+   }
+}
+
 #define ALU1(op)                                                        \
    fs_inst *                                                            \
    fs_visitor::op(fs_reg dst, fs_reg src0)                              \
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 6929a26..b086d5d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -182,6 +182,8 @@ public:
            const fs_reg &src2 = reg_undef);
    fs_inst(const fs_inst &that);
 
+   void resize_sources(uint8_t num_sources);
+
    bool equals(fs_inst *inst);
    bool overwrites_reg(const fs_reg &reg);
    bool is_send_from_grf();
-- 
1.8.3.2



More information about the mesa-dev mailing list