Sign in to follow this  

[C++][DX9c] Advancing shader development

This topic is 2861 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm still writing HLSL in text files and repeating myself often. I want to move on, but like always, there is no "Go This Way" in the D3D documentation or Google. What is a good reference for a shader novice to advance to compiling effects to files and making reusable shader code?

Share this post


Link to post
Share on other sites
Not sure of any good references. But what I do for common code is just like you would in C/C++. I simply use #include to include common functions and variables. I also use #ifdef/#endif/#define to specify what I want to use from a header - because not all shaders will want all common functions when being compiled.

Share this post


Link to post
Share on other sites
Nice. What about compiling shaders for later use? Custom data is also a factor here, since I have seen modern games with "shader" directories with extensions I do not recognize.

Share this post


Link to post
Share on other sites
I haven't really found the need to compile any of my shaders so I can't really say on that one. I leave them in straight HLSL. The extensions might just be a way of organising different fragments but could all be the same format if viewed in text editor. If not then I'm not sure, I use the extension .fxh for my effect headers. I have seen extensions of vsh and psh for vertex and pixel shaders.

Share this post


Link to post
Share on other sites
Thank you for the useful info! Someone elsewhere told me to look into ID3DXEffectCompiler, so I'll be going into that.

Share this post


Link to post
Share on other sites
Sign in to follow this