What is the proper way of doing vertex texture fetching with the scriptable pipeline? Is it the same as it used to? tex2Dlod() + #pragma target 3.0 . I’m asking because I’ve noticed the other shaders use some macros TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex); + SAMPLE_TEXTURE2D() instead of the old way using tex2D()
The SRPs are trying to move away from the Direct3D 9 style HLSL (tex2D()) in favor of directly calling the Direct3D 11 style HLSL (texture.Sample()) or other API equivalents, switching between the native functions via the SAMPLE_TEXTURE2D() macros. The old style will still work for now, but it’s possible they’ll stop working in the future, so I’d suggest getting used to using the new macros.
For tex2Dlod you want SAMPLE_TEXTURE2D_LOD.
https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.core/ShaderLibrary/API/D3D11.hlsl
If you want to see a file that has the native functions in a form you’re more used to, the GLES 2.0 file still uses D3D9 HLSL (since Unity converts Direct3D HLSL to GLES GLSL behind the scenes, it’s easier to keep everything user facing in HLSL).
https://github.com/Unity-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.core/ShaderLibrary/API/GLES2.hlsl
Thanks for the info and links bgolus. Very useful!