Jump to content
  • Advertisement
Sign in to follow this  
_Camus_

Implement HLSL on large app

This topic is 3608 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 am making my game engine, i have about 20 .cpps 30 .h and lots of models and textures, i am wonder how i should integrate the .fx files, right now i know to use bump mapping with those files, but i dont know what could be the best way to use them, a fx file per .X model? or make a large .fx that covers all effects? I know how to use the hlsl, but only with one model, thats the question. Thanks

Share this post


Link to post
Share on other sites
Advertisement
You seem to be mixing the concept of .fx files as code and as a resource.

On one hand it is just another code file, but on the other it is compiled to an ID3DXEffect and used the same as any resource.

You don't really need (nor want) to duplicate the actual code as it becomes a nightmare to maintain, but you can have multiple compiled effects derived from it. A simple implementation is to pair any number of duplicates to meshes once compiled to an ID3DXEffect but have each of those duplicates all compile from the same physical file...

A more robust solution to reduce your memory footprint and improve state management would be to have a single shared instance of an ID3DXEffect for all meshes that use it and to look into effect pools for any other similar effects.

hth
Jack

Share this post


Link to post
Share on other sites
Oh well thanks, i didn't know what i can have more than one compiled effects, because in that case, will be more than one pixel/vertex shader functions, and thats was my primary question.

Thanks i know what to do now!

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!