summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-01-06 17:00:01 -0800
committerJason Ekstrand <[email protected]>2016-01-06 17:00:55 -0800
commit000eb00862545aa1a0e42cea800a06bc57b406cf (patch)
tree19e8a2b9fa031a32b69138153941efcd5a354bc1 /src
parentde65d4dcafcf6b22a71689ef1ef19bbd3dd953da (diff)
nir/spirv/cfg: Only set fall to true at the start of a case
Previously, we were setting it to true at the top of the switch statement. However, this causes all of the cases to get executed until you hit a break. Instead, you want to be not executing at the start, start executing when you hit your case, and end at a break.
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/spirv/vtn_cfg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/glsl/nir/spirv/vtn_cfg.c b/src/glsl/nir/spirv/vtn_cfg.c
index 9330ac03769..db1163d0707 100644
--- a/src/glsl/nir/spirv/vtn_cfg.c
+++ b/src/glsl/nir/spirv/vtn_cfg.c
@@ -598,7 +598,7 @@ vtn_emit_cf_list(struct vtn_builder *b, struct list_head *cf_list,
*/
nir_variable *fall_var =
nir_local_variable_create(b->nb.impl, glsl_bool_type(), "fall");
- nir_store_var(&b->nb, fall_var, nir_imm_int(&b->nb, NIR_TRUE), 1);
+ nir_store_var(&b->nb, fall_var, nir_imm_int(&b->nb, NIR_FALSE), 1);
/* Next, we gather up all of the conditions. We have to do this
* up-front because we also need to build an "any" condition so
@@ -649,6 +649,7 @@ vtn_emit_cf_list(struct vtn_builder *b, struct list_head *cf_list,
bool has_break = false;
b->nb.cursor = nir_after_cf_list(&case_if->then_list);
+ nir_store_var(&b->nb, fall_var, nir_imm_int(&b->nb, NIR_TRUE), 1);
vtn_emit_cf_list(b, &cse->body, fall_var, &has_break, handler);
(void)has_break; /* We don't care */