fragment shader to implement paletted texture

I am trying to implement OPENGL paletted texture extension on ATI 8500 by using fragment shader. I put my 8-bit luminance texture in texture unit 0, and palette lookup table as 1D texture in unit 1. Fragment shader defined as follows:

glBindFragmentShaderATI(m_fragmentShaderID);
glBeginFragmentShaderATI();
// first phase
glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
glSampleMapATI(GL_REG_1_ATI, GL_TEXTURE1_ARB, GL_SWIZZLE_STR_ATI);
glColorFragmentOp1ATI(GL_MOV_ATI,
GL_REG_0_ATI, GL_NONE, GL_NONE,
GL_REG_0_ATI, GL_NONE, GL_NONE);
// second phase
glSampleMapATI(GL_REG_0_ATI, GL_REG_1_ATI, GL_SWIZZLE_STR_ATI);
glColorFragmentOp1ATI(GL_MOV_ATI,
GL_REG_0_ATI, GL_NONE, GL_NONE,
GL_REG_0_ATI, GL_NONE, GL_NONE);

glEndFragmentShaderATI();

Unfortunately, it didn’t work. Anything wrong? Please help! Thanks.

Remember, the call to glSampleMapATI takes the texture coordinate from REG_n_ATI (or TEXTURE_n_ARB). The only thing that was in REG_1_ATI was the value it pulled out of the texture when you sampled it. Try this instead:

glSampleMapATI(GL_REG_0_ATI, GL_TEXTURE0_ARB, GL_SWIZZLE_STR_ATI);
glColorFragmentOp1ATI(GL_MOV_ATI,
GL_REG_1_ATI, GL_NONE, GL_NONE,
GL_REG_0_ATI, GL_NONE, GL_NONE);
// second phase
glSampleMapATI(GL_REG_0_ATI, GL_REG_1_ATI, GL_SWIZZLE_STR_ATI);
glColorFragmentOp1ATI(GL_MOV_ATI,
GL_REG_0_ATI, GL_NONE, GL_NONE,
GL_REG_0_ATI, GL_NONE, GL_NONE);