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

Started by
4 comments, last by dustin10 14 years, 7 months ago
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
Advertisement
Are you using raw pixel/vertex/geometry shaders, or are you using Effects?
I believe I'm using effects, as I reference the class ID3D10Effect
looks like i want ID3D10Device::PSSetShader and ID3D10Device::VSSetShader
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();
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.

This topic is closed to new replies.

Advertisement