Jump to content
  • Advertisement
Sign in to follow this  
grunt123

shader register question

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

when specifying register for shader constant, there's b# and c#. cbuffer xxx : register(b#) or ... cbuffer yyy : register(c#) what's the difference?

Share this post


Link to post
Share on other sites
Advertisement
b# registers are constant boolean registers, they can only be used for static branching. c# registers are your general purpose constant registers, they can be used for arithmetic. Check the documentation of the shader profile you're targeting to see the full list of registers available, and what they're used for.

Share this post


Link to post
Share on other sites
i know b# is for boolean register, but i'm wondering if it's also true for dx10. In sdk doc, it just mentions about register(b#) for cbuffer. and, c# for packoffset

Share this post


Link to post
Share on other sites
My another question ...

cbuffer xxx
{
float4 mmm : packoffset(c0);
}

cbuffer xxx1
{
float4 mmm1 : register(c0);
}

what's the difference between these two cbuffer declaration?

Share this post


Link to post
Share on other sites
i still cant' figure out how this shader register stuffs work ...

cbuffer cb0
{
row_major float4x4 mWorldViewProj :packoffset(c0);//: aaa : packoffset(c0); // World * View * Projection transformation
float fTime :packoffset(c5.y);//: bbb : packoffset(c4.x); // Time parameter. This keeps increasing
// Notice, that this parameter is placed in c5.y.
// If it were packed by the default packing rules,
// it would be placed in c4.x
};

cbuffer cb1
{
row_major float4x4 mWorldViewProj1 :packoffset(c0);//: aaa : packoffset(c0); // World * View * Projection transformation
float fTime1 :packoffset(c5.y);//: bbb : packoffset(c4.x) ; // Time parameter. This keeps increasing
// Notice, that this parameter is placed in c5.y.
// If it were packed by the default packing rules,
// it would be placed in c4.x
};

cbuffer cb2
{
row_major float4x4 mWorldViewProj2 :packoffset(c0);//: aaa : packoffset(c0); // World * View * Projection transformation
float fTime2 :packoffset(c5.y);//: bbb : packoffset(c4.x) ; // Time parameter. This keeps increasing
// Notice, that this parameter is placed in c5.y.
// If it were packed by the default packing rules,
// it would be placed in c4.x
};

If i declare these in one shader file, are cb0,cb1,and cb2 going to be placed in separate register? It doesn't seem that way so far. I have to specify register by using register keyword to set shader variable properly ...

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!