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

Sodium Breaks Distant Horizons Instanced Rendering on Mac #2732

Open
jeseibel opened this issue Sep 1, 2024 · 4 comments
Open

Sodium Breaks Distant Horizons Instanced Rendering on Mac #2732

jeseibel opened this issue Sep 1, 2024 · 4 comments
Labels
A-drivers Area: Driver compatibility F-help-wanted Flag: Help wanted T-bug Type: Bug

Comments

@jeseibel
Copy link

jeseibel commented Sep 1, 2024

Bug Description

Having Sodium installed on a Apple Silicon mac causes Distant Horizons' use of glDrawElementsInstanced to crash the game.
This issue doesn't occur with just Sodium or Distant Horizons installed.

If there's no easy fix this problem I'll just disable instanced rendering on mac when Sodium is detected (it will reduce performance, but should prevent crashing).

Crash log stack trace:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001ee5b9150, pid=35486, tid=259
#
# JRE version: OpenJDK Runtime Environment Microsoft-9388422 (21.0.3+9) (build 21.0.3+9-LTS)
# Java VM: OpenJDK 64-Bit Server VM Microsoft-9388422 (21.0.3+9-LTS, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [GLEngine+0x11f150]  gleRunVertexSubmitImmediate+0x18cc
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

...

Stack: [0x000000016f050000,0x000000016f84c000],  sp=0x000000016f844ac0,  free space=8146k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [GLEngine+0x11f150]  gleRunVertexSubmitImmediate+0x18cc
C  [GLEngine+0xb8d50]  gleDrawArraysOrElements_ExecCore+0x270
C  [GLEngine+0xba170]  glDrawElementsInstanced_ACC_GL3Exec+0x1f8
C  0xa71180010deb8a88
j  org.lwjgl.opengl.GL31C.glDrawElementsInstanced(IIIJI)V+6
j  org.lwjgl.opengl.GL31.glDrawElementsInstanced(IIIJI)V+6
j  com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer.renderBoxGroupInstanced(Lcom/seibel/distanthorizons/api/interfaces/override/rendering/IDhApiGenericObjectShaderProgram;Lcom/seibel/distanthorizons/api/methods/events/sharedParameterObjects/DhApiRenderParam;Lcom/seibel/distanthorizons/core/render/renderer/generic/RenderableBoxGroup;Lcom/seibel/distanthorizons/core/util/math/Vec3d;)V+209
j  com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer.render(Lcom/seibel/distanthorizons/api/methods/events/sharedParameterObjects/DhApiRenderParam;Lcom/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IProfilerWrapper;Z)V+294

Related links:

Distant Horizons Gitlab Issue:
https://gitlab.com/jeseibel/distant-horizons/-/issues/793

Public Distant Horizons Discord conversation about the issue:
https://www.answeroverflow.com/m/1273612018506534973

Reproduction Steps

Hardware:

  • Apple silicon mac

Install:

  • Distant Horizons 2.2.0 or newer
  • Sodium 0.5
  • Indium
  • Fabric API

Testing:

  1. Confirm DH generic rendering and clouds are enabled under DH config -> advanced -> graphics -> generic rendering
  2. load into any world.
  3. Once DH starts rendering the game should crash.

Log File

latest.log

Crash Report

hs_err_pid35486.log

@jeseibel jeseibel added the S-needs-triage Status: Needs triage label Sep 1, 2024
@douira
Copy link
Collaborator

douira commented Sep 1, 2024

Just out of interest, do you know if this also happens on macs with intel iGPUs or AMD dGPUs? (There's also Macs with nvidia cards but those are largely irrelevant) The Apple Silicon drivers are observed to be generally more problematic

@jeseibel
Copy link
Author

jeseibel commented Sep 2, 2024

Looking at the crash log it appears this machine was a MacBookPro18,3 which I think has a dedicated GPU ( https://support.apple.com/en-us/111902 ).

Also, one thing I just remembered: there were reports from one user that the instanced rendering didn't appear at all (didn't crash, the objects just didn't appear on screen). Unfortunately I don't know if they had any other mods installed.
Maybe instanced rendering is always broken on Mac but Sodium causes the renderer to crash when called? That would be helpful for troubleshooting if that was the case. Although that also means GLCapabilities.GL_ARB_instanced_arrays or GLCapabilities.OpenGL33 is returning the wrong value if instanced rendering aren't supported.

@douira
Copy link
Collaborator

douira commented Sep 2, 2024

It should be noted that the drivers for Apple Silicon vs the AMD dGPU/intel iGPUs are different enough that they can generally be considered separate in terms of what bugs and quirks they have. That's why it's relevant to know what exact computer was having the issue here.

@jellysquid3 jellysquid3 added T-bug Type: Bug A-drivers Area: Driver compatibility F-help-wanted Flag: Help wanted and removed S-needs-triage Status: Needs triage labels Sep 8, 2024
@Aces-and-Jacks
Copy link

I used sodium and distant horizons on a mac with an m1 chip, which crashed. Searched for glDrawElementsInstanced in the java error report and found it mentioned. So not sure if that helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-drivers Area: Driver compatibility F-help-wanted Flag: Help wanted T-bug Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants