Repository navigation
feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable - #17611
feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable#17611SuarezPM wants to merge 15 commits into
Conversation
…out mesh shaders A mesh-path draw (the NGG primitive shader path) needed VK_EXT_mesh_shader. On a device without it, or for a draw whose targets have more layers than the device's maxMeshOutputLayers, the mesh program is now compiled as a GLCompute shader (SpirvTarget::meshAsCompute) that writes the draw's primitives and vertex records to a device buffer behind a VkDrawIndirectCommand header. A generated readback vertex shader (BuildMeshReadbackVertexShader) reads the records back for a triangle or line list drawn with vkCmdDrawIndirect, carrying position, parameters, clip and cull distances and the provoking vertex's layer. - The compute pass has its own pipeline layout with a compute push range; the draw's independent-sets layout lost the device on RDNA1. - The pass pins the program's subgroup size where the device allows it and refuses compute subgroups narrower than the wave, except the 32-lane subgroups that run a wave-64 program in paired lanes. - MeshDrawRunsAsCompute decides per draw: always without mesh shaders, and on a device with them when MeshDrawLayers exceeds maxMeshOutputLayers. - APS5_NO_MESH_SHADER=1 leaves VK_EXT_mesh_shader off. - Serialization version 43 stores meshAsCompute; the shader disk cache format is 45 for the record layout field. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nd it From review of the mesh compute fallback: - An indirect mesh draw run as compute sized its output buffer for four instances, and a record with more drew nothing. Its record is now read on the CPU (IndirectDrawPath::MeshCompute, which waits for the producer like the other CPU-read paths), and the buffer is sized from the groups and instances it resolves to. Mesh.cpp draws an indirect record with six instances. - The output buffer is bounded: a draw that needs more than 256 MiB (MeshComputeOutputLimitBytes) or maxStorageBufferRange throws. - docs/dev/ARCHITECTURE.md describes the compute pass and the readback vertex stage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main gained mesh-path point output with register and exported point sizes. The compute fallback's vertex record carries no point size and its readback draws triangle or line lists, so a mesh program with point output run as compute now throws instead of failing to emit; agc_driver_mesh runs its point cases on the native mesh stage only, and the debt file lists it. Rebased onto main: serialization version 45 after main's point and fused arithmetic fields, shader disk cache format 46. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…aders Supersedes boykopovar#9356 by billythemenace2; commits c0faaaf, fe9ac93 and ecf0a2b cherry-picked with authorship preserved, reconciled onto current main (serialization 57, disk-cache format 61) with fallback hardening and tests.
|
@SuarezPM as promised, the Intel HD 520 run. Intel HD 520 (Mesa 26.2.5, Vulkan 1.4.363, no
On llvmpipe Compared with the earlier #9356 run on the same machine (f49a25a), This PR sets AI-assisted: yes. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@sherySJ thank you for the HD 520 run — passing with 0 validation errors on real mesh-less hardware (Mesa ANV, no VK_EXT_mesh_shader) is exactly the evidence this fallback was missing, and it closes the hardware gap in our Tested section. The vanished layerCount-compatibility warnings in layered_volume_draw are a welcome bonus. Acknowledged on the version race: if #17056 merges first with 57/61, I will rebase and bump this PR to 58/62 (writer + bound + meshAsCompute gate + test assertions + FormatVersion) with fresh validation evidence, never resolving by keeping the shared numbers. On the skip guards: agreed, the five mesh tests skipping on no-VK_EXT_mesh_shader means the fallback path has no test coverage on the very devices it targets. I would rather not widen test semantics inside this PR without @oneandonlydean's call — happy to do it here if he wants it, otherwise I will open a follow-up letting those guards accept meshAsCompute so mesh-less hardware exercises the fallback. Let me know your preference. |
|
@SuarezPM a follow-up sounds right to me: it keeps this PR's review on the fallback itself. When it is up, tag me and I will run those five tests on the HD 520 with the layer, so the follow-up gets the same mesh-less evidence. |
|
Results from devices without Tests. I ran the 17 mesh, layered,
Titles. I reran the 34 ps5-homebrew-catalog titles that stopped on the mesh path in my last batch on
The HD 630 can't present under Xvfb, so the titles ran on the GTX only. |
|
Hi @SuarezPM @Gonic0, the current overlap scan for draft #16391 (WGSL/native-cache compatibility), against main Would #16391 → #17611 → #15548 fit your plans? The later integration must retain the mesh-as-compute target field and your serialization/cache format changes, keep the WGSL-only key suffix after native fields, and recalculate combined size assertions. If your stack is ready to land first, I can follow it instead. I have not tested the combined runtime behavior and am not recording this as agreed until you confirm. AI-assisted: yes. |
|
@GiannisG1 thank you for taking this to real hardware — this is the strongest evidence the PR has. Twelve titles going from instant death on the mesh check to full 90 s runs is exactly what the fallback exists for, and zero new VUIDs across three mesh-less devices is the validation result I could not produce here. Two honest caveats I am keeping: headless Xvfb proves they keep running, not that they render correctly, so pixel verification stays open. And on Pascal the barycentric refusal is now the next wall for most of the rest — that is the declared limitation (follow-up territory, see #9387), and refusing loudly is the correct behavior until someone builds that path. Thanks again for the three-device matrix. |
|
@SteelCrab thanks for the careful scan — and for asking instead of assuming. The proposed stack works for me, with a preference for #17611 first: it is green, review-ready and carries hardware evidence, while #16391 is still a draft, so landing ours first means you integrate onto a stable base rather than us rebasing onto a moving one. I confirm the constraints either way: the mesh-as-compute target field stays, serialization 57 and format 61 stay, the WGSL-only key suffix stays after the native fields, and the size assertions get recalculated for the combined key. Final order is @oneandonlydean's call and I am flexible if he wants it the other way — just ping me the day the first of the two lands so I can rebase the other one the same day. |
|
Hi @SuarezPM, Thanks, the compute pass reads well: the output is sized from the same group count the dispatch uses, indirect mesh draws on this path are resolved on the host before the size is taken, and the version bumps cover the new request field and artifact member. One blocker, on devices that do have VK_EXT_mesh_shader:
Example: the existing LayeredVolumeDraw mesh case (a 34-slice volume) on a device that reports 8 mesh output layers. On main it takes the mesh layer-window path in Could the draw-time decision match the compile-time one? The simplest fix is Smaller notes, not blocking:
|
The draw-time MeshDrawRunsAsCompute decision now matches the compile-time one (mesh && (forced || !meshShader)): on mesh-capable devices oversized-layer draws stay on the native layer-window replay instead of throwing in recordMeshCompute, whose pipeline has no compute stage there. Removes the now-unused MeshDrawLayers helper, scopes the BDA capability allowance to the compute/readback stages, documents the readback cache, and rewords the ARCHITECTURE section. Tests updated plus a literal 34-slice/8-layer regression.
|
@oneandonlydean thanks — sharp catch, and you are right about why it hid here: this card reports 2048 mesh output layers, so the oversized-layers branch never fired locally. Fixed in 7957c8e: Blocker. MeshDrawRunsAsCompute is now mesh && (forced || no-mesh-shader) at both draw-time sites (the shared 3-arg overload, so DrawCapture matches too), and the now-unused MeshDrawLayers helper plus its header declaration are gone. Oversized layers on mesh devices stay on the layer-window replay; compute only fires where the program was compiled with the record layout. The ARCHITECTURE.md sentence describing the old rule is reworded. Tests: the 32-slice/8-layer and depth-slice cases now assert the native window path, plus a literal 34-slice/8-layer regression mirroring your example. Re-verified from a clean build: 22/22 in default, FORCE (+1 expected skip) and NOMESH (+8 pre-existing skips), and -V validation runs with 0 VUIDs and no missing-layer warnings in all three modes. ShaderValidation:251. The mesh term came along with #9356, and on reflection it does not belong to native mesh: main lives without that relaxation today, so I scoped the allowance to the two new stages (meshCompute and meshReadback). Native validation behavior is now identical to main. Readback map. Agreed it deserves a record, but a code comment would break the no-comments rule, so I put it where the project keeps this class of notes instead: new entry in docs/dev/debt/libSceAgcDriver.md (Functional), with the LRU-or-cap follow-up spelled out. The PR body already listed it as a known limitation. One thing I could not cover here: a device with few mesh output layers running the layered-volume mesh case end to end — my 2048-layer card cannot produce that shape. If you have such hardware handy, that is the run I would trust most. |
|
Fine with me. #15548's own commit only touches the recorder, AI-assisted: yes |
… no longer has A mesh-capable device no longer runs a draw as compute because of its layer count, so the mesh-mode pixel shader gap in the barycentric entry cannot occur.
|
Data from a GPU without mesh shaders, running real titles: a GTX 1050 Ti (Pascal, NVIDIA 580.178.04 on Linux), which has no
I can attach logs, or rerun on a new head. |
|
@GiannisG1 thank you — this is the strongest title-level signal we have on a mesh-less Pascal part: 0/47 still running on On the 25 that stop at stage 5: your reading looks right, and it points at the emitter, not the validation. Most likely those 25 are hitting the declared barycentric limitation through the wrong error: on the compute fallback there is no barycentric path, so a mesh-path pixel shader that reads barycentrics should get the honest refusal (the #9387 follow-up), not a mesh-extension pixel module. I am keeping it out of this PR to avoid widening scope after review, and I have it as the pixel-side item of the guard follow-up alongside the per-record dispatch. To pin it, could you attach one full log for a single failing title from the 25 (command, stage 5 validation lines plus the surrounding shader-compile lines)? That tells us whether it is always the Conker ( I have added your GTX 1050 Ti row to Tested as combined title evidence (20 running / 25 pixel-stage ceiling / 1 + 1 separate), worded so it cannot be read as per-title support. AI-assisted: yes. |
|
Logs as asked, from the same runs as the table above. Each title is relinked with One of the 25 stage-5 stops, complete: Lantern Miner (PPSA58001) on this PR: Lantern Miner, #17611 59203ed (full log)Conker's Bad Fur Day (PPSA64065), Conker, main d237f5dConker, #17611 59203edProsperoAI (PPSA99004), ProsperoAI, main d237f5dProsperoAI, #17611 59203ed |
|
@GiannisG1 thank you — the logs pin the stage-5 ceiling. The Lantern Miner full log shows shader 0x200790c00 stage 5 failing with Conker: main stops at the stage-7 mesh recompile ( ProsperoAI is the one that needs attribution before anyone calls it pre-existing: main stops at stage 7, the PR advances (0x201d80f00/0x201d85b00/0x201d86400 prepared) and then submission 2 never completes (10 s x2) -> vkQueueWaitIdle -4 DEVICE_LOST -> abort/SIG6. Please rerun just ProsperoAI with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, confirm the layer is inserted, and attach the tail around I updated Tested to mark Lantern Miner log-confirmed and Conker/ProsperoAI as separate triage pending that repro. AI-assisted: yes. |
|
ProsperoAI (PPSA99004) rerun as asked, on the same build ( The layer is inserted: Validation: the run logs no What submission 2 is. It is not a present. The capture index: Ordinal 2 is the frame's graphics submit: 3591 dwords, 0.17 s after the first, followed by a suspend. Its PM4 has 22 Right before that submit, the driver prepares the frame's shaders:
So the device is lost while running a graphics submission that contains the mesh-path draw through this PR's compute pass. The device reports I can share the two captured submissions ( |
|
@GiannisG1 thank you — this repro is exactly what was needed, and it moves ProsperoAI from What you captured matters: submission 2 is a graphics submit (3591 dwords, 22 DRAW_INDEX_AUTO, no dispatches), the title waits on its own per-draw labels for the first nine draws and then on the closing RELEASE_MEM, which never lands. The mesh-path shader main stops on (0x201d80900) plus 0x201d80f00/0x201d85b00/0x201d86400 are prepared right before, on a device reporting mesh=0. So the device is lost inside a graphics submission that carries this PR's compute-pass mesh draw — not in present, not a Conker-style honest throw. Main cannot supply a control beyond stage 7 here, so neither Yes, please attach the two captured submissions with the index to this PR. Two pinpoint questions so the triage starts in the right place: (1) which of the 22 draws is the mesh-path one — do all nine per-draw labels advance, i.e. does the hang sit in/after the 13 back-to-back draws where the compute-pass draw presumably is? (2) where did the fallback's compute dispatch for that draw go in this capture — the submit shows no dispatch packets, so is it on a separate submit/queue or recorded elsewhere? No new rerun until those two are answered. Scope stays as agreed: this does not widen the PR (subset-only, and the 25 stage-5 titles are still the emitter follow-up), but I am flagging ProsperoAI to @oneandonlydean as the one open device-lost question needing his call before landing — single Pascal title so far, validation-clean, hang inside the fallback-carrying submit. Tested updated accordingly. AI-assisted: yes. |
|
The two captures with the index, and the answers. To decode an attachment, save its block and run
|
| draws | ES | PS | after the draw |
|---|---|---|---|
| 0-7 (3 vertices each) | 0x201d80000 / 0x201d80400 |
0x201d80200 / 0x201d80600 / 0x201d80700 |
RELEASE_MEM of 2…9 to 0x201c70000, then WAIT_REG_MEM on it |
| 8 (3) | 0x201d80900 |
0x201d80f00 |
nothing |
| 9-21 (6, draw 18 has 12) | 0x201d85b00 (draw 18: 0x201d86e00) |
0x201d86400 (draw 18: 0x201d87400) |
RELEASE_MEM 0xa to 0x201c70000 after draw 21 |
| end | RELEASE_MEM 2 to 0x201200000, the "submission 2" the title polls |
Draw 8's ES is 0x201d80900, the shader that main stops on at stage 7, so draw 8 is the mesh-path draw. There are eight per-draw labels, after draws 0-7. The ninth RELEASE_MEM to 0x201c70000 is the 0xa after draw 21.
I ran one more time with APS5_TRACE_LABEL=0x201c70000, which logs each packet aimed at that address as the driver processes it. All eight per-draw labels show up: 2, then 3-5 in one millisecond, then 6-9 in one millisecond. The 0xa after draw 21 never shows up, and the hang and abort reproduce. So the stall is at draw 8, the mesh-path draw, or in the 13 draws after it, before the label that closes them. The trace logs packet processing on the host, not GPU completion, so it cannot tell draw 8 from draws 9-21.
Q2: where did the compute dispatch go? Nowhere in this capture, by design: the capture is the guest's command stream before translation. In this PR, recordMeshCompute records the compute pass host-side, into the same VkCommandBuffer as the translated draw 8: vkCmdFillBuffer of the output header, a barrier, the compute pipeline bind and push constants, vkCmdDispatch (vkCmdDispatchIndirect for indirect draws), a barrier, then the vkCmdDrawIndirect from that output. So it is on the same queue and in the same host submit. Telling which host command hangs would take a host-side view, for example a RenderDoc capture or debug labels around the dispatch and the indirect draw. I can run either.
|
@GiannisG1 thank you — captures plus both answers, and the decode instructions are clear. This bounds the hang precisely: draws 0-7 all complete (labels 2-9 all observed via APS5_TRACE_LABEL), draw 8 is the mesh-path draw (ES 0x201d80900, the shader main stops on at stage 7), and 0xa after draw 21 never appears. So the stall is in draw 8's translated host commands or draws 9-21 — and you are right that the host-side trace cannot split those, since it logs packet processing, not GPU completion. Q2 is also settled: the compute dispatch is host-side in the same VkCommandBuffer as the translated draw 8 (fill header, barrier, bind, dispatch, barrier, draw-indirect), so the guest PM4 correctly shows no dispatches. No mystery there — it also means the hang candidates live in that host sequence: the dispatch itself (dimensions? shader hang?), the barrier/output handoff, or the indirect draw consuming it. Take the debug-labels run, not RenderDoc: labels around the draw-8 dispatch and around the indirect draw from the compute output will show in the log which side the hang is on, and RenderDoc on a hung frame may not capture cleanly anyway. Please attach the tail showing the last label reached, and if the dispatch dimensions for draw 8 are visible anywhere (groups x instances x layers), include them — a garbage/huge dispatch would explain exactly this signature (10 s timeout, DEVICE_LOST, validation-clean), and it is the first thing to rule out. No other rerun needed. Scope unchanged: emitter follow-up for the 25, draw-level follow-up for ProsperoAI, flag to @oneandonlydean stands as the one open device-lost question before landing. Tested updated to the draw-8..21 bound. AI-assisted: yes. |
|
@SuarezPM the debug-labels run is done. It answers the question differently than we both expected, and it corrects my earlier wording. There is no GPU hang and no host device loss. None of the ProsperoAI runs (the validation-layer run, the label run and the three below) printed a The 10 s run out while the host is still preparing draw 8's shaders on a cold shader cache. Setup: #17611
In runs 1 and A, the last host lines before the title gives up are the preparation of the next mesh-path draw's shaders ( Draw 8's dispatch is 1 × 1 × 1. It is a direct draw, and its compute pass is recorded as With a warm cache, ProsperoAI reaches the emitter issue you already attributed. After draw 8, the next mesh-path draw stops at The checkpoint tokens in the patch were not written. They use the same guards as Run A (cold cache): from label 2 to the abortRun B (warm cache): from label 2 to the abortLocal diagnostic patch (not part of any branch)diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
index 8fc57a17a91..843c1fc590e 100644
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
@@ -3080,6 +3080,23 @@ std::shared_ptr<Buffer> recordMeshCompute(const Context& context, VkCommandBuffe
if (indirect) std::memcpy(&resolved, arguments.Bytes().data(), sizeof(resolved));
const auto groups = indirect ? static_cast<std::uint64_t>(resolved.groups) * resolved.instances * std::max(resolved.layers, 1u) : static_cast<std::uint64_t>(inputs.meshGroups) * draw.instanceCount * inputs.meshLayers;
const auto outputLimit = std::min<std::uint64_t>(MeshComputeOutputLimitBytes, context.limits.maxStorageBufferRange);
+ const auto w159Token = [&](const char* what) -> unsigned {
+ if (std::getenv("APS5_GPU_CHECKPOINTS") == nullptr || GuestMemory::GpuLockThreadTag() != 0) return 0;
+ const auto token = AgcDriver::FaultTokenRing::Instance().Claim();
+ if (token == 0) return 0;
+ if (auto* entry = AgcDriver::FaultTokenRing::Instance().Mutable(token)) {
+ entry->submitSerial = 0;
+ entry->programAddress = 0;
+ entry->variantId = program.variantId;
+ entry->stage = static_cast<std::uint32_t>(AgcDriver::FaultStage::compute);
+ entry->argBuffer = 0; entry->argOffset = 0; entry->argStride = 0; entry->argCount = 0;
+ for (auto& word : entry->argWords) word = 0;
+ std::snprintf(entry->desc, sizeof(entry->desc), "%s", what);
+ std::atomic_ref<AgcDriver::FaultToken>(entry->token).store(token, std::memory_order_release);
+ }
+ WriteNvCheckpointToken(context, commands, token, 0);
+ return static_cast<unsigned>(token);
+ };
if (groups > outputLimit || groupBytes > outputLimit) {
char text[256];
std::snprintf(text, sizeof(text), "a mesh-path draw run as compute writes %llu groups of %llu bytes, past the %llu-byte output limit of the compute pass", static_cast<unsigned long long>(groups), static_cast<unsigned long long>(groupBytes), static_cast<unsigned long long>(outputLimit));
@@ -3099,9 +3116,18 @@ std::shared_ptr<Buffer> recordMeshCompute(const Context& context, VkCommandBuffe
context.BindComputePipeline(commands, pipeline.MeshCompute());
bind(VK_PIPELINE_BIND_POINT_COMPUTE, pipeline.MeshComputeLayout());
pushDrawConstants(pipeline, commands, state, draw, shaders, resources, pushBytes, pushStages, arguments.DeviceAddress(), !inputs.restartTable.empty(), inputs.meshLayerStride, true);
+ char w159Before[48];
+ const unsigned w159G = indirect ? resolved.groups : inputs.meshGroups, w159I = indirect ? resolved.instances : draw.instanceCount, w159L = indirect ? resolved.layers : inputs.meshLayers;
+ std::snprintf(w159Before, sizeof(w159Before), "mesh-cs dispatch%s g=%u i=%u l=%u", indirect ? " ind" : "", w159G, w159I, w159L);
+ const unsigned w159A = w159Token(w159Before);
if (indirect) context.Function<PFN_vkCmdDispatchIndirect>("vkCmdDispatchIndirect")(commands, arguments.Handle(), 0);
else context.Function<PFN_vkCmdDispatch>("vkCmdDispatch")(commands, inputs.meshGroups, draw.instanceCount, inputs.meshLayers);
RecordMemoryBarrier(context, commands, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, VK_ACCESS_SHADER_WRITE_BIT, VK_ACCESS_INDIRECT_COMMAND_READ_BIT | VK_ACCESS_SHADER_READ_BIT);
+ const unsigned w159B = w159Token("mesh-cs done, before draw-indirect");
+ std::fprintf(stderr, "[w159] mesh-cs record: variant %llu indirect=%d groups=%u instances=%u layers=%u (record-time%s) total=%llu groupBytes=%llu outputBytes=%llu tokens before-dispatch=%u after-barrier=%u\n",
+ static_cast<unsigned long long>(program.variantId), indirect ? 1 : 0, w159G, w159I, w159L,
+ indirect ? ", host copy of the indirect arguments" : "", static_cast<unsigned long long>(groups), static_cast<unsigned long long>(groupBytes),
+ static_cast<unsigned long long>(outputBytes), w159A, w159B);
return output;
}
|
|
@GiannisG1 thank you — and thanks for the correction, stated that plainly: no host device loss, no GPU hang. The -4/abort is the title's own driver timing out its 10 s fence wait, and my What the label run establishes: draw-8 dispatch is 1x1x1 (3584 B/group, 3600 B output), so the huge-dispatch hypothesis is ruled out; cold cache spends ~5.5 s preparing draw 8's pair (0x201d80900 as compute + 0x201d80f00), which does not fit the title's 10 s window together with the rest, so runs 1/A abort title-side; warm cache (7 ms) completes submission 2 and stops at the same stage-5 emitter ceiling at 0x201d86400, thrown as an honest error. So warm ProsperoAI joins the emitter-follow-up group, and cold ProsperoAI is a title-timeout-during-first-use-prep story — worth noting runs with ANYPS5_NO_SHADER_CACHE=1 can never leave that path, since every run pays first-use prep. On your diagnostic patch: understood, local-only and never pushed — keep it that way, the w159 scaffolding must not enter the repo. The record-time dimensions line is the useful artifact and you already pasted its output; the checkpoint tokens wrote nothing because their guards skipped, and with no device loss nothing needs them. Remaining open item is now only the Conker address mapping (mesh-output vs title import), still separate triage. Tested updated: ProsperoAI as emitter-group on warm cache / title-timeout on cold cache, Dean flag withdrawn. AI-assisted: yes. |
ligmaSec
left a comment
There was a problem hiding this comment.
I compiled the exact request serializer. A request using meshAsCompute round-trips here, but main c1601e56d5 rejects it as truncated. This reader also rejects main’s version 64 split-state capture, and both layouts claim version 64. A further exact version 64 cross-check with typed storage merges in #17056 failed in both directions. Reconcile the request version and legacy decoding when resolving the current conflicts in RequestSerializer.cpp, cache keys, mesh draw, and device integration.
AI-assisted: yes.
|
@ligmaSec confirmed with the exact code on both sides, and it is real — the collision @sherySJ predicted. Ours ( The full inventory for the rebase, since the PR is dirty anyway and this rides it:
No code in this cycle: the renumber lands with the rebase onto current main, together with the AI-assisted: yes. |
What
Emulates mesh-path draws through a compute pass on devices without
VK_EXT_mesh_shader(or withAPS5_FORCE_MESH_COMPUTE=1). Supported subset only (see Known limitations). Supersedes #9356: commits c0faaaf, fe9ac93 and ecf0a2b by @billythemenace2 are cherry-picked with authorship preserved, reconciled onto current main (recompile-request serialization 64, disk-cache format 97) with fallback hardening and tests; commit 479fb1c and the merge are mine.Activation matrix (capability x flag):
maxMeshOutputLayers): native layer-window path, not compute (draw-time decision matches the compile-time one)Tested
Linux x86_64, NVIDIA GeForce RTX 2060 SUPER (driver 615.78.08). Unit/execution coverage local (below) plus real-hardware runs by contributors (see Real hardware):
APS5_NO_PRESENT_QUEUE=1, also orthogonalmainb8b8f49250and on the same tree with this head merged, both 0 failed and 0 VUIDs with the layer inserted in every Vulkan test.agc_driver_meshskips on main and passes here;agc_driver_layered_volume_drawtakes thetarget.meshAsComputebranch and its "mesh draw run as compute" check passes. First RDNA1 (gfx1010) data point, one generation from the console's gfx1013APS5_FORCE_MESH_COMPUTE=1; a temporary probe counted 40 compute dispatches in the forced run (37 inagc_driver_mesh, 13 of them indirect) and removing the two dispatches fails exactly the three tests that depend on them. First run where both routes execute on one cardVK_EXT_mesh_shader(thanks @GiannisG1): 47 catalog titles that stop at the mesh-stage recompile onmain, 90 s each headless Xvfb, head59203ed861merged ontomaine09d1349b5with-DANYPS5_ENABLE_SPIRV_TOOLS=ON-- 20 keep running the full session vs 0 onmain(Crux2, DK64 Rekompiled, DevilutionX x2, James Pond 2, Links Awakening, Mario 64, OGBox, PSFlyCast, Rush 2, Second Coat London, Shining Force III, Ship of Harkinian, SpeedBreaker, SwanStationPS5, TrinityX360, VLC, Wave Race 64, Wind Waker HD, osu!); 25 stop at the mesh-path pixel shader (stage 5) with SPV_EXT_mesh_shader extension requires SPIR-V 1.4 or later (log-confirmed: Lantern Miner shader 0x200790c00 stage 5; pixel module still declares the mesh extension on the compute path -- emitter follow-up, not this PR); Conker (guest memory unreadable at 0x4009000000 after passing the mesh draws, honest throw, separate triage still open) and ProsperoAI (debug-label run 7199688305: no host device loss, title-side 10 s fence timeout + abort; cold cache ~5.5 s preparing draw-8 pair 0x201d80900/0x201d80f00, warm cache reaches the same stage-5 emitter ceiling at 0x201d86400 as the 25; dispatch 1x1x1 rules out huge dispatch; Dean flag withdrawn, emitter follow-up covers it)main(bc4cddf422, perf(agc): prebuild graphics pipeline shader libraries off the GpuMutex on first visit #25434 included) and fixed the prebuild collision it introduced:Pipeline::Prebuildreturns false whenMeshDrawRunsAsComputeis set, so the compiled mesh program is never handed to a graphics pipeline library on a device withoutVK_EXT_mesh_shader, and the constructor now requires that no stage is still Mesh whenmeshComputeis set. Re-verified with the validation layer: 23 focused tests pass in default,APS5_FORCE_MESH_COMPUTE=1andAPS5_NO_MESH_SHADER=1, 0VUID-lines, layer inserted in every runKnown limitations (follow-ups, not in this PR): compute readbacks have no eviction yet; multi-record CPU indirect mesh draws run as compute throw instead of dispatching per record (see debt entry); a mesh shader writing a viewport index other than the fallback path has no dedicated throw (no cheap signal; documented for review); no execution-level test pins the per-draw meshAsCompute override; no defensive meshAsCompute => !meshWindowBuffer assert in Recompiler/SpirvEmitter (only the two driver constructors set the flags).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Overlap note: tools/pr_overlap.py fails closed listing open PRs with adjacent files (the tool timed out on a full scan here, so this note is manual). #16413 landed and is integrated in this branch (its async MaterializeInBackground path now hosts the re-derived per-draw override; no action left). #15548 stacks on top of this PR and needs a rebase after landing (size asserts already account for the mesh key field). Manually compared hunk-by-hunk against current main: #15917 touches adjacent lines in the same functions (buildTarget, emitVariant, SpirvTarget, cache-key append, Emit mesh-window area; different lines, should auto-merge); #16115, #16260, #16088, #16474, #16887 share files but all hunks are 25+ lines away; docs-only adjacency in ENVIRONMENT.md/debt files is append-style. #9356 overlap is by design (superseded).