Effect file integration

Just wondering how you guys integrate DX Effect files into your engines?

I see 2 possibilities
A)For every effect there is a c++ class associated with it, with member functions for setting any effect specific paramaters (e.g. SetFrenselTerm()).

B)A generic effect class that can load any .fx file and exposes its parameter via funcs like SetFloat, SetFloat4, SetMatrix, etc.

A Pros:
-Damn easy to implement and maintain
-I can implement a fixed function class with the same interface, therefore not having to use a .fx file (if not needed)
-Potentially very fast, we dont have to look up what function we have to call, or iterate

A Cons:
-Have to implement a new class for each effect type
-Harder to integrate with something like FX composer


B Pros:
-Potentially no new code for a new effect

B Cons:
-Seems less optimal because of generality
-Overhead of having to figure out what fuction we have to call for what parameter
(e.g. I have parameters A:float, B:float2, C:float3, D:float4 in Effect1, being used for 2 meshes Mesh1 and Mesh2. Each mesh has its own specific values for A,B,C,D it wants to set before it draws. The mesh class does not know about the parameters A,B,C,D or there coresponding values at compile time, only at runtime after loading from a file giving the a list of string param name, type, and string param values that need to be set in the effect. For each frame i have to iterate through a list of GENERIC parameters (param Handle and VOID* pairs), then use the type info to determine what corresponding set function to call and cast to the proper type.)

Does anyone have any experience with this? Any suggestions?

[1744 byte] By [Ender1618] at [2008-2-28]
# 1
The books ShaderX2, ShaderX3 and ShaderX4 all have excellent sections on engine design, and most of the articles deal with various ways of integrating FX files with C/C++. But then I would say that, because I edited those sections :-) Seriously - there's some good stuff there, and the subject is a really complex one - far too much to go into on a forum!
Option A is pretty pointless by the way - you're just exchanging one form of complexity (FX files) for another (C classes). Along the way, you're losing the huge advantage of FX files, which is that they can be edited with something like Wordpad without recompiling your code. As shaders get more complex, that's a huge advantage.
TomForsyth at 2007-9-9 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: General...