Jump to content

  • Log In with Google      Sign In   
  • Create Account


Pipeline state: in HLSL or C++ ?


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
3 replies to this topic

#1 Richard Geslot   Members   -  Reputation: 192

Like
0Likes
Like

Posted 04 December 2011 - 09:33 AM

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!
Have a great day!Richard Geslot, 3D game developermy 3D creation

Sponsor:

#2 Promit   Moderators   -  Reputation: 6108

Like
1Likes
Like

Posted 04 December 2011 - 09:43 AM

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.

#3 Richard Geslot   Members   -  Reputation: 192

Like
0Likes
Like

Posted 04 December 2011 - 01:08 PM

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).
Have a great day!Richard Geslot, 3D game developermy 3D creation

#4 MJP   Moderators   -  Reputation: 10235

Like
2Likes
Like

Posted 04 December 2011 - 01:26 PM

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.




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