如何在 HLSL 中使用巨大的数组(错误 X4505)

How to use a huge array in HLSL (error X4505)

当我尝试编译时出现错误:

X4505: sum of temp register and indexable temp registers exceeds limit of 4096.

但是我的 shaderFX Composer 中工作。

它崩溃的原因可能是因为我使用了一个非常大的数组,因为我正在使用行进立方体。

const static int edgeTable[256] = ...
const static int triTable[256][16] = ...

我应该如何使用这些数组? (D11)

https://msdn.microsoft.com/en-us/library/windows/desktop/ff476898(v=vs.85).aspx#Shader_Constant_Buffer

Each shader stage allows up to 15 shader-constant buffers; each buffer can hold up to 4096 constants.

所以...我实际上在发布此问题后几天(几个通宵)解决了这个问题,但忘了上传解决方案。 到目前为止,我已经忘记了它到底是什么,所以我提出了我的整个解决方案:https://github.com/Ownie/MarchingCubesShader