Sample Texture2dArray in vertex shader


I’d like to ask if there is a possibility to sample a Texture2DArray in vertex shader? Normally, to sample a regular texture in vertex shader, I’d use


But since sampling Texture2DArray requires a macro (UNITY_SAMPLE_TEX2DARRAY), which encapsulates the regular tex2D used in fragment shaders, I can’t use it there.

Unity documentation does not seem to hold this information - or I just can’t find it.

Thanks in advance for any help!

Most texture sampling macros Unity provides have all possible overloads as well, and if they didn’t, you can just use the sampling function directly if you know what API you are building for;

//To sample a specific mip on a tex2Darray using macros (defined in "HLSLSupport.cginc");
UNITY_SAMPLE_TEX2DARRAY_LOD (_ArrayTex, float3 (uv, index), mip);

//To sample a specific mip directly with DX10+ HLSL-style syntax;
_ArrayTex.SampleLevel (sampler_ArrayTex, float3 (uv, index), mip);