Convert GLSL to maya CPU shader, how to achieve same effect like texture2D()?

Heya, I have a piece of code in glsl which is:

texture2D(dispSampler, convolutionUV).r

It means I can get vec3 color by feed in a custom uv from outside, but as far as I know, maya api of CPU shader node run through a different way transfer data and compute output, so if I want to modify values of uv and do something like texture2d() method in glsl, how to achieve that?
Many thanks.

Have you considered doing it in shaderfx?

ShaderFx? I havn’t heard about it. Since I need to write a custom CPU shader node, so it will be good if no compatiblility issue happens.

ShaderFX is Maya’s node-based shader solution for hardware shaders. It maps pretty neatly onto GLSL and HLSL.

However if you want a CPU shader, do you mean you want to write a custom shader plugin (using C++ or Python)? Or do you want to crreate a shader using the Hypershade?

I mean I use C++ write a custom shader node which will be located in 2d/texture category in Hypershader, and later it could be rendered out by Arnold. But now I can’t achieve texture2D() in compute() method of the node.