Jump to content
  • Advertisement
Sign in to follow this  
brasslips2

DX11 [DX11] Shader Architecture

This topic is 2944 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

Basically I'm confused on how to set up a good shader architecture in dx11. I'm not sure how to data drive them either. Here's an example of some thoughts i have. Any examples would be super helpful to look at. If i'm going the complete wrong direction it would be great if i could see an example of another way to do it.



FireShader.fx // hypothetical file containing vs, ps, etc.

// hypothetical class in c++ which FireShader.fx is compiled and stored as a shader pointer into
class Shader
{
...//

ID3D11VertexShader* m_pVertexShader;
ID3D11PixelShader* m_pPixelShader;
ID3D11HullShader* m_pHullShader;
ID3D11ComputeShader* m_pComputeShader;
ID3D11GeometryShader* m_pGeometryShader;
ID3D11DomainShader* m_pDomainShader;
};


// hypothetical fireShader class to feed FireShader.fx constant input. So for //each shader file I have one of these classes associated with them. Is there //a better way to do this?
class FireShaderData
{
//..
matrix4 world;
matrix4 view;
matrix4 proj;
float intensity;
};


// xml to load into FireShaderData class above
<Shader>
//what would i put in here since world view proj are all fed through each frame //from code and would i need them to be associated with a semantic name?
</Shader>

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you are looking for some kind of effect framework. Have you already take a look to that one that is part of the SDK?

Share this post


Link to post
Share on other sites
You could take a look at my engine's implementation. The code is up on codeplex (see link below) and you are looking for the RenderEffectDX11 class. This works in conjunction with the ShaderDX11 class to manage the effect state.

Also, as Demirug mentioned, you can use the Effects framework from the DXSDK which is also available in source code.

Share this post


Link to post
Share on other sites
Yes I looked at the effects framework. However, in DX11 it is removed from the binaries. I assume this is because effects are probably slow in comparison to having each shader type seperately. Yes i found the source and yes I compiled and get it to work however, I just chose not to use it since it is not in the standard.

Share this post


Link to post
Share on other sites
It is still the standard. It’s delivered as source as people ask for it to tweak it to their special needs.

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!