Sign in to follow this  
Migi0027

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

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

[quote name='Migi0027' timestamp='1356460291' post='5014197']I've used a single class, which works reasonably well, but makes it much harder to send different information to each shader.[/quote]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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this