Commit 2f54db7
authored
fix(glsm): add double-angle glRotatef redirect target used by NTM-CE (#65)
* fix(glsm): add double-angle glRotatef redirect target used by NTM-CE
HBM's Nuclear Tech (Community Edition) calls net.minecraft.client.renderer.GlStateManager.rotate(double, float, float, float) from its tile entity item renderers. The GLSM redirector rewrites vanilla GlStateManager calls to GLStateManager by method name while preserving the caller's descriptor, so the (DFFF)V rotate call became GLStateManager.glRotatef(DFFF)V — which did not exist, crashing with NoSuchMethodError when rendering the Industrial Turbine item (issue #64).
Add the missing glRotatef(double, float, float, float) overload next to the existing double-parameter glScalef/glTranslatef compat overloads; it delegates to the float form. Also extend the redirector tests: GLSMRedirectorTest now asserts a synthetic GlStateManager.rotate(DFFF) call is rewritten to GLStateManager.glRotatef with the descriptor preserved, and GLStateManagerRedirectContractTest asserts both the (FFFF)V and (DFFF)V glRotatef forms exist on the compiled class (394 tests, 0 failures).
* fix(compat): adapt HBM-CE mixin targets on DefaultChunkRenderer
HBM-CE's MixinDefaultChunkRenderer redirects reads inside fillCommandBuffer, a
method that existed in upstream Celeritas but was dropped in Actinium's
rewritten renderer. The mixin then aborts with a Critical injection error,
poisoning DefaultChunkRenderer and breaking world loading (issue #47): a
NoClassDefFoundError on VintageRenderSectionManager\ surfaces in
Minecraft.loadWorld and the client player never spawns, cascading into the
player-null NPE storm.
Restore a fillCommandBuffer(CameraTransform) compatibility seam (never invoked
by the render path) so the redirects find their getfield targets and apply
cleanly, preserving the unsafe camera access they also apply to
setModelMatrixUniforms. MixinOcclusionCuller still targets the old Celeritas
OcclusionCuller API that Actinium does not provide, so dev runs enable
-Dmixin.env.ignoreConstraints to downgrade that Critical failure to a skip
instead of poisoning the class.
* build: add HBM-CE and CTM dev dependencies
Declare curse.maven coordinates for HBM's Nuclear Tech Mod Community Edition
(1312314:8330665) and its CTM dependency (267602:2915363) so the dev client
reproduces the HBM celeritas-mixin environment for issue #64 / #47 work.
* fix(celeritas): restore legacy OcclusionNode API as HBM-CE mixin seam
HBM-CE's MixinOcclusionCuller wraps the pre-lattice upstream culling API:
isWithinFrustum(Viewport, OcclusionNode) call sites in isSectionVisible and
tryVisitNode, plus isWithinRenderDistance(CameraTransform, OcclusionNode,
float) in isSectionVisible. Actinium's lattice-based rewrite dropped the
object-node API, so the critical injections failed, poisoned OcclusionCuller,
and aborted the world-join task with NoClassDefFoundError before mc.player
was created — surfacing as the issue #47 player-null NPE storm.
Reintroduce a minimal OcclusionNode data holder and the four legacy members
as dead injection targets, mirroring upstream b07278d0. Verified in the dev
client: all HBM celeritas mixins now apply cleanly and the world loads.
* fix(render): snapshot section light data for off-thread chunk builds
Chunk-builder workers read the live light NibbleArrays while the light engine keeps mutating them on the main thread, so a torn read bakes transient darkness into the mesh (water and fluidlogged quads turning black after a relight burst). Copy the block/sky light arrays eagerly while the section is being cloned on the main thread.
* fix(render): guard tile-entity batches against GL state leaks
HBM-CE machine TESRs leak depth/blend/texture state during the render loop. The FastTESR batch flush relies on ambient GL state, so with machines in view the leaked state turned HBM water reeds into opaque black crosses that also punched holes in the water surface behind them. Wrap the block-entity region in a GLSM attrib push/pop and restore the clean entry state right before drawBatch, in both the main path and the mod-injected setTileEntities path.
* docs: plan celeritas upstream sync (0a3624bc to b8c1079a)
* perf(celeritas): sync fast frustum clamping and visibility snapshot from upstream
Sync upstream commits 9b4256d0, daaefb72, 7c7c8228, d96b07f3 and the
FFC/snapshot portion of 8fdbdb49 (0a3624bc..d96b07f3 + 8fdbdb49).
- OcclusionCuller: explicit allowFrustumClamping parameter (7-arg
findVisible), branchless integer angle refinement, aperture-based
frustum clamping via FastFrustumClamping, multi-root search disables
clamping. Public/package-visible signatures (isWithinFrustum,
isWithinRenderDistance, tryVisitNode, Visitor) preserved.
- FastFrustumClamping: new SWAR-based packed aperture culler (upstream).
- RegionCullCache: reset-based classification with UNCOMPUTED and
PARTIAL_DISTANCE_IN/PARTIAL_FRUSTUM_IN sub-classifications plus cached().
- SectionLattice: visibility snapshot reduced from long[] to int[]
visibleFrames with SnapshotBuffers; findVisible gains the clamping flag.
- RenderListManager/RenderSectionManager: thread the clamping flag through
(enabled for the main pass, disabled for the orthographic shadow pass).
Not included: b8c1079a shadow-occlusion refactor (deferred to the next
phase), HBM-CE OcclusionNode seam (lives on fix/issue64-ntm-glsm, not in
this branch).
* feat(celeritas): sync shadow occlusion culler classes from upstream
Sync the algorithm/data portion of upstream b8c1079a (receiver-driven
shadow occlusion culling).
- ShadowOcclusionCuller: new receiver-driven shadow search rooted at the
main pass's visible sections, traversing toward the light (upstream).
- ShadowSearchFrustum: new optional capability interface for shadow
frustums that support the receiver-driven search (upstream).
- SectionLattice: constructor gains hasShadowPass; adds shadowVisitState,
shadowCuller, visibleCells/visibleCount; splits snapshot buffers into
main/shadow pairs; findVisible records visible cells when a shadow pass
exists; adds findShadowVisible.
- OcclusionCuller: findVisible gains visitState and recordVisible
parameters; static members made package-visible for ShadowOcclusionCuller;
records visible cells during the search.
- Viewport: adds getFrustum().
RenderListManager/SectionGraph wiring is deferred to the next phase; the
tree is intentionally not fully buildable until then.
* feat(celeritas): wire receiver-driven shadow occlusion into renderers
Finish the common-side sync of upstream b8c1079a by adopting SectionGraph
and the frame-ordered shadow search in the renderer layer.
- SectionGraph: new shared lattice + single search thread + deferred
lattice updates (upstream).
- RenderListManager: constructor takes (SectionGraph, shadow,
AsyncOcclusionMode, SectionTicker); attach/detach/updateSectionMetadata
and the search thread move into SectionGraph; adds startShadowGraphUpdate
and the shadow flag; startGraphUpdate rejects the shadow manager.
- RenderSectionManager: both list managers share one SectionGraph; update()
and updateForShadowPass() split by frame order (didShadowPassRunThisFrame);
attach/detach/metadata fan out through the graph; the local
getCurrentRenderListManager() seam is kept for the render/rebuild paths,
while terrain search uses the terrain manager and shadow search uses
updateForShadowPass.
- SimpleWorldRenderer: setupTerrain/setupShadowTerrain/prepareFrame split,
with the local shadow render-distance switch retained in
setupShadowTerrain; chunk events apply while the graph is quiescent.
- VintageRenderSectionManager/ActiniumWorldRenderer: drop the now-redundant
finishAllGraphUpdates() in the shadow render path (setupShadowTerrain
already joins).
Build and all 423 tests pass.
* feat(shader): activate receiver-driven shadow occlusion culling
Wire the common-side shadow search (b8c1079a) into the Iris shader module.
- WorldRendererCompat: add setupShadowTerrain and getLastViewport so the
shadow pass can run the frame-ordered shadow search with the player
viewport captured by the preceding terrain pass.
- ShadowRenderer: call setupShadowTerrain(playerViewport, shadowViewport)
instead of setupTerrain in the celeritas integration block; pass
resolved near/far planes and the interval size to the advanced shadow
frustum (legacy perspective packs skip depth planes); update culling
info strings.
- AdvancedShadowCullingFrustum: implement ShadowSearchFrustum and add
depth planes (toward/away) using SHADOW_CAMERA_OFFSET.
- SafeZoneCullingFrustum: override supportsOcclusionSearch() to false
(safe-zone semantics are incompatible with the receiver-driven search).
- ShadowMatrices: extract SHADOW_CAMERA_OFFSET constant.
- ActiniumWorldRenderer: implement setupShadowTerrain/getLastViewport.
Shadow occlusion now runs end-to-end: the shadow search consumes the
terrain pass's visible-cell root set and expands toward the light. Build
and all 423 tests pass; runtime shadow verification still pending.
* build(celeritas): add JMH benchmark harness adapted to LWJGL 3.4.1
Sync the upstream f3c5642e benchmark harness and adapt it to Actinium's
LWJGL 3.4.1 (the version Cleanroom and the mod's dependency script use).
- celeritas-common/src/jmh: voxel/occlusion/multidraw benchmark sources
from upstream, including the GL-backed OcclusionCullerBench and
MultiDrawBench with their @benchmark methods. SectionLattice/findVisible
calls updated for the post-b8 3-arg constructor and 7-arg findVisible.
- build.gradle: jmh source set, jmhImplementation (jmh-core + annotation
processor) and LWJGL 3.4.1 (lwjgl/lwjgl-opengl/lwjgl-egl) with the same
native-classifier logic as GTNHLib; lwjgl-egl ships no natives classifier,
matching upstream.
- gradle.properties: jmh_version.
HeadlessGl opens a system EGL context (mesa), so the GL benchmarks need
EGL available at runtime (not bundled); pure-CPU benchmarks compile and
run regardless. Build and all 423 tests pass.
* docs: mark celeritas upstream sync complete
* Revert "build(celeritas): add JMH benchmark harness adapted to LWJGL 3.4.1"
This reverts commit 16eaec9.
* chore: ignore local Mesa DLL dir for deferred JMH harness
* docs: note JMH harness deferred (Windows Mesa EGL error 126)
* fix(glsm): fall back to bufferData when mapBufferRange fails
StreamingUploader's MAP_BUFFER_RANGE path fed the glMapBufferRange result
straight into MemoryUtilities.memAddress0 without a null check. When the
driver fails the mapping (returns NULL), Unsafe.getLong(null, 0x10) kills
the JVM with EXCEPTION_ACCESS_VIOLATION reading address 0x10 (hs_err on
the splash render thread during startup; MAP_BUFFER_RANGE is the default
streaming upload strategy).
Restore upstream Angelica's guarded form: RenderBackend gains
mapBufferRangeAddress (returns 0L on failed mapping) and the uploader
falls back to bufferData with a one-time WARN. The fallback is per-call,
so transient mapping failures recover automatically on the next upload.
* fix(celeritas): keep camera getfields inline in RenderSectionManager.update
HBM-CE MixinRenderSectionManager (hbm.mod.mixin.json) registers @reDIrect
injections on the update(Viewport, int, boolean) method body that rewrite
the CameraTransform x/y/z getfields to its unsafe accessors. The b8c1079a
shadow occlusion sync delegated that camera bookkeeping to the new private
updateCameraPosition helper, leaving the redirector with zero scanned
targets; the mixin application aborts with InjectionError, poisons the
whole RenderSectionManager class and crashes mod construction with
NoClassDefFoundError (observed as an Actinium onConstruct crash).
Inline the camera reads back into update (updateCameraPosition stays for
the shadow pass, which HBM-CE does not redirect) and lock the binding
contract with HbmCameraRedirectContractTest, which asserts the three
GETFIELD instructions against the compiled class bytes (same pattern as
GLStateManagerRedirectContractTest).
* fix(glsm): derive FFP shader flags from bound VAO attributes
HBM-CE uploads OBJ models into VAOs while its glEnableClientState calls
(redirected to GLSM) leak bits such as COLOR_BIT into ShaderManager's
globally tracked currentVertexFlags without a matching VAO attribute.
Raw GL draws (glDrawElements and friends, used by HBM's VAO path and by
ShaderManager.preDraw()) then pick a shader variant that declares an
attribute the VAO does not provide; the shader reads the default
(0,0,0,1) and the model renders black. Because the leak is global and
never restored, every machine rendered after the first model upload is
affected and the pollution also breaks GUI item icons that share the FFP
pipeline, independent of the fast-lit item / display-list / multidraw
options.
Derive the vertex-flag mask from VertexAttribState's per-VAO attribute
enablement instead: ShaderManager.preDraw() and onBindVertexArray() for
VAOs unknown to the vanilla VertexFormat setup path now use
VertexAttribState.deriveVertexFlags(), which always matches the real GL
state. Locked down by VertexAttribStateDeriveVertexFlagsTest.
* fix(hbm): restore machine lightmap and depth state
Route HBM render-state scopes through the GLSM state stack and synchronize world lightmap coordinates before tile-entity rendering. Derive fixed-function vertex flags from the bound VAO so raw HBM models do not inherit stale attributes. Add conditional mixins, regression tests, and compatibility documentation.
Test: ./gradlew build --no-daemon
* build(gradle): increase CI build memory
Raise the Gradle heap and direct-memory limits to 8G and cap worker concurrency at two so GitHub Actions builds do not exhaust runner memory during compilation and remapping.
Test: ./gradlew compileJava --no-daemon
* fix(hbm): restore shader texture state
* fix(shader): render block entities in shadow pass
Collect tile entities after the shadow render lists are updated instead of during the later terrain setup.
* fix(glsm): resync shader state after foreign draws
* fix(glsm): isolate built-in item render state1 parent 6110854 commit 2f54db7
53 files changed
Lines changed: 1824 additions & 202 deletions
File tree
- celeritas-common/src/main/java/org/embeddedt/embeddium/impl/render/chunk
- occlusion
- docs
- glsm/src/main/java/com/gtnewhorizons/angelica/glsm
- ffp
- hooks
- events
- recording
- stacks
- states
- gradle/scripts
- shader/src/main/java/net/coderbot/iris
- gbuffer_overrides/matching
- gl/blending
- pipeline
- src
- main
- java/com
- dhj/actinium
- compat/hbm
- mixin
- features/iris
- mod/hbm
- vintage/core/terrain
- render
- terrain
- world/cloned
- gtnewhorizons/angelica/iris
- resources
- test/java
- com
- dhj/actinium
- compat/hbm
- mixins
- mixin
- gtnewhorizons/angelica/glsm
- redirect
- states
- org/embeddedt/embeddium/impl/render/chunk
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
celeritas-common/src/main/java/org/embeddedt/embeddium/impl/render/chunk/DefaultChunkRenderer.java
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
385 | 415 | | |
386 | 416 | | |
387 | 417 | | |
| |||
celeritas-common/src/main/java/org/embeddedt/embeddium/impl/render/chunk/RenderSectionManager.java
Lines changed: 15 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
202 | 212 | | |
203 | 213 | | |
204 | 214 | | |
| |||
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
240 | 254 | | |
241 | 255 | | |
242 | 256 | | |
| |||
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
476 | 531 | | |
477 | 532 | | |
478 | 533 | | |
| |||
Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
422 | 425 | | |
423 | 426 | | |
424 | 427 | | |
425 | | - | |
| 428 | + | |
426 | 429 | | |
427 | 430 | | |
428 | 431 | | |
| |||
435 | 438 | | |
436 | 439 | | |
437 | 440 | | |
| 441 | + | |
438 | 442 | | |
439 | 443 | | |
440 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
| |||
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| 109 | + | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
| |||
0 commit comments