Jump to content
  • Advertisement
Sign in to follow this  
littlekid

DX10 To use the effect framework or parse shaders manually?

This topic is 3539 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 just wondering is it advisable to use the effect framework provided by directx? I was looking through some of the older post, and found that some people often create the own shaders, using pure shader by creating the vertex, pixel and geometry shaders. Then parse the constant buffers, variables etc, and then link and set them in the D3DDevice. Would it be more efficient to parse one's own shaders? I was thinking of using a constant buffer cache to optimize the usage of constant buffers.

Share this post


Link to post
Share on other sites
Advertisement
What is your measure of 'more efficient'?

Chances are you'll create yourself a lot of work in an exercise not too disimilar to reinventing the wheel. You've then obviously got all of the support, maintenance and general design tasks that the MS engineers have already done and they're not exactly stupid "n00b" coders [wink]

My thoughts are that for 99% of cases the FX framework as shipped by MS is plenty sufficient. For those 1% of cases where it is not the reasoning against the FX framework will be quite clear - e.g. complex tool chain and/or X-Platform requirements.

Unless you can somehow exploit domain-specific knowledge to optimize your shaders then I doubt you'll do much better a job than MS at micro-optimizing the library. You really need to have some optimization opportunities that they can't implement in a generic API-level way, the sorts of assertions that can only be made for specific classes of application (inc. yours!).

Does your perceived use-case either have definitive blockers stopping your use of FX10 or do you have domain-specific knowledge allowing you optimization tricks and techniques that MS don't/can't?


hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the answer. I had the idea to rewrite the parsing portion, as I remembered reading a presentation slide: D3D10 - Getting from 0 to 60Hz, which talked about using a tiered constant buffer system to manage the constant buffers.

The method create arrays of 32, 64, 128byte etc of constant buffers and when the need arises to update or use the constant buffers, it would select the best size for the data. I was thinking along the line that the constant buffers are probably manage with a cache allocation system base on LRU. Hopefully I did not misinterpret the proposed ideas.

Is this a recommended approach? I fully agree with the point that microsoft programmers would have probably already done a great job in writing the framework. However, when I was reading though those slide, I was just wondering if the method suggested viable or in anyway slightly more optimize in terms of memory/performance.

On the other hand, maybe my understanding of the tiered constant buffer method presented maybe offtrack?

Thanks alot for your reply, jollyjeffer

Share this post


Link to post
Share on other sites
It's been a while since I looked at that presentation so I'm not familiar with the details off the top of my head.

That sort of resource management is probably a case where MS know its a good optimization but can't justify it in the general case (e.g. what about low-end PC's that can't spare the memory for a cache). I would be very surprised if MS included it in a presentation without being fairly sure it had a positive effect.

In my mind the question is therefore return on investment - how long would it take to implement versus the performance gain? Have you any profiling that suggests this is a bottleneck for example? If not, is the stategic effort now worth the benefit that might only be realised a year from now...?!

The answers to that last paragraph are ultimately up to you, but for me I'd leave the door open for such an optimization (e.g. abstract around it for now) but only expend the effort implementing it when I had evidence it was needed.


hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the quick answer. After much contemplation, I think my best bet would be to stick to the FX framework for now, "be a lazy programmer :D", as you have mentioned, perhaps I should wait till I profile the code in the future and only make changes if it is really posing as a bottleneck.

Since changing the code would not affect the other portion of my code as the interaction to a shader is done behind a shader class, i guess it can be done at a later stage, if necessary, without affecting the rest of the code much.

Again thanks alot for the replies.

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!