* 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>
* 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
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
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
* added method to retrieve all socket handles
* fixed some error codes
* copyright or kalaposfos will hunt me
* sceNetGetSockInfo added
* small fixups
* fixup
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
Boot to black screen.
Fully booting.
Move runtime-deps to top scope.
Fully booting with reduced inputs.
Concat runtimeDeps to sdlConfigureDeps.
Removed duplicate packages in sdlConfigureDeps
Removed vulkan-loader and libX11 from runtimeDeps as not shared with
sdlConfigureDeps, moved directly into makeLibraryPath
Flatten lists before passing to makeLibraryPath
Formating.
* spirv: emulate GCN MSAA sample index wrapping in ImageRead
GCN hardware silently wraps out-of-range MSAA sample indices
(e.g. index 2→0, 3→1 on a 2x render target). Vulkan requires
valid sample indices and returns undefined values otherwise,
which corrupts neighbourhood min/max in the TAA resolve pass
and produces severe motion ghosting.
Fix by emitting OpImageQuerySamples + OpUMod to compute
ms %= actual_sample_count when the image is Color2DMsaa.
(Claude Code / deepseek-v4-pro)
* buffer_cache: add memory barrier before download copyBuffer
DownloadBufferMemory copies a GPU buffer into the download staging buffer
without any barrier between the compute dispatch that wrote the buffer
(SHADER_WRITE) and the vkCmdCopyBuffer that reads it (TRANSFER_READ).
The copy can therefore read stale L2 contents written before the
dispatch. This surfaced as all-zero readbacks of the cascade shadow
AABB ring buffer, which produced wrong split distances and flickering /
missing shadows.
Insert a pipelineBarrier2 before the copy, synchronising the whole buffer
from eMemoryRead|eMemoryWrite to eTransfer|eTransferRead.
(Claude Code · deepseek-v4-pro)
* buffer_cache: Stub HTILE zmask bits to uncompressed state on reads
* vk_rasterizer: Replace assert with warning
The assertion isnt actually useful at all but still keeping it as a log since its a rare case
* vk_rasterizer: Log invalid T# rejection
* vk_rasterizer: Reject T# with pitch smaller than width
* clang format
---------
Co-authored-by: Tdlife Peng <tdlief.peng@gmail.com>