Fix nine runtime faults a tester's report named: a stack overrun on mesh draws, lost YMM halves on preemption, and seven more.

- The mesh stage's storage table starts 0x90 bytes before the end of the 2 KiB constant bank, and all sixteen slots
  were written: 0x6C bytes past a stack buffer on every mesh draw. It holds the nine slots that fit.
- The prebuilt runtime is compiled without AVX, so its preemption stub saved only XMM0-15 while the lifted code of
  an AVX2 processor keeps data in the upper YMM halves, which the stub's callees may clear. Both bodies are built
  now and the one for the processor is chosen at the start.
- After an FSR 3.1 frame generation error the window's swapchain was still AMD's object but went to the plain Vulkan
  calls. Swapchain calls follow whose swapchain it is, and a failure takes it down as a switch in the menu does.
- A movie is paced at its own 60 fps under a lower limit too: at 40 fps it ended 25 s behind its sound.
- A lost device left the wait for an upload spinning for good; it ends the run with the device's report.
- The compute pipeline key had four bytes of padding that were hashed and compared, so a prebuilt pipeline could be
  missed and built again.
- A thread's TLS pointer was published before the TLS was allocated, so the slot was always 0.
- A fatal exit puts RivaTuner Statistics Server's profile back, and an ini saved as UTF-16 is read.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-09 21:54:32 -05:00
parent ed3db71485
commit 00f06e669e
10 changed files with 290 additions and 200 deletions

View File

@@ -1042,8 +1042,8 @@ static int bind_range(VkExec *ex, uint64_t addr, uint64_t size, uint64_t align,
return 1;
}
static void c0_table(uint8_t *at, const p_bind_buf b[16]) {
for (int r = 0; r < 16; r++) {
static void c0_table(uint8_t *at, const p_bind_buf b[16], int rows) {
for (int r = 0; r < rows; r++) {
uint64_t a = b[r].addr;
uint32_t n = (uint32_t)b[r].size;
memcpy(at + 16 * r, &a, 8);
@@ -1056,8 +1056,9 @@ static void c0_table(uint8_t *at, const p_bind_buf b[16]) {
// candidate base from here and compares the global pointer against it. Compute: dispatch size at 0x200, the uniform
// buffer table at 0x210 + 16 r. Graphics: the largest point size (Maxwell's limit, GLSLC clamps gl_PointSize to it) at
// 0x610, the base instance at 0x644. NVN2 task and mesh stages: storage tables at 0x670 and 0x770 (the game binds
// slots 0-2 there, and their programs read 0x670.. and 0x770..). Other stages: zeros. Unbound slots read zero, since the
// replay keeps them zero.
// slots 0-2 there, and their programs read 0x670.. and 0x770..). The mesh table starts 0x90 bytes before the bank's
// end: it holds the 9 slots that fit, and sixteen would write 0x6C bytes past the bank. Other stages: zeros. Unbound
// slots read zero, since the replay keeps them zero.
// Byte offset of a stage's storage buffer table in c0, -1 for none.
static int c0_ssbo_base(int stage) {
return stage == NVN_STAGE_VS ? 0x110 : stage == NVN_STAGE_FS ? 0x510 : stage == NVN_STAGE_CS ? 0x310
@@ -1069,11 +1070,12 @@ void vk_c0_fill(uint8_t bank[VK_C0_BYTES], int stage, const p_bind_buf ssbo[16],
memset(bank, 0, VK_C0_BYTES);
int base = c0_ssbo_base(stage);
if (base < 0) return;
c0_table(bank + base, ssbo);
int rows = (int)(VK_C0_BYTES - (uint32_t)base) / 16;
c0_table(bank + base, ssbo, rows < 16 ? rows : 16);
if (stage == NVN_STAGE_TASK || stage == NVN_STAGE_MESH) return;
if (stage == NVN_STAGE_CS) {
memcpy(bank + 0x200, dispatch, 12);
c0_table(bank + 0x210, ubo);
c0_table(bank + 0x210, ubo, 16);
return;
}
const float max_point = 2047.0f;