i965/fs: make rescale_texcoord() not use ir_texture.
authorConnor Abbott <connor.abbott@intel.com>
Fri, 1 Aug 2014 22:03:03 +0000 (15:03 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 16 Oct 2014 00:04:56 +0000 (17:04 -0700)
Our new IR won't have ir_texture objects, but using glsl_type is fine.

v2 (Ken): Drop redundant ir->coordinate NULL check; rebase.

Signed-off-by: Connor Abbott <connor.abbott@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_fp.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp

index 137f036a312768d646738a1de6a4fd3107075c94..458ea1e39f19900a23843b66875321cb95596650 100644 (file)
@@ -468,7 +468,7 @@ public:
    void emit_interpolation_setup_gen4();
    void emit_interpolation_setup_gen6();
    void compute_sample_position(fs_reg dst, fs_reg int_sample_pos);
-   fs_reg rescale_texcoord(ir_texture *ir, fs_reg coordinate,
+   fs_reg rescale_texcoord(fs_reg coordinate, const glsl_type *coord_type,
                            bool is_rect, uint32_t sampler, int texunit);
    fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
                               fs_reg shadow_comp, fs_reg lod, fs_reg lod2,
index b1745dd2cb62844124ecaa737300a49d3a63df7b..571fb668a66c075b11f19ea600fb379ce4192c10 100644 (file)
@@ -482,7 +482,7 @@ fs_visitor::emit_fragment_program_code()
          if (fpi->TexShadow)
             shadow_c = offset(coordinate, 2);
 
-         coordinate = rescale_texcoord(ir, coordinate,
+         coordinate = rescale_texcoord(coordinate, coordinate_type,
                                        fpi->TexSrcTarget == TEXTURE_RECT_INDEX,
                                        fpi->TexSrcUnit, fpi->TexSrcUnit);
 
index c1ad969a5ac3b95b36e7e49db1711a026f1e82a2..baa94ce85f62b78cc13542aa5e55db8ff7b1e610 100644 (file)
@@ -1689,7 +1689,7 @@ fs_visitor::emit_texture_gen7(ir_texture *ir, fs_reg dst, fs_reg coordinate,
 }
 
 fs_reg
-fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
+fs_visitor::rescale_texcoord(fs_reg coordinate, const glsl_type *coord_type,
                              bool is_rect, uint32_t sampler, int texunit)
 {
    fs_inst *inst = NULL;
@@ -1751,7 +1751,7 @@ fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
     * tracking to get the scaling factor.
     */
    if (brw->gen < 6 && is_rect) {
-      fs_reg dst = fs_reg(this, ir->coordinate->type);
+      fs_reg dst = fs_reg(this, coord_type);
       fs_reg src = coordinate;
       coordinate = dst;
 
@@ -1791,9 +1791,8 @@ fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
       }
    }
 
-   if (ir->coordinate && needs_gl_clamp) {
-      for (unsigned int i = 0;
-          i < MIN2(ir->coordinate->type->vector_elements, 3); i++) {
+   if (coord_type && needs_gl_clamp) {
+      for (unsigned int i = 0; i < MIN2(coord_type->vector_elements, 3); i++) {
         if (tex->gl_clamp_mask[i] & (1 << sampler)) {
            fs_reg chan = coordinate;
            chan = offset(chan, i);
@@ -1923,7 +1922,8 @@ fs_visitor::visit(ir_texture *ir)
    if (ir->coordinate) {
       ir->coordinate->accept(this);
 
-      coordinate = rescale_texcoord(ir, this->result,
+      coordinate = rescale_texcoord(this->result,
+                                    ir->coordinate->type,
                                     ir->sampler->type->sampler_dimensionality ==
                                     GLSL_SAMPLER_DIM_RECT,
                                     sampler, texunit);