• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Borissow · Sep 29, 2015 at 12:04 PM · shaderunity5upgrade

Unity 5 - Shader error in VertexBlend : Too many output registers declared (12). How to fix it?

Hi! I upgraded a project to Unity 5, I had the usual " variable not fully initialized" error in a lot of shader, I fixed it by adding UNITY_INITIALIZE_OUTPUT(Input, o); No problem. But now I have a shader that blends 2 * (diffuse+normal) texture pairs based on a blend texture I got a strange error. The shader only throws the error when in playmode. The shader error:

 Shader error in 'VertexBlend': Too many output registers declared (12).  When no output register has been declared with the semantic 'psize0', 11 o# registers are available.  When an o# register has been declared with the semantic 'psize0' (same as 'psize'), 12 registers are available. at line 192 (on d3d9)
 
 Compiling Vertex program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP2 VERTEXLIGHT_ON

It seems to work, but I am affraid it will break on some mobile devices. Can anyone tall me what is wrong? What should I change to make it work?

My vert output structure:

 struct Input {
 float2 uv_MainTex : TEXCOORD0;
 float2 uv_Diffuse2 : TEXCOORD1;
 float2 uv_BlendMask : TEXCOORD2;
 float4 color : COLOR;
 float2 uv_Normal1 : TEXCOORD3;
 float2 uv_Normal2 : TEXCOORD4;
             };


Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by fguinier · Sep 29, 2015 at 02:49 PM

Hi Borissow,

Depending on the platform/shader model targeted the amount of output register available are different. Furthermore the packing can have a great importance too.

Shader model 3.0 doc -> 1 pos register, 1 scalar point size register, 10 general purpose register. Shader model 4.0 doc -> 16 all purpose register

So i suppose in your case you can probably pack things up to use fewer register, or increase the target shader language (and min spec of your project ?).

PS : Additionally on some hardware you will have a performance gain at packing stuff.

Hope it helps

Florent

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Borissow · Sep 29, 2015 at 03:17 PM 0
Share

The strange thing is that I am using shader model 3.0 and when I open the compiled shader it has exactly 12 registers, so theoretically it should be ok. Another strange thing is that this shader is used in multilpe scenes, in some the error appears when I hit play in the editor, in other it doesn't.

By packing up you mean I put two float2-s in one float4?

avatar image fguinier Borissow · Sep 29, 2015 at 03:52 PM 0
Share

You are right ! Actually looking better at the error message the compiler say that you only have space for 11 register as no psize semantic is used ! -> finally looking at that doc its problematic in S$$anonymous$$3, thus the trouble (i just updated the anwer too to avoid confusion)

https://msdn.microsoft.com/en-us/library/windows/desktop/bb147365(v=vs.85).aspx look for "Simplify Output Registers"

By packing up you mean I put two float2-s in one float4? -> Yep

PS : just in case this link might be related http://forum.unity3d.com/threads/error-too-many-output-registers-declared.309662/

avatar image Borissow fguinier · Oct 12, 2015 at 02:47 PM 0
Share

It's seems it was one of Unity's schenanigans. The next day when I opened the scene with the error it was gone. Anyway what you suggested was correct for this error (AFAI$$anonymous$$). Thanks for the help :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

32 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[Video] Very strange wavy(shader?) bug on device but not on emulator where gameobjects meet 1 Answer

Can't find shader on iOS - GpuProgram creation error: shader program type is unrecognised. 2 Answers

Migrating from 2018.3.x to 2019.1 0 Answers

What are the property names in the new Unity 5 standard shader 3 Answers

Replaced '_Object2World' with 'unity_ObjectToWorld' 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges