diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs index 0f175def..25d0d23b 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs @@ -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; } diff --git a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs index 2331d5ea..0f089902 100644 --- a/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs +++ b/src/ComputeSharp.SourceGenerators/SyntaxRewriters/ShaderSourceRewriter.cs @@ -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)); } }