Skip to content

Commit 0e2447f

Browse files
committed
Add device name to debug system specs
1 parent 13e925f commit 0e2447f

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package net.vulkanmod.mixin.debug;
2+
3+
import com.mojang.blaze3d.platform.GLX;
4+
import com.mojang.blaze3d.systems.GpuDevice;
5+
import com.mojang.blaze3d.systems.RenderSystem;
6+
import net.minecraft.client.Minecraft;
7+
import net.minecraft.client.gui.components.debug.DebugEntrySystemSpecs;
8+
import net.minecraft.client.gui.components.debug.DebugScreenDisplayer;
9+
import net.minecraft.resources.ResourceLocation;
10+
import net.minecraft.world.level.Level;
11+
import net.minecraft.world.level.chunk.LevelChunk;
12+
import net.vulkanmod.Initializer;
13+
import org.spongepowered.asm.mixin.Final;
14+
import org.spongepowered.asm.mixin.Mixin;
15+
import org.spongepowered.asm.mixin.Shadow;
16+
import org.spongepowered.asm.mixin.injection.At;
17+
import org.spongepowered.asm.mixin.injection.Inject;
18+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
19+
20+
import java.util.List;
21+
import java.util.Locale;
22+
23+
@Mixin(DebugEntrySystemSpecs.class)
24+
public class DebugEntrySystemSpecsM {
25+
26+
@Shadow @Final private static ResourceLocation GROUP;
27+
28+
@Inject(method = "display", at = @At("HEAD"), cancellable = true)
29+
private void display(DebugScreenDisplayer debugScreenDisplayer, Level level, LevelChunk levelChunk,
30+
LevelChunk levelChunk2, CallbackInfo ci) {
31+
GpuDevice gpuDevice = RenderSystem.getDevice();
32+
debugScreenDisplayer.addToGroup(
33+
GROUP,
34+
List.of(
35+
String.format(Locale.ROOT, "Java: %s", System.getProperty("java.version")),
36+
String.format(Locale.ROOT, "CPU: %s", GLX._getCpuInfo()),
37+
String.format(
38+
Locale.ROOT, "Display: %dx%d (%s)", Minecraft.getInstance().getWindow().getWidth(), Minecraft.getInstance().getWindow().getHeight(), gpuDevice.getVendor()
39+
),
40+
gpuDevice.getRenderer(),
41+
String.format(Locale.ROOT, "%s %s", gpuDevice.getBackendName(), gpuDevice.getVersion()),
42+
String.format(Locale.ROOT, "VulkanMod %s", Initializer.getVersion())
43+
)
44+
);
45+
46+
ci.cancel();
47+
}
48+
49+
}

src/main/java/net/vulkanmod/render/engine/VkGpuDevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public boolean isDebuggingEnabled() {
182182

183183
@Override
184184
public String getRenderer() {
185-
return "VulkanMod %s".formatted(Initializer.getVersion()) ;
185+
return DeviceManager.device.deviceName;
186186
}
187187

188188
@Override

src/main/resources/vulkanmod.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
"debug.crash_report.SystemReportM",
2828
"debug.DebugEntryMemoryM",
29+
"debug.DebugEntrySystemSpecsM",
2930
"debug.DebugScreenEntriesM",
3031
"debug.KeyboardHandlerM",
3132

0 commit comments

Comments
 (0)