There are certain compatibility issues with the opengles shader on Android. On some models, atomicAdd supports SSBO uint data, but on some models, especially Huawei models, uint data is not supported. The shader compilation error is: S0001: No matching overload for function 'atomicAdd' found, just change uint to int. Shaders are generally different on Huawei models, such as the problem of SSBO declarations. To use atomicAdd, the declaration must be of int type. Using ivec2, ivec3, ivec4 and other declarations will cause atomicAdd to be invalid, and the data inside will not be accumulated. The following declaration and use are problematic:
layout(binding = 0) buffer Counts { ivec4 counts[];//Huawei models do not support uint, uvec2, uvec3, uvec4, etc., use int type here };
atomicAdd(counts[index].x, 1);
The compilation is passed on the Huawei model, but the operation has no effect. The problem may be that multi-level references and dotfield access are not supported. The following statement can count normally:
layout(binding = 0) buffer Counts { int counts[];//Huawei models do not support uint, uvec2, uvec3, uvec4, etc., use int type here };
atomicAdd(counts[index*4], 1); //index*4 replaces the address length of ivec4