From 26d74cd1d140786b8f4b1ccbaf500a16e68eec3c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 26 May 2010 17:42:03 -0700 Subject: [PATCH] Add stub visitor support for ir_texture. --- ir.h | 7 +++++++ ir_constant_expression.cpp | 10 ++++++++++ ir_constant_folding.cpp | 9 +++++++++ ir_function_inlining.cpp | 18 ++++++++++++++++++ ir_hierarchical_visitor.cpp | 14 ++++++++++++++ ir_hierarchical_visitor.h | 2 ++ ir_hv_accept.cpp | 6 ++++++ ir_visitor.h | 1 + 8 files changed, 67 insertions(+) diff --git a/ir.h b/ir.h index 44ffdc5..a286e7b 100644 --- a/ir.h +++ b/ir.h @@ -775,6 +775,13 @@ public: /* empty */ } + virtual void accept(ir_visitor *v) + { + v->visit(this); + } + + virtual ir_visitor_status accept(ir_hierarchical_visitor *); + /** * Return a string representing the ir_texture_opcode. */ diff --git a/ir_constant_expression.cpp b/ir_constant_expression.cpp index 361a7a1..e89b5bc 100644 --- a/ir_constant_expression.cpp +++ b/ir_constant_expression.cpp @@ -67,6 +67,7 @@ public: virtual void visit(ir_function_signature *); virtual void visit(ir_function *); virtual void visit(ir_expression *); + virtual void visit(ir_texture *); virtual void visit(ir_swizzle *); virtual void visit(ir_dereference_variable *); virtual void visit(ir_dereference_array *); @@ -503,6 +504,15 @@ ir_constant_visitor::visit(ir_expression *ir) void +ir_constant_visitor::visit(ir_texture *ir) +{ + // FINISHME: Do stuff with texture lookups + (void) ir; + value = NULL; +} + + +void ir_constant_visitor::visit(ir_swizzle *ir) { (void) ir; diff --git a/ir_constant_folding.cpp b/ir_constant_folding.cpp index b3f27c8..5dc4a7d 100644 --- a/ir_constant_folding.cpp +++ b/ir_constant_folding.cpp @@ -60,6 +60,7 @@ public: virtual void visit(ir_function_signature *); virtual void visit(ir_function *); virtual void visit(ir_expression *); + virtual void visit(ir_texture *); virtual void visit(ir_swizzle *); virtual void visit(ir_dereference_variable *); virtual void visit(ir_dereference_array *); @@ -115,6 +116,14 @@ ir_constant_folding_visitor::visit(ir_expression *ir) void +ir_constant_folding_visitor::visit(ir_texture *ir) +{ + // FINISHME: Do stuff with texture lookups + (void) ir; +} + + +void ir_constant_folding_visitor::visit(ir_swizzle *ir) { ir->val->accept(this); diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp index 7cc8a32..d66ecee 100644 --- a/ir_function_inlining.cpp +++ b/ir_function_inlining.cpp @@ -50,6 +50,7 @@ public: virtual ir_visitor_status visit_enter(ir_call *); virtual ir_visitor_status visit_enter(ir_assignment *); virtual ir_visitor_status visit_enter(ir_return *); + virtual ir_visitor_status visit_enter(ir_texture *); virtual ir_visitor_status visit_enter(ir_swizzle *); bool progress; @@ -118,6 +119,7 @@ public: virtual void visit(ir_function_signature *); virtual void visit(ir_function *); virtual void visit(ir_expression *); + virtual void visit(ir_texture *); virtual void visit(ir_swizzle *); virtual void visit(ir_dereference_variable *); virtual void visit(ir_dereference_array *); @@ -197,6 +199,14 @@ ir_function_cloning_visitor::visit(ir_expression *ir) void +ir_function_cloning_visitor::visit(ir_texture *ir) +{ + // FINISHME: Do stuff with texture lookups + (void) ir; +} + + +void ir_function_cloning_visitor::visit(ir_swizzle *ir) { ir->val->accept(this); @@ -437,6 +447,14 @@ ir_function_inlining_visitor::visit_enter(ir_return *ir) ir_visitor_status +ir_function_inlining_visitor::visit_enter(ir_texture *ir) +{ + (void) ir; + return visit_continue_with_parent; +} + + +ir_visitor_status ir_function_inlining_visitor::visit_enter(ir_swizzle *ir) { (void) ir; diff --git a/ir_hierarchical_visitor.cpp b/ir_hierarchical_visitor.cpp index ad47487..fd77391 100644 --- a/ir_hierarchical_visitor.cpp +++ b/ir_hierarchical_visitor.cpp @@ -109,6 +109,20 @@ ir_hierarchical_visitor::visit_leave(ir_expression *ir) } ir_visitor_status +ir_hierarchical_visitor::visit_enter(ir_texture *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status +ir_hierarchical_visitor::visit_leave(ir_texture *ir) +{ + (void) ir; + return visit_continue; +} + +ir_visitor_status ir_hierarchical_visitor::visit_enter(ir_swizzle *ir) { (void) ir; diff --git a/ir_hierarchical_visitor.h b/ir_hierarchical_visitor.h index d3ba508..85bc5bb 100644 --- a/ir_hierarchical_visitor.h +++ b/ir_hierarchical_visitor.h @@ -113,6 +113,8 @@ public: virtual ir_visitor_status visit_leave(class ir_function *); virtual ir_visitor_status visit_enter(class ir_expression *); virtual ir_visitor_status visit_leave(class ir_expression *); + virtual ir_visitor_status visit_enter(class ir_texture *); + virtual ir_visitor_status visit_leave(class ir_texture *); virtual ir_visitor_status visit_enter(class ir_swizzle *); virtual ir_visitor_status visit_leave(class ir_swizzle *); virtual ir_visitor_status visit_enter(class ir_dereference_array *); diff --git a/ir_hv_accept.cpp b/ir_hv_accept.cpp index 8d535e2..7c1798a 100644 --- a/ir_hv_accept.cpp +++ b/ir_hv_accept.cpp @@ -156,6 +156,12 @@ done: return v->visit_leave(this); } +ir_visitor_status +ir_texture::accept(ir_hierarchical_visitor *v) +{ + return visit_continue_with_parent; +} + ir_visitor_status ir_swizzle::accept(ir_hierarchical_visitor *v) diff --git a/ir_visitor.h b/ir_visitor.h index ba30858..a6f9d2b 100644 --- a/ir_visitor.h +++ b/ir_visitor.h @@ -48,6 +48,7 @@ public: virtual void visit(class ir_function_signature *) = 0; virtual void visit(class ir_function *) = 0; virtual void visit(class ir_expression *) = 0; + virtual void visit(class ir_texture *) = 0; virtual void visit(class ir_swizzle *) = 0; virtual void visit(class ir_dereference_variable *) = 0; virtual void visit(class ir_dereference_array *) = 0; -- 2.7.4