From 3b6500eac40bf323cc30bc736ff94b31838a0fc0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 4 Jun 2024 17:44:15 -0700 Subject: [PATCH] Update source generator tests for 'asfloat' --- .../Test_D2DPixelShaderDescriptorGenerator.cs | 16 ++++++++-------- .../D2D1ReflectionServicesTests.cs | 2 +- .../ShaderRewriterTests.cs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs index 43ef4515..91348cec 100644 --- a/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs +++ b/tests/ComputeSharp.D2D1.Tests.SourceGenerators/Test_D2DPixelShaderDescriptorGenerator.cs @@ -186,8 +186,8 @@ public class Test_D2DPixelShaderDescriptorGenerator { int2 xy = (int2)D2DGetScenePosition().xy; float2 uv = xy / (float2)dispatchSize; - float3 col = 0.5 + (0.5 * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); - return float4(col, 1.0); + float3 col = asfloat(1056964608U) + (asfloat(1056964608U) * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); + return float4(col, asfloat(1065353216U)); } """; @@ -482,8 +482,8 @@ public class Test_D2DPixelShaderDescriptorGenerator { int2 xy = (int2)D2DGetScenePosition().xy; float2 uv = xy / (float2)dispatchSize; - float3 col = 0.5 + (0.5 * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); - return float4(col, 1.0); + float3 col = asfloat(1056964608U) + (asfloat(1056964608U) * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); + return float4(col, asfloat(1065353216U)); } """; @@ -830,8 +830,8 @@ public class Test_D2DPixelShaderDescriptorGenerator { int2 xy = (int2)D2DGetScenePosition().xy; float2 uv = xy / (float2)dispatchSize; - float3 col = 0.5 + (0.5 * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); - return float4(col, 1.0); + float3 col = asfloat(1056964608U) + (asfloat(1056964608U) * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); + return float4(col, asfloat(1065353216U)); } """; @@ -1124,8 +1124,8 @@ public class Test_D2DPixelShaderDescriptorGenerator { int2 xy = (int2)D2DGetScenePosition().xy; float2 uv = xy / (float2)dispatchSize; - float3 col = 0.5 + (0.5 * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); - return float4(col, 1.0); + float3 col = asfloat(1056964608U) + (asfloat(1056964608U) * cos(time + float3(uv, uv.x) + float3(0, 2, 4))); + return float4(col, asfloat(1065353216U)); } """; diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1ReflectionServicesTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1ReflectionServicesTests.cs index d9fd2adf..a447701d 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1ReflectionServicesTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1ReflectionServicesTests.cs @@ -42,7 +42,7 @@ public partial class D2D1ReflectionServicesTests float4 input1 = D2DGetInput(1); float4 input2 = D2DSampleInputAtPosition(2, xy + offset); float value3 = __reserved__buffer[0]; - float4 value4 = __reserved__texture.Sample(__sampler____reserved__texture, float2(0, 0.5)); + float4 value4 = __reserved__texture.Sample(__sampler____reserved__texture, float2(0, asfloat(1056964608U))); return input0 + input1 + input2 + value3 + value4; } """, shaderInfo.HlslSource); diff --git a/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs index acc94bab..36a6220f 100644 --- a/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/ShaderRewriterTests.cs @@ -82,7 +82,7 @@ public partial class ShaderRewriterTests D2D_PS_ENTRY(Execute) { bool4 mask4 = bool4(true, false, true, true); - float4 float4_1 = float4(1, 2, 3.14, 4); + float4 float4_1 = float4(1, 2, asfloat(1078523331U), 4); float4 float4_2 = float4(5, 6, 7, 8); float4 float4_r = (mask4 ? float4_1 : float4_2); bool1x3 mask1x3 = bool1x3((bool)true, (bool)true, (bool)false); @@ -93,7 +93,7 @@ public partial class ShaderRewriterTests uint2x4 uint2x4_1 = uint2x4((uint)1, (uint)2, (uint)3, (uint)4, (uint)5, (uint)6, (uint)7, (uint)8); uint2x4 uint2x4_2 = uint2x4((uint)111, (uint)222, (uint)333, (uint)444, (uint)555, (uint)666, (uint)777, (uint)888); uint2x4 uint2x4_r = (mask2x4 ? uint2x4_1 : uint2x4_2); - float2x2 f2x2_r = mul((float2x4)uint2x4_r, float4x2((float2)float4_r.xy, (float2)float4_r.zw, (float2)float2(int1x3_r._m00, int1x3_r._m01), (float2)float2(int1x3_r._m02, 1.0))); + float2x2 f2x2_r = mul((float2x4)uint2x4_r, float4x2((float2)float4_r.xy, (float2)float4_r.zw, (float2)float2(int1x3_r._m00, int1x3_r._m01), (float2)float2(int1x3_r._m02, asfloat(1065353216U)))); return float4(f2x2_r._m00, f2x2_r._m01, f2x2_r._m10, f2x2_r._m11); } """, shaderInfo.HlslSource);