Search Unity

sm 2.0 and 64 arithmetic instruction limit

Discussion in 'Shaders' started by the_gnoblin, Oct 13, 2010.

  1. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    Hello!

    There's a limit of "64 arithmetic instructions" for shader model 2.0 in Unity, but how to count the number of such instructions in the shader code? What does translate to arithmetic instructions, what does not and what are the most expensive things to do in a shader in regard to a number of such instructions?

    I hope my question makes sense, thank you :)
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Some knowledge of D3D assembly shaders and/or OpenGL ARB_fragment_program shaders would help there. For any existing shader, you can press "Open Compiled Shader" in the inspector, and it will display the actual shader assembly generated from your Cg/HLSL code. So... well... that way you can learn :)