From 32c11b65294084e82d10474bb8f6cd2bb6f56c95 Mon Sep 17 00:00:00 2001
From: jnncoutinho <jnncoutinho@outlook.com>
Date: Tue, 27 Apr 2021 16:06:27 +0200
Subject: [PATCH] fix: fixed shader compilation in some platforms

The overload abs(float4x4, float4x4) is not present in some platforms
supported by Unity
Decomposing the operation fixes the problem
---
 Shaders/SoftMask.cginc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Shaders/SoftMask.cginc b/Shaders/SoftMask.cginc
index 69facfc..6a7e75f 100644
--- a/Shaders/SoftMask.cginc
+++ b/Shaders/SoftMask.cginc
@@ -9,7 +9,14 @@ half4 _MaskInteraction;
 
 fixed Approximately(float4x4 a, float4x4 b)
 {
-	float4x4 d = abs(a - b);
+	float4x4 d = a - b;
+	d = float4x4(
+			abs(d[0]),
+			abs(d[1]),
+			abs(d[2]),
+			abs(d[3])
+		);
+		
 	return step(
 		max(d._m00,max(d._m01,max(d._m02,max(d._m03,
 		max(d._m10,max(d._m11,max(d._m12,max(d._m13,