Conversation
Builds a loadable Fabric jar for the MC 1.21.1 Vulkan profile. Only the DH 3.x (API) integration path is compiled; the legacy DH 2.4 (dh24) module is excluded when no DH 2.x jar is present in jars/. Setup - gradle.properties: repoint org.gradle.java.home to the Linux JDK 21; default mcVer=1.21.1. Add gradlew-retry.sh (retries on network drops). Compat.java (lightmap + VulkanMod 0.6.7 API drift) - getLightmapVulkanImage(): split the coarse `>=MC_1_21_1` guard. 1.21.5+ keeps the GlTexture/getTextureView (GPU-rewrite) path; new 1.21.1-1.21.4 branch reads the lightmap DynamicTexture GL id (reflect by TYPE so it survives intermediary remapping) and feeds VkGlTexture.getTexture(id). - AlignedStruct.Builder.addUniformInfo -> addUniform; buildPushConstant() now takes stages (VK_SHADER_STAGE_VERTEX_BIT for the terrain PC block). - New helpers compilePipelineShaders() (Builder.setShaderSrc replaced compileShaders) and createImageDescriptor() (ctor gained descriptorType; sampler2D -> VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER). - Cloud helpers: 1.21.1 lacks Options.cloudRange(), NativeImage.getPixelsABGR(), DimensionType.cloudHeight(); route <=1.21.4 to renderDistance / per-pixel getPixelRGBA / hasSkyLight?192:-1. DH 3.2.0-b API drift - Math classes renamed: Vec3f/Vec3d/Mat4f/Vec3i -> Dh*. - VkRenderApiDefinition: getApiName->getEngineName; add isNativeRenderer() (true), getRenderApi() (VULKAN), getRenderDepth() (FORWARD_Z); IDhFogRenderer gained a DhApiFogRenderParam arg; IDhGenericRenderer gained close(); toUniforms() takes DhApiMat4f directly (no cast). - RenderUniforms.set(DhApiMat4f...); VkLodContainerUniformWrapper -> tryUpload(LodBufferContainer)+close(); VkVertexBufferWrapper drops DH 2.4 upload(); drop stale DH config fields; Graphics.Ssao.enableSsao -> Graphics.enableSsao; remove dead GLProxy import. Build/packaging - vulkan/build.gradle: exclude dh24 sources when no DH 2.x jar; raise javac maxerrs. Remove dh24 mixin entries from dh-vulkanmod.mixins.json. - Decouple entrypoint from dh24 via DhIntegration.wireIfNeeded() default. Runtime mixin targets verified present in DH 3.2.0-b / MC 1.21.1: setRenderingApiBindings(), LightMapWrapper.uploadLightmap/createLightmap, LevelRenderer.renderLevel/renderClouds.
The port compiled/bound against DH 3.0.0-nightly APIs but DH 3.2.0-b changed three runtime behaviours that stopped LODs from rendering. In-game verified: LODs now render (Beryl shading of LODs still TODO — see fork vm.4/vm.5). 1. Mixin target drift: DH 3.2.0-b dropped the `loaderCommon.fabric.` relocation prefix for a `_fabric`/`_neoforge` class suffix. Retarget MixinDependencySetup and MixinLightMapWrapper to `...DependencySetup_fabric` / `...LightMapWrapper_fabric`. 2. "No Lightmap Loaded" render gate: DH 3.2.0-b's ClientApi hard-skips rendering when RenderParams validation fails, and it requires a registered lightmap wrapper. DH's own LightTexture hook doesn't register one under VulkanMod (VM overwrites MC's LightTexture drive). Register the wrapper ourselves, GL-free, at renderLevel HEAD (ungated — registering inside the render path is unreachable because the gate skips it). The real lightmap is still fed to the Vulkan renderer via Compat.getLightmapVulkanImage(). NOTE: token-registration workaround; the upstream-quality fix is to make DH's validation VulkanMod-aware. 3. Beryl compat: Compat.rebindMainTarget() hard-cast getMainPass() to the concrete DefaultMainPass, but Beryl swaps in net.beryl.render.ShaderMainPass -> CCE every frame -> composite/endFrame aborted. Cast to the MainPass interface instead (rebindMainTarget() is declared there; both impls provide it).
There was a problem hiding this comment.
Pull request overview
Ports the DH↔VulkanMod bridge to Minecraft 1.21.1, updating for Distant Horizons (DH) 3.2.0-b and VulkanMod 0.6.7 API changes, plus new runtime compatibility fixes discovered via in-game testing (mixin retargeting, lightmap-wrapper validation gating, and shader-mod MainPass compatibility).
Changes:
- Retarget DH mixins for DH 3.2.0-b’s
_fabricclass suffixing and add a renderLevel@HEAD workaround to register DH’s lightmap wrapper under VulkanMod. - Update Vulkan pipeline/shader/descriptor setup to match VulkanMod 0.6.7 APIs and adjust DH math/config API renames (Mat4f/Vec3f → DhMat4f/DhVec3f, SSAO config path, etc.).
- Drop/disable legacy DH 2.4 integration paths in the shipped mixin set and entrypoint behavior, and add Gradle logic to exclude dh24 sources when no DH 2.x jar is present.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vulkan/src/main/resources/dh-vulkanmod.mixins.json | Removes dh24 mixins and keeps only DH3/shared mixins for this build. |
| vulkan/src/main/java/com/braffolk/dhvulkan/mixin/shared/MixinLightMapWrapper.java | Retargets LightMapWrapper mixin to DH 3.2.0-b _fabric class name. |
| vulkan/src/main/java/com/braffolk/dhvulkan/mixin/shared/MixinLevelRenderer.java | Adds renderLevel@HEAD hook to register DH lightmap wrapper and keep composite hook. |
| vulkan/src/main/java/com/braffolk/dhvulkan/mixin/dh3/MixinDependencySetup.java | Retargets DependencySetup mixin to DH 3.2.0-b _fabric class name. |
| vulkan/src/main/java/com/braffolk/dhvulkan/DhVulkanModEntrypoint.java | Disables DH 2.4 runtime path; makes wireIfNeeded integration-agnostic. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/VulkanRenderEngine.java | Updates DH math types and drops removed DH config toggles; clarifies lightmap binding timing. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/VulkanRenderContext.java | Adapts pipeline shader compilation and image descriptor creation to VM 0.6.7. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/VulkanCloudRenderer.java | Updates matrix types and related helper signatures for DH 3.2.0-b. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/VulkanBackend.java | Updates backend interface to use DhVec3f for model offsets. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/pipeline/DhSsaoPipeline.java | Updates matrix type + VM 0.6.7 shader/descriptor plumbing via Compat helpers. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/pipeline/DhFogPipeline.java | Updates matrix type + VM 0.6.7 shader/descriptor plumbing via Compat helpers. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/pipeline/DhDepthReaderPipeline.java | Updates VM 0.6.7 shader/descriptor plumbing via Compat helpers. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/pipeline/DhCompositePipeline.java | Updates VM 0.6.7 shader/descriptor plumbing via Compat helpers. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/DhConfigHelper.java | Adjusts SSAO config lookup to the new DH 3.2.0-b config path. |
| vulkan/src/main/java/com/braffolk/dhvulkan/core/data/RenderUniforms.java | Switches to DhApiMat4f inputs and DhMat4f storage; removes old cast-based copying. |
| vulkan/src/main/java/com/braffolk/dhvulkan/compat/Compat.java | Adds VM 0.6.7 helpers (shader src + image descriptors), new lightmap path for 1.21.1–1.21.4, MainPass cast fix, and DH lightmap-wrapper registration workaround. |
| vulkan/src/main/java/com/braffolk/dhvulkan/bridge/DhIntegration.java | Adds a default wireIfNeeded() to decouple entrypoint from optional dh24 module. |
| vulkan/src/main/java/com/braffolk/dhvulkan/api/VkVertexBufferWrapper.java | Removes DH 2.4 upload() compat method and aligns with DH 3.x interface. |
| vulkan/src/main/java/com/braffolk/dhvulkan/api/VkRenderApiDefinition.java | Updates DH 3.2.0-b render-definition metadata, fog renderer signature, and matrix copying. |
| vulkan/src/main/java/com/braffolk/dhvulkan/api/VkLodContainerUniformWrapper.java | Updates to DH 3.2.0-b ILodContainerUniformBufferWrapper interface (tryUpload + close). |
| vulkan/build.gradle | Excludes dh24 sources when no DH 2.x jar exists so DH 3.x builds stand alone. |
| gradle.properties | Pins mcVer to 1.21.1 for this port. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
19
to
+23
| */ | ||
| @Mixin(targets = "loaderCommon.fabric.com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper", remap = false) | ||
| // DH 3.2.0-b: `loaderCommon.fabric.` relocation prefix gone; class now carries a | ||
| // `_fabric` suffix (see HANDOFF Open Issue #1). uploadLightmap/createLightmap still | ||
| // exist on the _fabric variant; bind/unbind (DH 2.4 only) stay require=0. | ||
| @Mixin(targets = "com.seibel.distanthorizons.common.wrappers.misc.LightMapWrapper_fabric", remap = false) |
Comment on lines
+17
to
+21
| // DH 3.2.0-b dropped the `loaderCommon.fabric.` relocation prefix and now emits | ||
| // per-loader classes with a `_fabric` / `_neoforge` suffix. Under Fabric the class | ||
| // actually instantiated (and whose static setRenderingApiBindings() runs) is the | ||
| // _fabric variant. See HANDOFF Open Issue #1. | ||
| @Mixin(targets = "com.seibel.distanthorizons.common.wrappers.DependencySetup_fabric", remap = false) |
Comment on lines
+83
to
+87
| // This build ships only the DH 3.x (API) integration path. | ||
| // The legacy DH 2.4 (dh24) module is not compiled in. | ||
| LOGGER.warn("[DH-VulkanMod] Detected DH {} but this build only supports DH 3.x. " | ||
| + "Extension will be inactive.", dhVersion); | ||
| return; |
Comment on lines
+42
to
+52
| // The legacy DH 2.4 ("dh24") integration only compiles against a DH 2.x jar | ||
| // (uses GLProxy / GLVertexBuffer / LodBufferContainer.vbos, etc.). When no DH 2.x | ||
| // jar is present in jars/, exclude that module and build the DH 3.x path only. | ||
| def dh24Jar = fileTree("${rootDir}/jars").matching { include "DistantHorizons-2.*-${mcVer}-*.jar" }.files | ||
| if (dh24Jar.isEmpty()) { | ||
| sourceSets.main.java { | ||
| exclude "com/braffolk/dhvulkan/dh24/**" | ||
| exclude "com/braffolk/dhvulkan/mixin/dh24/**" | ||
| } | ||
| logger.lifecycle("[DH-VulkanMod] No DH 2.x jar for MC ${mcVer} — excluding legacy dh24 module (DH 3.x-only build).") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the bridge to MC 1.21.1 against DH 3.2.0-b and VulkanMod 0.6.7. LODs render in game, verified.
Two commits.
1. The port
VulkanMod 0.6.7 and DH 3.2.0-b API drift, plus a 1.21.1-1.21.4 lightmap path: 1.21.5+ keeps the
GlTexture/getTextureViewroute, while 1.21.1 reads the lightmapDynamicTextureGL id and feedsVkGlTexture.getTexture(reflected by TYPE so it survives intermediary remapping). Also cloud helpers for the olderOptions/NativeImage/DimensionTypeAPIs, and the legacy DH 2.4 (dh24) module is excluded when no DH 2.x jar is present, so the DH 3.x path builds standalone.2. DH 3.2.0-b runtime compat
Three things that only showed up by actually running it:
loaderCommon.fabric.relocation prefix in favour of a_fabric/_neoforgeclass suffix, soMixinDependencySetupandMixinLightMapWrapperwere silently not applying (target not found) and the Vulkan renderers never bound.ClientApihard-skips rendering whenRenderParamsvalidation fails, and that validation requires a registered lightmap wrapper. DH's ownLightTexturehook does not register one under VulkanMod, because VulkanMod overwrites MC'sLightTexturedrive. So the wrapper is registered here, GL free, atrenderLevelHEAD. The real lightmap still reaches the Vulkan renderer viaCompat.getLightmapVulkanImage(). Flagging this one as a workaround: the upstream-quality fix is to make DH's validation VulkanMod aware, and I am happy to rework it into that shape if you would prefer.Compat.rebindMainTarget()hard-castgetMainPass()to the concreteDefaultMainPass, but Beryl swaps in its ownShaderMainPass, so it threwClassCastExceptionevery frame and aborted composite/endFrame. Cast to theMainPassinterface instead; both impls declarerebindMainTarget().Not included
Beryl shading of LODs. This is based on vm.2, and vm.4/vm.5 carry the actual Beryl work, so that needs porting separately.