Add reflection-free NativeAOT CLI sample
このコミットが含まれているのは:
1 親
0c1b9a5b77
コミット
1dfd53665a
2ファイル変更
+71
-7
検索条件に一致するファイルはありません
@@ -6,20 +6,16 @@
|
|||||||
<Platforms>x64;ARM64</Platforms>
|
<Platforms>x64;ARM64</Platforms>
|
||||||
<DefineConstants>$(DefineConstants);SAMPLE_APP</DefineConstants>
|
<DefineConstants>$(DefineConstants);SAMPLE_APP</DefineConstants>
|
||||||
<NoWarn>$(NoWarn);CA1416</NoWarn>
|
<NoWarn>$(NoWarn);CA1416</NoWarn>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- NativeAOT settings -->
|
<!-- NativeAOT settings -->
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||||
<PublishAot>true</PublishAot>
|
<PublishAot>true</PublishAot>
|
||||||
<EventSourceSupport>false</EventSourceSupport>
|
|
||||||
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
<UseSystemResourceKeys>true</UseSystemResourceKeys>
|
||||||
<InvariantGlobalization>true</InvariantGlobalization>
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
|
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
|
||||||
<DebuggerSupport>false</DebuggerSupport>
|
<IlcDisableReflection>true</IlcDisableReflection>
|
||||||
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
|
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
|
||||||
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
|
|
||||||
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -29,6 +25,12 @@
|
|||||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="..\ComputeSharp.SwapChain\Backend\SwapChainApplication{T}.cs" Link="Backend\SwapChainApplication{T}.cs" />
|
||||||
|
<Compile Include="..\ComputeSharp.SwapChain\Backend\Win32Application.cs" Link="Backend\Win32Application.cs" />
|
||||||
|
<Compile Include="..\ComputeSharp.SwapChain\Backend\Win32ApplicationRunner.cs" Link="Backend\Win32ApplicationRunner.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="..\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems" Label="Shared" />
|
<Import Project="..\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems" Label="Shared" />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -1 +1,63 @@
|
|||||||
Console.WriteLine(string.Join(", ", args));
|
using System;
|
||||||
|
using ComputeSharp.SwapChain.Backend;
|
||||||
|
using ComputeSharp.SwapChain.Shaders;
|
||||||
|
using TerraFX.Interop.Windows;
|
||||||
|
|
||||||
|
// Accepted inputs:
|
||||||
|
// - []
|
||||||
|
// - [<SHADER_NAME>]
|
||||||
|
if (args is [] or [_])
|
||||||
|
{
|
||||||
|
// If there are no args, just run the default shader
|
||||||
|
if (args is not [string shaderName])
|
||||||
|
{
|
||||||
|
shaderName = nameof(ColorfulInfinity);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the requested shader, if possible
|
||||||
|
Win32Application? application = shaderName.ToLowerInvariant() switch
|
||||||
|
{
|
||||||
|
"helloworld" => new SwapChainApplication<HelloWorld>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"colorfulinfinity" => new SwapChainApplication<ColorfulInfinity>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"fractaltiling" => new SwapChainApplication<FractalTiling>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"twotiledtruchet" => new SwapChainApplication<TwoTiledTruchet>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"mengerjourney" => new SwapChainApplication<MengerJourney>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"octagrams" => new SwapChainApplication<Octagrams>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"proteanclouds" => new SwapChainApplication<ProteanClouds>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"extrudedtruchetpattern" => new SwapChainApplication<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"pyramidpattern" => new SwapChainApplication<PyramidPattern>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"trianglegridcontouring" => new SwapChainApplication<TriangleGridContouring>(static time => new((float)time.TotalSeconds)),
|
||||||
|
"terracedhills" => new SwapChainApplication<TerracedHills>(static time => new((float)time.TotalSeconds)),
|
||||||
|
_ => null
|
||||||
|
};
|
||||||
|
|
||||||
|
// If a shader is found, run it
|
||||||
|
if (application is not null)
|
||||||
|
{
|
||||||
|
return Win32ApplicationRunner.Run(application, "ComputeSharp", "ComputeSharp");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no shader matches, check if help was requested
|
||||||
|
if (shaderName is "-h")
|
||||||
|
{
|
||||||
|
Console.WriteLine($"""
|
||||||
|
Available shaders:
|
||||||
|
|
||||||
|
- {nameof(HelloWorld)}
|
||||||
|
- {nameof(ColorfulInfinity)}
|
||||||
|
- {nameof(FractalTiling)}
|
||||||
|
- {nameof(TwoTiledTruchet)}
|
||||||
|
- {nameof(MengerJourney)}
|
||||||
|
- {nameof(Octagrams)}
|
||||||
|
- {nameof(ProteanClouds)}
|
||||||
|
- {nameof(ExtrudedTruchetPattern)}
|
||||||
|
- {nameof(PyramidPattern)}
|
||||||
|
- {nameof(TriangleGridContouring)}
|
||||||
|
- {nameof(TerracedHills)}
|
||||||
|
""");
|
||||||
|
|
||||||
|
return S.S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return E.E_INVALIDARG;
|
||||||
新しいイシューから参照
ユーザーをブロックする