Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
if (path_node->type != HLSL_IR_CONSTANT)
return false;
/* We should always have generated a cast to UINT. */
assert(path_node->data_type->class == HLSL_CLASS_SCALAR
&& path_node->data_type->base_type == HLSL_TYPE_UINT);
idx = hlsl_ir_constant(path_node)->value[0].u;
switch (type->class)
{
case HLSL_CLASS_ARRAY:
if (idx >= type->e.array.elements_count)
{
hlsl_error(ctx, &path_node->loc, VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS,
"Array index is out of bounds. %u/%u", idx, type->e.array.elements_count);
"Array index %u is higher than array size %u" is a little more descriptive, although I'm sure this is understandable in practice. I'm more concerned that this isn't quite the place for this check, though, if only because it seems like this function could get called more than once.