From 1ec2dad3820cd98b8573d71d8a7fd97fcec5334d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 31 Dec 2022 15:19:14 +0100 Subject: [PATCH] Move D2D1 pixel shaders to shared project --- ComputeSharp.sln | 5 ++++ .../ColorfulInfinity.cs | 8 +++--- ...rp.SwapChain.Shaders.D2D1.Shared.projitems | 24 ++++++++++++++++++ ...Sharp.SwapChain.Shaders.D2D1.Shared.shproj | 13 ++++++++++ .../ContouredLayers.cs | 6 +++-- .../FractalTiling.cs | 8 +++--- .../HelloWorld.cs | 8 +++--- .../MengerJourney.cs | 8 +++--- .../Octagrams.cs | 8 +++--- .../ProteanClouds.cs | 12 +++++---- .../PyramidPattern.cs | 8 +++--- .../TerracedHills.cs | 6 +++-- .../TriangleGridContouring.cs | 8 +++--- .../TwoTiledTruchet.cs | 8 +++--- .../ComputeSharp.D2D1.Tests.csproj | 2 ++ .../D2D1TransformMapperTests.cs | 2 +- tests/ComputeSharp.D2D1.Tests/ShadersTests.cs | 25 ++++++++++--------- 17 files changed, 113 insertions(+), 46 deletions(-) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/ColorfulInfinity.cs (93%) create mode 100644 samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems create mode 100644 samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.shproj rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/ContouredLayers.cs (98%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/FractalTiling.cs (91%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/HelloWorld.cs (86%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/MengerJourney.cs (97%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/Octagrams.cs (96%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/ProteanClouds.cs (96%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/PyramidPattern.cs (97%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/TerracedHills.cs (97%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/TriangleGridContouring.cs (98%) rename {tests/ComputeSharp.D2D1.Tests/Shaders => samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared}/TwoTiledTruchet.cs (96%) diff --git a/ComputeSharp.sln b/ComputeSharp.sln index 0313b614..05a9aab4 100644 --- a/ComputeSharp.sln +++ b/ComputeSharp.sln @@ -130,6 +130,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B86A48A7-18B EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Uwp", "src\ComputeSharp.D2D1.Uwp\ComputeSharp.D2D1.Uwp.csproj", "{E60A3B1E-FC5D-41AC-ACF0-C2D75B6590D2}" EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SwapChain.Shaders.D2D1.Shared", "samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.shproj", "{F8BF7666-7CCF-4FE4-B055-2EBA4BCD4564}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -411,6 +413,7 @@ Global {5DE90C85-ED26-4B5A-A0D7-2FF966A210AC} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7} {669A414F-3B46-4B55-B587-061AF63C3067} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7} {B86A48A7-18BD-4946-B995-3CE26B092DDF} = {1A9C4108-F61A-4ABE-B5CF-F524521EAE2D} + {F8BF7666-7CCF-4FE4-B055-2EBA4BCD4564} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC} @@ -421,6 +424,7 @@ Global samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{0800bd51-499d-44c2-9417-fd1f7fdfe9c4}*SharedItemsImports = 13 src\ComputeSharp.UI\ComputeSharp.UI.projitems*{0c82ede1-5b8a-4df3-87da-700b29d5e265}*SharedItemsImports = 13 src\TerraFX.Interop.Windows.Dynamic\TerraFX.Interop.Windows.Dynamic.projitems*{158f984d-cd96-4062-bd02-2268946031a0}*SharedItemsImports = 13 + samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{209c95a3-fa53-431b-b688-3299ca6c29d2}*SharedItemsImports = 5 src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{314eb353-e7e3-4146-8111-685cc83ec1de}*SharedItemsImports = 5 src\TerraFX.Interop.Windows.D2D1\TerraFX.Interop.Windows.D2D1.projitems*{4d7d9ba8-a821-4b1c-9ee2-cbcf5849906e}*SharedItemsImports = 5 src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{514ff00e-bbf0-4d55-a47c-eeeb6208adce}*SharedItemsImports = 13 @@ -446,6 +450,7 @@ Global src\ComputeSharp.SourceGeneration\ComputeSharp.SourceGeneration.projitems*{eb52cb67-4162-4722-874b-44ea8da5450e}*SharedItemsImports = 5 src\TerraFX.Interop.Windows.Dynamic\TerraFX.Interop.Windows.Dynamic.projitems*{eb52cb67-4162-4722-874b-44ea8da5450e}*SharedItemsImports = 5 src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{eb52cb67-4162-4722-874b-44ea8da5450e}*SharedItemsImports = 5 + samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{f8bf7666-7ccf-4fe4-b055-2eba4bcd4564}*SharedItemsImports = 13 src\ComputeSharp.UI\ComputeSharp.UI.projitems*{fa18ba9f-76bf-4de0-8d24-02fc7657e6cb}*SharedItemsImports = 5 samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems*{fbd388a5-7855-4408-98ff-e689f509db5a}*SharedItemsImports = 4 samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{fbd388a5-7855-4408-98ff-e689f509db5a}*SharedItemsImports = 4 diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ColorfulInfinity.cs similarity index 93% rename from tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ColorfulInfinity.cs index 06a496f0..94ac59d2 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/ColorfulInfinity.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ColorfulInfinity.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A shader creating an abstract and colorful animation. @@ -15,12 +17,12 @@ internal readonly partial struct ColorfulInfinity : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; /// /// The total number of layers for the final animation. diff --git a/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems new file mode 100644 index 00000000..7c992834 --- /dev/null +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems @@ -0,0 +1,24 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + f8bf7666-7ccf-4fe4-b055-2eba4bcd4564 + + + ComputeSharp.SwapChain.Shaders.D2D1.Shared + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.shproj b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.shproj new file mode 100644 index 00000000..40434f52 --- /dev/null +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ComputeSharp.SwapChain.Shaders.D2D1.Shared.shproj @@ -0,0 +1,13 @@ + + + + f8bf7666-7ccf-4fe4-b055-2eba4bcd4564 + 14.0 + + + + + + + + diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/ContouredLayers.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ContouredLayers.cs similarity index 98% rename from tests/ComputeSharp.D2D1.Tests/Shaders/ContouredLayers.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ContouredLayers.cs index c5af9d3a..63b01ac6 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/ContouredLayers.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ContouredLayers.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// Constructing some concise contoured layers, then applying various edge and shading effects to produce some faux depth. @@ -19,7 +21,7 @@ internal readonly partial struct ContouredLayers : ID2D1PixelShader /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; /// /// The background texture to sample. diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/FractalTiling.cs similarity index 91% rename from tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/FractalTiling.cs index 191a2d7e..db30a226 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/FractalTiling.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/FractalTiling.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A shader creating a fractal tiling animation. @@ -15,12 +17,12 @@ internal readonly partial struct FractalTiling : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; /// public float4 Execute() diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/HelloWorld.cs similarity index 86% rename from tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/HelloWorld.cs index 96f0ed79..49727720 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/HelloWorld.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/HelloWorld.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A simple shader to get started with based on shadertoy new shader template. @@ -13,12 +15,12 @@ internal readonly partial struct HelloWorld : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; /// public float4 Execute() diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/MengerJourney.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/MengerJourney.cs similarity index 97% rename from tests/ComputeSharp.D2D1.Tests/Shaders/MengerJourney.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/MengerJourney.cs index b079eb1e..398e276d 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/MengerJourney.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/MengerJourney.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A shader creating a flythrough in a Menger system. @@ -14,12 +16,12 @@ internal readonly partial struct MengerJourney : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; private const int MaxSteps = 30; private const float MinimumDistance = 0.0009f; diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/Octagrams.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/Octagrams.cs similarity index 96% rename from tests/ComputeSharp.D2D1.Tests/Shaders/Octagrams.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/Octagrams.cs index e1c1bc27..aa16a6bb 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/Octagrams.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/Octagrams.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A shader creating an octagram animation, inspired by arabesque. @@ -14,12 +16,12 @@ internal readonly partial struct Octagrams : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; private static float2x2 Rotate(float a) { diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/ProteanClouds.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ProteanClouds.cs similarity index 96% rename from tests/ComputeSharp.D2D1.Tests/Shaders/ProteanClouds.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ProteanClouds.cs index 0eeabef3..762bf810 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/ProteanClouds.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/ProteanClouds.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// Fully procedural 3D animated volume with three evaluations per step (for shading). @@ -15,14 +17,14 @@ internal readonly partial struct ProteanClouds : ID2D1PixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; - private static readonly float3x3 m3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; + private static readonly float3x3 M3 = new float3x3(0.33338f, 0.56034f, -0.71817f, -0.87887f, 0.32651f, -0.15323f, 0.15162f, 0.69596f, 0.61339f) * 1.93f; private static float2x2 Rotate(in float a) { @@ -65,7 +67,7 @@ internal readonly partial struct ProteanClouds : ID2D1PixelShader z *= 0.57f; trk *= 1.4f; - p = Hlsl.Mul(p, m3); + p = Hlsl.Mul(p, M3); } d = Hlsl.Abs(d + (prm1 * 3.0f)) + (prm1 * 0.3f) - 2.5f + bsMo.Y; diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/PyramidPattern.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/PyramidPattern.cs similarity index 97% rename from tests/ComputeSharp.D2D1.Tests/Shaders/PyramidPattern.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/PyramidPattern.cs index c680c786..a272f95c 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/PyramidPattern.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/PyramidPattern.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// An offset grid of square-based pyramids whose tips have been offset according to an underlying directional noise field. @@ -15,12 +17,12 @@ internal readonly partial struct PyramidPattern : ID2D1PixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/TerracedHills.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TerracedHills.cs similarity index 97% rename from tests/ComputeSharp.D2D1.Tests/Shaders/TerracedHills.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TerracedHills.cs index 19090ae2..6669651c 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/TerracedHills.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TerracedHills.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// An abstract representation of some terraced hills. In essence, just a very basic terrain layout with a small code footprint. @@ -19,7 +21,7 @@ internal readonly partial struct TerracedHills : ID2D1PixelShader /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; // 2x2 matrix rotation. Angle vector, courtesy of Fabrice private static float2x2 Rot2(float th) diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/TriangleGridContouring.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TriangleGridContouring.cs similarity index 98% rename from tests/ComputeSharp.D2D1.Tests/Shaders/TriangleGridContouring.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TriangleGridContouring.cs index 3c38a8e3..d472f8e6 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/TriangleGridContouring.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TriangleGridContouring.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// Utilizing a 2D simplex grid to construct the isolines of a noise function. @@ -14,12 +16,12 @@ internal readonly partial struct TriangleGridContouring : ID2D1PixelShader /// /// The current time Hlsl.Since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; // Standard 2D rotation formula. private static float2x2 Rotate2x2(in float a) diff --git a/tests/ComputeSharp.D2D1.Tests/Shaders/TwoTiledTruchet.cs b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TwoTiledTruchet.cs similarity index 96% rename from tests/ComputeSharp.D2D1.Tests/Shaders/TwoTiledTruchet.cs rename to samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TwoTiledTruchet.cs index f2cf9655..2710b331 100644 --- a/tests/ComputeSharp.D2D1.Tests/Shaders/TwoTiledTruchet.cs +++ b/samples/ComputeSharp.SwapChain.Shaders.D2D1.Shared/TwoTiledTruchet.cs @@ -1,4 +1,6 @@ -namespace ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.D2D1; + +namespace ComputeSharp.SwapChain.Shaders.D2D1; /// /// A shader creating an animated two-tiles Truchet arrangement. @@ -14,12 +16,12 @@ internal readonly partial struct TwoTiledTruchet : ID2D1PixelShader /// /// The current time since the start of the application. /// - public readonly float time; + private readonly float time; /// /// The dispatch size for the current output. /// - public readonly int2 dispatchSize; + private readonly int2 dispatchSize; /// /// Calculates the Truchet distance field. diff --git a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj index 9f61c43a..a3818860 100644 --- a/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj +++ b/tests/ComputeSharp.D2D1.Tests/ComputeSharp.D2D1.Tests.csproj @@ -100,4 +100,6 @@ + + diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs index edf50028..b7ee61ac 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1TransformMapperTests.cs @@ -4,7 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Tests.Helpers; -using ComputeSharp.D2D1.Tests.Shaders; +using ComputeSharp.SwapChain.Shaders.D2D1; using ComputeSharp.Tests.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; using Win32; diff --git a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs index 2dd70375..2c05cc1c 100644 --- a/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/ShadersTests.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Runtime.InteropServices; using ComputeSharp.D2D1.Interop; using ComputeSharp.D2D1.Tests.Helpers; +using ComputeSharp.SwapChain.Shaders.D2D1; using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; @@ -17,25 +18,25 @@ public class ShadersTests [TestMethod] public void HelloWorld() { - RunTest(); + RunTest(); } [TestMethod] public void ColorfulInfinity() { - RunTest(); + RunTest(); } [TestMethod] public void FractalTiling() { - RunTest(); + RunTest(); } [TestMethod] public void MengerJourney() { - RunTest(0.000011f); + RunTest(0.000011f); } // This test and the other 3 below are skipped because they do produce valid result, @@ -46,33 +47,33 @@ public class ShadersTests [Ignore] public void TwoTiledTruchet() { - RunTest(); + RunTest(); } [TestMethod] public void Octagrams() { - RunTest(); + RunTest(); } [TestMethod] public void ProteanClouds() { - RunTest(); + RunTest(); } [TestMethod] [Ignore] public void PyramidPattern() { - RunTest(); + RunTest(); } [TestMethod] [Ignore] public void TriangleGridContouring() { - RunTest(); + RunTest(); } [TestMethod] @@ -101,15 +102,15 @@ public class ShadersTests strides: stackalloc uint[] { (uint)(texture.Width * sizeof(Rgba32)) }); } - Shaders.ContouredLayers shader = new(0f, new int2(1280, 720)); + ContouredLayers shader = new(0f, new int2(1280, 720)); - D2D1TestRunner.RunAndCompareShader(in shader, 1280, 720, $"{nameof(Shaders.ContouredLayers)}.png", nameof(Shaders.ContouredLayers), resourceTextures: (0, resourceTextureManager)); + D2D1TestRunner.RunAndCompareShader(in shader, 1280, 720, $"{nameof(ContouredLayers)}.png", nameof(ContouredLayers), resourceTextures: (0, resourceTextureManager)); } [TestMethod] public void TerracedHills() { - RunTest(0.000026f); + RunTest(0.000026f); } private static void RunTest(float threshold = 0.00001f)