I'm writing a game for the xbox360 using XNA. I would like to draw several models with a single DrawInstancedPrimitives call. Each model will use a different texture.
To do this, I would like to create a sampler array, and select which sampler to use in the array from a value passed into the shader from the instance vertex buffer.
So the shader code might look like:
void InstancingVertexShader(..., in float4x4 data : TEXCOORD0)
{
output.TextureIndex = data._m00
}
void InstancingPixelShader(...)
{
color = tex2Dlod(samplers[input.TextureIndex]);
}
Before I start trying to implement that, my question is:
Is it possible to do that, or will the HLSL complain?
Are there any cons to this method that I should know about?