Low-Drag-MC / Shimmer

A mod that integrates my passion for rendering
MIT License
70 stars 22 forks source link

[Forge - 1.19.2]: Framebuffer name must be generated before being bound #68

Closed SiverDX closed 10 months ago

SiverDX commented 1 year ago

Minecraft Version

1.19.2

ModLoader

Forge

Shimmer version

Shimmer-forge-1.19.2-0.1.14

Modpack info or mod list(please reduce mod range)

Too many to list

The latest.log file and hs_err_pidXXX if exists

N/A

optifine , Rubidium , flywheel or any rendering related mods. mod version is required.

Issue description

When reloading resources ingame it can happen that a lot of errors like this occur:

[com.mojang.blaze3d.platform.GlDebug/]: OpenGL debug message: id=1282, source=API, type=ERROR, severity=HIGH, message='GL_INVALID_OPERATION error generated. Framebuffer name must be generated before being bound.'

It can also cause the screen to go black Reloading the resources again can fix the issue (and then after reloading it can occur again)

I'm also using https://www.curseforge.com/minecraft/texture-packs/blooming-blocks I don't use Oculus

Steps to reproduce

  1. Reload resources

Other information

No response

SiverDX commented 1 year ago

Just now it occured randomly without reloading resources (Though this seems to be much more rare)

SiverDX commented 12 months ago

Did an inject at the HEAD of the debug logging, no clue if this helps

Particle render type: POST_WRAPPED_PARTICLE_SHEET_TRANSLUCENT

glBindFramebuffer

https://github.com/Low-Drag-MC/Shimmer/blob/153f3a76d8f5d5e8350009ac090f8ebb8925312e/Forge/src/main/java/com/lowdragmc/shimmer/forge/core/mixins/ForgeParticleEngineMixin.java#L80

handler$dpo000$where_am_i:13, GlDebug (com.mojang.blaze3d.platform)
m_84038_:89, GlDebug (com.mojang.blaze3d.platform)
invoke:-1, GlDebug$$Lambda$4691/0x0000000801a28ab0 (com.mojang.blaze3d.platform)
callback:46, GLDebugMessageCallbackI (org.lwjgl.opengl)
glBindFramebuffer:-1, GL30C (org.lwjgl.opengl)
glBindFramebuffer:1619, GL30 (org.lwjgl.opengl)
m_84486_:361, GlStateManager (com.mojang.blaze3d.platform)
m_83961_:201, RenderTarget (com.mojang.blaze3d.pipeline)
m_83947_:194, RenderTarget (com.mojang.blaze3d.pipeline)
modifyReceiver$hil000$injectRenderPre:83, ParticleEngine (net.minecraft.client.particle)
render:401, ParticleEngine (net.minecraft.client.particle)
m_109599_:1381, LevelRenderer (net.minecraft.client.renderer)
m_109089_:1068, GameRenderer (net.minecraft.client.renderer)
m_109093_:840, GameRenderer (net.minecraft.client.renderer)
m_91383_:1115, Minecraft (net.minecraft.client)
m_91374_:700, Minecraft (net.minecraft.client)
m_239872_:212, Main (net.minecraft.client.main)
main:51, Main (net.minecraft.client.main)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, Method (java.lang.reflect)
lambda$launchService$0:27, CommonClientLaunchHandler (net.minecraftforge.fml.loading.targets)
run:-1, CommonClientLaunchHandler$$Lambda$936/0x0000000800ff1058 (net.minecraftforge.fml.loading.targets)
launch:30, LaunchServiceHandlerDecorator (cpw.mods.modlauncher)
launch:53, LaunchServiceHandler (cpw.mods.modlauncher)
launch:71, LaunchServiceHandler (cpw.mods.modlauncher)
run:106, Launcher (cpw.mods.modlauncher)
main:77, Launcher (cpw.mods.modlauncher)
accept:26, BootstrapLaunchConsumer (cpw.mods.modlauncher)
accept:23, BootstrapLaunchConsumer (cpw.mods.modlauncher)
main:141, BootstrapLauncher (cpw.mods.bootstraplauncher)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, Method (java.lang.reflect)
main:57, Main (io.github.zekerzhayard.forgewrapper.installer)
invokeStaticInit:-1, LambdaForm$DMH/0x0000000800c02400 (java.lang.invoke)
invokeExact_MT:-1, LambdaForm$MH/0x0000000800c02c00 (java.lang.invoke)
launch:88, StandardLauncher (org.prismlauncher.launcher.impl)
listen:126, EntryPoint (org.prismlauncher)
main:71, EntryPoint (org.prismlauncher)

https://github.com/Low-Drag-MC/Shimmer/blob/153f3a76d8f5d5e8350009ac090f8ebb8925312e/Forge/src/main/java/com/lowdragmc/shimmer/forge/core/mixins/ForgeParticleEngineMixin.java#L103

