Skip to content

Commit e1df541

Browse files
committed
Added debug marker for screenshot
1 parent 0833f94 commit e1df541

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/main/java/com/ventooth/swansong/debug/DebugMarker.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public enum DebugMarker {
2828
TEXTURE_COLOR_BLIT(500),
2929
TEXTURE_DEPTH_BLIT(510),
3030
TEXTURE_MIP_GEN(520),
31+
SCREENSHOT_TAKEN(530),
3132

3233
;
3334

@@ -40,6 +41,14 @@ public static boolean isEnabled() {
4041
return DebugConfig.GLDebugMarkers;
4142
}
4243

44+
public void insert() {
45+
if (!isEnabled()) {
46+
return;
47+
}
48+
49+
doInsertMessage(name());
50+
}
51+
4352
public void insert(String message) {
4453
if (!isEnabled()) {
4554
return;

src/main/java/com/ventooth/swansong/image/ThreadedScreenshot.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
package com.ventooth.swansong.image;
1212

13+
import com.ventooth.swansong.debug.DebugMarker;
1314
import lombok.AccessLevel;
1415
import lombok.NoArgsConstructor;
1516
import lombok.val;
@@ -61,6 +62,9 @@ public static IChatComponent captureScreenshot(File gameDirectory, Framebuffer f
6162
if (rawImage == null) {
6263
throw new IllegalStateException("Failed to copy from GPU");
6364
}
65+
if (DebugMarker.isEnabled()) {
66+
DebugMarker.SCREENSHOT_TAKEN.insert();
67+
}
6468
} catch (Exception e) {
6569
return new ChatComponentTranslation("screenshot.failure", e.getMessage());
6670
}

0 commit comments

Comments
 (0)