feat(render): implement Campaign AR and terrain fidelity
This commit is contained in:
parent
99cf26e00c
commit
7a5f96ede5
368 changed files with 50611 additions and 950 deletions
|
|
@ -0,0 +1,63 @@
|
|||
using AcDream.App.Rendering.Packs;
|
||||
using AcDream.Plugin.Abstractions.Rendering;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering.Packs;
|
||||
|
||||
public sealed class AtmosphericGpuTimerSamplingTests
|
||||
{
|
||||
[Fact]
|
||||
public void LowMeasuresOneCompleteFrameInFour()
|
||||
{
|
||||
bool[] measured = Enumerable.Range(1, 12)
|
||||
.Select(frame => AtmosphericGpuTimerSampling.ShouldMeasure(
|
||||
RenderQualitySemantic.Low,
|
||||
frame))
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(
|
||||
[false, false, false, true, false, false, false, true, false, false, false, true],
|
||||
measured);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(RenderQualitySemantic.Medium)]
|
||||
[InlineData(RenderQualitySemantic.High)]
|
||||
public void OtherQualitiesMeasureEveryFrame(RenderQualitySemantic quality)
|
||||
{
|
||||
for (long frame = 1; frame <= 32; frame++)
|
||||
Assert.True(AtmosphericGpuTimerSampling.ShouldMeasure(quality, frame));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RejectsNonPositiveFrameSerial()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() =>
|
||||
AtmosphericGpuTimerSampling.ShouldMeasure(
|
||||
RenderQualitySemantic.Low,
|
||||
frameSerial: 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WarmSamplingDecisionsAllocateZero()
|
||||
{
|
||||
_ = AtmosphericGpuTimerSampling.ShouldMeasure(
|
||||
RenderQualitySemantic.Low,
|
||||
frameSerial: 1);
|
||||
|
||||
int measured = 0;
|
||||
long before = GC.GetAllocatedBytesForCurrentThread();
|
||||
for (long frame = 1; frame <= 10_000; frame++)
|
||||
{
|
||||
if (AtmosphericGpuTimerSampling.ShouldMeasure(
|
||||
RenderQualitySemantic.Low,
|
||||
frame))
|
||||
{
|
||||
measured++;
|
||||
}
|
||||
}
|
||||
long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
|
||||
|
||||
Assert.Equal(2_500, measured);
|
||||
Assert.Equal(0, allocated);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue