Maybe there's a problem that the texture is assigned to the shader more often than it should, or the texture it's being copied into a shader resource for each material? I'm not sure.
as a possible "workaround", you could try to set the texture manually (in case you're exceeding the entSkin1-4 limit):
void material_set_texture(MATERIAL * mat, BMAP * bmap, char * name)
{
LPDIRECT3DTEXTURE9 tex = (LPDIRECT3DTEXTURE9)bmap->d3dtex;
if(tex == NULL)
{
printf("error in 'material_set_texture()': empty d3dtex pointer");
return;
}
if(mat == NULL)
{
printf("error in 'material_set_texture()': empty material pointer");
return;
}
if(name == NULL)
{
printf("error in 'material_set_texture()': empty name pointer");
return;
}
LPD3DXEFFECT eff = (LPD3DXEFFECT)mat->d3deffect;
if(eff != NULL)
{
eff->SetTexture(name, tex);
}
else
{
printf("error in 'material_set_texture()': empty effect");
return;
}
}
I've used it a few times, although I'm not entirely sure if the above function works since I haven't used it in a while. Note that the material's shader has to be compiled before executing this function (otherwise the d3deffect-pointer will be invalid/empty). If I remember correctly you can force the material to compile by using effect_load. Otherwise you have to wait until the material has been used.