diff --git a/samples/ComputeSharp.SwapChain/Program.cs b/samples/ComputeSharp.SwapChain/Program.cs
index f34c3b3c..bdf8f3d4 100644
--- a/samples/ComputeSharp.SwapChain/Program.cs
+++ b/samples/ComputeSharp.SwapChain/Program.cs
@@ -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
///
/// The mapping of available samples to choose from.
///
- private static readonly Win32Application[] Samples = new Win32Application[]
+ private static readonly (Type ShaderType, Win32Application Application)[] Samples = new (Type, Win32Application)[]
{
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds)),
- new SwapChainApplication(static time => new((float)time.TotalSeconds, RustyMetal))
+ (typeof(HelloWorld), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(FourColorGradient), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(ColorfulInfinity), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(FractalTiling), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(TwoTiledTruchet), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(MengerJourney), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(Octagrams), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(ProteanClouds), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(ExtrudedTruchetPattern), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(PyramidPattern), new SwapChainApplication(static time => new((float)time.TotalSeconds))),
+ (typeof(TriangleGridContouring), new SwapChainApplication(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
/// A texture with the data from the image at the specified name.
private static ReadOnlyTexture2D 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(filename);
}