Sign in to follow this  
Hiyar

Offline shader compiling

Recommended Posts

Hiyar    130
When compling the shaders with fxc there is the option of using "Fo" for outputing object file. Is the output fxo file pure binary code of the shader?
when using "Fh" it outputs header file containing the binary code, what is the purpose of this file? For embedding the code in c++?

Share this post


Link to post
Share on other sites
Hodgman    51341
You're spot on.

[font="'Lucida Console"]/Fo[/font] outputs a binary blob, which you can load into a piece of memory, and cast to a "[font="'Lucida Console"]const DWORD *[/font]" (or whatever the shader creation functions take) to give to D3D.

[font="'Lucida Console"]/Fh[/font] outputs the same blob, but encoded as an array of bytes in a C++ header file, in case you want to compile your shaders into your project instead of loading them as data-files. In MSVC, you can set up a "pre-build step" which converts your shaders to headers so they're automatically compiled via [font="'Courier New"]FXC[/font] every time you build your project.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this