Search Unity

d3d11 Error Causing builds to crash on some devices

Discussion in 'Windows' started by hba_infinity, Feb 28, 2018.

  1. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    We are currently in the process of upgrading Unity from 5.5.0p4 to Unity 2017.2.1p2. On Windows Standalone builds, we are having an issue where some PCs are crashing due to running out of memory due to the problem d3d11: failed to create 2D texture shader resource. An example of this is below -

    In Unity 5.5.0p4, the build was running fine without any d3d11 errors, and would not crash the game.

    After some investigation of similar problems, we aren't using any NPOT textures, all textures are using DXT1 and DXT5 to ensure compatibility with older DirectX 9 systems, and the graphics card drivers on the device tested on are up to date. From what I can tell, the textures are having a problem, then causing textures to decompress, eventually causing the game to crash when running out of memory. I've generally seen similar things happen on older devices and using BC7 texture compression, but generally the "Unsupported Compression Format" error would appear instead of the above error.

    This error has happened on other test devices, and I'll try to post more information as I get it.

    Full output_log and error log are attached.
     

    Attached Files:

  2. Wecica

    Wecica

    Joined:
    Jul 20, 2016
    Posts:
    27
    I encountered the same problem when I debug my UWP game on Xbox.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    HRESULT 0x887a0005 is DXGI_ERROR_DEVICE_REMOVED, which means the graphics card driver crashed. Do you have a repro project you could share with us in a bug report?
     
  4. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    Hey Tautvydas,

    I'll try to make a bug report in a repro project now and will post the bug number below. It may take a while as we are unsure of the exact problem in the large project.
     
  5. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    Just an update, I believe I've found what the issue is.

    The game was running out of Graphical Memory when attempting to load in too many textures into memory at the same time. The weird thing was that on Unity 5.5.0p4, the game would not crash when loading the exact same amount of textures. The crash was only occurring on devices which had ~1GB of Graphical Memory (currently only on Intel integrated Graphics Cards).

    Has anything changed between Unity 5.5.0p4 and Unity 2017.2 where it will push Textures more into Graphical Memory instead of System Memory (RAM) on Standalone builds?
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    One thing to check is whether the textures are using the same format on the GPU. An easy way to do it is to use a graphics debugger like Visual Studio and see what format they end up being in.
     
  7. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    From what I can tell, everything seems to be using the same bits per byte (DXGI_FORMAT_R32G32B32A32_FLOAT) on both the 5.5 version and the 2017.2 version. The only real difference I could tell is that 2017.2 seems to render everything upside down before the final pass, but apart from that, everything seems the same.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I asked around and nobody seems to recall any special changes for this between those two Unity versions. Could we get a bug report so we could investigate it?
     
  9. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    I have built out a project with this problem occurring. I'll post the bug ID once the files have uploaded.

    In the bug report, there are 2 builds, one made in 5.5.0p4 and 2017.2.1p2. Running these builds on our affected machine (and others), the build on 5.5 seems to run fine without crashing (albeit using a heap of memory just to get this issue to occur), where the one on 2017.2 seems to crash during loading, and gets the errors above.
     
  10. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    Apologies, I was hoping to have the bug report uploaded before the end of our work day today, but it is uploading a large amount of data. I'll post the bug ID when it has completed.
     
  11. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    The upload finally completed. It is in the FogBugz bug database under Case 1009713.

    There are 2 different builds uploaded with the offending project. One built with 5.5 and the other with 2017.2, which both use the exact same code to load the exact same asset bundles. Does this help for tracking down what could be different?
     
  12. luluco250

    luluco250

    Joined:
    Jul 23, 2018
    Posts:
    2
    Sorry for necro-ing this thread, but I've ran into the same issue: a version of the same project made for Unity 5.4.1 works fine, but another made for Unity 2017.3 does not.

    The code related to the crash (which is related to rendering to a render texture and then saving it) is pretty much the same. If I select a lower resolution for the RT it doesn't crash.

    Was a solution to this ever found? Is there a way to reduce memory usage? I'm actually considering using a sort of "tiled" rendering, by taking renders of parts of the screen using a lower resolution RT, the results of which get saved in Texture2D's which would then be stitched together to form the the final image.

    This would only work because I'm using an orthographic camera of course, I can't imagine how bad it'd be with a perspective camera.
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    The original bug reported in this thread was fixed. It's likely you are running into a different one. Could you file a bug report?
     
    hba_infinity likes this.
  14. hba_infinity

    hba_infinity

    Joined:
    May 30, 2016
    Posts:
    49
    @luluco250 Our bug which we found was due to Running out of Memory using 32-bit builds. There was a compiler flag missing from 32 bit builds which would make it not use all allocated memory, which it could use in older versions. If you are using 64 bit builds and encountering this error, it could be that you are using a build which does not have this fix applied, or are actually running out of memory.

    This was the reference thread with more information - https://forum.unity.com/threads/crashes-in-unity-2017-2-1f1-when-building-32-bit.515435/
     
  15. luluco250

    luluco250

    Joined:
    Jul 23, 2018
    Posts:
    2
    @Tautvydas-Zilys
    I'll check if it works on a newer build of the engine, I have tested it before in 2018.2 but the same problem occurred.

    @hba_infinity
    We're using 64-bit builds yes. Like I mentioned in my previous message, I'm not sure if the code that handles all the objects that are used in the rendering process has changed much from the previous version. Like I said, it used to just work.

    I think I'll actually test running the old version directly on top of the 2017.3 editor we have installed here, if the problem does not occur then yeah it's more likely our fault (in the more recent version) and not Unity's.

    Thanks for the quick reply, I'll report back later!

    UPDATE

    After upgrading the old project to the same Editor we're using for the new version, it seems the problem does not happen, so it's more likely that we're just wasting more [video] memory in the new one. That'll be fun to fix.

    Well, thanks anyway, sorry again for necroing this thread.
     
    Last edited: Aug 21, 2018