Jump to content

  • Log In with Google      Sign In   
  • Create Account


HLSL keywords in inout


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

#1 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 08 December 2013 - 09:02 AM

For what are used in CG and HLSL keywords in and inout ? I did find the list on internet of keywords in shading languages but not explanation of their use.

Are they maybe the same as in c# like ref and out ?



Sponsor:

#2 Digitalfragment   Members   -  Reputation: 627

Like
2Likes
Like

Posted 08 December 2013 - 04:17 PM

'in' IIRC, denotes a vertex input going into a main function in CG.

'out' acts just like 'out' in C#, no value is passed into the function, but the function must write a value to it, which then gets passed back to the calling function.

'inout' acts like 'ref' in C# as you guessed, the argument gets passed both ways, allowing the function to read and modify the value.



#3 MJP   Moderators   -  Reputation: 8752

Like
1Likes
Like

Posted 08 December 2013 - 05:39 PM

The documentation for those HLSL keywords can be found here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb509606%28v=vs.85%29.aspx



#4 ryt   Members   -  Reputation: 294

Like
0Likes
Like

Posted 09 December 2013 - 10:55 AM

Considering performance I suppose that is best than to use "inout" so parameters don't get copied.


Edited by ryt, 09 December 2013 - 10:57 AM.


#5 MJP   Moderators   -  Reputation: 8752

Like
1Likes
Like

Posted 09 December 2013 - 02:21 PM

Using "in" doesn't mean that values always get physically copied from one register to another, it means that any changes to the value won't be visible to the calling code. This *may* require the compiler to allocate another register and copy the value to it if you do decide to to change the value of the parameter, but if you don't change it then the compiler is perfectly capable of detecting that and will generate code that avoids any copies.






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