summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-06 02:31:20 +0200
committerLuca Barbieri <[email protected]>2010-09-14 06:08:03 +0200
commitb37459388b22fb6a831d45bc08e51cdb7b9c610c (patch)
treefcc5feba56d88929958ecbbf4db5a15f844ca1f0 /src/mesa/state_tracker
parenta508d2dddcc67d0f92cc36b9ed6f36a9bbfc579d (diff)
mesa/st: set compiler options based on Gallium shader caps
This turns on if conversion and unlimited loop unrolling if control flow is not supported. NOTE: this will change the behavior of r300g and any other driver that doesn't advertise control flow
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_extensions.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index d637e6f43a0..3f91eb78d81 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -162,7 +162,16 @@ void st_init_limits(struct st_context *st)
pc->MaxNativeAddressRegs = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_ADDRS);
pc->MaxNativeParameters = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONSTS);
+ /* TODO: make these more fine-grained if anyone needs it */
+ options->EmitNoIfs = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoFunctions = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoLoops = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoMainReturn = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+
options->EmitNoCont = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED);
+
+ if(options->EmitNoLoops)
+ options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
}
/* PIPE_CAP_MAX_FS_INPUTS specifies the number of COLORn + GENERICn inputs