From 8b9dfb4b6d05c0af48dd75e9ab601bbb6ebbd2e8 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 8 Jan 2016 11:38:59 -0800 Subject: [PATCH] nir/spirv: Add real support for outer products --- src/glsl/nir/spirv/vtn_alu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/glsl/nir/spirv/vtn_alu.c b/src/glsl/nir/spirv/vtn_alu.c index e8316d1f42e..70875007ec7 100644 --- a/src/glsl/nir/spirv/vtn_alu.c +++ b/src/glsl/nir/spirv/vtn_alu.c @@ -187,10 +187,6 @@ vtn_handle_matrix_alu(struct vtn_builder *b, SpvOp opcode, dest->ssa = vtn_ssa_transpose(b, src0); break; - case SpvOpOuterProduct: - dest->ssa = matrix_multiply(b, src0, vtn_ssa_transpose(b, src1)); - break; - case SpvOpMatrixTimesScalar: if (src0->transposed) { dest->ssa = vtn_ssa_transpose(b, mat_times_scalar(b, src0->transposed, @@ -292,6 +288,14 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode, case SpvOpSMod: op = nir_op_umod; break; /* FIXME? */ case SpvOpFMod: op = nir_op_fmod; break; + case SpvOpOuterProduct: { + for (unsigned i = 0; i < src[1]->num_components; i++) { + val->ssa->elems[i]->def = + nir_fmul(&b->nb, src[0], nir_channel(&b->nb, src[1], i)); + } + return; + } + case SpvOpDot: assert(src[0]->num_components == src[1]->num_components); switch (src[0]->num_components) { -- 2.30.2