Jump to content
  • Advertisement
Sign in to follow this  
Zemedelec

ID3DXBaseEffect :: GetVertexShader method

This topic is 2904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to get the vertex/pixel shaders from a ID3DXEffect object - with no luck to date.
What does that handle parameter mean in the first place - technique / pass / shader name / ...?
Docs are completely awful.
Searches just tell me that nobody knows how exactly to call that method :)
So, any ideas?

P.S: My device is PURE and shaders are not CLONEABLE!

Share this post


Link to post
Share on other sites
Advertisement
Sorry, guess I didn't look at it closely enough.

Probably a stupid question, but what happens if you just pass the shader name as the handle?

Share this post


Link to post
Share on other sites
I tried the above myself, not surprisingly it didn't work.

After digging around for a bit, it seems like this works:

1) Create an ID3DXEffectCompiler.
2) call compiler->CompileShader(), which will give you an ID3DXBuffer containing the shader code.
3) Call device->CreateVertexShader() with the buffer from 2.

At least it seems to work in my code, and right now I can't think of anything better.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gage64
Sorry, guess I didn't look at it closely enough.

Probably a stupid question, but what happens if you just pass the shader name as the handle?


No, it doesn't work.

Share this post


Link to post
Share on other sites
Quote:
Original post by Gage64
I tried the above myself, not surprisingly it didn't work.

After digging around for a bit, it seems like this works:

1) Create an ID3DXEffectCompiler.
2) call compiler->CompileShader(), which will give you an ID3DXBuffer containing the shader code.
3) Call device->CreateVertexShader() with the buffer from 2.

At least it seems to work in my code, and right now I can't think of anything better.


This will add a lot of compilation...
Also, our shaders are cached in binary compiled state, so to get the constant tables I'll need to recompile them again - one time per shader in the effect.

For now I demoved the PURE flag of the device and just query Device::GetVertexShader after ID3DXEffect::Begin/BeginPass/CommitChanges.
Ugly, works for now, will wait if somebody say something more clever :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!