From 3ba56a5005a11132a0aa4a0a432539c7c28b0fc0 Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Fri, 24 Jul 2026 10:18:40 +0200 Subject: [PATCH] [GPU] ship-capture: also dump VS float constants (the placement matrix) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The captured vertex BUFFER holds LOCAL positions (byte-identical to the .xpr) — capital-ship parts are placed entirely in the vertex shader, not in the buffer. So the per-part world/WVP matrix lives in the VS float constants. Extend the F10 capture to dump the first 48 vec4 from the SQ_VS_CONST base per draw; diffing two parts isolates the world matrix (the camera VP block is shared across draws). Co-Authored-By: Claude Opus 4.8 --- src/xenia/gpu/command_processor.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/xenia/gpu/command_processor.cc b/src/xenia/gpu/command_processor.cc index 68670281d..89863b6ee 100644 --- a/src/xenia/gpu/command_processor.cc +++ b/src/xenia/gpu/command_processor.cc @@ -227,6 +227,29 @@ void CommandProcessor::CaptureShipDrawForRE( be_f32(p + 8)); } cap_out << "\n"; + + // Vertex-shader float constants: the buffer holds LOCAL positions, so the + // per-part world (or world-view-projection) matrix that places the part lives + // here as a run of float4 constants. Diffing two parts' constants isolates the + // matrix (the camera VP block is shared). Dump the first 48 vec4 from the VS + // constant base as host-float (the register file stores them host-endian). + auto vsc = register_file_->Get(); + uint32_t cbase = vsc.base; // starting float4 index + cap_out << fmt::format(" vsconst base={}:", cbase); + for (uint32_t i = 0; i < 48; ++i) { + uint32_t idx = cbase + i; + if (idx >= 256) { + break; + } + uint32_t r = XE_GPU_REG_SHADER_CONSTANT_000_X + 4 * idx; + float cx = register_file_->Get(r); + float cy = register_file_->Get(r + 1); + float cz = register_file_->Get(r + 2); + float cw = register_file_->Get(r + 3); + cap_out << fmt::format(" c{}=({:.4f},{:.4f},{:.4f},{:.4f})", i, cx, cy, cz, + cw); + } + cap_out << "\n"; cap_out.flush(); }