Something went wrong. Try again.
The Minecraft: Java Edition decompiled source code.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687package com.mojang.blaze3d;
import com.mojang.blaze3d.platform.GLX;import com.mojang.blaze3d.systems.GpuDevice;import java.lang.ref.WeakReference;import java.util.List;import java.util.Locale;import net.minecraft.util.Util;import org.jspecify.annotations.Nullable;
public class GraphicsWorkarounds { private static final List<String> INTEL_GEN11_CORE = List.of( "i3-1000g1", "i3-1000g4", "i3-1000ng4", "i3-1005g1", "i3-l13g4", "i5-1030g4", "i5-1030g7", "i5-1030ng7", "i5-1034g1", "i5-1035g1", "i5-1035g4", "i5-1035g7", "i5-1038ng7", "i5-l16g7", "i7-1060g7", "i7-1060ng7", "i7-1065g7", "i7-1068g7", "i7-1068ng7" ); private static final List<String> INTEL_GEN11_ATOM = List.of("x6211e", "x6212re", "x6214re", "x6413e", "x6414re", "x6416re", "x6425e", "x6425re", "x6427fe"); private static final List<String> INTEL_GEN11_CELERON = List.of("j6412", "j6413", "n4500", "n4505", "n5095", "n5095a", "n5100", "n5105", "n6210", "n6211"); private static final List<String> INTEL_GEN11_PENTIUM = List.of("6805", "j6426", "n6415", "n6000", "n6005"); @Nullable private static GraphicsWorkarounds instance; private final WeakReference<GpuDevice> gpuDevice; private final boolean alwaysCreateFreshImmediateBuffer; private final boolean isGlOnDx12;
private GraphicsWorkarounds(GpuDevice gpuDevice) { this.gpuDevice = new WeakReference<>(gpuDevicex); this.alwaysCreateFreshImmediateBuffer = isIntelGen11(gpuDevicex); this.isGlOnDx12 = isGlOnDx12(gpuDevicex); }
public static GraphicsWorkarounds get(GpuDevice gpuDevice) { GraphicsWorkarounds graphicsWorkarounds = instance; if (graphicsWorkarounds == null || graphicsWorkarounds.gpuDevice.get() != gpuDevicex) { instance = graphicsWorkarounds = new GraphicsWorkarounds(gpuDevicex); }
return graphicsWorkarounds; }
public boolean alwaysCreateFreshImmediateBuffer() { return this.alwaysCreateFreshImmediateBuffer; }
public boolean isGlOnDx12() { return this.isGlOnDx12; }
private static boolean isIntelGen11(GpuDevice gpuDevice) { String string = GLX._getCpuInfo().toLowerCase(Locale.ROOT); String string1 = gpuDevicex.getRenderer().toLowerCase(Locale.ROOT); if (!string.contains("intel") || !string1.contains("intel") || string1.contains("mesa")) { return false; } else if (string1.endsWith("gen11")) { return true; } else { return !string1.contains("uhd graphics") && !string1.contains("iris") ? false : string.contains("atom") && INTEL_GEN11_ATOM.stream().anyMatch(string::contains) || string.contains("celeron") && INTEL_GEN11_CELERON.stream().anyMatch(string::contains) || string.contains("pentium") && INTEL_GEN11_PENTIUM.stream().anyMatch(string::contains) || INTEL_GEN11_CORE.stream().anyMatch(string::contains); } }
private static boolean isGlOnDx12(GpuDevice gpuDevice) { boolean bl = Util.getPlatform() == Util.OS.WINDOWS && Util.isAarch64(); return bl || gpuDevicex.getRenderer().startsWith("D3D12"); }}