Home Technical Talk

can I change a pass based on a condition in HLSL for max viewports?

poopipe
grand marshal polycounter
Offline / Send Message
poopipe grand marshal polycounter
Basically I want to achieve the following - the only difference being that I want it to work
    {
	  VertexShader = compile vs_3_0 VS(g_LightPos);
	  CullMode = ccw;
	  ZEnable = true;
	  ZWriteEnable = true;
	 AlphaBlendEnable = true;

          if(g_enableAdditive)
          {
	     SrcBlend = One;
             DestBlend = One;
           }
          else
          {
            SrcBlend = SrcAlpha;
            DestBlend = invSrcAlpha;
           }


      
      PixelShader  = compile ps_3_0 PSConstant(g_LightCol, 1);
    }

I've already got this working using an extra technique for the additive blend mode but that's not a good solution for me as it doesn't sit well with my exporter scripts and also because I already have 4 different techniques that all require the ability to enable additive blending

I'm aware that I can't use conditional statements in Pass (it became evident when it failed to compile),

I've found this http://stackoverflow.com/questions/8717636/conditional-operator-in-hlsls-pass which appears to solve my problem but I don't know the language well enough to adapt the solution to my own code.

Could somebody point me in the right direction or at maybe explain (in idiot speak) what the solution does/means


ta very much :)
Sign In or Register to comment.