[Mesa-dev] [PATCH 10/13] i965: move common optimisation loop to a helper
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 27 05:20:51 UTC 2016
---
src/mesa/drivers/dri/i965/brw_link.cpp | 50 ++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index efd67e7..e56df93 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -86,6 +86,35 @@ brw_lower_packing_builtins(struct brw_context *brw,
}
static void
+brw_common_opts(struct gl_linked_shader *shader, struct gl_context *ctx,
+ bool uniform_locs_assigned,
+ const struct brw_compiler *compiler,
+ const struct gl_shader_compiler_options *options)
+{
+ bool progress;
+ do {
+ progress = false;
+
+ if (compiler->scalar_stage[shader->Stage]) {
+ if (shader->Stage == MESA_SHADER_VERTEX ||
+ shader->Stage == MESA_SHADER_FRAGMENT)
+ 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,
+ uniform_locs_assigned, true, options,
+ ctx->Const.NativeIntegers) || progress;
+ } while (progress);
+}
+
+static void
process_glsl_ir(struct brw_context *brw,
struct gl_shader_program *shader_prog,
struct gl_linked_shader *shader)
@@ -149,26 +178,7 @@ process_glsl_ir(struct brw_context *brw,
_mesa_shader_stage_to_abbrev(shader->Stage));
}
- bool progress;
- do {
- progress = false;
-
- if (compiler->scalar_stage[shader->Stage]) {
- if (shader->Stage == MESA_SHADER_VERTEX ||
- shader->Stage == MESA_SHADER_FRAGMENT)
- 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, true, true,
- options, ctx->Const.NativeIntegers) || progress;
- } while (progress);
+ brw_common_opts(shader, ctx, false, compiler, options);
validate_ir_tree(shader->ir);
--
2.7.4
More information about the mesa-dev
mailing list