PS4 shader compile error in 'Triangle Core.cginc'

Avatar
  • updated
  • Fixed

Hi,

We're getting a shader compiler error on PS4 on lines 134-136 of 'Triangle Core.cginc':

Shader error in 'Shapes/Triangle Darken': Program 'vert', incompatible argument list for call to 'mul'. Found 1280 possible candidates: at Assets/Thirdparty/Shapes/Shaders/Core/Triangle Core.cginc(134) (on ps4)


The cause is three attempts to multiply a half3x3 by a half2 - the PS4 shader compiler is stricter than the other platforms on mismatched calls like this, and throws errors instead of attempting to guess the right thing to do.

// 2D miter offset directions
half2 miterVecA = GetMiterOffsetDirFast( nCA, nAB, padding );
half2 miterVecB = GetMiterOffsetDirFast( nAB, nBC, padding );
half2 miterVecC = GetMiterOffsetDirFast( nBC, nCA, padding );

// add local space padding
half3x3 mtxProjToLocal = transpose(mtxLocalToProj);
a += mul(mtxProjToLocal, miterVecA);
b += mul(mtxProjToLocal, miterVecB);
c += mul(mtxProjToLocal, miterVecC);

I'm not clear on the right fix for this - what is the intention here?

Thanks,

Keith

Reporting a bug? please specify Unity version:
2019.4.17f1
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer

try this! lemme know if it works and I'll include the fix in the next update :)

a += mul(mtxProjToLocal, half3(miterVecA,0));
b += mul(mtxProjToLocal, half3(miterVecB,0));
c += mul(mtxProjToLocal, half3(miterVecC,0));
Avatar
Freya Holmér creator
  • Answer

try this! lemme know if it works and I'll include the fix in the next update :)

a += mul(mtxProjToLocal, half3(miterVecA,0));
b += mul(mtxProjToLocal, half3(miterVecB,0));
c += mul(mtxProjToLocal, half3(miterVecC,0));
Avatar
Keith OConor

Thanks, will do!

Avatar
Keith OConor

Looks like that took care of it. Thanks for the quick turnaround!

Avatar
Freya Holmér creator
  • Fixed

glad it worked out! this has now been fixed for 4.0.0