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

Elements missing when scoping in Valkyria Chronicles II (ULUS-10515) #13462

Open
justafella opened this issue Sep 21, 2020 · 39 comments
Open

Elements missing when scoping in Valkyria Chronicles II (ULUS-10515) #13462

justafella opened this issue Sep 21, 2020 · 39 comments
Labels
Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues
Milestone

Comments

@justafella
Copy link

What happens?

Things such as objects from scenery disappear while scoping. Sometimes soldiers get cropped as well if they're in front of those objects. Happens on Vulkan and Direct3D 11.

What should happen?

Everything should be fine as is with Direct3D 9 and OpenGL.

What hardware, operating system, and PPSSPP version? On desktop, GPU matters for graphical issues.

  • Windows 10 64 bit;
  • Acer Aspire ES15;
  • Intel Celeron QuadCore N3450;
  • Intel HD Graphics 500 (driver ver. 27.20.100.8587);
  • 4 GB RAM;
  • ppsspp v1.10.3-735-ga0251eae2

ULUS10515_00000
ULUS10515_00001
ULUS10515_00002

Here is a Save State for testing:
ULUS10515_1.00_2.zip

@justafella
Copy link
Author

As for cropped units:
ULUS10515_00000
ULUS10515_00001
ULUS10515_00002

@Panderner
Copy link
Contributor

@justafella could you send me the GE Dump for scoping?

@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Sep 21, 2020
@hrydgard hrydgard added this to the v1.11.0 milestone Sep 21, 2020
@hrydgard hrydgard added the Depth / Z Issue involves depth drawing parameters. label Sep 21, 2020
@justafella
Copy link
Author

How do I do it?

@Panderner
Copy link
Contributor

How do I do it?

Just go to http://ppsspp-debugger.unknownbrackets.org/

@justafella
Copy link
Author

justafella commented Sep 21, 2020

Well, if I got that right, these are the files:

Scoping:
recording (2).zip

Scoping+zoom:
recording (3).zip

If you need it, whenever I come across the cropped unit problem again I'll bring its GE dump as well

@hrydgard
Copy link
Owner

Thanks, those will be useful!

@justafella
Copy link
Author

justafella commented Sep 23, 2020

If you need it, whenever I come across the cropped unit problem again I'll bring its GE dump as well

Here it is:

Cropped unit on scope: recording.zip

Cropped unit on scope+zoom: recording (1).zip

Hope it helps you guys

@unknownbrackets
Copy link
Collaborator

Well, here's something interesting.

In Valkyria Chronicles 3, I reproduced easily. In the GE debugger, I then disabled the depth clamp flag for a frame, which fixed it, because background stuff was clamping over the character.

But then I realized that it stayed fixed - nothing was turning clamp back on. I played through a bunch of the game without it getting set back enabled. Instead, returning to the chapter map finally re-enabled it. It also re-enabled when going to the deploy screen, each time when "Now loading" was being shown. Interestingly, for the loading into the mission - it did not set the depth clamp flag.

So it could be this is depth clamp behaving wrong - but it could also be that, somewhere, something is supposed to clear this and isn't? Well, just a guess. I can't find anything obvious that should be resetting it (like contexts on lists or signals or CALLs etc.)

-[Unknown]

@hrydgard hrydgard modified the milestones: v1.12.0, Future-Prio Aug 29, 2021
@unknownbrackets
Copy link
Collaborator

The behavior described in #12058 should fix this.

-[Unknown]

@justafella
Copy link
Author

I have tested the game with the same save state I provided back then, using the latest buildbot. My system remains the same apart from the graphics driver's version (that I keep updated). I tested it on all backends (with hardware transform on and then off) but only D3D9 worked properly. I couldn´t understand everything here, so if there is something more I could do for testing as an end-user, I´ll gladly help.

@unknownbrackets
Copy link
Collaborator

If you try the artifacts in #14833, it should fix it on modern systems.

-[Unknown]

@justafella
Copy link
Author

I haven't been able to test this yet because I can't seem to build it right. I'm all new to this and even with the instructions provided I'm still messing up somewhere. I'd be grateful if you could build it and send me a .zip or something.

@unknownbrackets
Copy link
Collaborator

There's a build attached to the under artifacts.

  1. Go to https://github.com/hrydgard/ppsspp/pull/14833/checks.
  2. Select Artifacts near the top right.
  3. Select Windows x64 build (or similar.)

macOS, Windows ARM64, and Linux builds are available too. These are not permanent however, and only last for 90 days after the code in the pull request is most recently updated.

-[Unknown]

@justafella
Copy link
Author

IT IS FIXED!!!! Thank you!!!!! You may close the issue 🥇

@hrydgard
Copy link
Owner

hrydgard commented Sep 19, 2021

Thanks for reporting!

Let's close it when that branch is merged - I'm not gonna merge it for 1.12, due to the risk of breakage. It will however be merged soon after that release, and then we can close this.

@vit9696
Copy link
Contributor

vit9696 commented Sep 19, 2021

Does not seem to fix the issue for me on macOS 11.6 with #14833 on Vulkan. OpenGL implementation is unsupported as explained in #14833 (comment).

Screenshot 2021-09-19 at 15 32 38

Confirmed that the latest master of https://github.com/KhronosGroup/MoltenVK (KhronosGroup/MoltenVK@f78ab20) does not solve the issue at the very least.

@hrydgard
Copy link
Owner

Vulkan on MacOS uses MoltenVK, it could be that it lacks support for the clip/cull distances.

@vit9696
Copy link
Contributor

vit9696 commented Sep 19, 2021

That somewhat surprised be, but you are right:

