private EmitValHLSL EmitConstantRef(MidVal constantVal, Span span)
{
if (constantVal is MidLit)
return EmitExp(constantVal, span);
else if (constantVal is MidAttributeRef)
{
var attr = ((MidAttributeRef)constantVal);
return EmitExp(attr.Decl.Exp, span);
}
else
{
Diagnostics.Add(
Severity.Error,
new SourceRange(),
"Unacceptable constant expression in HLSL emit");
return new ErrorValHLSL();
}
}