Mutil path code ?

I am using specific nVidia and ATI extension to improve some speficial case in my renderer but I really don’t know how to design my renderer to managed well different code path according the graphics card prevent on the computer during the program execution.

So, how do you manage multi path code in your renderer architechture ?


I’m really not sure you posted in the good forum. This is more a question about design and architecture or so: that is, is completly different from math or algos.
Anyway, I’m sure a moderator will move it into the appropriate forum if he think it’s valuable :slight_smile:

I think you should, first of all, detect the graphic card and its possibilities before doing everything else: so finding what extensions it could do and what it couldn’t.
From that, during rendering time, you might use some conditionals in order to do the matching functions, ie (sorry for the old stuff, but I actually don’t use new vendor specific extensions) using NV VAR instead of CVA whenever you have a nvidia card that supports that extension. That’s the easiest way to do that. ‘if’ statements are not slow at all, so the overall will be as much fast as if without your conditionals.
You also have other possibilites, but mainly depend on the language you’ll use, and so for, don’t really belong to the aims of those forums.

Hope that’s what you was asking for.

Another possibility would be to include this in the object oriented design (assuming of course that your engine is object oriented :wink: ).

For example, make a material class that includes several “methods” for rendering that particular material, and on load time you construct the correct class that’s appropriate for your graphic cards abilities and rely on virtual functions to do the correct thing when using the material.