Fixed parsing issue with HLSL float literals
このコミットが含まれているのは:
1 親
e349eb78f4
コミット
d5992f0039
2ファイル変更
+7
-3
検索条件に一致するファイルはありません
@@ -494,7 +494,7 @@ namespace ComputeSharp.BokehBlur.Processors
|
||||
Float4 v = source[i, ids.X];
|
||||
|
||||
v.XYZ = Hlsl.Clamp(v.XYZ, 0, float.MaxValue);
|
||||
v.XYZ = Hlsl.Pow(v.XYZ, 0.333333343f);
|
||||
v.XYZ = Hlsl.Pow(v.XYZ, 1 / 3f);
|
||||
|
||||
target[i, ids.X] = v;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,15 @@ namespace ComputeSharp.SourceGenerators.SyntaxRewriters
|
||||
// in HLSL, we can remove the suffix entirely. As for 64 bit values, we simply use the 'L' suffix.
|
||||
if (type.GetFullMetadataName().Equals(typeof(float).FullName))
|
||||
{
|
||||
return updatedNode.WithToken(Literal(updatedNode.Token.ValueText, 0f));
|
||||
string literal = updatedNode.Token.ValueText;
|
||||
|
||||
if (!literal.Contains('.')) literal += ".0";
|
||||
|
||||
return updatedNode.WithToken(Literal(literal, 0f));
|
||||
}
|
||||
else if (type.GetFullMetadataName().Equals(typeof(double).FullName))
|
||||
{
|
||||
return updatedNode.WithToken(Literal($"{updatedNode.Token.ValueText}L", 0d));
|
||||
return updatedNode.WithToken(Literal(updatedNode.Token.ValueText + "L", 0d));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする