From 3c8dc1afd1101ff11d942a056a22ae43c0611bb7 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 12 Feb 2016 10:40:24 -0800 Subject: [PATCH] nir/spirv/glsl: Clean up the row-skipping swizzle logic a bit --- src/compiler/nir/spirv/vtn_glsl450.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/compiler/nir/spirv/vtn_glsl450.c b/src/compiler/nir/spirv/vtn_glsl450.c index 5fb73df0566..6b649fd085b 100644 --- a/src/compiler/nir/spirv/vtn_glsl450.c +++ b/src/compiler/nir/spirv/vtn_glsl450.c @@ -68,11 +68,8 @@ build_mat4_det(nir_builder *b, nir_ssa_def **col) nir_ssa_def *subdet[4]; for (unsigned i = 0; i < 4; i++) { unsigned swiz[3]; - for (unsigned j = 0, k = 0; j < 3; j++, k++) { - if (k == i) - k++; /* skip column */ - swiz[j] = k; - } + for (unsigned j = 0; j < 3; j++) + swiz[j] = j + (j >= i); nir_ssa_def *subcol[3]; subcol[0] = nir_swizzle(b, col[1], swiz, 3, true); @@ -121,11 +118,8 @@ build_mat_subdet(struct nir_builder *b, struct vtn_ssa_value *src, } else { /* Swizzle to get all but the specified row */ unsigned swiz[3]; - for (unsigned j = 0, k = 0; j < 3; j++, k++) { - if (k == row) - k++; /* skip column */ - swiz[j] = k; - } + for (unsigned j = 0; j < 3; j++) + swiz[j] = j + (j >= row); /* Grab all but the specified column */ nir_ssa_def *subcol[3]; -- 2.30.2