ir_function_cloning_visitor: Add support for ir_texture.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Jun 2010 18:07:53 +0000 (11:07 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Jun 2010 18:14:58 +0000 (11:14 -0700)
ir.h
ir_function_inlining.cpp

diff --git a/ir.h b/ir.h
index 33ce4a04c360ab1de53316b8d6e4c40785f621e4..78ea196ffbcd24615119665c37181b5a480a4d84 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -770,7 +770,7 @@ enum ir_texture_opcode {
 class ir_texture : public ir_rvalue {
 public:
    ir_texture(enum ir_texture_opcode op)
-      : op(op)
+      : op(op), projector(NULL), shadow_comparitor(NULL)
    {
       /* empty */
    }
index d66eceedb86c1ce7e3387afac1fd9c7a92dd83a5..a501c813fb8395278c9a8e9e060845a8b705a45f 100644 (file)
@@ -201,8 +201,28 @@ 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;
+   ir_texture *tex = new ir_texture(ir->op);
+
+   ir->sampler->accept(this);
+   tex->set_sampler(this->result->as_dereference());
+
+   ir->coordinate->accept(this);
+   tex->coordinate = this->result->as_rvalue();
+
+   if (ir->projector != NULL) {
+      ir->projector->accept(this);
+      tex->projector = this->result->as_rvalue();
+   }
+
+   if (ir->shadow_comparitor != NULL) {
+      ir->shadow_comparitor->accept(this);
+      tex->shadow_comparitor = this->result->as_rvalue();
+   }
+
+   for (int i = 0; i < 3; i++)
+      tex->offsets[i] = ir->offsets[i];
+
+   tex->lod_info = ir->lod_info;
 }