Commit Graph

676 Commits

Author SHA1 Message Date
PixelyIon
476c070c7a Fix Minor Maxwell3D Register Ordering Issues
We order all registers in ascending order, a few registers namely `colorLogicOp`, `colorWriteMask`, `clearBuffers` and `depthBiasClamp` were erroneously not following this order which has now been fixed.
2022-04-14 14:14:52 +05:30
PixelyIon
32de7e5150 Use decltype over typeof globally
We inconsistently utilized `typeof` and `decltype` all over the codebase, this has now been fixed by uniformly using `decltype` as `typeof` is a GCC extension and not in the C++ standard alongside having the hidden side effect of removing references from the determined type.
2022-04-14 14:14:52 +05:30
PixelyIon
841ee9fc15 Check for vertexAttributeInstanceRateZeroDivisor feature before usage
Check for `vertexAttributeInstanceRateZeroDivisor` in `VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT` when the Maxwell3D register corresponding to the vertex attribute divisor is set to 0. If it isn't then it logs a warning and sets the value anyway which could result in UB since the only alternative is an exception that stops emulation which might not be optimal if the game mostly works fine without this, we will add a user-facing warning when we intentionally allow UB like this in the future.
2022-04-14 14:14:52 +05:30
PixelyIon
c3895a8197 Support VkPhysicalDeviceFeatures2 Extensions
Implement the infrastructure to depend on `VkPhysicalDeviceFeatures2` extended feature structures which can be utilized to retrieve the specifics of features from extensions. It is implemented in the form of `vk::StructureChain` with `vk::PhysicalDeviceFeatures2` that can be extended with any extension feature structures.
2022-04-14 14:14:52 +05:30
PixelyIon
ff5515d4d1 Implement Maxwell3D Vertex Buffer Bindings
This implements everything in Maxwell3D vertex buffer bindings including vertex attribute divisors which require the extension `VK_EXT_vertex_attribute_divisor` to emulate them correctly, this has been implemented in the form of of a quirk. It is dynamically enabled/disabled based on if the host GPU supports it and a warning is provided when it is used by the guest but the host GPU doesn't support it.
2022-04-14 14:14:52 +05:30
PixelyIon
d163e4ffa6 Introduce IOVA union for flipped words of IOVAs in GraphicsContext
The Maxwell3D `Address` class follows the big-endian register ordering for addresses while on the host we consume them in little-endian, the `IOVA` class is the host equivalent to the `Address` class with implicitly flipped 32-bit register ordering. It shares implicit decomposition semantics from `Address` due to similar requirements with a minor difference of being returned by reference rather than value as we want to have value setting semantics with implicit decomposition while we don't for `Address`.
2022-04-14 14:14:52 +05:30
PixelyIon
73646c4da8 Implicitly decompose Address into u64
The semantics of implicitly decomposing the `Address` class into a `u64` were determined to be appropriate for the class. As it is an integer type this effectively retains all semantics from using an integer directly for the most part.
2022-04-14 14:14:52 +05:30
PixelyIon
48d0b41f16 Implement Maxwell3D Common/Independent Color Write Mask
Maxwell3D supports both independent and common color write masks like color blending but for common color write masks rather than having register state specifically for it, the state from RT 0 is extended to all RTs. It should be noted that color write masks are included in blending state for Vulkan while being entirely independent from each other for Maxwell, it forces us to use the `independentBlend` feature even when we are doing common blending unless the color write mask is common as well but to simplify all this logic the feature was made required as it supported by effectively all targeted devices.
2022-04-14 14:14:52 +05:30
PixelyIon
92809f8a78 Implement Maxwell3D Independent/Common Color Blending
Maxwell3D supports independent blending which has different blending per-RT and common blending which has the same blending for all RTs. There is a register determining which mode to utilize and we simply have two arrays of `VkPipelineColorBlendAttachmentState` for the RTs that we toggle between to make the transition between them extremely cheap.
2022-04-14 14:14:52 +05:30
PixelyIon
2ceb6465e8 Make independentBlend a required VkDevice feature
Independent blending is supported by effectively every Vulkan 1.1 Android GPU, it gives us the ability to architecture Maxwell3D blending emulation better as we can avoid additional checks for independent blending state and having a fallback path for when the host doesn't support the feature.
2022-04-14 14:14:52 +05:30
PixelyIon
cd737fbdd8 Add Required VkDevice Features
A prior commit added the ability to utilize features with quirks but this implements the ability to require a feature be present on the host or an exception will be thrown. It allows us to make useful assumptions that result in a better architecture in certain cases.
2022-04-14 14:14:52 +05:30
PixelyIon
081d3277c1 Enable Quirk + Required VkDevice Extensions
Implements the infrastructure required to enable optional extensions set in `QuirkManager` alongside the required extensions in the `GPU` class. All extensions should be correctly resolved now and according to what the device supports.
2022-04-14 14:14:52 +05:30
PixelyIon
6099b1ead5 Fix Maxwell3D Register lineWidthAliased Offset
The offset was incorrectly set to `0x4D` rather than `0x4ED` which is what it should be. This would've led to bugs in line width determination and likely broken any aliased line rendering entirely.
2022-04-14 14:14:52 +05:30
PixelyIon
51659e1329 Enable VkDevice Features Selectively
We selectively enable GPU features that we require as enabling all of them might result in extra driver overhead in certain circumstances. Setting them is handled by `QuirkManager` with the new `FEAT_SET` function that ties a quirk with a feature.
2022-04-14 14:14:52 +05:30
PixelyIon
ec378814aa Stub Maxwell3D Alpha Testing
We stub alpha testing as it doesn't exist in Vulkan and few titles use it, it can be emulated in the future using a shader patch with manually discarding fragments failing the alpha test function but this'll be added in later as it isn't high priority at the moment and has associated overhead with it so other options might be explored at the time.
2022-04-14 14:14:52 +05:30
PixelyIon
83ec99fa48 Print GPU Quirks At Startup
It is essential to know what quirks a certain GPU may have to debug an issue, these are now printed at startup into the log alongside all other GPU information. A new `QuirkManager::Summary` function was implemented to provide this functionality.
2022-04-14 14:14:52 +05:30
PixelyIon
01eb16e59a Implement Maxwell3D Color Logic Operations
Implements a basic part of Vulkan blending state which are color logic operations applied on the framebuffer after running the fragment shader. It is an optional feature in Vulkan and not supported on any mobile GPU vendor aside from ImgTec/NVIDIA by default.
2022-04-14 14:14:52 +05:30
PixelyIon
662935c35d Attempt Flushing Logger During Fatal Signals
Any signals that lead to exception handling being triggered now attempt to flush all logs given that the log mutex is unoccupied, this is to mostly help logs be more complete when exiting isn't graceful.
2022-04-14 14:14:52 +05:30
PixelyIon
586bee2c59 Remove Maxwell3D Zero Initialization Calls
A lot of calls in Maxwell3D register initialization ended up setting the register to 0 which should be implicit behavior and most calls would be eliminated by the redundancy check which had to be manually disabled. It was determined to be better to move this responsibility to the called function to initialize to state equivalent to the corresponding register being 0. All initialization calls with the argument as 0 have been removed now due to this, it was the vast majority of calls.
2022-04-14 14:14:52 +05:30
PixelyIon
49cc0964e2 Initialize Maxwell3D Registers Correctly
Maxwell3D Registers weren't initialized to the correct values prior, this commit fixes that by doing `HandleMethod` calls with all the register values being initialized. This is in contrast to the registers being set without calling the methods in `GraphicsContext` or otherwise resulting in bugs.
2022-04-14 14:14:52 +05:30
PixelyIon
ea87b8878c Implement B8G8R8A8{Unorm/Srgb} RT Format
Needed by Maxwell3D Register Initialization
2022-04-14 14:14:52 +05:30
PixelyIon
69e7d8b574 Remove Vulkan to Skyline Format Conversion Function
The function `GetFormat` was seemingly no longer required due to us never converting from a Vulkan format to a Skyline format, most conversions only went from Skyline to Vulkan and were generally lossy due to certain formats being missing in Vulkan and approximated using channel swizzles. As a result of this, it was pointless to maintain and has now been removed.
2022-04-14 14:14:52 +05:30
PixelyIon
e8656a362f Add Skyline Logs to .gitignore
It's useful to place Skyline logs within the project folder for easy access in Android Studio but they shouldn't be committed to the repository. They have been added to `.gitignore` to prevent them from being tracked or committed.
2022-04-14 14:14:52 +05:30
PixelyIon
5ed26fef23 Implement Maxwell3D Rasterizer State
Maxwell3D registers relevant to the Vulkan Rasterizer state have been implemented aside from certain features such as per-face polygon modes that cannot be implemented due to Vulkan limitations. A quirk was utilized to dynamically support the provoking vertex being the last vertex as opposed to the first as well.
2022-04-14 14:14:52 +05:30
PixelyIon
8ef225a37d Introduce QuirkManager for runtime GPU quirk tracking
We require a way to track certain host GPU features that are optional such as Vulkan extensions, this is what the `QuirkManager` class does as it checks for all quirks and holds them allowing other components to branch based off these quirks.
2022-04-14 14:14:52 +05:30
PixelyIon
8803616673 Reorder GraphicsContext Members
All members are now placed at the start of sections they are relevant to rather than  at the start of the class.
2022-04-14 14:14:52 +05:30
PixelyIon
107d337d77 Fix MacroInterpreter::MethodAddress Bitfield Padding
Due to compiler alignment issues, the bitfield member `increment` of `MacroInterpreter::MethodAddress` was mistakenly padded and moved to the next byte. This has now been fixed by making its type `u16` like the member prior to it to prevent natural alignment from kicking in.
2022-04-14 14:14:52 +05:30
PixelyIon
26966287c7 Implement Maxwell3D Shader Program Registers
This commit added basic shader program registers, they simply track the address a shader is pointed to at the moment. No parsing of the shader program is done within them.
2022-04-14 14:14:52 +05:30
PixelyIon
93ea919c8f Fix warnings from NVRESULT due to unused lambda capture
A previously used `this` capture is no longer used since the introduction of the static logger.
2022-04-14 14:14:52 +05:30
Niccolò Betto
8826c113b0 Update README.md
* Reworded `Special Thanks` section
* Added links to contributing and building guides for easier navigation
2022-04-14 13:54:51 +05:30
lynxnb
e4a04968dc Create a BUILDING.md file with building instructions 2022-04-14 13:54:51 +05:30
lynxnb
882b939335 Automatically import key files from search location 2022-03-25 09:40:21 +05:30
Robin Kertels
6cf2ef8fb9 Grant Uri permission when sharing logs 2022-03-24 03:39:41 +05:30
lynxnb
092dcb18c8 Stub ectx:w and ectx:aw Glue services 2022-02-06 21:57:38 +05:30
Robin Kertels
2993f65a1c Ignore empty lines in key files 2022-02-04 23:51:46 +05:30
MCredstoner2004
0ceecbba4f Implement fixed aspect ratio surface
Adds a setting to letterbox the surface with black bars to 16:9 or 21:9 aspect ratio to avoid stretching out the rendered image
2022-01-12 22:09:39 +05:30
Clownacy
6cf9bc5729 Fix a typo in the readme
A possessive 'its' doesn't have an apostrophe.
2021-12-20 16:02:17 +00:00
lynxnb
6913a90361 Use the new log file name & ext for every logger context 2021-11-11 16:32:19 +01:00
lynxnb
5cd1f01690 Refactor all logger calls 2021-11-11 16:13:24 +01:00
lynxnb
769e6c933d Make Logger class static and introduce LoggerContext
A thread local LoggerContext is now used to hold the output file stream instead of the `Logger` class. Before doing any logging operations, a LoggerContext must be initialized.
This commit will not build successfully on purpose.
2021-11-11 16:13:24 +01:00
PixelyIon
69ef93bfa8 Add Dividers to ControllerActivity's RecyclerView
Dividers after titles were missing in `ControllerActivity` which made it look inconsistent with `SettingsActivity` which did have them. They have now been added by extending `DividerItemDecoration` to be drawn before any `ControllerHeaderItem`.
2021-11-11 20:20:19 +05:30
PixelyIon
b230afcd35 Fix FAB Icon color in OnScreenEditActivity
The icons in these FABs had the same color as the FAB prior which led them to being invisible. This has been fixed by setting a white tint on them which makes the icons clearly visible.
2021-11-11 18:59:09 +05:30
PixelyIon
e4fbee1626 Style Improvements to LicenseDialog
Additional padding has been added to the text alongside making it be left-aligned rather than center-aligned and justified. A newline has also been added to the copyright notice for Skyline to make it look nicer.
2021-11-11 16:35:30 +05:30
PixelyIon
36a1f2a2ec Make all Dialogs use @color/backgroundColor as the background color
We wanted the color of the modals used by the dialogs to be the same as our regular background color rather than a lighter grey. This has now been enforced with style attributes in the case of `AlertDialog` and `setBackground` in the case of `BottomSheetDialog`.
2021-11-11 16:34:38 +05:30
PixelyIon
3f3891839e Make all AlertDialogs use MaterialComponents theme
We inconsistently used `AppCompat`'s `AlertDialog` theme in Settings while using `MaterialComponents`'s theme in Controller Configuration. This has now been fixed by universally using the `MaterialComponents` theme.
2021-11-11 16:28:57 +05:30
PixelyIon
ff5887975b Remove Logo from MainActivity
The Skyline logo was added to the title area but it ended up being too distracting with a light theme as the logo was designed purely for a white background. Ultimately, even though it looked good with the dark theme we had to remove it.
2021-11-11 13:58:25 +05:30
PixelyIon
43b9d95dbc Rework App Dialog Buttons
Aligning the buttons to the bottom of the game image was determined to look odd due to the amount of padding between the title and buttons. They are now back to being below the title but the buttons have been resized with "Play" being a wide button while "Pin" has been replaced with Google Material Icons's "Add To Home Screen" icon and sized down to an icon-only button.
2021-11-11 13:47:20 +05:30
lynxnb
6a0ad25c27 Update BottomSheetDialog appearance
* Fix incorrect dialog surface color
* Adjust buttons' position
2021-11-10 17:41:07 +01:00
lynxnb
df120ab76d Fix unicode characters being turned into emojis for some vendors 2021-11-10 17:41:07 +01:00
lynxnb
b7b0f07ba8 Update application branding
- Logo is now displayed next to the app name
- Remove search bar animation
- New color accent
- Improve visibility of controller binding setting's glyphs
2021-11-10 17:41:07 +01:00