- C++ 58%
- C 36.4%
- Rust 2.8%
- HLSL 0.7%
- GLSL 0.6%
- Other 1.4%
Switching the texture filter from Nearest to JINC2 / xBR / Bilinear
in the D3D11 backend currently freezes RetroArch for multiple
seconds: GPU_HW_D3D11::UpdateSettings -> DestroyShaders ->
CompileShaders rebuilds the entire batch fragment shader matrix
(4 render modes x 9 texture modes x 2 dithering x 2 interlacing =
144 permutations, 112 of them unique) synchronously on the runloop
thread. With high-optimisation HLSL compiles at 50-200 ms per
shader the total can run 10-20 seconds; the previously-shipped
RETRO_MESSAGE_TYPE_PROGRESS notification is unreadable against
the RetroArch menu UI during the stall, so users perceive a hang.
This adds a 'swanstation_GPU_ShaderPrecompile' core option with
three values, defaulting to 'Lazy', and threads its behaviour
through the D3D11 backend (other backends follow in subsequent
commits):
- Disabled: CompileShaders skips the batch fragment shader matrix
entirely. Each combination compiles on the main thread the
first time the game dispatches a draw using it, then is
cached. Lowest startup latency; trades the single multi-second
stall for a small number of first-use hitches scattered
through early gameplay. Useful on low-end hardware and for
users who don't intend to use the heavier filters.
- Enabled: the historical behaviour. CompileShaders walks the
full matrix synchronously at GPU init. RetroArch is blocked
the entire time. After that, no per-draw hitches. Useful for
benchmarking and for users who want a single up-front cost.
- Lazy (default): CompileShaders spawns a background thread
that walks the matrix and fills it slot-by-slot. The main
thread starts gameplay immediately. If the game asks for a
combo the worker hasn't reached yet, the main thread compiles
it itself (same hitch as Disabled for that one combo);
otherwise the slot is already populated and the draw proceeds
at full speed. After the worker finishes, behaviour is
identical to Enabled.
A new GetBatchPixelShader(render_mode, texture_mode, dithering,
interlacing) helper centralises the lazy-compile path. It:
- Applies the Reserved_Direct16Bit (3) -> Direct16Bit (2) and
Reserved_RawDirect16Bit (7) -> RawDirect16Bit (6) dedup
discovered in commit
|
||
|---|---|---|
| CMakeModules | ||
| dep | ||
| src | ||
| .clang-format | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| CMakeLists.txt | ||
| libretro.osx.def | ||
| LICENSE | ||
| link.T | ||
| Makefile.libretro | ||
| README.md | ||
| TODO | ||
SwanStation - PlayStation 1, aka. PSX Emulator
Features | System Requirements | Disclaimers
SwanStation is a hard fork and open-source Libretro core implementation of DuckStation, which is an emulator of the Sony PlayStation(TM) console, focusing on playability, speed, and long-term maintainability. The goal is to be as accurate as possible while maintaining performance suitable for low-end devices. "Hack" options are discouraged, the default configuration should support all playable games with only some of the enhancements having compatibility issues.
A "BIOS" ROM image can be used, but is not required. You can use an image from any hardware version or region, although mismatching game regions and BIOS regions may have compatibility issues. A ROM image is not provided with the emulator for legal reasons, you should dump this from your own console using Caetla or other means. If no ROM image is provided, OpenBIOS will be used instead.
Features
SwanStation features include:
- CPU Recompiler/JIT (x86-64, armv7/AArch32 and AArch64)
- Hardware (D3D11, OpenGL, Vulkan) and software rendering
- Upscaling, texture filtering, and true colour (24-bit) in hardware renderers
- PGXP for geometry precision, texture correction, and depth buffer emulation
- Adaptive downsampling filter
- Post processing shader chains
- "Fast boot" for skipping BIOS splash/intro
- Save state support
- Supports bin/cue images, raw bin/img files, MAME CHD, single-track ECM, MDS/MDF, and unencrypted PBP formats.
- Direct booting of homebrew executables
- Direct loading of Portable Sound Format (psf) files
- Digital and analog controllers for input (rumble is forwarded to host)
- Namco GunCon lightgun support (simulated with mouse)
- NeGcon support
- Emulated CPU overclocking
- Multitap controllers (up to 8 devices)
- RetroAchievements
- Automatic loading/applying of PPF patches
System Requirements
- A CPU faster than a potato. But it needs to be x86_64, AArch32/armv7, or AArch64/ARMv8, otherwise you won't get a recompiler and it'll be slow.
- For the hardware renderers, a GPU capable of OpenGL 3.1/OpenGL ES 3.0/Direct3D 11 Feature Level 10.0 (or Vulkan 1.0) and above. So, basically anything made in 2013 or later.
Region detection and BIOS images
By default, SwanStation will emulate the region check present in the CD-ROM controller of the console. This means that when the region of the console does not match the disc, it will refuse to boot, giving a "Please insert PlayStation CD-ROM" message. SwanStation supports automatic detection disc regions, and if you set the console region to auto-detect as well, this should never be a problem.
The region checking can be disabled in the console options tab. This is the only way to play unlicensed games or homebrew which does not supply a correct region string on the disc, aside from using fastboot which skips the check entirely.
Mismatching the disc and console regions with the check disabled is supported, but may break games if they are patching the BIOS and expecting specific content.
LibCrypt protection and SBI files
A number of PAL region games use LibCrypt protection, requiring additional CD subchannel information to run properly. libcrypt not functioning usually manifests as hanging or crashing, but can sometimes affect gameplay too, depending on how the game implemented it.
For these games, make sure that the CD image and its corresponding SBI (.sbi) file have the same name and are placed in the same directory. SwanStation will automatically load the SBI file when it is found next to the CD image.
For example, if your disc image was named Spyro3.cue, you would place the SBI file in the same directory, and name it Spyro3.sbi.
Tests
- Passes amidog's CPU and GTE tests in both interpreter and recompiler modes, partial passing of CPX tests
Disclaimers
"PlayStation" and "PSX" are registered trademarks of Sony Interactive Entertainment Europe Limited. This project is not affiliated in any way with Sony Interactive Entertainment.