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

Crash when a graphics adapter is present which does not support OpenGL #2591

Closed
D2Lx0wse opened this issue Jul 7, 2024 · 15 comments
Closed
Assignees
Labels
A-drivers Area: Driver compatibility P-critical Priority: The issue is of critical importance R-has-workaround Resolution: Has workaround T-crash Type: Crash or hang
Milestone

Comments

@D2Lx0wse
Copy link

D2Lx0wse commented Jul 7, 2024

Bug Description

The game crashes with this error
A mod crashed on startup! net.fabricmc.loader.impl.FormattedException: java.lang.RuntimeException: Could not execute entrypoint stage 'preLaunch' due to errors, provided by 'sodium'! at net.fabricmc.loader.impl.FormattedException.ofLocalized(FormattedException.java:63) at net.fabricmc.loader.impl.launch.knot.Knot.init(Knot.java:162) at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:68) at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100) at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) Caused by: java.lang.RuntimeException: Could not execute entrypoint stage 'preLaunch' due to errors, provided by 'sodium'! at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:388) at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33) at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:386) at net.fabricmc.loader.impl.launch.knot.Knot.init(Knot.java:160) ... 5 more Caused by: java.lang.NullPointerException: Cannot invoke "String.matches(String)" because "driverName" is null at me.jellysquid.mods.sodium.client.compatibility.checks.PreLaunchChecks.findIntelDriverMatchingBug899(PreLaunchChecks.java:123) at me.jellysquid.mods.sodium.client.compatibility.checks.PreLaunchChecks.onGameInit(PreLaunchChecks.java:60) at me.jellysquid.mods.sodium.client.SodiumPreLaunch.onPreLaunch(SodiumPreLaunch.java:13) at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:384) ... 6 more

Reproduction Steps

  1. Download ARM64 Prism Launcher and a ARM64 build of java 21 on a snapdragon pc
  2. Install minecraft 1.21 with fabric and the attached mods
    image

image

  1. Launch the game
  2. Fabric crashes

Log File

latest.log

Crash Report

The game does not produce a crash report, or gets to the main menu. Here's my specs?!?!?
image
image
the opengl is not the best but it say it's compatible

@D2Lx0wse D2Lx0wse added the S-needs-triage Status: Needs triage label Jul 7, 2024
@jellysquid3
Copy link
Member

Are you not using the latest version of Sodium? Please upload the entire log file, not the snippet. It has critical information.

@jellysquid3 jellysquid3 added S-info-needed Status: Info needed and removed S-needs-triage Status: Needs triage labels Jul 7, 2024
@jellysquid3
Copy link
Member

We do not have anyone on our team who has access to these recent laptops with Qualcomm's Snapdragon chips. It will be impossible for anyone to debug this without the information that our issue template asks for.

@jellysquid3 jellysquid3 added A-drivers Area: Driver compatibility T-crash Type: Crash or hang labels Jul 7, 2024
@D2Lx0wse
Copy link
Author

D2Lx0wse commented Jul 7, 2024

This is not a X elite laptop, as you can see in the specs, it's from 2022, also minecraft only produced the log I attached as file as it crashed so early, I tried to send all info I could

@D2Lx0wse
Copy link
Author

D2Lx0wse commented Jul 7, 2024

image

@jellysquid3
Copy link
Member

Sorry. The email that was sent to me about your issue did not include the link to the log file for some reason.

@jellysquid3
Copy link
Member

[19:14:16] [main/INFO]: Found graphics adapter: AdapterInfo{vendor=UNKNOWN, description='Adreno 680', adapterType=0x0000230B, openglIcdFilePath='null', openglIcdVersion=null}

Do the Adreno drivers actually support OpenGL? It seems like they don't, and Windows is using a translation layer on top of it (OpenGL on D3D12, probably), which confuses Sodium...

@jellysquid3 jellysquid3 removed the S-info-needed Status: Info needed label Jul 7, 2024
@jellysquid3
Copy link
Member

I think the graphics adapter probe in Sodium is just bugged, and it doesn't account for the possibility that a GPU may not actually support OpenGL.

