In GLSL/Vulkan, it's possible to define the workgroup size using a specialization constant, using local_size_{x,y,z}_id = <specialization constant id>. This is e.g. useful for ensuring that the workgroup size matches the subgroup size. It appears to not yet be supported by slangc's GLSL compatibility mode.
// test.comp
#version 460
layout(constant_id = 0) const uint WG_SIZE = 8;
layout(local_size_x_id = 0) in;
void main()
{
}
Output:
test.comp(4): error 31216: GLSL layout qualifier is unrecognized
layout(local_size_x_id = 0) in;
^~~~~~~~~~~~~~~
(Also, is this feature available via HLSL or Slang proper? I guess this is a GLSL compatibility bug in any case, but in practice I only have like two fairly simple shaders that do this, so porting them to Slang up-front wouldn't too big of a deal.)