Search Unity

Crash: d3d11.dll caused an Access Violation (0xc0000005) in module d3d11.dll at 0033:ef656f40.

Discussion in 'Editor & General Support' started by hoesterey, Sep 14, 2016.

  1. SANSITH

    SANSITH

    Joined:
    Dec 9, 2018
    Posts:
    1
    Updating the GPU drivers helped me with the same problem.
    now unity 5.3.6 works perfectly fine.:):)
     
  2. SunnySunshine

    SunnySunshine

    Joined:
    May 18, 2009
    Posts:
    977
    Code (CSharp):
    1. d3d11.dll caused an Access Violation
    2. d3d11: Failed to create 2D texture in GfxDeviceD3D11
    3. d3d11: failed to create 2D texture shader resource view id=501 [D3D error was 80070057]
    4. d3d11: failed to create 2D texture id=501 width=684 height=684 mips=1 dxgifmt=78 [D3D error was 887a0005]
    5. d3d11: failed to create staging 2D texture w=128 h=2 d3dfmt=10 [887a0005]
    6. D3D shader create error for vertex shader [0x887a0005]
    7. D3D shader create error for pixel shader [0x887a0005]
    8. D3D11: Failed to create RenderTexture (662 x 534 fmt 9 aa 1), error 0x887a0005
    9. D3D11: Failed to create render texture primary DSV (error 0x80070057)
    10. d3d11: failed to create staging 2D texture w=128 h=2 d3dfmt=10 [887a0005]
    11. d3d11: failed to create buffer (target 0x1 mode 0 size 864) [0x887A0005]
    12. d3d11: failed to create Cube texture id=1858 s=512 mips=10 d3dfmt=95 [887a0005]
    Adding my experience of this problem and what the solution was in our case.

    A week ago or so, a user made us aware of a bug that occurred on his system. Apparently the app would crash upon load. The computer this user was using was not particularly powerful (a laptop with a dedicated gfx 2gb), but still it should be able to run the app.

    After multiple builds and sharing of logs, I pinpointed the problem (in our case) to a ComputeBuffer.GetData() returning all zeros where there should have been data. This was very confusing, because the very same code on the very same buffer (which was unaltered) worked elsewhere, but all of the sudden, somewhere along the line, this would stop functioning properly.

    This issue would not show up in isolation, only in the immense complexity of our project.

    Since this issue was so illusive and since making builds, sharing them and waiting for logs is so slow, eventually I bought similar hardware to what the user had, in order to test on. Luckily, we could reproduce the bug on this hardware.

    After pulling the project apart piece by piece, I discovered that it wasn't the GetData necessarily that was the problem. Rather, a compute shader which runs fine on faster systems would silently cause all future buffers and render textures to fail. Even those buffers that were already created successfully previously.

    This compute shader was a rather heavy one - brute force stepping through thousands of triangles to do some operation. By splitting up this operation into several dispatches, we were able to avoid the problem from occurring.

    It is by far the most difficult bug I've come across, because there was no information about this in the logs from the build, and random things like having the web browser open would prevent the bug from happening. I've never seen anything like that. The app would silently fail with no information of any of this occurring. It's by pure intuition and trial and erroring that I was able to solve this.

    In the unity crash logs, there was some more information. I pasted the errors that I could find in the code block above, in case people search google.

    tl;dr:
    A complex compute shader caused buffers and textures to behave improperly after a while on slower systems.
    Splitting the complex compute shader into multiple dispatches to reduce the time of each dispatch solved the problem for us.

    Surprisingly, changing from deferred to forward also solved the problem for us. But we need to use deferred for performance, so we went with our own solution.
     
    grizzly and DMinsky like this.
  3. frozenito

    frozenito

    Joined:
    Mar 20, 2020
    Posts:
    9
    I have decent PC with small scene, i7, 3070 and 64gb of RAM, and Unity crashes during saving scene, and all I get is logs from Windows 10, directing to error 0xc0000005 and d3d11.dll, Unity version is 2021.3.27f1