Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latte optimizations and tweaks #706

Merged
merged 5 commits into from
Sep 19, 2023
Merged

Conversation

Exzap
Copy link
Member

@Exzap Exzap commented Mar 22, 2023

Changes:

  • Reworked "fast drawing" logic. Fast draws are a special mode where the renderer can skip some of the more expensive per-drawcall checks if only a subset of states was changed. With this PR more drawcalls now qualify for the fast mode, reducing overall CPU load on the GPU emulation thread.
  • Lowered amount of drawcalls that need to accumulate before LatteVk flushes the command buffer. Should decrease latency for texture readbacks.
  • Use heuristic to determine the real resolution of colorbuffers. In cases where the aligned colorbuffer resolution mismatches the texture resolution (e.g. 1920x1088 vs 1920x1080) it is necessary to allocate and synchronize two textures. If we can guess the real colorbuffer resolution correctly we can avoid all the overhead of double textures, lowering VRAM requirements and texture synchronization overhead. Fixes BotW: high GPU load in buy/sell menus #380

@lijunyu-cn
Copy link
Contributor

Perfect most of the time, except for looking into the distance with a telescope or camera.
https://user-images.githubusercontent.com/60218343/227747349-5bfefe50-a14c-418f-85db-72bf813a5c21.mp4

@Squall-Leonhart
Copy link
Contributor

Perfect most of the time, except for looking into the distance with a telescope or camera. https://user-images.githubusercontent.com/60218343/227747349-5bfefe50-a14c-418f-85db-72bf813a5c21.mp4

this is likely due to incompatibility with existing graphics packs

@LuismaSP89
Copy link

I don't pretend to be off-topic, but since here I can see some optimizations on the graphics/vulkan's side, maybe this can be used for Cemu:

https://www.khronos.org/blog/you-can-use-vulkan-without-pipelines-today

@Squall-Leonhart
Copy link
Contributor

I don't pretend to be off-topic, but since here I can see some optimizations on the graphics/vulkan's side, maybe this can be used for Cemu:

Since the effort has already been put in to have the pipeline cache, there isn't any benefit to be had here.

Copy link

@czak czak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to look into it! I was mostly interested in the buy/sell menu bug so I only tested the last commit on top of current main (i.e. b8dec03).

I definitely noticed improved performance with this fix. In the buy/sell screens I can now reach my target 48FPS no problem:

image

However, this fix seems to introduce another issue:

image

Unfortunately, I don't have enough experience to debug this further.
I thought it was the typo in LatteRenderTarget.cpp, but changing that actually made it worse :(
Happy to test any alternatives if anyone can figure this out.

Comment on lines +302 to +304
if (((scissorBoxWidth + 7) & ~7) == colorBufferWidth)
colorBufferWidth = scissorBoxWidth;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is a typo and this was meant instead:

Suggested change
if (((scissorBoxWidth + 7) & ~7) == colorBufferWidth)
colorBufferWidth = scissorBoxWidth;
if (((colorBufferWidth + 7) & ~7) == colorBufferWidth)
colorBufferWidth = scissorBoxWidth;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a typo

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the noise then! 😅 Performance is improved and only the graphics pack was to blame for the issue!

@Squall-Leonhart
Copy link
Contributor

The issue you're seeing is because some aspects of graphics packs are not functional on this PR.

@czak
Copy link

czak commented May 17, 2023

The issue you're seeing is because some aspects of graphics packs are not functional on this PR.

Ah you're right thank you! I had the graphics pack enabled for 1080p. Turning it off resolves the issue 👍

@SunshineFluffy
Copy link

@Squall-Leonhart do you have a pointer on which graphics pack is causing this and how to fix it?

@Squall-Leonhart
Copy link
Contributor

@Squall-Leonhart do you have a pointer on which graphics pack is causing this and how to fix it?

The graphics pack will be updated eventually, Exzap doesn't intend to merge this until 2.1, but its the base resolution pack.

@Exzap
Copy link
Member Author

Exzap commented Sep 19, 2023

Since the color buffer heuristic breaks graphic packs I have disabled it for now. I started updating gfx packs but it will take a while to cover them all. Once those updates are pushed we can enable the heuristic again.

@Exzap Exzap merged commit 90c56b7 into cemu-project:main Sep 19, 2023
5 checks passed
@Exzap Exzap deleted the latte-cp-optimization branch September 19, 2023 20:46
Exzap added a commit to Exzap/Cemu that referenced this pull request Mar 25, 2024
Graphic packs can now set "colorbufferOptimizationAware = true" to enable the framebuffer texture size optimization mentioned in cemu-project#706. If no graphic packs with texture rules are active then the optimization is enabled automatically.
Exzap added a commit to Exzap/Cemu that referenced this pull request Mar 25, 2024
Graphic packs can now set "colorbufferOptimizationAware = true" to enable the framebuffer texture size optimization added in cemu-project#706.
If no graphic packs with texture rules are active then the optimization is enabled automatically now.
Exzap added a commit to Exzap/Cemu that referenced this pull request Mar 25, 2024
Graphic packs can now set "colorbufferOptimizationAware = true" to enable the framebuffer texture size optimization added in cemu-project#706.
If no graphic packs with texture rules are active then the optimization is enabled automatically now.
Exzap added a commit to Exzap/Cemu that referenced this pull request Mar 25, 2024
Graphic packs can now set
"colorbufferOptimizationAware = true" 
to enable the colorbuffer texture size optimization added in cemu-project#706.
If no graphic packs with texture rules are active then the optimization is enabled automatically now.
Exzap added a commit to Exzap/Cemu that referenced this pull request Mar 25, 2024
The optimization for colorbuffer resolution introduced in PR cemu-project#706 is now enabled. This optimization changes the resolution of certain framebuffer textures, which may conflict with the texture resolution rules set by some graphic packs. As a result, if a graphic pack that specifies texture resolution rules is in use, the optimization will automatically be turned off to prevent any issues.

To circumvent this, graphic packs can now include the setting "colorbufferOptimizationAware = true" in their rules.txt. This setting indicates that the pack has been updated to handle the resolution changes introduced by the optimization. Cemu will allow the optimization to remain enabled if resolution packs have this flag set.
Exzap added a commit that referenced this pull request Mar 25, 2024
The optimization for colorbuffer resolution introduced in PR #706 is now enabled. This optimization changes the resolution of certain framebuffer textures, which may conflict with the texture resolution rules set by some graphic packs. As a result, if a graphic pack that specifies texture resolution rules is in use, the optimization will automatically be turned off to prevent any issues.

To circumvent this, graphic packs can now include the setting "colorbufferOptimizationAware = true" in their rules.txt. This setting indicates that the pack has been updated to handle the resolution changes introduced by the optimization. Cemu will allow the optimization to remain enabled if resolution packs have this flag set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BotW: high GPU load in buy/sell menus
6 participants