[Mesa-dev] [PATCH 07/19] i965/fs: Add fs_inst constructor that takes a list of sources.

Matt Turner mattst88 at gmail.com
Fri Apr 18 11:56:43 PDT 2014


Also add an emit() function that calls it.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 20 ++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_fs.h   |  3 +++
 2 files changed, 23 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 1a7fe45..86eed27 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -78,6 +78,19 @@ fs_inst::fs_inst()
    this->opcode = BRW_OPCODE_NOP;
 }
 
+fs_inst::fs_inst(enum opcode opcode, const fs_reg &dst, fs_reg src[], int sources)
+{
+   memset(this, 0, sizeof(*this));
+
+   this->opcode = opcode;
+   this->sources = sources;
+   this->src = src;
+
+   this->dst = dst;
+
+   this->regs_written = sources;
+}
+
 fs_inst::fs_inst(enum opcode opcode, const fs_reg &dst,
                  const fs_reg &src0, const fs_reg &src1, const fs_reg &src2)
 {
@@ -759,6 +772,13 @@ fs_visitor::emit(enum opcode opcode, fs_reg dst,
    return emit(new(mem_ctx) fs_inst(opcode, dst, src0, src1, src2));
 }
 
+fs_inst *
+fs_visitor::emit(enum opcode opcode, fs_reg dst,
+                 fs_reg src[], int sources)
+{
+   return emit(new(mem_ctx) fs_inst(opcode, dst, src, sources));
+}
+
 void
 fs_visitor::push_force_uncompressed()
 {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 1e73b09..4f1bdc6 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -192,6 +192,7 @@ public:
    void init(int sources);
 
    fs_inst();
+   fs_inst(enum opcode opcode, const fs_reg &dst, fs_reg src[], int sources);
    fs_inst(enum opcode opcode, const fs_reg &dst = reg_undef,
            const fs_reg &src0 = reg_undef,
            const fs_reg &src1 = reg_undef,
@@ -298,6 +299,8 @@ public:
    fs_inst *emit(enum opcode opcode, fs_reg dst, fs_reg src0, fs_reg src1);
    fs_inst *emit(enum opcode opcode, fs_reg dst,
                  fs_reg src0, fs_reg src1, fs_reg src2);
+   fs_inst *emit(enum opcode opcode, fs_reg dst,
+                 fs_reg src[], int sources);
 
    fs_inst *MOV(fs_reg dst, fs_reg src);
    fs_inst *NOT(fs_reg dst, fs_reg src);
-- 
1.8.3.2



More information about the mesa-dev mailing list