Search Unity

[HDRP] Build failed: error X4567: maximum cbuffer exceeded

Discussion in 'Graphics Experimental Previews' started by PixelMind, Aug 1, 2018.

  1. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    Hey,
    Anyone else getting following error when trying to make a HDRP build?
    Code (CSharp):
    1. Shader error in 'HDRenderPipeline/Lit': Program 'Frag', error X4567: maximum cbuffer exceeded. target has 14 slots (on d3d11)

    Code (CSharp):
    1. Compiling Fragment program with DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON LOD_FADE_CROSSFADE INSTANCING_ON _NORMALMAP _ALPHATEST_ON _DOUBLESIDED_ON _NORMALMAP_TANGENT_SPACE _SURFACE_TYPE_TRANSPARENT _BLENDMODE_ALPHA _BLENDMODE_PRESERVE_SPECULAR_LIGHTING _ENABLE_FOG_ON_TRANSPARENT _MATERIAL_FEATURE_TRANSMISSION USE_CLUSTERED_LIGHTLIST
    2. 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_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODIN
    Ive been struggling with this for a while now. The error does not appear if I make a fresh project.
    I have quite a few external asset store assets included in the project but I'm not sure if they could be related to this in any way. There are half a dozen custom shader graphs included with custom nodes but they are fairly basic too.

    I've been trying to build with various settings but each build takes about 30 minutes (it looks like it recompiles all shader variants every time) so testing this is tedious. I'd post a bug but I can't reproduce this in any other project and I can't really upload the whole project with the report.

    The error references to d3d11 so I also tried to remove dx11 build target by replacing it with Vulkan and dx12 but still got the same error (dx12 only doesn't seem to be possible since its experimental).

    Unity version: 2018.2.0f2
    HDRP: 3.0.0. preview (downloaded via Package Manager)
    Shader Graph: 3.0.0 preview (downloaded via Package Manager)
    Post-processing: 2.0.10 preview
     
    SunnyChow and Retr028 like this.
  2. petersx

    petersx

    Joined:
    Mar 5, 2015
    Posts:
    217
    I'am using 2018.2.1f1 and the same packages as you, and everything is ok.
     
    PixelMind likes this.
  3. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    Thanks @petersx

    I finally somehow got it to build by disabling "Enable Depth Prepass With Deferred Rendering" in HDRP asset's Rendering settings. However I'm sure it wasn't just this setting alone. In an empty project enabling that setting builds just fine.

    There is something strange with the project I'm working on that causes cbuffers to tip over that hard limit. I'll investigate it some more and file a bug report if I figure out what caused it or if I can reproduce it in a fresh project.
     
  4. Retr028

    Retr028

    Joined:
    Mar 25, 2017
    Posts:
    3
    I have the same issue! I already had "Enable Depth Prepass With Deferred Rendering" disabled and I can't find anything! Have you found another fix?
     
  5. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    @GamerRO28 unfortunately no.
    I actually have the same error back for some reason. It worked fine all day yesterday. I didn't include anything new to my knowledge and its the same project.

    Same project and same error is back. Can't build. Still no idea why it's so random or what's causing it.
     
  6. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    A bit of an update to this issue.
    The error still surfaces rather randomly. Do some work with a scene, add some prefabs and or edit some shader graphs. At some point you can't make a build anymore (error in the first post).

    I can't pinpoint what exactly causes it. But I suspect its actually related to shader graph after all because I've found a fairly reliable way to get rid of it at least in my case:
    I remove all my custom shader graphs from the project (scenes go pink). Then rebuild the project with only one almost empty debug level and it usually successfully finishes. The weird part is that I can then just revert my graphs and levels back and build again and build is successful again.
    It seems like something goes wrong while editing shader graphs and removing them clears / resets *something* internally. And then the same assets work once again.
     
  7. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,093
    I believe this has been fixed for 3.3.0 which will be available in 18.3 beta 1 (hopefully later this week or early next week)
     
  8. PixelMind

    PixelMind

    Joined:
    Aug 16, 2013
    Posts:
    100
    @Tim-C Awesome! Thanks for the fix and reply :)
     
  9. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    337
    I got some similar errors, but in my case, it seems even the built in shaders can cause the problem.

    I tried to convert one mode of my existing project to HDRP. Unity automatically convert all Standard material to HDRP Lit material. It works well in editor, but it can't build. I am so sure these material trigger the problem, because i tested it by importing those materials to a new created project.