Commit Graph

1376 Commits

Author SHA1 Message Date
Billy Laws
eb00dc62f8 Implement support for 36 bit games by using split code/heap mappings
Although rtld and IPC prevent TLS/IO and code from being above the 36-bit AS limit, nothing depends the heap being below it. We can take advantage of this by stealing as much AS as possible for code in the lower 36-bits.
2022-12-02 22:10:03 +00:00
Dima
e8e1b910c3 Add possibility to disable audio output 2022-12-02 00:33:28 +01:00
lynxnb
70109f8fbd Work around invalid values in CNTFRQ_EL0 register
Exynos SoCs have a bug where the `CNTFRQ_EL0` register is either set to 0 or contain incoherent values. With this patch, the frequency value is loaded into a static variable and used instead of reading the register. The value will be initialised to the correct value for affected SoCs, while unaffected ones will use the value from the register.
2022-12-02 00:23:28 +01:00
Billy Laws
b2384e83f5 Add prepo:a service 2022-11-25 16:26:00 +00:00
Billy Laws
736216a6f4 Stub OpenPatchDataStorageByCurrentProcess 2022-11-25 16:26:00 +00:00
Billy Laws
44033d7f8d Adjust CalendarTime year to be relative to 0AD 2022-11-25 16:26:00 +00:00
Billy Laws
2ce2604421 Implement VFS file deletion 2022-11-25 16:26:00 +00:00
Billy Laws
6c968e0357 Fix GetEntryType IPC return type 2022-11-25 16:26:00 +00:00
Billy Laws
7f1667de82 Avoid using trapping for frequently trapped shaders
Fall back to hashing for every shader access as that ends up being faster than applying traps for every execution.
2022-11-19 12:49:05 +00:00
Billy Laws
06095918a9 Introduce per-channel sequence number for invalidation tracking
For cases like shaders, which may be uploaded through I2M (which no longer causes an execution) we need a way to cause an invalidation on all writes
2022-11-19 12:49:05 +00:00
Billy Laws
97e3f7fd34 Increase max swapchain image count 2022-11-19 12:49:05 +00:00
Billy Laws
c49119f5ef Fixup depth bounds register arguments 2022-11-19 12:49:05 +00:00
Billy Laws
db3c5c33c4 Clamp depth bounds into 0-1 range 2022-11-19 12:49:05 +00:00
Billy Laws
e1bbd521d9 Fix potential circular queue submission race
If a producer thread was waiting for the queue to have free space and the consumer thread hadn't yet acquired the production mutex a deadlock could occur
2022-11-19 12:49:05 +00:00
Billy Laws
13baf2312f Add a workaround for sampling BGRA textures with a swizzle 2022-11-19 12:49:05 +00:00
Billy Laws
13a96c5aba Implement a helper shader for partial clears
These are not natively supported by Vulkan, so use a helper shader and colorWriteMask for the same behaviour.
2022-11-19 12:49:05 +00:00
Billy Laws
ac0e225114 Use vkCmdBlit for texture copies when formats dont match 2022-11-19 12:49:05 +00:00
Billy Laws
c8fc8f84ec Fallback to RGBA888 for unsupported swapchain formats as opposed to swizzle 2022-11-19 12:49:05 +00:00
Billy Laws
e0bc0d3a97 Avoid megabuffering buffers larger than the chunk size 2022-11-19 12:49:05 +00:00
Billy Laws
b6f49884b3 Use lower_bound to speedup texture hostMapping lookup 2022-11-19 12:49:05 +00:00
Billy Laws
e7fda28ac6 Skip over textures in cache which have been replaced with a layer/mip match 2022-11-19 12:49:05 +00:00
Billy Laws
88cc696c7f Only use 2D array depth targets when depth > 1 2022-11-19 12:49:05 +00:00
Billy Laws
7fed971b2d Take firstIndex into account when calculating index (quad) buffer size
Without this we would miss any elements beyond indexCount in the index buffer and they would be filled with random garbage causing vertex bombs
2022-11-19 12:49:05 +00:00
Billy Laws
1f9de17e98 Begin command buffers asynchronously in command executor
vkBeginCommandBuffer can take quite some time on adreno, move it to the cycle waiter thread where it won't block GPFIFO.
2022-11-19 12:49:05 +00:00
Billy Laws
4b3e906c22 Update cached buffer execution number when megabuffering 2022-11-19 12:49:05 +00:00
Billy Laws
3ae1e78544 Match mip layers and array layers in texture manager 2022-11-19 12:49:05 +00:00
Billy Laws
d502adb309 Avoid WRW hazard in subpass deps 2022-11-19 12:49:05 +00:00
Billy Laws
e9313cc291 Use view layer count over texture for attachments 2022-11-19 12:49:05 +00:00
Billy Laws
e65ca52d91 Avoid potential buffer copy race 2022-11-19 12:49:05 +00:00
Dima
720cfaafb6 Stub caps:su 2022-11-18 15:35:03 +00:00
Dima
74afca4aab Stub caps:u 2022-11-18 15:35:03 +00:00
Dima
27ff1ae19b Stub caps:c 2022-11-18 15:35:03 +00:00
Dima
ffb0546609 Stub caps:a 2022-11-18 15:35:03 +00:00
Dima
1c8736cb56 Stub IsLargeResourceAvailable 2022-11-18 12:52:25 +00:00
Dima
dcd9e4ff61 Stub SetIdleTimeDetectionExtension, SetAlbumImageTakenNotificationEnabled 2022-11-18 12:52:25 +00:00
Dima
60843269de Stub GetBlockedUserListIds and UpdateUserPresence 2022-11-18 12:52:25 +00:00
Dima
2cdfc7640c Stub GetPreviousProgramIndex 2022-11-18 12:52:25 +00:00
Dima
360306eb61 Stub GetAddOnContentListChangedEventWithProcessId 2022-11-18 12:52:25 +00:00
Dima
3d475ca122 Stub GetAccountId 2022-11-18 12:52:25 +00:00
Dima
0b452fe36b Stub GetFriendList 2022-11-18 12:52:25 +00:00
Dima
cc37d2231d Stub CheckFreeCommunicationPermission and IsFreeCommunicationAvailable 2022-11-18 12:52:25 +00:00
Dima
ec81c97fa9 Stub TryPopFromFriendInvitationStorageChannel 2022-11-18 12:52:25 +00:00
Dima
413f162cf2 Stub some account functions 2022-11-18 12:52:25 +00:00
lynxnb
675e8dbb2e Move input handling code to a dedicated class 2022-11-17 21:54:15 +01:00
Dima
262ee28611 Stub some bsd functions
Co-authored-by: Lunar-Pixel <83507264+Lunar-Pixel@users.noreply.github.com>
2022-11-15 16:24:33 +00:00
Dima
9afa8b881e Stub nsd:u/nsd:a and sfdnsres services 2022-11-15 16:24:33 +00:00
Billy Laws
01e27bd2dd Implement ldr:ro LoadModule 2022-11-15 16:23:40 +00:00
Billy Laws
e571066409 Stub ldr:ro IRoInterface
Some games initialise this service on startup however don't actually use it. Add a simple stub to allow such games to boot.
2022-11-15 16:23:40 +00:00
Billy Laws
1fc2641746 Stub the web applet 2022-11-13 11:37:18 +00:00
Billy Laws
021f82ef08 Stub ListOpenContextStoredUsers 2022-11-13 11:35:40 +00:00
Billy Laws
e7bab27d85 Fixup nvdrv channel private memory allocation
This was incorrectly allocated in words, rather than bytes, meaning that guest allocations could overwrite the private memory and break inline syncpt operations
2022-11-13 11:35:40 +00:00
Billy Laws
8b523fa1f0 Avoid inline syncpt increments sending OOB GpEntries
In cases where no wfi is required, the space where the WFI commands would go needs to be zeroed out to avoid the GPU reading uninitialised memory.
2022-11-13 11:35:40 +00:00
Billy Laws
cd0b2636e5 Prevent truncation of big page start in GetVaRegions 2022-11-13 11:35:40 +00:00
Billy Laws
f650f32bf0 Avoid duplicating NvDrv buffer unmap code 2022-11-13 11:35:40 +00:00
Billy Laws
001064b7bf Fix GraphicsBufferProducer recreation
We need to use a shared_ptr to ensure that the present callback doesn't do any UAFs, also unlocks the GBP during presentation as if the queue is full a deadlock could a rise where the present callback wouldn't be able to run due to the (waiting) DequeueBuffer thread holding the lock.
2022-11-13 11:35:40 +00:00
Billy Laws
29e89a3950 Fix crashes when opening non-existent directories 2022-11-13 11:35:40 +00:00
Billy Laws
ec139b3027 Fixup CancelBuffer fence handling 2022-11-13 11:35:40 +00:00
Billy Laws
7f24c7b857 Store KMemory object ptrs in memory class to avoid linear-time unmap
This is quite a horrible solution but fixing it properly would require a whole rewrite of how we handle memory.
2022-11-13 11:35:15 +00:00
Billy Laws
388245789f Restructure ConditionalVariableSignal to avoid potential deadlock
Since InsertThread can block for paused threads, we need to ensure we unlock syncWaiterMutex when calling it.
2022-11-09 23:02:26 +05:30
PixelyIon
f4a8328cef Implement Symbol Hooking
Symbol hooking is required for HLE implementations of certain features in the future such as `nvdec` and for more in-depth debugging of games as we can inspect them on a SDK function level which allows us to debug issues far more easily.
2022-11-07 23:56:22 +05:30
PixelyIon
8892eb08e6 Fix MoveRegister to clear when value is 0
The register wouldn't be cleared with a `MOVZ` when a value was zero due to the condition for writing an instruction requiring the `offsetValue` to be non-zero.
2022-11-07 23:56:22 +05:30
Billy Laws
f7ab3abb86 Allow load balancing when waiting on condvars 2022-11-06 20:47:26 +00:00
german77
b6e2fb894c service: bcat: Stub CreateDeliveryCacheStorageService 2022-11-06 20:39:41 +00:00
Billy Laws
026bb04386 Impl some more texture formats 2022-11-02 17:46:07 +00:00
Billy Laws
133f08ed14 Stash new register value before executing deferred draws/updates
Since the register writes technically happen after the draw, issues can occur if they happen before: e.g. skyrim updates ctSelect and disables all RTs after a draw, but this would happen before it previously and crash the driver.
2022-11-02 17:46:07 +00:00
Billy Laws
c50852e546 Implement the draw(...)BeginEnd Maxwell3D draw registers
Used by guest Vulkan games and nouveau.
2022-11-02 17:46:07 +00:00
Billy Laws
270ef3e0d2 Implement GPFIFO semaphore acquire operations 2022-11-02 17:46:07 +00:00
Billy Laws
2ce146e28f Don't crash on the Grp0SetSubDevMask TertOp
Used by Vulkan games to set the SLI mask, not applicable to the switch.
2022-11-02 17:46:07 +00:00
Billy Laws
1d83dadefb Drop size restruction bypass for frequently synced buffers
In cases where large buffers are updated every draw this could seriously increase memory usage beyond 3GB in the megabuffer.
2022-11-02 17:46:07 +00:00
Billy Laws
1088ed514c Introduce texture usage system to ensure RPs are split when necessary
Vulkan doesn't allow sampling a texture and using it as an RT in the same RP, by tracking the texture usage status and splitting RPs when this occurs we can avoid such potential sync errors.
2022-11-02 17:46:07 +00:00
Billy Laws
2dd4698441 Adjust texture matching hacks 2022-11-02 17:46:07 +00:00
Billy Laws
4f5c9047ef Add some additional texture formats used by Vulkan games 2022-11-02 17:46:07 +00:00
Billy Laws
6a830dfac5 Use shader-compiler side {S,U}Scaled format emulation 2022-11-02 17:46:07 +00:00
Billy Laws
579fd04117 Fixup ReadTextureType shader compiler callback 2022-11-02 17:46:07 +00:00
Billy Laws
b04d18eba5 Add support for split mappings to I2M uploads
Used by Super Mario Sunshine and other Vulkan games.
2022-11-02 17:46:07 +00:00
Billy Laws
db5e208379 Clear images even when aspects mismatch 2022-11-02 17:46:07 +00:00
Billy Laws
3c8df327f1 Fixup subpass barriers and flags 2022-11-02 17:46:07 +00:00
Billy Laws
5ab80901c6 Drop some debug code 2022-11-02 17:46:07 +00:00
Billy Laws
4de89c8839 GPU NEW MARGEBAC 2022-11-02 17:46:07 +00:00
Billy Laws
7670c83405 Ensure textures are clean before paging them out 2022-11-02 17:46:07 +00:00
Billy Laws
1a2351386d Add u64 iova ctor 2022-11-02 17:46:07 +00:00
Billy Laws
93d43e0115 Fully fill in swizzle component mappings
Avoids the rest being default initialised to identity, which would break the intended effect of them.
2022-11-02 17:46:07 +00:00
Billy Laws
37ff0ab814 Add buffer manager support for accelerated copies
These will be sequenced on the GPU/CPU depending on what's optimal and avoid any serialisation
2022-11-02 17:46:07 +00:00
Billy Laws
cac287d9fd Implement accelerated uploads/copies through buffer manager
Previously, both I2M uploads and DMA copies would force GPU serialisation if they happened to hit a trap or were used to copy GPU dirty buffers. By using the buffer manager to implement them on the host GPU we can avoid such slowdowns entiely.
2022-11-02 17:46:07 +00:00
Billy Laws
c5ec484d9a Avoid redundantly passing executor in ctors when it's already in ChannelCtx 2022-11-02 17:46:07 +00:00
Billy Laws
463394ba72 Pass correct size for XFB buffers 2022-11-02 17:46:07 +00:00
Billy Laws
bd976676f4 Fix SNorm vertex formats 2022-11-02 17:46:07 +00:00
Billy Laws
b74098570f Zero-out unused XFB varyings before passing to hades 2022-11-02 17:46:07 +00:00
Billy Laws
22f3ba6b93 Mark XFB buffers as GPU dirty 2022-11-02 17:46:07 +00:00
Billy Laws
26aeeaecf5 Add constant buffer GPU write pipeline barrier 2022-11-02 17:46:07 +00:00
Billy Laws
0b5d9308c4 Be more careful about potentially-unneeded GPU->CPU syncs
These can be especially expensive so should be avoided as much as possible.
2022-11-02 17:46:07 +00:00
Billy Laws
e6530e2386 Delete graphics_context
F
2022-11-02 17:46:07 +00:00
Billy Laws
b24a8465da Don't require depthClamp 2022-11-02 17:46:07 +00:00
Billy Laws
9055c98e09 Only enable debug/verbose logs in (rel)debug builds 2022-11-02 17:46:07 +00:00
Billy Laws
0ebdbcf0ff Don't lock stateMutex when updating buffer cycle 2022-11-02 17:46:07 +00:00
Billy Laws
dd360b8f75 Pass correct wait semaphore array size to queue submit 2022-11-02 17:46:07 +00:00
Billy Laws
c78a4b9699 Fixup buffer recreation to avoid deadlock when waiting on srcs 2022-11-02 17:46:07 +00:00
Billy Laws
d236bfe454 Enable depthClamp VK device feature 2022-11-02 17:46:07 +00:00
Billy Laws
95d849e1f6 Check FenceCycle signalled flag immediately before waiting
The lock release within the wait for submission means that another thread could end up signalling the cycle and then the VK wait still happen after when the lock has been reacquired.
2022-11-02 17:46:07 +00:00
Billy Laws
1a23b929a7 Avoid chaining cycles in buffer recreation
This had a chance of creating circular chains which obviously caused issues, just do a wait instead for now.
2022-11-02 17:46:07 +00:00