You can only be sure that your texture is not overrided by effect framework if you call d3dDevice.SetTexture() after BeginPass() call. Why you don't want to set texture via effect.SetTexture()? It wil be set only once as if you call d3dDevice.SetTexture() outside your effect render cycle.
Again, if you are using HLSL shader you should forget about fixed function part of D3D. There is no "API lights" for HLSL shader. So if you have shader calculating 2 lights you should declare array variables determining light properties by yourself and calculate all lighting by yourself too.
To simplify your task you can use uniform variables that are resolved at compile time:
Code:
PS_OUTPUT RenderScene_ifs( VS_OUTPUT In, float2 p: VPOS, uniform int Lights = 2)
{
for (int i = 0; i<Lights; i++)
{
// Do lighting
}
}
technique Lights_1
{
pass P0
{
PixelShader = compile ps_3_0 RenderScene_ifs( 1 );
}
}
technique Lights_2
{
pass P0
{
PixelShader = compile ps_3_0 RenderScene_ifs( 2 );
}
}
PS. :!: In D3D10 there is no fixed function at all.
Bookmarks