シェーダーの個数の一覧を共有の設定に集め、同梱するシェーダーを一覧から決める

このコミットが含まれているのは:
routersys committed 2026-10-13 15:59:39 +09:00
1 親 a77dbbe13f
コミット 0c097c3eb8
4ファイル変更
+29 -9

検索条件に一致するファイルはありません

+6
ファイルの表示
@@ -0,0 +1,6 @@
<Project>
<ItemGroup>
<StepCount Include="8;12;16;20;24;28;32;36;40;44;48;52;56;60;64" />
<TapCount Include="4;8;12;16;20;24;28;32;36;40;44" />
</ItemGroup>
</Project>
+6 -5
ファイルの表示
@@ -158,11 +158,12 @@
<None Include="Physical.hlsli" />
<None Include="Srgb.hlsli" />
</ItemGroup>
<ItemGroup>
<StepCount Include="8;12;16;20;24;28;32;36;40;44;48;52;56;60;64" />
<TapCount Include="4;8;12;16;20;24;28;32;36;40;44" />
</ItemGroup>
<Target Name="AddStepCountShaders" BeforeTargets="FxCompile">
<Import Project="ShaderVariants.props" />
<Target Name="AddVariantShaders" BeforeTargets="FxCompile">
<ItemGroup>
<StaleShader Include="$(OutDir)SpectrumColorShift*.cso" />
</ItemGroup>
<Delete Files="@(StaleShader)" />
<ItemGroup>
<FxCompile Include="SpectrumColorShift.hlsl">
<ShaderType>Pixel</ShaderType>
+7 -3
ファイルの表示
@@ -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=(?<value>\d+)</PreprocessorDefinitions>\s*<ObjectFileOutput>\$\(OutDir\)(?<prefix>SpectrumColorShiftPhysicalFilter|SpectrumColorShiftPhysical|SpectrumColorShift)(?<mode>[A-Za-z]+)%\((?<list>StepCount|TapCount)\.Identity\)\.cso")]
private static partial Regex VariantPattern();
static IEnumerable<int> Listed(Regex pattern) => pattern.Match(Project).Groups["counts"].Value.Split(';').Select(count => int.Parse(count, CultureInfo.InvariantCulture));
static IEnumerable<int> 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()));
+10 -1
ファイルの表示
@@ -11,6 +11,8 @@
<ShaderDirPath>..\Release\</ShaderDirPath>
</PropertyGroup>
<Import Project="..\SpectrumColorShift.Shader\ShaderVariants.props" />
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>SpectrumColorShift.Tests</_Parameter1>
@@ -61,7 +63,14 @@
</ItemGroup>
<ItemGroup>
<Resource Include="$(ShaderDirPath)SpectrumColorShift*.cso" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="$(ShaderDirPath)SpectrumColorShiftLinearize.cso" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftLinear%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftRadial%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftRotational%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftPhysicalLinear%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftPhysicalRadial%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(StepCount->'$(ShaderDirPath)SpectrumColorShiftPhysicalRotational%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
<Resource Include="@(TapCount->'$(ShaderDirPath)SpectrumColorShiftPhysicalFilterLinear%(Identity).cso')" Link="Resources\Shader\%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>