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

Hey,
Anyone else getting following error when trying to make a HDRP build?

Shader error in 'HDRenderPipeline/Lit': Program 'Frag', error X4567: maximum cbuffer exceeded. target has 14 slots (on d3d11)
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
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

2 Likes

Iā€™am using 2018.2.1f1 and the same packages as you, and everything is ok.

1 Like

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.

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?

@Retr028 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.

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.

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)

@Tim-C Awesome! Thanks for the fix and reply :slight_smile:

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.

Its back!

1 Like

Relief that Iā€™m not the only one getting this error(with urp), though its terrible to not be able to build. Exact same error, reported as IN-24251 though it appears no one has looked at it yet.

Same here. Unity version 2022.2.2f1, cannot build due to this error displaying numerous times. Iā€™ve never had it previously. URP, not HDRP.

1 Like

Me too, Unity 2022.2.7f1 and URP 14.0.6 (cannot build my game)

Have you found any solution?

Same here. 2022.2.8f1

Iā€™ve just hit this error after updating to the latest version of DOTS (1.0.0-pre.44) on Editor 2022.2.8f1

Shader error in ā€˜Universal Render Pipeline/Litā€™: Program ā€˜LitPassFragmentā€™, error x4567: maximum cbuffer exceeded. target has 14 slots at line 98 (on d3d11)

It seems like itā€™s a shader bug and it should be fixed in the upcoming 2022.2 version: Discord

Same, also canā€™t build after updating unity to 2022.2.8f1.

Just tested this with 2022.2.9f1 and the error still happens.

3 Likes

Just tested this with 2022.2.10f1 and the error still happens.

2 Likes