Repository navigation
sync: upstream batch 13 and forced 1x MSAA resident view clamp - #528
Conversation
Add the PS4 functions sceVideoOutSetBufferAttribute and sceVideoOutRegisterBuffers on top of the existing registration. The PS4 call uses the first free attribute set and returns its index. It accepts linear A8R8G8B8_SRGB and A8B8G8R8_SRGB buffers, which map to the PS5 B8G8R8A8 and R8G8B8A8 formats. It throws for tiled buffers, whose PS4 layout differs from the PS5 one. Linear PS4 buffers may be 4 KiB aligned: the OpenOrbis graphics sample places its second 1920x1080 buffer 8,294,400 bytes after the first. PS5 buffers keep the 64 KiB rule. A handle with PS4 buffers writes the PS4 flip status (64 bytes) and vblank status (32 bytes). Writing the 128-byte PS5 flip status into the sample's stack structure overwrote its saved frame pointer.
v_cmp_X_f32 and v_cmpx_X_f32 flush their denormal inputs by bit 0 of the FLOAT_MODE f32 denormal field, as measured on RDNA2 (gfx1030): mode 1 keeps them and mode 2 flushes them. Both modes threw before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mode 1 keeps subnormal inputs and flushes a result below 2^-126 to a zero of its sign; mode 2 flushes subnormal inputs and rounds a subnormal result in the f32 round mode, as measured on RDNA2 (gfx1030) in every f32 round mode at IEEE=0 and IEEE=1. Both modes threw before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… code stepping sceFontCharactersRefersTextCodes fills a 64-byte FontTextCodes with the order and code of a text character and keeps the current, start and term characters at +0x28, +0x30 and +0x38. The traversal follows the PS4 11.00 libSceFont.sprx disassembly posted in the review of boykopovar#4050, which implemented the same rules: Refers never compares the character with the term and returns null for a clustered or synthetic character, sceFontTextCodesStepNext returns null at the term after visiting it, sceFontTextCodesStepBack returns null at the start character, and both steps skip synthetic characters. Null from StepNext at the end of the chain and from StepBack at the head of the chain is assumed and not covered by the report. The signatures follow Orbital's IDA type database and SharpProspero. A null cursor or output returns null as in KytyPS5; a null text character throws. guest_font_tests gets configure_windows_unwind so the expected exception reaches the test on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…large Since 7947149 every fiber ran on an mmap'd host stack so that host calls cannot overrun the small contexts PPSA01341 packs next to each other. A title that derives state from the stack pointer then reads the wrong memory: PPSA05684's job fibers have 512 KiB contexts at 1 MiB-aligned addresses and find their job record by masking rsp with ~0xfffff, so the job system lost track of a GameInit job and the game waited forever right after loading big4r/actor76.txt. Its 64 KiB fibers fault later on a host stack too. A fiber now gets a host stack only when its context is smaller than 64 KiB; a larger context is the stack again, as on the console. The limit sits between the 16 KiB contexts that need protection and the 64 KiB ones that need the guest stack (technical debt entry). The fiber test runs a 512 KiB fiber and checks that its stack is in its context; it fails without this change. AI-assisted: yes
sceAgcCbSetShRegistersDirect and the other register list writers threw on a count of 0 although the matching size functions report 0 words for it. PPSA05684 calls the writer with an empty list at its main menu and terminated. An empty list now writes no packet and returns the cursor, as its size says; a null buffer still throws. AI-assisted: yes
Adds fmin, fminf, fminl, fmax, fmaxf and fmaxl, the remaining missing members of the C99 minimum/maximum family, with the NaN propagation and signed-zero handling guest_fminf pins down (host std::fmin does not guarantee the sign of a zero result). The previous libSceLibcInternal copy of fminf is removed so the export stays single-owner. PPSA28319 imports fmaxf from libc.prx; the other five names were exported by nothing.
…e their deltas The console's mouse reports relative motion, so the host cursor can never line up with the cursor a title draws. While a title has a mouse open and the window is focused the host cursor is hidden and captured, released on focus loss or while the pad's mouse-to-stick toggle is on. Motion deltas are scaled from the presented image's size in window units to the title's display resolution with sub-pixel carry, so the title's cursor travels as far as the host pointer would, on scaled desktops and letterboxed windows alike. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
AI-assisted: yes
…lement For an indirect draw, whose counts only the GPU knows, the driver copies the whole range a vertex buffer descriptor covers, records * stride from the descriptor's address. The last record's element ends sooner when the attribute sits at an offset in its record, and the fetch can read at most (records - 1) * stride plus the element. Forspoken (PPSA03984) draws instances from a 48 MiB buffer of 96-byte records with six attributes at offsets 0 to 0x50 in each record. The copy for the attribute at 0x50 ran 0x50 bytes past the buffer into the unmapped page after it, and the draw stopped with "guest memory is not readable". VertexBufferExtent now ends at the last record's element, as VertexBufferReadSize does for the last record of a direct draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A depth surface is one level: the driver rejects draws that render a depth mip. A sampled or storage view at the surface's address and extent that starts at a later level, or a storage access to a later level, does not touch that level, so it is not the depth plane. DepthSurfaceTexture and DepthSurfaceStorage still sent such views to the surface, which rejected the level. Forspoken (PPSA03984) builds a depth pyramid from its 1984x1116 D32 depth surface with a compute shader that samples one level of a five-level R32F view and stores the next, and stopped there. Both now leave such views to the texture and storage caches, as they already do for a view of another extent or format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h modes Co-Authored-By: Claude <noreply@anthropic.com>
Implement sceNgs2GeomApply, which was previously an unimplemented throwing stub and was blocking Dead Cells (PPSA15552). The implementation validates null handles/output addresses and writes a minimal Ngs2GeomAttribute: pitch_ratio 1.0, source position, source volume/level maxima, and diagonal channel levels for the source's channel count. It does not implement source attenuation, distance rolloff, panning or Doppler. The export lives in Geom.cpp's internal Ngs2GeomApply and is exposed through the existing default-visibility wrapper in Voice.cpp. Unimplemented.cpp no longer defines the stub. A passing test was added to Ngs2Geom.cpp. Unblocks: PPSA15552 #<Game bring-up discussion number> Depends on: none AI assistance: yes
sceSystemServiceParamGetInt answered 0 for the time zone (parameter 4) and summer time (parameter 5), so the console looked set to UTC while libSceRtc and libc convert local time with the host's zone. Titles add the time zone in minutes and 60 more minutes when summer time is 1 to UTC to get the local time (Apollo, GoldHEN's frame logger). Both now follow the host's local time zone: summer time is whether it is in effect, and the time zone is the current offset east of UTC less the summer time shift while it is. On Windows that shift is the C runtime's own summer time bias (_get_dstbias), the one localtime_s applied, not a fixed 60 minutes. The UCRT reads the system zone when libc.prx loads and keeps that zone's bias after TZ is set later, so on a host whose system zone has no summer time (the CI runner's UTC) a TZ of CET-1CEST shifted by 0 and the time zone came out as 0. The cause and the change are screamm's, from the review. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ePosition A call site passes the handle and then x and y as zero-extended 16-bit values (the centre of the display size), and ignores the result.
Resolve the XCuZoBSVFG8 import required by Killzone Liberation by adding sceRazorCpuNamedSync as a no-op returning success when capture is inactive. Extend the RazorCpu behavior test and document the NID source and unverified console signature and capture behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
On Windows a test that returns from main ends through exit and ExitProcess, which kills every other thread before the prx static destructors run at DLL_PROCESS_DETACH. Detached host threads (the driver's async log thread, libkernel's file watch thread, ...) die holding winpthreads and queue locks, and a destructor that then locks a mutex, waits for the dead logger or destroys a condition variable never returns: the test prints its last line and hangs until the CTest timeout (boykopovar#6791). Every test executable now wraps main on MinGW. After main returns the wrapper runs the executable's own exit handlers and static destructors (_cexit), as exit does today, flushes the streams and ends the process with LibcTerminate_nid_no_patch, the path the guest exit already takes. That flushes the driver log while its thread is alive and calls TerminateProcess, so no DLL_PROCESS_DETACH work runs after the threads are gone. The libc shutdown callbacks are not run, as on a plain return from main on Linux. A test that does not load libc.prx returns as before.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24d450f7e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| DropReplacedDepthSurfaces(depthSurfaces, *depthCache, resource); | ||
| if (auto array = residentDepthArray(resource, storage); array != nil) return array; | ||
| if (auto view = residentView(resource, storage, compare); view != nil || resource.samples <= 1) return view; | ||
| if (auto view = residentView(resource, storage, compare); view != nil || (!Force1xMsaaEnabled() && resource.samples <= 1)) return view; |
There was a problem hiding this comment.
Keep single-sample textures on the guest-memory path
When ANYPS5_METAL_FORCE_1X_MSAA is enabled and an ordinary single-sample 2D texture has no resident view, this condition no longer returns nil, so binding proceeds into the multisampled-surface fallback. That fallback sets target.samples to 1 and calls MetalDepthSurfaceCache::Acquire, whose MetalColorSurface constructor rejects sample counts below 2; consequently normal guest-memory textures can throw during resource binding in forced-1x mode instead of being uploaded from guest memory.
Useful? React with 👍 / 👎.
| require(buffer.alignment == 65536u || (buffer.alignment == 4096u && buffer.tilingMode == 1), "VideoOut: 4 KiB display buffer alignment is only supported for linear buffers"); | ||
| require(buffer.address != 0 && (buffer.address & (buffer.alignment - 1u)) == 0, buffer.alignment == 65536u ? "VideoOut: display buffer requires 64 KiB alignment" : "VideoOut: display buffer requires 4 KiB alignment"); |
There was a problem hiding this comment.
Use the configured alignment when reading display buffers
For a PS4 linear buffer that is 4 KiB-aligned but not 64 KiB-aligned, registration now succeeds here, but ReadDisplayBuffer and ReadDisplayBufferTexels still call GuestMemory::Read(..., 65536). The Vulkan linear presentation path calls ReadDisplayBuffer unconditionally, so the supported PS4 layout fails at flip time with a misaligned-address error; the readers need to pass buffer.alignment as well.
Useful? React with 👍 / 👎.
| #else | ||
| const int summerMinutes = summer ? 60 : 0; | ||
| #endif |
There was a problem hiding this comment.
Account for non-hour daylight-saving offsets
On non-Windows hosts this assumes every active daylight-saving adjustment is exactly 60 minutes. Zones such as Australia/Lord_Howe use a 30-minute adjustment, so during DST the current UTC offset is +11:00 but this code subtracts an hour and reports a base zone of +10:00 instead of +10:30, causing both console time-zone conversion and any title-visible setting based on it to be wrong.
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Tested: