1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Copyright © 2010 Intel Corporation 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a 5*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"), 6*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation 7*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the 9*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions: 10*61046927SAndroid Build Coastguard Worker * 11*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the next 12*61046927SAndroid Build Coastguard Worker * paragraph) shall be included in all copies or substantial portions of the 13*61046927SAndroid Build Coastguard Worker * Software. 14*61046927SAndroid Build Coastguard Worker * 15*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*61046927SAndroid Build Coastguard Worker * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20*61046927SAndroid Build Coastguard Worker * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21*61046927SAndroid Build Coastguard Worker * DEALINGS IN THE SOFTWARE. 22*61046927SAndroid Build Coastguard Worker */ 23*61046927SAndroid Build Coastguard Worker 24*61046927SAndroid Build Coastguard Worker /** 25*61046927SAndroid Build Coastguard Worker * \file ir_optimization.h 26*61046927SAndroid Build Coastguard Worker * 27*61046927SAndroid Build Coastguard Worker * Prototypes for optimization passes to be called by the compiler and drivers. 28*61046927SAndroid Build Coastguard Worker */ 29*61046927SAndroid Build Coastguard Worker 30*61046927SAndroid Build Coastguard Worker #ifndef GLSL_IR_OPTIMIZATION_H 31*61046927SAndroid Build Coastguard Worker #define GLSL_IR_OPTIMIZATION_H 32*61046927SAndroid Build Coastguard Worker 33*61046927SAndroid Build Coastguard Worker struct gl_shader; 34*61046927SAndroid Build Coastguard Worker struct gl_linked_shader; 35*61046927SAndroid Build Coastguard Worker struct gl_shader_program; 36*61046927SAndroid Build Coastguard Worker 37*61046927SAndroid Build Coastguard Worker bool do_common_optimization(exec_list *ir, bool linked, 38*61046927SAndroid Build Coastguard Worker const struct gl_shader_compiler_options *options, 39*61046927SAndroid Build Coastguard Worker bool native_integers); 40*61046927SAndroid Build Coastguard Worker 41*61046927SAndroid Build Coastguard Worker bool do_rebalance_tree(exec_list *instructions); 42*61046927SAndroid Build Coastguard Worker bool do_algebraic(exec_list *instructions, bool native_integers, 43*61046927SAndroid Build Coastguard Worker const struct gl_shader_compiler_options *options); 44*61046927SAndroid Build Coastguard Worker bool do_dead_code(exec_list *instructions); 45*61046927SAndroid Build Coastguard Worker bool do_dead_code_local(exec_list *instructions); 46*61046927SAndroid Build Coastguard Worker bool do_dead_code_unlinked(exec_list *instructions); 47*61046927SAndroid Build Coastguard Worker bool opt_flip_matrices(exec_list *instructions); 48*61046927SAndroid Build Coastguard Worker bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false); 49*61046927SAndroid Build Coastguard Worker bool do_if_simplification(exec_list *instructions); 50*61046927SAndroid Build Coastguard Worker bool opt_flatten_nested_if_blocks(exec_list *instructions); 51*61046927SAndroid Build Coastguard Worker bool do_mat_op_to_vec(exec_list *instructions); 52*61046927SAndroid Build Coastguard Worker bool do_minmax_prune(exec_list *instructions); 53*61046927SAndroid Build Coastguard Worker bool do_tree_grafting(exec_list *instructions); 54*61046927SAndroid Build Coastguard Worker bool do_vec_index_to_cond_assign(exec_list *instructions); 55*61046927SAndroid Build Coastguard Worker bool lower_instructions(exec_list *instructions, 56*61046927SAndroid Build Coastguard Worker bool have_gpu_shader5); 57*61046927SAndroid Build Coastguard Worker bool lower_packing_builtins(exec_list *instructions, 58*61046927SAndroid Build Coastguard Worker bool has_shading_language_packing, 59*61046927SAndroid Build Coastguard Worker bool has_gpu_shader5, 60*61046927SAndroid Build Coastguard Worker bool has_half_float_packing); 61*61046927SAndroid Build Coastguard Worker bool lower_vector_derefs(gl_shader *shader); 62*61046927SAndroid Build Coastguard Worker void optimize_dead_builtin_variables(exec_list *instructions, 63*61046927SAndroid Build Coastguard Worker enum ir_variable_mode other); 64*61046927SAndroid Build Coastguard Worker 65*61046927SAndroid Build Coastguard Worker bool lower_builtins(exec_list *instructions); 66*61046927SAndroid Build Coastguard Worker bool lower_subroutine(exec_list *instructions, struct _mesa_glsl_parse_state *state); 67*61046927SAndroid Build Coastguard Worker bool propagate_invariance(exec_list *instructions); 68*61046927SAndroid Build Coastguard Worker 69*61046927SAndroid Build Coastguard Worker namespace ir_builder { class ir_factory; }; 70*61046927SAndroid Build Coastguard Worker 71*61046927SAndroid Build Coastguard Worker void lower_precision(const struct gl_shader_compiler_options *options, 72*61046927SAndroid Build Coastguard Worker exec_list *instructions); 73*61046927SAndroid Build Coastguard Worker 74*61046927SAndroid Build Coastguard Worker #endif /* GLSL_IR_OPTIMIZATION_H */ 75