Mesa (master): i965: Get rid of the do_lower_unnormalized_offsets pass

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Jul 22 23:33:09 UTC 2016


Module: Mesa
Branch: master
Commit: 67b7d876e429f13de874df447c67f47d2890f71a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=67b7d876e429f13de874df447c67f47d2890f71a

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Jul 21 13:07:17 2016 -0700

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 <jason at jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: "12.0" <mesa-dev at lists.freedesktop.org>

---

 src/mesa/drivers/dri/i965/Makefile.sources         |   1 -
 src/mesa/drivers/dri/i965/brw_context.h            |   1 -
 src/mesa/drivers/dri/i965/brw_link.cpp             |   1 -
 .../dri/i965/brw_lower_unnormalized_offset.cpp     | 106 ---------------------
 4 files changed, 109 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index ca7591f..df6b5dd 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 bfad868..e0f7000 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 a77df50..1ad2369 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 f5d7bae..0000000
--- 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 <chrisf at 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;
-}
-
-}




More information about the mesa-commit mailing list