Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Metron

Fixed function and other shaders

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

Hi, I''m running into a conceptual problem in my engine design. Perhaps you out there could share some of your ideas. As you know, DirectX offers two vertex shaders : fixed function and vertex shader programs. The fixed function shader is created using a stream declaration that describes which components are located at which position in the streams (ie. stream 0 -> position, stream 1 -> normals, stream 2 -> texture coordinates). The vertex shader programs do not use that declaration to create the shader but it uses a program code that describes the shader. How do you guys combine the 2 ? Do you have 2 functions in your engine to create the shader ? One called CreateFixedFunctionShader and one called CreateProgrammedShader ? Or do you skip entirely the fixed function pipeline ? Kind regards, Metron

Share this post


Link to post
Share on other sites
Advertisement
Short answer: You can''t combine the two. When you choose to use vertex shaders you are responsible for everything in your vertex shader code. Example, it''s not possible to use fixed function lighting while transforming your vertices in vertex shader code. You would be responsible for writing the code to perform whatever lighting operations you require. The power of vertex shaders comes at the cost of understanding ever detail of transformations and lighting. You are no longer sheltered by the black box that was fixed functions.

Now, it is possible to render parts of your scene with fixed function calls and others with vertex shaders. You just have to set the appropriate shader before sending the vertices through the pipeline.

Chris Z.

Share this post


Link to post
Share on other sites
Well, I think I explained it in a wrong way :

I do *not* want to use the fixed function pipeline in the same time than the programmable pipeline. As you stated, this is not possible. I *want* to render parts of the scene with the fixed function pipeline and other parts with the programmable pipeline.

The problem I have is an interface conceptual one :

I have an interface


class IShader
{
public:
virtual bool UseShader() = 0;
}


I would like to have a interface that wraps the two possible pipelines in the same time. But I think I cannot avoid to implement it in this way :


class IFixedPipe : public IShader
{
public:
virtual bool SetFixedPipeShaderDesc( DWORD* Declarator, int Size ) = 0;
}


and


class IProgrammablePipe : public IShader
{
public:
virtual bool SetProgrammablePipeShaderDesc( const char* pszShaderCode ) = 0;
}


Kind regards,
Metron

Share this post


Link to post
Share on other sites

  • 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!