Browse Source

Merge branch 'main' into sn/nullable_icc

pull/3023/head
Stefan Nikolei 3 months ago
committed by GitHub
parent
commit
197dc44f15
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 22
      .github/workflows/build-and-test.yml
  2. 6
      Directory.Build.props
  3. 2
      src/ImageSharp/ImageSharp.csproj
  4. 2
      tests/Directory.Build.targets
  5. 4
      tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj
  6. 2
      tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj
  7. 10
      tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs
  8. 4
      tests/ImageSharp.Tests/Common/SimdUtilsTests.cs
  9. 4
      tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs
  10. 13
      tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs
  11. 14
      tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs
  12. 2
      tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs
  13. 2
      tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs
  14. 2
      tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs
  15. 2
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  16. 4
      tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs
  17. 14
      tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs
  18. 4
      tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs
  19. 2
      tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs
  20. 2
      tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs
  21. 4
      tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs
  22. 2
      tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs
  23. 2
      tests/ImageSharp.Tests/ImageSharp.Tests.csproj
  24. 4
      tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs
  25. 12
      tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs
  26. 2
      tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs
  27. 65
      tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs
  28. 259
      tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs

22
.github/workflows/build-and-test.yml

@ -64,32 +64,32 @@ jobs:
matrix:
options:
- os: ubuntu-latest
framework: net9.0
sdk: 9.0.x
framework: net10.0
sdk: 10.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
framework: net9.0
sdk: 9.0.x
framework: net10.0
sdk: 10.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-26
framework: net9.0
sdk: 9.0.x
framework: net10.0
sdk: 10.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: windows-latest
framework: net9.0
sdk: 9.0.x
framework: net10.0
sdk: 10.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: ubuntu-22.04-arm
framework: net9.0
sdk: 9.0.x
framework: net10.0
sdk: 10.0.x
sdk-preview: true
runtime: -x64
codecov: false
@ -187,7 +187,7 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
10.0.x
- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}

6
Directory.Build.props

@ -21,10 +21,14 @@
<!-- Import the shared global .props file -->
<Import Project="$(MSBuildThisFileDirectory)shared-infrastructure\msbuild\props\SixLabors.Global.props" />
<PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0' OR '$(TargetFramework)' == 'net9.0'">
<LangVersion>12.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0'">
<LangVersion>14.0</LangVersion>
</PropertyGroup>
<!--
Ensure all custom build configurations based upon "Release" are optimized.
This is easier than setting each project individually.

2
src/ImageSharp/ImageSharp.csproj

@ -30,7 +30,7 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>

2
tests/Directory.Build.targets

@ -25,7 +25,7 @@
See https://github.com/ImageMagick/ImageMagick/commit/27a0a9c37f18af9c8d823a3ea076f600843b553c
-->
<PackageReference Update="Magick.NET-Q16-AnyCPU" Version="13.10.0" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="8.0.0-beta.23580.1" />
<PackageReference Update="Microsoft.DotNet.RemoteExecutor" Version="10.0.0-beta.25563.105" />
<PackageReference Update="Microsoft.DotNet.XUnitExtensions" Version="8.0.0-beta.23580.1" />
<PackageReference Update="Moq" Version="4.20.72" />
<PackageReference Update="NetVips" Version="3.0.0" />

4
tests/ImageSharp.Benchmarks/ImageSharp.Benchmarks.csproj

@ -19,7 +19,7 @@
BenchmarkDotNet requires a certain structure to the code,
as such, some of these rules cannot be implemented.
-->
<!--Mark members as static-->
<!--Validate platform compatibility-->
<!--Types that own disposable fields should be disposable-->
@ -39,7 +39,7 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>

2
tests/ImageSharp.Tests.ProfilingSandbox/ImageSharp.Tests.ProfilingSandbox.csproj

@ -19,7 +19,7 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>

10
tests/ImageSharp.Tests/Common/SimdUtilsTests.Shuffle.cs

