From cb65246ed2ac826285b6d6cc6e1994ff1299e531 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Fri, 13 Jul 2018 03:33:22 +0200 Subject: nir: cleanup oversized arrays in nir_swizzle calls There are no fixed sized array arguments in C, those are simply pointers to unsized arrays and as the size is passed in anyway, just rely on that. where possible calls are replaced by nir_channel and nir_channels. Reviewed-by: Jason Ekstrand Signed-off-by: Karol Herbst --- src/compiler/spirv/vtn_glsl450.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/compiler/spirv/vtn_glsl450.c') diff --git a/src/compiler/spirv/vtn_glsl450.c b/src/compiler/spirv/vtn_glsl450.c index 8393450f2f4..9ef066e8e6d 100644 --- a/src/compiler/spirv/vtn_glsl450.c +++ b/src/compiler/spirv/vtn_glsl450.c @@ -36,7 +36,7 @@ static nir_ssa_def * build_mat2_det(nir_builder *b, nir_ssa_def *col[2]) { - unsigned swiz[4] = {1, 0, 0, 0}; + unsigned swiz[2] = {1, 0 }; nir_ssa_def *p = nir_fmul(b, col[0], nir_swizzle(b, col[1], swiz, 2, true)); return nir_fsub(b, nir_channel(b, p, 0), nir_channel(b, p, 1)); } @@ -44,8 +44,8 @@ build_mat2_det(nir_builder *b, nir_ssa_def *col[2]) static nir_ssa_def * build_mat3_det(nir_builder *b, nir_ssa_def *col[3]) { - unsigned yzx[4] = {1, 2, 0, 0}; - unsigned zxy[4] = {2, 0, 1, 0}; + unsigned yzx[3] = {1, 2, 0 }; + unsigned zxy[3] = {2, 0, 1 }; nir_ssa_def *prod0 = nir_fmul(b, col[0], @@ -602,8 +602,8 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint, return; case GLSLstd450Cross: { - unsigned yzx[4] = { 1, 2, 0, 0 }; - unsigned zxy[4] = { 2, 0, 1, 0 }; + unsigned yzx[3] = { 1, 2, 0 }; + unsigned zxy[3] = { 2, 0, 1 }; val->ssa->def = nir_fsub(nb, nir_fmul(nb, nir_swizzle(nb, src[0], yzx, 3, true), nir_swizzle(nb, src[1], zxy, 3, true)), -- cgit v1.2.3