Parsing the sampler and render states from .fx file

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Klunk
Posts: 264
Joined: Mon Jan 10, 2011 5:21 pm

Parsing the sampler and render states from .fx file

Post by Klunk »

Autodesk in their wisdom have deprecated IGameFX and all it's accompanying classes... which meaning I need to rewrite some legacy code in an exporter (if we want to use it in newer versions of max). Now I can duplicate most of the stuff using direct3d sdk function

Code: Select all

 D3DXCreateEffectCompilerFromFile()
which gets me an LPD3DXEFFECTCOMPILER which gives me access to the parameter definitions, functions and techniques (and passes) and all the annotations that go with them.
what I'm struggling with is parsing the Sampler States and the pass Render States from the file, I could just search the file for text strings but thats made tricky by the possible use of includes and macros. Any know a fix for this ?
Klunk
Posts: 264
Joined: Mon Jan 10, 2011 5:21 pm

Re: Parsing the sampler and render states from .fx file

Post by Klunk »

I ended up parsing the file myself, i created a preprocessed version of the file with

Code: Select all

D3DXPreprocessShaderFromFile()
which handles all the includes and macro's.

you then pass this new version to

Code: Select all

D3DXCreateEffectCompiler()
which gives you the parameter names to help parsing the file.
Post Reply