From b97efa5db5fce2e0d9a4c61a939c85b240c89170 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 9 Jun 2010 11:07:53 -0700 Subject: [PATCH] ir_function_cloning_visitor: Add support for ir_texture. --- ir.h | 2 +- ir_function_inlining.cpp | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ir.h b/ir.h index 33ce4a04c36..78ea196ffbc 100644 --- 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 */ } diff --git a/ir_function_inlining.cpp b/ir_function_inlining.cpp index d66eceedb86..a501c813fb8 100644 --- a/ir_function_inlining.cpp +++ b/ir_function_inlining.cpp @@ -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; } -- 2.30.2