Skip to main content
GameDev.net gamedev.net
🔒 Locked

ID3DXBaseEffect :: GetVertexShader method

Started by Zemedelec Jul 6, 2010 at 3:30 AM 5 replies 1.3k views
Original Post
Zemedelec
Zemedelec
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!
Zemedelec
Zemedelec
Quote:
Original post by Gage64
Take a look here.


Already did. They didn't figure it out either :)
Gage64
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.
Zemedelec
Zemedelec
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.
Zemedelec
Zemedelec
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 :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.