Jump to content
  • Advertisement
bandages

Compiling HLSL to ASM? And inserting ASM into HLSL?

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

Hi, I'm just a self-taught amateur exploring HLSL (among other things).  I'm using MikuMikuDance to render my models and effects.  It's closed source but free, based on DX9 (so shader model 3.0).

One of my problems with this renderer is that effects are always compiled at run time.  This is handy for debugging, of course.  But when I get something finished, load times can be irritating.  I very much appreciate the intelligence of the compiler in terms of optimization, but loading times are the price to be paid for that.  Since I usually attach shaders to models that I make for public use (public domain to the extent made possible by any other sources I might use), shader load times can limit my audience.

I believe that if I could insert assembly into my .fx files, that I could bypass most of the compiler's thought processes.  In order to do that, I'd need to know how to output my HLSL to ASM (I can't write ASM and have a lot of other priorities) and how to replace my HLSL with the outputted ASM.

Maybe that's bad thinking?  Like I said, I'm just a beginner, trying to work within the limits of my knowledge and my environment.  Always happy to hear if I'm pursuing something unwise.

But otherwise, this strikes me as something that is probably possible, and that would probably help load times quite a bit.  Any help or advice?  Wasn't able to refine my Googling enough to get anything useful.

 

Share this post


Link to post
Share on other sites
Advertisement

Thanks, that might be a start.  I'll try to figure out what I can get out of fxc.

 

Just to be clear about my limits, my "development environment" is Notepad++ and I don't have any access to C code from the renderer.  I believe that the renderer will only load uncompiled HLSL files (typically with the .fx extension) rather than compiled shaders.

Share this post


Link to post
Share on other sites

You can't insert inline assembly into HLSL. The only way to avoid compiling at runtime is to pre-compile offline (or cache compiler outputs at runtime), and create your shaders from the pre-compiled binary data. If you can't modify the code that loads the shaders, then your only options are to somehow patch the executable or DLL, or create a shim DLL that intercepts the call to compile the shader and does something else.

Share this post


Link to post
Share on other sites

  • 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!