Either way, arrayUsageMap doesn't get initialised correctly. If we don't know what's in a register, we shouldn't pass it through arrayUsageMap, but use some other way.
I won't be around next week, but after that I'll probably try to have a look at d3d8 shaders.
The declaration is converted to a d3d9 shader in parsedeclaration8. The function parsetoken8 handles the conversion of a token. In this case the following code is entered:
case D3DVSD_TOKEN_STREAMDATA: if (token & 0x10000000) { TRACE(" 0x%08lx SKIP(%lu)\n", token, ((token & D3DVSD_SKIPCOUNTMASK)
D3DVSD_SKIPCOUNTSHIFT));
} else { DWORD type = ((token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT); DWORD reg = ((token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT); ERR("reg: %d\n", reg); TRACE(" 0x%08lx REG(%s, %s)\n", token, VertexDecl8_Registers[reg], VertexDecl8_DataTypes[type]); }
Because reg is set to 6 in the declaration, this translates to specular because VertexDecl8_Registers[6] corresponds to specular. Someone in #winehackers thought that perhaps your code should only be called for FVF shaders.
Roderick