Skip to content

Commit

Permalink
fix: fixed shader compilation in some platforms
Browse files Browse the repository at this point in the history
The overload abs(float4x4, float4x4) is not present in some platforms
supported by Unity
Decomposing the operation fixes the problem
  • Loading branch information
jnncoutinho authored and mob-sakai committed May 15, 2022
1 parent 50c41f2 commit 40b450b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Shaders/SoftMask.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ float CustomStep(float a, float x)

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,
Expand Down

0 comments on commit 40b450b

Please sign in to comment.