i965: Get rid of the do_lower_unnormalized_offsets pass
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 21 Jul 2016 20:07:17 +0000 (13:07 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 22 Jul 2016 23:48:54 +0000 (16:48 -0700)
We can do this in NIR now.  No need to keep a GLSL pass lying around for
it.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "12.0" <mesa-dev@lists.freedesktop.org>
src/mesa/drivers/dri/i965/Makefile.sources
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_lower_unnormalized_offset.cpp [deleted file]

index ca7591f7b05454f162cb5a239eee73d14e44a2f8..df6b5dd2aa0d7d6be0d653c96532431f80f17a61 100644 (file)
@@ -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 \
index bfad868cf87db1f573bc1ba2fe8a5718eb3d1cea..e0f70007478eedc48372388e1cdb3ba8c5b4d09b 100644 (file)
@@ -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];
index a77df50c7c4cdc24c3731497a3389d99ba49ef69..1ad236969529e6f01359747f1a0cc12e2d66d3ec 100644 (file)
@@ -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 (file)
index f5d7bae..0000000
+++ /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 <chrisf@ijw.co.nz>
- */
-
-#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;
-}
-
-}