Jump to content

  • Log In with Google      Sign In   
  • Create Account


C++ Directx 11 Shaders - One class for each or individual for each?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 MiniMigi   Crossbones+   -  Reputation: 1435

Like
0Likes
Like

Posted 25 December 2012 - 12:31 PM

Hi guys,

 

I'm working with Directx 11 shaders.

Is it more efficient to create a single class that handles the responsibilities of all shaders, or use individual classes for each independent shader?

In my own experience, I've used a single class, which works reasonably well, but makes it much harder to send different information to each shader.

Which approach is more efficient for typical DirectX 11 applications?

 

Thank You



Sponsor:

#2 NiteLordz   Members   -  Reputation: 369

Like
0Likes
Like

Posted 25 December 2012 - 07:16 PM

I have one class "shaders" and separate struts for parameters and samplers. I then have a list of both in the shaders. Upon binding, I apply each list. I found this works nicely, and it doesn't matter what kind of shader it is, vs, PS, gs, cs, etc... they all work and is east to maintain
Code makes the man

#3 Hodgman   Moderators   -  Reputation: 27690

Like
0Likes
Like

Posted 25 December 2012 - 08:18 PM

I've used a single class, which works reasonably well, but makes it much harder to send different information to each shader.

As mentioned above, every shader receives the same type of information -- buffers and textures and samplers. So you can easily have 1 shader class, but then different types to help put data into different buffers.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS