Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Unity 4] 3D texture with mipmaps and crashes?

Discussion in 'Editor & General Support' started by ronan-thibaudau, Nov 18, 2012.

  1. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I'm trying to get 3D textures to work with mipmap, my 3D textures work just fine without mipmap but simply changing

    tex = new Texture3D(size, size, itemscount, TextureFormat.ARGB32, false);
    to
    tex = new Texture3D(size, size, itemscount, TextureFormat.ARGB32, true);
    causes a unity hard crash (even if i divide the resolution by 4 to make sure i'm not just going over a memory limit)
    This is with the latest unity 4
    It also crashes in a different way than usual as it doesn't even bring the unity bug reporter!
     
  2. MikeBastien

    MikeBastien

    Joined:
    Apr 24, 2009
    Posts:
    139
    Sorry,

    As I have no experience with that issue, but if you weren't aware you can bring up the bug reporter from the menus:

    'Help' >> 'Report a Bug'.
     
  3. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Already bug reported it, but wanted it on the forum too as sometimes you report a bug and posting it in the forum someone will let you know that it isn't a bug and you totally messed up, so since there's a param to explicitely say wether you want it mipmapped or not, i'm assuming it's misuse on my end as i can't see such a large bug making it throught testing.
     
  4. Corngood

    Corngood

    Joined:
    Nov 15, 2012
    Posts:
    20
    Bumping because I'm having a similar problem with 4.1.5 (d3d11). It crashed for me once, but usually I will just get undefined contents in all levels > 0 when I try to set them. I'm not getting any errors, and I'm calling Apply(false).

    Did you ever resolve this?

    Cheers
     
  5. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    Just a quick not helpful answer since i wouldn't want you to wait, no iirc i never really fixed it, i did get 3D textures working just fine but it always failed past a certain resolution, and at a lower resolution it failed randomly.
    I do remember i had something going but i can't remember if i stuck to 3D textures on it or not, if i find the code again i'll update here.
     
  6. Corngood

    Corngood

    Joined:
    Nov 15, 2012
    Posts:
    20
    Do you have a link to the bug report?

    Here's the crash I'm seeing:

    In TexturesD3D11::UploadTexture3D, 'srcSlice' points to invalid memory, and is used as the source for a memcpy. The locals are:

    Code (csharp):
    1.  
    2. +       this    0x00000020 {m_Samplers={ size=??? } m_Textures={rep={hash={...} equals=equal_to get_key={...} ...} } ...}   TexturesD3D11 *
    3. +       tid {m_ID=1235 }    TextureID
    4. +       srcData 0x0e925db4 "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ... unsigned char *
    5.         width   64  int
    6.         height  64  int
    7.         depth   16  int
    8.         format  4   unsigned long
    9.         mipCount    7   int
    10.         uploadFlags 1   unsigned long
    11. +       ctx 0x02112d94 {...}    ID3D11DeviceContext *
    12.         maxLevel    6   int
    13. +       rgba    0x0b246fbc "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ... unsigned char *
    14. +       uploadFormat    {unityformat=4 d3dformat=DXGI_FORMAT_R8G8B8A8_UNORM (28) sRGBD3dformat=DXGI_FORMAT_R8G8B8A8_UNORM_SRGB (29) }   const FormatDesc11
    15. +       it  {ht=0x19c87078 {hash={...} equals=equal_to get_key={...} ...} pos=0x19c8ba70 ({m_ID=4261281277 }, {m_Texture=0xdeadbeef {...} m_SRV=0xdeadbeef {...} m_UAV=0xdeadbeef {...} ...}) ...}  dense_hashtable_iterator<std::pair<TextureID const ,TexturesD3D11::D3D11Texture>,TextureID,TextureIDHashFunctor,dense_hash_map<TextureID,TexturesD3D11::D3D11Texture,TextureIDHashFunctor,std::equal_to<TextureID>,stl_allocator<std::pair<TextureID const ,TexturesD3D11::D3D11Texture>,49,4> >::SelectKey,std::equal_to<TextureID>,stl_allocator<std::pair<TextureID const ,TexturesD3D11::D3D11Texture>,49,4> >
    16. +       texture 0x1fa1df90 <Information not available, no symbols loaded for d3d11.dll> ID3D11Texture3D *
    17. +       viewDesc    {Format=DXGI_FORMAT_R8G8B8A8_UNORM (28) ViewDimension=D3D11_SRV_DIMENSION_TEXTURE3D (8) Buffer={FirstElement=...} ...}  D3D11_SHADER_RESOURCE_VIEW_DESC
    18. +       srView  0x0b246fbc {...}    ID3D11ShaderResourceView *
    19. +       desc    {Width=64 Height=64 Depth=16 ...}   D3D11_TEXTURE3D_DESC
    20.         level   1   int
    21. +       dstSlice    0x0b246fbc "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ... unsigned char *
    22. +       srcSlice    0x0ea25db4 <Error reading characters of string.>    const unsigned char *
    23.  
    And the full call-stack is:

    Code (csharp):
    1.     Unity.exe!memcpy(unsigned char * dst, unsigned char * src, unsigned long count) Line 185    Unknown
    2.     Unity.exe!prcore::Surface::BlitImage(const prcore::Surface  source, prcore::Surface::BlitMode mode) Line 4077   C++
    3.     Unity.exe!SwizzleToRGBA(const unsigned char * src, unsigned char * dst, int width, int height, int dstPitch, unsigned long format) Line 20  C++
    4. >   Unity.exe!TexturesD3D11::UploadTexture3D(TextureID tid, unsigned char * srcData, int width, int height, int depth, unsigned long format, int mipCount, unsigned long uploadFlags) Line 713  C++
    5.     Unity.exe!GfxDeviceD3D11::UploadTexture3D(TextureID texture, unsigned char * srcData, int srcSize, int width, int height, int depth, unsigned long format, int mipCount, unsigned long uploadFlags) Line 1579   C++
    6.     Unity.exe!GfxDeviceWorker::RunCommand(ThreadedStreamBuffer  stream) Line 762    C++
    7.     Unity.exe!GfxDeviceWorker::Run() Line 202   C++
    8.     Unity.exe!GfxDeviceWorker::RunGfxDeviceWorker(void * data) Line 174 C++
    9.     Unity.exe!Thread::RunThreadWrapper(void * ptr) Line 252 C++
    10.     kernel32.dll!7725850d() Unknown
    11.     [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] 
    12.     ntdll.dll!7747bf39()    Unknown
    13.     ntdll.dll!7747bf0c()    Unknown
     
  7. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    No clue if it's the same issue, but found the case number by digging in my mails and it was 498351
    Also the issue wasn't about 3D tex in the end i think but about a mono crash that happened after using a 3D tex when allocating a color array
     
  8. Corngood

    Corngood

    Joined:
    Nov 15, 2012
    Posts:
    20
    Thanks. I'll submit a new bug for this.