[Mesa-dev] [PATCH 06/23] i965: Add a visitor method to extract the result of a visit.

Francisco Jerez currojerez at riseup.net
Tue Apr 28 11:44:17 PDT 2015


This method will be used by the back-end-agnostic implementation of
the image and atomic counter built-ins to extract the register
location of its arguments.
---
 src/mesa/drivers/dri/i965/brw_fs.h             | 3 +++
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 7 +++++++
 src/mesa/drivers/dri/i965/brw_vec4.h           | 3 +++
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 7 +++++++
 4 files changed, 20 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index d882aae..e33a5f4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -119,6 +119,9 @@ public:
    void visit(ir_emit_vertex *);
    void visit(ir_end_primitive *);
 
+   /** Visit an instruction \p ir and extract the result. */
+   fs_reg visit_result(ir_instruction *ir);
+
    uint32_t gather_channel(int orig_chan, uint32_t sampler);
    void swizzle_result(ir_texture_opcode op, int dest_components,
                        fs_reg orig_val, uint32_t sampler);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 99fad6e..f3a5d4d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -4210,6 +4210,13 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
    *reg = neg_result;
 }
 
+fs_reg
+fs_visitor::visit_result(ir_instruction *ir)
+{
+   ir->accept(this);
+   return result;
+}
+
 fs_visitor::fs_visitor(struct brw_context *brw,
                        void *mem_ctx,
                        const struct brw_wm_prog_key *key,
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 3021e6f..fbbee4b 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -162,6 +162,9 @@ public:
    virtual void visit(ir_end_primitive *);
    /*@}*/
 
+   /** Visit an instruction \p ir and extract the result. */
+   src_reg visit_result(ir_instruction *ir);
+
    src_reg result;
 
    /* Regs for vertex results.  Generated at ir_variable visiting time
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 80beb26..3c03587 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3686,6 +3686,13 @@ vec4_visitor::resolve_bool_comparison(ir_rvalue *rvalue, src_reg *reg)
    *reg = neg_result;
 }
 
+src_reg
+vec4_visitor::visit_result(ir_instruction *ir)
+{
+   ir->accept(this);
+   return result;
+}
+
 vec4_visitor::vec4_visitor(struct brw_context *brw,
                            struct brw_vec4_compile *c,
                            struct gl_program *prog,
-- 
2.3.5



More information about the mesa-dev mailing list