Is this a bug, or am I just missing something?

I can’t seem to figure out how to sample a texture in HLSL code via the material editor’s [FONT=Courier New]Custom node.
In the images below, I’m attempting to create a simple “pass-thru” shader, which simply returns the source colors.

W8r2RLo.png

Notice the VERY simple HLSL code here:
W8r2RLo.png

But for whatever reason, it spits out these errors:
W8QBkr1.png

Why!?
I’ve even tried several variations of the code, such as [FONT=Courier New]return tex2D( Tex, UV.xy ); but I always get the same error whenever I try to make use of the [FONT=Courier New]tex2D intrinsic function.
Am I missing something here, or is this a bug?

You wanna use something like Texture2DSample(Tex, TexSampler, UV); (Tex and UV would be the parameter inputs in the custom node).

Thanks, that seems to work, but requires Tex to be a TextureObject node.