summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-24 21:26:41 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:02 -0800
commit9d62df3800cad8f8a221d2222203cfa0856918f4 (patch)
treec3b9403e7a0fe0ec41afa333223b406370b65fe6 /src/glsl
parent24249599b144364d2787a6866509ef7e07a2cffd (diff)
nir: Validate that the sources of a phi have the same size as the destination
Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir_validate.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_validate.c b/src/glsl/nir/nir_validate.c
index f6a55ccabd5..0a015e43bba 100644
--- a/src/glsl/nir/nir_validate.c
+++ b/src/glsl/nir/nir_validate.c
@@ -460,9 +460,22 @@ validate_phi_src(nir_phi_instr *instr, nir_block *pred, validate_state *state)
{
state->instr = &instr->instr;
+ assert(instr->dest.is_ssa);
+
exec_list_validate(&instr->srcs);
foreach_list_typed(nir_phi_src, src, node, &instr->srcs) {
if (src->pred == pred) {
+ unsigned num_components;
+ if (src->src.is_ssa)
+ num_components = src->src.ssa->num_components;
+ else {
+ if (src->src.reg.reg->is_packed)
+ num_components = 4; /* can't check anything */
+ else
+ num_components = src->src.reg.reg->num_components;
+ }
+ assert(num_components == instr->dest.ssa.num_components);
+
validate_src(&src->src, state);
return;
}