【发布时间】:2018-05-03 11:44:43
【问题描述】:
我正在使用计算着色器来做一些事情。我创建了一个特定长度的输入缓冲区(一维),然后在 x 和 y 上调用调度以优化计算时间。但是我在访问索引时遇到了问题。可能是什么问题?
double size = Math.Ceiling(Math.Sqrt(input.pattern.Length));
shader.Start((int)Math.Ceiling(size/32), (int)Math.Ceiling(size / 32), 1);
在 hlsl 代码中...
[numthreads(32, 32, 1)]
void Reconstruction(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int idx = dispatchThreadID.y * size + dispatchThreadID.x;
if (idx > rayCount) { return; }
我打印了 idx,但有些重复,我不明白为什么...
【问题讨论】:
标签: c# directx-11 sharpdx compute-shader