Jump to content
  • Advertisement
Sign in to follow this  
RichardGe

Pipeline state: in HLSL or C++ ?

This topic is 2563 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 everyone

I'm wondering what's the difference(s) between defining pipeline states in the C++ program or in the shader program.

For example, the difference between


pass P0
{
......
SetBlendState( ....);
.....
}

And that:

..... somewhere in the C++ program ....
pd3dDevice->OMSetBlendState(....)
....


Is there any performance difference?
What's your style (and Why): All states defined in the HLS ? the minimum of states defined in the HLSL ?...

Thanks!

Share this post


Link to post
Share on other sites
Advertisement
From a strictly results point of view, it should make no difference. The same code will happen when you begin the pass or technique. But now it's data driven, which means you can keep all of the state for a shader together and in sync with that shader. You can also update it without having to dig through code, recompile, etc. On the other hand, I have to imagine that having it there makes batching very difficult, since the states aren't really exposed to your application anymore.

Share this post


Link to post
Share on other sites

From a strictly results point of view, it should make no difference. The same code will happen when you begin the pass or technique. But now it's data driven, which means you can keep all of the state for a shader together and in sync with that shader. You can also update it without having to dig through code, recompile, etc. On the other hand, I have to imagine that having it there makes batching very difficult, since the states aren't really exposed to your application anymore.


OK thanks. To conclude, they are nearly the sames. It's not a question of performance but rather of program architecture (how effects are managed).

Share this post


Link to post
Share on other sites
It's purely organizational. At the end of the day, all states have to be set from the CPU by calling D3D functions. So either you can have the effects framework call those functions by defining the states in your effect file, or you can do it yourself in your C++ code.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!