Exercise source-rate conversion through the real worker and AAC calibration across AVC, HEVC/PQ and AV1 receiver cases, including TLS. Check normalized duration independently and compare every submitted PCM sample before packet replay.
Center offline output on source frame zero and report the input lookahead needed for tail draining. Existing processing and reset paths remain unchanged. This supplies latency handling for worker-owned fractional recording conversion.
Check impulses, independent fractional-rate tone phase, chunk invariance and tail drain at 8-192 kHz. GCC/Clang sanitizers, Windows C89 and four NDK ABI builds pass; missing and one-frame compensation mutants are rejected.
Add enhanced RTMP receiver cases for HEVC 8-bit, HEVC 10-bit PQ and AV1. Verify decoded pictures, complete source PCM, source epochs and color metadata over standard/legacy RTMP, TLS 1.2/1.3 and video-only output. Preserve ten-bit samples in the comparison and retain AVC coverage.
Replay independently encoded AVC/AAC only at the encoder boundary while running the actual worker, PCM queue, AAC probe, FLV adapter and RTMP/TLS client. Check partial PCM acceptance, silent preroll, calibration removal, source PCM recovery, video epoch and EOS drain. Keep adapter-only checks and run both targets in CI.
Validation: GCC and Clang ASan/UBSan five-case receiver runs pass (standard/legacy RTMP, TLS 1.2/1.3, video-only). A two-millisecond actual worker video epoch mutation is rejected after successful transport. This is portable integration evidence, not native MediaCodec device acceptance.
Replay independently encoded AVC/AAC through the real native output adapter, shared FLV mux, owned RTMP client and TCP/TLS transport. Compare received packet counts, millisecond timestamps and independently decoded RGB/PCM bytes. Cover standard and legacy RTMP, TLS 1.2/1.3 and video-only output.
GCC and Clang ASan/UBSan matrices pass five cases each (120 pictures and 80 AAC packets per compiler). An adapter mutation shifting both media clocks by one second is rejected after successful transport drain. Metadata getters and encoded packet input are replayed: native MediaCodec, the calibrated worker and device capture are not established by this test. Add the matrix to Android CI and retain exact evidence.
The unsized uniform-buffer fixture uses a Vulkan extension added after the
system standalone validator. Running it through the old Vulkan 1.0 profile
rejects a legal Uniform/Block runtime array. Its std430 layout also needs the
standard uniform-buffer layout feature enabled during independent validation.
Use a pinned current SPIRV-Tools validator and matching headers in a dedicated
cached CI job. Keep Vulkan 1.0 for ordinary fixtures and Vulkan 1.1 for subgroup
operations; apply the extension fixture's required rules only to that module.
Do not skip incompatible-validator failures or relax other shaders' checks.
Deliberately misalign a member of the emitted UBO and require its rejection.
Validation: all 40 emitted SPIR-V modules pass current standalone validation;
the corrupted UBO fails alignment validation. Extended compiler and builder
contracts pass ASan/UBSan, and all five emitted GLSL programs pass glslang.
The pinned setup helper passes cold-source and cached-build runs. No production
shader compiler or device-feature admission is changed.
Connect the admitted desktop Vulkan encode queue to viewport recording through
an asynchronous worker. Capture GPU pixels in the renderer submission, publish
only successful submissions, and retain source/device resources through stop,
resize and deferred video reinitialization. Refuse unsupported devices, HDR,
formats and audio layouts before creating output. Start after the first core
frame so admission uses its actual audio layout.
Hold PCM on the existing worker queue until encoded video establishes its
clock limit. Trim trailing queued PCM at video EOS before AC-3 padding and
publish the actual consumed count after worker retirement. This prevents a
threaded resize from leaving audio beyond the last captured picture. Add no
producer locks, waits, pixel readbacks or pacing logs.
Configure selects the driver on desktop Vulkan builds with its dependencies;
existing default driver priority is retained. Add frontend admission/lifetime,
delayed-video PCM, terminal-result publication and native isolated-window
resize/reinit/stop regression coverage.
Validation: GCC/Clang ASan+UBSan frontend contracts, Vulkan encode contracts,
recording output/session/dispatch contracts and independent MP4 A/V checks.
Windows native recording passes threaded/direct multichannel float PCM at
32/44.1/48 kHz, plus resize, reinit and stop with Khronos sync validation.
Desktop Linux and Windows frontends build with automatic feature selection.
Native Linux GPU acceptance remains open. The unrelated extended RSLC unsized
uniform-buffer fixture is rejected by the installed standalone SPIR-V validator;
that check is retained as a failure, not reported as an extended-suite pass.
Own session startup, file output and retirement on a dedicated worker. Publish immutable pool borrows after startup, wake through the existing lock-free eventcount backend and wait for each producer to close itself before teardown. Add concurrent startup/cancel/error contracts and native GPU A/V acceptance for both capture paths. Threadless and locking-fallback configurations refuse admission.
Keep the producer clock and queue budget in source frames. Convert on the recording worker through AudioToolbox, retain converted packets across mux backpressure and retire native input borrows before queue teardown. Preserve the direct path for integral rates and extend conversion contracts through eight channels.
The X display server gains the vblank clock the setting's hold waits
on. It asks the Present extension for a notification at the vblank
count after the last one seen; the answer carries that vblank's count
and its time on the monotonic clock, for the CRTC the window is on.
The requests are made with xcb's own request call, so nothing beyond
libxcb is linked, on a connection of the clock's own: a wait is a
bounded poll of its socket, there is no thread, and no other thread's
events are read. A window destroyed, a server without Present or one
whose stamps are of another clock leave no clock, and the timer paces.
The GLX context says its swap tears with no swap interval where no
compositor shows the window: it asked to bypass one, or none runs.
samples/gfx/x11_vblank runs the clock against a real server in CI.
retro_vfs_file_write_at_impl() (filestream_write_at()) wrote without
touching the stream's size at all: after a positional write past the
end, or an append, retro_vfs_file_size_impl(), filestream_get_size()
and filestream_eof() still gave the size from before it. On master a
new test finds it on descriptor and stdio streams alike - grown files
reported at their old size, appends at 0, eof true in the middle of
the file.
A positional write that writes now marks the stream's size_grown, an
atomic of its own beside append_end (positional writers run on any
number of threads at once, so the hint bits that a descriptor write
marks are no place for it). It reads the mark first and sets it only
if unset, so writers on many threads don't all store to one line. The
next size query clears the mark and then asks the file, so a write
landing after the clear marks it again and none is missed: a
descriptor's size is the file's; a stdio or native Windows stream's,
which may still hold bytes of its own, the larger of the file's and
what its own writes reached. No lock, no wait.
Built where the size can be asked of the file (VFS_SIZE_LAZY, as for
the descriptor writes); where there is no positional I/O nothing
changes.
samples/file/vfs/vfs_positional_size_test: writes past the end, inside,
after a truncate, appends, and four threads writing interleaved records
at once, on descriptor and stdio streams, through the impl and through
filestream (get_size, tell, eof); it fails on master and passes now -
on Linux with and without mmap, under ASan/UBSan and ThreadSanitizer,
and as 64-bit native and C-runtime and 32-bit Windows builds under
wine - and is added to both samples workflows. vfs_size_contract_test
and the rest of the VFS suite pass as before (under wine, the same
three tests master fails there).
Cost: four threads of 64-byte positional writes on one stream, best of
five passes, four runs - 749/437/555/631 ns per write before,
623/415/672/598 ns after: within the run-to-run noise.
Every write on the descriptor path (a SEQUENTIAL_BULK stream opened to
write, to read and write, or to update a file in place) asked the file
position first - one lseek() per write call - for one thing only: to
keep stream->size, which retro_vfs_file_size_impl() hands back, up to
date. writev did the same once per call. Most write streams never ask
their size.
Now a descriptor write marks the size stale instead, and the next size
query asks the file once: one fstat() (_fstati64() on Windows), or a
seek to the end and back should that fail. A truncate sets the size
and clears the mark; the on-demand mapping asks the size the same way.
Nothing keeps a position of its own, so code seeking the descriptor
directly can't put anything out of step, and the size reported is the
file's own.
Where neither fstat nor _fstati64 answers for a descriptor (the
consoles), writes keep asking the position as before. stdio, native
Windows, NFS and SMB streams, and the positional and append writes, are
untouched.
samples/file/vfs/vfs_size_contract_test pins what a stream says its
size is - after appends, a write inside the file, one across its end,
a seek past the end and the write after it, an empty write, a writev
with an empty piece, a truncate and a write at the new end, and reads -
on the descriptor path for writing, reading and writing, and updating
in place, and on stdio, with retro_vfs_file_size_impl(), the size on
disk, and filestream_get_size()/filestream_eof()/filestream_tell(). It
was written against the code before this change and passed there
(Linux; 64-bit native and C-runtime and 32-bit Windows builds under
wine), and passes after it the same way, and under ASan and UBSan;
it is added to both samples workflows. The rest of the VFS suite passes
on Linux with and without mmap; under wine it fails the same three
tests master fails there (vfs_rename_replace_test,
filestream_rbuf_fault_test with C-runtime streams,
vfs_seek_contract_test's 4 GiB case in 32-bit).
Measured on Linux, 20000 writes to one SEQUENTIAL_BULK stream, best of
six passes, three runs: 64-byte writes 386/356/319 ns before, 271/255/
260 ns after; 4096-byte writes 1830/1616/1731 ns before, 1616/1574/
1637 ns after. Counted with strace over 7000 writes and a size query
per pass: 7000 lseek() before, none after, and fstat() once per query.
vfs_native_bench is unchanged within its noise (its write rows use
stdio streams).
The KMS display server gains wait_vblank. The CRTC's sequence is the
count and its stamp the time; the next vblank is a sequence event,
queued on a file description of the server's own - the context's
carries its page flips, which are left to it - and waited for with
the caller's bound. No thread. An inactive CRTC, one with a variable
refresh rate on, and a kernel or libdrm without the sequence ioctls
count nothing, and the timer paces as before.
The hold needs a present that tears, which on KMS is an async page
flip: the KMS context answers present_immediate as it queues one. KMS
shows nothing but fullscreen, so the hold no longer waits there for
the Fullscreen setting; that test moves from the wrapper to where the
frame info is filled. The setting is listed on KMS builds.
display_servers_kms_test drives the clock over a FIFO standing in for
the device, and drm_vkms_live runs it on a real kernel's vkms: thirty
vblanks one by one, a page flip's event still the master's.
glcore's GLSL path - what a build without slang draws through - had
only one-pass presets under test. Now, on the test core's software
frame:
- multi.glslp: two passes, the first into a framebuffer twice the
frame's size, the second at the viewport's;
- history.glslp, the core swapping its frame's halves every frame: each
half the average of this frame and the last, through PrevTexture;
- feedback.glslp: half the frame and half the pass's own last output,
through PassFeedback0, which settles on the frame;
- invert.glslp with the menu opened and closed over it.
All four pass on master: nothing to fix there. The test core gains
PATTERN_FLIP for the history case, and the job installs xdotool to
press the menu key. What the test cannot reach on X11 is a frame drawn
under HDR, whose target is not the backbuffer.
With a core running, glcore's GLSL path - what a build without slang
draws through - showed two faults:
- A software frame was black, or garbage. With a GLSL chain the frame
goes into a power-of-two square texture, and the upload wrote that
whole square from the core's buffer, which holds only the frame: a
read far past its end. Now only the frame is written.
- A GLSL preset was refused, the stock shader drawing instead. The
frontend reads which shaders a context runs from the context's flags,
and the window contexts (X11, WGL, DRM, Wayland, xegl, SDL3 and the
consoles') gave glcore slang alone. They now give glcore GLSL where
the build has no slang to draw through. glcore's own fallback to
GLSL whatever the flags said, from the last change, goes again: the
flags say it now, and the frontend and glcore agree.
The first pass also binds its own program before it draws, as gl2's
does, instead of drawing with whatever the menu or the last frame's
passes left bound.
Test: samples/gfx/glcore_glsl_menu/run.py goes on from the menu to a
test core (pattern_core.c, built by the test): a frame whose top
quarter is blue and whose rest is red on the left and green on the
right, as a software frame and on a GL core-profile hardware context,
320x240 and 640x480, with no preset and through invert.glslp (one pass
into a framebuffer, then the stock pass to the screen). Each must show
its colours where they belong and the right way up, inverted through
the preset. On master the software frames are black and the presets
are not applied; without the upload fix the 640x480 software frame
fails.
The missing firmware dialog underlines each file's path, and measured
the path and the text before it with the font for every line of it in
every frame the box was up. The width and offset are now kept with the
line and the font - its size and the font generation - they were
measured in, for the few lines such a box has, and the frames after
the first draw the underline from them.
msgbox_layout's firmware lane draws the dialog in Ozone, XMB and
MaterialUI and checks the one underline under the path, not under its
number, as wide as the path, in the frames drawn from what was kept as
well as the first.
The caret lane opens the input dialog in XMB and MaterialUI with 40
words typed, wrapped over several lines, at three screen sizes, and
puts the cursor at the start, inside a word, at the start of each
line the wrap made, on the space before it and at the end. The caret
must be drawn on the line of the character after the cursor, at its
left edge - for a space the wrap made a line end, after the line it
ends. The harness now also records the quads the drivers draw, the
caret being the one 2 px wide.
With the caret placed by wrapping the text up to the cursor again, as
both drivers did, the lane fails: before a word the wrap moved to the
next line, the caret sat at the end of the line above.
The rgui redraw lane runs RGUI as the runloop does - the box's text
handed over, the render, the frame, the framebuffer handed to the
video driver - and counts the uploads: one when the box comes up, one
for a newer box in its place, for the lit button moving and for new
text, one when it goes, and none for the frames between. With RGUI
redrawing the box every iteration it was up, as it did, every frame
was an upload.
The Vulkan presenter's drain submits one empty VkSubmitInfo rather
than a NULL batch, and the sample's stand-in still asserted the NULL
one and had no VkSubmitInfo: it stopped building. No job ran
samples/gfx/dxgi_present, which is how it fell behind; samples-gfx-kms
now runs it natively and under Wine.
present_immediate answered from the tearing flag and vsync alone. A
borderless fullscreen window on an output that cannot flip it straight
to the scanout - one driven by another GPU than the one rendering, for
one - is composed by DWM, and its present waits for a vblank whatever
its flags: Display Pacing On VBlank Events then released each frame a
display period before it showed. The drivers now also ask the swap
chain's output, through IDXGIOutput6::CheckHardwareCompositionSupport,
whether it flips a fullscreen window itself: once, and again after the
chain is resized. An output that cannot say is taken as composing, and
the timer schedule paces there as before.
It says what the output can do, not what it is doing: a window DWM
composes for the moment, under a notification, still answers yes.
glcore could only draw through slang. Most window contexts (X11, WGL,
DRM, Wayland, xegl) offer glcore slang and nothing else, and none where
the build has no slang or nothing to cross-compile it with: such a
build gave glcore no shader backend, and it drew a black screen - no
menu, no frame. configure therefore dropped glcore whenever slang was
off.
Now glcore takes GLSL when the context offers it no slang. Every GL
context runs GLSL, and glcore already has the GLSL backend and makes
the menu effects from their GLSL. configure keeps glcore when there is
GLSL even without slang, glslang or SPIRV-Cross. It stays off on
PowerPC Macs, native or cross-built, which have no GL 3.2 core context.
A default configure is unchanged; one with --disable-slang now builds
glcore as well.
Test: samples/gfx/glcore_glsl_menu/run.py, run by a new workflow
(Linux-glcore-glsl.yml) on a build with X11, OpenGL and the menu and
no slang, under Xvfb on Mesa's software rasteriser: glcore takes the
GLSL backend, the menu is drawn, and the Ribbon (with its glow) and
Bokeh show. Without the change it fails on all four.
Draws a Cancel/OK box in each of the three drivers against the null
video driver, through a display driver and font of the harness's that
record every piece of text drawn, where it went and how wide it is.
The box's text is numbered words no other menu text has, so its lines
can be told apart. Each lane checks that the words are all drawn, in
order, on the screen, a line height apart and above the buttons; that
the next frame - drawn from the wrap the driver kept - is the same;
that a frame at another size is laid out as one made afresh at that
size; and that a frame back at the first size is the first again.
The short lane fits the screen; the tall one fills the box on a small
screen, where Ozone and MaterialUI cut the text short. It found Ozone
drawing nothing at all of a box taller than the screen, and with a
driver's wrap kept across a size change, the box laid out for the
size before.
Since the menu installs its effects, gl2 made them from GLSL only, and
a build with Cg but no GLSL drew no background effect. Each effect now
carries a Cg source for GL as well (cg_gl in the effect description,
the six gl_shaders/pipeline_*.cg.h back, the ribbon's built from the
shared ribbon code as D3D9's is), and gl2 makes the program from it
when there is no GLSL program to be had. The Cg programs live in a
context of their own (gfx/drivers_shader/shader_gl_cg.h), so they
outlive the backend's context, which a preset change remakes, and go
with the video driver. Like the GLSL ones they draw from the mesh's
buffer, with their uniforms found once.
Two things drew wrong under Cg and are dealt with here:
- The backend's own program leaves its vertex arrays on between draws,
and one of them is the attribute an effect's position aliases. Left
on, it won: the ribbons were drawn from the wrong vertices, the
simple ribbon a solid blot of layer on layer. An effect's draw now
turns the backend's arrays off first.
- The Ribbon's glow left its GLSL program bound. gl2 under GLSL binds
a program for every draw, but the Cg backend's ARB programs do not
unbind it, and a GLSL program wins over them: everything after the
glow went through it, a grey screen. The glow's passes now unbind
their program when done.
gl2 also sets the GLSL dialect for its context whatever the shader
backend, so the GLSL effects build under a Cg chain too.
Test: samples/gfx/menu_effects/menu_effects_cg_test.c (make check-cg),
run in samples-gfx under Xvfb (Cg finds its profiles through GLX). In a
legacy GL context, through the Cg backend itself, every effect's Cg
compiles in its ARB profiles and draws the same whether or not the
backend's own program drew just before, and the glow leaves no GLSL
program bound. Without the two changes above it fails on the ribbon,
the simple ribbon and the glow.
menu_wrap_offset(), which finds where a byte of a string landed in its
word_wrap() or word_wrap_wideglyph() wrap, moves to stdstring.c beside
them as word_wrap_offset(), and MaterialUI and XMB call it from there.
It gave a glyph the wide-glyph wrap had put a line end before the
offset of that line end, so the input dialog's caret sat at the end
of the line above; it now gives the glyph's own.
word_wrap_offset_test wraps plain, wide-glyph and mixed text at every
width from 1 to 39, with line ends left or made NUL as the drivers
make them, and checks that every character lands on itself or on the
line end its space or newline became, in order, that the end lands
on the end, that no wrap more than doubles its text, and that the
caret before a word moved to the next line is on that line. It found
the wrong offset and the wide-glyph wrap's runaway at narrow widths.
The Ribbon's SM4 pixel shader took its TEXCOORD0 alone, while the
vertex shader writes SV_POSITION ahead of it. From SM4 on, a pixel
shader's inputs are matched to the vertex shader's outputs by
register, so the pixel shader read the ribbon's data from the wrong
register. On D3D12 the pipeline is not made, and the Ribbon is not
drawn; D3D10 and 11 draw it with whatever the driver makes of it.
vkd3d matches by name and drew it right, so it went unseen under Wine.
The pixel shader now takes the SV_POSITION in front.
With the Ribbon not drawn and its glow on, D3D12 also lost the icons:
the glow's passes run before the effect's own draw, and left their
pipeline, constants and a triangle strip bound, which the effect's
draw resets - but an effect with no pipeline is not drawn, and the
icons after it drew through the last glow pass. The glow passes now
leave the sprites' state bound when they are done.
Tests:
- samples/gfx/menu_effects: every effect's SM4 and SM5 pixel shader,
and the glow's, reads each input from the register its vertex
shader writes it to, checked from the bytecode's signatures. It fails
on the old Ribbon shader under Wine's compiler as under Microsoft's.
- samples/gfx/d3d_hdr_menu: a Ribbon scene (glow and particles on),
HDR off and HDR10, on D3D11 and D3D12: it must darken nothing of the
still menu and must show. With the Ribbon's pipeline refused and the
old glow state, it fails on both counts.
samples/gfx/d3d_hdr_menu runs retroarch.exe under Wine (vkd3d,
lavapipe) on an Xvfb screen of its own and shoots the XMB with the
plastic effect four times per driver: still and with the Snow effect,
each with HDR off and with HDR10 out. Then:
- still, HDR10 against HDR off: HDR10 encodes every pixel the same
monotonic way, so what is brighter with HDR off stays brighter. Each
HDR-off luma bin's HDR10 median must not fall as the bins go
brighter; plastic icons and labels shown darker than the background
break that order.
- snow against still, both outputs: the snow only adds white over the
same menu, so next to no pixel may come out darker.
Without the previous commit both drivers fail both HDR10 checks (the
labels' bin drops from 96 to 75; 0.19% and 0.24% of the screen darker
under the snow), and pass with it. The still shot is taken once the menu
is the same two seconds apart. About 50 seconds a driver.
A display under Wine reports no HDR, so RETROARCH_DXGI_HDR=1 now has
dxgi_check_display_hdr_support() take it as HDR-capable, as
RETROARCH_D3D9EX=0 keeps D3D9's legacy device testable; it is read once
when the driver checks the display. Not on UWP.
Windows-wine-views.yml, which builds retroarch.exe with D3D11, D3D12
and vkd3d's compiler, runs it after the views, with the XMB icons and
font from a sparse clone of retroarch-assets.
A setting, off by default. With Display Pacing, vsync off and
fullscreen, the hold releases each core frame on a vblank the display
server counted instead of sleeping to a deadline: the vblank nearest
the frame's due time, which accumulates in the content's period on the
clock, so 60 on 120 Hz and 59.94 on 60 Hz keep the content's rate. It
holds only where a frame's start cannot cost latency: the driver says
its present tears (the new present_immediate poke: Direct3D 11 and 12,
Vulkan in immediate mode), no variable refresh rate is in use, and the
content is no faster than the display. Everywhere else the timer
schedule paces, as it does with the setting off.
The display server's wait_vblank now returns a vblank count and the
latest one's time, with a bounded wait for the next. On Windows a
thread of its own sits in D3DKMTWaitForVerticalBlankEvent, which takes
no timeout, and counts; it parks unasked, and when the wait fails or
comes straight back. The hold waits two content periods at most, takes
no vblank that is old, and stands down when vblanks stop or do not
keep the display's grid - for good the second time running.
The harness drives the hold from a vblank clock of its own: the rate
at 60, 120 and 144 Hz, each case it stands aside for, and each way it
stands down. samples/gfx/win32_d3dkmt runs the Windows clock under
Wine on entry points of its own.
The adapter and VidPn source D3DKMTGetScanLine and
D3DKMTWaitForVerticalBlankEvent are asked about are those of the
monitor the window is on: bound when the window is made, and again
when it moves to another monitor or the display configuration changes.
The first display device that opens serves only until a window exists.
With displays at different refresh rates, Scanline Sync read the
primary's beam for a window on the secondary.
The binding is two atomics under a seqlock, written by the window's
thread and read by the video and main threads; the adapter left behind
is closed. samples/gfx/win32_d3dkmt builds win32_common.c with
HAVE_D3DKMT, which no Linux job compiled, and runs the binding under
Wine on entry points of its own.
Three additions to the built-in implementation, for a caller that
checks what it reads (the core signature check, which has kept its own
open/read/identity/map code per platform beside the VFS). Nothing that
exists changes: no existing hint, path or call behaves differently, and
every new branch is behind the new hint or the new calls.
RETRO_VFS_FILE_ACCESS_HINT_IMPL_STABLE, in vfs_implementation.h rather
than the frontend ABI: a read-only open of a local regular file on the
descriptor path, with no stdio buffer. It fails unless the file is
regular, and its size comes from that same answer (one fstat() on
POSIX, which is the probe an open makes anyway); it never waits on a
FIFO, never takes a controlling terminal and is not inherited
(O_NONBLOCK, O_NOCTTY, O_CLOEXEC). On Windows it shares the file for
reading only (_wsopen/_sopen with _SH_DENYWR, _O_NOINHERIT,
_O_SEQUENTIAL), so nothing writes, renames or deletes it while it is
open. Any other mode or scheme drops the hint and opens as before. The
UWP backend refuses it: it can't keep those promises, and a caller must
not think it has them.
retro_vfs_file_identity_impl(): which file a descriptor-path stream is,
read from its handle - volume, file id (Windows' 128-bit id where
GetFileInformationByHandleEx has it, else the inode), size, mtime and
change time, in seconds from 1970. One fstat() on POSIX.
retro_vfs_file_map_impl(): maps a descriptor-path stream whole and
read-only when asked, for a caller that wants to look at the bytes
rather than copy them out; the stream owns the mapping and drops it at
close. Reads, seeks and the position never see it (it is kept apart
from a FREQUENT_ACCESS mapping by its own internal flag), and a second
call returns the same one. NULL where nothing maps, so the caller
reads. The header says when a mapping is safe to read: a file nothing
else can shorten, on a local fixed volume.
UWP defines both calls (no identity, no mapping), so its link still
matches the C backend; tools/vfs_backend_parity agrees on 40 symbols.
samples/file/vfs/vfs_stable_test covers all three, including a FIFO
refused without waiting, a directory refused, Windows refusing writes,
renames and deletes while the file is open and allowing them after,
the mapping leaving the read position alone, identity following the
handle across a rename over its path, and opens without the hint
unchanged. It passes on Linux with and without mmap (and under ASan and
UBSan), and as 64-bit (native and C-runtime streams) and 32-bit
Windows builds under wine; it is added to both samples workflows. The
rest of the VFS suite passes as before (vfs_seek_contract_test's 4 GiB
case fails in a 32-bit build under wine on master too).
vfs_native_bench, master against this, three interleaved runs on
Linux: every row within run-to-run noise (open + 4 KiB read + close
2204/2207/2307 ns against 2246/2279/2190 ns; 1 MiB sequential reads
60.6/83.6/62.0 us against 63.5/62.2/59.1 us).
The six XMB background effects (ribbon, simple ribbon, simple snow,
snow, bokeh, snowflake) were baked into every video driver as fixed
shader slots, VIDEO_SHADER_MENU to VIDEO_SHADER_MENU_6. Each driver
carried its own copies of the sources, built them whether or not a menu
used them, and had a case per slot in its draw code.
Now the menu owns them. XMB keeps one table of the effects
(menu/drivers/xmb_effects.h) with each effect's sources for every
backend - GLSL (legacy and core), SPIR-V, HLSL SM3 and SM4, Metal and
GX2 - and how it draws (a mesh or a quad, its blend, whether it takes
the ribbon data, whether it flips Y). XMB installs them through
gfx_display_effect_install() and draws one by handing the draw its
effect. The drivers have a single generic path: an effect_install
callback that makes a program from the backend's source, and a draw
that goes by the effect's flags. VIDEO_SHADER_MENU..MENU_6 are gone,
and so is the shader backend's init_menu_shaders.
Installs are kept in a small lock-free table in gfx_display. The
programs are made on the drawing thread when the first effect is
drawn, all at once, so nothing is compiled while an effect is on
screen. When the video driver goes away the programs are dropped and
made again under the next one.
What this removes or speeds up:
- Menus that draw no effect (Ozone, MaterialUI, RGUI, XMB with the
effect off) build no effect programs at all.
- GL: effect draws use their own program with every uniform and
attribute location looked up once at compile. Before, every effect
draw looked up "time", "Ribbon" and "OutputSize" by name through
the shader backend, with prefix retries, each frame. The quads draw
from the full-screen mesh's buffer, as the ribbon draws from its
own: no vertices are uploaded per draw, and nothing is read from
client memory, which a core profile does not allow.
- GL core: effects no longer switch to and from the shader chain's
program through the chain path; the chain program is put back only
after an effect was drawn.
- D3D9 (HLSL and Cg): the constant registers/parameters are found once
when an effect is compiled, not on every draw.
- Vulkan: display.pipelines shrinks from 9 to 3 (plastic stays at its
own slot); the effect pipelines are made from the effect's own
SPIR-V and remade with the passes.
- D3D12: effect bytecode is compiled once; only the PSOs are remade
when the render target format changes.
- The seven Cg effect sources (gl_shaders/pipeline_*.cg.h) are gone.
Unchanged: the plastic effect and the stock shaders keep their ids;
fonts and other menus use them, and moving them buys nothing.
Behaviour notes:
- GL (gl2) effects need GLSL; a Cg-only GL build no longer draws
them.
- GL core draws effects only when built with slang (they come from
the SPIR-V); without it the background is plain.
- D3D9 HLSL no longer falls back to stock shading when an effect
fails to compile; the effect is skipped instead.
Tests:
- samples/gfx/menu_effects (new): every effect carries a source for
every backend, its flags hold together, and each source names the
inputs and uniforms the drivers set for those flags. Each GLSL
program is made through shader_glsl.c as gl2 makes it - GL legacy
and core profile, GLES 3 and 2, on Mesa's EGL device - its
locations checked and drawn once into a framebuffer. The SPIR-V goes
through spirv-val. Cross-built with mingw-w64, the HLSL is compiled
under Wine as D3D9 (SM3), D3D10/11 (SM4) and D3D12 (SM5) compile it;
what Wine's compiler does not yet support (SM1 branches and loops,
atan) is reported as skipped. Run in samples-gfx and
samples-gfx-d3d.
- samples/gfx/gfx_display_mesh covers install-once, re-making after
the driver is lost, and no draw without an install.
- samples/gfx/d3d9_failed_lock's ribbon test follows the new ids.
Replace the full-frame allocation with ordered in-place row moves. Copy forwards before the source/destination crossing and backwards after it. Windows x86 uses bounded stack chunks for overlapping backward moves, avoiding slow CRT memmove behavior.
Validated unchanged loans unlock directly without repacking or border-clear calculations. Capture the destination stride across forward row copies. Both Cg and HLSL share these paths.
Check overlapping 16/32-bit layouts, invalid loans and stack-chunk boundaries against immutable snapshots under ASan/UBSan, Wine and native Windows x86. Native x86/x64 benchmarks improve repacking and steady loans. D3D9/9Ex GPU readback and frontend links pass; Cg and unavailable platform branches are checked through the compile matrix. Griffin adds no diagnostics to its baseline.
Pool cached staging mappings for 32-bit software frames with a shader preset. Preserve the core layout until consumption, then perform any required DXGI conversion in place before the existing GPU copy. Keep stock dynamic uploads and the RGB565 fallback.
Decline copies while a cached-frame reader holds the mapping instead of waiting or unmapping it. Preserve mipmap generation and cover padded, cropped, converted uploads with native GPU readback.
Validated native Windows x86/x64, Wine, sanitizers and full frontend links, including D3D10-enabled Windows. The platform compile matrix checks unavailable branches; Griffin adds no diagnostics to its existing baseline.
Publish renewable mappings to the producer without changing stable-pointer pools. Use cached D3D11 staging memory when history presets already require a GPU copy; keep the stock dynamic-texture path and decline incompatible core loans.
Retire exposed mappings without waiting for cached-frame readers. A pinned reader keeps the mapping valid and takes the existing upload fallback.
Exercise pointer renewal, padded layouts, deferred installation and native D3D11 readback under sanitizers and Wine. Native Windows tests cover both x86 and x64. The portable compile matrix and SDK macro checks cover unavailable platform branches; Griffin adds no diagnostics to its existing baseline.
The load check adds paths only macOS builds: trust for cores inside
RetroArch's own app bundle, looked up through CoreFoundation, and the
check on Darwin's loader. Nothing built them on macOS. Run
core_signature, core_install_check and core_load_check with Apple clang
under ASan+UBSan and, as on Linux, under TSan, whenever their sources
change, the libretro-common files they build included.
The shipping objects of a build with the load check and the public
test key load cores the way users do, one mode a run: a startup -L
checked in place and answered from the menu (Load Once, Always Trust,
a core outside the cores folder, there also with its probe cached by
an earlier session, with content, a core that needs content, and one
that changes before Load Once, which asks again) or, with no menu,
refused or waiting for the seed; staged loads with and without a task
worker, one whose core changes before the core stage opens it, and
one marked as a lobby join marks the load in flight, past its preload
stage, which isn't parked; a playlist Run, a parked subsystem load,
and subsystem loads from a playlist and from netplay, which say a
refused core wasn't loaded; netplay lobby joins of a refused core,
its probe cached or not and, uncached, from the dummy core too, which
say so and leave netplay off; a quiet probe and a parked Load Core,
one that fails to open after Load Once, which says so, and, with no
menu, one refused again on its re-run, which says only that it was
refused; the first run's seed, a subsystem load while it runs, which
says the seed is still checking, and a core the seed passes that
fails to open, which says so where a held back load doesn't;
run-ahead's copy, Load Once lasting through Close Content until
another core loads, another load ending a waiting park, a built-in
core's load, which checks no core and ends a park as another core's
load does, and, on Windows, a \\?\ core path ending in '.' given to
-L, Load Core or a playlist Run, which is refused as named and asks
nothing.
The companion UI's Load Core has modes of its own: a first Load Core
of an untrusted core asks and Load Once starts it; Load Core of the
running core, of a trusted core and of one that needs content; and
Load Once on a parked Load Core whose core changed since its check,
which asks again, for the companion UI's start and the menu's load
alike. Some answers press the Security Warning's buttons through the
menu, as a pad does.
build.sh links the harness on macOS too, with ui_cocoa.m's main()
renamed; the no-menu re-run mode, which forces the quick check's
answer through ld's --wrap, is skipped there. The menu-harness job
builds with the check and runs every mode.
With a trust store, run-ahead gets its second instance back. The copy
task hashes the copy and compares it with the running core's hash:
from its check, or from its file, if that is still the file loaded. It
loads the copy from the file it hashed. A copy that doesn't match, or
won't load, is deleted and run-ahead keeps one instance.
A staged load's take now grants the stage's own quick pass even when a
probe's quick pass of another core took its place while the worker
opened the core, so that core keeps its record and run-ahead its
source.
core_load_check.c checks a core before it is opened: the quick check
on the main thread, else a task hashes it in slices of the shared I/O
window and keeps the result for the load, bound to the file it
checked. A refusal tells whether it only waits for the first run's
seed. Built with HAVE_CORE_LOAD_CHECK; nothing calls it yet. Its unit
harness runs in the samples-tasks job, under ASan and UBSan, TSan and
mingw-w64.
On Windows the check reads the file LoadLibraryW will load: a name
with no '.' is read as <name>.dll, and a \\?\ path ending in '.' is
refused, since CreateFileW opens that name as written while
LoadLibraryW may drop the dot and map another file.
The warning now opens the menu's confirm box with named buttons
instead of a list screen: its text in the box, then Cancel, Install
and Trust, or Cancel, Load Once and Always Trust This Core. Cancel
starts highlighted, Left/Up and Right/Down move between buttons, OK
presses the highlighted one, Back and Info cancel, and the answer is
logged. The box goes up for the pending request, waits while a
Cancel/OK confirm is open, and a press on a box an older request put
up chooses nothing.
The list screen goes with its text rows and their 40-character wrap,
the row labels and the handlers behind them; the strings the dialog
shows stay.
A classic confirm reads as Cancel and OK through the same getter, so
the drivers can draw one button row for every confirm. For the named
buttons it also says which pad icon each shows: Back on Cancel, OK on
the others, dimmed unless highlighted.
A tap whose press began on a box since replaced chooses nothing, a
hover measured on a replaced box is dropped, and a confirm set over
another box starts with nothing hovered.
The updater fetches <core>.sig into the core's staging folder before
the core itself; with checks on, a missing one refuses the update
there. Every download is then staged and checked under its install
name, and only a core that passes replaces the installed one, its .sig
beside it, its record made on the main thread. A refused core is named
in a message and the old core stays; Update Installed Cores carries on
with the rest. Builds without keys update as before.
Only a 404 or 410 for the .sig means the core is unsigned; any other
failure ends as a failed install, never as a bad signature. A checked
download that holds anything but the core and its .sig is refused.
The core's staging folder is cleared before a download and at every
end, a capped number of entries a tick, so a hostile archive can't
stall a frame. An update cancelled after the backup task moved the new
core in still places its .sig and records it.
Restoring a backup or using Install or Restore a Core now unpacks the
core under its own name beside the one it replaces and checks it with
the .sig kept beside what was picked. A restore from RetroArch's own
backup list may be an older build. Anything that doesn't pass goes to
the Security Warning; Install and Trust runs the restore again and
installs only when the core is still the one the warning showed.
On a Play Store build a core installed through Play Feature Delivery
is a link into the APK's read-only lib folder; a restore stages beside
the link and deletes it only once the core passes. Install and Trust
that can't run the restore again says so.
A backup gets a copy of the core's .sig beside it, whether it is
written or moved into the backups before an update, so a restore can
check it. Pruning and Delete Backup remove it with the backup.
When an update's install move puts the new core in, the old .sig is
set aside as in core_install_commit(), and the backup's copy of it
goes if the move rolls back.
Adds the check the install paths will use: a core is staged under
the name it is installed as, checked there and only then moved into
place. The check hashes the staged file even when a record or the
folder rule would pass the file in place: those vouch for the file,
not the download. A check reads as failed until it ends, so a cancel
is a failure.
The old .sig is set aside as <core>.sig.old while the core is renamed
in, then deleted, or renamed back when the rename fails; the new .sig
is placed and the identity read again after the rename. A crash in
between leaves a core without a .sig, never a new core beside the old
one's .sig, and a stray .sig.old is never put back. A core that passed
by its trusted hash keeps its staged .sig only if that .sig verifies
on its own.
The load check is off in the default build, so one job builds with
--enable-core_load_check and another with
--enable-core_signing_test_key. The test-key job only builds:
samples-tasks already runs the core_trust_runtime harness with the key
under ASan/UBSan, TSan and mingw-w64, and the core_signature harness
with it under ASan/UBSan and mingw-w64.
The value lives in the trust store, not retroarch.cfg, so no config
file can turn the checks off. Turning them off always asks first with
the OK/Back confirm, even with confirmations off; turning them on asks
nothing. The row is hidden when the feature is inactive, and in a
session whose store couldn't be read it shows its value but says it
can't be changed.
The row is a switch like Core Lock's: Left and Right leave it alone
when it already sits on that side, and Start resets it to On.
core_warning_push() holds one request, a copy of the check that failed,
and opens a screen built like Load Archive / Open Archive: the reason
and the full-access warning as rows above the choices, the line about
turning the checks off below, the cursor on Cancel. An install offers
Install and Trust, a load Load Once and Always Trust This Core, a core
that couldn't be read Cancel only. The text rows are wrapped short
because no menu driver wraps a label. The core updater's two refusal
messages are added with the rest.
The caller's callback gets the choice, or Cancel on Back, a newer
request or quit. Each request has a serial that its screen's rows
carry, so OK on rows built for an older request refreshes the screen
rather than answering the newer one. OK and Back take the screen off
the stack before the callback runs, so a callback that changes the
menu stack (a load starting content) isn't followed by a pop of the
wrong screen. A newer push runs the replaced request's callback with
Cancel inside itself, with the newer request already in the slot; a
choice made from there is ignored.
A request still pending when a stack flush (a tab switch, a menu
reinit) takes its screen away gets it back on the next frame; one
answered before its screen came up leaves none. Info on the screen
does nothing. core_warning_push() refuses during deinit's cancel and
when the menu driver shows no screens (null), so the caller keeps its
request instead of one nobody can answer.
samples/menu/core_warning drives the screen through the shipping
handlers, with core_signature.c rebuilt around the test key and a trust
store of its own.
With the load check built in, the first run with a store that was never
seeded hashes every core in the platform's built-in cores folder, a
read or a folder entry at a time within the per-frame I/O window, and
trusts each one, up to the store's 256 trusted hashes. Only what
lstat() calls a regular file is seeded, so a symlink in the folder
can't bring in a file that lives elsewhere; a hardlink's bytes are the
folder's own. On Android the seed walks <ApplicationInfo.dataDir>/cores,
which no intent extra moves, rather than the default core folder, which
follows the DATADIR extra; when ApplicationInfo can't be read the seed
doesn't run that launch.
The store is marked seeded once the walk finishes or the folder doesn't
exist. A seed cut short at quit, or a folder that is there but can't be
opened, is seeded at a later start. If trust was recorded for at least
one core, a notice says once that cores are now checked.
core_trust_runtime owns the one store: loaded at startup before any
core is opened, saved by a task after each change with one write out at
a time, and written once more at quit, within the exit drain's limit,
if a change didn't go through. A store that can't be read is left alone
and the session's changes stay in memory. With no keys compiled in,
nothing is loaded and the feature acts as if it weren't built. A
test-key build says so at every launch.
Test-key builds keep their store in core_trust.testkey, so what they
record never reaches a release build's store on the same account. On
macOS the store always lives in ~/Library/Application Support/RetroArch,
whatever portable.txt, RAPortableInstall or a Steam build say about the
app's folder.
HAVE_CORE_SIGNATURES builds the signature check and its trust store,
HAVE_CORE_LOAD_CHECK the check at every core load, and
HAVE_CORE_SIGNING_TEST_KEY the public test key. The first defaults on
where dynamic loading and the crypto library are, a line to turn off
for one target; the load check and the test key default off. configure
has --disable-core_signatures, --enable-core_load_check and
--enable-core_signing_test_key. griffin stops with an #error when
HAVE_CORE_SIGNATURES is set without HAVE_CRYPTO, as it does for
HAVE_S3, rather than failing on crypto/pk.c's missing symbols.