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

Avoid scaling 2d textures that could be used as “3d“ #3464

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

riperiperi
Copy link
Member

This PR adds another “safe mode” toggle for scaling that disables it for 2d textures that might be used as 3D. These textures essentially have a line of “slices” stacked in the x direction, rather than using a real 3d texture, as it is easier to render into. Games that dynamically update a 3D look-up-table to do tone mapping might do this. If that texture were scaled, the slices would blend into each other, causing black to appear as red, and bright red to darken too.

Some notes about the rules:

  • It is assumed that the slices are stacked in the x-direction.
  • It is assumed that the “slice” count is the same as the height, so the width is the height squared.
  • Due to other rules, minimum affected texture size is 64x8

Hopefully this should fix issue #3456 , but all those games are on different engines so it does need tested.

@riperiperi riperiperi added gpu Related to Ryujinx.Graphics fix Fix something labels Jul 13, 2022
@meisiek
Copy link

meisiek commented Jul 13, 2022

Fixes the red screen in "Lost in Random", "Far: Changing Tides" and "A Hat in Time".
I don't own the other games.

@edisionnano
Copy link
Contributor

Could it fix the similar issue occuring on AMD linux when playing SMO in handheld mode?

@riperiperi
Copy link
Member Author

riperiperi commented Jul 13, 2022

No, I believe that issue is caused by out of bounds image access, which needs a feature to be available and enabled on vulkan, and I guess on opengl there is no workaround.

EDIT: This extension does cover out of bounds texel fetch on opengl, might be worth looking into:
https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_robust_buffer_access_behavior.txt

@EliEron
Copy link
Contributor

EliEron commented Jul 13, 2022

I can confirm the PR fixes the issue in World's End Club.

2x Master:
Ryujinx_IlhVa4eXaC

2x PR:
Ryujinx_zd4HNozH0K

@Niwu34
Copy link
Contributor

Niwu34 commented Jul 13, 2022

Fixes Cruis'n Blast & A Hat in Time & Lost in Random
Master:
CnB - Master
PR3464:
CnB - Fix

Master:
AhIT - Master
PR3464:
AhIT - Fix

Master:
Lost in Random - Master
PR3464:
Lost in Random - Fix

@gdkchan
Copy link
Member

gdkchan commented Jul 14, 2022

Seems to be working on Demon's Gaze Extra too:
image

Copy link
Member

@gdkchan gdkchan left a comment

Choose a reason for hiding this comment

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

lgtm, thanks. Nice to see this issue finally fixed.

@zombie167
Copy link

Fix red tint
Sherlock Holmes: The Devil's Daughter

Master build
MASTER2

PR build
PR2

Pascal's Wager: Definitive Edition

Master build

MASTER

PR build

PR

@Djipi71
Copy link

Djipi71 commented Jul 15, 2022

Test the Build. I can confirm that the scaling problem red is now solved.
Agatha Christie The First Cases
Sherlock Sin and Punishment
Lost in random
Sherlock Devil Daughter

All are perfect now

@gdkchan gdkchan merged commit 5811d12 into Ryujinx:master Jul 15, 2022
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix something gpu Related to Ryujinx.Graphics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants