summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-04-20 01:46:04 +0200
committerRoland Scheidegger <sroland@vmware.com>2013-04-20 02:27:53 +0200
commit85974e5fee152c96239aa87040799a557cd789ab (patch)
tree074035c9ca771a94442f4db3acc52400fca4ff51 /src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
parent8f5d4283c0448ed2e5d2c12bb46ec70be7744a7b (diff)
downloadexternal_mesa3d-85974e5fee152c96239aa87040799a557cd789ab.zip
external_mesa3d-85974e5fee152c96239aa87040799a557cd789ab.tar.gz
external_mesa3d-85974e5fee152c96239aa87040799a557cd789ab.tar.bz2
gallivm: implement switch opcode
Should be able to handle all things which make this tricky to implement. Fallthroughs, including most notably into/out of default, should be handled correctly but are quite a mess. If we see largely unoptimized switches in the wild should probably think about some "real" switch optimization pass, e.g. things like this: switch case1 someinst brk case2 default case3 someinst brk case4 someinst endswitch are legal, but the pointless case2/case3 statements not only cause condition evaluation but will turn this into a "fake" fallthrough case (because mask and defaultmask are already updated for case2 when default is encountered) requiring executing code twice. If default is at the end though, there's never any code re-execution, and if that's not the case if there's no fallthrough in (not even a fake one) and out of default there's no code re-execution neither. v2: add comments, and use enum for break type instead of magic boolean. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
index e1c362b..dc7c090 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
@@ -865,6 +865,8 @@ lp_set_default_actions(struct lp_build_tgsi_context * bld_base)
bld_base->op_actions[TGSI_OPCODE_XPD] = xpd_action;
bld_base->op_actions[TGSI_OPCODE_BREAKC].fetch_args = scalar_unary_fetch_args;
+ bld_base->op_actions[TGSI_OPCODE_SWITCH].fetch_args = scalar_unary_fetch_args;
+ bld_base->op_actions[TGSI_OPCODE_CASE].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_COS].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_EX2].fetch_args = scalar_unary_fetch_args;
bld_base->op_actions[TGSI_OPCODE_IF].fetch_args = scalar_unary_fetch_args;