fix #425: pack resident budget is a 1080p ceiling that scales with pixel count; an explicit Apply retries a failed selection
Live Holtburg at 2560x1440: the Low preset needed 67,368,164 resident bytes (screen-sized HDR/depth/ray targets are 44 MB of that) against an absolute 64 MiB ceiling that had only been validated at 1080p, so Options -> Apply fell back to the default path; every later Apply was then refused by the controller's failure memo, which treated the user's deliberate choice like automatic re-activation. RenderPackResidentBudget.Effective scales the declared 1080p figure by the viewport's pixel-count ratio (never below 1), still capped by the hardware MaxPackResidentBytes; both pack graphs use it and the performance-matrix tool judges its resident column by the same rule (contract test updated). RenderPackController.Request gains explicitUserChoice, which clears the memo for that selection; RenderPackSelectionBinding passes it on every display edge (Apply, including resolution changes) and keeps the memo for the startup request. Tests: RenderPackResidentBudgetTests (1080p/720p keep the declared ceiling, 1440p = 16/9x, 4K = 4x, hardware cap wins, zero extent rejected); controller explicit-retry; the binding test now proves the user's next Apply activates once the cause is gone. App hermetic lane 6,068/0 (Release). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
38def07edb
commit
132395e6f7
11 changed files with 250 additions and 8 deletions
|
|
@ -162,10 +162,20 @@ public sealed class AtmosphericPerformanceMatrixContractTests
|
|||
"$cpuP99 -gt $budget.IncrementalCpuMillisecondsP99",
|
||||
source,
|
||||
StringComparison.Ordinal);
|
||||
// #425: the declared resident ceiling is the 1080p figure and scales
|
||||
// with the row's pixel count — the same rule as
|
||||
// RenderPackResidentBudget.Effective, so the tool and the runtime
|
||||
// cannot disagree about a 1440p/4K row.
|
||||
Assert.Contains(
|
||||
"$residentGpuBytes -gt $budget.ResidentGpuBytes",
|
||||
"$residentGpuBytes -gt $residentCeiling",
|
||||
source,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("$referencePixels = 1920L * 1080L", source, StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"[Math]::Ceiling([double]$budget.ResidentGpuBytes * $rowPixels / $referencePixels)",
|
||||
source,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("$rowPixels -le $referencePixels", source, StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"$gpuP50 -gt $budget.InclusiveGpuMillisecondsP50At1080p",
|
||||
source,
|
||||
|
|
|
|||
|
|
@ -291,6 +291,47 @@ public sealed class RenderPackControllerTests
|
|||
Assert.Equal(1, assets.OpenCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_explicit_user_request_retries_a_selection_that_failed_earlier()
|
||||
{
|
||||
// #425 (Campaign VM VM7 owner gate): a preset that failed its resident
|
||||
// budget once locked the user out of the pack until restart, because
|
||||
// the Options panel's Apply went through the same memo as automatic
|
||||
// re-activation. An explicit choice is a fresh attempt — here the
|
||||
// second attempt opens the assets again and fails on its own merits
|
||||
// (still invalid SPIR-V), not with the "will not be retried" memo.
|
||||
RenderPackDescriptor descriptor = Descriptor() with
|
||||
{
|
||||
Passes =
|
||||
[
|
||||
new RenderPassDeclaration(
|
||||
"tone-map",
|
||||
RenderPassHook.ToneMap,
|
||||
"shaders/fullscreen.vert.spv",
|
||||
"shaders/tone-map.frag.spv",
|
||||
[RenderSemanticInput.WorldColor],
|
||||
[],
|
||||
[]),
|
||||
],
|
||||
};
|
||||
var assets = new StubAssets([1, 2, 3, 4]);
|
||||
using var registry = new BufferedRenderPackRegistry();
|
||||
using IDisposable registration = registry.Register(descriptor, assets);
|
||||
var factory = new StubFactory();
|
||||
using var controller = Controller(registry, factory);
|
||||
|
||||
controller.Request(Selection());
|
||||
RenderPackActivationSnapshot first = controller.ApplyAtFrameBoundary(Extent);
|
||||
controller.Request(Selection(), explicitUserChoice: true);
|
||||
RenderPackActivationSnapshot second = controller.ApplyAtFrameBoundary(Extent);
|
||||
|
||||
Assert.Equal(RenderPackActivationState.FailedToRetail, first.State);
|
||||
Assert.Equal(RenderPackActivationState.FailedToRetail, second.State);
|
||||
Assert.Contains("not valid SPIR-V", second.Reason, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("will not be retried", second.Reason, StringComparison.Ordinal);
|
||||
Assert.Equal(2, assets.OpenCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Arbitrary_plugin_asset_exception_is_contained_as_a_retail_fallback()
|
||||
{
|
||||
|
|
@ -682,6 +723,20 @@ public sealed class RenderPackControllerTests
|
|||
Assert.True(settings.Display.RenderPack.IsRetail);
|
||||
Assert.Contains("pipeline rejected", controller.Snapshot.Reason, StringComparison.Ordinal);
|
||||
Assert.Null(controller.ActiveRuntime);
|
||||
|
||||
// #425: the user's next Apply of the SAME selection is an explicit
|
||||
// choice — with the failure cause gone it activates instead of being
|
||||
// refused with the "will not be retried" memo.
|
||||
factory.Failure = null;
|
||||
settings.SaveDisplay(settings.Display with
|
||||
{
|
||||
RenderPack = Selection() with { PresetId = "medium" },
|
||||
});
|
||||
RenderPackActivationSnapshot retried = binding.ApplyAtFrameBoundary(Extent);
|
||||
|
||||
Assert.NotEqual(RenderPackActivationState.FailedToRetail, retried.State);
|
||||
Assert.DoesNotContain("will not be retried", retried.Reason ?? string.Empty, StringComparison.Ordinal);
|
||||
Assert.NotNull(controller.ActiveRuntime);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
using AcDream.App.Rendering.Packs;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering.Packs;
|
||||
|
||||
public sealed class RenderPackResidentBudgetTests
|
||||
{
|
||||
private const long LowAt1080p = 64L * 1024 * 1024;
|
||||
private const long Unlimited = long.MaxValue;
|
||||
|
||||
[Theory]
|
||||
[InlineData(1920, 1080, LowAt1080p)]
|
||||
[InlineData(1280, 720, LowAt1080p)] // smaller than the reference keeps the declared ceiling
|
||||
[InlineData(1600, 900, LowAt1080p)]
|
||||
public void AtOrBelowTheReferenceResolutionTheDeclaredCeilingApplies(int width, int height, long expected)
|
||||
{
|
||||
Assert.Equal(expected, RenderPackResidentBudget.Effective(LowAt1080p, width, height, Unlimited));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void At1440pTheCeilingScalesByPixelCount()
|
||||
{
|
||||
// 2560x1440 / 1920x1080 = 16/9 ≈ 1.777…; #425's live Holtburg Low
|
||||
// preset needed 67,368,164 bytes, which the scaled ceiling admits.
|
||||
long effective = RenderPackResidentBudget.Effective(LowAt1080p, 2560, 1440, Unlimited);
|
||||
Assert.Equal((long)Math.Ceiling(LowAt1080p * 16.0 / 9.0), effective);
|
||||
Assert.True(effective >= 67_368_164L);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void At4KTheCeilingIsFourTimesTheDeclaredFigure()
|
||||
{
|
||||
Assert.Equal(4L * LowAt1080p, RenderPackResidentBudget.Effective(LowAt1080p, 3840, 2160, Unlimited));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheHardwareCapStillWins()
|
||||
{
|
||||
Assert.Equal(
|
||||
100_000_000L,
|
||||
RenderPackResidentBudget.Effective(LowAt1080p, 3840, 2160, hardwareCapBytes: 100_000_000L));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 1080)]
|
||||
[InlineData(1920, 0)]
|
||||
public void AZeroExtentIsRejected(int width, int height)
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(
|
||||
() => RenderPackResidentBudget.Effective(LowAt1080p, width, height, Unlimited));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue