Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Pragma target 3.0 not fixing "Too many interpolators"

Discussion in 'Shaders' started by WDudderz, Sep 18, 2018.

  1. WDudderz

    WDudderz

    Joined:
    Apr 6, 2013
    Posts:
    12
    Hi all,

    I'm getting the error "Too many texture interpolators would be used for ForwardBase pass (11 out of max 10) at line 21". My understanding is that #pragma target 3.0 should fix this, am I wrong?

    I'm using 2017.4.3f1
    I can't really share code but here's the structure:

    Code (CSharp):
    1. Shader "Custom/New Shader" {
    2.     Properties {
    3.         _Color ("Color", Color) = (1,1,1,1)
    4.         _MainTex ("Albedo (RGB)", 2D) = "white" {}
    5.         //etc...
    6.     }
    7. SubShader {
    8.         Tags { "RenderType"="Opaque" }
    9.         LOD 200
    10.         CGPROGRAM
    11.  
    12.         #pragma surface surf Standard fullforwardshadows
    13.  
    14.         #pragma target 3.0
    15.  
    16.         struct Input {
    17.             float2 uv_MainTex;
    18.             //etc...
    19.         };
    20.  
    21.         float _Glossiness;
    22.         //etc...  
    23.  
    24.         UNITY_INSTANCING_BUFFER_START(Props)
    25.  
    26.         UNITY_INSTANCING_BUFFER_END(Props)
    27.  
    28.             void vert(inout appdata_full v, out Input o)
    29.         {
    30.             //Stuff
    31.         }
    32.  
    33.         void surf (Input IN, inout SurfaceOutputStandard o) {
    34.             //Stuff
    35.         }
    36.  
    37.         ENDCG
    38.     }
    39.     FallBack "Diffuse"
    40. }

    I guess that's impossible to debug, but my question really just is whether "#pragma target 3.0" should be fixing that error.

    Thanks in advance!
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,857
    #pragma target 3.0 sets the requirements to 10 interpolators. If you're using more, it will give you this error.
    Your struct Input has too many fields. Try packing those together.
     
  3. WDudderz

    WDudderz

    Joined:
    Apr 6, 2013
    Posts:
    12
    Ah right, thanks very much!