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

Ninja Gaiden Black: Intro video does not render on M1 mac #991

Open
abaire opened this issue May 28, 2022 · 13 comments
Open

Ninja Gaiden Black: Intro video does not render on M1 mac #991

abaire opened this issue May 28, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@abaire
Copy link
Contributor

abaire commented May 28, 2022

Title

https://xemu.app/titles/5443000d/#Ninja-Gaiden-Black

Bug Description

The intro video after selecting a new game does not render on M1 mac. The text overlay is shown, but the video itself is black:

Screen Shot 2022-05-28 at 12 10 23

.

Note that this works fine on other platforms and seems specific to the M1/Monterey

Expected Behavior

The video should display (there's a picture of a sword around that frame)
Screen Shot 2022-05-28 at 12 12 17

xemu Version

Version: 0.7.21-1-g8334f294df
Branch: master
Commit: 8334f29
Date: Sat May 28 19:07:34 UTC 2022

I don't know if this ever worked on M1, I tested with a branch from the 0.6.x days and it did not work there either.

System Information

CPU:
OS Platform: macOS
OS Version: Version 12.4 (Build 21F79)
Manufacturer: Apple
GPU Model: Apple M1 Max
Driver: 4.1 Metal - 76.3
Shader: 4.10

Additional Context

I can fix the issue in renderdoc by clamping the oPos value. As long as the upper value is no higher than 1.0 the video shows up. E.g.,: oPos = clamp(oPos, -2, 1);, oPos = clamp(oPos, -1, 1);

@notaturkey
Copy link

i have the same issue using a steam deck

@mbriar
Copy link

mbriar commented Jan 2, 2023

Same thing happens on linux with radeonsi

GL_RENDERER: AMD Radeon RX 6700 XT (navi22, LLVM 14.0.6, DRM 3.49, 6.1.2-zen1-1-zen)
GL_VERSION: 4.6 (Core Profile) Mesa 22.3.1

@mbriar
Copy link

mbriar commented Jan 2, 2023

I found that setting vs_position_always_invariant=true as environment variable fixes it on radeonsi, this will most likely also work on Steam Deck, fyi @notaturkey.

@mbriar
Copy link

mbriar commented Jan 3, 2023

This patch also fixes it for me, I guess it might also work on mac M1

diff --git a/hw/xbox/nv2a/shaders.c b/hw/xbox/nv2a/shaders.c
index 409129e50d..abae6b851b 100644
--- a/hw/xbox/nv2a/shaders.c
+++ b/hw/xbox/nv2a/shaders.c
@@ -803,6 +803,7 @@ GLSL_DEFINE(texMat2, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T2MAT))
 GLSL_DEFINE(texMat3, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T3MAT))
 
 "\n"
+"invariant gl_Position;\n"
 "vec4 oPos = vec4(0.0,0.0,0.0,1.0);\n"
 "vec4 oD0 = vec4(0.0,0.0,0.0,1.0);\n"

@BasicFrag
Copy link

Hi there @mbriar, could you help on how to set up this environment variable and this particular patch in question. Have the exact same setup as yours (as far as gpu goes) but I am very new in the linux space.

I found that setting vs_position_always_invariant=true as environment variable fixes it on radeonsi, this will most likely also work on Steam Deck, fyi @notaturkey.

This patch also fixes it for me, I guess it might also work on mac M1

diff --git a/hw/xbox/nv2a/shaders.c b/hw/xbox/nv2a/shaders.c
index 409129e50d..abae6b851b 100644
--- a/hw/xbox/nv2a/shaders.c
+++ b/hw/xbox/nv2a/shaders.c
@@ -803,6 +803,7 @@ GLSL_DEFINE(texMat2, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T2MAT))
 GLSL_DEFINE(texMat3, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T3MAT))
 
 "\n"
+"invariant gl_Position;\n"
 "vec4 oPos = vec4(0.0,0.0,0.0,1.0);\n"
 "vec4 oD0 = vec4(0.0,0.0,0.0,1.0);\n"

@mbriar
Copy link

mbriar commented Feb 17, 2023

Hey @BasicFrag,

if you run xemu from a terminal, setting the environment variable is as easy as:

vs_position_always_invariant=true ./xemu-v0.7.83-x86_64.AppImage

if you use the flatpak you can do

flatpak run --env=vs_position_always_invariant=true app.xemu.xemu

@bryanperris
Copy link

It happens for the Steam Deck as well. The intro graphics (and the videos) works on old Radeon R5, using either the radeon driver or the amdgpu driver. The drawback is that emulation is very slow on the old AMD APU processor, but other than that the graphics look pretty accurate. https://www.notebookcheck.net/AMD-Radeon-R5-Beema.122502.0.html

The OS used for the R5 machine is batocera.linux

@skunkfox
Copy link

Confirmed that this has been an ongoing issue on the Steam Deck.

@Spidy123222
Copy link

Spidy123222 commented Sep 3, 2023

I found adding when using flatpak from using emudeck.

vs_position_always_invariant=true %command%

Was able to fix all of my steamdeck rendering issues. Even allows using burnout 3.

It doesn't work as well as the appimage version though. EDIT: changing resolution to higher gets same effect as flatpak one. But 1x has some issue but helps a little on some games.

@Spidy123222
Copy link

Spidy123222 commented Sep 3, 2023

"invariant gl_Position;\n"
"vec4 oPos = vec4(0.0,0.0,0.0,1.0);\n"
"vec4 oD0 = vec4(0.0,0.0,0.0,1.0);\n"

We're you thinking of adding this as a Pull request to the project? I added it to my GitHub and works on steamdeck.

https://github.com/Spidy123222/xemu/actions/runs/6062740649

@mbriar
Copy link

mbriar commented Sep 3, 2023

@Spidy123222 i don't know if this change is technically correct, I'm not really a graphics programmer. It just does the same as vs_position_always_invariant=true does on the driver level.

@Spidy123222
Copy link

@Spidy123222 i don't know if this change is technically correct, I'm not really a graphics programmer. It just does the same as vs_position_always_invariant=true does on the driver level.

Maybe a discussion in the discord about it could work out to see if it is correct or not.

@Spidy123222
Copy link

From some discussion with people testing. It breaks some games like super monkey ball. So I'm guessing it's not a proper implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants