Remove reflection from SwapChain sample
このコミットが含まれているのは:
1 親
9f68fc31da
コミット
2254053960
1ファイル変更
+16
-18
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.SwapChain.Backend;
|
||||
using ComputeSharp.SwapChain.Shaders;
|
||||
@@ -17,20 +16,19 @@ class Program
|
||||
/// <summary>
|
||||
/// The mapping of available samples to choose from.
|
||||
/// </summary>
|
||||
private static readonly Win32Application[] Samples = new Win32Application[]
|
||||
private static readonly (Type ShaderType, Win32Application Application)[] Samples = new (Type, Win32Application)[]
|
||||
{
|
||||
new SwapChainApplication<HelloWorld>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<FourColorGradient>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ColorfulInfinity>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<FractalTiling>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<TwoTiledTruchet>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<MengerJourney>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<Octagrams>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ProteanClouds>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<PyramidPattern>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<TriangleGridContouring>(static time => new((float)time.TotalSeconds)),
|
||||
new SwapChainApplication<ContouredLayers>(static time => new((float)time.TotalSeconds, RustyMetal))
|
||||
(typeof(HelloWorld), new SwapChainApplication<HelloWorld>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(FourColorGradient), new SwapChainApplication<FourColorGradient>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(ColorfulInfinity), new SwapChainApplication<ColorfulInfinity>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(FractalTiling), new SwapChainApplication<FractalTiling>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(TwoTiledTruchet), new SwapChainApplication<TwoTiledTruchet>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(MengerJourney), new SwapChainApplication<MengerJourney>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(Octagrams), new SwapChainApplication<Octagrams>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(ProteanClouds), new SwapChainApplication<ProteanClouds>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(ExtrudedTruchetPattern), new SwapChainApplication<ExtrudedTruchetPattern>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(PyramidPattern), new SwapChainApplication<PyramidPattern>(static time => new((float)time.TotalSeconds))),
|
||||
(typeof(TriangleGridContouring), new SwapChainApplication<TriangleGridContouring>(static time => new((float)time.TotalSeconds)))
|
||||
};
|
||||
|
||||
static void Main()
|
||||
@@ -45,7 +43,7 @@ class Program
|
||||
|
||||
for (int i = 0; i < Samples.Length; i++)
|
||||
{
|
||||
Console.WriteLine($"{i}: {Samples[i].GetType().GenericTypeArguments[0].Name}");
|
||||
Console.WriteLine($"{i}: {Samples[i].ShaderType.Name}");
|
||||
}
|
||||
|
||||
Console.WriteLine($"{Samples.Length}+: Exit (Use Escape, 'Q', or Alt + F4 to exit a sample once chosen)");
|
||||
@@ -60,9 +58,9 @@ class Program
|
||||
if (index >= 0 && index < Samples.Length)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Starting {Samples[index].GetType().GenericTypeArguments[0].Name}...");
|
||||
Console.WriteLine($"Starting {Samples[index].ShaderType.Name}...");
|
||||
|
||||
Win32ApplicationRunner.Run(Samples[index]);
|
||||
Win32ApplicationRunner.Run(Samples[index].Application);
|
||||
}
|
||||
}
|
||||
while (index >= 0 && index < Samples.Length);
|
||||
@@ -75,7 +73,7 @@ class Program
|
||||
/// <returns>A texture with the data from the image at the specified name.</returns>
|
||||
private static ReadOnlyTexture2D<Rgba32, float4> LoadTexture([CallerMemberName] string name = null!)
|
||||
{
|
||||
string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Textures", $"{name}.png");
|
||||
string filename = Path.Combine(AppContext.BaseDirectory, "Textures", $"{name}.png");
|
||||
|
||||
return GraphicsDevice.GetDefault().LoadReadOnlyTexture2D<Rgba32, float4>(filename);
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする