Repository navigation
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.
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.
Resolve the ShaderDiskCache.hpp FormatVersion conflict as 78: main is at 68 and 69-77 are set by other open pull requests.
Re-derive the mesh-as-compute fallback on the current main: async MaterializeInBackground draw-stage path, Settled indirect path, deviceAtomicWorkgroupMemoryBarriers/meshInlineFunctions/ spannedShuffleThroughMemory targets, version 63 serializer with 58-61 blacklisted. Unify MeshDrawRunsAsCompute on mesh && (forced || !meshShader) at every call site with an explicit force flag; the layer condition stays out per review. Cap the CPU multi-record indirect mesh path with a loud Require plus a debt entry. The follow-up commit renumbers the serializer to 64 and the disk-cache format to 97.
…to 97 The rebase onto current main collides with its serializer 63 and disk-cache format 96: write version 64 with meshAsCompute after the spanned-subgroup flag, keep the emulated-barycentrics flag trailing, reject the blacklisted 58-61 range, and bump the disk format for the new mesh record layout in artifacts (304/568-byte static asserts). Adapt the fallback to current main APIs (BindComputePipeline) and bring the request-serializer, shader-memory and graphics tests to the new versions, including the shared meshAsCompute activation decision with an explicit force flag and a loud refusal for multi-record indirect mesh draws run as compute.
Three conflicts, all from boykopovar#24898 reworking the mesh argument path: - Recorder.hpp / Recorder.cpp: keep the 8-rule span (firstIgnored) and carry the compute-fallback flag on the same signature. - Draw.cpp: keep the non-indexed MeshArgumentRulesFor(draw) overload and the multi-record Require; propagate asCompute explicitly from recordMeshArguments, and leave the 3-argument helpers mesh-only so the boykopovar#24898 tests keep their mesh limits under APS5_FORCE_MESH_COMPUTE.
A pull request records debt through a fragment, not by editing the debt files (docs/dev/TechnicalDebt.md#fragments). Move the four entries into docs/dev/debt/changes/agc-mesh-fallback-compute.md, restore both debt files to main, and drop the stray leading space the direct edit left on the DB_RENDER_CONTROL entry. tools/debt_fold.py --check and tools/check_conventions.py pass.
boykopovar#25434 prebuilds graphics pipeline libraries on the first visit of a shader set and hands the compiled mesh program straight to the Pipeline constructor. On a device without VK_EXT_mesh_shader that created a VK_SHADER_STAGE_MESH_BIT_EXT stage from the compute-layout program once the constructor's mesh-shader Require was gone. Return false from Pipeline::Prebuild when MeshDrawRunsAsCompute is set, and require that no stage is still Mesh in the constructor when meshCompute is set, so any other caller is caught too. Verified on RTX 2060 SUPER, Linux x86_64, driver 620.73.04, with the validation layer: 23 focused tests pass in default, APS5_FORCE_MESH_COMPUTE=1 and APS5_NO_MESH_SHADER=1, 0 VUID- lines, layer inserted in every run.
…every path The guard exempted IndirectDrawPath::Gpu, so a mesh-path indirect draw that still carried that path with more than one resolved record fell through to the single-record resolve: recordMeshArguments copied front() into one argument buffer and the fallback issued one dispatch and one indirect draw, dropping every later record silently. Reject a compute-path draw with more than one resolved record whatever the path says, before anything is recorded. Per-record dispatch stays the follow-up already listed in the debt entry. Verified on RTX 2060 SUPER, Linux x86_64, driver 620.73.04, with the validation layer: 23 focused tests pass in default, APS5_FORCE_MESH_COMPUTE=1 and APS5_NO_MESH_SHADER=1, 0 VUID- lines, layer inserted in every run.
…eadback vertex shader On a device without VK_EXT_mesh_shader and fragmentShaderBarycentric, a mesh-path draw whose pixel shader reads barycentrics runs through the compute fallback, but its pixel shader was still compiled for the mesh stage, which declares SPV_EXT_mesh_shader in a SPIR-V 1.3 module, and the fallback refused barycentric inputs. The pixel shader of a draw run as compute is now compiled as on the vertex path, and the readback vertex shader writes the emulated interface itself: each corner is its own vertex of the triangle list, so it writes the one-hot weights of its slot, the 1/w-scaled weights for offset barycentrics, the three corners' per-vertex values and the provoking corner's flat values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kn5E2jBvwSg6P3XXp7MUJt
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
The mesh compute fallback and barycentric readback changes were inspected at head b496c74cc5726bf928a75f33d5c00864f0743cbe; I did not run tests, and the review is incomplete because several changed files were not fully read.
What I ran
No commands or tests were run. Author-reported test results in the PR description were not independently verified.
Results
| Check | Result | Note |
|---|---|---|
| Code inspection | not run | Partial inspection only |
| Tests | not run | Author reports Linux test runs |
Findings
Blocking
None verified in the code inspected.
Non-blocking
None.
Not verified
The full text of core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, and core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp was excluded from the review folder; I did not read those files through the pinned reader. Other included changed files were not all fully read. I did not independently verify the reported test results, title behavior, or Windows build.
To get this to a good state
Nothing is required. The optional next step is to complete inspection of the excluded and unread changed files and run the relevant checks on this head.
|
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.
|
|
Windows at this head ( Setup:
The added test lines have no platform guard. AI-assisted: yes. |
ligmaSec
left a comment
There was a problem hiding this comment.
The new fixture explicitly skips llvmpipe before inspecting which mesh path it will use. Could the skip be limited to native mesh compilation if the compute fallback works there? That would let the software Vulkan job exercise the readback vertex shader, while the existing pixel-count checks identify which native and iterated cases ran.
Source review at b496c74cc5. The trial merge conflicts in the device and graphics draw code. Native GPU execution remains unverified here.
AI-assisted: yes.
What
Depends on #17611. Until it merges, this diff also shows #17611's commits; only the top commit is this PR.
Problem. On a GPU with neither
VK_EXT_mesh_shadernorfragmentShaderBarycentric, #17611 runs mesh draws as compute, but a pixel shader that reads barycentrics still stops the draw:Recompiler.cppcompiles that pixel shader for the mesh stage, which putsSPV_EXT_mesh_shaderin a SPIR-V 1.3 module, and the validator refuses it. This is the stage-5 stop in the GTX 1050 Ti run on feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611 (25 of 47 titles, Lantern Miner PPSA58001 in the log).MeshComputeStagesrefuses barycentric emulation without native mesh shaders. This is the refusal that stops ccleste and PSteroid5 in feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611's reports.Fix.
BuildMeshBarycentricReadbackVertexShader). Each corner writes its one-hot weights, the 1/w-scaled weights for offset reads, all three corners' per-vertex values and the provoking corner's flat values.This is an alternative to #9387 (the tessellation route) for draws run as compute. The native mesh path and
main's native barycentric pairing are untouched. Debt: edits to #17611's fragmentagc-mesh-fallback-compute.md.Overlap with other PRs
tools/pr_overlap.pymeasures frommain, so it reports #17611's footprint too, and it fails closed. Counting only this PR's commit:tests/Mesh.cppwith feat(agc): look up table images at run time through a device image table on the GPU heap (APS5_GPU_PATH) #7642, feat(agc): GPU descriptor heap on VK_EXT_descriptor_heap (APS5_GPU_HEAP) #9508 and feat(agc): serve lane-keyed, pointer and runtime image-table columns #10193, which already conflict withmain.tests/execution/LayeredVolumeDraw.cppconflicts withmain's 3867c1e. I will resolve it when I rebase onto feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611 after feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611 itself is rebased.Tested
Linux, A/B against #17611's head
59203ed861on the same machine, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1.Full ctest (6844 tests), RTX 3070: native and
APS5_NO_MESH_SHADER=1have 0 failures on both heads.APS5_FORCE_MESH_COMPUTE=1fails the same 2 tests on both heads (agc_driver_tessellation_geometry,agc_driver_viewport_index).Focused set, 26 tests, under the validation layer:
APS5_NO_MESH_SHADER=1mesh_barycentric_emulationskippedAPS5_FORCE_MESH_COMPUTE=1mesh_barycentric_emulationskippedmesh_barycentric_emulationskippedThe PR adds no
VUID-lines: there are 0 on each device except Intel, which logs the same 48maxCombinedClipAndCullDistances-00710on both heads.The new tests catch the bug. Applied to #17611 without the fix, all three fail in every compute-path config: Intel and no-mesh with the SPIR-V 1.4 error from the GTX 1050 Ti logs, forced compute with
graphics interfaces disagree at location 0.Not tested: titles, AMD. Windows: build only.
Test details
-DANYPS5_ENABLE_SPIRV_TOOLS=ON.ctest -V -R 'agc_driver_mesh|barycentric|layered_volume|mesh_output|request_serializer|agc_driver_graphics'withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer, using the layer from LunarG SDK 1.4.363.0. Every log showsInsert instance layer "VK_LAYER_KHRONOS_validation", and none showswas not found but was requested.agc_driver_mesh_barycentric_emulationused to skip there. It now checks perspective, linear and iterated (offset) I/J pixels and raw per-vertex values against the reference: 932 pixels each on RTX 3070 (no mesh, forced) and Intel.agc_driver_meshadds non-indexed and indexed draws, front and back culling compared with the ordinary readback draw, and a flat input with the first and last provoking vertex.agc_driver_layered_volume_drawadds a layered mesh draw run as compute.objcopy --rename-sectionstep ("Invalid argument"), the same 36 on feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611's head. Tests can't run on this machine: its CPU (i7-3770K) lacks AVX2/BMI, and the host-CPU check stops them on both heads.Checklist
main; no other open PR implements the same functions (stacked on feat(agc): emulate mesh pipeline draws with a compute pass when VK_EXT_mesh_shader is unavailable #17611, which is on currentmain; feat(agc): emulate mesh-fallback barycentrics through tessellation #9387 covers the same draws through tessellation)NotImplemented_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)🤖 Generated with Claude Code
https://claude.ai/code/session_01Kn5E2jBvwSg6P3XXp7MUJt