Apply suggestions from code review pt 1

Co-authored-by: Schplee <24275329+Schplee@users.noreply.github.com>
This commit is contained in:
Matías Locatti 2021-10-11 02:27:53 -03:00 committed by GitHub
parent 4999daa04d
commit 4fb6244765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,16 +6,16 @@ coauthor = "Honghoa"
forum = 0
+++
Hi yuz-ers! Welcome to the latest entry in our monthly progress reports. This time we have yet even more GPU rendering fixes, TAS support, 8 players mayhem, input and UI
Hi yuz-ers! Welcome to the latest entry of our monthly progress reports. We have even more GPU rendering fixes, TAS support, 8 player mayhem, input and UI
changes, some preliminary work for future big changes, and more!
<!--more-->
## **A**fter **T**esting **I**mages, and other graphical fixes
Certain AMD and Intel GPUs were unable to utilize yuzu's unlock FPS feature on Vulkan, due to the lack of driver support for the `VK_PRESENT_MODE_MAILBOX_KHR` presentation mode.
They, however, support `VK_PRESENT_MODE_IMMEDIATE_KHR`, another mode that allows to present at a higher framerate than the screen refresh rate, so
[epicboy](https://github.com/ameerj) made the [necessary changes](https://github.com/yuzu-emu/yuzu/pull/7003) in order to unlock FPS on these GPUs.
Certain AMD and Intel GPUs were unable to utilize yuzu's unlock FPS feature with the Vulkan API, due to the lack of driver support for the `VK_PRESENT_MODE_MAILBOX_KHR` presentation mode.
They, however, support `VK_PRESENT_MODE_IMMEDIATE_KHR`, another mode that allows Vulkan to present at a higher framerate than the screen refresh rate, so
[epicboy](https://github.com/ameerj) made the [necessary changes](https://github.com/yuzu-emu/yuzu/pull/7003) in order to unlock the FPS on these GPUs.
Due to the nature of this presentation mode, this may cause visible tearing on the screen, so bear that in mind if you try this out.
{{< imgs
@ -23,7 +23,7 @@ Due to the nature of this presentation mode, this may cause visible tearing on t
>}}
Booting a title in Linux with the Vulkan API using the Intel Mesa driver resulted in a crash due to a device loss error.
The problem laid on the synchronization between the rendering and subsequent presentation of frames.
The problem was in the synchronization between the rendering and subsequent presentation of frames.
Previously, yuzu would issue the Vulkan `Present` command, then wait for the frame to be rendered before continuing with the process.
While this was fine for other drivers and vendors, ANV (Intels Vulkan driver) expected to have the frame already rendered before this command, which caused this error.
@ -44,16 +44,14 @@ epicboy found out that during the process of initializing Vulkan, the emulator
[assigned Int8Float16s values after its memory was freed.](https://github.com/yuzu-emu/yuzu/pull/7027)
Surprisingly, this only started affecting official AMD drivers recently, after their periodical Vulkan version update.
So we had to lay down the pitchforks, *this time.*
No performance numbers were harmed during the production of these PRs.
Performance returned to normal after the introduction of this PR.
AMD Windows users are also familiar with certain stages in `Super Smash Bros. Ultimate` turning completely white, or ghosting in a way similar to how we used to play when
Internet Explorer froze back in the Windows XP era.
AMD Windows users are also familiar with certain stages in `Super Smash Bros. Ultimate` turning completely white or ghosting, akin to when applications [would freeze](https://i.stack.imgur.com/4Jh7t.jpg) back in the Windows XP era.
Those were the good days.
For you kids out there, yes, there are older Windows versions than 7.
Ahem, anyway, AMD Radeon GPUs lack support for fixed point 24-bit depth textures, or D24 for short, a relatively common texture format.
To bypass this hardware limitation, yuzu uses D32 textures instead, which can cause precision issues during the conversion process.
[By adjusting the Depth Bias and Polygon Offset of yuzus D24 emulation,](https://github.com/yuzu-emu/yuzu/pull/7070) Blinkhawk solves the issue for good.
[By adjusting the Depth Bias and Polygon Offset of yuzus D24 emulation,](https://github.com/yuzu-emu/yuzu/pull/7070) [Blinkhawk](https://github.com/FernandoS27) solves the issue for good.
{{< single-title-imgs
"Fair play, please (Super Smash Bros. Ultimate)"
@ -62,15 +60,15 @@ To bypass this hardware limitation, yuzu uses D32 textures instead, which can ca
>}}
Yet another AMD Radeon specific issue is visible when playing `The Legend of Zelda: Breath of the Wild`.
Terrain textures looked colourful and corrupted, like the default RGB rainbow puke setting of most “gaming” hardware.
Terrain textures were colourful and corrupted, like when a PC gamer dials up the RGB to 11.
This issue affected our regular suspects, GCN4 devices (Polaris, RX 400/500 series) and older, running on the Windows and Linux proprietary Vulkan drivers.
GCN5 (Vega), RDNA1, and RDNA2 devices were unaffected.
The problem resides in how we guess the textures are being handled by the game.
The problem resided in how we guessed the textures were being handled by the game.
Some information first, there are several ways to handle textures, and in this particular example we need to focus on two, `Cube Maps` and `Texture Arrays`.
Some information first: there are several ways to handle textures, and in this particular example we need to focus on two, `Cube Maps` and `Texture Arrays`.
Cube maps are a cube with its six faces filled with different textures.
Cube maps are a cube with its six faces filled with different textures.
The coordinate used to fetch the data, unlike the regular X and Y values, is a single [versor](https://en.wikipedia.org/wiki/Versor) originating from the center and pointing
to the surface of the cube.
@ -86,12 +84,12 @@ texture, and a Z axis used to determine which texture of the array is in use.
>}}
So tl;dr, one is a sphere and the other is a list.
TL;DR, one is a sphere and the other is a list.
Vulkan allows to mark textures to be converted into cube maps later if needed, but the sampling (reading) is determined by the texture type specified by the games shader
Vulkan allows for marking textures to be converted into cube maps later if needed, but the sampling (reading) is determined by the texture type specified by the games shader
instructions. This type is then passed to the graphics API.
We do so and the game instead decides to just keep its textures as arrays, its own decision.
The AMD driver on the other hand decides that the textures shall be sampled as cube maps, ignoring what the texture view determined just before.
We do just this and the game decides to keep its textures as arrays, which is its own decision.
However, the AMD driver decides that the textures should be sampled as cube maps, ignoring what the texture view determined just before.
While this should not be a problem on its own, as coordinates can still be pulled out from the wrong texture type, the driver can end up reading the wrong texel.
@ -109,11 +107,11 @@ shaders to convert most BGR texture formats in OpenGL to avoid mismatched colour
While this can work fine on most current GPUs, theres a performance cost that can affect older and slower products.
Users of Kepler series Nvidia GPUs (usually GTX 600/700 series, with several renamed 800 and 900 series too) could experience those performance penalties while also producing
corrupt rendering.
rendering corruptions.
Instead of using compute shaders to swizzle textures, epicboy figured we could just use `Pixel Buffer Objects`
[(or PBO for short)](https://www.khronos.org/opengl/wiki/Pixel_Buffer_Object) for [all affected texture formats instead.](https://github.com/yuzu-emu/yuzu/pull/7036)
This has many benefits, it solves Kepler BGR issues, improves performance on weak devices from any GPU vendor, and is also a required change for `A.R.T.`, the resolution
scaler in development.
This has many benefits: it solves Kepler BGR issues, improves performance on weak devices from any GPU vendor, and is also a required change for `A.R.T.` (the resolution
scaler in development).
{{< single-title-imgs
"A Hat in Time"
@ -123,7 +121,7 @@ scaler in development.
On the subject of changes needed for the resolution scaler, Blinkhawk implemented [fixes to queries and indexed samplers.](https://github.com/yuzu-emu/yuzu/pull/7077)
The result is fewer crashes while playing `Luigis Mansion 3` on Intel and AMD GPUs, be it on Windows or Linux.
This PR also helps improve stability for `A.R.T.` too.
This PR helps improve stability for `A.R.T.` as well.
Another issue affecting `Luigis Mansion 3` is related to its use of [Tessellation Shaders](https://en.wikipedia.org/wiki/Tessellation_(computer_graphics)) on Vulkan.
The Vulkan specification requires the input-assembler topology to be `PATCH_LIST` in the tessellation stages. Not all games follow this, so
@ -144,7 +142,7 @@ Thanks to this, `WarioWare: Get It Together!` properly renders its models.
them can render properly when using this API.
Both these attributes are part of a set of attributes with specific definitions and uses.
But they were deprecated on newer versions of OpenGL, in favour of "generic" attributes that the programmer can freely define as they want, based on their needs.
But they were deprecated in newer versions of OpenGL in favour of "generic" attributes that the programmer can freely define as they want, based on their needs.
While OpenGL is still able to run shaders that use this legacy feature for the sake of backwards compatibility, they were already considered obsolete by the time Vulkan was
created, which means that this API lacks a fallback.
@ -171,22 +169,22 @@ The format used to store them is the one [TAS-nx](https://github.com/hamhub7/TAS
You can access TAS configuration by going to `Tools > Configure TAS…`
{{< imgs
"./tas.png| "
"./tas.png| TAS Configuration window"
>}}
## Other input changes
Lets start with a nice addition by [german77](https://github.com/german77) that will make `Super Smash Bros. Ultimate` Parsec players happy, and several others too of course.
Lets start with a nice addition by [german77](https://github.com/german77) that will make `Super Smash Bros. Ultimate` players happy, and Parsec users especially so.
Theres now an option to enable [8 player support](https://github.com/yuzu-emu/yuzu/pull/6950) for XInput devices, at the cost of disabling the Web Applet. A small price to pay
for epic fights with your friends.
You can find the option in `Emulation > Configure… > Controls > Advanced > Enable XInput 8 player support (disables web applet)`.
{{< imgs
"./8.png| "
"./8.png| yuzu Controls configuration window"
>}}
[v1993](https://github.com/v1993) later [hid the option on non-Windows OSes,](https://github.com/yuzu-emu/yuzu/pull/7042) as this limitation doesnt apply outside the Windows
[v1993](https://github.com/v1993) later [hid the option for non-Windows OSes](https://github.com/yuzu-emu/yuzu/pull/7042), as this limitation doesnt apply outside the Windows
SDL builds.
Linux kernel drivers for Joy-Cons use a different naming convention than the ones we use on Windows.
@ -196,8 +194,8 @@ Linux kernel drivers for Joy-Cons use a different naming convention than the one
With the release of [Project Hades](https://yuzu-emu.org/entry/yuzu-hades/), yuzu started using a full `Pipeline cache` instead of single stages of the graphics pipeline, both
in Vulkan and OpenGL.
This means parts of our UI were outdated so, [your degenerate writer](https://github.com/goldenx86) decided to simply
[update the context menu entries,](https://github.com/yuzu-emu/yuzu/pull/6976) from Shader cache to Pipeline cache.
This means parts of our UI were outdated, so [your degenerate writer](https://github.com/goldenx86) decided to simply
[update the context menu entries](https://github.com/yuzu-emu/yuzu/pull/6976) from Shader cache to Pipeline cache.
Following suit, [Moonlacer](https://github.com/Moonlacer) helped [replace `Use disk shader cache` with `Use disk pipeline cache`](https://github.com/yuzu-emu/yuzu/pull/6977).
¡Gracias!
@ -208,16 +206,16 @@ As a general rule, the fewer options available, the better.
Morph decided to [eliminate a 2 year old feature,](https://github.com/yuzu-emu/yuzu/pull/7102) [boxcat](https://yuzu-emu.org/entry/yuzu-boxcat/).
BCAT is a network service used by the Nintendo Switch to add content to its games without needing constant updates.
Our old BCAT implementation only added some “gifts” our developers placed into games that were playable at the time, it was unable to support real case uses, like the updates
games like `Animal Crossing: New Horizons` regularly push.
Our old BCAT implementation only added some “gifts” our developers placed into games that were playable at the time. It was unable to support real use cases, like the game
updates `Animal Crossing: New Horizons` regularly pushes.
While the plan is to add support for this in the future, major changes to the file system emulation need to come first.
[behunin](https://github.com/behunin) implemented much needed [clean ups to our debug configuration window.](https://github.com/yuzu-emu/yuzu/pull/7068)
Check the results below:
View the results below:
{{< single-title-imgs
" "
"Before and After, Debug configuration settings"
"./debugbug.png"
"./debugfix.png"
>}}
@ -227,7 +225,7 @@ Check the results below:
epicboy noticed a memory leak that would grew progressively after stopping and restarting the emulation, which was caused by yuzus `main_process` not being cleaned up.
[By destroying this process when stopping emulation ](https://github.com/yuzu-emu/yuzu/pull/7009), the resources are properly freed now, fixing the leak.
Additionally, epicboy also mitigated the crashes that happened when the emulation was stopped by
Additionally, epicboy also mitigated the crashes that happened when emulation was stopped by
[using std::jthread for worker threads](https://github.com/yuzu-emu/yuzu/pull/7019).
`std::jthread` is a [new implementation of the thread class that was recently introduced in C++20](https://en.cppreference.com/w/cpp/thread/jthread), which alleviates their
@ -245,26 +243,26 @@ implementation of the class for yuzu's host threads.
He also made changes so that the KEvents used in the nvflinger [service](https://github.com/yuzu-emu/yuzu/pull/6968) and [queue](https://github.com/yuzu-emu/yuzu/pull/6971)
are owned by these services, instead of being owned the process for the emulated game, which makes the implementation more accurate.
Weve been trying to focus on improving our homebrew support, as this isnt a powerful tool that only developers use, for example modders have very powerful homebrew apps
Weve been trying to focus on improving our homebrew support, as this isnt just a powerful tool that only developers use. For example, modders have very powerful homebrew apps
that the Switch community enjoys.
One important example is [UltimateModManager](https://github.com/ultimate-research/UltimateModManager), or UMM for short, which refuses to work on yuzu for now.
To counter this, [ogniK](https://github.com/ogniK5377) allowed homebrews running in yuzu the [creation of subdirectories](https://github.com/yuzu-emu/yuzu/pull/6974),
To counter this, [ogniK](https://github.com/ogniK5377) allowed homebrew running in yuzu to [also create subdirectories instead of just the parent directory](https://github.com/yuzu-emu/yuzu/pull/6974),
resulting in UMM managing to at least start.
A temporary solution until our much needed filesystem rewrite is finished.
Plus [Morph](https://github.com/Morph1984) did a [partial implementation of the `GetFileTimeStampRaw` function,](https://github.com/yuzu-emu/yuzu/pull/7010) removing
This is a temporary solution until our much needed filesystem rewrite is finished.
Additionally, [Morph](https://github.com/Morph1984) pushed a [partial implementation of the `GetFileTimeStampRaw` function,](https://github.com/yuzu-emu/yuzu/pull/7010) removing
several warnings.
This isnt enough to allow full UMM compatibility, but were getting there.
Some games pop-up a confirmation window when trying to stop emulation.
Moving on to a quality-of-life change, some games pop-up a confirmation window when trying to stop emulation.
{{< imgs
"./exit.png| Like this"
"./exit.png| Like this, End emulation confirmation window"
>}}
This kind of redundant question is made by the game itself and while we always had a toggle to skip it, it wasnt working properly. epicboy comes to the rescue,
[fixing the toggle](https://github.com/yuzu-emu/yuzu/pull/6997) for good and saving us trying to stop our games some seconds of time in the process.
[fixing the toggle](https://github.com/yuzu-emu/yuzu/pull/6997) for good and saving us precious seconds in quitting our games.
If you wish to change this behaviour, the option is in `Emulation > Configure… > General > Confirm exit while emulation is running`.
@ -273,7 +271,7 @@ users storage.
Instead of a separate folder in `%appdata%`, information is now saved in yuzus directory, `%appdata%\yuzu\qtwebengine` by default.
[toastUnlimited](https://github.com/lat9nq)
[performed his first stubbing surgery with the audio input services `Start`, `RegisterBufferEvent`, and `AppendAudioInBufferAuto`.](https://github.com/yuzu-emu/yuzu/pull/7018)
[performed his first stubbing surgery with the audio input services `Start`, `RegisterBufferEvent`, and `AppendAudioInBufferAuto`](https://github.com/yuzu-emu/yuzu/pull/7018).
This way, `Splatoon 2` can now be played via [LAN](https://yuzu-emu.org/entry/yuzu-progress-report-aug-2021/#lan-party-time) without requiring the use of auto-stub. Happy
splatting!
@ -301,9 +299,9 @@ we have to sort out in the future.
Morph has been working on implementing what is needed to get `Diablo II: Resurrected` working.
Initially, the [`Read` socket service was implemented](https://github.com/yuzu-emu/yuzu/pull/7082), but this mandates also implementing more complex services like `Select` and
`EventFD`.
EventFD is particularly tricky as there is no native support for it on Windows, so a considerable amount of work is needed to properly emulate it in the most popular OS.
`EventFD` is particularly tricky as there is no native support for it on Windows, so a considerable amount of work is needed to properly emulate it in the most popular OS.
As a temporary alternative, [Read was just stubbed,](https://github.com/yuzu-emu/yuzu/pull/7085), allowing the game to boot.
As a temporary alternative, [Read was just stubbed](https://github.com/yuzu-emu/yuzu/pull/7085), allowing the game to boot.
{{< imgs
"./diablo.png| Diablo II: Resurrected"
@ -311,15 +309,15 @@ As a temporary alternative, [Read was just stubbed,](https://github.com/yuzu-emu
## Future projects
For anyone wondering about `Project A.R.T.`, the following image speaks of its own.
For anyone wondering about `Project A.R.T.`, the following image speaks for itself.
{{< imgs
"./art.png| Xenoblade Chronicles Definitive Edition"
>}}
Regarding other works, there are more rendering fixes underway, and were already starting plans on what to focus on after A.R.T. is finished.
Regarding works in progress, there are more rendering fixes underway, and were already starting plans on what to focus on after `A.R.T.` is finished.
Thats all folks! We thank you for your kind attention, and see you next month!
Thats all folks! Thank you for your attention and see you next month!
&nbsp;
{{< article-end >}}