Internal Error communicating to shader compiler process

Hello, I’m trying to write a compute shader to multithread part of my game, but when it automatically compiles, it gives me these errors:


8023994--1033655--upload_2022-4-5_18-29-17.png
Attached is the editor log.
I’m using 2020.3.32f1 on Win10.
I tried switching to the Vulkan pipeline, because DirectX has been giving my graphics card trouble recently, but the same error still persists.

Here is the shader code:

#pragma kernel ReadFileToArray //id 0

Texture2D textureToRead; //texture to extreact heightmap data from
RWBuffer<float> res; //resulting flat array
uint width = 256; //width of the image

//Read a chunk of the texture
[numthreads(8,8,1)]
void ReadFileToArray(uint3 id : SV_DispatchThreadID)
{
[unroll(256)] for (uint x = 0; x < width; x++) //columns
{
[unroll(256)] for (uint y = 0; y < width; y++) //rows
{
res[
((id.y * 8 + y) * width) + //get y position in flattened array
(id.x * 8) + x //add x position
] = textureToRead.Load(width - y, width - x); //Read texture
}
}
}

8023994–1033652–Editor.txt (85.4 KB)

The shader compiler either timed out (seems likely - it’s trying to unroll two nested loops into 256*256 = 65536 loop bodies) or it crashed.

What exactly are you trying to achieve with this kernel? It looks a bit odd - are you sure you want to access all 256x256 pixels from each invocation of this kernel?
You’re also assigning a float4 to a float when you read the texture.