-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create debug message groups for ProfilerFiller push/pop calls in Game…
…Renderer & LevelRenderer
- Loading branch information
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
common/src/main/java/us/drullk/opengldebug/mixin/GameRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package us.drullk.opengldebug.mixin; | ||
|
||
import net.minecraft.client.renderer.GameRenderer; | ||
import net.minecraft.util.profiling.ProfilerFiller; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import us.drullk.opengldebug.GLDebugHelper; | ||
|
||
@Mixin(GameRenderer.class) | ||
public class GameRendererMixin { | ||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V")) | ||
private void renderDebugPush(ProfilerFiller instance, String s) { | ||
instance.push(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V")) | ||
private void renderDebugPopPush(ProfilerFiller instance, String s) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.popPush(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V")) | ||
private void renderDebugPop(ProfilerFiller instance) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.pop(); | ||
} | ||
|
||
@Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V")) | ||
private void renderLevelDebugPush(ProfilerFiller instance, String s) { | ||
instance.push(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V")) | ||
private void renderLevelDebugPopPush(ProfilerFiller instance, String s) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.popPush(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V")) | ||
private void renderLevelDebugPop(ProfilerFiller instance) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.pop(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
common/src/main/java/us/drullk/opengldebug/mixin/LevelRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package us.drullk.opengldebug.mixin; | ||
|
||
import net.minecraft.client.renderer.LevelRenderer; | ||
import net.minecraft.util.profiling.ProfilerFiller; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import us.drullk.opengldebug.GLDebugHelper; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(LevelRenderer.class) | ||
public class LevelRendererMixin { | ||
@Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/lang/String;)V")) | ||
private void debugAmongPopPush(ProfilerFiller instance, String s) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.popPush(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "renderChunkLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;push(Ljava/lang/String;)V")) | ||
private void renderChunkLayerPush(ProfilerFiller instance, String s) { | ||
instance.push(s); | ||
GLDebugHelper.pushMessageGroupFromProfiler(s); | ||
} | ||
|
||
@Redirect(method = "renderChunkLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;popPush(Ljava/util/function/Supplier;)V")) | ||
private void renderChunkLayerDebugPopPush(ProfilerFiller instance, Supplier<String> stringSupplier) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.popPush(stringSupplier); | ||
GLDebugHelper.pushMessageGroupFromProfiler(stringSupplier.get()); | ||
} | ||
|
||
@Redirect(method = "renderChunkLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V")) | ||
private void renderChunkLayerPop(ProfilerFiller instance) { | ||
GLDebugHelper.popMessageGroup(); | ||
instance.pop(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters