d3d11: failed to create 2D texture

Hi!

I’ve searched a solution but I haven’t found anything.

In my game, first, I take a screenshot for each team (maximum of three teams), and in the last scene I show these screenshots that I have taken previously, but sometimes, when I click in the button to get the last scene (the scene that shows the screenshots), the game crashes.

The error log returns me this message:

I have no idea… =(

Thanks!

Any idea? =(

Whats your code look like? Sounds like you may be running out of memory.

The way to store the screenshot:

 public IEnumeratortake ScreenshotToTeam(System.Actioncallback){
            yieldreturnnewWaitForEndOfFrame();
            Texture2Dtex=newTexture2D((Screen.width/2+425)-(Screen.width/2-425),Screen.height);
            tex.ReadPixels(newRect(Screen.width/2-425,0,Screen.width/2+425,Screen.height),0,0);
            tex.Apply();
            SharedVariablesNonGame.pyramids[SharedVariablesNonGame.currentTeam-1]=tex;
             callback();
}

The way to load the screenshot:

 for(int i=0;i<SharedVariablesNonGame.numTeams;i++){
rec=newRect(0,0,SharedVariablesNonGame.pyramids.width,SharedVariablesNonGame.pyramids.height);
sprite=Sprite.Create(SharedVariablesNonGame.pyramids,rec,newVector2(0,0));
resultImagesThreeTeams.GetComponent<Image>().sprite=sprite;
}

The maximum of the screenshots to load are 3

What does your full log file look like?

The error log is like this:

...
...
...
d3d11: failed to create 2D texture id=1171 w=850 h=1050 mips=11 d3dfmt=28 [887a0005]
d3d11: failed to create 2D texture view id=1171 [80070057]
d3d11: failed to create 2D texture id=1173 w=850 h=1050 mips=11 d3dfmt=28 [887a0005]
d3d11: failed to create 2D texture view id=1173 [80070057]
d3d11: failed to create 2D texture id=1175 w=850 h=1050 mips=11 d3dfmt=28 [887a0005]
d3d11: failed to create 2D texture view id=1175 [80070057]
Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
d3d11: failed to create 2D texture id=1179 w=256 h=256 mips=9 d3dfmt=77 [887a0005]
d3d11: failed to create 2D texture view id=1179 [80070057]
d3d11: failed to create 2D texture id=1181 w=256 h=256 mips=9 d3dfmt=77 [887a0005]
d3d11: failed to create 2D texture view id=1181 [80070057]
d3d11: failed to create vertex buffer of size 3920 [0x887A0005]
d3d11: failed to create vertex buffer of size 784 [0x887A0005]
d3d11: failed to create index buffer of size 756 [0x887A0005]
d3d11: failed to create vertex buffer of size 3920 [0x887A0005]
d3d11: failed to create vertex buffer of size 784 [0x887A0005]
d3d11: failed to create index buffer of size 744 [0x887A0005]
D3D shader create error for vertex shader [0x887a0005]
D3D shader create error for pixel shader [0x887a0005]
WARNING: Shader Unsupported: 'UnlitAlpha' - Pass '' has no vertex shader
WARNING: Shader Unsupported: 'UnlitAlpha' - Setting to default shader.
d3d11: failed to create 2D texture id=1177 w=256 h=256 mips=1 d3dfmt=65 [887a0005]
d3d11: failed to create 2D texture view id=1177 [80070057]
Crash!!!

I am getting the same error.
It seems to be a model dependent bug occurring on some PCs.
However, it does not happen with too old a PC.
I can wake up on a number of PCs that I can not ignore.

A user who purchased the game reports that “the screen turns black during play and it will not move”.
I investigate the cause, I am reporting to Unity Japan and a bug reporter.(Case 888114)
However, the problem has not been solved yet. Bug reporters have only reply of fixed form sentences.
I found a topic that seems to be the same cause here, so I will add it.

· Texture loading fails when Call LoadFromImage in coroutine
· It happens only on some older Windows PCs. It’s happens 100% if it gets up
· The error log is ‘d3d11: failed to create 2D texture’
· In “Auto Graphics API for Window” of PlayerSettings. It does not happen if you reverse the order of Direct3D11 and Direct3D9 and give priority to Direct3D9

I think this is an important bug. LoadImage is used in coroutines and it is often used after waiting for loading files, so I think that it will be used with considerable probability.
I think that it was not happening before, it seems that it is caused by the version of Unity.
I have confirmed that this phenomenon occurs in Unity 5.5.2

An error occurs in this code.

public class ExampleScript2 : MonoBehaviour
{
    public TextAsset bytes;
    public RawImage rawImage;

    public void Start()
    {
        StartCoroutine(LoadAsync());
    }

    IEnumerator LoadAsync()
    {
        yield return new WaitForSeconds(1);

        Texture2D tex = new Texture2D(1, 1);
        tex.LoadImage(bytes.bytes);
        rawImage.texture = tex;
    }
}

I have this bug occuring on a GTX 970 in Unity 5.4.5

We are having the same problem. In our build machine when we build the game, we got a lot of:

d3d11: failed to create 2D texture id=3977 width=80 height=80 mips=8 dxgifmt=28 [D3D error was 80070057]
d3d11: failed to create 2D texture shader resource view id=3977 [D3D error was 80070057]
d3d11: Failed to create 2D texture in GfxDeviceD3D11
d3d11: failed to create 2D texture id=3979 width=264 height=126 mips=10 dxgifmt=28 [D3D error was 80070057]
d3d11: failed to create 2D texture shader resource view id=3979 [D3D error was 80070057]
d3d11: Failed to create 2D texture in GfxDeviceD3D11
d3d11: failed to create 2D texture id=3989 width=478 height=459 mips=10 dxgifmt=28 [D3D error was 80070057]
d3d11: failed to create 2D texture shader resource view id=3989 [D3D error was 80070057]
d3d11: Failed to create 2D texture in GfxDeviceD3D11

and sometimes running the game in a NVIDIA GeForce GTX 960:

d3d11: failed to create 2D texture id=244 width=740 height=537 mips=11 dxgifmt=28 [D3D error was 80070057]
d3d11: failed to create 2D texture shader resource view id=244 [D3D error was 80070057]

Any indication of the offender textures and why it’s happening would be great.

It seems that in build machine, the problem comes from sprite packer:

d3d11: failed to create 2D texture id=3977 width=80 height=80 mips=8 dxgifmt=28 [D3D error was 80070057]

UnityEditor.Sprites.PackerJob:AssignToAtlas(String, Sprite, SpritePackingMode, SpritePackingRotation)
UnityEditor.Sprites.DefaultPackerPolicy:OnGroupAtlases(BuildTarget, PackerJob, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\DefaultSpritePackerPolicy.cs:109)
UnityEditor.Sprites.Packer:ExecuteSelectedPolicy(BuildTarget, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\SpritePacker.cs:118)
UnityEditor.BuildPipeline:BuildAssetBundlesInternal(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:490)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:481)
Builder:BuildAllAssetBundles(BuildTarget) (at Assets\Editor\Builder.cs:1065)
Builder:PerformBuild() (at Assets\Editor\Builder.cs:357)

[C:\buildslave\unity\build\Runtime/GfxDevice/d3d11/TexturesD3D11.cpp line 496]
(Filename: Assets/Editor/Builder.cs Line: 1065)

d3d11: failed to create 2D texture shader resource view id=3977 [D3D error was 80070057]

UnityEditor.Sprites.PackerJob:AssignToAtlas(String, Sprite, SpritePackingMode, SpritePackingRotation)
UnityEditor.Sprites.DefaultPackerPolicy:OnGroupAtlases(BuildTarget, PackerJob, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\DefaultSpritePackerPolicy.cs:109)
UnityEditor.Sprites.Packer:ExecuteSelectedPolicy(BuildTarget, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\SpritePacker.cs:118)
UnityEditor.BuildPipeline:BuildAssetBundlesInternal(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:490)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:481)
Builder:BuildAllAssetBundles(BuildTarget) (at Assets\Editor\Builder.cs:1065)
Builder:PerformBuild() (at Assets\Editor\Builder.cs:357)

[C:\buildslave\unity\build\Runtime/GfxDevice/d3d11/TexturesD3D11.cpp line 515]
(Filename: Assets/Editor/Builder.cs Line: 1065)

d3d11: Failed to create 2D texture in GfxDeviceD3D11
UnityEditor.Sprites.PackerJob:AssignToAtlas(String, Sprite, SpritePackingMode, SpritePackingRotation)
UnityEditor.Sprites.DefaultPackerPolicy:OnGroupAtlases(BuildTarget, PackerJob, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\DefaultSpritePackerPolicy.cs:109)
UnityEditor.Sprites.Packer:ExecuteSelectedPolicy(BuildTarget, Int32[]) (at C:\buildslave\unity\build\Editor\Mono\Sprites\SpritePacker.cs:118)
UnityEditor.BuildPipeline:BuildAssetBundlesInternal(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTargetGroup, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:490)
UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:481)
Builder:BuildAllAssetBundles(BuildTarget) (at Assets\Editor\Builder.cs:1065)
Builder:PerformBuild() (at Assets\Editor\Builder.cs:357)

[C:\buildslave\unity\build\Runtime/GfxDevice/d3d11/TexturesD3D11.cpp line 532]
(Filename: Assets/Editor/Builder.cs Line: 1065)

Could you file a bug report please and include as much information about this as you can?
Thanks

