Shader warnings and errors since upgrade to 3.5

I just upgraded from 3.4 to 3.5 and am getting a lot of errors from surface shaders that were working perfectly fine in 3.4. Many are giving me warnings that say “Program ‘frag_surf’, Temporary register limit of 8 exceeded;…”. Still others have bona fide errors and will not display with messages about exceeding the 64 register limit. (Target default sm 2.0).

From other information I can find out there, Direct X should have a temporary register limit of 12, not 8. And the fact that these shaders were working perfectly in 3.4 with no error or warning messages is very confusing. For now, I’m just changing these shaders to 3.0, but that seems like a band-aid rather than a solution.

Any advice would be helpful.

UPDATE: According to http://unity3d.com/support/documentation/Components/SL-ShaderPrograms.html under Shader Targets states the default SM2 target is "ARB_vertex_program with 128 instruction limit and ARB_fragment_program with 96 instruction limit (32 texture + 64 arithmetic), 16 temporary registers and 4 texture indirections. "

16 temp registers is clearly more than the 8 stated in the warnings.

Additionally, #pragma target default throws the error “#pragma target with unknown target: #pragma target default”. I then tried #pragma target 2.0 for the heck of it and it accepted it, but the warnings and errors persist.

Since upgrading t0 3.5 when I import the Image Effects Assets I’m gettinag a lot of errors like this:

Shader warning in ‘Hidden/tiltShift’: Program ‘fragBlurWeighted’, Temporary register limit of 8 exceeded; 10 registers needed to compile program at line 315 :expressionless:

Flash platform only has 8 temp registers. You will note that this is a warning and if you are not exporting to flash can be ignored.

While I do see the flash register warning sometimes, most of the warnings I get do not specify Flash (some do). Also, I had several with full errors that worked perfectly in 3.4 but would not compile in 3.5 without switching to SM3.0 (Error messages about exceeding the 64 register limit.) While the warnings are annoying, they don’t prevent it from compiling. The errors however do, and it seems silly that what used to be an SM2.0 shader in 3.4 has to be a SM3.0 in 3.5 with no changes to the code at all.

In 3.5 there are extra instructions inserted so that the unity rendering pipeline can work properly. Things like light probes and directional light maps increase the instruction count. If your are not using these features you can disable them with the correct #pragma at the start of your shader application (they are listed in the surface shader documentation).

Ahh, that makes a lot of sense (finally). Thanks for the explanation. I will disable the features I’m not using!

I think there should be a “#pragma noflash” or something like that, because its not very nice to have to live with warnings. They generate a lot of noise and makes you miss out on more important warnings. Please add! ; )

#pragma exclude_renderers flash

Ohh, thanx a lot : D