i965/fs: Move sampler fetch to the top of the ir_texture visit function.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 10 Jun 2011 21:49:36 +0000 (14:49 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 19 Jun 2011 00:53:53 +0000 (17:53 -0700)
This makes it available earlier, which will soon be necessary.
(Separating code motion from actual changes.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index a5479e1178b39d54e739c9b03997b41a18567f97..ac2437551ae49c379c8e8d1d322faed9c89744b0 100644 (file)
@@ -932,9 +932,11 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
 void
 fs_visitor::visit(ir_texture *ir)
 {
-   int sampler;
    fs_inst *inst = NULL;
 
+   int sampler = _mesa_get_sampler_uniform_value(ir->sampler, prog, &fp->Base);
+   sampler = fp->Base.SamplerUnits[sampler];
+
    this->result = reg_undef;
    ir->coordinate->accept(this);
    fs_reg coordinate = this->result;
@@ -973,11 +975,6 @@ fs_visitor::visit(ir_texture *ir)
    /* Should be lowered by do_lower_texture_projection */
    assert(!ir->projector);
 
-   sampler = _mesa_get_sampler_uniform_value(ir->sampler,
-                                            prog,
-                                            &fp->Base);
-   sampler = fp->Base.SamplerUnits[sampler];
-
    /* The 965 requires the EU to do the normalization of GL rectangle
     * texture coordinates.  We use the program parameter state
     * tracking to get the scaling factor.