diff options
author | Kenneth Graunke <[email protected]> | 2014-04-06 23:25:00 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-04-08 00:02:03 -0700 |
commit | 169c645f12337cdc3e02b628f9cde6a9fb72acc2 (patch) | |
tree | 6495da83c2faef2f37016d0a343947b4189dde7d /src | |
parent | 40d9337406709d0e5e143c51dc5d57921a91aab9 (diff) |
glsl: Pass ctx->Const.NativeIntegers to do_common_optimization().
The next few patches will introduce an optimization that only works when
integers are not represented as floating point values.
v2: Re-word-wrap a line, as requested by Ian Romanick.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 6 | ||||
-rw-r--r-- | src/glsl/ir_optimization.h | 3 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 4 | ||||
-rw-r--r-- | src/glsl/test_optpass.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 3 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 3 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 |
8 files changed, 18 insertions, 9 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 8422ba6f00b..532b6a5e7c0 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1444,7 +1444,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times */ - while (do_common_optimization(shader->ir, false, false, 32, options)) + while (do_common_optimization(shader->ir, false, false, 32, options, + ctx->Const.NativeIntegers)) ; validate_ir_tree(shader->ir); @@ -1492,7 +1493,8 @@ bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, unsigned max_unroll_iterations, - const struct gl_shader_compiler_options *options) + const struct gl_shader_compiler_options *options, + bool native_integers) { GLboolean progress = GL_FALSE; diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 5f4a2f4051c..9f31826d901 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -67,7 +67,8 @@ enum lower_packing_builtins_op { bool do_common_optimization(exec_list *ir, bool linked, bool uniform_locations_assigned, unsigned max_unroll_iterations, - const struct gl_shader_compiler_options *options); + const struct gl_shader_compiler_options *options, + bool native_integers); bool do_algebraic(exec_list *instructions); bool do_constant_folding(exec_list *instructions); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 3bf27896523..7c194a26a36 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -2298,7 +2298,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations; - while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll, &ctx->ShaderCompilerOptions[i])) + while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, + max_unroll, &ctx->ShaderCompilerOptions[i], + ctx->Const.NativeIntegers)) ; } diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp index f1b9579cd3b..6cb902aa2e1 100644 --- a/src/glsl/test_optpass.cpp +++ b/src/glsl/test_optpass.cpp @@ -64,7 +64,7 @@ do_optimization(struct exec_list *ir, const char *optimization, if (sscanf(optimization, "do_common_optimization ( %d , %d ) ", &int_0, &int_1) == 2) { - return do_common_optimization(ir, int_0 != 0, false, int_1, options); + return do_common_optimization(ir, int_0 != 0, false, int_1, options, true); } else if (strcmp(optimization, "do_algebraic") == 0) { return do_algebraic(ir); } else if (strcmp(optimization, "do_constant_folding") == 0) { diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index ca448d02fb3..d8eecb39403 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -202,7 +202,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) ) || progress; progress = do_common_optimization(shader->base.ir, true, true, 32, - &ctx->ShaderCompilerOptions[stage]) + &ctx->ShaderCompilerOptions[stage], + ctx->Const.NativeIntegers) || progress; } while (progress); diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 1d2ad604b5c..e41dcefb0c6 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -1344,7 +1344,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key) const struct gl_shader_compiler_options *options = &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; - while (do_common_optimization(p.shader->ir, false, false, 32, options)) + while (do_common_optimization(p.shader->ir, false, false, 32, options, + ctx->Const.NativeIntegers)) ; reparent_ir(p.shader->ir, p.shader->ir); diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 0923357b1bb..675e58e2a97 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -3008,7 +3008,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_common_optimization(ir, true, true, options->MaxUnrollIterations, - options) + options, ctx->Const.NativeIntegers) || progress; progress = lower_quadop_vector(ir, true) || progress; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index c3e36eceab4..28e8f1ecbc5 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5358,7 +5358,9 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress; progress = do_common_optimization(ir, true, true, - options->MaxUnrollIterations, options) + options->MaxUnrollIterations, + options, + ctx->Const.NativeIntegers) || progress; progress = lower_if_to_cond_assign(ir, options->MaxIfDepth) || progress; |