mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-10 14:26:10 +01:00
30 lines
875 B
Java
30 lines
875 B
Java
|
package com.jozufozu.flywheel.mixin;
|
||
|
|
||
|
import javax.annotation.Nullable;
|
||
|
|
||
|
import org.spongepowered.asm.mixin.Mixin;
|
||
|
import org.spongepowered.asm.mixin.Shadow;
|
||
|
import org.spongepowered.asm.mixin.injection.At;
|
||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||
|
|
||
|
import com.jozufozu.flywheel.backend.gl.GlStateTracker;
|
||
|
import com.mojang.blaze3d.vertex.BufferUploader;
|
||
|
import com.mojang.blaze3d.vertex.VertexFormat;
|
||
|
|
||
|
@Mixin(BufferUploader.class)
|
||
|
public class BufferUploaderMixin {
|
||
|
|
||
|
@Shadow
|
||
|
@Nullable
|
||
|
private static VertexFormat lastFormat;
|
||
|
|
||
|
@Inject(method = "reset", at = @At("HEAD"))
|
||
|
private static void stopBufferUploaderFromClearingBufferStateIfNothingIsBound(CallbackInfo ci) {
|
||
|
// Trust our tracker over BufferUploader's.
|
||
|
if (GlStateTracker.getVertexArray() == 0) {
|
||
|
lastFormat = null;
|
||
|
}
|
||
|
}
|
||
|
}
|