feat(render): Campaign V slice V4a - port TextRenderer/BitmapFont/DebugLineRenderer/TextureCache onto IGpuDevice

TextRenderer, BitmapFont, DebugLineRenderer, and TextureCache's UI-texture
upload path (GetOrUploadRenderSurface/UploadRgba8) now issue every draw and
resource creation through the pinned IGpuDevice/IGpuFrame/IGpuPassEncoder
RHI contract instead of raw GL. This is the RHI's first real production
consumer - V0-V3 only established the contract, GL backend skeleton, and a
shader-dialect migration with no live GL exercise. TextRenderer owns one
IGpuPipeline (ui_text shader, straight-alpha blend, depth disabled) and
allocates a per-bucket ring each Flush; BitmapFont's atlas texture is
created and uploaded via device.CreateTexture/.Upload; DebugLineRenderer
mirrors the same one-pipeline-per-Flush shape for its line-list draws.
World-path TextureCache methods (GetOrUpload, the raw-GL layer-array
upload) are untouched - still legacy GL, still out of scope.

Frame lifecycle: GpuDeviceFrameLifetime (RenderFrameOrchestrator.cs) wraps
IGpuDevice.BeginFrame()/IGpuFrame.End() inside the existing
IRenderFrameLifetime bracket HostInputCameraCompositionPhase already opens
per callback, additively - no frame-graph restructuring. Ported renderers
reach the frame via ICurrentGpuFrameSource, a plain interface (not a
delegate field) so WorldSceneDiagnosticsController keeps passing its
existing "no stored window/delegate" architectural-conformance test.

Two real bugs surfaced by actually exercising the RHI against a live GL
context (nothing here was previously reachable before this slice):

- GlGpuDevice.BeginFrame() now resets the render-state cache every frame.
  The cache assumes it is the sole writer of GL program/blend/depth/cull
  state, which was true while it had zero real consumers, but every
  still-legacy renderer (WbDrawDispatcher, terrain, particles, EnvCells)
  mutates that same GL state directly and never informs the cache. Once a
  legacy renderer ran between two RHI binds, the cache's belief about the
  current GL program went stale, so a later BindPipeline(text shader)
  skipped re-issuing glUseProgram and the following push-constant upload
  threw GL_INVALID_OPERATION against whatever program was actually bound.
  Reset() at the frame boundary is the same defensive move BeginPass
  already makes after a forced clear (see its comment); it costs one
  redundant state application on the frame's first bind.
- GL_MULTISAMPLE has no representation in the pinned contract. Added a
  GL-backend-internal Multisample field to GlRenderStateSnapshot/Changes,
  computed from GpuPipelineDescription.SampleCount at BindPipeline time -
  mirrors how Vulkan bakes MSAA into the pipeline instead of a separate
  toggle.

Collateral, scoped to keep the port real rather than a stub:

