Mesa (master): glsl/i965: move lower_offset_array up to GLSL compiler level.

Dave Airlie airlied at kemper.freedesktop.org
Tue Feb 25 03:41:28 UTC 2014


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Feb 11 09:41:44 2014 +1000

glsl/i965: move lower_offset_array up to GLSL compiler level.

This lowering pass will be useful for gallium drivers as well, in order to support
the GL TG4 oddity that is textureGatherOffsets.

Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/glsl/Makefile.sources                               |    1 +
 src/glsl/ir_optimization.h                              |    1 +
 .../lower_offset_array.cpp}                             |   15 ++++++---------
 src/mesa/drivers/dri/i965/Makefile.sources              |    1 -
 src/mesa/drivers/dri/i965/brw_context.h                 |    1 -
 src/mesa/drivers/dri/i965/brw_shader.cpp                |    2 +-
 6 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index e69c1ac..5945590 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -67,6 +67,7 @@ LIBGLSL_FILES = \
 	$(GLSL_SRCDIR)/lower_jumps.cpp \
 	$(GLSL_SRCDIR)/lower_mat_op_to_vec.cpp \
 	$(GLSL_SRCDIR)/lower_noise.cpp \
+	$(GLSL_SRCDIR)/lower_offset_array.cpp \
 	$(GLSL_SRCDIR)/lower_packed_varyings.cpp \
 	$(GLSL_SRCDIR)/lower_named_interface_blocks.cpp \
 	$(GLSL_SRCDIR)/lower_packing_builtins.cpp \
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 055d655..24d019b 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -120,6 +120,7 @@ bool lower_vector_insert(exec_list *instructions, bool lower_nonconstant_index);
 void lower_named_interface_blocks(void *mem_ctx, gl_shader *shader);
 bool optimize_redundant_jumps(exec_list *instructions);
 bool optimize_split_arrays(exec_list *instructions, bool linked);
+bool lower_offset_arrays(exec_list *instructions);
 
 ir_rvalue *
 compare_index_block(exec_list *instructions, ir_variable *index,
diff --git a/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp b/src/glsl/lower_offset_array.cpp
similarity index 93%
rename from src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp
rename to src/glsl/lower_offset_array.cpp
index 91c002e..0c235ed 100644
--- a/src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp
+++ b/src/glsl/lower_offset_array.cpp
@@ -31,10 +31,11 @@
  * \author Chris Forbes <chrisf at ijw.co.nz>
  */
 
-#include "glsl/glsl_types.h"
-#include "glsl/ir.h"
-#include "glsl/ir_builder.h"
-#include "glsl/ir_rvalue_visitor.h"
+#include "glsl_types.h"
+#include "ir.h"
+#include "ir_builder.h"
+#include "ir_optimization.h"
+#include "ir_rvalue_visitor.h"
 
 using namespace ir_builder;
 
@@ -78,10 +79,8 @@ brw_lower_offset_array_visitor::handle_rvalue(ir_rvalue **rv)
    progress = true;
 }
 
-extern "C" {
-
 bool
-brw_do_lower_offset_arrays(exec_list *instructions)
+lower_offset_arrays(exec_list *instructions)
 {
    brw_lower_offset_array_visitor v;
 
@@ -89,5 +88,3 @@ brw_do_lower_offset_arrays(exec_list *instructions)
 
    return v.progress;
 }
-
-}
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources
index dc30eb3..1649369 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -73,7 +73,6 @@ i965_FILES = \
 	brw_gs_surface_state.c \
 	brw_interpolation_map.c \
 	brw_lower_texture_gradients.cpp \
-	brw_lower_offset_array.cpp \
 	brw_lower_unnormalized_offset.cpp \
 	brw_misc_state.c \
 	brw_object_purgeable.c \
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 854583e..dbb30f2 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1843,7 +1843,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_offset_arrays(struct exec_list *instructions);
 bool brw_do_lower_unnormalized_offset(struct exec_list *instructions);
 
 struct opcode_desc {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 643c140..fce2ec7 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -167,7 +167,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
       do_vec_index_to_cond_assign(shader->base.ir);
       lower_vector_insert(shader->base.ir, true);
       brw_do_cubemap_normalize(shader->base.ir);
-      brw_do_lower_offset_arrays(shader->base.ir);
+      lower_offset_arrays(shader->base.ir);
       brw_do_lower_unnormalized_offset(shader->base.ir);
       lower_noise(shader->base.ir);
       lower_quadop_vector(shader->base.ir, false);




More information about the mesa-commit mailing list