I erased everything because i realized my texcoords are just fine, but my texture is always rendering grey.
I started passing in texcoords manually to the sampler, and it was giving me parts of the texture like it should... I think.
/*HLSL*/
// My list of texcoords, they're getting passed correctly i've debugged this
float2 gTexCoord[4];
struct InVertex
{
float3 position : POSITION0;
int nIndex : TEXCOORD0;
};
struct OutVertex
{
float4 position : POSITION0;
float2 texCoord : TEXCOORD0;
};
OutVertex VertexShader(InVertex input)
{
OutVertex output;
output.position = float4(input.position,1);
// Setting the texcoord for this vert.
output.texCoord = gTexCoord[input.nIndex];
return output;
}
float4 PixelShader(float2 texCoord : TEXCOORD0) : COLOR0
{
return tex2D(gSampler,texCoord);
}
// The vertex declaration
D3DVERTEXELEMENT9 decl[] =
{
{ 0,0,D3DDECLTYPE_FLOAT3,D3DDECLMETHOD_DEFAULT,D3DDECLUSAGE_POSITION,0 },
{ 0,12,D3DDECLTYPE_FLOAT1,D3DDECLMETHOD_DEFAULT,D3DDECLUSAGE_TEXCOORD,0 },
D3DDECL_END()
};
I'm going to try to test the index, to see if it's getting correct values
EDIT: SOLVED
It was indeed the vertex declaration, i was sending it a D3DDECLTYPE_FLOAT1, i changed it to a D3DDECLTYPE_SHORT2 and it worked just fine. I can see why it works, but i feel like it still should work with FLOAT1