diff options
author | Eric Anholt <[email protected]> | 2011-05-26 09:57:36 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-05-27 08:51:05 -0700 |
commit | 14b86f3c9131c1b26b01e07679cc899df0885b23 (patch) | |
tree | b9095aa46eab064864e660709aebcb1dc2b46eaf /src/mesa/drivers/dri/i965/brw_fs.cpp | |
parent | 53c89c67f33639afef951e178f93f4e29acc5d53 (diff) |
i965: Move non-FS-specific shader support to brw_shader.cpp.
These only existed in brw_fs.cpp because it was the only .cpp file in
the area when I wrote them.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.cpp')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index af70d922bac..89803cd9f24 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -34,7 +34,6 @@ extern "C" { #include "main/uniforms.h" #include "program/prog_parameter.h" #include "program/prog_print.h" -#include "program/prog_optimize.h" #include "program/register_allocate.h" #include "program/sampler.h" #include "program/hash_table.h" @@ -44,109 +43,11 @@ extern "C" { } #include "brw_fs.h" #include "../glsl/glsl_types.h" -#include "../glsl/ir_optimization.h" #include "../glsl/ir_print_visitor.h" #define MAX_INSTRUCTION (1 << 30) static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg); -struct gl_shader * -brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) -{ - struct brw_shader *shader; - - shader = rzalloc(NULL, struct brw_shader); - if (shader) { - shader->base.Type = type; - shader->base.Name = name; - _mesa_init_shader(ctx, &shader->base); - } - - return &shader->base; -} - -struct gl_shader_program * -brw_new_shader_program(struct gl_context *ctx, GLuint name) -{ - struct brw_shader_program *prog; - prog = rzalloc(NULL, struct brw_shader_program); - if (prog) { - prog->base.Name = name; - _mesa_init_shader_program(ctx, &prog->base); - } - return &prog->base; -} - -GLboolean -brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) -{ - struct brw_context *brw = brw_context(ctx); - struct intel_context *intel = &brw->intel; - - struct brw_shader *shader = - (struct brw_shader *)prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; - if (shader != NULL) { - void *mem_ctx = ralloc_context(NULL); - bool progress; - - if (shader->ir) - ralloc_free(shader->ir); - shader->ir = new(shader) exec_list; - clone_ir_list(mem_ctx, shader->ir, shader->base.ir); - - do_mat_op_to_vec(shader->ir); - lower_instructions(shader->ir, - MOD_TO_FRACT | - DIV_TO_MUL_RCP | - SUB_TO_ADD_NEG | - EXP_TO_EXP2 | - LOG_TO_LOG2); - - /* Pre-gen6 HW can only nest if-statements 16 deep. Beyond this, - * if-statements need to be flattened. - */ - if (intel->gen < 6) - lower_if_to_cond_assign(shader->ir, 16); - - do_lower_texture_projection(shader->ir); - do_vec_index_to_cond_assign(shader->ir); - brw_do_cubemap_normalize(shader->ir); - lower_noise(shader->ir); - lower_quadop_vector(shader->ir, false); - lower_variable_index_to_cond_assign(shader->ir, - GL_TRUE, /* input */ - GL_TRUE, /* output */ - GL_TRUE, /* temp */ - GL_TRUE /* uniform */ - ); - - do { - progress = false; - - brw_do_channel_expressions(shader->ir); - brw_do_vector_splitting(shader->ir); - - progress = do_lower_jumps(shader->ir, true, true, - true, /* main return */ - false, /* continue */ - false /* loops */ - ) || progress; - - progress = do_common_optimization(shader->ir, true, 32) || progress; - } while (progress); - - validate_ir_tree(shader->ir); - - reparent_ir(shader->ir, shader->ir); - ralloc_free(mem_ctx); - } - - if (!_mesa_ir_link_shader(ctx, prog)) - return GL_FALSE; - - return GL_TRUE; -} - static int type_size(const struct glsl_type *type) { |