Commit Graph

1742 Commits

Author SHA1 Message Date
Billy Laws
06bf1b38af Introduce a pipeline state accessor that reads from a bundle 2022-12-22 18:05:45 +00:00
Billy Laws
7dd3a1db0f Avoid InterconnectContext use in graphics PipelineManager
We will soon move to a global pipeline manager instance, so it wont be possible to use InterconnectContext at pipeline-creation time anymore
2022-12-22 18:05:45 +00:00
Billy Laws
ffe7263848 Add quirk for 615 drivers with broken multithreaded compilation 2022-12-22 18:05:45 +00:00
Billy Laws
755f7c75af Add pipeline (de)serialisation support to bundle
See comments in code for details on the on-disk format.
2022-12-22 18:05:45 +00:00
Billy Laws
937eff392f Switch execution-numbers to be globally unique tags
This is required for making pipelines usable across channels without introducing caching bugs.
2022-12-22 18:05:45 +00:00
Billy Laws
072b8193a1 Implement thread pool based async pipeline compilation with futures
By distributing the load of shader compiling onto multiple threads and then only waiting for completion until absolutely neccessary we can reduce compilation stutters significantly.
2022-12-22 18:05:45 +00:00
Billy Laws
186549748d Implement HelperShader-local pipeline cache and use dynamic state
Avoids the heavy overhead of the VK pipeline cache when we really only have a few bits of non-dynamic state
2022-12-22 18:05:45 +00:00
Billy Laws
9115b8cae8 Properly hash dynamic states in pipeline cache 2022-12-22 18:05:45 +00:00
Billy Laws
7c4b4765bf Reduce thresholds for slot increase and buffer/texture fast readback 2022-12-22 18:05:45 +00:00
Billy Laws
f32ab1feff Include BS thread pool library 2022-12-22 18:05:45 +00:00
Billy Laws
ce428af2e6 Use attachment formats rather than views in VK pipeline cache 2022-12-22 18:05:45 +00:00
Billy Laws
e849264028 Abstract out pipeline-compile-time GPU state accesses
Introduces the base abstractions that will be used for pipeline caching, with a 'PipelineStateBundle' that can be (de)serialised to/from disk and an abstract accessor class to allow switching between creating disk-cached pipelines and fresh ones.
2022-12-22 18:05:45 +00:00
Billy Laws
2e96248fb6 Track RT format info in PackedPipelineState and move VK conv code there
When caching pipelines we can't cache whole images, only their formats so refactor PackedPipelineState so that it can be used for pipeline creation, as opposed to passing in a list of attachments.
2022-12-22 18:05:45 +00:00
Billy Laws
bc7e1eb380 Split-out hash from ShaderBinary struct
This isn't necessary for pipeline creation and creates some difficulty with pipeline caching.
2022-12-22 18:05:45 +00:00
Dima
de10ab1219 Stub SetConnectionConfirmationOption 2022-12-18 20:34:55 +00:00
Dima
f3b2b4317e Stub some IPrepoService calls 2022-12-18 20:34:55 +00:00
Dima
efef67b92b Stub some IAudioDevice calls 2022-12-18 20:34:55 +00:00
Dima
3a94bcf692 Fix ListOpenContextStoredUsers stub
The problem is in StoreOpenContext wasn't storing any user, but ListOpenContextStoredUsers was writing default user (when it's not stored by StoreOpenContext)
2022-12-18 20:34:55 +00:00
TheASVigilante
3c5f8dd876 Fix small typo 2022-12-18 14:49:54 +00:00
lynxnb
6599c1dccf Stub GyroscopeZeroDriftMode
Related service calls are called in a loop by SM3DW. A variable tracking zero drift mode has been added to `npad_device`, but it's unused at the moment.
2022-12-10 14:59:44 +00:00
Dima
dcc3047ba8 Stub ErrorCommonArg 2022-12-10 14:58:20 +00:00
Dima
68253fe995 Stub mii:e/mii:u
Needed for SSBU
2022-12-10 14:58:20 +00:00
Dima
69ee3cfc66 Stub DeleteDirectory
Should allow deleting/rewriting saves in some games
2022-12-10 14:58:20 +00:00
Dima
bbd34ae7e7 Validate if entries are not empty before using
Should fix saving problem in Baldur's Gate: Dark Alliance II at least
2022-12-10 14:58:20 +00:00
Dima
5f510d84d7 Stub IsVibrationPermitted 2022-12-10 14:58:20 +00:00
Dima
51d1f519af Stub ListDisplays 2022-12-10 14:58:20 +00:00
Dima
a3866a3129 Stub LibraryAppletShop 2022-12-10 14:58:20 +00:00
Dima
1ebec7db82 Stub GetImageSize and LoadImage 2022-12-10 14:58:20 +00:00
Dima
52c4228ecf Stub some friends service calls
Needed for Diablo 3
2022-12-10 14:58:20 +00:00
Dima
ebcbc5b05b Validate NpadId for ActivateVibrationDevice 2022-12-10 14:58:20 +00:00
Dima
4bdd033354 Stub SetRecordVolumeMuted 2022-12-10 14:58:20 +00:00
Dima
f6d95aae01 Stub GetCacheStorageSize 2022-12-10 14:58:20 +00:00
Dima
4ab8699cd4 Stub ImportServerPki 2022-12-10 14:58:20 +00:00
Dima
41cf4bb12d Stub GetLanguageCode 2022-12-10 14:58:20 +00:00
Dima
3e078d54b6 Stub GetIdleTimeDetectionExtension 2022-12-10 14:58:20 +00:00
Dima
2311f777fc Stub IsCpuOverclockEnabled 2022-12-10 14:58:20 +00:00
Dima
4601c28c28 Stub GetCurrentIpAddress 2022-12-10 14:58:20 +00:00
Dima
18e6a6c53c Stub DeclareOpenOnlinePlaySession and DeclareCloseOnlinePlaySession 2022-12-10 14:58:20 +00:00
Dima
150c1370c2 Stub some IApplicationFunctions funcs 2022-12-10 14:58:20 +00:00
Dima
a6f3aa3062 Stub TrySelectUserWithoutInteraction and ListQualifiedUsers 2022-12-10 14:58:20 +00:00
Dima
5a9a2861df Add TitleId TextView in App Dialog 2022-12-10 14:57:46 +00:00
Abandoned Cart
b08fcd7027 Favor a predefined "click" over system vibration 2022-12-10 14:57:33 +00:00
Abandoned Cart
cfd3bfecba Add a rudimentary OSC button vibration setting 2022-12-10 14:57:33 +00:00
Billy Laws
7c802aea46 Mark vertex buffers as dirty on limit changes 2022-12-03 22:50:56 +00:00
Billy Laws
df19810c6c Always set vertex stride for unbound buffers 2022-12-03 22:50:56 +00:00
Billy Laws
f4f658e3b7 Fix typo 2022-12-03 22:50:56 +00:00
Billy Laws
45b10ef776 Return whole mapping for shader code when end instrs aren't found 2022-12-03 22:50:56 +00:00
Billy Laws
d849875656 Only unlock GPU channel state on queue wait if it was previously locked 2022-12-03 22:50:56 +00:00
Billy Laws
a5e0a64adc Switch patch error logs to debug 2022-12-03 22:50:56 +00:00
Billy Laws
af7c54297f Cache staging buffer used for texture download 2022-12-03 22:50:56 +00:00
Billy Laws
8c5e6d2bb4 Update VKMA 2022-12-03 22:50:56 +00:00
Billy Laws
bba07fb101 Update for new hades 2022-12-03 22:50:56 +00:00
Billy Laws
a16383fd4b Disable compute shaders on mali
This will need to be debugged properly at some point but its fine for now.
2022-12-03 22:50:56 +00:00
Billy Laws
d69c6851f3 Update hades 2022-12-03 22:50:56 +00:00
Billy Laws
137d801843 Skip host1x HW emulation and effectively stub submission
This was causing a bunch of logspam and isn't really needed as we will be using a HLE approach.
2022-12-03 22:50:56 +00:00
Billy Laws
579a2d9337 Add dynamic executor slot growth 2022-12-03 22:50:56 +00:00
Billy Laws
60169fce4c Support 0-sized constant buffers 2022-12-03 22:50:56 +00:00
Billy Laws
b86dd99e1a Align all SSBOs to 0x40 bytes
Required by Adreno GPUs
2022-12-03 22:50:56 +00:00
Billy Laws
bfae292fb0 Make executor slot count setting exponential 2022-12-03 22:50:56 +00:00
Billy Laws
e0ae94be9d Enable robustness1 Vulkan feature 2022-12-03 22:50:56 +00:00
Billy Laws
e8ef2d80af CMake build file updates 2022-12-03 22:50:56 +00:00
Billy Laws
bf03f945ee Implement the Kepler compute engine
This can reuse a fair bit of the now-commonised Maxwell 3D code and mostly consists of compute-specific pipeline code which was deemed not suitable for being commonised (e.g. descriptor update code is somewhat duplicated). Of note is how compute lacks any active state at all de to its use of QMDs which bundle up all state into a single object in memory.
2022-12-03 22:50:56 +00:00
Billy Laws
4bc81f007f Add some convinience helpers to compute engine regs 2022-12-03 22:50:56 +00:00
Billy Laws
4267a6af36 Add support for parsing and compiling compute shaders to the shader manager 2022-12-03 22:50:56 +00:00
Billy Laws
86dab65af4 Commonise maxwell3d state updater 2022-12-03 22:50:56 +00:00
Billy Laws
a0b81d54d6 Use pitch layout for linear RTs
More likely to match in the texture cache when being sampled.
2022-12-03 22:50:56 +00:00
Billy Laws
ac85df7b7a Start transition cache lookup with most recent one 2022-12-03 22:50:56 +00:00
Billy Laws
62c86b7690 Move maxwell3d to common constant buffer code 2022-12-03 22:50:56 +00:00
Billy Laws
8f0a6e78c5 Add Vulkan stride dynamic state and robustness support
Fixes the waterfall in SMO by specifying vertex buffer bounds.
2022-12-03 22:50:56 +00:00
Billy Laws
23a7f70a8e Commonise maxwell3d guest shader caching code 2022-12-03 22:50:56 +00:00
Billy Laws
6f6a312692 Commonise maxwell3d pipeline binding handling code
A lot of pipeline code is difficult to commonise due to the inherent difference between compute and graphics pipelines, however the binding layout is shared so we can at least commonise that
2022-12-03 22:50:56 +00:00
Billy Laws
be8cbabd97 Commonise maxwell3d texture code
This will be shared with the compute engine implementation.
2022-12-03 22:50:56 +00:00
Billy Laws
61e95c4b2c Commonise maxwell3d sampler code
This will be shared with the compute engine implementation, the only thing of note with this is that the binding register is now passed as a param since it is part of the compute QMD which can't be dirty tracked.
2022-12-03 22:50:56 +00:00
Billy Laws
7f93ec3df6 Commonise maxwell3d interconnect common code for use by other engines
The compute engine will require most of this for basic functionality.
2022-12-03 22:50:56 +00:00
Billy Laws
281838fde1 Apply GPU readback hack to both buffers and textures
And rename as appropriate.
2022-12-03 22:50:56 +00:00
Billy Laws
f358c4517e Update edge credits 2022-12-03 22:50:56 +00:00
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
lynxnb
54d0246ca6 Tweak GpuDriverActivity FAB padding 2022-11-28 00:06:07 +01:00
lynxnb
2e8d7b559c Use the original view padding/margin when applying window insets
Adding to the current view padding/margin values results in applying the insets over and over again as insets listeners can be called multiple times.
2022-11-28 00:04:39 +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
lynxnb
ec220c8ea9 Use an extended FAB in GpuDriverActivity 2022-11-23 19:49:42 +05:30
lynxnb
163f4f2014 Fix window insets handling when in landscape mode
To avoid code duplication, insets handling has been moved to a separate interface.
2022-11-23 19:49:42 +05:30
lynxnb
ab6c5f4c50 Improve robustness of KeyReader.import
* Close the input and output file streams before moving the output file to the final destination
* Clean up the destination path before moving the new file
* Introduce a `ImportResult` return value to differentiate between the possible causes of import errors
* Display more meaningful error messages in the UI
2022-11-23 19:49:42 +05:30
lynxnb
38129d9dc3 Mark some strings as non-translatable 2022-11-23 19:49:42 +05:30
lynxnb
ee8c055641 Make GpuDriverInstallResult PascalCase 2022-11-23 19:49:42 +05:30
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
b209ae8e90 Account for stick flat area when retrieving axes value from a MotionEvent 2022-11-17 21:54:15 +01:00
lynxnb
c966220bab Zero-initialize axes history instead of using null values
Use zero initialization for axes history instead of using null values. Fixes the first axis event after launching a game being completely ignored.
2022-11-17 21:54:15 +01:00
lynxnb
3a657c44cc Don't ignore HAT axes input events
Capture HAT axes events ourselves instead of relying on the android framework to turn them into KeyCodes. Fixes handling of DPAD button presses on most controllers.
2022-11-17 21:54:15 +01:00
lynxnb
f1ec771944 Fix inverted axis polarity
In the case of axis value being zero, polarity would favor one side of the stick resulting in invalid values. Fix that by taking into account axis history when calculating polarity.
2022-11-17 21:54:15 +01:00
lynxnb
675e8dbb2e Move input handling code to a dedicated class 2022-11-17 21:54:15 +01:00
lybxlpsv
18861d73a3 Set systemUiVisibility during onResume for A11 2022-11-17 14:04:57 +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
lynxnb
cc71e7b56c Run emulation in a separate process
Exiting from emulation has always been a big issue for Skyline, with guest and host threads that would keep running in the background unless the app was manually killed. Running emulation in a separate process allows us to kill it when we are done, avoiding the need for complex exiting management code.
2022-11-11 11:49:33 +00:00
lynxnb
281562ccdb Fix FABs ripple effect in OnScreenEditActivity 2022-11-09 23:07:23 +05:30
lynxnb
56f6f8a362 Reword the unsupported gpu drivers message
The old message was being misinterpreted as if the device's gpu was not supported by the emulator. Reword that message to explicitly mention custom drivers.
2022-11-09 23:07:23 +05:30
lynxnb
e2a5da1d67 Fix AppDialog layout
* Add a drag indicator at the top
* Fix flex layout wrapping when buttons didn't fit on a single line
* Fix BottomSheetDialog peek height too small on landscape orientation
* General cleanup of the layout
2022-11-09 23:07:23 +05:30