diff --git a/SpectrumColorShift.Shader/ShaderVariants.props b/SpectrumColorShift.Shader/ShaderVariants.props new file mode 100644 index 0000000..e212ba0 --- /dev/null +++ b/SpectrumColorShift.Shader/ShaderVariants.props @@ -0,0 +1,6 @@ + + + + + + diff --git a/SpectrumColorShift.Shader/SpectrumColorShift.Shader.vcxproj b/SpectrumColorShift.Shader/SpectrumColorShift.Shader.vcxproj index a9c21e5..b4e29a2 100644 --- a/SpectrumColorShift.Shader/SpectrumColorShift.Shader.vcxproj +++ b/SpectrumColorShift.Shader/SpectrumColorShift.Shader.vcxproj @@ -158,11 +158,12 @@ - - - - - + + + + + + Pixel diff --git a/SpectrumColorShift.Tests/ShaderVariantsTests.cs b/SpectrumColorShift.Tests/ShaderVariantsTests.cs index e90cd40..f327a4d 100644 --- a/SpectrumColorShift.Tests/ShaderVariantsTests.cs +++ b/SpectrumColorShift.Tests/ShaderVariantsTests.cs @@ -8,7 +8,11 @@ namespace SpectrumColorShift.Tests; public sealed partial class ShaderVariantsTests { - static string Project { get; } = File.ReadAllText(Path.Combine(Path.GetDirectoryName(Here())!, "..", "SpectrumColorShift.Shader", "SpectrumColorShift.Shader.vcxproj")); + static string Project { get; } = ShaderProjectFile("SpectrumColorShift.Shader.vcxproj"); + + static string Props { get; } = ShaderProjectFile("ShaderVariants.props"); + + static string ShaderProjectFile(string name) => File.ReadAllText(Path.Combine(Path.GetDirectoryName(Here())!, "..", "SpectrumColorShift.Shader", name)); static string Here([CallerFilePath] string path = "") => path; @@ -23,7 +27,7 @@ public sealed partial class ShaderVariantsTests [GeneratedRegex(@"ShaderMode=(?\d+)\s*\$\(OutDir\)(?SpectrumColorShiftPhysicalFilter|SpectrumColorShiftPhysical|SpectrumColorShift)(?[A-Za-z]+)%\((?StepCount|TapCount)\.Identity\)\.cso")] private static partial Regex VariantPattern(); - static IEnumerable Listed(Regex pattern) => pattern.Match(Project).Groups["counts"].Value.Split(';').Select(count => int.Parse(count, CultureInfo.InvariantCulture)); + static IEnumerable Listed(Regex pattern) => pattern.Match(Props).Groups["counts"].Value.Split(';').Select(count => int.Parse(count, CultureInfo.InvariantCulture)); [Fact] public void TheStepCountsCoverTheWholeRangeInWholeQuanta() @@ -42,7 +46,7 @@ public sealed partial class ShaderVariantsTests } [Fact] - public void TheShaderProjectCompilesExactlyTheseCounts() + public void TheSharedPropsListExactlyTheseCounts() { Assert.Equal(ShaderVariants.Legacy.Counts, Listed(StepCountsPattern())); Assert.Equal(ShaderVariants.Filter.Counts, Listed(TapCountsPattern())); diff --git a/SpectrumColorShift/SpectrumColorShift.csproj b/SpectrumColorShift/SpectrumColorShift.csproj index 054f72d..1aaac70 100644 --- a/SpectrumColorShift/SpectrumColorShift.csproj +++ b/SpectrumColorShift/SpectrumColorShift.csproj @@ -11,6 +11,8 @@ ..\Release\ + + <_Parameter1>SpectrumColorShift.Tests @@ -61,7 +63,14 @@ - + + + + + + + +