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@ijw.co.nz>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2014-02-11 09:41:44 +10:00
parent 945d87f958
commit 122c3b9486
6 changed files with 9 additions and 12 deletions

View File

@ -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 \

View File

@ -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,

View File

@ -31,10 +31,11 @@
* \author Chris Forbes <chrisf@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;
}
}

View File

@ -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 \

View File

@ -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 {

View File

@ -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);