Less stupid workaround
Should fix compatibility with iris Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
7b310399cf
commit
8c526473e1
@ -1,38 +0,0 @@
|
|||||||
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);
|
|
||||||
};
|
|
||||||
}
|
|
@ -2,6 +2,7 @@ package fr.username404.snowygui.utils
|
|||||||
|
|
||||||
import com.mojang.blaze3d.buffers.BufferType
|
import com.mojang.blaze3d.buffers.BufferType
|
||||||
import com.mojang.blaze3d.buffers.BufferUsage
|
import com.mojang.blaze3d.buffers.BufferUsage
|
||||||
|
import com.mojang.blaze3d.opengl.GlCommandEncoder
|
||||||
import com.mojang.blaze3d.opengl.GlStateManager
|
import com.mojang.blaze3d.opengl.GlStateManager
|
||||||
import com.mojang.blaze3d.pipeline.RenderPipeline
|
import com.mojang.blaze3d.pipeline.RenderPipeline
|
||||||
import com.mojang.blaze3d.pipeline.RenderTarget
|
import com.mojang.blaze3d.pipeline.RenderTarget
|
||||||
@ -55,12 +56,14 @@ object RenderingUtil {
|
|||||||
val builder = Tesselator.getInstance().begin(mode, renderPipeline.vertexFormat)
|
val builder = Tesselator.getInstance().begin(mode, renderPipeline.vertexFormat)
|
||||||
bufferBuilderConsumer(builder)
|
bufferBuilderConsumer(builder)
|
||||||
builder.buildOrThrow().use { meshData ->
|
builder.buildOrThrow().use { meshData ->
|
||||||
RenderSystem.getDevice().createCommandEncoder().createRenderPass(
|
val encoder = RenderSystem.getDevice().createCommandEncoder() as GlCommandEncoder
|
||||||
|
encoder.createRenderPass(
|
||||||
renderTarget.colorTexture!!,
|
renderTarget.colorTexture!!,
|
||||||
OptionalInt.empty(),
|
OptionalInt.empty(),
|
||||||
renderTarget.depthTexture,
|
renderTarget.depthTexture,
|
||||||
OptionalDouble.empty()
|
OptionalDouble.empty()
|
||||||
).use { renderPass ->
|
).use { renderPass ->
|
||||||
|
encoder.inRenderPass = false;
|
||||||
RenderSystem.getDevice().createBuffer(
|
RenderSystem.getDevice().createBuffer(
|
||||||
{ name }, BufferType.VERTICES, BufferUsage.DYNAMIC_WRITE, meshData.vertexBuffer()
|
{ name }, BufferType.VERTICES, BufferUsage.DYNAMIC_WRITE, meshData.vertexBuffer()
|
||||||
).use { buffer ->
|
).use { buffer ->
|
||||||
@ -74,6 +77,7 @@ object RenderingUtil {
|
|||||||
uniformAndSamplerConsumer?.invoke(renderPass)
|
uniformAndSamplerConsumer?.invoke(renderPass)
|
||||||
renderPass.drawIndexed(0, meshData.drawState().indexCount())
|
renderPass.drawIndexed(0, meshData.drawState().indexCount())
|
||||||
}
|
}
|
||||||
|
encoder.inRenderPass = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,3 +4,6 @@ accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
|||||||
mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object;
|
||||||
|
|
||||||
accessible field net/minecraft/client/gui/GuiGraphics bufferSource Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;
|
accessible field net/minecraft/client/gui/GuiGraphics bufferSource Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;
|
||||||
|
|
||||||
|
accessible field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z
|
||||||
|
mutable field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z
|
@ -3,7 +3,6 @@
|
|||||||
"package": "fr.username404.snowygui.mixins",
|
"package": "fr.username404.snowygui.mixins",
|
||||||
"compatibilityLevel": "JAVA_18",
|
"compatibilityLevel": "JAVA_18",
|
||||||
"client": [
|
"client": [
|
||||||
"CursedRenderPassMixin",
|
|
||||||
"EndTickMixin",
|
"EndTickMixin",
|
||||||
"TitleScreenMixin",
|
"TitleScreenMixin",
|
||||||
"KeysAccessor",
|
"KeysAccessor",
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
"required": false,
|
"required": false,
|
||||||
"package": "fr.username404.snowygui.mixins",
|
"package": "fr.username404.snowygui.mixins",
|
||||||
"compatibilityLevel": "JAVA_21",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [],
|
||||||
"CursedRenderPassMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user