Skip to content

Commit df2b5f4

Browse files
committed
fix: Wierd race condition with CustomLoadingScreen + FalseTweaks
1 parent fc1563b commit df2b5f4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/main/java/com/ventooth/swansong/shader/ShaderEngine.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,16 +803,14 @@ public static void finishRenderFinal() {
803803

804804
public static @Nullable Frustrum mcFrustrum;
805805

806-
private static final Frustrum frustrum = new Frustrum();
807-
private static final ClippingHelperShadow ch = new ClippingHelperShadow();
808-
809-
static {
810-
frustrum.clippingHelper = ch;
811-
}
806+
private static @Nullable Frustrum frustrum;
807+
private static @Nullable ClippingHelperShadow ch;
812808

813809
private static int shadowFrustumCheckOffset = 0;
814810

815811
private static void clipRenderersByFrustumShadow(WorldRenderer[] wrs) {
812+
assert frustrum != null: "frustrum not initialized";
813+
816814
for (int i = 0, wrsLength = wrs.length; i < wrsLength; i++) {
817815
var wr = wrs[i];
818816
val wre = (WorldRendererExt) wr;
@@ -838,6 +836,17 @@ private static void renderShadowMap() {
838836
if (state.shadow == null) {
839837
return;
840838
}
839+
840+
if (frustrum == null) {
841+
frustrum = new Frustrum();
842+
}
843+
if (ch == null) {
844+
ch = new ClippingHelperShadow();
845+
}
846+
if (frustrum.clippingHelper == null) {
847+
frustrum.clippingHelper = ch;
848+
}
849+
841850
GLDebugGroups.RENDER_SHADOW.push();
842851

843852
val partialTicks = ShaderState.getSubTick();

0 commit comments

Comments
 (0)