Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
} if (multisampled) {
hlsl_fixme(ctx, loc, "Load() sampling index parameter.");
struct hlsl_ir_node *sample_index = params->args[1];
if (sample_index->type != HLSL_IR_CONSTANT && ctx->profile->major_version == 4 && ctx->profile->minor_version == 0)
{
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Expected literal sample index.");
}
If you don't need to access the value while parsing, defer this error message to the code generation phase. This way you give the constant folding pass the opportunity to let the compiler accept constant expressions which are not constant values (like `1+2` instead of `3`).