SnowyGUI/common/src/main/java/fr/username404/snowygui/mixins/CursedRenderPassMixin.java
Username404-59 92c8e36c71
Update to 1.21.5
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2025-04-16 02:46:59 +02:00

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);
};
}