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.
Whoever can change RetroArch's own .app bundle, or the read-only mount
its binary runs from (Flatpak, AppImage, Snap), can replace RetroArch
itself, so cores there are exempt like it. Linux compares mount ids,
not devices: a Flatpak user install's read-only view of the home shares
/app's device. Not on Windows, Android or the BSDs.
The bundle is looked up through CoreFoundation, which RetroArch and the
core_signature and core_install_check harnesses now link on macOS.
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.
Derive the native Metal backend from a shared SDK floor rather than a desktop-only target check. Add shared RTMP/FLV flags to the existing Apple network configuration and let griffin include the existing native implementation units. Extend the real SDK audit to compile the actual C frontend using automatic backend admission, with ARC kept out of C compilation.
This is an unlanded integration candidate. SDK compilation, full Apple application linking and physical-device recording/streaming acceptance are pending.
rgif now loads GIFs wherever RetroArch loads images: thumbnails and
backgrounds through task_image, the image viewer core, the file browser
and the image_texture/image_transfer layer underneath them all.
rgif:
- the image_transfer interface the other decoders have:
rgif_set_buf_ptr, rgif_set_avail, rgif_header_ready and
rgif_process_image, giving a 32-bit texture of its own, ARGB32 or
ABGR32 in native byte order
- RGIF_ABGR, for ABGR32 on big-endian targets
- a file not all read yet gives IMAGE_PROCESS_WAIT and is not touched;
the image is decoded in one call once it is all in
Wiring, as HAVE_RTGA is wired:
- IMAGE_TYPE_GIF (image.h) and NBIO_TYPE_GIF (task_file_transfer.h),
both appended so no other value moves
- image_texture_get_type: .gif
- image_transfer: new, free, start, is_valid, set_buffer_ptr, process,
set_avail; the support matrix gains a GIF column
- task_image and task_file_transfer: GIF is an image task
- FILE_TYPE_GIF ("gif", "GIF"): opened as image content
- the file browser's image extensions, the image viewer core's
extensions, the System Information list ("GIF (RGIF)") and
--features ("RGIF"); SUPPORTS_RGIF in config.features.h
- griffin.c, Makefile.common (rgif.o), configure (HAVE_RGIF=yes), and
next to HAVE_RTGA in every platform Makefile, the Android, Apple,
MSVC, UWP and QNX projects and the CI compile matrix
- tools/settings_check.py and tools/stack_budget.py check with it
Also: menu_displaylist's image viewer extension list wrote "tga"
without moving its length on, so "webp" and "dds" landed on top of it
and TGA dropped out of the list; it moves on now.
Tests: rgif_test checks the texture in both byte orders against
rgif_decode, the wait before the whole file is in, and a refused file;
image_decode_fuzz sweeps GIF too (every byte of a small GIF set to
edge values, and every truncation), under ASan and UBSan. The griffin
unity build with every codec, the touched objects in a configured
build, the MinGW/C89 syntax check, the overlap check and the stack
budget pass.
altool from Xcode 27.2 logs an ERROR line about
CDUploaderStateInfoResumeFilePath even when the upload succeeds, and
fastlane fails the upload on any ERROR line from altool. Skip that line
so upload_to_testflight continues to processing and tester distribution;
every other altool error still fails the upload.
lakka.h and lakka-switch.h join the rest of Lakka's OS layer in
os/lakka; switch_performance_profiles.h, which only HAVE_LIBNX builds
read, starts os/libnx. Includes and the iOS Xcode projects follow.
rslc is the slang compiler everywhere. ./configure --enable-glslang
--enable-spirv_cross links the system's glslang and SPIRV-Cross next to
it when both are found, and only then does Settings > Drivers offer a
Shader Compiler choice between the two: one setting read per stage
picks the path, with nothing copied.
The MSVC 2010 project builds Vulkan and rslc. Samples that used the
vendored copies run on rslc or the system's SPIRV-Cross.
The MSVC projects (2012 to 2026, UWP and the legacy Android one) build
rslc through griffin_rslc.c in place of glslang and SPIRV-Cross, as do
RetroArch_OSX107 and RetroArch_iOS11_Metal through griffin.c, and the
unix griffin build in Makefile.griffin. WANT_GLSLANG, which no
platform makefile set any more, is gone from Makefile.griffin, ngc and
wii.
rslc's MSL compiles under Apple's Metal compiler where SPIRV-Cross's
does: array, matrix and struct varyings go in one stage member per
element, column or field; length, distance, dot and normalize of
scalars, x *= M, and constructors mixing scalars and vectors or
running past a vector are spelled out; program-scope constants are
built from columns of literals, so Metal needs no global constructor;
decay and quad no longer clash with Metal's names.
Every non-bezel preset of slang-shaders gives glslang's picture on
metal, or one within the rounding where Metal's fast math orders the
two texts differently, so auto compiles with rslc on every driver.
configure builds rslc alone on macOS too, and the Xcode projects take
rslc through griffin.c in place of glslang and SPIRV-Cross.
The image gate runs metal (-d metal, pattern_core.dylib), and without
timeout(1) where macOS has none.
Open supported external media in the fullscreen menu viewer and keep image confirmation there across all four menu drivers. Disable the legacy imageviewer core in normal build configurations while preserving its sources and Griffin guard.
Publish the retained Metal device only when the SDR conversion pipeline and shared-event OS gate are available. Withdraw by owner at teardown and retire decoder sessions on a process-lifetime serial dispatch queue. Capability queries remain atomic; hardware settings are checked during decoder setup.
Link CoreMedia and VideoToolbox in the Metal build routes. Annotate HEVC setup availability so older deployment targets can include the guarded startup path. Exercise the shipping bootstrap in the native registered-stream fixture and add a macOS 10.13 compile probe.
Validation: complete GCC/Clang portable Metal jobs, final selected HEVC sanitizer lanes, Windows C89/GDB, 94-workflow selftest, 44-driver thread-state check and complete compile matrix including feature-enabled Metal. Apple SDK/runtime and full player acceptance remain pending.
Create NV12/P010 Metal views through a caller-owned texture cache. Keep the pixel buffer and both CoreVideo wrappers until completion or asynchronous discard. Infer range from the pixel format and refuse conflicting metadata, flipped views and device mismatches.
Cover partial failures and GPU-error retirement in the mock fixture, plus real IOSurface plane pixels and discard on the native runner. Decoder selection remains gated pending planar conversion and producer integration.
The upload that skips the tester groups while another build is in
TestFlight review is a nightly the testers get at the next run after
the review, not an internal build; the comment and messages say so.
pilot submits a build for beta review whenever groups are given, and
an empty list counts, so the upload meant to skip distribution while
another build is in review submitted anyway and was refused. The
internal upload now passes no groups and asks for no review. A build
that enters review between the check and the end of processing still
refuses the submission; that is reported and the job passes, since
the upload has landed by then.
Built the way Xcode builds them - the App Store floors (macOS 12,
iOS/tvOS 15), the projects' warnings, every translation unit - the
tree still warned:
- Delegate methods the SDK deprecates that an older OS still calls
are no longer implemented in source. apple_rt_add_method() gives
the class each one at run time, from +initialize and only on the
releases that call it: -locationManager:didChangeAuthorizationStatus:
before macOS 11 / iOS 14 (-locationManagerDidChangeAuthorization:
from there), -documentPicker:didPickDocumentAtURL: before iOS 11
(the URL-array method from there), -shouldAutorotateTo-
InterfaceOrientation: before iOS 6, and NSView's
-layer:shouldInheritContentsScale:fromWindow: from 10.7.
class_addMethod is looked up by name, as the 10.4 binary may not
import it. CocoaView no longer declares UIDocumentPickerDelegate,
whose pre-11 SDKs require the method it now adds at run time, and
-prefersPointerLocked is not built for tvOS, where it is
unavailable.
- The open panel's file types, the companion's folder icon and the
cores folder's open are -setAllowedContentTypes:, -iconForContent-
Type: and -openURL: from macOS 11, the 10.x methods before it, by
selector where they are not on every release.
- The alert's end selector is looked up by name, and on SDKs older
than the selectors ui_cocoa.m names (10.6, 10.7, 10.9) they are
declared in an unimplemented NSObject category, so @selector()
stays a constant.
- size_t and 64-bit values narrowed without a cast in configuration.c,
gl3.c, cdrom.c, media_detect_cd.c and vfs_implementation_cdrom.c;
rchd_read_extent() rejects an extent past the last 32-bit frame
instead of wrapping into the wrong track.
App Store uploads: one iOS or tvOS core without an unencrypted
LC_ENCRYPTION_INFO_64 - written by Apple's ld, not by other linkers -
fails the whole upload (ITMS-90125). make-frameworks.sh leaves such a
core out of an App Store build with a warning naming it. The
Fastfile's check for a build already in TestFlight review passed
Build.all a filter it does not take, so it always failed and the
upload went on to external distribution and stopped there; it asks
App Store Connect for the newest five builds of the platform with
their review submissions instead.
The iOS and tvOS paths take the same treatment as macOS, down to an iOS
12 floor and with deprecations reported: the UIKit, GameController,
MetricKit, AVFoundation and CoreLocation calls above the floor go
through the apple_runtime.h sends behind their OS checks, enum values
newer than the floor are compared by value, and the display link's
frame-rate range is set and read by selector on every platform without
an SDK gate. apple_runtime.h gains a 9-16 byte struct getter and
-init sends whose casts carry the init family's ownership.
Code that uses a framework throughout - the keypress and device
haptics, camera authorization, speech - moves into classes carrying
its availability, so it calls the framework directly, and is reached
by selector through a class looked up once. Deprecated calls with a
successor on every floor take it; the rest are sent by selector. The
iOS display link and GCDWebServer's lastModifiedDate declare their
ownership, and the iOS display link's rate read is guarded for systems
before iOS 10.3.
A GitLab job log is cut off at 4 MB and nothing after that is kept, so
a build whose warnings fill the stream loses the error that failed it.
xcbeautify prints only errors to the job; the complete xcodebuild log
still lands in buildlog/ on the runner.
The two tvOS configurations compile the same sources as iOS and macOS
with IEEE semantics intact, so code that classifies NaN or infinity
behaves the same on every Apple target.
RetroArch.xcodeproj and RetroArch_OSX107.xcodeproj define HAVE_RZSTD,
so rchd opens zstd-compressed hunks and the rzstd transform stream is
available, as in the xcconfig-based projects.
The Xcode flag sets gain HAVE_RCHD alongside HAVE_CHD, so griffin takes
the built-in reader arm (encoding_huffman + formats/chd/rchd.c) and
none of libchdr is compiled, as every Makefile platform already does.
Deflate, rzstd, rflac and r7z_lzma are already part of the Apple build.
xcodebuild -exportArchive copies the archive with rsync and only works
with /usr/bin/rsync. Put /usr/bin first in PATH before gym runs so a
Homebrew rsync on the build Mac cannot be picked up, which made the
iOS and tvOS App Store exports fail with "Copy failed".
The fastlane build lanes pass the build number and marketing version
to xcodebuild as CURRENT_PROJECT_VERSION and MARKETING_VERSION, so the
widget and Top Shelf extensions carry the same CFBundleVersion and
CFBundleShortVersionString as their containing app, as App Store
Connect requires.
PACKAGE_VERSION on iOS and tvOS comes from version.all, as on every
other platform, so the App Store build bump never changes the version
the code reports or the netplay compatibility magic derived from it.
The iOS 6 through 11 projects and the PowerPC project set
HAVE_NETWORKING with no TLS backend, so HTTPS was unavailable in them.
Define HAVE_SSL, HAVE_CRYPTO and HAVE_RETROSSL alongside it. The
client uses only the int atomics every retro_atomic backend provides,
including the volatile fallback the Xcode 3 GCC gets.
Its project-level Debug and Release flags carry HAVE_SSL without a
backend, so griffin takes the system mbedTLS socket layer, which is
no longer bundled. Define HAVE_RETROSSL and the HAVE_CRYPTO it needs.
The project-level Debug and Release flags carry HAVE_SSL without a
backend, so griffin falls through to the system mbedTLS socket layer,
which the macOS runner does not have. Define HAVE_RETROSSL and the
HAVE_CRYPTO it needs, as BaseConfig.xcconfig does for the other
Apple builds.
Every build uses the built-in TLS, SMB and NFS clients, so the
bundled deps/mbedtls, deps/bearssl-0.6 and deps/libsmb2 are removed.
A system library can still stand in for a built-in client, off by
default: --enable-mbedtls and --enable-bearssl replace the TLS client
with a system mbedTLS or BearSSL, and --enable-libsmb the SMB client
with a system libsmb2; a library asked for and not found is a
configure error, and two TLS libraries at once are refused. The
older builtin/system switches go, as do the platform files' bundled
selections, and the libsmb2 backend follows the library's current
share-enumeration API.
Linux-library-net-backends.yml replaces the legacy lane with one lane
per library: each configures with its option, builds RetroArch to
the link, checks the library's backend is linked and the built-in
client is not, and operates it - the cheevos login transport over a
local HTTPS server for mbedTLS and BearSSL, the SMB VFS tests against
a local smbd for libsmb2 (built from upstream; Ubuntu has no package).
The cheevos_login sample links the system BearSSL, the smb_backup
sample carries stand-in libsmb2 headers for its fake share, and the
samples workflow installs libbearssl-dev.
The Apple targets still had griffin pull in the bundled mbedtls for
TLS, and the webOS build both mbedtls and libsmb2. BaseConfig.xcconfig
and Makefile.webos now select HAVE_CRYPTO, the keychain, HAVE_RETROSSL
and HAVE_RETROSMB as the desktop and Android builds do, and add the
NFSv3/v4 client, so macOS, iOS, tvOS and webOS get the same TLS
1.2/1.3 client with verification, the encrypted keychain, the SMB2/3
client with signing, sealing, Kerberos and the read-ahead window, and
nfs://; neither bundled library is compiled in any more. The Apple
MBEDTLS_BUILTIN_FLAG stays a variable a deps.xcconfig may still set:
with HAVE_RETROSSL defined griffin takes the built-in client either
way. The keychain's Darwin path resolves gethostuuid at run time
already, so the old SDK floors hold.
The nine objects of the stack compile through Makefile.webos with its
cortex-a9 softfp ARCHFLAGS on an ARM cross compiler with neither
warning nor error; the Xcode build is the Apple workflows' to run.
Each unit targets a single SDL major version and exports its own vtable:
sdl1_joypad (ident "sdl") and sdl2_joypad (ident "sdl2"). Makefile.common
selects the object alongside the matching input driver on HAVE_SDL2,
griffin includes it in the same arm, and joypad_drivers[] lists whichever
one the build defines.
sdl1_joypad.c keeps only the plain joystick API: no GameController, haptic
or sensor members, so the pad accessors collapse into their call sites and
set_rumble, set_sensor_state and get_sensor_input are NULL entries rather
than stubs that always return false - both are null-checked by their
callers. The unused compat/strl.h include goes with it.
Each unit targets a single SDL major version and exports its own vtable:
input_sdl1 (ident "sdl") and input_sdl2 (ident "sdl2"). Makefile.common
selects the object on HAVE_SDL2, griffin includes the matching unit in
each arm of its SDL chain, and the driver registry lists whichever one
the build defines. The SDL1 arm of griffin now carries the input driver
and joypad next to the audio driver so it links on its own.
sdl1_input.c omits the KMOD_SCROLL probe: 0x8000 is KMOD_RESERVED under
SDL 1.2, so scroll lock stays unreported there and remains SDL2-only.
RA_IPHONEOS_DEPLOYMENT_TARGET and RA_TVOS_DEPLOYMENT_TARGET set the floor
for every target in RetroArch_iOS13.xcodeproj, so a runner on an Xcode that
has raised its minimum can build the store packages without a tree edit.
Unset, the targets keep the values they build with today.
Xcode 27 accepts macOS deployment targets in the 12.0 - 27.0.x range, so
the store package targets 12.0. RA_MACOSX_DEPLOYMENT_TARGET overrides it
for builds on machines carrying an older Xcode.
@available has two problems for RetroArch's range of targets:
1. It needs a clang new enough to know the syntax, so the ancient
toolchains building the legacy iOS/macOS targets cannot compile
any file that uses it.
2. It lowers to a call to __isPlatformVersionAtLeast() every time
it is evaluated, including in per-frame and per-input paths.
Introduce apple_runtime.h with apple_runtime_available(mac, ios,
tvos), a drop-in replacement that resolves the running OS version
exactly once per process and caches it in a static int; after
warm-up every check is a single load and integer compare, cheaper
than @available. Platforms the original check did not list are
passed as 0, preserving @available's semantics of returning true
on unlisted platforms.
The version is read from UIDevice systemVersion on iOS/tvOS (never
shimmed, works on any version), and on macOS from the
kern.osproductversion sysctl - which reports the real OS version
even for binaries linked against pre-11.0 SDKs, where the
NSProcessInfo APIs (and @available's own plist source) are subject
to the 10.16 compatibility shim - with an
operatingSystemVersionString fallback for pre-10.13.4 systems.
This also fixes the broken iOS 9 / iOS 6 CI builds: cocoa_common.m
used UIWindowScene.effectiveGeometry, an iOS 16 API that older SDKs
(e.g. iPhoneOS 14.2) do not declare at all, so @available could not
save compilation. That call chain is now resolved entirely at
runtime via objc_msgSend (identical cost to a compiled property
access), with the capability probe cached in a static.
All 84 live @available sites across 13 files are converted.
Behavior on every OS version is unchanged: the same paths are taken
at the same version thresholds. Swift #available sites are
untouched; Swift enforces availability at compile time and those
files only build on modern toolchains.
Existing compile-time SDK gates (e.g. around NSWorkspace
isVoiceOverEnabled and the Metal HDR blocks) are kept, since they
guard symbol declarations, not runtime dispatch; comments updated
accordingly.
The macOS build fails on IFF_UP being undeclared in net_ifinfo.c,
twice, with net/if.h included right above it.
Strict C99 is why. Darwin defines _POSIX_C_SOURCE for it and hides the
BSD names behind __DARWIN_C_FULL - IFF_UP among them - and this
project was the only Apple one still asking for c99 while
RetroArch_iOS13 already builds C as gnu99 and gnu17. That is also why
iOS did not fail here and macOS did.
Both configurations in the Metal project now say gnu99, which is what
the rest of the tree builds with. Demonstrated rather than assumed: a
file including net/if.h and printing IFF_UP does not compile under
-std=c99 and does under -std=gnu99, on a plain POSIX host.
This is the same root cause as the RTLD_DEFAULT failure fixed a few
commits ago, from the other side. That one is a local #ifndef and
stays - it defers to the platform where the platform provides the
symbol, so it costs nothing now that the namespace is open, and it
keeps that file building if a target ever tightens again.
No other Apple project asks for c99, checked.
The DOS and PSL1GHT builds fail to link, both on
retro_waitable_spsc.c:185 wanting retro_eventcount_cancel_wait.
griffin includes retro_waitable_spsc.c unconditionally and included
retro_eventcount.c only inside #if defined(HAVE_THREADS). Every build
without threads therefore compiled a queue whose parking half was
missing, and found out at link time.
The eventcount has no thread dependency of its own - it names
HAVE_THREADS nowhere and compiles standalone - because with no lock or
condition variable to hand it degrades to a spin, which is exactly
what a build with no threads needs from it. So it goes beside the
queue that uses it rather than behind a guard about something else.
That accounts for two of the three failures in the same report. The
third, the gfx_widgets_sanitize link, was the missing gfx_display_draw
stub and is already fixed.
Both harnesses in that report pass here plain and under ASan and
UBSan with leak checking on, and retro_waitable_spsc.c compiles with
HAVE_THREADS undefined.
Darwin has forced HAVE_MODELINE off since 3cad8ac8 (2023), when
HAVE_CRTSWITCHRES still meant the external SwitchRes library and only
XRandR and Win32 could apply a timing: "bake out Switchres
(Linux/windows only)". The engine is in-tree now, C89 with no
libraries of its own, and it carries the EDID reader as well as the
mode generator - so the disable also compiled out System Information
> Display Information > EDID, which is why the submenu did not appear
on an M1 even with the DCP reader in place.
The qb force-off goes, and -DHAVE_MODELINE joins the macOS Xcode
builds: Metal.xcconfig's macosx line and the Steam, AppStore and
QTConfig layers that the Metal project's other configurations read,
plus the inline flag lists of the three macOS-only projects
(RetroArch, OSX107, PPC). The iOS and tvOS projects are left alone;
BaseConfig is shared with RetroArch_iOS13, so the define is placed in
the macOS-only layers rather than there.
macOS still cannot program a timing - dispserv_apple leaves the
modeline ops NULL, so the CRT switcher generates and finds no way to
apply, exactly as on any other server without them. What the build
gains is the EDID reader and its menu.
The reference library went from the tree; the project still listed
its decoder's assembly file in the four targets' sources and its
include path, and the build stopped at the file it could not find.
qb, Makefile.common and the Xcode configurations set HAVE_COCOA for
macOS and HAVE_COCOATOUCH for iOS/tvOS; which video drivers are built
is decided by HAVE_METAL, HAVE_VULKAN and HAVE_OPENGL alone. The Xcode
macOS build now carries HAVE_COCOA like the make build, so the desktop
companion settings appear there too. A Darwin Vulkan build links the
Metal frameworks its CAMetalLayer render view needs, whether or not the
Metal driver is included.
gfx/drivers/metal.h carries everything the Metal driver shares with its
neighbours: the vertex, uniform and HDR structs that metal.m and the shaders
must agree on, plus the MetalView @interface that ui_cocoa.m and
ui_cocoatouch.m need in order to instantiate the render view. The
Objective-C half sits behind __OBJC__ so the Metal compiler sees only the
struct layouts, and the include guard keeps a single @interface in the
griffin unity build, where metal.m and the Cocoa UI driver share one
translation unit.
Shaders.metal moves alongside it into gfx/drivers/metal_shaders/, matching
the gl_shaders, d3d_shaders and vulkan_shaders layout. The commandline
metallib rules, the clean rule and the three Xcode projects that reference
either file follow the new paths.
The companion to the OSX change. The Xcode config passed -DIOS and 126
sites across 40 files tested it.
What -DIOS meant is the important part: OTHER_CFLAGS_IOS_TVOS_SHARE
carries it to iphoneos, iphonesimulator, appletvos and appletvsimulator
alike, so IOS meant "the iPhone family", not iOS as against tvOS.
Apple's name for that is TARGET_OS_IPHONE, which is 1 on iOS, tvOS,
watchOS and their simulators - TARGET_OS_IOS is 0 on tvOS and would
have turned every one of those 126 sites off there. So IOS becomes
TARGET_OS_IPHONE, one for one, and nothing changes which branch it
takes on any target. menu_displaylist.c's "#if !defined(IOS) || !IOS",
which said the same thing twice, becomes one test.
The macro now comes from Apple's header rather than a -D, so
<TargetConditionals.h> is included, under __MACH__ as config.def.h
already did it, by the 42 files that test TARGET_OS_IPHONE or
TARGET_OS_OSX and did not include it. The four settings_def fragments
are not translation units - they are included into configuration.c,
menu_setting.c and msg_hash_us.c, all three of which have it, the last
through msg_hash.h. -DIOS is gone from the Xcode config.
And the simulator, which is the reason to be careful here rather than
after a bug report: iOS SDKs before 9 set TARGET_OS_IPHONE to 0 for a
simulator build and marked it with TARGET_IPHONE_SIMULATOR instead, so
the TARGET_OS_OSX fallback added in the previous commit would have
called an old simulator build a Mac. Both simulator spellings are
checked now, the modern TARGET_OS_SIMULATOR and that one.
The preprocessor matrix from the previous commit grew two rows - an
old iOS-simulator SDK and a modern one - and all thirteen are correct.
Linux builds and runs clean under ASan; the Apple side is not compiled
here.
Both build systems passed -DOSX to say "this is a macOS build" and 95
sites across 24 files tested it. Apple already has a name for that -
TARGET_OS_OSX, from TargetConditionals.h, alongside TARGET_OS_IPHONE
which this tree does use - so the private one goes and Apple's is used
throughout: #ifdef OSX becomes #if TARGET_OS_OSX, #ifndef OSX becomes
#if !TARGET_OS_OSX, defined(OSX) becomes TARGET_OS_OSX. Every TARGET_OS_*
is defined to 0 or 1, so the tests are on the value, never on whether
the macro exists.
TARGET_OS_OSX itself is only in the 10.12 and later SDKs. Older ones get
it from cocoa_defines.h, by the same rule Apple's own header uses: on
Apple, anything that is not the iPhone family is macOS. That needs
nothing but TARGET_OS_IPHONE - which every SDK that has ever had an
iPhone in it defines, and whose absence on a 10.4 or 10.5 SDK that
predates the iPhone means macOS by the same reasoning. tvOS and watchOS
set TARGET_OS_IPHONE and land on the right side. The include of
TargetConditionals.h is under __MACH__, as config.def.h already does it.
The build systems pass -DTARGET_OS_OSX=1 exactly where they passed
-DOSX, for the translation units that include no Apple header at all -
retroarch.c, dir_list.c, menu_displaylist.c and the like. That is the
same reach the old define had, so no file changes which branch it
takes; on a 10.12 or later SDK the header defines the macro identically
and the redefinition is silent.
Checked by preprocessing the header against a stand-in TargetConditionals
for every SDK generation it has to survive: 10.4 with no TARGET_OS_IPHONE
at all, 10.5 with it zero, iPhone SDK 2.0 with it one, 10.6 through 10.11
with no TARGET_OS_OSX, 10.12 and later which define it, a modern iOS SDK,
a modern tvOS SDK, the two oldest and newest of those with the build
system's -D added (the redefinition clean under -Wall -Werror), and a
translation unit with no Apple header at all both with the -D and on a
non-Apple build. Eleven configurations, all correct.
An earlier attempt used a backslash line continuation, which does not
continue across the CRLF endings of that file and silently left the
macro at 0 on macOS; the test matrix is what caught it, and the file
now says so.
Linux builds and runs clean. The Apple side is not compiled here.
Two playback drivers for the same hardware: coreaudio.c, C, on the
AudioUnit C API, and coreaudio3.m, Objective-C with ARC and blocks, on
AUAudioUnit and AVAudioFormat, which the Xcode builds defaulted to.
Side by side they differed in what each had missed rather than in
what either did better: 3 had no device list, ignored the device
argument, had no wait_writable() so the threaded pipeline could not
host on it, read its ring a sample at a time with a divide each, and
signalled its dispatch semaphore from every callback with no waiter
count, the pile-up fixed in coreaudio.c three commits ago. AUAudioUnit
is a wrapper over the same I/O unit and DefaultOutput can insert a
sample-rate converter that HALOutput at the device's nominal rate does
not; nothing in 3 was faster or lower in latency, and dispatch made
the file a libdispatch client for a semaphore the kernel already has.
coreaudio.c is the driver. From 3 it takes the three things worth
taking: the converter is rebuilt when the source rate changes or rate
control moves its adjustment by more than half a percent, not only
when the effective rate has drifted that far; the stream format set
is retried once, since RemoteIO has been seen to refuse the first;
and stop()/start() double as the two ends of an audio session
interruption, which is what the Cocoa side already calls at Began and
Ended - start() resets the converter, since one stopped mid-stream
can come back stuck at end-of-stream, the tvOS 13/14 symptom. The
Cocoa handler now reactivates the session before restarting and
honours ShouldResume, without which the units were restarted into a
session the system had deactivated.
The last SDK gate goes with it. Component versus AudioComponent was a
build-time choice on HAS_MACOSX_10_12, baking the build machine into
what the binary could open; both triples are resolved once at runtime
through dlsym, the modern one if the process has it and the Component
Manager's otherwise, with no header from either side needed since the
description structs share a layout and the handles are pointers. The
HAL device query asks AudioObjectHasProperty whether the output scope
answers rather than assuming from the SDK, through one helper both
the device list and the named open now share. Only TARGET_OS_IPHONE
remains, which is an ABI split and not a version.
"coreaudio3" is accepted as an alias of "coreaudio" in the driver
lookup for a release, so a config naming it lands on this driver and
not on whatever is first in the table. HAVE_COREAUDIO3 is gone from
the Makefiles, qb, griffin, the feature list, the menu, the label
tables and the Xcode config - where its OTHER_CFLAGS line had been
overriding the HAVE_COREAUDIO one above it, so Xcode builds had only
ever compiled 3.
Verified on Linux with the real coreaudio.c linked against stubs of
the Apple calls and a render thread at the device rate: the device
list and the named open through both the AudioComponent and the
Component Manager triples, the converter built once across 200 calls
with rate control jittering by a tenth of a percent and once more for
a two percent step, stop and start, and the earlier wait harness -
no stale-signal storm, blocking writes at the device's pace. Syntax
under gnu89 with mixed declarations an error and gnu99, macOS and
iOS. Linux and win32 builds of the touched frontend files clean; the
frontend runs under ASan. Wants a Mac and an iOS build before it is
trusted; the Cocoa change in particular is not compiled here.
Rename gfx/drivers_shader/shader_vulkan.cpp to shader_vulkan.c and convert
the remaining C++ syntax: 14 autos become indexed loops and typed pointers,
casts become C casts, the extern "C" wrapper goes away, file-local typedefs
cover the header struct tags, and 35 reference parameters become pointers
or by-value PODs. All mixed declarations are hoisted for C89 and the three
for-init declarations are gone, so the file now clears
-Werror=declaration-after-statement clean for the MSVC lanes.
The incompatible-pointer-types gate caught two real conversion bugs before
they could ship: both set_semantic_texture wrappers compared the write_count
POINTER against VULKAN_MAX_DESCRIPTOR_WRITES and forwarded unsigned** into
the flush, and seven build_semantics call sites passed the batch counter by
value. Both would have corrupted descriptor batching at runtime.
Texture, VkViewport and the semantic-texture layer stay pointer-passed on
the per-frame path: by-value conversion initially cost +124 instructions
(+1.6%) in build_semantics/build_commands from struct copies at every call;
with the layer pointerized the final delta versus the C++ object is +4
instructions (0.1%), i.e. codegen parity.
The griffin include moves from griffin_cpp.cpp to griffin.c beside
slang_process.c (single-TU cohabitation of both files compiles clean), and
the Xcode project entry switches to sourcecode.c.c. griffin.c itself does
not compile at origin/master in this environment (pre-existing rc_export.h
include gap and test_input.c collisions), so the cohabitation TU stands in
for that lane.
Verified: 7/7 harness lifecycles under ASan+UBSan+LSan (leaks enabled),
byte-exact parameter/pass dumps across 1643 presets, production build with
zero warnings.