Unity 5.6.1p1 same issue, after many errors like that game crashed.

d3d11: failed to create staging 2D texture w=32 h=32 d3dfmt=2 [887a0005]

has anyone found a solution to this? I’m running into the same problem with 5.5 and windows

I am having the same issue with a nVidia GTX 980. I cannot even open the the Unity 5.6.2 editor with new empty project without a crash. So i made unity run on the integrated graphics (it sucks) but works. Now when i build it crashes with:

========== OUTPUTING STACK TRACE ==================

0x629AC7BA (d3d11) CreateDirect3D11SurfaceFromDXGISurface
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00F84C19)
0x00F84C19 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 0106B6F8)
0x0106B6F8 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 010742F8)
0x010742F8 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00F643C4)
0x00F643C4 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00F65409)
0x00F65409 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00F657C8)
0x00F657C8 (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00FCF86C)
0x00FCF86C (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 00FD374E)
0x00FD374E (dascube)
ERROR: SymGetSymFromAddr64, GetLastError: ‘Attempt to access invalid address.’ (Address: 012C4716)
0x012C4716 (dascube)
0x755C62C4 (KERNEL32) BaseThreadInitThunk
0x77860FD9 (ntdll) RtlSubscribeWnfStateChangeNotification
0x77860FA4 (ntdll) RtlSubscribeWnfStateChangeNotification

========== END OF STACKTRACE ===========

**** Crash! ****

Of course i have latest DirectX and Graphics Driver.

Any more info on this?

  • UPDATE *
    I tried the program on other computers in the house and compiling with unity 5.4.x, 5.5x.
    It crashes on all nVidia GTX Cards - My wifes computer as AMD with ATI card, works perfectly.
    My Desktop is Dual GTX 660’s and Laptop is Predator with GTX 980. CRASH!

I can play many other games on the nVidia GTX’s so I do not think its the driver or system but rather a Unity Issue.

3124209–236586–output_log.txt (22.9 KB)

1 Like

We’re running into this, not with Unity itself, but with our game.

…and so on, at great length. At this point the app becomes unresponsive as far as the user can tell (though we’re still executing scripts, at least for a while, as I can tell by further Debug.Log output).

This only occurs on one of our test machines, and it’s a fairly old one… but if there’s anything that can be done, even to detect this case and present a useful error message, please let me know!

We had this issue to and figured out what it was.

There were textures in the build that were set to compress and were not powers of 2. Notice that all the textures in your thread have this. You can correct this by either scaling the textures of turning off compression, and mip mapping. If they are not power of 2 having mip mapping on will cause this problem, and if they are not multiple of 4 Compression will cause this problem.

The bigger problem for this is that Unity’s behavior for this is horrible. We discovered this when we started doing clean builds because it was the one time when the warnings would show up. In addition these texture would just not show up in the game. Think about this scenario for a second.

During development, everything is fine, no warnings.
Do an incremental build or a build from the editor, no warnings, works fine.
Spit a clean build out, the build gets these cryptic errors and doesn’t work.

It is like a nightmare scenario for putting builds together. On top of this the errors don’t tell you which texture is the problem so it is very hard to find this.

The weirdest part is that if I go to my build machine to a build that has already been generated then open the project in unity and close it, all the incremental builds will work at that point.

I would like to be doing clean builds but I am terrified to now.

8 Likes

I made a fairly simple repro case of this and filed it as

(Case 939236) NPOT Textures cause Clean Builds to Fail without warning

2 Likes

Thank you! That’s useful information.

When we launch unity editor it shows multiple errors of this kind

d3d11: failed to create 2D texture id=60 width=960 height=540 mips=10 dxgifmt=28 [D3D error was 887a0005]

The machine does not have a discrete video card. It is running on Intel HD graphics.

We have tried running it with DirectX 9 as well but it shows the same error in a slightly different format.
We have also tried running it on a different machine with ATI graphics card capable of DX11.

If we turn of mipmaps in all the images than these errors do not show up.

Can anyone point out the root cause of this issue?

Hi everyone, nothing new? It happens with me on 5.6.3p4 for a user with Intel HD too. Anyone knows if it still happens with 2017.3?

Thanks