@ -292,7 +292,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]
@ -352,7 +352,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]
@ -394,7 +394,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]
@ -436,7 +436,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]
@ -478,7 +478,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
private static void TestShuffleFloat4Channel(

4
tests/ImageSharp.Tests/Common/SimdUtilsTests.cs

@ -133,7 +133,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE41);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2);
}
[Theory]
@ -171,7 +171,7 @@ public partial class SimdUtilsTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
count,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512BW | HwIntrinsics.DisableAVX2);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2);
}
[Theory]

4
tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.cs

@ -267,7 +267,7 @@ public partial class Block8x8FTests : JpegFixture
RunTest,
srcSeed,
qtSeed,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
[Fact]
@ -462,7 +462,7 @@ public partial class Block8x8FTests : JpegFixture
// 3. DisableAvx2 - call fallback code of float implementation
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableSSE);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]

13
tests/ImageSharp.Tests/Formats/Jpg/DCTTests.cs

@ -152,7 +152,7 @@ public static class DCTTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
seed,
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
[Theory]
@ -352,15 +352,14 @@ public static class DCTTests
Assert.Equal(expectedDest, actualDest, new ApproximateFloatComparer(1f));
}
// 4 paths:
// 1. AllowAll - call avx/fma implementation
// 2. DisableFMA - call avx without fma implementation
// 3. DisableAvx - call Vector4 implementation
// 4. DisableHWIntrinsic - call scalar fallback implementation
// 3 paths:
// 1. AllowAll - call avx implementation
// 2. DisableAvx - call Vector4 implementation
// 3. DisableHWIntrinsic - call scalar fallback implementation
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
seed,
HwIntrinsics.AllowAll | HwIntrinsics.DisableFMA | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
}
}
}

14
tests/ImageSharp.Tests/Formats/Jpg/JpegColorConverterTests.cs

@ -19,12 +19,8 @@ public class JpegColorConverterTests
private const int TestBufferLength = 40;
private const HwIntrinsics IntrinsicsConfig = HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2;
private static readonly ApproximateColorProfileComparer ColorSpaceComparer = new(epsilon: Precision);
private static readonly ColorProfileConverter ColorSpaceConverter = new();
public static readonly TheoryData<int> Seeds = new() { 1, 2, 3 };
public JpegColorConverterTests(ITestOutputHelper output)
@ -73,7 +69,7 @@ public class JpegColorConverterTests
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{
@ -106,7 +102,7 @@ public class JpegColorConverterTests
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{
@ -139,7 +135,7 @@ public class JpegColorConverterTests
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{
@ -172,7 +168,7 @@ public class JpegColorConverterTests
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{
@ -205,7 +201,7 @@ public class JpegColorConverterTests
{
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512F | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableHWIntrinsic);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX512 | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
static void RunTest(string arg)
{

2
tests/ImageSharp.Tests/Formats/Png/PngDecoderFilterTests.cs

@ -171,7 +171,7 @@ public class PngDecoderFilterTests
public void PaethFilter_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.AllowAll);
[Fact]
public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableSSSE3);
public void PaethFilter_WithoutSsse3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void PaethFilter_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPaethFilterTest, HwIntrinsics.DisableHWIntrinsic);

2
tests/ImageSharp.Tests/Formats/Png/PngEncoderFilterTests.cs

@ -51,7 +51,7 @@ public class PngEncoderFilterTests : MeasureFixture
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
}
[Fact]

2
tests/ImageSharp.Tests/Formats/Png/PngEncoderTests.cs

@ -618,7 +618,7 @@ public partial class PngEncoderTests
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.DisableSSSE3,
HwIntrinsics.DisableHWIntrinsic,
provider);
}

2
tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs

@ -785,7 +785,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester
// ImageMagick cannot decode this image.
image.DebugSave(provider);
image.CompareToReferenceOutput(
ImageComparer.TolerantPercentage(0.0018F), // NET 9+ Uses zlib-ng to decompress, which manages to decode 2 extra pixels.
ImageComparer.TolerantPercentage(0.0034F), // NET 10 Uses zlib-ng to decompress, which manages to decode 3 extra pixels.
provider,
appendPixelTypeToFileName: false);
}

4
tests/ImageSharp.Tests/Formats/WebP/ColorSpaceTransformUtilsTests.cs

@ -71,7 +71,7 @@ public class ColorSpaceTransformUtilsTests
public void CollectColorBlueTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.AllowAll);
[Fact]
public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableSSE41);
public void CollectColorBlueTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void CollectColorBlueTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorBlueTransformsTest, HwIntrinsics.DisableAVX2);
@ -80,7 +80,7 @@ public class ColorSpaceTransformUtilsTests
public void CollectColorRedTransforms_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.AllowAll);
[Fact]
public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableSSE41);
public void CollectColorRedTransforms_WithoutVector128_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void CollectColorRedTransforms_WithoutVector256_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCollectColorRedTransformsTest, HwIntrinsics.DisableAVX2);

14
tests/ImageSharp.Tests/Formats/WebP/LosslessUtilsTests.cs

@ -304,19 +304,19 @@ public class LosslessUtilsTests
public void Predictor11_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.AllowAll);
[Fact]
public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableSSE2);
public void Predictor11_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor11Test, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void Predictor12_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.AllowAll);
[Fact]
public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableSSE2);
public void Predictor12_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor12Test, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void Predictor13_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.AllowAll);
[Fact]
public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableSSE2);
public void Predictor13_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunPredictor13Test, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void SubtractGreen_Works() => RunSubtractGreenTest();
@ -331,7 +331,7 @@ public class LosslessUtilsTests
public void SubtractGreen_Scalar_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSSE3);
public void SubtractGreen_WithoutAvxOrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSubtractGreenTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void AddGreenToBlueAndRed_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.AllowAll);
@ -340,13 +340,13 @@ public class LosslessUtilsTests
public void AddGreenToBlueAndRed_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2);
[Fact]
public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableSSE2 | HwIntrinsics.DisableSSSE3);
public void AddGreenToBlueAndRed_WithoutAVX2OrSSSE3_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunAddGreenToBlueAndRedTest, HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void TransformColor_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.AllowAll);
[Fact]
public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableSSE2);
public void TransformColor_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void TransformColor_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorTest, HwIntrinsics.DisableAVX2);
@ -355,7 +355,7 @@ public class LosslessUtilsTests
public void TransformColorInverse_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.AllowAll);
[Fact]
public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableSSE2);
public void TransformColorInverse_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void TransformColorInverse_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunTransformColorInverseTest, HwIntrinsics.DisableAVX2);

4
tests/ImageSharp.Tests/Formats/WebP/PredictorEncoderTests.cs

@ -24,7 +24,7 @@ public class PredictorEncoderTests
[Fact]
public void ColorSpaceTransform_WithPeakImage_WithoutSSE41_Works()
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableSSE41);
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithPeakImage_ProducesExpectedData, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void ColorSpaceTransform_WithBikeImage_WithHardwareIntrinsics_Works()
@ -32,7 +32,7 @@ public class PredictorEncoderTests
[Fact]
public void ColorSpaceTransform_WithBikeImage_WithoutSSE41_Works()
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableSSE41);
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(ColorSpaceTransform_WithBikeImage_ProducesExpectedData, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void ColorSpaceTransform_WithBikeImage_WithoutAvx2_Works()

2
tests/ImageSharp.Tests/Formats/WebP/QuantEncTests.cs

@ -45,7 +45,7 @@ public class QuantEncTests
public void QuantizeBlock_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.AllowAll);
[Fact]
public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableSSE2);
public void QuantizeBlock_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void QuantizeBlock_WithoutAVX2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunQuantizeBlockTest, HwIntrinsics.DisableAVX2);

2
tests/ImageSharp.Tests/Formats/WebP/Vp8ResidualTests.cs

