diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index 7df690a5..31024cbb 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -35,7 +35,6 @@ - diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Extensions/ImagingExtensions.cs b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Extensions/ImagingExtensions.cs deleted file mode 100644 index 2abd292a..00000000 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Extensions/ImagingExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Diagnostics.Contracts; -using System.Runtime.InteropServices; -using SixLabors.ImageSharp; -using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; - -namespace ComputeSharp.SwapChain.WinUI.Extensions -{ - /// - /// A helper class for loading images into resources. - /// - public static class ImagingExtensions - { - /// - /// Allocates a new instance with the specified texture data. - /// - /// The target instance to allocate the texture for. - /// The path of the texture to load. - /// A texture with the data from the image at the specified path. - [Pure] - public static ReadOnlyTexture2D LoadTexture(this GraphicsDevice device, string path) - { - using Image image = Image.Load(path); - - _ = image.TryGetSinglePixelSpan(out Span span); - - Span pixels = MemoryMarshal.Cast(span); - - return device.AllocateReadOnlyTexture2D(pixels, image.Width, image.Height); - } - } -} diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Shaders/Runners/ContouredLayersRunner.cs b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Shaders/Runners/ContouredLayersRunner.cs index 857a2cb4..9faa0198 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Shaders/Runners/ContouredLayersRunner.cs +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI/Shaders/Runners/ContouredLayersRunner.cs @@ -1,7 +1,6 @@ using System; using System.IO; using ComputeSharp.SwapChain.Shaders; -using ComputeSharp.SwapChain.WinUI.Extensions; using ComputeSharp.WinUI; using Windows.ApplicationModel; @@ -24,7 +23,7 @@ namespace ComputeSharp.SwapChain.WinUI.Shaders.Runners { string filename = Path.Combine(Package.Current.InstalledLocation.Path, "Images", "Textures", "RustyMetal.png"); - this.texture = Gpu.Default.LoadTexture(filename); + this.texture = Gpu.Default.LoadReadOnlyTexture2D(filename); } Gpu.Default.ForEach(texture, new ContouredLayers((float)timespan.TotalSeconds, this.texture));