(lldb) p caps_.clipCullDistanceSupported
(bool) $0 = false
(lldb) p vulkan->GetDeviceFeatures().enabled.shaderClipDistance
(const VkBool32) $1 = 1
(lldb) p vulkan->GetDeviceFeatures().enabled.shaderCullDistance
(const VkBool32) $2 = 0

There is a note on that in KhronosGroup/MoltenVK#203 (comment). Interestingly, culling appears to be rather rarely used by the games (KhronosGroup/MoltenVK#203 (comment)), so one can expect it not to land any soon. I wonder if the alternative can be found here.

@vit9696
Copy link
Contributor

vit9696 commented Sep 19, 2021

To be fair, software one (i.e. HardwareTransform = False) does work fairly well for me with both OpenGL and Vulkan though after fixing up the hardware usage requirements in #14833 (comment) without performance issues. However, this is a desktop (11700k clocked at 5.0 GHz to be precise), laptops may have bigger issues.

@justafella
Copy link
Author

justafella commented Sep 25, 2021

Is there any way I can get an android build with these fixes? I have a Moto G9 Play with Qualcomm SM6115 Snapdragon 662 (11 nm) Octa-core (4x2.0 GHz Kryo 260 Gold + 4x1.8 GHz Kryo 260 Silver) Adreno 610

@ghost
Copy link

ghost commented Sep 26, 2021

Is there any way I can get an android build with these fixes? I have a Moto G9 Play with Qualcomm SM6115 Snapdragon 662 (11 nm) Octa-core (4x2.0 GHz Kryo 260 Gold + 4x1.8 GHz Kryo 260 Silver) Adreno 610

You need to compile this #14833
all by your self.

@unknownbrackets
Copy link
Collaborator

It'll get merged in not very long and included in git builds. It should work on Adreno, but it won't yet work on Mali, so it's not a complete fix. Be warned there are likely to be issues on some devices once it's merged, so I can't say for sure it'll work on your device.

-[Unknown]

@IrfanH495
Copy link

IrfanH495 commented Oct 19, 2021

thanks(^o^). working on v1.12.3-39-g16bf5197e
vulkan
adreno 530
Valkyria Chronicles 3
Screenshot_20211019-213637

@ghost
Copy link

ghost commented Oct 19, 2021

I try the dump and here's the results.
Screenshot_2021-10-19-23-19-41-123_org ppsspp ppsspp
Screenshot_2021-10-19-23-19-27-727_org ppsspp ppsspp

@hrydgard
Copy link
Owner

@Gamemulatorer not sure I understand, is that a failure or success? Which GPU on your device?

@ghost
Copy link

ghost commented Oct 19, 2021

@Gamemulatorer not sure I understand, is that a failure or success? Which GPU on your device?

I think is a success because as far as I can see all elements is present 🤔🙂

@hrydgard
Copy link
Owner

Ok, so several successful reports. I'm gonna close this, even though the new code doesn't have full effect on Mali and D3D9 yet.

@vit9696
Copy link
Contributor

vit9696 commented Oct 19, 2021

@hrydgard while D3D9 is rather old, macOS VK/GL is considerably new. Shall we have a separate issue for the added code being incompatible with macOS? I believe a shader implementation will still be faster than a software one.

@hrydgard
Copy link
Owner

@vit9696 who says the added code is incompatible with macOS?

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Oct 19, 2021

Apple GL doesn't expose cull distance, possibly also with Vulkan. But I thought this one was probably fixed by clipping, so it might be fixed anyway? If it requires cull, then I think it's still related to all the other open guardband issues.

-[Unknown]

@vit9696
Copy link
Contributor

vit9696 commented Oct 19, 2021

I did earlier: #13462 (comment), can retest the master version, but I am pretty sure it is still broken.

@vit9696
Copy link
Contributor

vit9696 commented Oct 19, 2021

@unknownbrackets, sure, I will retest as I am not positive I did local tests after culling/clipping separation.

@vit9696
Copy link
Contributor

vit9696 commented Oct 20, 2021

Yes, the issue is still there. In master both hardware and software transforms are broken. The former is broken because culling is unsupported and the latter is broken, because nobody merged the second branch by @unknownbrackets. Funny enough, this branch is now entirely gone from GitHub, so I needed to restore the patch from my local copy (attached below).
0001-GPU-Implement-cull-behavior-in-sw-transform.patch.zip

@vit9696
Copy link
Contributor

vit9696 commented Oct 20, 2021

Applying the attached patch (requires fixing GPU_SUPPORTS_CULL_DISTANCE name) resolves the problem for software transform.

@hrydgard
Copy link
Owner

Gonna reopen as a reminder.

@hrydgard hrydgard reopened this Oct 20, 2021
@vit9696
Copy link
Contributor

vit9696 commented Oct 20, 2021

@hrydgard @unknownbrackets can we merge software culling in 1.13 to at least have a partial workaround? I believe Mali would also benefit.

@hrydgard
Copy link
Owner

Yeah, I think we should. It can be optimized, but that can be done after.

For Mali I'm planning to try a different approach using a geometry shader, too.

@vit9696
Copy link
Contributor

vit9696 commented Nov 1, 2021

Just to make it clear, with #15072 merged, disabling hardware transform fixes this issue on macOS. Thanks. I guess it might be useful to autoenable software culling based on the platform for affected games, but something like that is clearly out of the scope of this issue.

@hrydgard hrydgard modified the milestones: v1.13.0, Future-Prio Jun 19, 2022
@ghost
Copy link

ghost commented Oct 2, 2022

This might improve now with #16142?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Depth / Z Issue involves depth drawing parameters. GE emulation Backend-independent GPU issues
Projects
None yet
Development

No branches or pull requests

6 participants