@ -252,5 +252,5 @@ public class Vp8ResidualTests
public void SetCoeffsTest_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.AllowAll);
[Fact]
public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableSSE2);
public void SetCoeffsTest_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunSetCoeffsTest, HwIntrinsics.DisableHWIntrinsic);
}

4
tests/ImageSharp.Tests/Formats/WebP/WebpCommonUtilsTests.cs

@ -23,7 +23,7 @@ public class WebpCommonUtilsTests
[Fact]
public void CheckNonOpaque_WithOpaquePixels_WithoutSse2_Works()
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableSSE2);
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithOpaquePixelsTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void CheckNonOpaque_WithOpaquePixels_WithoutAvx2_Works()
@ -35,7 +35,7 @@ public class WebpCommonUtilsTests
[Fact]
public void CheckNonOpaque_WithNoneOpaquePixels_WithoutSse2_Works()
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableSSE2);
=> FeatureTestRunner.RunWithHwIntrinsicsFeature(RunCheckNoneOpaqueWithNoneOpaquePixelsTest, HwIntrinsics.DisableHWIntrinsic);
[Fact]
public void CheckNonOpaque_WithNoneOpaquePixels_WithoutAvx2_Works()

2
tests/ImageSharp.Tests/Formats/WebP/YuvConversionTests.cs

@ -32,7 +32,7 @@ public class YuvConversionTests
public void UpSampleYuvToRgb_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.AllowAll);
[Fact]
public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableSSE2);
public void UpSampleYuvToRgb_WithoutSSE2_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunUpSampleYuvToRgbTest, HwIntrinsics.DisableHWIntrinsic);
[Theory]
[WithFile(TestImages.Webp.Yuv, PixelTypes.Rgba32)]

2
tests/ImageSharp.Tests/ImageSharp.Tests.csproj

@ -12,7 +12,7 @@
<Choose>
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>

4
tests/ImageSharp.Tests/Metadata/Profiles/ICC/DataWriter/IccDataWriterPrimitivesTests.cs

@ -42,7 +42,7 @@ public class IccDataWriterPrimitivesTests
byte[] output = writer.GetData();
Assert.Equal(0, count);
Assert.Equal([], output);
Assert.Equal(Array.Empty<byte>(), output);
}
[Fact]
@ -62,7 +62,7 @@ public class IccDataWriterPrimitivesTests
byte[] output = writer.GetData();
Assert.Equal(0, count);
Assert.Equal([], output);
Assert.Equal(Array.Empty<byte>(), output);
}
[Theory]

12
tests/ImageSharp.Tests/Processing/Processors/Convolution/BokehBlurTest.cs

@ -50,7 +50,7 @@ public class BokehBlurTest
List<Complex64[]> components = new();
foreach (Match match in Regex.Matches(Components10x2, @"\[\[(.*?)\]\]", RegexOptions.Singleline))
{
string[] values = match.Groups[1].Value.Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
string[] values = match.Groups[1].Value.Trim().Split([' '], StringSplitOptions.RemoveEmptyEntries);
Complex64[] component = values.Select(
value =>
{
@ -114,12 +114,12 @@ public class BokehBlurTest
};
public static readonly string[] TestFiles =
{
TestImages.Png.CalliphoraPartial,
[
TestImages.Png.CalliphoraPartial,
TestImages.Png.Bike,
TestImages.Png.BikeGrayscale,
TestImages.Png.Cross,
};
TestImages.Png.Cross
];
[Theory]
[WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32)]
@ -148,7 +148,7 @@ public class BokehBlurTest
[Theory]
[WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.AllowAll)]
[WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableSSE41)]
[WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32, HwIntrinsics.DisableHWIntrinsic)]
public void BokehBlurFilterProcessor_Bounded(TestImageProvider<Rgba32> provider, BokehBlurInfo value, HwIntrinsics intrinsicsFilter)
{
static void RunTest(string arg1, string arg2)

2
tests/ImageSharp.Tests/Processing/Transforms/ResizeTests.cs

@ -102,6 +102,6 @@ public class ResizeTests : BaseImageOperationsExtensionTest
FeatureTestRunner.RunWithHwIntrinsicsFeature(
RunTest,
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2 | HwIntrinsics.DisableFMA);
HwIntrinsics.AllowAll | HwIntrinsics.DisableAVX2);
}
}

