+12
Under review

Add support for PS4 + PSVita (not to be confused with PlayStation Mobile!)

Zach Aikman 10 years ago updated by thelordmortis 9 years ago 11
The recent release claimed to add support for PSVita when it actually added support for PlayStation Mobile, a separate platform. Shaders created in ShaderForge still fail to compile for PSVita. The requirements for each platform are...

-=PSVita=-
  • UV fields in the vertex input struct (using TEXCOORD0 semantic) must be named 'texcoord', not 'texcoord0' as they are for PlayStation Mobile.
-=PS4=-
  • v2f structures (output from vertex shader used as input to fragment shader) must be changed from POSITION to SV_POSITION. Note that a2v (application to vertex) structures should continue to use POSITION.
  • Fragment shader output that writes colour must be changed from COLOR to SV_Target.
  • Fragment shader output that writes depth must be changed from DEPTH to SV_Depth.
  • Do not use "sample" as a variable name in shaders. This is a reserved word that will cause shaders to fail to compile.
Thank you!
Under review
Does PS mobile work with texcoord then? Or does that one have to be texcoord0?
And for PSVita, when using vertex colors as colors, must be named "color" and not "vertexColor".
This shouldn't be an issue. Unity should make it read the semantics, not have silly platform specific naming like this :/
I'm not sure whether or not texcoord works on PSM since we don't have a license for that particular platform.

Rubén is right; vertexColor isn't accepted for PSVita either. I agree with you, Joachim - it really is a silly issue. I've started a discussion on the PSVita DevNet forums with the Unity devs about consolidating these naming conventions to be the same. My understanding is that the PSM and PSVita ports may have been handled by different teams, which would explain the discrepancies.

The PS4 changes shouldn't cause any conflicts, I don't think. In the PS4-friendly build of Unity, the HLSLSupport.cginc file it ships with contains definitions for mapping SV_Target/SV_Depth to the appropriate semantics. I'm not sure if those same changes are in the main branch of Unity. If not, maybe just add an option to the list of Target renderers, for those of us who are affected by it?
Hello, I noticed v1.10 add PS4 and PSVita to the render platforms. So is this idea completed? If not, can you update shaderforge to support PS4?
Is the problem in the topic still present even in Unity 5?
That is method to port shader to PS4. I just curious does shaderforge fit the requirements.
There's no way for me to try it, so, I'm not sure if it still works that way with Unity 5
It appears that the metallic shaders aren't supported on the PSVita? is this a known issue?
Nope. Any errors in the log?
The lines that error are both:
diffuseColor = DiffuseAndSpecularFromMetallic( diffuseColor, _Specular, specularColor, specularMonochrome );

And the error is Shader error in 'Custom/PlatformBaseS': Program 'vert', parameter of type 'half3' is a function output and does not permit argument of mismatching type 'float3' at line 267 (on psp2)