summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-02-12 10:40:24 -0800
committerJason Ekstrand <[email protected]>2016-02-12 10:40:39 -0800
commit3c8dc1afd1101ff11d942a056a22ae43c0611bb7 (patch)
tree7f6698e41305e82bf946ede8dca1c105579d3856
parent37f4dfb19dadf5a2643ab3c78e09908cfd440504 (diff)
nir/spirv/glsl: Clean up the row-skipping swizzle logic a bit
-rw-r--r--src/compiler/nir/spirv/vtn_glsl450.c14
1 files 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];