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

Platform independant shader loading, altrenative to ID3DXEffect.

Started by Sent1nel Sep 8, 2010 at 8:44 AM 3 replies 1k views
Original Post
Sent1nel
Sent1nel
I've implemented an abstracted renderer that keeps my calls to direct3d or opengl hidden away from the higher levels of my framework. Unfortunately this has left me with using the fixed function pipelines of the rendering API's. I was hoping to add support for loading in effect files but without using something like ID3DXEffect, so as the user at the application programming level can manage their use, but am unsure as to how to go about creating a shader loader?

I've looked into a number of different open source engines to see if I can get an idea as to how to go about doing this but so far only the WildMagic engine has been easiest to understand, but it looks like a lot of hog work of which I don't have the time to do for my framework.

Does anyone have any suggestions or examples of how to provide effect loading support that maintains abstraction from any particular API's?
Schrompf
Schrompf
ATI has a tool on their developer website which converts HLSL source to GLSL source code. Source code is also there, so maybe you can incooperate it into your renderer. I can't say anything about its reliability, though.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
programmer_tom
programmer_tom
Last time i checked, CG had AWFUL performance issues that were not ever being addressed, specifically the inefficiency of sending down shader constants (uniforms).
MJP
MJP
SM3.0 and lower HLSL can be compiled as Cg (and vice versa) with only a few tweaks. For instance VPOS is WPOS in Cg, which you can fix with a #define. I would suggest doing that over converting to GLSL. You can use Cg with Direct3D, but I don't really see the point when you can just directly compile it as HLSL and use the native API's.

Topic Locked

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

Sign in to reply to this topic.