Marking these fields as @Nullable and then adding null-checks where the fields are accessed would likely be enough.

@D2Lx0wse
Copy link
Author

D2Lx0wse commented Jul 7, 2024

I have no idea, if sodium checked if the driver name string was null
image
(since thats where it's erroring) could it launch? I acknowledge it'd possibly be broken cause no translation layer- oh you said it as I was typing

@jellysquid3 jellysquid3 changed the title Sodium crash at startup on Qualcomm Adreno GPU on Windows "Cannot invoke "String.matches(String)" because "driverName" is null" Crash when a graphics adapter is present which does not support OpenGL Jul 8, 2024
@jellysquid3 jellysquid3 added the P-high Priority: High label Jul 8, 2024
@jellysquid3 jellysquid3 added this to the Sodium 0.5.12 milestone Jul 8, 2024
@ading2210
Copy link
Contributor

I can confirm that this issue also occurs on the new Qualcomm Snapdragon X Elite (X1E78100) systems.
image

Here are my system specs:
image

@ading2210
Copy link
Contributor

ading2210 commented Jul 22, 2024

Also, it appears that OpenGL does work, since vanilla 1.21 runs just fine. It appears to be using Mesa for the OpenGL translation layer as well.

image

@asumagic
Copy link

asumagic commented Jul 22, 2024

Is there a chance that the translation layers belong in a different "virtual" adapter? I'm curious how the full virtual adapter list looks like, null exception aside. Otherwise, is there really no way to poll information on GLon12 support for the given platform?

FWIW, internally, on context creation, it does seem to make a difference between a native OpenGL driver and GLon12: https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/d3dkmthk/ne-d3dkmthk-_d3dkmt_clienthint
(Although this specific hint enum seems irrelevant for sodium.)

@ading2210
Copy link
Contributor

I built the latest version of the mod using Intellij, and it somehow isn't crashing? The driverName is detected correctly here, but launching the game through PrismLauncher still crashes.

image

Regardless of this weird behavior, I believe it can be fixed easily by just checking if driverName is null, and continuing the loop if it is. The function that it's crashing in seems to only be for detecting Intel drivers, so this shouldn't break any existing behavior.

@jellysquid3
Copy link
Member

jellysquid3 commented Jul 23, 2024

I'm nominating this issue for critical prioritization so that we can make a backport exception for older versions.

@jellysquid3 jellysquid3 added P-critical Priority: The issue is of critical importance and removed P-high Priority: High labels Jul 23, 2024
@jellysquid3
Copy link
Member

The mod crashing on new hardware platforms is not acceptable for me and this problem is likely manifesting elsewhere with drivers that don't actually support OpenGL natively.

@jellysquid3
Copy link
Member

If you run into this issue, you can add the following entry to your JVM arguments:

-Dsodium.checks.issue899=false

This disables the broken pre-launch check and allows the game to launch (somewhat) normally.

@jellysquid3 jellysquid3 added the R-has-workaround Resolution: Has workaround label Jul 23, 2024
IMS212 pushed a commit that referenced this issue Aug 1, 2024
* fix issue #2591 by ignoring null driver names

* add nullable annotation
IMS212 pushed a commit that referenced this issue Aug 1, 2024
* fix issue #2591 by ignoring null driver names

* add nullable annotation
IMS212 pushed a commit that referenced this issue Aug 1, 2024
* fix issue #2591 by ignoring null driver names

* add nullable annotation
IMS212 pushed a commit to IMS212/sodium-fabric that referenced this issue Aug 6, 2024
)

* fix issue CaffeineMC#2591 by ignoring null driver names

* add nullable annotation
@jellysquid3 jellysquid3 modified the milestones: Sodium 0.5.12, Sodium 0.6 Aug 13, 2024
@jellysquid3 jellysquid3 self-assigned this Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-drivers Area: Driver compatibility P-critical Priority: The issue is of critical importance R-has-workaround Resolution: Has workaround T-crash Type: Crash or hang
Projects
None yet
Development

No branches or pull requests

4 participants