Jump to content
  • Advertisement
Sign in to follow this  
tcige

usage of hlsl function

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

Advertisement
Earlier versions can't use it, because it wasn't added to the spec until SM5.
You have to just use "1/x" for earlier versions.

Share this post


Link to post
Share on other sites

Earlier versions can't use it, because it wasn't added to the spec until SM5.
You have to just use "1/x" for earlier versions.

 

i test it works for 'vs_1_1', and D3DXCompileShaderFromFile returns no error

Share this post


Link to post
Share on other sites

it is definitely supported in vertex shaders since vs_1_1, and (if I remember correct) in pixel shaders since ps_2_0

I think what msdn means is that it is supported in all shader types (so also in hull, domain and geometry shaders) starting from SM5.

Share this post


Link to post
Share on other sites

it is definitely supported in vertex shaders since vs_1_1, and (if I remember correct) in pixel shaders since ps_2_0

I think what msdn means is that it is supported in all shader types (so also in hull, domain and geometry shaders) starting from SM5.

 

yes, i am writing hlsl

 

'vs_1_1' is the paramter passed to D3DXCompileShaderFromFile

Share this post


Link to post
Share on other sites

Huh... the rcp intrinsic function did not used to exist, it is new (at least, it doesn't show up in my old offline documentation).

 

However, there is an rcp assembly instruction in VS 1.1 and PS 2.0, maybe the HLSL compiler was modified to accept this new intrinsic and compile it as the rcp instruction, but the MSDN docs were never updated to reflect this? It's obviously easy to support on any hardware, as long as that hardware can do division wink.pngrcp(x) just has to be an approximate form of 1/x, so the real thing is a suitable implementation.

 

Curiously, SM3 has the same rcp instruction as SM1/SM2, SM5's is specified slightly differently, and SM4's assembly language does not contain an rcp instruction at all!

Edited by Hodgman

Share this post


Link to post
Share on other sites

the rcp intrinsic function did not used to exist, it is new.

 

I haven't seen it before either. I've tried it out for vs_4_1 and ps_4_1 and it compiles.

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!