- GpuTextureSlot (Unassigned = uint.MaxValue, NOT 0) now flows through
  every consumer of TextureCache.GetOrUploadRenderSurface/UploadRgba8 and
  TextRenderer.DrawSprite - the entire retained UI layer, since a pervasive
  Func<uint,(uint,int,int)> sprite-resolve delegate threads through nearly
  every UI element/controller. Every prior `== 0` / `!= 0` "no texture"
  check became `.IsAssigned` / `!.IsAssigned`; slot 0 is a real assigned
  slot (the device's default white texture), so the old sentinel would
  have produced live visual regressions if left in place.
- GpuTextureSlot/IGpuDevice/IGpuFrame are internal, so ~270 previously
  public AcDream.App types that touched them (directly or transitively)
  are now internal too - safe, since AcDream.App is an exe with no
  external project references; only the two test projects consume it, via
  InternalsVisibleTo. A handful of unrelated types the sweep caught
  (ElementInfo/ImportedLayout's property-bag hierarchy, several enums used
  as public [Theory] parameters, CursorFeedbackSnapshot's DragAcceptState)
  were reverted back to public where making them internal would have
  either cascaded into unrelated files or broken xUnit's public-member
  discovery.
- ExternalViewportTextureBridge (new) registers the still-raw-GL FBO
  color textures PrivateEntityViewportRenderer/PaperdollViewportRenderer
  produce (V4g's scope) into the device's texture table for
  UiViewport.TextureHandle, via a temporary
  GlGpuDevice.RegisterExternalColorTexture escape hatch (internal, not
  part of IGpuDevice) deleted when V4g ports those viewports.
- TextRenderGlStateScope.cs and its test deleted: the pipeline description
  now bakes what it used to restore by hand.
- ResourceCleanupGroupTests/GlTextureOwnershipTests: the two source-text
  conformance tests keyed to TextRenderer's old multi-resource
  construction shape (Shader + per-flight FrameBufferSet array + white
  texture + tracked VAO/VBO, all via ResourceCleanupGroup) no longer apply
  - that shape is gone, replaced by one IGpuPipeline created through
    IGpuDevice. The construction-order test is deleted; the checked-commit
    texture-creation check now targets GlGpuTexture (which already used
    the same GlResourceCommand.CreateName primitive before this slice).

Gates:
- dotnet build -c Release: 0 warnings, 0 errors (AcDream.App has
  TreatWarningsAsErrors).
- dotnet test tests/AcDream.App.Tests -c Release: 3,840 passed / 3
  skipped (was 3,843/3 entering this slice - net 3 fewer tests:
  TextRendererFailureSafetyTests.cs deleted (2, tested the now-deleted
  TextRenderGlStateScope) plus the one retired ResourceCleanupGroupTests
  method). Full solution: 8,908 passed / 5 skipped across all nine test
  projects.
- Offline pixel gate (tools/run-offline-pixel-gate.ps1, parent ec414d60
  vs this commit): differing fraction 0.318% (1,791/563,200 compared
  pixels), above the 0.001 threshold. Investigated pixel-by-pixel rather
  than waved through: a diff heatmap plus 4x crops at the differing
  clusters show zero differences anywhere in the retained UI, terrain,
  scenery, or static meshes - every differing pixel sits on continuously-
  animated ambient content (flying-insect sprites over the swamp, foliage
  sparkle/dew glints) whose exact phase depends on elapsed wall-clock
  time, the same category the gate's own sky-masking rationale already
  documents and the campaign doc's coverage table explicitly excludes
  ("Not covered - particles"). Confirming evidence: two same-commit
  captures at HEAD compare clean against each other (0.0025%), and two
  same-commit captures at the parent compare clean against each other
  (0.0044%) - only base-vs-head is consistently elevated, which is what
  frame-pacing drift from genuinely new per-frame RHI work (BeginFrame,
  ring resets, the render-state reset above) would produce against a
  fixed wall-clock capture deadline, not a rendering defect. Recommend a
  quick user visual check of this capture pair alongside the automated
  result, matching how V2c's particle work was already handled in this
  campaign (flagged for user visual confirmation rather than blocked on
  an automated gate that cannot cover animated content).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-27 18:22:08 +02:00
parent ec414d60cd
commit ceec3bc440
334 changed files with 3660 additions and 3840 deletions

View file

@ -1,3 +1,4 @@
using AcDream.App.Rendering.Gpu;
using System;
using System.Collections.Generic;
using AcDream.App.UI;
@ -66,7 +67,7 @@ public class ToolbarControllerTests
void AddSlot(uint id)
{
var list = new UiItemList(_ => (0u, 0, 0)) { Width = 32, Height = 32 };
var list = new UiItemList(_ => (GpuTextureSlot.Unassigned, 0, 0)) { Width = 32, Height = 32 };
dict[id] = list; slots[id] = list; root.AddChild(list);
}
@ -101,7 +102,7 @@ public class ToolbarControllerTests
},
};
}
var button = new UiButton(info, _ => (0u, 0, 0)) { Width = 32, Height = 32 };
var button = new UiButton(info, _ => (GpuTextureSlot.Unassigned, 0, 0)) { Width = 32, Height = 32 };
dict[id] = button;
root.AddChild(button);
}
@ -117,10 +118,10 @@ public class ToolbarControllerTests
{ new(Index: 0, ObjectId: 0x5001u, SpellId: 0) };
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u, useItem: _ => { });
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u), useItem: _ => { });
Assert.Equal(0x5001u, slots[Row1[0]].Cell.ItemId);
Assert.Equal(0x77u, slots[Row1[0]].Cell.IconTexture);
Assert.Equal(new GpuTextureSlot(0x77u), slots[Row1[0]].Cell.IconTexture);
Assert.Equal(0u, slots[Row1[1]].Cell.ItemId); // others empty
}
@ -143,7 +144,7 @@ public class ToolbarControllerTests
layout,
repo,
Store(shortcuts),
iconIds: (_, _, _, _, _) => 0x77u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(0x77u),
useItem: _ => { });
Assert.Equal(0x5001u, slots[Row1[0]].Cell.ItemId);
@ -161,7 +162,7 @@ public class ToolbarControllerTests
{ new(Index: 2, ObjectId: 0x5002u, SpellId: 0) };
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x88u, useItem: _ => { });
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x88u), useItem: _ => { });
Assert.Equal(0u, slots[Row1[2]].Cell.ItemId); // not bound yet
repo.AddOrUpdate(new ClientObject { ObjectId = 0x5002u, WeenieClassId = 1u, IconId = 0x06005678u });
@ -177,7 +178,7 @@ public class ToolbarControllerTests
var shortcuts = new List<ShortcutEntry>
{ new(Index: 2, ObjectId: 0x5002u, SpellId: 0) };
var controller = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x88u, useItem: _ => { });
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x88u), useItem: _ => { });
controller.Dispose();
controller.Dispose();
@ -203,7 +204,7 @@ public class ToolbarControllerTests
var selection = new SelectionState();
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u,
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u),
useItem: g => used = g,
selection: selection);
UiItemSlot cell = slots[Row1[0]].Cell;
@ -226,7 +227,7 @@ public class ToolbarControllerTests
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
ctrl.BindPanelButtons(
panelId => panelId is RetailPanelCatalog.Inventory or RetailPanelCatalog.Character,
toggles.Add);
@ -277,7 +278,7 @@ public class ToolbarControllerTests
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u,
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned,
useItem: _ => { },
itemInteraction: interaction);
ctrl.BindPanelButtons(
@ -304,7 +305,7 @@ public class ToolbarControllerTests
var puts = new List<(uint Item, uint Container, int Placement)>();
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
playerGuid: () => player,
sendPutItemInContainer: (i, c, p) => puts.Add((i, c, p)));
@ -344,7 +345,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: static (_, _, _, _, _) => 0u,
iconIds: static (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: static _ => { },
itemInteraction: interaction,
playerGuid: () => player,
@ -394,7 +395,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: static (_, _, _, _, _) => 0u,
iconIds: static (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: static _ => { },
itemInteraction: interaction,
playerGuid: () => player,
@ -426,7 +427,7 @@ public class ToolbarControllerTests
var puts = new List<(uint Item, uint Container, int Placement)>();
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
playerGuid: () => player,
sendPutItemInContainer: (i, c, p) => puts.Add((i, c, p)));
@ -447,7 +448,7 @@ public class ToolbarControllerTests
var repo = new ClientObjectTable();
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
var inventoryButton = (UiButton)layout.FindElement(InventoryButtonId)!;
var characterButton = (UiButton)layout.FindElement(CharacterButtonId)!;
@ -524,7 +525,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
itemInteraction: interaction,
selectedObjectId: () => selected);
@ -582,7 +583,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
itemInteraction: interaction,
selectedObjectId: () => selection.SelectedObjectId ?? 0u,
@ -648,7 +649,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
itemInteraction: interaction,
selectedObjectId: () => selection.SelectedObjectId ?? 0u,
@ -691,7 +692,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
playerGuid: () => player);
var ammoButton = (UiButton)layout.FindElement(0x10000194u)!;
@ -730,7 +731,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
playerGuid: () => player);
var ammoButton = (UiButton)layout.FindElement(0x10000194u)!;
@ -752,7 +753,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 0u,
iconIds: (_, _, _, _, _) => GpuTextureSlot.Unassigned,
useItem: _ => { },
toggleCombat: () => toggles++);
@ -779,7 +780,7 @@ public class ToolbarControllerTests
layout,
repo,
Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: id => used = id,
selectItem: id => selected = id);
@ -816,7 +817,7 @@ public class ToolbarControllerTests
layout,
repo,
Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
itemInteraction: interaction,
selectItem: id => selection.Select(id, SelectionChangeSource.Toolbar),
@ -870,7 +871,7 @@ public class ToolbarControllerTests
layout,
repo,
Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
itemInteraction: interaction);
@ -909,7 +910,7 @@ public class ToolbarControllerTests
layout,
repo,
new ShortcutStore(),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
itemInteraction: interaction,
sendAddShortcut: entry => sends.Add(((uint)entry.Index, entry.ObjectId)));
@ -935,7 +936,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) =>0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
// Only peace indicator (index 0 = 0x10000192) is visible.
Assert.True (indicators[0x10000192u].Visible, "peace indicator should be visible after bind");
@ -955,7 +956,7 @@ public class ToolbarControllerTests
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) =>0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
ctrl.SetCombatMode(CombatMode.Melee);
@ -977,7 +978,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) =>0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
combatState: combat);
// Initially NonCombat after bind.
@ -1016,7 +1017,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted);
// Top row: ShortcutNum == slot index, ghosted == false.
@ -1045,7 +1046,7 @@ public class ToolbarControllerTests
var repo = new ClientObjectTable();
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted);
ctrl.SetCombatMode(mode);
@ -1055,7 +1056,7 @@ public class ToolbarControllerTests
var cell = slots[Row1[i]].Cell;
Assert.Equal(i, cell.ShortcutNum);
Assert.False(cell.ShortcutGhosted, $"top-row slot {i} should be regular in {mode}");
cell.SetItem((uint)(0x5000 + i), 0x99u);
cell.SetItem((uint)(0x5000 + i), new GpuTextureSlot(0x99u));
Assert.Same(FakeRegular, cell.ActiveDigitArray());
}
// Bottom row still has no number.
@ -1073,13 +1074,13 @@ public class ToolbarControllerTests
var repo = new ClientObjectTable();
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted);
ctrl.SetCombatMode(CombatMode.Magic);
foreach (var id in Row1)
{
slots[id].Cell.SetItem(id, 0x99u);
slots[id].Cell.SetItem(id, new GpuTextureSlot(0x99u));
Assert.True(slots[id].Cell.ShortcutGhosted);
Assert.Same(FakeGhosted, slots[id].Cell.ActiveDigitArray());
}
@ -1105,7 +1106,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted);
foreach (var id in Row1)
@ -1127,7 +1128,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted, emptyDigits: FakeEmpty);
foreach (var id in Row1)
@ -1148,7 +1149,7 @@ public class ToolbarControllerTests
ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { },
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { },
regularDigits: FakeRegular, ghostedDigits: FakeGhosted, emptyDigits: null);
foreach (var id in Row1)
@ -1174,7 +1175,7 @@ public class ToolbarControllerTests
int iconCallCount = 0;
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => { iconCallCount++; return 0x77u; }, useItem: _ => { });
iconIds: (_,_,_,_,_) => { iconCallCount++; return new GpuTextureSlot(0x77u); }, useItem: _ => { });
int callsAfterBind = iconCallCount; // 1 call from initial Populate
@ -1199,7 +1200,7 @@ public class ToolbarControllerTests
int iconCallCount = 0;
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => { iconCallCount++; return 0x99u; }, useItem: _ => { });
iconIds: (_,_,_,_,_) => { iconCallCount++; return new GpuTextureSlot(0x99u); }, useItem: _ => { });
Assert.Equal(0, iconCallCount); // not called — item absent during initial Populate
Assert.Equal(0u, slots[Row1[1]].Cell.ItemId);
@ -1225,7 +1226,7 @@ public class ToolbarControllerTests
{ new(Index: 3, ObjectId: 0x5004u, SpellId: 0) };
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0xAAu, useItem: _ => { });
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0xAAu), useItem: _ => { });
Assert.Equal(0x5004u, slots[Row1[3]].Cell.ItemId); // bound
@ -1252,7 +1253,7 @@ public class ToolbarControllerTests
int iconCallCount = 0;
ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => { iconCallCount++; return 0xBBu; }, useItem: _ => { });
iconIds: (_,_,_,_,_) => { iconCallCount++; return new GpuTextureSlot(0xBBu); }, useItem: _ => { });
int callsAfterBind = iconCallCount; // 1 call for the shortcut item
@ -1274,7 +1275,7 @@ public class ToolbarControllerTests
var ctrl = ToolbarController.Bind(layout, repo,
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
for (int i = 0; i < Row1.Length; i++)
{
@ -1299,7 +1300,7 @@ public class ToolbarControllerTests
var (layout, slots, _) = FakeToolbar();
var ctrl = ToolbarController.Bind(layout, new ClientObjectTable(),
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
var list = slots[Row1[0]];
var payload = new ItemDragPayload(0x5001u, ItemDragSource.Inventory, 0, new UiItemSlot());
@ -1314,7 +1315,7 @@ public class ToolbarControllerTests
var (layout, slots, _) = FakeToolbar();
var ctrl = ToolbarController.Bind(layout, new ClientObjectTable(),
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
var list = slots[Row1[0]];
var payload = new ItemDragPayload(0u, ItemDragSource.Inventory, 0, new UiItemSlot());
Assert.Equal(ItemDragAcceptance.None, ctrl.OnDragOver(list, list.Cell, payload));
@ -1343,7 +1344,7 @@ public class ToolbarControllerTests
uint selected = 0;
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u, useItem: _ => { },
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u), useItem: _ => { },
sendAddShortcut: add, sendRemoveShortcut: rem,
selectItem: item => selected = item, selectedObjectId: () => selected);
Assert.Equal(0x5001u, slots[Row1[3]].Cell.ItemId);
@ -1368,7 +1369,7 @@ public class ToolbarControllerTests
new(Index: 5, ObjectId: 0x5002u, SpellId: 0) };
var (adds, removes) = NewSpies(out var add, out var rem);
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u, useItem: _ => { },
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u), useItem: _ => { },
sendAddShortcut: add, sendRemoveShortcut: rem);
var payload = new ItemDragPayload(0x5001u, ItemDragSource.ShortcutBar, 3, slots[Row1[3]].Cell);
@ -1397,7 +1398,7 @@ public class ToolbarControllerTests
var (adds, _) = NewSpies(out var add, out var remove);
var controller = ToolbarController.Bind(
layout, repo, Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
sendAddShortcut: add,
sendRemoveShortcut: remove);
@ -1420,7 +1421,7 @@ public class ToolbarControllerTests
{ new(Index: 3, ObjectId: 0x5001u, SpellId: 0) };
var (adds, removes) = NewSpies(out var add, out var rem);
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u, useItem: _ => { },
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u), useItem: _ => { },
sendAddShortcut: add, sendRemoveShortcut: rem);
var payload = new ItemDragPayload(0x5001u, ItemDragSource.ShortcutBar, 3, slots[Row1[3]].Cell);
@ -1446,7 +1447,7 @@ public class ToolbarControllerTests
};
var wire = new List<string>();
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
sendAddShortcut: entry => wire.Add($"add:{entry.Index}:{entry.ObjectId:X8}:{entry.SpellId:X8}"),
sendRemoveShortcut: slot => wire.Add($"remove:{slot}"));
@ -1479,7 +1480,7 @@ public class ToolbarControllerTests
};
var wire = new List<string>();
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_, _, _, _, _) => 1u,
iconIds: (_, _, _, _, _) => new GpuTextureSlot(1u),
useItem: _ => { },
sendAddShortcut: entry => wire.Add($"add:{entry.Index}:{entry.ObjectId:X8}:{entry.SpellId:X8}"),
sendRemoveShortcut: slot => wire.Add($"remove:{slot}"));
@ -1504,7 +1505,7 @@ public class ToolbarControllerTests
{ new(Index: 3, ObjectId: 0x5001u, SpellId: 0) };
var (adds, removes) = NewSpies(out var add, out var rem);
var ctrl = ToolbarController.Bind(layout, repo, Store(shortcuts),
iconIds: (_,_,_,_,_) => 0x77u, useItem: _ => { },
iconIds: (_,_,_,_,_) => new GpuTextureSlot(0x77u), useItem: _ => { },
sendAddShortcut: add, sendRemoveShortcut: rem);
var payload = new ItemDragPayload(0x5001u, ItemDragSource.ShortcutBar, 3, slots[Row1[3]].Cell);
@ -1523,7 +1524,7 @@ public class ToolbarControllerTests
var (layout, slots, _) = FakeToolbar();
ToolbarController.Bind(layout, new ClientObjectTable(),
new ShortcutStore(),
iconIds: (_,_,_,_,_) => 0u, useItem: _ => { });
iconIds: (_,_,_,_,_) => GpuTextureSlot.Unassigned, useItem: _ => { });
Assert.Equal(0x060011FAu, slots[Row1[0]].Cell.DragAcceptSprite); // green cross, not the ring F9
}
}