C++ AMP: direct3d namespace and HLSL intrinsics in C++ AMP

As you know by now, as a rule most functionality in C++ AMP is in the concurrency namespace. The exception to that is the C++ AMP math library which introduces two sub namespaces (precise_math and fast_math), and thetextures and short vector types which introduce one sub namespace (graphics).

The other sub namespace is direct3d.

direct3d namespace

You’ve already seen in the concurrency::direct3d namespace four DirectX Interop APIs. Inconcurrency::graphics::direct3d there are two more for interop with textures, plus some aliased functions for short vector types.

In the concurrency::direct3d namespace there are also 20 functions that you can find in <amp.h>. These intrinsics are offered when you do HLSL programming and, we decided to offer them through C++ AMP too. You can only call them from restrict(amp) functions. The list below is for your reference and it includes links to the HLSL documentation (I also encourage you to open the header file and look at our xml comments in there for each function).

  1. int abs(int _X)
  2. float clamp(float _X, float _Min, float _Max)
  3. int clamp(int _X, int _Min, int _Max)
  4. unsigned int countbits(unsigned int _X)
  5. int firstbithigh(int _X)
  6. int firstbitlow(int _X)
  7. int imax(int _X, int _Y)
  8. int imin(int _X, int _Y)
  9. float mad(float _X, float _Y, float _Z)
  10. double mad(double _X, double _Y, double _Z)
  11. int mad(int _X, int _Y, int _Z)
  12. unsigned int mad(unsigned int _X, unsigned int _Y, unsigned int _Z)
  13. float noise(float _X)
  14. float radians(float _X)
  15. float rcp(float _X)
  16. unsigned int reversebits(unsigned int _X)
  17. float saturate(float _X)
  18. int sign(int _X)
  19. float smoothstep(float _Min, float _Max, float _X)
  20. float step(float _Y, float _X)

And that is all you will find in the direct3d namespace.

HLSL intrinsics

Beyond the aforementioned 20 functions, you may be wondering about other HLSL intrinsics and access to them through C++ AMP. Well, if we haven’t wrapped them for you, then you cannot use them. However we have done exactly that for many of them in our fast_math namespacedebug functionsmemory fences & barriers, and ouratomic operations. If there are other intrinsics that we left out, please ask us about them (e.g. in our MSDN Forum) so we can potentially suggest a workaround or so we can consider them for a future release…

http://blogs.msdn.com/b/nativeconcurrency/archive/2012/02/24/direct3d-namespace-and-hlsl-intrinsics-in-c-amp.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值