From: Jason Ekstrand Date: Fri, 8 Jan 2016 19:18:47 +0000 (-0800) Subject: nir/spirv: Add support for add, subtract, and negate on matrices X-Git-Tag: upstream/17.1.0~11012^2~754 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=927ef0ea4ecc006e0f37d9a0064931ade6482298;p=platform%2Fupstream%2Fmesa.git nir/spirv: Add support for add, subtract, and negate on matrices --- diff --git a/src/glsl/nir/spirv/vtn_alu.c b/src/glsl/nir/spirv/vtn_alu.c index a8c6e5c..e8316d1 100644 --- a/src/glsl/nir/spirv/vtn_alu.c +++ b/src/glsl/nir/spirv/vtn_alu.c @@ -157,6 +157,32 @@ vtn_handle_matrix_alu(struct vtn_builder *b, SpvOp opcode, struct vtn_ssa_value *src0, struct vtn_ssa_value *src1) { switch (opcode) { + case SpvOpFNegate: { + dest->ssa = vtn_create_ssa_value(b, src0->type); + unsigned cols = glsl_get_matrix_columns(src0->type); + for (unsigned i = 0; i < cols; i++) + dest->ssa->elems[i]->def = nir_fneg(&b->nb, src0->elems[i]->def); + break; + } + + case SpvOpFAdd: { + dest->ssa = vtn_create_ssa_value(b, src0->type); + unsigned cols = glsl_get_matrix_columns(src0->type); + for (unsigned i = 0; i < cols; i++) + dest->ssa->elems[i]->def = + nir_fadd(&b->nb, src0->elems[i]->def, src1->elems[i]->def); + break; + } + + case SpvOpFSub: { + dest->ssa = vtn_create_ssa_value(b, src0->type); + unsigned cols = glsl_get_matrix_columns(src0->type); + for (unsigned i = 0; i < cols; i++) + dest->ssa->elems[i]->def = + nir_fsub(&b->nb, src0->elems[i]->def, src1->elems[i]->def); + break; + } + case SpvOpTranspose: dest->ssa = vtn_ssa_transpose(b, src0); break;