How can I get fragment's screen coordinates in fragment shader?

Hello. I need to know screen coordinates of a fragment while it's being processed. From what I've found that's what WPOS semantic is for, but I get this error when I try to use it: "Cg in program 'frag': error C5119: variable/member "sPos" has semantic "WPOS" which is not visible in this profile". Is there a way to get this information?

Although I'm not sure if I've used WPOS recently, I would point out that profile may refer to the fragment profile, which is a set of rules governing your shader to make sure it can run on certain graphics cards. Using a more advanced profile may allow you to utilize WPOS (which is part of Shader Model 2.0 if I understand correctly, which is what Unity supports). For more information on shader profiles check out: