diff options
author | Dave Airlie <[email protected]> | 2014-02-11 09:41:44 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2014-02-25 13:28:57 +1000 |
commit | 122c3b9486d3dbf8cb6b796c9a25f43817f006d3 (patch) | |
tree | 06adcc7da94ddd3c12568e445768dab569021e5a | |
parent | 945d87f95877e198fb2203f47a4ebbccae883978 (diff) |
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 <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r-- | src/glsl/Makefile.sources | 1 | ||||
-rw-r--r-- | src/glsl/ir_optimization.h | 1 | ||||
-rw-r--r-- | src/glsl/lower_offset_array.cpp (renamed from src/mesa/drivers/dri/i965/brw_lower_offset_array.cpp) | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/Makefile.sources | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 1 | ||||
-rw-r--r-- | 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 e69c1ac612b..5945590a57e 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 055d65547ba..24d019b718e 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 index 91c002ed568..0c235eda395 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 <[email protected]> */ -#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 dc30eb371e9..1649369e9e5 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 854583e4ba0..dbb30f221aa 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 643c140aa7c..fce2ec75961 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); |