From: Connor Abbott Date: Fri, 1 Aug 2014 22:03:03 +0000 (-0700) Subject: i965/fs: make rescale_texcoord() not use ir_texture. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a8905e8c0908e5ed3f86fa0a8bebeb0cee7ba619;p=mesa.git i965/fs: make rescale_texcoord() not use ir_texture. 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 Reviewed-by: Kenneth Graunke Reviewed-by: Chris Forbes --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 137f036a312..458ea1e39f1 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -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, diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index b1745dd2cb6..571fb668a66 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index c1ad969a5ac..baa94ce85f6 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -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);