Hi There I have the following compute shader, which basically sorts a series of lights into the nearest 4 for a given 'tile' centre. This works fine in the editor and runs fine on Quest 2 in OpenGL, but something is not right when I build using Vulkan. Does anyone have any theory looking at the shader code as to why this might be? I suspect it is the branching but I have not been able to verify that and I've tried various forms of the branching and evne included the [branch] attribute but the results are the same... I don't think it ever goes into any of the IF statements. If not the branching then maybe my code, literals or other are a not quite right and this is being tolerated by OpenGL but not Vulkan? Code (CSharp): // Each #kernel tells which function to compile; you can have many kernels #pragma kernel CSMain // Create a RenderTexture with enableRandomWrite flag and set it // with cs.SetTexture RWTexture2D<float4> Lighting; struct csLight { float3 position; float intensity; float3 colour; float overbright; }; struct Important { float index; float distance; }; RWStructuredBuffer<csLight> Lights; float LightCount; [numthreads(8,8,1)] void CSMain (uint3 id : SV_DispatchThreadID) { Important imp[4]; imp[0].index = 0; imp[0].distance = 9000000.0f; imp[1].index = 0; imp[1].distance = 9000000.0f; imp[2].index = 0; imp[2].distance = 9000000.0f; imp[3].index = 0; imp[3].distance = 9000000.0f; float x = id.x; float y = id.y; float3 centre = float3(0.75f + (x * 1.5f), 0.75f, 0.75f + (y * 1.5f)); int i = 1; for (i = 1; i < LightCount; ++i) { csLight l = Lights[i]; float dist = distance(l.position, centre); if (imp[0].distance > dist) { imp[3] = imp[2]; imp[2] = imp[1]; imp[1] = imp[0]; imp[0].distance = dist; imp[0].index = i; } else { if (imp[1].distance > dist) { imp[3] = imp[2]; imp[2] = imp[1]; imp[1].distance = dist; imp[1].index = i; } else { if (imp[2].distance > dist) { imp[3] = imp[2]; imp[2].distance = dist; imp[2].index = i; } else { if (imp[3].distance > dist) { imp[3].distance = dist; imp[3].index = i; } } } } } Lighting[id.xy] = float4(imp[0].index / 255.0f, imp[1].index / 255.0f, imp[2].index / 255.0f, imp[3].index / 255.0f); } Appreciate that there may be ways to do this with structured buffers, I have yet to explore that but it's up next, hopefully once I have this solved. Thanks Ian H