Skip to content

Add Guild Leader and City Mayor Chat Channels - #6

Merged
Cekis merged 1 commit into
SWG-Source:masterfrom
AconiteX:master
Oct 29, 2020
Merged

Add Guild Leader and City Mayor Chat Channels#6
Cekis merged 1 commit into
SWG-Source:masterfrom
AconiteX:master

Conversation

@AconiteX

@AconiteX AconiteX commented Oct 8, 2020

Copy link
Copy Markdown
Member

@Cekis
Cekis merged commit 9261fb9 into SWG-Source:master Oct 29, 2020
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
Phase 10 established a scene-conditional DPVS verdict (`remove` outdoor,
`keep` indoor) under the D3D9 renderer. Per CONTEXT D-12 and the Phase 11
Revisit Note in docs/recon/10-dpvs-profiling.md, D3D11's cheaper per-draw-
call cost can shift the cost/benefit calculus -- particularly for the
indoor `keep` verdict, which could flip to `remove` if D3D11 makes the
draws cheap enough that intra-cell occlusion savings stop paying for the
DPVS query overhead.

Added as Phase 11 success criterion SWG-Source#6:
- Re-run Phase 10 capture protocol against D3D11 renderer
- Confirm or reverse the D3D9 scene-conditional verdict
- Conditional source-edit revert (outdoor flip) or extension (indoor flip)
- Verdict documented in docs/recon/11-dpvs-d3d11-remeasure.md

Also updated Phase 11 "Depends on" line to call out the dependency on
Phase 10's verdict baseline, and the Plans line to flag a TBD
"DPVS remeasure" plan in the multi-plan breakdown.

Note: Phase 10 instrumentation gets ripped out by plan 10-07 (THROWAWAY
per D-15), so Phase 11 must either restore equivalent instrumentation or
adopt a different measurement approach -- captured in the criterion text
to surface it during Phase 11 planning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…d globally

Yesterday's verdict doc + Phase 11 success criterion SWG-Source#6 assumed a per-line
indoor/outdoor split at RenderWorld.cpp:908 vs :911. That was wrong --
those two lines are the same cullingParameters value via #ifdef _DEBUG /
release branching, both feeding the single ms_dpvsCamera applied to ALL
rendering. There is no code-level path split between indoor and outdoor
at this site.

Reframed:
- Underlying data remains scene-conditional (remove outdoor 3/3, keep
  indoor 1/1) -- that finding stands.
- Implementation decision: Option alpha -- apply remove globally. Outdoor
  magnitude (0.94-2.13 ms, dominant playtime) wins over indoor regression
  (0.66 ms / 2.2%, below human perception, POB playtime is minor).
- Phase 11 D3D11 work will reconsider per ROADMAP criterion SWG-Source#6.

Also added 10-05-analysis.txt -- the verdict gate file plan 10-06 Task 3
reads for its conditional branch (`findstr /R /C:"^verdict = "`). Records
`verdict = remove` plus the per-scene analysis context.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…key plumbing (Option alpha)

Per Phase 10 verdict (docs/recon/10-dpvs-profiling.md): apply `remove`
globally to the single global cullingParameters value. Outdoor scenes
get the 3.3-9.1% median frame-time win; indoor cantina takes a 2.2%
regression below human perception threshold. Aggregate user experience
improves; Phase 11 D3D11 will reconsider per ROADMAP criterion SWG-Source#6.

