Search Unity

Compilation Error Desktop Windows 64-bits : Maximum constant register index exceeded

Discussion in 'Shaders' started by Ofreyre, Nov 26, 2017.

  1. Ofreyre

    Ofreyre

    Joined:
    Jul 17, 2013
    Posts:
    28
    Hi,

    I made a shader that works on Editor and Android, but can´t compile for Windows 64-bits.

    When compiling for desktop Windows 64-bits I get that maximum constant register index is exceeded.
    I'm setting a global vector array of 150 elements. I'm also using a two global floats and a global int:

    Shader.SetGlobalVectorArray("_MASK", m_mask);
    Shader.SetGlobalFloat("_MASKLENGTH", j);
    Shader.SetGlobalFloat("_MASK_R", m_radius);
    Shader.SetGlobalInt("_MASK_PI_index", m_PI_j);

    Where m_mask is Vector4[150].

    I'm using shader globals to set the values once for multiple materials.

    Is there a way to increase the number of constants that can be used?

    These are the relevant logs:

    Log 1
    18: [Unity] ERROR: Implementation limit of 4096 (e.g., number of built-in plus user defined active uniforms components) exceeded, fragment shader uses 4124 total uniforms.

    Log 2
    Shader error in 'FOVV/Clip': Program 'frag_surf', error X4507: maximum ps_3_0 constant register index (224) exceeded - Try reducing number of constants referenced (on d3d9) Compiling Fragment program with DIRECTIONAL DYNAMICLIGHTMAP_ON Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA

    Log 3
    Shader error in 'FOVV/Clip': maximum temp register index exceeded at Assets/Shaders/ClipCommon.cginc(57) (on d3d9) Compiling Fragment program with DIRECTIONAL Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA

    Thanks
     
  2. sidney7111

    sidney7111

    Joined:
    Jun 28, 2020
    Posts:
    8
    It's should not have this problem now, because of people were seldom using D3D9,D3D9 have such limit. Change it or use default D3D11, it will be ok
    upload_2022-5-10_18-40-48.png