Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

CreateExternalTexture for 2d texture array

Discussion in 'General Graphics' started by snacktime, Feb 27, 2021.

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,228
    Was sad this wasn't a thing. Is there any way around this? The use case is an nvidia api that manages texture arrays internally. Is there such a thing as accessing the individual slices in C and passing those to CreateExternalTexture ?
     
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,228
    So the best approach I've found here is create texture in unity send pointer to native, and then very frame copy the texture arrays to the individual textures with ID3D11DeviceContext::CopySubresourceRegion.

    Is there some reason why it's hard on the unity side to just have CreateExternalTexture for texture arrays?
     
  3. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,228
    Actually not sure why I didn't notice that Texture2DArray has GetNativeTexturePtr. That actually works better and simpler create the array in unity and pass it to native, then use the simpler CopyResource. Not ideal I'd still rather have arrays support CreateExternalTexture, but CopyResource seems pretty damn fast.
     
unityunity