Search Unity

Standard: Too large shader binary (-1911378036 > max 2147483647 bytes) - compression failed. Try red

Discussion in 'Editor & General Support' started by Brechtos, Jan 24, 2019.

  1. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    I'm currently in the process of upgrading our game from Unity 2017.4.14f1 LTS to Unity 2018.
    I've gone through all the steps that go alongside an upgrade like this, fixing all relevant warnings and errors as well as updating any packages in use to their package manager versions (Probuilder, Progrids, Cinemachine and Textmesh Pro).
    Everything is working like a charm in the editor, however I can no longer create a functional standalone build.
    (Note that no assets where really changed apart from some color changes in certain shaders and the warning+ error fixes)
    The following thing happens:
    I can create ok builds when I have all light map data cleared and the fog option disabled in the lighting inspector for the build included scenes. However when I add a couple of more complex scenes to my build list, as soon as I have a scene in there that has lighting built and the fog option enabled, I will end up with very long compile times combined with the following error once the build is completed:

    Standard: Too large shader binary (-1911378036 > max 2147483647 bytes) - compression failed. Try reducing the number of variants or shader complexity.


    If I then try to run the generated .exe I will get an instant crash (the launcher won't even start). See the attached log + crashdump that is generated in such an event. - Write to location 0000000000000000 caused an access violation.)
    Rebuilding the exact same content but with the fog setting disabled, the build will succeed and I will be able to run the game just fine.

    Some additional info:
    • I can build some of the scenes with the fog enabled when they are standalone but that depends on the scene (I'm guessing the total build size has an influence on that?)
    • I haven't been able to test a build with a lot of larger scenes included to rule out that it is fully caused by enabling the fog parameter
    • The builds where tested using a full clean install of Unity (removed all app data unity folders before reinstalling)
    • The project was build after a full fresh library re import to make sure there were no leftover assets from the previous versions being used.
    • The project went through a tiered update going from 2017.4.14f1 to the latest 2018.1 version (build failed), going to the latest 2018.2 version (build failed) and latest 2018.3 version (build failed)
    • The project builds perfectly without any issues on the 2017.4.14f1 using a same build list and the same setup.
    • Clearing the GI caches and rebuilding lighting in the new versions didn't seem to have any impact. So far it seems like enabling the fog has the biggest impact.
    • Looking at the editor logs it would seem that the difference between the working builds and the non working builds is the fact that the standard shader compiles differently and actually ends up breaking everything.

      Compiled shader 'Legacy Shaders/Diffuse' in 1.75s
      d3d11 (total internal programs: 330, unique: 330)
      Compiled shader 'Standard' in 4923.18s
      d3d11 (total internal programs: 466880, unique: 453456)
      Standard: Too large shader binary (-1911378036 > max 2147483647 bytes) - compression failed. Try reducing the number of variants or shader complexity.

    • There is a difference in the way the issue is handled between 2018.1/2 and 2018.3. In 1 and 2 the .would crash before the launcher is opened and give crashdump as provided in the attachement. In 2018.3 the launcher will start and you will be able to start the game but at some point you will clearly end up in a broken gamestate while the game just blasts through (in my case broken rendering en init crashes, no full crash though)
    • The error that is provided differs between 1/2and 3. In 3 it seems to point into the actual direction of the issue whereas in 1/2 the error would talk about issues with the LZ4 compression
    I was wondering if anyone else has had issues with this and if there is a reliable fix for this problem.

    In the attachment you can find a crashdump of the pre 2018.3 .exe fails as well as a couple of editor logs.

    Thx
     

    Attached Files:

  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,618
    In this case, it sounds like you found a regression. Could you please submit a bug-report, including a project to reproduce the issue, as described in this document:
    https://unity3d.com/unity/qa/bug-reporting

    Submitting a bug-report allows Unity Technologies to take a look at this issue.

    After you submitted the bug-report, you receive a confirmation email with a bug-report Case number. You can post this Case number (the Case number only, not the link) in this forum thread for Unity staff to pick up, in case they see it.
     
  3. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    It might be a bit tricky to fully upload our entire game to the bugreporter even with stripping most of the unused content.
    Because it's hard to pinpoint what the exact trigger is of this issue (as it's happening in the unity code) I'm still trying to figure out how to repro this with a bare minimum setup.
     
    Peter77 likes this.
  4. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    After some experimenting and hours of building and trying to strip the project to a more submitable size I was able to submit a bug report. This issue causes the same effect as if you would set the graphics settings Instancing Variants setting to "Keep All" resulting in a all the Standard Shader variants being included and compiled even though it is most definitely set to "Strip Unused" . This in turn results in an integer overflow, a build error and a broken executable.
     
    Peter77 likes this.
  5. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    Still awaiting a response from the bug tracker... In the meantime we are totally halted with moving forward certain parts of development as this is a critical game breaker :(
     
    Kohelot_Koodaajat likes this.
  6. Kohelot_Koodaajat

    Kohelot_Koodaajat

    Joined:
    Feb 4, 2018
    Posts:
    1
    Any response yet? I'm facing exactly the same issue.
     
  7. Brechtos

    Brechtos

    Joined:
    Sep 18, 2014
    Posts:
    18
    As far as I could tell they aren't looking that much into the problem as it is "caused by to many parameters"
    I did receive a issue tracker link for a seemingly related issue but from what I could tell, though the result is similar, I believe the cause is different.
    https://issuetracker.unity3d.com/is...JrcxKSYe3U-yKWXuQJRVBn7pKg3cMkYz3YCTJS4dOk1yA

    Something to double check though is to make sure that if you have always included shaders in the project that they are not using the Standard shader as the fallback shader. Having it set to the Standard shader will almost always guarantee the issue as soon as a scene with fog enabled is part of the build.
     
  8. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I'm seeing this issue as well with 2019.2.7.2