How to debug with PSP vita?

Discussion in 'PSM Development' started by sama.van, Apr 13, 2014.

  1. sama.van

    sama.van

    Member

    Joined:
    Jun 2, 2009
    Messages:
    1,300
    I just made my first build on Vita and as expected got my first crash.

    Below the video :
    - https://www.facebook.com/photo.php?v=544538125659390&set=vb.262298680550004&type=2&theater

    Well, wondering if there is anyway to debbug this?
    I have Unity Pro, opened the Profiler, and sticked Developement Build + Autoconnect Profiler in the Build Settings...
    But the Profiler belong empty, absolutly nothing occur.

    What I can say so far is the game is 100% running on :
    - iphone : 3GS to 5S, (ipad2,4, mini).
    - Android :Nexus 7, Galaxy S3,4
    - Ouya...

    Never got any problem during the map loading process...

    Not sure if it is a memory management issue, maybe some c# or lib not supported on Vita... or else?



    A few other feedback :

    The black cloud on the video seems to be a shader issue.
    I am using the Mobile/Particles/ Alpha Blend shader.

    I hope an update inthe RuntimePlatform including the Vita :
    https://docs.unity3d.com/Documentation/ScriptReference/RuntimePlatform.html
    EDIT : it seems #if UNITY_PSM is already available...



    Thank you!
    Last edited: Apr 13, 2014
  2. xixgames

    xixgames

    Member

    Joined:
    Jan 20, 2014
    Messages:
    28
  3. sama.van

    sama.van

    Member

    Joined:
    Jun 2, 2009
    Messages:
    1,300
    Awesome ^___^!!
    >> THANK YOU!

    Finally....

    Code (csharp):
    1.  
    2. [80.896059] 4469: fps 19.91  ms/f 50.22 [kernel avail main 161MB, cdram 0MB, phy
    3. cont 26MB]
    4. [80.256858] attribute mismatch, channels offset: 16 calculated: 24
    5. [80.258266] Compiling VERTEX shader "sama.van/VertexColor, alpha, slide" variati
    6. on with entrypoint 'main' (md5:e3973a3cfde8f21f051c5aac5b9aa87f)
    7. [80.784010] Compiling FRAGMENT shader "sama.van/VertexColor, alpha, slide" varia
    8. tion with entrypoint 'main' (md5:4487a1d06e797018274a29b9a64f33f6)
    9. [80.894485] Shader : sama.van/VertexColor, alpha, slide
    10. [80.894985] Entrypoint : main
    11. [80.895365] WARN (16,16):
    12.         local variable 'prev' is unreferenced
    13. [80.896059] ERROR (24,17):
    14.         ambiguous call to 'lerp'. Found 2 possible candidates:
    15. [80.896784] INFO (24,17):
    16.         function was called with params: (fixed4, fixed4, half)
    17.  
    It seems something wrong is the lerp?? o_O....
    Code (csharp):
    1.  
    2. Shader "sama.van/Blend 2 Textures, Alpha, 2sided" {
    3.  
    4. Properties {
    5.     _Blend ("Blend", Range (0, 1) ) = 0.5
    6.     _MainTex ("Base (RGB) Trans (A) 1", 2D) = ""
    7.     _Texture2 ("Base (RGB) Trans (A) 2", 2D) = ""
    8. }
    9.  
    10. SubShader {
    11.     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    12.     ZWrite Off
    13.     Blend SrcAlpha OneMinusSrcAlpha
    14.     Cull Off
    15.    
    16.         Pass {
    17.             SetTexture[_MainTex]
    18.             SetTexture[_Texture2] {
    19.                 ConstantColor (0,0,0, [_Blend])
    20.                 Combine texture lerp(constant) previous
    21.             }      
    22.     }
    23. }
    24.  
    25.  
    Last edited: Apr 13, 2014
  4. sama.van

    sama.van

    Member

    Joined:
    Jun 2, 2009
    Messages:
    1,300
    I wrote a bew version of the shader and now it works.
    The source below if it can help some...

    Code (csharp):
    1. Shader "sama.van/Blend 2 Textures, Alpha, 2sided" {
    2.  
    3. Properties {
    4.     _Blend ("Blend", Range (0, 1) ) = 0.5
    5.     _MainTex ("Base (RGB) Trans (A) 1", 2D) = ""
    6.     _Texture2 ("Base (RGB) Trans (A) 2", 2D) = ""
    7. }
    8.  
    9. SubShader {
    10.     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    11.     ZWrite Off
    12.     Blend SrcAlpha OneMinusSrcAlpha
    13.     Cull Off
    14.    
    15.         Pass {
    16.        
    17.         CGPROGRAM
    18.                 #pragma vertex vert
    19.                 #pragma fragment frag
    20.                
    21.                 uniform float _Blend;
    22.                 uniform sampler2D _MainTex;
    23.                 uniform sampler2D _Texture2;
    24.                
    25.                 struct appdata_base
    26.                 {
    27.                     float4 vertex : POSITION;
    28.                     float4 texcoord : TEXCOORD0;
    29.                 };
    30.                
    31.                 struct v2f
    32.                 {
    33.                     float4 pos : POSITION;
    34.                     float2 texcoord0 : TEXCOORD0;
    35.                 };
    36.                
    37.                 v2f vert(appdata_base v)
    38.                 {
    39.                     v2f o;
    40.                    
    41.                     o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    42.                     o.texcoord0 = v.texcoord.xy;
    43.                                        
    44.                     return o;
    45.                 }
    46.                
    47.                 float4 frag(v2f value) : COLOR
    48.                 {
    49.                     float4 mainTex      = tex2D(_MainTex, value.texcoord0);
    50.                     float4 texture2     = tex2D(_Texture2, value.texcoord0);
    51.                    
    52.                     return lerp(mainTex, texture2, _Blend);
    53.                 }
    54.             ENDCG  
    55.             }      
    56.     }
    57. }
    58.  
  5. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Messages:
    533
    Yes, this is a bug where the generated code assumes that lerp can be called with mismatching params (fixed4 vs half). The workaround is to manually force the params to be of the same type (as in your CG code).

    EDIT: I've the updated the fixed function emulation to generate the correct lerp() call - the next version of Unity-for-PSM won't have this problem.
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Messages:
    10,446
    (not working)
    //float3 reflection = reflect ( normalize ( mul ( UNITY_MATRIX_MV , ad.vertex ) ), float3 ( normalize ( mul ( (float3x3)UNITY_MATRIX_MV , ad.normal ) ) ) );

    (working)
    float3 reflection = reflect ( float3( normalize ( mul ( UNITY_MATRIX_MV , ad.vertex ) ) ), float3 ( normalize ( mul ( (float3x3)UNITY_MATRIX_MV , ad.normal ) ) ) );


    The commented out line is from Core Framework, with the cast to float3 being present in the uncommented line. I include it here to give Unity a heads up on their compiler behaviour under Vita.

    I am not 100% certain it affects this version of vita but I include it just in case. It *does* affect the other version of vita for retail, and afaik doesn't use lerp. Reflect is also affected by this issue.
  7. DarkSprite

    DarkSprite

    Member

    Joined:
    Oct 7, 2011
    Messages:
    78
    ERIqUE , do you know when the new version will be coming out
  8. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Messages:
    533
    I rather not make any promises with regards to release dates. The timeline given earlier states "summer", as in June/July/August 2014.
    And I would say June/July is more likely (and preferable) than August.

    Is there a specific issue that is blocking you? The lerp() issue discussed previously in this thread can be worked around..
  9. DarkSprite

    DarkSprite

    Member

    Joined:
    Oct 7, 2011
    Messages:
    78
    lerp issue is the one that is stopping me , I brought the shader off the store and there is like 10 place the lerp is used , I have contacted the developer , just waiting for a response from them as I dont know shaders that well

    Here is the Log Output

    [37.412173] Shader : Toony Colors Pro/Normal/OneDirLight/Basic Rim
    [37.412704] Entrypoint : vert_surf
    [37.413090] WARN (79,9):
    local variable 'worldPos' is unreferenced
    [37.413784] WARN (382,9):
    unrecognized pragma directive 'lighting' will be ignored
    [37.414493] WARN (386,15):
    implicit cast from 'half4' to 'half3'
    [37.415195] ERROR (387,9):
    ambiguous call to 'lerp'. Found 2 possible candidates:
    [37.415915] INFO (387,9):
    function was called with params: (half4, half4, half3)
    [37.416631] INFO (5,7):
    could be: half4 lerp(half4, half4, float)
  10. PeterD

    PeterD

    Member

    Joined:
    Feb 6, 2013
    Messages:
    106
    @eriQue 'camera near clip/cull' bug. This one affects everybody and makes it near impossible to view levels and particle effects correctly. Surely that bug alone warrants at least one more release before June/July! Even if that's the only fix included in it.
  11. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Messages:
    533
    IIRC all the Toony Colors shaders use an include (TGP_Include.cginc?) where there is a call (or two) that looks like
    _SColor and _Color are fixed4 while ramp is fixed3. This will trigger the error.
    Change the lerp call to include casts for the _SColor/_Color to fixed3
    (Or the more proper fix - make sure ramp is a fixed4).
  12. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Messages:
    533
    While I agree with you, and it indeed would be ideal to get the fix for this released ASAP, it's unfortunately not that simple.
    There is a lead time connected with releasing an updated version of the Development Assistant which slows down the release process.
    The bug is fixed, but getting it into your hands takes 2-3 weeks minimum (and would delay the subsequent release)..

    But I hope we will be able to streamline this process going forward, once we have an official release (and all the code in place)..
  13. DarkSprite

    DarkSprite

    Member

    Joined:
    Oct 7, 2011
    Messages:
    78
    Cheers that fixed the issue , I finally got the game working on the vita , now to sort out the FPS issues
    $IMG_0600.jpg