Mesa (master): i965: convert brw_lower_offset_array_visitor to ir_rvalue_visitor
Chris Forbes
chrisf at kemper.freedesktop.org
Sun Nov 10 03:57:22 UTC 2013
Module: Mesa
Branch: master
Commit: 5442c0eae3a639d0c9daf447cdfecdbafb475658
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5442c0eae3a639d0c9daf447cdfecdbafb475658
Author: Chris Forbes <chrisf at ijw.co.nz>
Date: Sun Nov 10 09:15:13 2013 +1300
i965: convert brw_lower_offset_array_visitor to ir_rvalue_visitor
Previously, we would bogusly replace the entire statement containing the
ir_texture node with an ir_dereference_variable.
Correct this to just replace the ir_texture node itself as intended.
Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
.../drivers/dri/i965/brw_lower_offset_array.cpp | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp b/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp
index 19e1efe..91c002e 100644
--- a/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp
+++ b/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp
@@ -34,26 +34,31 @@
#include "glsl/glsl_types.h"
#include "glsl/ir.h"
#include "glsl/ir_builder.h"
+#include "glsl/ir_rvalue_visitor.h"
using namespace ir_builder;
-class brw_lower_offset_array_visitor : public ir_hierarchical_visitor {
+class brw_lower_offset_array_visitor : public ir_rvalue_visitor {
public:
brw_lower_offset_array_visitor()
{
progress = false;
}
- ir_visitor_status visit_leave(ir_texture *ir);
+ void handle_rvalue(ir_rvalue **rv);
bool progress;
};
-ir_visitor_status
-brw_lower_offset_array_visitor::visit_leave(ir_texture *ir)
+void
+brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
{
+ if (*rv == NULL || (*rv)->ir_type != ir_type_texture)
+ return;
+
+ ir_texture *ir = (ir_texture *) *rv;
if (ir->op != ir_tg4 || !ir->offset || !ir->offset->type->is_array())
- return visit_continue;
+ return;
void *mem_ctx = ralloc_parent(ir);
@@ -68,10 +73,9 @@ brw_lower_offset_array_visitor::visit_leave(ir_texture *ir)
base_ir->insert_before(assign(var, swizzle_w(tex), 1 << i));
}
- base_ir->replace_with(new (mem_ctx) ir_dereference_variable(var));
+ *rv = new (mem_ctx) ir_dereference_variable(var);
progress = true;
- return visit_continue;
}
extern "C" {
More information about the mesa-commit
mailing list