Commit Graph
4266 Commits
Author SHA1 Message Date
Stephen Millerandgeorgemoralis 548789cfa5 Random, mostly pointless fixes (#4959)
Remove dead code in DecoderImpl, fix weird harmless double-assign in TextEditor, fix FindStreams return check, fix broken memset and clean up a bit of Aio code, fix type for compare check in sceNpCmpNpIdInOrder, slightly de-slopify comments in sceNpCheckPlus, fix OrbisNpState defines based on extracted VSH defines, fix scePlayGoConvertLanguage types, fix scePlayGoGetProgress nullptr dereference, fix (I think?) missing break in HullShaderTransform, and fix (I think?) vk::Format result table definition.

Needs review, I think most of this is fine, but I'd like a second opinion.

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
2026-09-13 10:17:05 +03:00
Stephen Miller b8254edf3b V_CMPX_EQ_I64 (#5015) 2026-09-13 09:07:29 +03:00
Vladislav Mikhalin 678705df8d ajm mp3: rely on ffmpeg parser for packet boundaries (#5007) 2026-09-12 22:13:59 +03:00
Stephen Miller 4302ee99e2 Implement some V_CMPX_U64 ops (#5009)
* Implement some V_CMPX_U64 ops

Just the two I know are needed right now, can add more if others have been seen in games.

* oops
2026-09-12 21:09:38 +03:00
Stephen MillerandTheTurtle 64c820f3a0 Skip lowering for null buffer sharps (#5008)
Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
2026-09-12 20:50:23 +03:00
Gih-ptandraphaelthegreat e40d0f3803 shader_recompiler: Implement S_BITSET0_B64 and S_BITSET1_B64 (#5006)
* implement-s-bitset-b64

* Add 64-bit bitset operations to scalar ALU

* Fix clang-format trailing whitespace

* shader_recompiler: use 64-bit BitFieldInsert for S_BITSET_B64

Adds BitFieldInsert64 IR opcode and EmitBitFieldInsert64 in the SPIR-V
backend (OpBitFieldInsert with 64-bit Result Type), per SPIR-V spec
support for wider integer bitfield ops. offset/count stay 32-bit,
matching the existing ShiftLeftLogical64/ShiftRightLogical64
convention. S_BITSET_B64 now uses it instead of the manual
shift/or/andn2 sequence.

Addresses review comment from @raphaelthegreat.

* Rename BitFieldInsert to BitFieldInsert32

* Refactor S_BITSET_B64 to use 32-bit offset

* Consolidate BitFieldInsert function signatures

* Update BitFieldInsert to support U32 and U64

Refactor BitFieldInsert to handle both U32 and U64 types.

* Rename EmitBitFieldInsert to EmitBitFieldInsert32 *again

* I hope this is the last time.

* constant_prop_pass: fix bitfield

---------

Co-authored-by: raphaelthegreat <geoster3d@gmail.com>
2026-09-12 18:06:55 +03:00
junminlee2004 5a2b826186 Re-anchor the fps counter when the display resizes (#5005) 2026-09-11 18:24:33 +03:00
Hog dbc1c40f32 Refactor mip info calculation for array modes (#5001) 2026-09-11 13:21:17 +03:00
kalaposfos13 7a8caf12b6 Misc QoL stuff (#4990)
* Include fiber names in thread names, if the thread is running a fiber

* yet another openorbis libkernel-libkernel export

* Move more shutdown routines to Emulator::Shutdown
2026-09-10 09:33:40 +03:00
Marcin Mikołajczyk 6de0eed1d2 Stub sceNpNotifyPlusFeature (#4993) 2026-09-10 09:15:35 +03:00
junminlee2004 a0d0a1d117 imgui: stop Triangle from opening context menus (#4994) 2026-09-10 08:14:03 +03:00
kalaposfos13 3429fe27b5 Fix memory leak if an invalid camera ID is provided in the config or if SDL fails to open the camera for any other reason (#4986) 2026-09-09 13:24:25 +02:00
Marcin Mikołajczyk b184aaf6df Implement S_MEMTIME (#4987) 2026-09-09 10:32:27 +01:00
TheTurtle 507464a531 shader_recompiler: Reimplement B64 SALU opcodes with U64 masks (#4972)
* shader_recompiler: Use full U64 masks

WIP lacks proper ballot elim pass so codegen is not optimal but it worksTM

* shader_recompiler: Implement inverse ballot elimination pass

This pass pushes up InverseBallot instruction in the def chain in order to cancel out with corresponding Ballot instructions

* shader_recompiler: Handle composite construction and boolean select in constant propagation

* shader_recompiler: Add phi simplification pass

Implements pass for pulling out common operations into the phi itself as well as removing duplicated phis that result from that.
Inspired from InstCombinePHI in LLVM

* inverse_ballot_elimination_pass: Fold UndefU64

* phi_simplification_pass: Deduplicate phi users after phi deduplication

The act of deduplicating phis can also cause users to became identical

* shader_recompiler: Dont pull out ballot ops from phis

Also every time an instruction is pull out of a phi, also add any phi users to worklist

* shader_recompiler: Implement more aggressive DCE

inspired by LLVM ADCE, the pass can now also remove dead use cycles

* emit_spirv: Enable group ballot for SubgroupLtMask

* shader_recompiler: Avoid re-emitting register loads and ballots in structurization

This allows us to move ballot elim before structurization and it can work more efficiently that way

* ssa_rewrite_pass: More prints

* inverse_ballot_elim: Perform targeted CSE and simplfication for ballot elim

Takes the responsibility of instruction deduplication from phi elim and runs the needed subset of constant prop so running constant prop beforehand is not required

* clang format

* shader_recompiler: Rewrite phi simplfication pass

It now works with phi SCCs making it more robust and able to optimize more cases

* ir: Move instruction type special checks to instruction itself

IR::Value is not the correct place for those

* bring back localized simplification

* vector_alu: Add v_cmp_lt_u64

* phi_simplification_pass: Run local CSE after deduping SCCs

This can expose more opt possiblities
2026-09-08 19:07:02 +03:00
junminlee2004 63cc326dc5 renderer_vulkan: Handle QuadStrip as a triangle strip (#4977)
* Add support for QuadStrip primitive type

* Log warning for QuadStrip

Added a warning log for unimplemented primitive type handling.
2026-09-07 21:24:58 +03:00
georgemoralis b81daab3dd fixed DrawCenteredText with new imgui (#4978) 2026-09-07 12:59:50 +03:00
Gabriele C.andClaude Opus 5 3303b03e5b FileSys: Open host-backed files with POSIX-style full sharing (#4838)
* FileSys: Open host-backed files with POSIX-style full sharing

Guests code expect POSIX behaviour here: if a file is already open for writing
on one fd, opening it again on another one should still work. That is what our
other host backends already do, since the share mode is a Windows-only concept
and the POSIX path ignores it, but on Windows we default to denying writers and
the second open comes back as EACCES. It is easy to run into, since a title
reopening its own scratch files is perfectly normal: LittleBigPlanet 3 does it
constantly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* FileSys: Shorten the host file sharing comment

The note above the HostFile constructor spent three lines restating what
the code already shows. Say why the sharing flags are there in one line,
and fix the grammar while at it.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 18:38:48 +03:00
kalaposfos13 7055e65518 Fix cut off logging in log files after the signals rewrite (#4975)
* Put back Emulator::Shutdown() to assert_fail_impl

* as far as I can see this code is entirely irrelevant to logging being cut off on windows

* the default guest handler for SIGTRAP doesn't need to be handled differently ever since we remove the host handlers before asserting

* it works so ship it
2026-09-06 10:19:53 -05:00
Marcin Mikołajczyk 17ca6700f5 Include more info in image overlap log (#4974) 2026-09-06 00:18:37 +02:00
Stephen Miller a31770e2e8 Fix IR dumping (#4973) 2026-09-05 16:51:22 -05:00
Marcin Mikołajczyk 256546c430 Improve log message for fp rounding modes (#4970) 2026-09-05 14:40:11 -05:00
Lander Gallastegiandraphaelthegreat 1cf28cbc96 shader_recompiler: split resource tracking and flatten load from buffer for sharp source (#4782)
* shader_recompiler: Split resource tracking into 2 parts and flatten load from buffer if used as sharp source

clang-format

fix inmediate sample raw

defer sharp not found asserts

flip asserts

disable aniso pattern

fix disable aniso

some fixes

non immediate

fix PushPtr

fix PushPtr for non immediate

don't assert on offset computation failures

robust bfs

some xbyak fixes

add bitwise ops

umin umax and bit extract

correct rshift lshift 0st immediate

fix and in memory

some minor code fixes

consider ReadConstBuffer as valid finding

fix xbyak

fix magic_enum for opcodes

fix building (yes, i didn't test)

don't corrupt stack when bailing out

ReadConstBuffer compute offset

use canonical inst for readconst non-imm offset

mark all readconstbuffer sharp dwords

consider r128 images

FindSharpLocation

handle non-imm offset readconstbuffer

don't handle immediates when constant folding

proper check for ReadConst to get flatbuf offset

clang-format

fix stupidity

invert condition

separate search dominant function

handle phis loke other insts in gvn

use same logic for phis in gvn than for flatten pass

apparently idk how logic works

revert back to old logic

min/max immediate in constant folding

add offset insts to gvn inst to hash args

assert that ReadConstsBuffer insts have usage as buffer sharp

separate dominance search from bfs

chang gvn phi handling

remove unused includes

fix reuse

readconst transform add address

* shader_recompiler: Move readconst address add simplification to flatten pass

* shader_recompiler: Remove unnecessary phi handling

Now sharp tracking should be much simpler since its on the unstructured control flow graph

* shader_recompiler: Only enable DMA if some ReadConst could not be flattened

* shader_recompiler: Improve phi eliminaton of readlane elimination with worklist

* shader_recompiler: Cascade flattening failure in ReadConst tree, bind null sharp when source could not be flattened

* shader_recompiler: Further improve robustness of tracking

- Track all dwords of T# with SSA
- Ensure sharp dwords are sequential in flatbuf memory
- Substitue null descriptors on tracking failures

* shader_recompiler: Add new sharp fetching object

* shader_recompiler: Add new sampler pattern

* shader_recompiler: Add texture cube to 2d array pattern

* control_flow_graph: Remove unreachable blocks

Fix bloodborne

* shader_recompiler: Add yet another sampler pattern

* shader_recompiler: Add sampler aniso pattern

* flatten_extended_userdata: Only search through allowed instructions

* some fixes

* :kek:

* tests: Fix tests compile

---------

Co-authored-by: raphaelthegreat <geoster3d@gmail.com>
2026-09-04 20:10:46 -05:00
junminlee2004 22fb56d51c ime: pass AddPolyline thickness and flags in the imgui 1.92.8 order (#4969) 2026-09-05 00:41:54 +03:00
kalaposfos13 5802ad8d26 the boring fix (#4968) 2026-09-04 23:28:18 +03:00
georgemoralis f03636bf35 fix imgui crash (#4967) 2026-09-04 20:31:44 +03:00
junminlee2004 21d5639419 imgui: raise the font atlas cap from the backend's max texture size (#4964) 2026-09-04 19:18:00 +03:00
Vladislav Mikhalin 97c8feab18 video decoding: minor logic mistake (#4962) 2026-09-04 09:16:39 +03:00
georgemoralis 2eca0b5f0b Upstreaming imgui (#4960)
* added imgui upstream and updated ImGuiFileDialog with a needed update

* cmake fix

* update ImGuiChildFlags ,ImGuiWindowFlags in latest imgui

* revert to recheck

* big picture flags

* fixed texture descriptor

* migrated layer_extra to latest imgui

* updated text_editor to latest imgui
2026-09-03 15:40:23 +03:00
Stephen Miller f47e5f5cfe IMAGE_SAMPLE_D_O (#4958) 2026-09-03 08:50:18 +03:00
junminlee2004 473633c31a video_core: Decode sRGB for A2R10G10B10Srgb display buffers (#4957) 2026-09-03 03:46:03 +03:00
georgemoralisandGabriele C db126323b9 Http module fixups and implementations (#4933)
* Some games open port with handle 255 , that is not an accepted port so don't complain about it

* Net: Send the User-Agent configured on the HTTP template

* simplified comment

* default http user-agent

* added dummy nputility module

* match User Agent 100% with decompile

* return result to np_auth and some more debug code

* implemented sceNpLookup*  (similar of how np_score ,np_tus) functions

* improved accept encoding for gzip

* removedd invalid test after last change , GZIP encoding is not default true

* Implemented Cached  Redirected Connection

* Inflate only when the response is actually GZIP-encoded and the flag is enabled

* simplify GetLibhttpSystemVersionString

* fixed tests

* old file removed

---------

Co-authored-by: Gabriele C <sgdc3.mail@gmail.com>
2026-09-03 00:18:12 +03:00
Marcin Mikołajczyk f3818e0319 Update sirit submodule (#4956) 2026-09-02 23:01:57 +03:00
Vladislav Mikhalin 0b93ac1751 we take security seriously here or whatever (#4955) 2026-09-02 22:00:42 +03:00
Vladislav Mikhalin ae1539d32a vdec2: support for h265/hevc (#4951)
* vdec2 hevc

* making someone happier

* you saw nothing

* neat nid
2026-09-02 13:08:58 +03:00
kalaposfos13 2b4592b77c Fix incorrect error return on attempting to create a file in a nonexistent folder in a writable mount (#4952)
I refuse to have a clang commit on a one line fix PR, so a force push it is.
2026-09-02 00:46:09 +03:00
georgemoralis 1403d31130 Some games open port with handle 255 , that is not an accepted port so don't complain about it (#4946) 2026-09-01 19:13:46 +03:00
Valdis Bogdāns e29cf71996 shader_recompiler: Enhance shared memory barrier handling and add divergent loop detection (#4941)
* shader_recompiler: Enhance shared memory barrier handling and add divergent loop detection

* Clang-format fixes as always.
2026-08-31 12:25:48 +03:00
AnishGRao 0134143b6d Force LOG_GENERIC behind check of should_log (#4942) 2026-08-31 08:26:03 +03:00
georgemoralis b8e60d2dac np_utility initial impelmentation (#4940)
* implemented sceNpLookup*  (similar of how np_score ,np_tus) functions

* Update CMakeLists.txt

* fixed logging

* cleanup logging

* more cleanup
2026-08-31 07:45:37 +03:00
kalaposfos13 297551e00c Use a system mapping for camera frame data and add a dummy sceCameraGetCalibData implementation (#4938)
* Well, I tried

* map the camera gpu pool a bit higher

* dummy sceCameraGetCalibData

* slight improvement to sceCameraGetCalibData

* remove this because it's just a hack that I tried just in case it does anything
2026-08-30 01:07:43 +03:00
kalaposfos13 e82c33507b LLE system computer vision libraries except VrTracker (#4937) 2026-08-29 23:55:44 +03:00
junminlee2004 012a15d4ff renderer_vulkan: do not auto-select a software rendering device (#4904) 2026-08-29 23:42:12 +03:00
TheTurtle 2651debdd0 shader_recompiler: Structurize later in the pipeline and cleanup (#4906)
The code regarding structurization has not changed much since the very first commit of the recompiler.
The algorithm has proven very reliable in practice however it doesnt produce optimal code.
More specifically the algorithm does not know to emit if-else statements, it can only emit ifs
The following code

```
a = 0
if (cond) goto L1
a = 1
goto L2
L1:
use(a)
L2
```

will emit the following

```
if (cond) %0 = 1
else %1 = 0

%3 = phi(%0, %1)

if (!cond) use(%3)

```

if the structurizer knew about else statement it could have emited much more optimal code

```
%0 = 0
if (cond)
%1 = 1
else
use(%0)
```

In general while suboptimal, this is harmless. It does matter though for one specific case; K$ pointer chasing
if "a" were a resource descriptor load, then the program ends up with a phi node with 2 possible sources which results in ambiguity.

The obvious solution is to improve the structurizer codegen to reduce these semantically redundant phis.
Relying on structurizer quality for correctness is generally fragile however.

On main this issue is solved by performing dominance and reachability analysis on the original unstructured CFG.
The phi tree is scanned and all possible sources are collected. Then sources are examined in pairs (a, b), if b dominates a, then a can be removed

The goal of this PR is to solve the same issues but in a more fundemental way; most IR passes do not care about structurization
and some like readlane elimination that duplicate phis also benefit from unstructured graphs. So defer structurization until the end of compilation

The new pipeline builds an unstructured graph of IR blocks and runs SSA rewrite on those. The SSA pass has been reworked again to remove
recursion and not rely on def lookups during phi trivialization. This allows removing Opcode::Identity, its removal pass and all special checks for it
in various places inside the recompiler.

When optimization passes are done, phis are lowered back to hardware registers. This is possible with the new RegTag structure that intrusively
stores register information for every phi. This used to be stored with a hash map inside ssa pass, but having this information later in the pipeline is of benefit

After structurization the ssa is repaired to fixup any dominance violations that have resulted and ssa rewrite runs again to resolve added goto variables,
conditions and bring lowered phis back to ssa form

changes

remove identity op

remove some heap allocs

cleanup and split headers

repair ssa after structurization

faster phi lowering

use more ir builder

fix
2026-08-29 21:14:06 +03:00
Mehran 3e458471e5 video_core: Emulate scaled min/max blending (#4768)
* video_core: Emulate scaled min/max blending

* video_core: Warn when scaled min/max blend emulation is used

* Emulate min/max alpha blend with operand-zeroing factors
2026-08-29 16:27:38 +03:00
junminlee2004 fc74821b41 shader_recompiler: decorate written storage buffers as Coherent (#4896)
* shader_recompiler: decorate written storage buffers as Coherent

* Revert "shader_recompiler: decorate written storage buffers as Coherent"

* shader_recompiler: derive Coherent decorations from guest V# mtype
2026-08-29 15:51:15 +03:00
Stephen Miller 391430a924 Update vk_rasterizer.cpp (#4934) 2026-08-29 10:45:18 +03:00
Vaibhav Srivastava e5d93d2cf0 docs: fix typo occured -> occurred (#4935)
Signed-off-by: Vaibhav Srivastava <vaibhavsri1712@gmail.com>
2026-08-29 10:45:05 +03:00
DanielSvoboda 388cff5177 Fix missing files.json handling (#4931) 2026-08-27 18:15:42 +03:00
georgemoralis d7114f9197 Tss support (#4930)
* initial TSS

* improved delete request
2026-08-27 17:08:47 +03:00
kalaposfos13 54ec7d00a0 Trigger a lightbar reset on controller connection (#4927)
Because the config is now parsed earlier than controller connection, we can no longer update the lightbar directly from the input config loading code, at least on startup. It's still used for mid-game input config reload though
2026-08-26 23:57:06 +03:00