Sign in to follow this  
Quat

Organizing Shader Programs

Recommended Posts

I'm trying to rework how I organize my shader programs.  I precompile my shaders at build time.  I would like to loop through all the compiled shader files in some folder and create the corresponding d3d11 shader interface (e.g., ID3D11ComputeShader).  However, given just the compiled shader bytecode, I don't think I can figure out the shader type, so I don't know whether to call CreateComputeShader, CreateVertexShader, etc. 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Yeah I could do something like that.  Is that what people are doing?  I know I asked a specific question, but I was also looking for possibly better ways to manage shaders.  Do people just treat shaders like assets and lazy load them and store them in a hash table?

Share this post


Link to post
Share on other sites

Most of our shaders are packed as part of assets that are processed by our build system, so we can provide any metadata needed by the runtime. We do have some standalone shaders that are compiled via scripts. For those the runtime just loads by name and has to know what type it is. To distinguish different shader types we'll usually just add "_vs" or "_ps" suffix to the name.

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