diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 7 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 6 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 5 |
5 files changed, 15 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 25a20e76042..c23e7ce78a5 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -141,7 +141,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do { progress = false; - progress = do_common_optimization(shader->ir, true) || progress; + progress = do_common_optimization(shader->ir, true, 32) || progress; } while (progress); validate_ir_tree(shader->ir); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 61cd93c364c..3e54656981d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2187,7 +2187,6 @@ struct gl_shader_compiler_options { /** Driver-selectable options: */ GLboolean EmitHighLevelInstructions; /**< IF/ELSE/ENDIF vs. BRA, etc. */ - GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitCondCodes; /**< Use condition codes? */ GLboolean EmitComments; /**< Annotated instructions */ GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */ @@ -2196,6 +2195,12 @@ struct gl_shader_compiler_options * support control flow. */ GLboolean EmitNoIfs; + GLboolean EmitNoLoops; + GLboolean EmitNoFunctions; + GLboolean EmitNoCont; /**< Emit CONT opcode? */ + GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */ + + GLuint MaxUnrollIterations; struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ }; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 2977a29ab74..c32c09f8d4b 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -97,10 +97,14 @@ _mesa_init_shader_state(GLcontext *ctx) struct gl_shader_compiler_options options; GLuint i; options.EmitHighLevelInstructions = GL_TRUE; - options.EmitContReturn = GL_TRUE; options.EmitCondCodes = GL_FALSE; options.EmitComments = GL_FALSE; options.EmitNoIfs = GL_FALSE; + options.EmitNoLoops = GL_FALSE; + options.EmitNoFunctions = GL_FALSE; + options.EmitNoCont = GL_FALSE; + options.EmitNoMainReturn = GL_FALSE; + options.MaxUnrollIterations = 32; /* Default pragma settings */ options.DefaultPragmas.IgnoreOptimize = GL_FALSE; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b3641032fb0..caa906abfad 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2719,7 +2719,7 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog) do_div_to_mul_rcp(ir); do_explog_to_explog2(ir); - progress = do_common_optimization(ir, true) || progress; + progress = do_common_optimization(ir, true, options->MaxUnrollIterations) || progress; if (options->EmitNoIfs) progress = do_if_to_cond_assign(ir) || progress; @@ -2799,7 +2799,7 @@ _mesa_glsl_compile_shader(GLcontext *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)) + while (do_common_optimization(shader->ir, false, 32)) ; validate_ir_tree(shader->ir); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 82be1494338..91bd5a92c92 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -135,11 +135,8 @@ void st_init_limits(struct st_context *st) = CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), 1, MAX_DRAW_BUFFERS); - /* Is TGSI_OPCODE_CONT supported? */ - /* XXX separate query for early function return? */ for(i = 0; i < MESA_SHADER_TYPES; ++i) - st->ctx->ShaderCompilerOptions[i].EmitContReturn = - screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED); + st->ctx->ShaderCompilerOptions[i].EmitNoCont = !screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED); /* Quads always follow GL provoking rules. */ c->QuadsFollowProvokingVertexConvention = GL_FALSE; |