Sign in to follow this  
Velik

how to tell directx to use a shader A instead of shader B

Recommended Posts

using VC++ & Dx10 & HLSL If I have 2 shader files loaded which are very similar, how do i tell Directx to render using one shader instead of another? Thanks for any assistance! -Velik

Share this post


Link to post
Share on other sites
I haven't used DX10, but I imagine this applies there as well. You don't set it with the device directly, when using Effects. Instead, when you activate your effect, the required constants are set, and the shaders are set.
int pass, passes;
pFX->Begin(&passes);
for (pass = 0; pass < passes; pass++)
{
pFX->BeginPass(pass); // At this point the shaders will be set
...Draw...
pFX->EndPass();
}
pFX->End();

Share this post


Link to post
Share on other sites
If you are using Effect framework then you want to do what Namethatnobodyelsetook has posted. If you arent using the Effect framework then you will want to use the method that you mentioned in your last post.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this