Search Unity

CreateExternalTexture for 2d texture array

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

  1. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    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,356
    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,356
    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.