From 560ba41fa5f422d7c1008e8ed2e2b273850ab689 Mon Sep 17 00:00:00 2001 From: MCRcortex <18544518+MCRcortex@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:23:00 +1000 Subject: [PATCH 1/2] attempted fix for incorrect sampling of depth buffer stuffs --- .../cortex/voxy/client/core/AbstractRenderPipeline.java | 9 ++++++++- .../cortex/voxy/client/core/IrisVoxyRenderPipeline.java | 2 +- .../resources/assets/voxy/shaders/post/depth_copy.frag | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/AbstractRenderPipeline.java b/src/main/java/me/cortex/voxy/client/core/AbstractRenderPipeline.java index 74e5f981..7b63e779 100644 --- a/src/main/java/me/cortex/voxy/client/core/AbstractRenderPipeline.java +++ b/src/main/java/me/cortex/voxy/client/core/AbstractRenderPipeline.java @@ -53,6 +53,11 @@ public abstract class AbstractRenderPipeline extends TrackedObject { private final FullscreenBlit depthMaskBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/noop.frag"); private final FullscreenBlit depthSetBlit = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth0.frag"); private final FullscreenBlit depthCopy = new FullscreenBlit("voxy:post/fullscreen2.vert", "voxy:post/depth_copy.frag"); + private static final int DEPTH_SAMPLER = glGenSamplers(); + static { + glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glSamplerParameteri(DEPTH_SAMPLER, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } protected AbstractRenderPipeline(AsyncNodeManager nodeManager, NodeCleaner nodeCleaner, HierarchicalOcclusionTraverser traversal, BooleanSupplier frexSupplier) { this.frexStillHasWork = frexSupplier; @@ -109,9 +114,11 @@ public abstract class AbstractRenderPipeline extends TrackedObject { // the mismatched formats in this case is the d32 to d24s8 glBindFramebuffer(GL30.GL_FRAMEBUFFER, targetFb); + this.depthCopy.bind(); int depthTexture = glGetNamedFramebufferAttachmentParameteri(sourceFrameBuffer, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME); glBindTextureUnit(0, depthTexture); - + glBindSampler(0, DEPTH_SAMPLER); + glUniform2f(1,((float)width)/srcWidth, ((float)height)/srcHeight); glColorMask(false,false,false,false); this.depthCopy.blit(); diff --git a/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java b/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java index 3a267c22..443d75d2 100644 --- a/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java +++ b/src/main/java/me/cortex/voxy/client/core/IrisVoxyRenderPipeline.java @@ -113,7 +113,7 @@ public class IrisVoxyRenderPipeline extends AbstractRenderPipeline { glClear(GL_COLOR_BUFFER_BIT); } - if (this.data.useViewportDims) { + if (!this.data.useViewportDims) { srcWidth = viewport.width; srcHeight = viewport.height; } diff --git a/src/main/resources/assets/voxy/shaders/post/depth_copy.frag b/src/main/resources/assets/voxy/shaders/post/depth_copy.frag index c43f07a0..56ab97b8 100644 --- a/src/main/resources/assets/voxy/shaders/post/depth_copy.frag +++ b/src/main/resources/assets/voxy/shaders/post/depth_copy.frag @@ -1,8 +1,9 @@ #version 330 core layout(binding = 0) uniform sampler2D depthTex; +layout(location = 1) uniform vec2 scaleFactor; in vec2 UV; void main() { - gl_FragDepth = texture(depthTex, UV).r; + gl_FragDepth = texture(depthTex, UV*scaleFactor).r; } \ No newline at end of file From 4d8de7eb3d7fedfd87e3cd344e1c0c5d8a5f3e91 Mon Sep 17 00:00:00 2001 From: MCRcortex <18544518+MCRcortex@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:27:39 +1000 Subject: [PATCH 2/2] remove lighting synchronizer + version bump --- build.gradle | 1 + gradle.properties | 2 +- .../minecraft/MixinLayerLightSectionStorage.java | 16 ++++++++++++++++ src/main/resources/client.voxy.mixins.json | 13 +++++++------ src/main/resources/fabric.mod.json | 5 ++++- 5 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 src/main/java/me/cortex/voxy/client/mixin/minecraft/MixinLayerLightSectionStorage.java diff --git a/build.gradle b/build.gradle index 5ab53405..d67c12d9 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,7 @@ def gitCommitHash = { -> } def buildtime = {System.currentTimeSeconds()} + processResources { def time = buildtime() def hash = gitCommitHash() diff --git a/gradle.properties b/gradle.properties index 7530cea8..8b98d13e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,6 +16,6 @@ fabric_version=0.134.1+1.21.10 # Mod Properties -mod_version = 0.2.6-alpha +mod_version = 0.2.7-alpha maven_group = me.cortex archives_base_name = voxy \ No newline at end of file diff --git a/src/main/java/me/cortex/voxy/client/mixin/minecraft/MixinLayerLightSectionStorage.java b/src/main/java/me/cortex/voxy/client/mixin/minecraft/MixinLayerLightSectionStorage.java new file mode 100644 index 00000000..eaf264a4 --- /dev/null +++ b/src/main/java/me/cortex/voxy/client/mixin/minecraft/MixinLayerLightSectionStorage.java @@ -0,0 +1,16 @@ +package me.cortex.voxy.client.mixin.minecraft; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import net.minecraft.world.level.chunk.DataLayer; +import net.minecraft.world.level.lighting.LayerLightSectionStorage; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(LayerLightSectionStorage.class) +public class MixinLayerLightSectionStorage { + @Redirect(method = "", at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/longs/Long2ObjectMaps;synchronize(Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;)Lit/unimi/dsi/fastutil/longs/Long2ObjectMap;"), remap = false) + private static Long2ObjectMap voxy$removeSynchronized(Long2ObjectMap map) { + return map; + } +} diff --git a/src/main/resources/client.voxy.mixins.json b/src/main/resources/client.voxy.mixins.json index c66ee66e..662108fe 100644 --- a/src/main/resources/client.voxy.mixins.json +++ b/src/main/resources/client.voxy.mixins.json @@ -5,28 +5,28 @@ "client": [ "flashback.MixinFlashbackMeta", "flashback.MixinFlashbackRecorder", - "iris.MixinLevelRenderer", - "iris.MixinPackRenderTargetDirectives", "iris.CustomUniformsAccessor", "iris.IrisRenderingPipelineAccessor", "iris.MixinIris", "iris.MixinIrisRenderingPipeline", "iris.MixinIrisSamplers", + "iris.MixinLevelRenderer", "iris.MixinMatrixUniforms", + "iris.MixinPackRenderTargetDirectives", "iris.MixinProgramSet", "iris.MixinShaderPackSourceNames", "iris.MixinStandardMacros", - "minecraft.MixinClientLevel", + "minecraft.MixinBlockableEventLoop", "minecraft.MixinClientChunkCache", "minecraft.MixinClientCommonPacketListenerImpl", + "minecraft.MixinClientLevel", "minecraft.MixinClientPacketListener", "minecraft.MixinFogRenderer", "minecraft.MixinGlDebug", + "minecraft.MixinLevelRenderer", "minecraft.MixinMinecraft", "minecraft.MixinRenderSystem", - "minecraft.MixinBlockableEventLoop", "minecraft.MixinWindow", - "minecraft.MixinLevelRenderer", "nvidium.MixinRenderPipeline", "sodium.AccessorChunkTracker", "sodium.AccessorSodiumWorldRenderer", @@ -34,7 +34,8 @@ "sodium.MixinDefaultChunkRenderer", "sodium.MixinRenderSectionManager", "sodium.MixinSodiumOptionsGUI", - "sodium.MixinSodiumWorldRenderer" + "sodium.MixinSodiumWorldRenderer", + "minecraft.MixinLayerLightSectionStorage" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bb87b0bb..7a5c4db4 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,10 @@ ] }, "mixins": [ - "client.voxy.mixins.json", + { + "config": "client.voxy.mixins.json", + "environment": "client" + }, "common.voxy.mixins.json" ], "depends": {