39 lines
1.4 KiB
Java
39 lines
1.4 KiB
Java
package fr.username404.snowygui.mixins;
|
|
|
|
import com.mojang.blaze3d.opengl.*;
|
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
|
import com.mojang.blaze3d.systems.RenderPass;
|
|
import com.mojang.blaze3d.textures.GpuTexture;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import org.spongepowered.asm.mixin.Final;
|
|
import org.spongepowered.asm.mixin.Mixin;
|
|
import org.spongepowered.asm.mixin.Overwrite;
|
|
import org.spongepowered.asm.mixin.Shadow;
|
|
|
|
import static fr.username404.snowygui.misc.CreateRenderPassRewriteKt.createRenderPassRewrite;
|
|
|
|
import java.util.OptionalDouble;
|
|
import java.util.OptionalInt;
|
|
|
|
@Mixin(GlCommandEncoder.class)
|
|
abstract class CursedRenderPassMixin {
|
|
@Shadow private boolean inRenderPass;
|
|
|
|
@Shadow @Final private GlDevice device;
|
|
|
|
@Shadow @Nullable private RenderPipeline lastPipeline;
|
|
|
|
/**
|
|
* @author Username404-59
|
|
* @reason war crimes- I REGRET NOTHING
|
|
*/
|
|
@Overwrite
|
|
public RenderPass createRenderPass(GpuTexture gpuTexture, OptionalInt optionalInt, @Nullable GpuTexture gpuTexture2, OptionalDouble optionalDouble) {
|
|
this.inRenderPass = false; // VIP access 😈
|
|
int framebufferId = ((GlTexture)gpuTexture).getFbo(this.device.directStateAccess(), gpuTexture2);
|
|
createRenderPassRewrite(framebufferId, gpuTexture, optionalInt, gpuTexture2, optionalDouble);
|
|
this.lastPipeline = null;
|
|
return new GlRenderPass((GlCommandEncoder) (Object) this, gpuTexture2 != null);
|
|
};
|
|
}
|