* p2p crypto schema
* adding p2p keyring
* p2p framing and testing
* fixups
* test fix
* missing definations
* implementation of host functions
* tcp/transport of p2p packets
* improvements in binding
* guest_net ,improvements and test cases
* all mighty clang
* fixing macOS tests failures
* misc
* net_rewrite : net_errors , types and translation schemas
* updated fixed chunks transfer on windows
* bye bye old net
* small updates for the new net
* settings and tests
* net lib first draft
* allow more than 1 P2P instances on from same pc
* improved shadnet replies
* possible fix for jojo
* cleanup
* move net files to libaries/net
* fixed macOS tests
* mighty clang
* fixed cmakelists
* don't cosume inviation event on client (test code)
* fix macOS tests
* Large multi-file rework for Signaling and Matching2 network handling / optimization. Consolidates Matching2-signaling and signaling to one process (signaling_handler)
General cleanup and consolidation of matching2 context management > nphandler
Removal of a lot
SIgnaling overall structure cleanup.
Matching2: added get and set roommemberdatainternal and the proper type / shadnet call / request / reply.
Consolidated signaling/matching2 typedefs to np_types2
Utilized Codex as a reviewer and for general cleanup.
* all mighty clang
* fixed member attributes
* fixed MAPPED address for matching signaling
* Fixed sceNpMatching2SignalingGetLocalNetInfo
* fixups on net core/library based on fw
* improved errno
* spilt p2p to net_p2p
* some cleanups
* fix for localinfo
* clang
* fix up
* cleanups
* cleanups
* added KernelFstat
* fixed fstat
* one more fix for fstat...
* cleanup old deprecated code
* cleanup
* General logging cleanup across NP changes. Thanks Stephen!
* cleanup based on stephen's suggestions
* fixup
* fixing tests
* blah
* fixup
* improve memory pools
* cleaunp
* force https disable option
* clang
* @stephen's fixes
* added network field in settings and ported old network ones
---------
Co-authored-by: Metr1k <blackkn1ght1991@gmail.com>
* Fix config annoyances
Removed a million "Windows static guest red-zone protection" logs, removed the excessively wordy logging for red-zone being enabled, made the red-zone patches setting a proper setting in our general category (with backwards-compat for the old setting behavior so users don't need to change anything and GUI doesn't need adjusting)
Also fixed implementation for the userfaultfd and inline_fetch_parsing config settings introduced in recent PRs. Due to oversights from those respective devs, neither setting was actually getting read from the config.
* Nuke the red-zone config tests
These were all dependent on the old behavior. There's no point in these now that red zone patches are a proper config setting.
SystemSetup stored the result of SystemSetupCore in a u32, so the
`result < 0` guards could never be taken and an invalid system option
was reported back to the guest as ORBIS_OK.
* Fix config corruption on close and replace error with unreachable for failing to load configs
* Clean up config init code a bit
* Fix some hotkeys accidentally triggering twice
* Add unreachable for user_settings as well
* sir clang offnir, the all-formatting
* oops lmao
* oh come on why does clang-format have to find some new random edge case every few months
* update tests that failed
* fuck if i know what this was supposed to be
* :we:
* common: Optimize logger by replacing hash map with table lookup and hide implementation details in cpp file
Also bring back assertion noinline functions, this makes call sites of ASSERT/UNREACHABLE much cleaner
* clang format
* review comments
* fix tests
* fix build pt1
* fix build pt2
* fix build pt3
* video_core: respect SPI_BARYC_CNTL front-face encoding
- Read FRONT_FACE_ALL_BITS from SPI_BARYC_CNTL
- Emit +1.0/-1.0 when sign encoding is selected
- Emit integer 1/0 when all-bits encoding is selected
- Carry the register state through FragmentRuntimeInfo
- Add a boolean IR attribute path for FrontFacing
- Include the mode in shader specialization and cache metadata
- Add regression tests covering both AMD-defined encodings
Fixes according Roamic, Raphael, and IndecisiveTurtle recommendations.
* shader_recompiler: Remove unused IsFrontFace attribute and enhance front face handling in translation, rebase
* shader_recompiler: Fix front-face test compilation
- Use the current hw.fs runtime-info layout for front-face encoding.
- Update the regression helper to the HwStage and SwStage APIs.
- Address test compilation feedback from @raphaelthegreat
---------
Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
Co-authored-by: TheTurtle <47210458+raphaelthegreat@users.noreply.github.com>
GCN has the concept of hardware and software stages. Software stages are the shader stages exposed in graphics APIs like opengl/vulkan, and each software stage runs on a hardware stage.
Depending on how many and what software stages are used in a graphics pipeline, the hardware stage a software one is executed on can change, so the mapping is not fixed.
The following table from ACO describes the various combinations for HW-SW stages: https://gitlab.freedesktop.org/mesa/mesa/-/blob/c90ae5f7/src/amd/compiler/README.md#gfx6-8
Certain software stages like the vertex and tess eval shader can run a lot of different hardware stages, which creates problems because runtime info is a tagged union on HW stage.
Current main uses struct inheritance to make it work, but that will get clunky when more data is added to other stages. In general there is a lack of separation between what data
is required when a HW stage is used and what for SW stage.
An example is the tess_emulated_primitive variable. This is used for skipping exports in a software vertex shader when tessellation stages have been inserted after it
for Quad/RectList emulation, because it is undefined behavior to not export them from the last geometry stage. Having this data field in the HW vertex info is not semantically
correct because HW vertex is always the last geometry stage that runs. So this only works when there isnt any HW geometry shader active, as the HW vertex shader is not normally processed in that case.
Another example is shader specialization previously checked the HW vertex stage to specialize the fetch shader. This only works on simple VS+PS pipelines when HW VS runs the SW VS.
Fetch shader is part of the SW VS state, its run on first geometry stage not the last, and this issue got exposed because of the new state separation.
This commit refactors runtime info to contain two tagged unions, one from SW stage and the other HW stage. This makes it obvious what is the scope of each state.
When recompiler does a switch on sw stage, it becomes more apparent it should only access sw state members unless it also checks which hw stage it runs on, which will result in less bugs
* 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>
* 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>
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
The ssa rewrite pass is based on the spirv-opt pass of the same name:
https://github.com/KhronosGroup/SPIRV-Tools/blob/main/source/opt/ssa_rewrite_pass.cpp
This commit brings the pass closer to that reference implementation.
Notably this fixes applying the pass to unstructured graphs which seems to be broken otherwise
Additionally the manual stack iteration of ReadVariable has been replaced with recusion
which is much easier to reason about
Undef handling has also been changed, before each block would define its own Undef instruction,
now the pass will keep track and reuse compatible instructions add insert them to the first block
- Analyze EH function boundaries and relocate faultable guest instructions through red-zone-safe trampolines.
- Integrate Windows exception handling and existing CPU patches without an external debugger.
- Add a Windows-only per-game setting, coverage diagnostics, and configuration tests.
Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
fix: flaky tests due to uninitialized values
fix: segfault during teardown while running gcn tests
fix: vulkan validation error by enabling shaderFloat16 in GCN runner
* Reset controller colours on emulator shutdown
* bruh moment
* Don't use the destructor for this
* clang, formatter of night
* forgot to stage this file
* ffs
* fix tests
* fixed tests?
* gcn tests fixed?
* now?
* possible fixed
---------
Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
* sceHttpAddRequestHeader
* added sceHttpRemoveRequestHeader
* implemented a few more functions
* added sceHttpSetProxy
* cleanup
* more cleanup
* fix tests?
* fix tests part2
* Added debug in SendRequest
* improved debug
* forgot
* added real http connection path
* fixes for wipeout
* add custom redirect as it doesn't match the httplib one
* more debug messages
* clang is not my friend
* argg
* make kernelstub configurable
* added url override
* fixup
* ..
* stephen's reviews
* more stephen reviews
* http tests
* fixed tests
* fixed a single tests isssue
* one more fix
* argg
* more uri work based on decompile and tests
* fix includes
* fix loader stubs
* cleanups
* sceHttpParseStatusLine matches decompile and tests
* sceHttpParseResponseHeader implemenation and tests
* try fixing no-internet path in sendrequest
* minimal state machine to support proper erroring of no-internet available
* more improvements
* more implementation based on stephen's comments
* some more fixes based on decompile
The case-insensitive fallback search() in GetHostPath is only
invoked for patch_path and host_path, so mods whose file or folder
capitalization does not exactly match the guest path are silently
bypassed even when the files are present. Mirror the existing
search(patch_path) pass for mods_path, placed first to preserve
mod > patch > base precedence.
Co-authored-by: Matías Buzzo <matias@mbuzzo.com>
* initial tests for testing Setting<T>
* argg
* keep switch off
* added ci
* fix ci
* merging tests to build.yml
* fixing linux ttests/?
* one more try for ci
* more linux fix for ci
* more ci fixes
* try to fix ctests now
* should fix now
* trying fixing linux tests
* some more tests
* more tests (68 tests) and clang format