浏览代码

Only initialize indirect buffer to size

On iOS, we get a GPU hang/reset based upon the execution of the ClearDispatchIndirect kernel. The buffer is created using the 'NUM_FEATURE_VARIANTS' constant (currently 27), but we're dispatching a threadgroup of 64 threads, so we are presumably going out of bounds (Metal GPU errors are not terribly descriptive, but this is a common cause).
/main
sebastienlagarde 6 年前
当前提交
6421d0ae
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/cleardispatchindirect.compute

8
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/cleardispatchindirect.compute


RWBuffer<uint> g_DispatchIndirectBuffer : register( u0 ); // Indirect arguments have to be in a _buffer_, not a structured buffer
#include "LightLoop.cs.hlsl"
// On iOS, we get a GPU hang/reset based upon the execution of the ClearDispatchIndirect kernel.
// The buffer is created using the 'NUM_FEATURE_VARIANTS' constant but we're dispatching a threadgroup of 64 threads, so we are presumably going out of bounds (Metal GPU errors are not terribly descriptive, but this is a common cause).
// In DirectX out-of-bounds reads are always zero and out-of-bounds writes are are a no op.
if (dispatchThreadId >= NUM_FEATURE_VARIANTS)
return;
g_DispatchIndirectBuffer[dispatchThreadId * 3 + 0] = 0; // ThreadGroupCountX
g_DispatchIndirectBuffer[dispatchThreadId * 3 + 1] = 1; // ThreadGroupCountY
g_DispatchIndirectBuffer[dispatchThreadId * 3 + 2] = 1; // ThreadGroupCountZ
正在加载...
取消
保存