Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


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 Migi0027 (肉コーダ)   Crossbones+   -  Reputation: 3830

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


FastCall22: "I want to make the distinction that my laptop is a whore-box that connects to different network"

Blog about... stuff (GDNet, WordPress): www.gamedev.net/blog/1882-the-cuboid-zone/cuboidzone.wordpress.com/


Sponsor:

#2 NiteLordz   Members   -  Reputation: 603

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: 42434

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