65
tests/ImageSharp.Tests/TestUtilities/FeatureTesting/FeatureTestRunner.cs

@ -436,37 +436,38 @@ public enum HwIntrinsics : long
// Use flags so we can pass multiple values without using params.
// Don't base on 0 or use inverse for All as that doesn't translate to string values.
DisableHWIntrinsic = 1L << 0,
DisableSSE = 1L << 1,
DisableSSE2 = 1L << 2,
DisableAES = 1L << 3,
DisablePCLMULQDQ = 1L << 4,
DisableSSE3 = 1L << 5,
DisableSSSE3 = 1L << 6,
DisableSSE41 = 1L << 7,
DisableSSE42 = 1L << 8,
DisablePOPCNT = 1L << 9,
DisableAVX = 1L << 10,
DisableFMA = 1L << 11,
DisableAVX2 = 1L << 12,
DisableSSE42 = 1L << 1,
DisableAVX = 1L << 2,
DisableAVX2 = 1L << 3,
DisableAVX512 = 1L << 4,
DisableAVX512v2 = 1L << 5,
DisableAVX512v3 = 1L << 6,
DisableAVX10v1 = 1L << 7,
DisableAVX10v2 = 1L << 8,
DisableAPX = 1L << 9,
DisableAES = 1L << 10,
DisableAVX512VP2INTERSECT = 1L << 11,
DisableAVXIFMA = 1L << 12,
DisableAVXVNNI = 1L << 13,
DisableAVX512BW = 1L << 14,
DisableAVX512BW_VL = 1L << 15,
DisableAVX512CD = 1L << 16,
DisableAVX512CD_VL = 1L << 17,
DisableAVX512DQ = 1L << 18,
DisableAVX512DQ_VL = 1L << 19,
DisableAVX512F = 1L << 20,
DisableAVX512F_VL = 1L << 21,
DisableAVX512VBMI = 1L << 22,
DisableAVX512VBMI_VL = 1L << 23,
DisableBMI1 = 1L << 24,
DisableBMI2 = 1L << 25,
DisableLZCNT = 1L << 26,
DisableArm64AdvSimd = 1L << 27,
DisableArm64Crc32 = 1L << 28,
DisableArm64Dp = 1L << 29,
DisableArm64Aes = 1L << 30,
DisableArm64Sha1 = 1L << 31,
DisableArm64Sha256 = 1L << 32,
AllowAll = 1L << 33
DisableAVXVNNIINT = 1L << 14,
DisableGFNI = 1L << 15,
DisableSHA = 1L << 16,
DisableVAES = 1L << 17,
DisableWAITPKG = 1L << 18,
DisableX86Serialize = 1 << 19,
// Arm64
DisableArm64Aes = 1L << 20,
DisableArm64Atomics = 1L << 21,
DisableArm64Crc32 = 1L << 22,
DisableArm64Dczva = 1L << 23,
DisableArm64Dp = 1L << 24,
DisableArm64Rdm = 1L << 25,
DisableArm64Sha1 = 1L << 26,
DisableArm64Sha256 = 1L << 27,
DisableArm64Sve = 1L << 28,
DisableArm64Sve2 = 1L << 29,
// RISC-V64
DisableRiscV64Zba = 1L << 30,
DisableRiscV64Zbb = 1L << 31,
AllowAll = 1L << 32,
}

259
tests/ImageSharp.Tests/TestUtilities/Tests/FeatureTestRunnerTests.cs

