I'm trying to pass unsigned int number to vertex shader, but the shader acts like it gets only the first byte of that number.
Vertex structure:
struct HMMULTITEX
{
D3DXVECTOR3 pos;
D3DXVECTOR3 norm;
D3DXVECTOR2 tex;
UINT texID;
};
Vertex declaration
D3DVERTEXELEMENT9 aVertDecl[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
{ 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },
{ 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
{ 0, 32, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 },
D3DDECL_END()
};
HLSL code:
unsigned int vTexHeight : TEXCOORD1
out float oTH[8] : TEXCOORD3
unsigned int retnum=vTexHeight % 0x10;
oTH[0]=(retnum/15.0f);
retnum=vTexHeight/0x10;
retnum=retnum % 0x10;
oTH[1]=(retnum/15.0f);
retnum=vTexHeight/0x100;
retnum=retnum % 0x10;
oTH[2]=(retnum/15.0f);
retnum=vTexHeight/0x1000;
retnum=retnum % 0x10;
oTH[3]=(retnum/15.0f);
...oTH[7]
Problem: Only oTH[0] and oTH[1] works, all other ale allways 0. It looks like vertex shader gets only the first byte of vTexHeight.
Everything above 0xff is ignored.
How can i pass unsigned int to vertex shader? Why is current vertex shader ignoring anything above the first byte?