Search Unity

Shaders Error on Android Build

Discussion in 'Shaders' started by FinalBoss69, Feb 28, 2017.

  1. FinalBoss69

    FinalBoss69

    Joined:
    Feb 12, 2016
    Posts:
    32
    Trying to run a build that has a compute shader on Samsung Galaxy 6 and I'm getting an error:

    "GLSL link error: The number of vertex shader storage blocks (2) is greater than the maximum number allowed (0)".

    This is the code I'm using in the shader:

    Code (CSharp):
    1. #pragma kernel CSPointsCompute
    2. #define GROUP_SIZE 128
    3.  
    4.  
    5. struct GPoint
    6. {
    7.     float3 pos;
    8.     float3 direction;
    9. };
    10.  
    11. uniform RWStructuredBuffer<GPoint> _gPoints;
    12.  
    13. [numthreads(GROUP_SIZE,1,1)]
    14. void CSPointsCompute(uint3 id : SV_DispatchThreadID)
    15. {
    16.     int i = id.x;
    17.     GPoint p = _gPoints[i];
    18.     p.pos += float3(-0.01f, 0, 0);
    19.     _gPoints[i] = p;
    20. }
    I have another vertex/frag shader that uses x2 buffers as well in that project:

    Code (CSharp):
    1. Shader "GG/PointRender" {
    2.     Properties{
    3.         _MainTex("Base (RGB)", 2D) = "white" {
    4.             }
    5.         _Color(" Color", Color) = (1, 0.5, 0.5, 1)
    6.     }
    7.         SubShader{
    8.         Pass
    9.     {
    10.             Tags{
    11.                 "RenderType" = "Transparent" }
    12.         ZTest Off
    13.         ZWrite Off
    14.         Cull Off
    15.         Blend SrcAlpha One
    16.  
    17.         CGPROGRAM
    18.         // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
    19.         #pragma exclude_renderers gles
    20.         #pragma vertex star_vertex
    21.         #pragma fragment frag
    22.  
    23.         #pragma target 5.0
    24.  
    25.     struct GPoint
    26.     {
    27.                 float3 pos;
    28.                 float3 direction;
    29.             }
    30. ;
    31.             uniform StructuredBuffer<GPoint> points;
    32.             uniform StructuredBuffer<float3> quadPoints;
    33.             sampler2D _MainTex;
    34.             float4 _Color;
    35.             struct v2f
    36.     {
    37.                 float4 pos : SV_POSITION;
    38.                 float2 uv : TEXCOORD0;
    39.                 float4 color: COLOR;
    40.             }
    41. ;
    42.             // vertex shader with no inputs
    43.     // uses the system values SV_VertexID and SV_InstanceID to read from compute buffers
    44.     v2f star_vertex(uint id : SV_VertexID, uint inst : SV_InstanceID)
    45.     {
    46.                 v2f o;
    47.                 float3 worldPosition = points[inst].pos;
    48.                 float3 quadPoint = quadPoints[id];
    49.                 o.pos = mul(UNITY_MATRIX_P, mul(UNITY_MATRIX_V, float4(worldPosition, 1.0f)) + float4(quadPoint, 0.0f));
    50.                 o.uv = quadPoints[id] + 0.5f;
    51.                 o.color = _Color;
    52.                 return o;
    53.             }
    54.  
    55.  
    56.     float4 frag(v2f i) : COLOR
    57.     {
    58.                 float4 texCol = tex2Dbias(_MainTex, float4(i.uv, 0.0f, -1.0f));
    59.                 float4 partCol = i.color;
    60.                 return float4 (1.0f - (1.0f - texCol.rgb) * (1.0f - partCol.rgb), texCol.a);
    61.             }
    62.  
    63.         ENDCG
    64.  
    65.  
    66.     }
    67.     }
    68.         FallBack "Diffuse"
    69. }
     
  2. FinalBoss69

    FinalBoss69

    Joined:
    Feb 12, 2016
    Posts:
    32
    Anyone ?
     
  3. FinalBoss69

    FinalBoss69

    Joined:
    Feb 12, 2016
    Posts:
    32
  4. FinalBoss69

    FinalBoss69

    Joined:
    Feb 12, 2016
    Posts:
    32
  5. PateAalto

    PateAalto

    Joined:
    Nov 25, 2017
    Posts:
    3