usage of hlsl function

Started by
6 comments, last by Zaoshi Kaba 10 years, 10 months ago

rcp

msdn says 'Minimum shader model' is 5, but why vs_1_1 could use it

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.

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

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.

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

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!

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.

Does shader get created successfully? Maybe it only compiles with won't create shader.

This topic is closed to new replies.

Advertisement