Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualIcebone1000

Posted 23 March 2013 - 08:07 AM

My difficult is managing the binding commands. Say I have 2 drawables with different materials, each material have different shaders with different cbuffers layout (consider different slots usage only..).

(Are you using shader permutations? If not you should consider start using them.)

Different materials simply use different permutations of the same shader. So make the cbuffers layous the same in all permutations. (Check the 2nd paragraph of Hodgman reply to that topic).

 

Sure you'll be binding some data that is not needed in some cases, but you won't have to deal with the complexity that a more dynamic system would introduce. Plus number of bound constant buffers will be the same, so go with the "lame" approach and only try to optimize if you find that it's hurting performance.
 

I meant materials with completely different shader effects, not just different permutations for the same effect.

In my understanding, you`re not meant to use the same shader for all objects. Do you do something like different queues for different shaders?


#1Icebone1000

Posted 23 March 2013 - 08:07 AM

My difficult is managing the binding commands. Say I have 2 drawables with different materials, each material have different shaders with different cbuffers layout (consider different slots usage only..).

(Are you using shader permutations? If not you should consider start using them.)

Different materials simply use different permutations of the same shader. So make the cbuffers layous the same in all permutations. (Check the 2nd paragraph of Hodgman reply to that topic).

 

Sure you'll be binding some data that is not needed in some cases, but you won't have to deal with the complexity that a more dynamic system would introduce. Plus number of bound constant buffers will be the same, so go with the "lame" approach and only try to optimize if you find that it's hurting performance.
 

I meant materials with completely different shader effects, not just different permutations for the same effect.

In my understanding, you`re not meant to use the same shader for all objects. Do you do something like different queues for different effects?


PARTNERS