Jump to content
  • Advertisement
Sign in to follow this  
Chris Reynolds

Run-time shader compilation

This topic is 2760 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

In my particular engine, it would be really useful to be able to write and compile shaders inside the running engine from a scripting interface or something.

How could I go about achieving this?

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Um, well D3D9 has functions for compiling shaders from strings or from files, so you would just construct the shader as a string and pass it to the relevant function.

Am I missing something?

Share this post


Link to post
Share on other sites
Besides the fact that the "particular engine" doesn't tell us something about what kind of graphics API we are speaking of, yes, it is probably as simple as
0. integrating a text editor (okay, doing this need not be simple ;),
1. noticing the rendering system that a particular shader script has been updated, and
2. pushing the script to the graphics API for the purpose of compiling just between two frames.
Binding of parameters and streams is assumed to happen anyway. Some simple kind of version numbering along the script management object/structure would be sufficient for 1.

Share this post


Link to post
Share on other sites
I should have specified the API but the engine has paths for both OGL and DX, so I guess I was asking how is this generally done, rather than specifically.

If anyone wishes to go further, I'm hoping to compile CG to OGL 3.x and DX 11.

Thanks for the responses, I'll do some digging

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!