Browse Source

fixing #146

af/merge-core
Anton Firszov 9 years ago
parent
commit
4d3391c4b6
  1. 8
      src/ImageSharp/Colors/Color.BulkOperations.cs

8
src/ImageSharp/Colors/Color.BulkOperations.cs

@ -42,6 +42,12 @@ namespace ImageSharp
BufferSpan<Vector4> destVectors, BufferSpan<Vector4> destVectors,
int count) int count)
{ {
if (!Vector.IsHardwareAccelerated)
{
throw new InvalidOperationException(
"Color.BulkOperations.ToVector4SimdAligned() should not be called when Vector.IsHardwareAccelerated == false!");
}
int vecSize = Vector<uint>.Count; int vecSize = Vector<uint>.Count;
DebugGuard.IsTrue( DebugGuard.IsTrue(
@ -92,7 +98,7 @@ namespace ImageSharp
/// <inheritdoc /> /// <inheritdoc />
internal override void ToVector4(BufferSpan<Color> sourceColors, BufferSpan<Vector4> destVectors, int count) internal override void ToVector4(BufferSpan<Color> sourceColors, BufferSpan<Vector4> destVectors, int count)
{ {
if (count < 256) if (count < 256 || !Vector.IsHardwareAccelerated)
{ {
// Doesn't worth to bother with SIMD: // Doesn't worth to bother with SIMD:
base.ToVector4(sourceColors, destVectors, count); base.ToVector4(sourceColors, destVectors, count);

Loading…
Cancel
Save