[Mesa-dev] [PATCH 05/13] i965/fs: make rescale_texcoord() more generic
Connor Abbott
cwabbott0 at gmail.com
Mon Aug 4 14:28:09 PDT 2014
Signed-off-by: Connor Abbott <connor.abbott at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 11 ++++++-----
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 482b92f..21b7f23 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -370,7 +370,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, int 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 84e83b9..a8f0133 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
@@ -484,7 +484,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 adbdf42..876847d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1606,7 +1606,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, int sampler, int texunit)
{
fs_inst *inst = NULL;
@@ -1664,7 +1664,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;
@@ -1704,9 +1704,9 @@ fs_visitor::rescale_texcoord(ir_texture *ir, fs_reg coordinate,
}
}
- if (ir->coordinate && needs_gl_clamp) {
+ if (coord_type && needs_gl_clamp) {
for (unsigned int i = 0;
- i < MIN2(ir->coordinate->type->vector_elements, 3); i++) {
+ i < MIN2(coord_type->vector_elements, 3); i++) {
if (key->tex.gl_clamp_mask[i] & (1 << sampler)) {
fs_reg chan = coordinate;
chan.reg_offset += i;
@@ -1796,7 +1796,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 ? ir->coordinate->type : NULL,
ir->sampler->type->sampler_dimensionality ==
GLSL_SAMPLER_DIM_RECT,
sampler, texunit);
--
1.9.3
More information about the mesa-dev
mailing list