diff --git a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj
index 9f8fe3d7..248e0cad 100644
--- a/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj
+++ b/samples/ComputeSharp.SwapChain/ComputeSharp.SwapChain.csproj
@@ -5,10 +5,6 @@
net5.0
-
-
-
-
image = Image.Load(filename);
-
- ReadOnlyTexture2D texture = Gpu.Default.AllocateReadOnlyTexture2D(image.Width, image.Height);
-
- image.TryGetSinglePixelSpan(out Span span);
-
- texture.CopyFrom(MemoryMarshal.Cast(span));
-
- return texture;
+ return Gpu.Default.AllocateReadOnlyTexture2D(filename);
}
}
}
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 398a1fa7..91228da0 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -4,7 +4,7 @@
-
+
diff --git a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs
index 6994ab4c..0fea45d9 100644
--- a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs
+++ b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs
@@ -12,24 +12,6 @@ namespace ComputeSharp.Tests.Extensions
///
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);
-
- Assert.IsTrue(image.TryGetSinglePixelSpan(out Span span));
-
- Span pixels = MemoryMarshal.Cast(span);
-
- return device.AllocateReadOnlyTexture2D(pixels, image.Width, image.Height);
- }
-
///
/// Creates a new instance with the specified texture data.
///
diff --git a/tests/ComputeSharp.Tests/ShadersTests.cs b/tests/ComputeSharp.Tests/ShadersTests.cs
index 075e7ffa..2a3bdf14 100644
--- a/tests/ComputeSharp.Tests/ShadersTests.cs
+++ b/tests/ComputeSharp.Tests/ShadersTests.cs
@@ -105,7 +105,7 @@ namespace ComputeSharp.Tests
{
string filename = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Shaders", "Textures", "RustyMetal.png");
- using ReadOnlyTexture2D background = device.Get().LoadTexture(filename);
+ using ReadOnlyTexture2D background = device.Get().AllocateReadOnlyTexture2D(filename);
RunAndCompareShader(
device,
diff --git a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs
index 294dd521..0c0fec91 100644
--- a/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs
+++ b/tests/ComputeSharp.Tests/Texture2DTests.Pixels.cs
@@ -76,14 +76,14 @@ namespace ComputeSharp.Tests
using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png"));
- using ReadOnlyTexture2D source = device.Get().LoadTexture(Path.Combine(imagingPath, "city.jpg"));
+ using ReadOnlyTexture2D source = device.Get().AllocateReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg"));
using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height);
device.Get().For(sampled.Width, sampled.Height, new SamplingComputeShader(source, destination));
using var processed = destination.ToImage();
- ImagingTests.TolerantImageComparer.AssertEqual(sampled, processed, 0.00000086f);
+ ImagingTests.TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f);
}
[AutoConstructor]
@@ -109,14 +109,14 @@ namespace ComputeSharp.Tests
using var sampled = Image.Load(Path.Combine(assetsPath, "CityAfter1024x1024Sampling.png"));
- using ReadOnlyTexture2D source = device.Get().LoadTexture(Path.Combine(imagingPath, "city.jpg"));
+ using ReadOnlyTexture2D source = device.Get().AllocateReadOnlyTexture2D(Path.Combine(imagingPath, "city.jpg"));
using ReadWriteTexture2D destination = device.Get().AllocateReadWriteTexture2D(sampled.Width, sampled.Height);
device.Get().ForEach(destination, new SamplingPixelShader(source));
using var processed = destination.ToImage();
- ImagingTests.TolerantImageComparer.AssertEqual(sampled, processed, 0.00000086f);
+ ImagingTests.TolerantImageComparer.AssertEqual(sampled, processed, 0.0000017f);
}
[AutoConstructor]