[Mesa-dev] [PATCH 11/29] i965: Add a visitor method to extract the result of a visit.
Francisco Jerez
currojerez at riseup.net
Sat May 2 08:29:38 PDT 2015
This method will be used by the implementation of the image and atomic
counter built-ins to extract the result of evaluating 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 ffb2e5b..0834ca5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -127,6 +127,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 c080e9b..0cfa0e0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -4213,6 +4213,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 988886f..d218f19 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -3667,6 +3667,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