@ -47,7 +47,7 @@ public class FeatureTestRunnerTests
}
FeatureTestRunner.RunWithHwIntrinsicsFeature(
() => Assert.True(Vector.IsHardwareAccelerated),
() => Assert.True(Vector.IsHardwareAccelerated, "Vector hardware acceleration should be enabled when AllowAll is specified."),
HwIntrinsics.AllowAll);
}
@ -56,21 +56,21 @@ public class FeatureTestRunnerTests
{
static void AssertDisabled()
{
Assert.False(Sse.IsSupported);
Assert.False(Sse2.IsSupported);
Assert.False(Aes.IsSupported);
Assert.False(Pclmulqdq.IsSupported);
Assert.False(Sse3.IsSupported);
Assert.False(Ssse3.IsSupported);
Assert.False(Sse41.IsSupported);
Assert.False(Sse42.IsSupported);
Assert.False(Popcnt.IsSupported);
Assert.False(Avx.IsSupported);
Assert.False(Fma.IsSupported);
Assert.False(Avx2.IsSupported);
Assert.False(Bmi1.IsSupported);
Assert.False(Bmi2.IsSupported);
Assert.False(Lzcnt.IsSupported);
Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set.");
Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set.");
Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set.");
}
FeatureTestRunner.RunWithHwIntrinsicsFeature(
@ -88,90 +88,70 @@ public class FeatureTestRunnerTests
switch (Enum.Parse<HwIntrinsics>(intrinsic))
{
case HwIntrinsics.DisableHWIntrinsic:
Assert.False(Sse.IsSupported);
Assert.False(Sse2.IsSupported);
Assert.False(Aes.IsSupported);
Assert.False(Pclmulqdq.IsSupported);
Assert.False(Sse3.IsSupported);
Assert.False(Ssse3.IsSupported);
Assert.False(Sse41.IsSupported);
Assert.False(Sse42.IsSupported);
Assert.False(Popcnt.IsSupported);
Assert.False(Avx.IsSupported);
Assert.False(Fma.IsSupported);
Assert.False(Avx2.IsSupported);
Assert.False(Bmi1.IsSupported);
Assert.False(Bmi2.IsSupported);
Assert.False(Lzcnt.IsSupported);
Assert.False(AdvSimd.IsSupported);
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported);
Assert.False(Crc32.IsSupported);
Assert.False(Dp.IsSupported);
Assert.False(Sha1.IsSupported);
Assert.False(Sha256.IsSupported);
break;
case HwIntrinsics.DisableSSE:
Assert.False(Sse.IsSupported);
break;
case HwIntrinsics.DisableSSE2:
Assert.False(Sse2.IsSupported);
Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set.");
Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set.");
Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set.");
Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set.");
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set.");
Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set.");
break;
case HwIntrinsics.DisableAES:
Assert.False(Aes.IsSupported);
break;
case HwIntrinsics.DisablePCLMULQDQ:
Assert.False(Pclmulqdq.IsSupported);
break;
case HwIntrinsics.DisableSSE3:
Assert.False(Sse3.IsSupported);
break;
case HwIntrinsics.DisableSSSE3:
Assert.False(Ssse3.IsSupported);
break;
case HwIntrinsics.DisableSSE41:
Assert.False(Sse41.IsSupported);
Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set.");
#if NET10_0_OR_GREATER
Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable).");
#endif
break;
case HwIntrinsics.DisableSSE42:
Assert.False(Sse42.IsSupported);
break;
case HwIntrinsics.DisablePOPCNT:
Assert.False(Popcnt.IsSupported);
#if NET10_0_OR_GREATER
Assert.False(Sse3.IsSupported, "Sse3 should be disabled.");
Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled.");
Assert.False(Sse41.IsSupported, "Sse41 should be disabled.");
Assert.False(Popcnt.IsSupported, "Popcnt should be disabled.");
#else
Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set.");
#endif
break;
case HwIntrinsics.DisableAVX:
Assert.False(Avx.IsSupported);
break;
case HwIntrinsics.DisableFMA:
Assert.False(Fma.IsSupported);
Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set.");
break;
case HwIntrinsics.DisableAVX2:
Assert.False(Avx2.IsSupported);
break;
case HwIntrinsics.DisableBMI1:
Assert.False(Bmi1.IsSupported);
break;
case HwIntrinsics.DisableBMI2:
Assert.False(Bmi2.IsSupported);
break;
case HwIntrinsics.DisableLZCNT:
Assert.False(Lzcnt.IsSupported);
break;
case HwIntrinsics.DisableArm64AdvSimd:
Assert.False(AdvSimd.IsSupported);
Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set.");
#if NET10_0_OR_GREATER
Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable).");
#endif
break;
case HwIntrinsics.DisableArm64Aes:
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported);
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set.");
break;
case HwIntrinsics.DisableArm64Crc32:
Assert.False(Crc32.IsSupported);
Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set.");
break;
case HwIntrinsics.DisableArm64Dp:
Assert.False(Dp.IsSupported);
Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set.");
break;
case HwIntrinsics.DisableArm64Sha1:
Assert.False(Sha1.IsSupported);
Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set.");
break;
case HwIntrinsics.DisableArm64Sha256:
Assert.False(Sha256.IsSupported);
Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set.");
break;
}
}
@ -189,12 +169,12 @@ public class FeatureTestRunnerTests
{
Assert.NotNull(serializable);
Assert.NotNull(FeatureTestRunner.DeserializeForXunit<FakeSerializable>(serializable));
Assert.False(Sse.IsSupported);
Assert.False(Sse42.IsSupported, "SSE42 should be disabled when DisableSSE42 is set (sanity check using serializable param overload).");
}
FeatureTestRunner.RunWithHwIntrinsicsFeature(
AssertHwIntrinsicsFeatureDisabled,
HwIntrinsics.DisableSSE,
HwIntrinsics.DisableSSE42,
new FakeSerializable());
}
@ -209,90 +189,69 @@ public class FeatureTestRunnerTests
switch (Enum.Parse<HwIntrinsics>(intrinsic))
{
case HwIntrinsics.DisableHWIntrinsic:
Assert.False(Sse.IsSupported);
Assert.False(Sse2.IsSupported);
Assert.False(Aes.IsSupported);
Assert.False(Pclmulqdq.IsSupported);
Assert.False(Sse3.IsSupported);
Assert.False(Ssse3.IsSupported);
Assert.False(Sse41.IsSupported);
Assert.False(Sse42.IsSupported);
Assert.False(Popcnt.IsSupported);
Assert.False(Avx.IsSupported);
Assert.False(Fma.IsSupported);
Assert.False(Avx2.IsSupported);
Assert.False(Bmi1.IsSupported);
Assert.False(Bmi2.IsSupported);
Assert.False(Lzcnt.IsSupported);
Assert.False(AdvSimd.IsSupported);
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported);
Assert.False(Crc32.IsSupported);
Assert.False(Dp.IsSupported);
Assert.False(Sha1.IsSupported);
Assert.False(Sha256.IsSupported);
break;
case HwIntrinsics.DisableSSE:
Assert.False(Sse.IsSupported);
break;
case HwIntrinsics.DisableSSE2:
Assert.False(Sse2.IsSupported);
Assert.False(Sse.IsSupported, "SSE should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse2.IsSupported, "SSE2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableHWIntrinsic is set.");
Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse3.IsSupported, "SSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Ssse3.IsSupported, "SSSE3 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse41.IsSupported, "SSE4.1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sse42.IsSupported, "SSE4.2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Popcnt.IsSupported, "POPCNT should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx.IsSupported, "AVX should be disabled when DisableHWIntrinsic is set.");
Assert.False(Fma.IsSupported, "FMA should be disabled when DisableHWIntrinsic is set.");
Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableHWIntrinsic is set.");
Assert.False(AdvSimd.IsSupported, "Arm64 AdvSimd should be disabled when DisableHWIntrinsic is set.");
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableHWIntrinsic is set.");
Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableHWIntrinsic is set.");
Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableHWIntrinsic is set.");
break;
case HwIntrinsics.DisableAES:
Assert.False(Aes.IsSupported);
break;
case HwIntrinsics.DisablePCLMULQDQ:
Assert.False(Pclmulqdq.IsSupported);
break;
case HwIntrinsics.DisableSSE3:
Assert.False(Sse3.IsSupported);
break;
case HwIntrinsics.DisableSSSE3:
Assert.False(Ssse3.IsSupported);
break;
case HwIntrinsics.DisableSSE41:
Assert.False(Sse41.IsSupported);
Assert.False(Aes.IsSupported, "AES (x86) should be disabled when DisableAES is set.");
#if NET10_0_OR_GREATER
Assert.False(Pclmulqdq.IsSupported, "PCLMULQDQ should be disabled when DisableAES is set (paired disable).");
#endif
break;
case HwIntrinsics.DisableSSE42:
Assert.False(Sse42.IsSupported);
break;
case HwIntrinsics.DisablePOPCNT:
Assert.False(Popcnt.IsSupported);
#if NET10_0_OR_GREATER
Assert.False(Sse3.IsSupported, "Sse3 should be disabled.");
Assert.False(Ssse3.IsSupported, "Ssse3 should be disabled.");
Assert.False(Sse41.IsSupported, "Sse41 should be disabled.");
Assert.False(Popcnt.IsSupported, "Popcnt should be disabled.");
#endif
Assert.False(Sse42.IsSupported, "Sse42 should be disabled when DisableSSE42 is set.");
break;
case HwIntrinsics.DisableAVX:
Assert.False(Avx.IsSupported);
break;
case HwIntrinsics.DisableFMA:
Assert.False(Fma.IsSupported);
Assert.False(Avx.IsSupported, "AVX should be disabled when DisableAVX is set.");
break;
case HwIntrinsics.DisableAVX2:
Assert.False(Avx2.IsSupported);
break;
case HwIntrinsics.DisableBMI1:
Assert.False(Bmi1.IsSupported);
break;
case HwIntrinsics.DisableBMI2:
Assert.False(Bmi2.IsSupported);
break;
case HwIntrinsics.DisableLZCNT:
Assert.False(Lzcnt.IsSupported);
break;
case HwIntrinsics.DisableArm64AdvSimd:
Assert.False(AdvSimd.IsSupported);
Assert.False(Avx2.IsSupported, "AVX2 should be disabled when DisableAVX2 is set.");
#if NET10_0_OR_GREATER
Assert.False(Fma.IsSupported, "FMA should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Bmi1.IsSupported, "BMI1 should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Bmi2.IsSupported, "BMI2 should be disabled when DisableAVX2 is set (paired disable).");
Assert.False(Lzcnt.IsSupported, "LZCNT should be disabled when DisableAVX2 is set (paired disable).");
#endif
break;
case HwIntrinsics.DisableArm64Aes:
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported);
Assert.False(System.Runtime.Intrinsics.Arm.Aes.IsSupported, "Arm64 AES should be disabled when DisableArm64Aes is set.");
break;
case HwIntrinsics.DisableArm64Crc32:
Assert.False(Crc32.IsSupported);
Assert.False(Crc32.IsSupported, "Arm64 CRC32 should be disabled when DisableArm64Crc32 is set.");
break;
case HwIntrinsics.DisableArm64Dp:
Assert.False(Dp.IsSupported);
Assert.False(Dp.IsSupported, "Arm64 DotProd (DP) should be disabled when DisableArm64Dp is set.");
break;
case HwIntrinsics.DisableArm64Sha1:
Assert.False(Sha1.IsSupported);
Assert.False(Sha1.IsSupported, "Arm64 SHA1 should be disabled when DisableArm64Sha1 is set.");
break;
case HwIntrinsics.DisableArm64Sha256:
Assert.False(Sha256.IsSupported);
Assert.False(Sha256.IsSupported, "Arm64 SHA256 should be disabled when DisableArm64Sha256 is set.");
break;
}
}

Loading…
Cancel
Save