handler$dpo000$where_am_i:13, GlDebug (com.mojang.blaze3d.platform)
m_84038_:89, GlDebug (com.mojang.blaze3d.platform)
invoke:-1, GlDebug$$Lambda$4691/0x0000000801a28ab0 (com.mojang.blaze3d.platform)
callback:46, GLDebugMessageCallbackI (org.lwjgl.opengl)
glBindFramebuffer:-1, GL30C (org.lwjgl.opengl)
glBindFramebuffer:1619, GL30 (org.lwjgl.opengl)
m_84486_:361, GlStateManager (com.mojang.blaze3d.platform)
m_83961_:201, RenderTarget (com.mojang.blaze3d.pipeline)
m_83947_:194, RenderTarget (com.mojang.blaze3d.pipeline)
renderParticlePost:326, PostProcessing (com.lowdragmc.shimmer.client.postprocessing)
handler$hil000$injectRenderReturn:105, ParticleEngine (net.minecraft.client.particle)
render:425, ParticleEngine (net.minecraft.client.particle)
m_109599_:1381, LevelRenderer (net.minecraft.client.renderer)
m_109089_:1068, GameRenderer (net.minecraft.client.renderer)
m_109093_:840, GameRenderer (net.minecraft.client.renderer)
m_91383_:1115, Minecraft (net.minecraft.client)
m_91374_:700, Minecraft (net.minecraft.client)
m_239872_:212, Main (net.minecraft.client.main)
main:51, Main (net.minecraft.client.main)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, Method (java.lang.reflect)
lambda$launchService$0:27, CommonClientLaunchHandler (net.minecraftforge.fml.loading.targets)
run:-1, CommonClientLaunchHandler$$Lambda$936/0x0000000800ff1058 (net.minecraftforge.fml.loading.targets)
launch:30, LaunchServiceHandlerDecorator (cpw.mods.modlauncher)
launch:53, LaunchServiceHandler (cpw.mods.modlauncher)
launch:71, LaunchServiceHandler (cpw.mods.modlauncher)
run:106, Launcher (cpw.mods.modlauncher)
main:77, Launcher (cpw.mods.modlauncher)
accept:26, BootstrapLaunchConsumer (cpw.mods.modlauncher)
accept:23, BootstrapLaunchConsumer (cpw.mods.modlauncher)
main:141, BootstrapLauncher (cpw.mods.bootstraplauncher)
invoke0:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, NativeMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, DelegatingMethodAccessorImpl (jdk.internal.reflect)
invoke:-1, Method (java.lang.reflect)
main:57, Main (io.github.zekerzhayard.forgewrapper.installer)
invokeStaticInit:-1, LambdaForm$DMH/0x0000000800c02400 (java.lang.invoke)
invokeExact_MT:-1, LambdaForm$MH/0x0000000800c02c00 (java.lang.invoke)
launch:88, StandardLauncher (org.prismlauncher.launcher.impl)
listen:126, EntryPoint (org.prismlauncher)
main:71, EntryPoint (org.prismlauncher)
SiverDX commented 12 months ago

I think it's very common with many particles (or at least water drip particles)? Makes it kinda unplayable atm

SiverDX commented 12 months ago

I changed it like this for now No clue about this stuff or the performance impact

~But I did not encounter the issue yet - so this fixed it or it's just very inconsistent?~ ~Nevermind, it's just inconsistent, second attempt:~ Second attemp might actually fix the issue but kills the performance

    @ModifyReceiver(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/culling/Frustum;)V",
            at = @At(value = "INVOKE",
                    target = "Lnet/minecraft/client/particle/ParticleRenderType;begin(Lcom/mojang/blaze3d/vertex/BufferBuilder;Lnet/minecraft/client/renderer/texture/TextureManager;)V"))
    private ParticleRenderType injectRenderPre(ParticleRenderType particlerendertype, BufferBuilder bufferBuilder, TextureManager textureManager) {
        if (particlerendertype instanceof IPostParticleType && this.particles.get(particlerendertype).size() > 0) {
            PostProcessing postProcessing = ((IPostParticleType) particlerendertype).getPost();

            CopyDepthColorTarget postTarget = postProcessing.getPostTarget(false);
            postTarget.frameBufferId = GlStateManager.glGenFramebuffers();
            GlStateManager._glBindFramebuffer(GL30.GL_FRAMEBUFFER, postTarget.frameBufferId);
            postTarget.bindWrite(false);

            postProcessing.hasParticle();
        }
        return particlerendertype;
    }
SiverDX commented 11 months ago

Currently trying things out without https://www.curseforge.com/minecraft/mc-mods/fix-gpu-memory-leak Since it does some tick- / queue-based framebuffer name binding

SiverDX commented 10 months ago

Closing this since the issue stopped occuring after removing the mentioned mod above