Original Post
Hi all, I'm attempting to write a pixel shader that will use a lookup texture to convert between colour spaces. I have a 256x256xARGB texture lookup table containing the results from the calculation one wishes to make, and another ARGB texture (whose dimension is dependent on other stuff and is insignificant to this discussion) that contains in it's GB components the values to lookup in the table. They're fed to the GPU in the following manner (pseudo code as I don't have it in front of me). const DWORD FVF_2TEXCOORDS = D3DFVF_XYZRHW|D3DFVF_TEX2; SetTexture(0, m_InputTexture); SetTexture(1, m_LookupTable); SetVertexShader(FVF_2TEXCOORDS); SetPixelShader(m_LookupShader); Begin(D3DPT_QUADLIST); SetVertexData2f(D3DVSDE_TEXCOORD0, 0, 0); SetVertexData2f(D3DVSDE_TEXCOORD1, 0, 0); SetVertexData4f(D3DVSDE_VERTEX, dest_x1,dest_y1,0, 1); SetVertexData2f(D3DVSDE_TEXCOORD0, width, 0); SetVertexData2f(D3DVSDE_TEXCOORD1, 256, 0); SetVertexData4f(D3DVSDE_VERTEX, dest_x2, dest_y1, 0, 1); SetVertexData2f(D3DVSDE_TEXCOORD0, width, height); SetVertexData2f(D3DVSDE_TEXCOORD1, 256, 256); SetVertexData4f(D3DVSDE_VERTEX, dest_x2,dest_y2,0, 1); SetVertexData2f(D3DVSDE_TEXCOORD0, 0, height); SetVertexData2f(D3DVSDE_TEXCOORD1, 0, 256); SetVertexData4f(D3DVSDE_VERTEX, dest_x1, dest_y2, 0, 1); End(); The pixel shader m_LookupShader is given by: ps 1.1 tex t0 texreg2rg t1, t0 mov r0, t1 Now, what should happen is the shader reads in the texture t0 and gets the green and blue coordinates to lookup in the Lookup texture, and the colour from the lookup texture is output to the screen. However, I just get a solid block of colour as my output - ie it is looking up the SAME texel in the lookup texture all the time. It could be something to do with the way my coordinates are arranged, and I have tried fiddling with it to no avail. Any comments/suggestions would be most useful. Cheers, Jonathan