変異試験で見つけた幅と区画の継ぎ目と許容値の試験の漏れを補う
このコミットが含まれているのは:
2ファイル変更
+68
検索条件に一致するファイルはありません
@@ -465,10 +465,14 @@ public sealed class CpuTileConvolverTests
|
||||
|
||||
var actual = (float[])expected.Clone();
|
||||
|
||||
var narrow = (float[])expected.Clone();
|
||||
|
||||
CpuTileConvolver.ButterfliesScalar(expected, log2, twiddles, direction);
|
||||
CpuTileConvolver.Butterflies(actual, log2, twiddles, direction);
|
||||
CpuTileConvolver.Butterflies(narrow, log2, twiddles, direction, allowWide: false);
|
||||
|
||||
Assert.Equal(expected.Select(BitConverter.SingleToInt32Bits), actual.Select(BitConverter.SingleToInt32Bits));
|
||||
Assert.Equal(expected.Select(BitConverter.SingleToInt32Bits), narrow.Select(BitConverter.SingleToInt32Bits));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,4 +587,25 @@ public sealed class CpuTileConvolverTests
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(true)]
|
||||
[InlineData(false)]
|
||||
public void RenderingASeveralChunkStoreAwayFromTheOriginKeepsEveryPosition(bool linear)
|
||||
{
|
||||
var light = new LightOptions(linear, true, 0.85f, linear ? 12f : 0f);
|
||||
var source = ConvolutionScene.RandomSource(100, 60, 80, 0.5);
|
||||
var scene = ConvolutionScene.CreateShifted(source, 103, 59, 100, 60, 97, 53, 313, 207, 4, 64, light);
|
||||
var plan = scene.Plan;
|
||||
Assert.True(plan.RegionWidth * plan.RegionHeight > CpuTileConvolver.StoredChunkPixels * 3);
|
||||
Assert.NotEqual(0, CpuTileConvolver.StoredChunkPixels % plan.RegionWidth);
|
||||
var (expected, _) = RunLight(scene, 3, 1.2f);
|
||||
var (_, stored) = RunLight(scene, 3, 1f);
|
||||
var output = new byte[scene.RegionLength];
|
||||
using var convolver = new CpuTileConvolver(4);
|
||||
|
||||
convolver.RenderStored(stored, plan.RegionWidth * plan.RegionHeight, 1.2f, output, light, plan.RegionWidth, plan.RegionX, plan.RegionY);
|
||||
|
||||
Assert.Equal(expected, output);
|
||||
}
|
||||
}
|
||||
@@ -694,4 +694,47 @@ public sealed class GpuTileConvolverTests
|
||||
Assert.InRange(scene.WorstRatio(run.Store, ConvolutionBound.GpuOperationError + GpuTileCheck.LightTransformError), 0d, 1d);
|
||||
AssertOutputIsTheTransformOfTheStore(scene, run, 1f, light);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PreparingInvalidLightOptionsIsRejected()
|
||||
{
|
||||
var scene = ConvolutionScene.Create(ConvolutionScene.RandomSource(100, 60, 3, 0.5), 100, 60, 8, 4, 64);
|
||||
var plan = scene.Plan;
|
||||
using var convolver = new GpuTileConvolver(HardwareOrDefault());
|
||||
convolver.Upload(scene.Spectrum);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => convolver.Prepare(plan, 8, 8, 100, 60, 1f, [], false, new LightOptions(true, false, 1.5f, 5f)));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => convolver.Prepare(plan, 8, 8, 100, 60, 1f, [], false, new LightOptions(true, false, 0.5f, 2000f)));
|
||||
convolver.Prepare(plan, 8, 8, 100, 60, 1f, [], false, new LightOptions(true, false, 0.5f, 5f));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheLinearLightToleranceExceedsTheOtherOneByTheTransformError()
|
||||
{
|
||||
var scene = ConvolutionScene.Create(ConvolutionScene.RandomSource(150, 97, 31, 0.45), 150, 97, 11, 5, 64, new LightOptions(true, false, 0f, 0f));
|
||||
var run = Run(HardwareOrDefault(), scene);
|
||||
var plan = scene.Plan;
|
||||
var sampleCount = run.Samples.Length;
|
||||
var linear = new ConvolutionMeasurement[GpuTileCheck.MeasurementCount(sampleCount)];
|
||||
var plain = new ConvolutionMeasurement[linear.Length];
|
||||
var linearJob = run.Job with { Light = new LightOptions(true, true, 0f, 0f) };
|
||||
var plainJob = run.Job with { Light = new LightOptions(false, true, 0f, 0f) };
|
||||
|
||||
GpuTileCheck.Evaluate(run.Report, linearJob, run.Samples, scene.Spectrum.Kernel, linear);
|
||||
GpuTileCheck.Evaluate(run.Report, plainJob, run.Samples, scene.Spectrum.Kernel, plain);
|
||||
|
||||
for (var sample = 0; sample < sampleCount; sample++)
|
||||
{
|
||||
var tile = plan.TileAt(plan.RegionX + run.Samples[sample].X, plan.RegionY + run.Samples[sample].Y);
|
||||
var (redGreen, blueAlpha) = GpuTileCheck.Norms(run.Report, plan, tile, true);
|
||||
for (var channel = 0; channel < 4; channel++)
|
||||
{
|
||||
var index = 1 + 4 + sample * 4 + channel;
|
||||
var norm = channel < 2 ? redGreen : blueAlpha;
|
||||
Assert.Equal(GpuTileCheck.LightTransformError * norm, linear[index].Tolerance - plain[index].Tolerance, norm * 1e-12);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.Equal(Math.ScaleB(1d, -16), GpuTileCheck.LightTransformError);
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする