Implement matrix inverse built-in

Inverse is emulated in HLSL by calculating the cofactor matrix and
dividing that with the determinant. This results in the transpose of the
inverse as is required. Better performing options might exist especially
for 4x4 matrices, but this is enough for a working implementation.

BUG=angle:859

Change-Id: I5185797cc1ed86865f5f4342707abdc2977a186b
Reviewed-on: https://chromium-review.googlesource.com/240331
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 2af8c4e..40f8bd2 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1669,6 +1669,10 @@
         break;
       case EOpTranspose:        outputTriplet(visit, "transpose(", "", ")");   break;
       case EOpDeterminant:      outputTriplet(visit, "determinant(transpose(", "", "))"); break;
+      case EOpInverse:
+        ASSERT(node->getUseEmulatedFunction());
+        writeEmulatedFunctionTriplet(visit, "inverse(");
+        break;
 
       case EOpAny:              outputTriplet(visit, "any(", "", ")");       break;
       case EOpAll:              outputTriplet(visit, "all(", "", ")");       break;