I am just curious. It seems that HLSL for Direct3D does not have any built-in variables at all.
BTW, I recently tried to use gl_VertexId on an old NV card, which supports GL_ARB_shader_objects but no GL_EXT_gpu_shader4. It complains “VERTEXID” semantics binding of gl_VertexId is not supported by vp40 profile.