Compute Shader (DX11)

Compute Shader是DX11中的一种功能,允许GPU进行通用计算。它以线程的形式执行,线程被组织成组以便同步。通过设置Shader资源和无序访问视图(UAV),可以在Compute Shader中存储计算结果。Shader Resource Views(SRV)用于读取这些结果。Dispatch函数用于指定线程组的数量,而numthreads属性定义每个线程组的维度。Compute Shader的系统值如SV_GroupID、SV_GroupThreadID和SV_DispatchThreadID帮助标识执行的线程和组。
摘要由CSDN通过智能技术生成

DX11中提供vs和ps后的又一支持直接gpu计算的Compute Shader,可以看得出物理加速不再是只属于n卡,而且gpu通用计算的道路会越发成熟,下面做下标记,下次翻译

// from DX11 SDK and gamedev
 
Compute shaders are basically the same as any other shader ... pixel shader for example. Just like the pixel shader is envoked for each pixel, the compute shader is envoked for each
"thread". A thread is a generic and independent execution entity that doesn't really require any sort of geometry.
All you have to do now is to dispatch a number of threads, and your shader will be executed for each of these threads.
In DirectX, these threads are organized into "groups". You have X * Y * Z threads in each group, and U * V * W thread groups in your application.
Threads are organized into groups for synchornization purposes.
The number of groups are specified during dispatch time, and the number of threads in each group are hardcoded in the compute shader.
The compute shaders actually don't ou

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值