Sign in to follow this  
ProgrammerDX

Pixel Shader/ Vertex Shader or ID3DXEffect?

Recommended Posts

ProgrammerDX    395
Hi,

I noticed there are 2 ways to make use of shaders in DirectX?

What's the difference between using SetPixelShader/SetVertexShader and ID3DXEffect::Begin()?

Thanks

Share this post


Link to post
Share on other sites
LevyDee    376
Using the Effect interface allows you to keep your rendering code a lot more tidy, and store everything related to each other in one effect file. Using effects also allows for an interface to set/get any variables related to your shader code(constants). There is more work to using shaders if you don't use effect files. This being said, I have only ever used effect files, and never manually made my own shader handling system(needed when using the SetPixel/Vertex shader functions).

Share this post


Link to post
Share on other sites
MJP    19755
Effects can make things easier for you, due to the reason Slig already mentioned. If you do decide to use them, I would just recommend that you make sure that you understand what the effects framework is actually doing for you under the hood with regards to setting shaders, setting shader constants, setting render states, setting textures, etc. One helpful tool you can use is PIX, which will show you all of the raw D3D calls being made whenever you make a call on an ID3DXEffect.

Share this post


Link to post
Share on other sites
turch    590
Since no one's mentioned it, effects are a wrapper for shaders. So under the hood Set*Shader is still being used.

Share this post


Link to post
Share on other sites
Tom KQT    1704
And I should also mention (although it isn't fully related to the question) that effects aren't necessarily tied to shaders, you can use them also with the fixed function pipeline, you can define a Technique which sets render states, transformation matrices etc. and no shaders.

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