D-13 edits (drop OCCLUSION_CULLING bit at cullingParameters):
- RenderWorld.cpp:909 (#ifdef _DEBUG branch): strip OCCLUSION_CULLING
  term, retain ms_disableViewFrustumCulling-conditional VIEWFRUSTUM_CULLING
- RenderWorld.cpp:913 (release branch): strip OCCLUSION_CULLING term,
  retain VIEWFRUSTUM_CULLING

D-14 edits (delete runtime toggle machinery):
- RenderWorld.cpp: delete `ms_disableOcclusionCulling` static, delete
  `setDisableOcclusionCulling()` + `getDisableOcclusionCulling()` bodies
- RenderWorld.h: delete corresponding declarations
- ConfigClientGraphics.cpp: delete `ms_disableOcclusionCulling` static,
  delete `KEY_BOOL(disableOcclusionCulling, ...)` registration, delete
  `getDisableOcclusionCulling()` body
- ConfigClientGraphics.h: delete `getDisableOcclusionCulling()` declaration

Caller fixes (sites the plan didn't explicitly enumerate but that
referenced the now-deleted setter/getter):
- GroundScene.cpp:691: pre-Phase-10 scene-conditional toggle (off for
  space, on for ground) was actually doing the right thing -- now
  redundant since DPVS is globally off. Removed the call site with a
  comment pointing at the Option-alpha rationale.
- DpvsProfileInstrumentation.cpp:330: writeRow's dpvs_occlusion_flag CSV
  column reference. Neutralized to literal `1` (DPVS permanently off).
  Wave 7 deletes this file entirely.
- CuiIoWin.cpp:978-983: F11 keybind hook from plan 10-04 referenced both
  setter and getter. Block commented out. Wave 7 removes the entire
  #ifdef _DEBUG block.
- DpvsProfileInstrumentation.cpp:394 (reportOverlay): replaced
  `getDisableOcclusionCulling() ? "OFF" : "ON"` with literal "removed".
  Wave 7 deletes this file.

Left intentionally alone (plan didn't target; orthogonal to D-13/D-14):
- RenderWorld.cpp:86: `ms_forceDisableOcclusionCulling` static
  (#ifdef _DEBUG only) — orthogonal debug flag, address still taken by
  DebugFlags::registerFlag at line 232. Variable is now dormant but
  harmless.

Acceptance grep checks all pass:
- grep -c 'DPVS::Camera::OCCLUSION_CULLING' RenderWorld.cpp == 0
- grep -c 'DPVS::Camera::VIEWFRUSTUM_CULLING' RenderWorld.cpp == 2
- grep -c 'ms_disableOcclusionCulling' RenderWorld.cpp == 0
- grep -c 'set/getDisableOcclusionCulling' RenderWorld.h == 0
- grep -c 'disableOcclusionCulling' ConfigClientGraphics.cpp == 0

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
… 10 instrumentation

Reverts every Phase 10 instrumentation artifact in one revert-shaped commit
per D-15. Permanent D-13/D-14 edits from plan 10-06 (OCCLUSION_CULLING bit
stripped at RenderWorld.cpp:909/913 + disableOcclusionCulling config plumbing
deleted) are NOT reverted -- those are the verdict-driven permanent state.

Files deleted (entire module):
- src/engine/client/library/clientGraphics/include/public/clientGraphics/DpvsProfileInstrumentation.h
- src/engine/client/library/clientGraphics/src/shared/DpvsProfileInstrumentation.cpp

Wave 1 (plan 10-02) reverts -- GPU timing plumbing:
- Direct3d9.cpp: 5 sites reverted -- namespace function declarations (lines 275-280),
  pool member statics + kDpvsGpuTimingPoolSize (lines 504-512), ms_glApi assignments
  in install path (lines 1144-1147), dpvsGpuTimingShutdownPool() call in remove
  path (lines 1633-1634), and the five function bodies (Ensure/Shutdown/Begin/End/
  PollResult, ~92 lines starting at 4617)
- Graphics.h: 3 static method declarations removed
- Graphics.cpp: 3 forwarder bodies removed
- Gl_dll.def: 3 Gl_api function pointer entries removed

Wave 2 (plan 10-03) reverts -- engine module wiring:
- SetupClientGraphics.cpp: install hook + include removed
- clientGraphics.vcxproj: ClCompile + ClInclude entries removed

Wave 3 (plan 10-04) reverts -- hook wiring:
- RenderWorld.cpp: includes removed (DpvsProfileInstrumentation.h,
  sharedDebug/PerformanceTimer.h); GPU/CPU bracket around resolveVisibility
  reverted to the pre-Phase-10 plain NP_PROFILER block (12-line cleanup)
- Game.cpp: include + onFrameEnd hook removed
- CuiIoWin.cpp: entire #ifdef _DEBUG F10/F11 intercept block removed
  (was Plan 10-04 Wave 3 addition; F11 was already neutralized by 10-06; this
  removes the whole block including F10 toggleCapture)
- SwgCuiCommandParserDefault.cpp: include + MAKE_COMMAND + cmds[] entry +
  performParsing else-if branch all removed

Acceptance grep all pass:
- `grep -rE 'THROWAWAY|DpvsProfileInstrumentation|dpvsGpuTiming|setrunlabel'
   src/ --include='*.{cpp,h,def,vcxproj}'` returns 0 hits
- `grep -rE 'ms_dpvsTs|ms_dpvsTiming|kDpvsGpu|DpvsProfileInstrumentationNamespace'
   src/ --include='*.{cpp,h,def,vcxproj}'` returns 0 hits
- DpvsProfileInstrumentation.{h,cpp} no longer exist

Bisect anchor: tag `phase-10-instrumentation-pre-cleanup` at commit 9f2ec37
preserves the pre-cleanup HEAD for Phase 11 revert-anchor recovery. Phase 11
DPVS remeasurement (ROADMAP success criterion SWG-Source#6) can restore this commit
via `git revert <this-commit>` if the harness is wanted back; alternatively
the harness is fundamentally D3D9-specific (the query pool implementation is
in Direct3d9.cpp) and Phase 11 D3D11 should reimplement cleanly anyway.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…oved, two /gsd-debug leads captured

Phase 10 (dpvs-culling-experiment) closes at 7/7 plans (100%) per CONTEXT
D-15. The phase delivered its ROADMAP goal: measured DPVS occlusion-query
cost on modern hardware against a real server, captured a clean verdict,
applied the verdict-driven source edits, removed the measurement
scaffolding, documented the result in docs/recon/10-dpvs-profiling.md.

Final verdict: `remove` globally per Option alpha (one-bit decision in
cullingParameters; aggregate experience optimization). Phase 11 D3D11
reconsideration captured in ROADMAP success criterion SWG-Source#6 -- when the
D3D11 renderer lands, re-measure and decide whether to maintain alpha,
revert to keep, or implement runtime scene-aware split.

Commits this phase (closeout):
- af34b7e docs corrections + verdict gate file
- 18bc4fd D-13 + D-14 permanent source edits
- 2a5efb3 plan 10-06 closeout
- 151167d plan 10-07 D-15 cleanup (-726 lines)
- this commit -- phase closeout SUMMARY + STATE update

Phase 10 boot smoke surfaced two orthogonal investigations that did NOT
exist as Phase 10 work but are now well-scoped /gsd-debug candidates:

1. SafeCast.h:29 null dynamic_cast dialog (todo 2026-05-14): Koogie's
   stricter assert((t) != nullptr) replacing SOE's NOT_NULL fires two
   CRT dialogs on world load. Recoverable via Ignore-twice; real null
   cast underneath probably tied to a SWGSource compat-guard gap from
   the D-18 unported list. Reproduction protocol + suspect candidates
   captured.

2. Cantina corner-snap regression (todo 2026-05-15): bisected to a
   ~5-hour window on 2026-05-08 (v1 milestone Debug doesn't snap;
   build-v145 + everything since does). Phase 10 boot smoke surfaced
   the smoking-gun mechanism: DEBUG_WARNING routes to
   OutputDebugString in Report.cpp:145; ui.log doesn't grow because
   it's UI-subsystem-only; 12,133 warnings in a 10-min play session
   produced no on-disk log. OutputDebugString has ~50-200us per-call
   overhead from Windows' global event-check mutex even with no
   debugger attached. Concentrated warning bursts on first-time cell
   load = visible snap. One-line fix candidate captured:
   `if (IsDebuggerPresent()) OutputDebugString(buffer);`. Plus Kenny's
   Release-build binary-search test idea added to the todo as the
   pre-fix verification step (Release builds compile out DEBUG_WARNING
   entirely via PRODUCTION==1; if Release doesn't snap, theory
   confirmed before any source edit).

Per user direction: do both /gsd-debug sessions before starting Phase 11.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…s (ambiguity 0.11)

Locks scope and acceptance criteria for the new Direct3d11 renderer
plugin via 4-round Socratic interview (Researcher / Simplifier /
Boundary Keeper / Failure Analyst) per /gsd-spec-phase protocol.

Headline decisions:
- D3D9 stays as fallback during a transition phase; D3D11 becomes
  default once stable. D3D9 plugin not deleted in Phase 11.
- Render gate: Tatooine outdoor + Mos Eisley cantina interior (NOT
  space, NOT other planets). All four subsystems required for both
  scenes: terrain, character/creature skeletal, particles, UI HUD.
- D3D 11.0 feature level baseline (HLSL SM5.0, Win7+).
- Three-variant D3D9 question (Direct3d9 / _ffp / _vsps) deferred to
  a SPIKE as Phase 11's first plan. FFP emulation is conditional on
  whether target scenes actually exercise FFP paths.
- Stability: match D3D9 stability floor — no renderer-specific crash
  during 5+ min Tatooine + 5+ min cantina play. Known D3D9 long-tails
  (e.g. ~11-min ExceptionHandler) accepted.
- Visual bar: side-by-side screenshot comparison ("substantially
  similar"), not pixel-perfect. Reference shots committed under
  docs/recon/11-d3d11-screenshots/.
- DPVS remeasurement under D3D11 (success criterion SWG-Source#6): external
  tools (PIX / Nsight / GPUView), NOT source-instrumentation restore.
- Out of scope: space scenes, other planets, pixel-perfect parity,
  performance parity, deletion of D3D9 plugin, lost-device recovery.

7 requirements (D3D11-01..05 expanded + visual-parity method + DPVS
remeasurement) all with Current/Target/Acceptance. 13 falsifiable
pass/fail acceptance criteria. Ambiguity Report and Interview Log
included per template.

Adjacent research item surfaced during interview but explicitly NOT
part of Phase 11 scope: SWGSource vs whitengold codebase + TRE asset
diff for the broken space-scene graphics artifacts. Tracked as a
parallel todo so Phase 11 stays scoped tight.

Next step: /gsd-discuss-phase 11 — implementation decisions (plugin
scaffold approach, shader compile pipeline, FFP spike design,
renderer selection mechanism, etc.)

Files:
- .planning/phases/11-d3d11-renderer-plugin/11-SPEC.md
- .planning/todos/pending/2026-05-15-swgsource-vs-whitengold-tre-asset-diff.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…tes; declare Direct3d11_VertexSlot0CB with per-field static_asserts (CODEX Q3a+Q3b)

Plan 11-08 Task 2.5. Plan 11-05's kMaxCBufferBytes = 1024 was an unverified "comfortable headroom" assumption that under-provisioned c60..c67 (ExtendedLightData) by 64 bytes. CODEX Q3a analysis: ExtendedLightData is 8 registers (2 x HemisphericLightData, where HemisphericLightData = 4 float4 per HLSL struct-row-alignment rules) occupying c60..c67; cbuffer total span = (67+1)*16 = 1088 bytes minimum. CODEX Q3b verdict: expand the slot (splitting / dropping both untenable). Plan 11-08 chooses 1152 = 72 registers (64 bytes safety margin above 1088).

Combined with the Iter-18 BSOD root-cause-set item SWG-Source#6 (Map with WRITE_DISCARD returns UNDEFINED bytes, not zeros, per Microsoft documentation), the original 1024-byte slot would have stranded ARBITRARY GARBAGE in any unwritten region the shader subsequently reads -- exactly the symptom that took the OS down. Iter-18's BSOD was reverted; this retrofit closes the structural gap before Task 3a/3b touches cbuffer writes.

Direct3d11_ConstantBuffer.h:
- kMaxCBufferBytes 1024 -> 1152 with 12-line comment block documenting the CODEX Q3a/Q3b verdict + 64-byte safety margin rationale + Iter-18 BSOD cross-reference.
- AFTER the class declaration: new struct Direct3d11_VertexSlot0CB with 8 fields covering c0..c71 (WVP / World / fog / material / LightData / gap / ExtendedLightData / trailing pad). Layout matches CODEX Q3a + Iter-13B shader IR dump (stage/shader-iter13b-inc-0-output.txt).
- 10 static_asserts: sizeof == 1152 + sizeof % 16 == 0 + sizeof <= kMaxCBufferBytes + 7 offsetof boundary checks (c0/c4/c8/c11/c16/c44/c60). Compile-time enforcement of every packoffset boundary -- any future C++ or HLSL drift surfaces as a build error, not a runtime BSOD.

Direct3d11_ConstantBuffer.cpp: NO change. All uses of kMaxCBufferBytes flow through the single constant (createOneSlot ByteWidth + install log + updateVS/updatePS bounds checks). Confirmed by grep -- no hardcoded 1024 in the cpp.

Direct3d11_PerFrameCB / Direct3d11_PerObjectCB / Direct3d11_PerMaterialCB declarations PRESERVED. Still consumed by Plan 11-06 LightManager and other call sites. Plan 11-08's struct is additive, not replacement.

Verification:
- MSBuild Direct3d11 EXIT=0; gl11_d.dll restages clean.
- ALL 10 static_asserts passed at compile time. Layout matches the locked design.
- D-13/D-04a/D-05 invariants unchanged.
- MSVC /W4 clean (pre-existing C4459 DirectXMathVector carry-forward only).

No smoke required this iteration -- compile-only change. Task 3a (primeDefaults install-time landing) is the next step; that task's smoke is where the new slot capacity gets exercised at runtime.
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…ills with identity/zero defaults before first draw (Iter-18 must-haves SWG-Source#2 + SWG-Source#3 + SWG-Source#5; Task 3a)

Plan 11-08 Task 3a. Mitigates the Iter-18 BSOD CODEX sixth hypothesis: Map(D3D11_MAP_WRITE_DISCARD) does NOT zero unwritten bytes per Microsoft documentation; unwritten bytes contain ARBITRARY GARBAGE from prior frames. Without primeDefaults, the first draw call's shader reads uninitialized cbuffer memory in slot 0's c8..c71 region (~1024 bytes beyond the 128-byte WVP+World write that Iter-18 attempted) PLUS every byte in slots 1/2/3 PLUS every byte in PS slots 0..3. That's exactly the symptom that took the OS down via NaN cascade -> degenerate rasterization -> GPU TDR escalation -> BSOD.

Direct3d11_ConstantBuffer.h:
- new `static void primeDefaults()` declaration with header comment explaining FULL-FILL discipline + Iter-18 root-cause-item-SWG-Source#6 cross-reference.

Direct3d11_ConstantBuffer.cpp:
- #include Direct3d11_LightManager.h for the Direct3d11_LightingCB struct identity reference (slot 3 ownership comment).
- primeDefaults() implementation:
  - Stack `unsigned char zero[kMaxCBufferBytes]` = 1152 bytes of zeros, reused across slots that don't have a dedicated struct shape.
  - VS slot 0: full Direct3d11_VertexSlot0CB (the struct landed in Iter-2.5) -- `{}-init` zeroes every field, then two XMStoreFloat4x4 calls set objectWorldCameraProjectionMatrix + objectWorldMatrix to identity. lightData[0].x = 0 is implicit via {}-init (numLights = 0 guard against shader-side for-loop bombs reading uninitialized counter).
  - VS slots 1, 2: full 1152-byte zero-fill. Belt-and-suspenders against any engine path that binds them between Iter-3a and the Task 3b setter rewrite.
  - VS slot 3: full 1152-byte zero-fill. Rule-1 deviation from the plan -- the plan assumed Direct3d11_LightManager::install primed slot 3, but verification via source read (LightManager.cpp:42-48) confirms LightManager::install is intentionally empty; slot 3 is unprimed until setLights() runs (AFTER first draw). primeDefaults takes ownership of priming slot 3 to close the same garbage-read gap covered for other slots. When setLights() fires later, its updateVS(kLightingCBSlot, &cb, sizeof(cb)) cleanly overwrites the zero-fill with real Direct3d11_LightingCB data. Zero impact on Plan 11-06 LightManager behavior.
  - PS slots 0..3: full 1152-byte zero-fill each. PS-side reads of zero produce defined-dark visuals, not NaN.
  - DEBUG_REPORT_LOG_PRINT at end confirms the prime fired (visible in stage/d3d11-debug.log via the Iter-1.7 file sink and in OutputDebugString stream).
- Wired primeDefaults() call into install() immediately after the per-slot createOneSlot loop + before the existing install log line.

No behavioral change to per-frame logic this iteration -- primeDefaults is purely defensive. The setter rewrite + WVP composition + per-draw flush+bind sequencing lands in Task 3b. Smoke gate for Iter-3a is: process launches + dark-blue clear visible + zero ERROR-severity D3D11 messages + >= 30 sec without crash. Matches Iter-1 baseline (plus Iter-1.8's BC2 fix dropping the prior 96 BC2 errors to 0).

Verification:
- MSBuild Direct3d11 EXIT=0; gl11_d.dll auto-restages clean.
- D-13/D-04a/D-05 invariants unchanged; STUB count unchanged at 27.
- 10 Direct3d11_VertexSlot0CB static_asserts (Iter-2.5) still pass at compile time.
- MSVC /W4 clean (pre-existing C4459 DirectXMathVector carry-forward only).

Awaiting Kenny smoke: Iter-3a + Iter-1.8 combined effect. Expected: stage/d3d11-debug.log carries the new "primeDefaults: VS slot 0 = identity-matrix..." line near the session-start header, ZERO BC2 errors (Iter-1.8 closure), no new cbuffer-write errors, Plan 11-07 milestone still preserved.
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 20, 2026
…n + per-draw flush+bind (Iter-18 must-haves 5+7+8 of 8; CODEX Q1 ratified order; Task 3b)

The actual Iter-18 fix. Plan 11-07 Iter-18 BSOD'd the OS attempting a 128-byte minimal-WVP cbuffer push; this lands the cbuffer composition with all 8 must-have prerequisites in place (Iter-1 verified D3D9 composition order, Iter-1.5 ROW_MAJOR flag, Iter-1.6 break-on-severity tuned, Iter-1.7 file-sink diagnostics, Iter-1.8 BC2 srcBox pad, Iter-2.5 slot capacity 1152B with per-field static_asserts, Iter-3a primeDefaults install-time fill, Iter-3a.1 RTV cache).

Root cause being fixed: the three per-frame transform setters (setWorldToCameraTransform / setProjectionMatrix / setObjectToWorldTransformAndScale) wrote SMALL structs (96 / 192 / 192 bytes) to slot 0 or slot 1 -- partial writes against the new 1152-byte slot, leaving 1056+ bytes UNDEFINED via Map(WRITE_DISCARD). This is the Iter-18 BSOD root cause SWG-Source#6 lurking in the working tree. setProjectionMatrix's slot-1 write also clobbered setObjectToWorldTransformAndScale's slot-1 world matrix every frame. The shader's c0..c3 (WVP) was never composed; c4..c7 (World) flickered between projection and world depending on call order.

Implementation in Direct3d11_StateCache.cpp:
- Added file-scope statics in Direct3d11_StateCacheNamespace:
  - XMFLOAT4X4 s_cachedView, s_cachedProj, s_cachedWorld -- identity-initialized at static-storage-init time (NOT zero-init; identity is the correct first-draw default).
  - XMFLOAT4 s_cachedCameraPos = (0,0,0,0) for the c8 region.
  - bool s_anyMatrixWritten = false sentinel.
  - composeAndUploadSlot0() helper: zero-inits Direct3d11_VertexSlot0CB cb = {} (1152 bytes); composes wtp = XMMatrixMultiply(P, V); wvp = XMMatrixMultiply(wtp, W); XMStoreFloat4x4 both into cb.objectWorldCameraProjectionMatrix + cb.objectWorldMatrix; cb.c8_to_c10[0] = s_cachedCameraPos (matches shader IR at stage/shader-iter13b-inc-0-output.txt line 99: float3 cameraPosition_w : packoffset(c8)); updateVS(0, &cb, sizeof(cb)) for the full 1152-byte upload.

- applyPreDrawState gets a first-draw race guard at the top: if !s_anyMatrixWritten, composeAndUploadSlot0() + set sentinel. Closes the race even if the engine fires draws before any setObjectToWorldTransformAndScale call. The existing bindVS(0)/bindVS(1)/bindPS(0)/bindPS(2) calls below (Plan 11-06) handle the per-draw bind.

- setWorldToCameraTransform: shadow-only. s_cachedView gets the row-major XMFLOAT4X4 from objectToWorld.getMatrix() with the implicit (0,0,0,1) fourth row; s_cachedCameraPos gets the camera vector. NO cbuffer write.

- setProjectionMatrix: shadow-only. memcpy projectionMatrix.matrix into s_cachedProj. NO cbuffer write. (Removed the slot-1 PerObjectCB write that was clobbering world.)

- setObjectToWorldTransformAndScale: shadow s_cachedWorld with per-axis scale composed into basis columns (preserves Plan 11-06's correct scale-compose logic); call composeAndUploadSlot0(); set s_anyMatrixWritten = true. The canonical per-object upload site.

CODEX Q1 ratification recorded in Iter-1: D3D9 plugin at Direct3d9.cpp:3291 + 3359 computes ms_cachedWorldToProjectionMatrix = D3DXMatrixMultiply(P, V) = P * V; at line 4034 computes matrices[0] = D3DXMatrixMultiply(WtP, W) = (P*V)*W. Per CODEX peer review XMMatrixMultiply(A, B) == D3DXMatrixMultiply(&out, &A, &B) -- same row-major + row-vector + pre-multiplication semantics. Direct port.

Shader IR layout (verified Iter-2.5 + cross-referenced in this iter): c0..c3 WVP, c4..c7 World, c8 cameraPosition_w (float3), c9 viewportData (float4, zero), c10 fog (float4, zero), c11..c71 material/lightData/gap/extendedLightData/pad (all zero by {}-init -- numLights = lightData[0].x = 0 is the shader-side loop-bomb guard per Iter-18 must-have SWG-Source#2).

Verification:
- MSBuild Direct3d11 EXIT=0; gl11_d.dll auto-restages.
- D-13/D-04a/D-05 invariants unchanged; STUB count unchanged at 27.
- 10 Direct3d11_VertexSlot0CB static_asserts (Iter-2.5) still pass at compile time -- composeAndUploadSlot0's sizeof(cb) uploads exactly 1152 bytes.
- MSVC /W4 clean (pre-existing C4459 DirectXMathVector carry-forward only).

Awaiting Kenny smoke (Plan 11-08 exit milestone candidate): visible geometry on top of the dark-blue clear in at least one scene. Iter-18 BSOD risk re-tested with all 8 safety nets in place; if anything goes wrong, drainInfoQueue captures the validation message BEFORE TDR escalates. If FATAL fires, normal iteration progress -- Task 4 picks up from the new boundary. If BSOD, working tree reverts per Plan 11-07 Iter-18 precedent (do NOT commit BSOD code).
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 30, 2026
Plan 17-02 (D-09 non-fatal PSRC recompile lane) merged via 4d2973b.
Code deliverables done — 0 unresolved externals, 116 PS input signatures
dumped, 26 cbuffer layouts reflected (all SwgVertexConstants bindPoint=0
totalSize=400 vars=9), 0 PSRC compile failures.

CHAR-01 visual evidence: character renders flat-black silhouette under
D3D11. Root cause traced to systemic VS↔PS interpolator-schema mismatch
(id=343 fires 565K times per session: 188K COLOR + 376K TEXCOORD).
VS programs only output [TEXCOORD0 r=o1 mask=0x3] (single interpolator,
inherited from pre-recompile-lane fallback-magenta-PS world); HLSL-
compiled PS programs expect COLOR0+TEXCOORD0+TEXCOORD1+ at registers
0-4. PS reads garbage / zero for missing semantics, modulates against
COLOR0=0, output goes flat black. Plan 17-02's R3-02b SR-2 dual-route
diagnostic worked as designed — surfaced exactly this gap.

Parked findings (do NOT block Phase 17 close):
  - Task SWG-Source#5: gl05_d.dll rebuild texture-binding regression (D3D9
    reference path unavailable on Phase-17+ binaries; pre-17-01 backup
    works; rebuild config drift suspected from 80 KB size delta)
  - Task SWG-Source#6: VS recompile lane to match HLSL PS interpolator schema
    (id=343 root cause; cross-AI consult prompt at
    .planning/research/CONSULT-vs-ps-interpolator-mismatch-codex.in)

Phase 17 closes as 'beachhead established with two parked gaps' once
Plan 17-03 (cbuffer wiring) finishes. Visual parity gated on Phase 17.X
or Phase 18 addressing SWG-Source#5 + SWG-Source#6.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 30, 2026
…e cap + cross-AI consult

Plan 17-03 host-stage boot verification + investigation into a 3-of-3
deterministic FATAL crash that masked itself when diagnostic instrumentation
was added (Heisenbug). Plan 17-03 is CODE-COMPLETE and VERIFIED running on
real char-select shaders.

Boot evidence (CLOSEOUT.md):
  - 4,407 apply() invocations across all char-select assets (sul_eye,
    sul_m_head, sul_m_body, scout_blaster, shoes, vest, shirt, pants,
    necklace, armor_marauder_belt — every char-select shader)
  - All reflected layouts: SwgVertexConstants @ b0, totalSize=400,
    varsCount=9 (consistent with Plan 17-02's PS-cbuffer census)
  - id=343 × 24,408 (char-select only) — task SWG-Source#6 (VS↔PS register-position
    mismatch) confirmed dominant; visual outcome still flat-black character
  - R3-03g flush log: sul_eye + sul_m_head both show
    wroteDiffuse=0 wroteSpecular=0 wroteEmissive=0 despite materialValid=1
    and properly-resolved source data (diffuse=(1,1,1,1) etc) — task SWG-Source#7
    (writeVarByName lookups for "materialDiffuse" etc don't exist in
    SwgVertexConstants; the cbuffer uses material[N] array indexing)
    confirmed

Initial crash (now fixed by defensive cap, plus possibly was elsewhere):
  - First 3 host-stage boots of the merged Plan 17-03 binaries produced
    identical FATAL: MemoryManager refused ~1.05 GB allocation at PPEM
    init's setStaticShader(*ms_copyShader) → gl11_d.dll
  - Inserted synchronous fopen/fwrite/fclose trace BEFORE apply()'s
    std::vector<unsigned char> staging(layout.TotalSize) — the only
    unbounded alloc in Plan 17-03's diff
  - Boot with trace did NOT reproduce the crash (Heisenbug — code layout
    / timing sensitive); 4,407 trace lines all show clean TotalSize=400
  - Conclusion: original FATAL was NOT in apply()'s staging allocation;
    bug is elsewhere in the setStaticShader call chain (uninitialized
    memory read, or timing-dependent race) that this build's code layout
    doesn't expose
  - Trace evidence preserved at .planning/phases/17-.../evidence/

Defensive cap (Direct3d11_StaticShaderData.cpp):
  - Trace insertion removed (4,407 fopen/write/close per boot was a perf
    cost)
  - Replaced with cheap upper-bound: if layout.TotalSize > 64 KiB (160×
    SwgVertexConstants's 400 B), skip + DEBUG_WARNING with shader name
    and layout name — belt-and-braces against any future reflected layout
    returning a corrupt size, regardless of root cause

Cross-AI consult on task SWG-Source#6 (VS↔PS pair signature validation):
  - Codex + Cursor both fired in background during Wave 3, decoded from
    UTF-16, synthesized at .planning/research/CONSULT-...-SYNTHESIS.md
  - Convergence: diagnosis confirmed (D3D11 register-position strict;
    semantic-only matching was a D3D9 assumption that no longer holds);
    Approach SWG-Source#1 (VS recompile lane mirroring PS lane) ranked primary;
    Approach SWG-Source#5 (per-pass interpolator ABI normalization) as fallback;
    Approaches 2/3/4 rejected
  - Cursor's key correction: VS recompile lane already exists from Phase
    11 (Direct3d11_VertexShaderData.cpp + buildHlslForVSOutputs() from
    Iter-3 fixed a related id=343 × 65K case for static Variant T).
    Real fix is pair-validate at PS-bind time → use selectFallbackPSForVS
    when asset PS is incompatible with bound VS
  - Task SWG-Source#6 description revised accordingly; Plan 17-04 spec scoped for
    that approach

D3D9 no-textures regression evidence (task SWG-Source#5):
  - Screenshot from earlier in the session preserved at
    docs/research/phase17-char-select/d3d9-no-textures-regression-mos-eisley.png
  - Mos Eisley with flat-color materials (no textures) — pre-existing-
    gl05-rebuild-config regression confirmed by A/B (pre-17-01 backup
    boots clean with textures)

Plan 17-03 stays merged. Phase 17 close-out can proceed.
Pre-Plan-17-04 work: spec the VS↔PS pair-validation plan.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request May 30, 2026
…7 scope expanded

Two-task plan that lands the two technical fixes blocking CHAR-01/02/03
visual parity, both surfaced by Plans 17-01/02/03 boot evidence:

  Task 1 — VS↔PS signature pair validation at asset-PS bind time
    (Direct3d11_StateCache.cpp + PixelShaderProgramData). When the
    bound VS's reflected output signature is incompatible with the
    asset PS's cached input signature, fall through to the existing
    selectFallbackPSForVS path (Phase 11 Iter-3's buildHlslForVSOutputs
    builds a PS matching the VS register layout). Eliminates id=343
    × 24K per char-select boot.

  Task 2 — writeVarByName recognizes SwgVertexConstants material[N]
    array schema (Direct3d11_StaticShaderData.cpp). Plan 17-03's
    R3-03g flush log confirmed wroteDiffuse/Specular/Emissive=0/0/0
    because hardcoded "materialDiffuse" etc names don't exist in
    SwgVertexConstants's 9 reflected vars (material[N] array per
    vertex_shader_constants.inc). Extend lookups to discover names
    from D3DReflect output AND read vertex_shader_constants.inc
    inline for ground truth. Keep original hardcoded names as
    fallback so a future shader using simple names still works.

Single human-verify checkpoint at end (Task 3) — Kenny boots once,
expected outcome is the FIRST textured character at D3D11 char-select.

Cross-AI consult on Task 1 already complete (Codex + Cursor convergence
at .planning/research/CONSULT-vs-ps-interpolator-mismatch-SYNTHESIS.md):
diagnosis confirmed, Approach SWG-Source#1 ranked primary, Approach SWG-Source#5 as fallback,
Cursor caught my original task-SWG-Source#6 framing was wrong (VS recompile lane
already exists from Phase 11; real fix is bind-time pair validation).

Phase 17 scope: 3 plans → 4 plans. ROADMAP.md updated, STATE.md re-opens
phase status. Plan 17-04 is the first plan to enable rather than instrument.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 14, 2026
… node_errors)

Surgical in-place revision of the four Phase-28 plans + CONTEXT to close the
Codex+Cursor consensus findings (REVIEWS.md):

- SWG-Source#1 28-03: rewrite merge loop to single descending pass; claimed/tombstoned
  guard BEFORE the tree-length-0 branch; delete claimed.pop (the un-claim bug)
- SWG-Source#2 28-04: add test_searchtree_lower_priority_length0_does_not_tombstone_winner
- SWG-Source#3 28-04: mandatory build_cot2000() + read_cot2000_entries round-trip (drop
  the detector-only hedge); SC#1 met literally, no ROADMAP wording change
- SWG-Source#4 28-04: strengthen integration test (assert priority-10 winner_node.kind==
  'path' when override non-empty); real-archive tombstone proof delegated to the
  synthetic suite — SC#3 tombstone clause narrowed to synthetic, override on real
- SWG-Source#5 28-02: verified vendored dataclasses already expose snake_case length +
  compressed_length; verbatim+two-edits stands; +extended-stride 8-byte pad note
- SWG-Source#6 28-02/03/04: soften 02 bounded-reads wording; add merge-boundary bounds
  preflight (T-28-03-04) + regression test
- SWG-Source#7 28-03/04: deterministic sorted os.walk, followlinks=False, reparse/junction
  skip; +missing/empty searchPath dir tests
- SWG-Source#8 28-03/04: add VirtualTree.node_errors diagnostics field + assertions
- SWG-Source#9 28-CONTEXT: correct blanket length-0-tombstone line to per-node-type nuance
- LOW: 28-01 pin .python-version to 3.11 floor; 28-03 scanner _NN_/TOCTreePath
  engine-role notes

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 14, 2026
…SearchNode list

- parse_shared_file(cfg_path) hand-parses repeated/indexed keys (NOT configparser)
- engine-faithful sort (-priority, KIND_RANK[kind], cfg_seq); path<tree<toc within priority (review SWG-Source#1)
- supports both _NN_ and bare-priority key grammars (review SWG-Source#6)
- captures maxSearchPriority/TOCTreePath scalars; cfg path is a parameter (D-08)
- re-export parse_shared_file/SearchNode/ScanResult from package __init__
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 14, 2026
…st-hit-wins merge

- fix_up_file_name VERBATIM engine port (leading-.. only; keeps interior .. — review SWG-Source#3)
- safe_virtual_key hardening wrapper rejects interior-../drive/UNC/empty (threat T-28-03-01)
- single descending pass first-hit-wins; guard precedes tree-length-0 branch (review SWG-Source#1, no claimed.pop)
- PER-NODE-TYPE tombstone: tree length-0 = global remove; toc length-0/offset-0 = skip-only
- shadowed = later REAL copies only, excludes tombstones/absent (review SWG-Source#4)
- eager deterministic searchPath os.walk with reparse-dir prune before descent (Open-Q1, review SWG-Source#5/SWG-Source#7)
- .tre AND .toc header bounds preflight + count*stride cap (review SWG-Source#6/#2a, threat T-28-03-04)
- node_errors diagnostics field on VirtualTree (review SWG-Source#8); documented approximation boundary (review SWG-Source#7)
- re-export fix_up_file_name/safe_virtual_key/build_virtual_tree/MergedEntry/VirtualTree from __init__
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 17, 2026
…S-01)

- Add the phase's ONE justified #if defined(_M_X64) fork (register sets are
  inherently bitness-specific): RtlCaptureContext(&context); AddrPC/Stack/Frame
  .Offset = full 64-bit context.Rip/Rsp/Rbp (NO DWORD truncation, review SWG-Source#6);
  walk with IMAGE_FILE_MACHINE_AMD64
- 32-bit #else keeps the original __asm GetEIP grab + IMAGE_FILE_MACHINE_I386
  byte-unchanged
- Flag two PHASE-33 RUNTIME RESIDUALs: (1) the x64 unwind WALK is compile-clean
  only (Open-Q3 bar), (2) the uint32* callStack output still narrows Rip
- TU compiles x64-clean (0 C4235/C4311/C4312/C4244); only DEF-31-01 Misc.h
  C2668 (plan 31-04) remains
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 19, 2026
The login/character-select music handoff + UAT were written mid-research and
went stale after the fix landed. Reconcile docs to reality:

- handoff/README.md + login-music-miles-9.3v-research.md: mark RESOLVED, note
  the 9.3v lead was a red herring (fix was engine-side: serve Miles' empty-name
  background-IO re-open from the remembered stream name; gated s_titleMusicStreamFix).
  9.3v body kept as historical record.
- 35-HUMAN-UAT.md: test SWG-Source#6 issue -> pass, status partial -> complete, 5/6 -> 6/6,
  gaps cleared.

Docs only; no code change.
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 28, 2026
…tinni Bucket B v7 + async sibling)

Single 'where we are now / what's next' snapshot tying the three threads of the session
to their detailed docs: gl11 space-HUD cyan-square FIXED (44d54da), Utinni Bucket B
DONE/awaiting-smoke (db3ca58), MeshAppearanceTemplate async heap-corruption sibling
logged (task SWG-Source#6). Next Utinni = Bucket A. Indexed at top of the handoff README.
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Jun 29, 2026
…et A/A-2/A-3 v12 + 2 crash diagnoses)

Authoritative where-we-are snapshot: contract at v12/113 (all waves pushed, staged exe correct);
THE open blocker = consumer-side UtinniCore v12 rebuild for target-change (network::getObjectById);
target-change crash root-caused (dump 135512, stale hardcoded resolver RVA); spaceport zone-in crash
PARKED as a rare intermittent StaticShaderTemplate flake (dump 152448, task SWG-Source#6); diagnostics gotchas
(Utinni anti-debug blocks cdb attach -> use app-handler mdmp; .txt breadcrumb != stack, symbolize the
.mdmp; build serially). Indexed READ-FIRST at the top of the handoff list.
kennethlong added a commit to kennethlong/client-tools that referenced this pull request Aug 1, 2026
…B id copy-out (SWG-Toolkit change request SWG-Source#6)

Contract v24 -> v25, 146 -> 147 names. The model-D Arm-step unblock:
from any cell-contained object (an .ilf decoration pick, a wall-click
CELL object, the player) to the containing POB building NetworkId (==
the .ws node id wsSetNodeTemplateName takes). Chain per the request
(getParentCell -> getPortalProperty -> getOwner -> getNetworkId) with
one provider correction: a CELL object input uses its OWN CellProperty
first -- getParentCell walks attachment ANCESTORS, so on a cell it
lands in the world cell and would wrongly report "not inside a POB".
Fail-closed at the null world-cell PortalProperty.

Gates: Release/Win32 forced relink 0 unresolved; GetEngineHookPoints
ord-82 undecorated; 147==147; 45s boot smoke clean, no new dumps.
x64 untouched by construction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants