From: Jason Ekstrand Date: Thu, 21 Jul 2016 20:07:17 +0000 (-0700) Subject: i965: Get rid of the do_lower_unnormalized_offsets pass X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=67b7d876e429f13de874df447c67f47d2890f71a;p=mesa.git i965: Get rid of the do_lower_unnormalized_offsets pass We can do this in NIR now. No need to keep a GLSL pass lying around for it. Signed-off-by: Jason Ekstrand Reviewed-by: Kenneth Graunke Cc: "12.0" --- diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index ca7591f7b05..df6b5dd2aa0 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -133,7 +133,6 @@ i965_FILES = \ brw_gs_surface_state.c \ brw_link.cpp \ brw_lower_texture_gradients.cpp \ - brw_lower_unnormalized_offset.cpp \ brw_meta_util.c \ brw_meta_util.h \ brw_misc_state.c \ diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index bfad868cf87..e0f70007478 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1795,7 +1795,6 @@ brw_program_reloc(struct brw_context *brw, uint32_t state_offset, bool brw_do_cubemap_normalize(struct exec_list *instructions); bool brw_lower_texture_gradients(struct brw_context *brw, struct exec_list *instructions); -bool brw_do_lower_unnormalized_offset(struct exec_list *instructions); extern const char * const conditional_modifier[16]; extern const char *const pred_ctrl_align16[16]; diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index a77df50c7c4..1ad23696952 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -132,7 +132,6 @@ process_glsl_ir(gl_shader_stage stage, do_vec_index_to_cond_assign(shader->ir); lower_vector_insert(shader->ir, true); lower_offset_arrays(shader->ir); - brw_do_lower_unnormalized_offset(shader->ir); lower_noise(shader->ir); lower_quadop_vector(shader->ir, false); diff --git a/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp b/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp deleted file mode 100644 index f5d7baee6db..00000000000 --- a/src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright © 2013 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file brw_lower_unnormalized_offset.cpp - * - * IR lower pass to convert a texture offset into an adjusted coordinate, - * for use with unnormalized coordinates. At least the gather4* messages - * on Ivybridge and Haswell make a mess with nonzero offsets. - * - * \author Chris Forbes - */ - -#include "compiler/glsl_types.h" -#include "compiler/glsl/ir.h" -#include "compiler/glsl/ir_builder.h" - -using namespace ir_builder; - -class brw_lower_unnormalized_offset_visitor : public ir_hierarchical_visitor { -public: - brw_lower_unnormalized_offset_visitor() - { - progress = false; - } - - ir_visitor_status visit_leave(ir_texture *ir); - - bool progress; -}; - -ir_visitor_status -brw_lower_unnormalized_offset_visitor::visit_leave(ir_texture *ir) -{ - if (!ir->offset) - return visit_continue; - - if (ir->op == ir_tg4 || ir->op == ir_tex) { - if (ir->sampler->type->sampler_dimensionality != GLSL_SAMPLER_DIM_RECT) - return visit_continue; - } - else if (ir->op != ir_txf) { - return visit_continue; - } - - void *mem_ctx = ralloc_parent(ir); - - if (ir->op == ir_txf) { - /* It appears that the ld instruction used for txf does its - * address bounds check before adding in the offset. To work - * around this, just add the integer offset to the integer texel - * coordinate, and don't put the offset in the header. - */ - ir_variable *var = new(mem_ctx) ir_variable(ir->coordinate->type, - "coordinate", - ir_var_temporary); - base_ir->insert_before(var); - base_ir->insert_before(assign(var, ir->coordinate)); - base_ir->insert_before(assign(var, - add(swizzle_for_size(var, ir->offset->type->vector_elements), ir->offset), - (1 << ir->offset->type->vector_elements) - 1)); - - ir->coordinate = new(mem_ctx) ir_dereference_variable(var); - } else { - ir->coordinate = add(ir->coordinate, i2f(ir->offset)); - } - - ir->offset = NULL; - - progress = true; - return visit_continue; -} - -extern "C" { - -bool -brw_do_lower_unnormalized_offset(exec_list *instructions) -{ - brw_lower_unnormalized_offset_visitor v; - - visit_list_elements(&v, instructions); - - return v.progress; -} - -}