Search Unity

GraphicsFormat integer formats can't be used to create a Texture2D

Discussion in 'General Graphics' started by Arycama, Oct 15, 2019.

  1. Arycama

    Arycama

    Joined:
    May 25, 2014
    Posts:
    184
    There are Integer formats in UnityEngine.Experimental.Rendering.GraphicsFormat, however passing them into a new Texture2D() gives an error due to the formats not being supported for sampling on this platform.

    I assume this is because they can only be used in a shader via Load or Gather functions, as opposed to tex2D/Texture2D.Sample functions. However my use case involves storing indices for a texture array into an integer texture. Currently I must pack them into a UNORM texture, and manually unpack them in the shader.

    Is there an alternate way to create Texture2Ds using these formats, or am I stuck with Unorm textures?