Author Topic: Shader Error When Build for PS4  (Read 2334 times)

nicolasdai

  • Newbie
  • *
  • Posts: 1
    • View Profile
Shader Error When Build for PS4
« on: April 18, 2017, 01:47:11 AM »
Hi, we are facing plenty of shader errors when building for PS4.

Screenprint is attached.

And most of the errors is:
1. ambiguous call to 'lerp'. Found 2 possible candidates: at line 94 (on ps4)
2. Shader error in 'TENKOKU/cloud_sphere': Program 'frag', ambiguous call to 'dot'. Found 3 possible candidates: at line 468 (on ps4)
3. Shader error in 'TENKOKU/fx_Particle': Program 'frag', 'S_TARGET_OUTPUT' is not a valid semantic for varying 'i.color' at /Program Files (x86)/Unity5.5.0f3/Editor/Data/PlaybackEngines/PS4Player/CgBatchPlugins64/include/HLSLToPSSL.cginc(122) (on ps4)

We are now using Unity 5.5.0f3, and Tenkoku Dynamic Sky 1.1.5d

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #1 on: April 18, 2017, 08:03:03 AM »
Hi nicolasdai,
I'll take a look at these errors and get back to you soon.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #2 on: April 18, 2017, 10:28:22 AM »
Hi nicolasdai,

I've gone through the shader code and made a few edits that might help.  I'm unable to test directly because I don't have a PS4 Unity license, but I have a general idea of what's going on I think. I'll send you a patch that might address these... though we may need to do a little back and forth to track all the errors.

-Justin

viskem

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Shader Error When Build for PS4
« Reply #3 on: February 28, 2018, 10:35:09 PM »
hi Chingwa, i have the same problem  can you send me the patch?

We are now using Unity 2017.3.0p4 , and Tenkoku Dynamic Sky 1.1.7
« Last Edit: February 28, 2018, 10:36:58 PM by viskem »

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #4 on: February 28, 2018, 11:04:28 PM »
Hi Viskem,
I never heard much back about these errors and so was not able to confirm whether they fixed the problem or not.  I rolled what I did into one of the recent updates last year so apparently this did not fix all of the problems.  Are you seeing the same exact errors as listed above?  If you see anything different then let me know or post a screenshot.  I will take another look at this.

viskem

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Shader Error When Build for PS4
« Reply #5 on: March 01, 2018, 03:52:18 AM »
Thank you very much~ ;D 

here is the error.

Code: [Select]
Shader error in 'TENKOKU/TenkokuFog': Program 'frag', ambiguous call to 'lerp'. Found 3 possible candidates: at line 296 (on ps4)

Compiling Fragment program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING


Shader error in 'TENKOKU/TenkokuFog': Program 'vert', ambiguous call to 'lerp'. Found 3 possible candidates: at line 296 (on ps4)

Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #6 on: March 01, 2018, 10:51:37 AM »
Thanks for the specific error description.  Is this the only 2 shader errors that you see?  I will take a look!

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #7 on: March 04, 2018, 11:54:21 AM »
Hi Viskem,
I just emailed you a patch that I think will fix these issues.  Try it out and let me know!

Noble Robot

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Shader Error When Build for PS4
« Reply #8 on: June 06, 2018, 07:11:19 PM »
Hi!

I stumbled upon this thread while researching an identical pair of Shader errors (one fragment, one vertex) regarding "ambiguous call to 'lerp'" that I encountered while using another asset while building for PS4.

I hate to crash this party when I'm not a part of it, but could you describe how you (think you may have) solved this issue in your shader? Maybe I can apply it to my issue and report back on its possible success.

Thanks!

Noble Robot

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Shader Error When Build for PS4
« Reply #9 on: June 06, 2018, 08:51:06 PM »
Nevermind! I solved my own problem.

In the shader that I was using, the lerp function was
Code: [Select]
float3 = lerp(float3, float4, float) and unity's auto-translation into a PlayStation-friendly shader didn't know how to handle that float4. So for me, because my function didn't need the alpha value, I changed the line to
Code: [Select]
float3 = lerp(float3, float4.rgb, float) and it complied with the more strict arugment rules for PS4 shaders.

The root of the issue is that the lerp function is simply not as flexible when building for PS4, and you need to be more explicit when feeding it arguments. I wonder if your solution was similar.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1596
    • View Profile
    • Tanuki Digital
Re: Shader Error When Build for PS4
« Reply #10 on: June 07, 2018, 07:22:03 AM »
Yes I ended up doing similar changes to help fix this issue (at least I think it's fixed...).  In many cases I would be lerping between various variables, some would be float3, some would be float4, and PS4 apparently can't handle it. :D

Casting them explicitly as you've shown helped.  In some cases I put a direct cast in front of the variable to show what it was... for example...

float4 var1;
float3 var2;
float var3;
float3 result = lerp((float3)var1.xyz, (float3)var2.xyz, (float)var3);