Repository navigation
fix(agc): start the sample location registers at their clear-state value - #4949
oneandonlydean merged 1 commit into
Conversation
|
Tested with a title: Resident Evil 4 (PPSA07411) on Windows Server 2025, RTX 3060.
|
|
Correction to my previous comment: "renders" overstated it. In a 10-minute run with this PR the title presents frames at 59.95 FPS without any error, but every captured frame is black: it is stalled on what looks like a file-loading wait, which is unrelated to sample locations and which I am looking into separately. What this PR changes for the title is only that the |
|
Another data point for the title in the description: in three of my saved runs of PPSA07411 (2026-10-12, before this change) the title stops with AI-assisted (Claude Code). |
f982c7e to
c55e2f9
Compare
|
I rebased onto |
|
Resident Evil Village (PPSA01556, 01.210.000) stops on the same line on With this PR's |
A draw with PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES > 0 whose context never wrote PA_SC_AA_SAMPLE_LOCS_PIXEL_* (context 0x2fe-0x30d) was rejected with "missing register in context bank at DWORD 0x2fe", because the registers were absent from the initial context (PPSA07411 stops on it after two frames). The MSAA_ENABLE single-sample path read them the same way. The sixteen registers now start at 0, both initially and after CLEAR_STATE. That is the value in libSceAgc's own register defaults (sceAgcGetRegisterDefaults2, every public table that holds context registers, the tables the initial context already follows for PA_SU_VTX_CNTL and PA_SC_CONSERVATIVE_RASTERIZATION_CNTL), in amdgpu's GFX10 clear-state table (clearstate_gfx10.h, gfx10_SECT_CONTEXT_def_8, loaded by gfx_v10_0_cp_gfx_start before CLEAR_STATE) and the GC 10.3 register reset value (gc_10_3_0_default.h). RADV, radeonsi and PAL always write the locations themselves and do not settle the unwritten value. 0 puts every sample at the pixel center. That is not the standard pattern for any sample count, so such a draw decodes as custom locations at the center, as a single-sample scan into a multisampled target already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c55e2f9 to
15955c0
Compare
What
A draw with
PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES> 0 whose context never wrotePA_SC_AA_SAMPLE_LOCS_PIXEL_*(context0x2fe-0x30d) was rejected withmissing register in context bank at DWORD 0x2fe (766).decodeSampleLocationsreads the registers withread(), and they were not in the initial context. The same happened on theMSAA_ENABLEsingle-sample path, which reads them withread()beforesingleSampleMsaaRejection. Resident Evil 4 (PPSA07411) stops with this error after two frames.The sixteen registers now start at 0, both initially and after
CLEAR_STATE, in the same way earlier fixes addedPA_SU_POLY_OFFSET_CLAMP,SPI_PS_INPUT_ENA/ADDRandSPI_PS_INPUT_CNTLto the initial context. The value comes from:sceAgcGetRegisterDefaults2,RegisterDefaultsData.hpp). Every public table that holds context registers (V0, V4, V5, V7-V11) sets0x2fe-0x30dto 0. The same tables supplyPA_SU_VTX_CNTL = 0x2dandPA_SC_CONSERVATIVE_RASTERIZATION_CNTL = 0x6000, which the initial context already uses. amdgpu's GFX10 values for those two registers (0x5 and 0x100000) are different, so these tables are the console's own source.clearstate_gfx10.h,gfx10_SECT_CONTEXT_def_8from0xa2f5. All sixteen registers are 0 there.gfx_v10_0_cp_gfx_startloads that table beforeCLEAR_STATE.gc_10_3_0_default.h,mmPA_SC_AA_SAMPLE_LOCS_PIXEL_*_DEFAULT = 0.The Mesa and PAL drivers write the registers themselves and never read the unwritten value, so they don't settle it. RADV calls
radv_emit_default_sample_locations(radv_device.c) whenever no custom locations are bound. radeonsi'ssi_emit_sample_locations(si_state_msaa.c) writes the pattern for each sample count, including 0 for 1x. PAL'sMsaaState::WriteSamplePositionswrites the client's quad pattern on everyCmdSetMsaaQuadSamplePattern. Their 1x pattern is also 0, which means the pixel center.With 0, every sample sits at the pixel center. That is not the standard pattern for 2, 4 or 8 samples, so such a draw decodes as custom sample locations at the center (
customSampleLocations, all locations 0). A single-sample scan into a multisampled target already decodes this way. As for any custom pattern, the draw needsVK_EXT_sample_locationsfor its sample count. Without it, the draw throws the existingcustom sample locations require VK_EXT_sample_locationserror.The run log doesn't contain the value of
PA_SC_AA_CONFIGor of the failing draw's registers. The draw sets its context withSET_CONTEXT_REG_INDIRECT, and the register lists are in guest memory. The only draw in the failing submission (queue 0x0, serial 8) isDRAW_INDIRECTwithVGT_DRAW_INITIATOR = 2(auto-index, not indexed). The error reaches the title throughDriver::CheckFailurefromsceAgcCreateInterpolantMapping→ResolveGraphicsAbi. Whether the title draws further is not known: this PR was not run on the title.Tested
Windows Server 2025, MinGW (winlibs), NVIDIA RTX 3060.
agc_driver_graphics: the newUnwrittenSampleLocationTestsstart from a fresh queue state with the draw's registers written on top and no sample-location registers. They check:0x622ae6ae) still decode as standard.0x22eea66a) still decode to the same coordinates.CLEAR_STATEresets the registers to 0.more than eight samples, and a mismatched exposed count still throwsexposing fewer samples, both with unwritten registers.MSAA_ENABLEon a single-sample target with unwritten registers decodes.On
mainthe test fails. With the initial-context assertion disabled, the decode fails with the title's message,AGC graphics: missing register in context bank at DWORD 0x2fe (766). With the fix, it passes.Also passing:
agc_driver,agc_driver_pm4,agc_driver_pm4_failure,agc_driver_msaa_enable_single_sample,agc_driver_alpha_to_coverage,agc_driver_draw_cache_reuse,agc_driver_draw_cache_reuse_off,agc_driver_depth_fast_clear_submit,agc_driver_prepared_graphics,agc_driver_prepared_unregistered_graphics.Not run on the title.
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)🤖 Generated with Claude Code