Zero-dependency Java 8+ bindings for graphics debugging and performance profiling tools
with transparent Java 25+ Panama FFM Multi-Release acceleration
Compatible with · LWJGL 2 · LWJGL 3 · JOGL · Vulkan / OpenGL / Direct3D · Custom Rendering Engines
Highlights · Modules · Installation · Quick Start · Architecture · Configuration · Building & Samples · Contributing
- Zero Runtime Dependencies: Every artifact compiles with
--release 8, ships anAutomatic-Module-Namefor JPMS, and introduces zero transitive runtime dependencies. - Dual-Runtime Multi-Release JARs (JNI + Java 25 Panama FFM, plus Java 11 JFR): Java 8–24 runtimes invoke stack-buffered C11 JNI bindings, while JDK 25+ loads
META-INF/versions/25classes usingSymbolLookup.libraryLookupandLinker.Option.critical(...)downcalls — zero JNI overhead on Java 25+. Pure-Javajgdt-jfrships a Java 8 no-op base with a liveMETA-INF/versions/11jdk.jfrimplementation. Inspect native FFM activation via<Module>.isFfmActive(). - Single-Source-of-Truth Codegen: A typed Kotlin DSL in
build-logicgenerates the plain-C ABI header, C11 JNI forwarding shell, Java 8 JNI class, and Java 25 FFM class from one specification. - Lock-Safe Content-Hashed Extraction: Bundled natives extract to
${java.io.tmpdir}/jgdt-<user>/<lib>-<sha256>/with.sha256sidecar verification, atomic moves, and owner-only permissions — preventing Windows multi-process DLL locking and shared-/tmpcollisions. - Graceful No-Op Degradation: Missing tools or unsupported platforms never throw
UnsatisfiedLinkError; entry points return safe no-op instances (isAvailable() == false).
| Module | Artifact (net.morphismmc.jgdt) |
Version | Upstream SDK | Target Platforms (x86_64, aarch64) |
Packaging |
|---|---|---|---|---|---|
| renderdoc | jgdt-renderdoc |
0.1.0 |
renderdoc_app.h (1.0–1.7) |
Windows, Linux | Embedded MR-JAR |
| tracy | jgdt-tracy |
0.15.0-0.1.0 |
Tracy v0.15.0 |
Windows, Linux, macOS | MR-JAR + natives-<os>-<arch> |
| nvtx | jgdt-nvtx |
0.1.0 |
NVIDIA NVTX3 v3.7.0 |
Windows, Linux | Embedded MR-JAR |
| itt | jgdt-itt |
0.1.0 |
Intel ittapi v3.28.4 |
Windows, Linux, macOS | Embedded MR-JAR |
| pix | jgdt-pix |
0.1.0 |
WinPixEventRuntime 1.0.240308001 |
Windows | Embedded MR-JAR |
| signpost | jgdt-signpost |
0.1.0 |
Apple os_signpost (libSystem) |
macOS | Embedded MR-JAR |
| jfr | jgdt-jfr |
0.1.0 |
jdk.jfr (FlightRecorder) |
Pure Java 8+ (11+ active) | Pure Java MR-JAR |
| aftermath | jgdt-aftermath |
0.1.0 |
NVIDIA Nsight Aftermath (clean-room C ABI) | Windows, Linux | Embedded MR-JAR |
| profiler | jgdt-profiler |
0.1.0 |
ServiceLoader facade + JVM telemetry |
Pure Java 8+ (all) | Pure Java JAR |
Add only the backends you need in Gradle (Kotlin DSL):
dependencies {
implementation("net.morphismmc.jgdt:jgdt-renderdoc:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-nvtx:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-itt:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-pix:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-signpost:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-jfr:0.1.0")
implementation("net.morphismmc.jgdt:jgdt-aftermath:0.1.0")
// Optional unified facade (auto-discovers any jgdt backends on the runtime classpath)
implementation("net.morphismmc.jgdt:jgdt-profiler:0.1.0")
// Tracy ships native binaries in platform classifier JARs
implementation("net.morphismmc.jgdt:jgdt-tracy:0.15.0-0.1.0")
runtimeOnly("net.morphismmc.jgdt:jgdt-tracy:0.15.0-0.1.0:natives-windows-x86_64")
}Available classifiers for jgdt-tracy: natives-windows-x86_64, natives-windows-aarch64, natives-linux-x86_64, natives-linux-aarch64, natives-macos-x86_64, natives-macos-aarch64.
Tip
On JDK 24+, pass --enable-native-access=ALL-UNNAMED (or your module name) to avoid restricted native-access warnings from JNI and Panama FFM.
Call RenderDoc.attach() (passive) or RenderDoc.load() (active discovery) before creating your OpenGL, Vulkan, or Direct3D device:
// For Vulkan: activate the implicit layer before vkCreateInstance
RenderDoc.enableVulkanImplicitLayer();
RenderDoc rdoc = RenderDoc.load();
if (rdoc.isAvailable()) {
rdoc.setCaptureFilePathTemplate("captures/frame");
try (CaptureScope scope = rdoc.captureFrame()) {
scope.setTitle("Main Scene Pass");
renderFrame();
}
// RenderDoc 1.7.0+ object & command annotations
rdoc.setGLObjectAnnotation(0L, 0x0DE1 /* GL_TEXTURE_2D */, texId, "material.albedo", "stone");
}jgdt-profiler fans out zones, marks, plots, and thread names across every active jgdt backend discovered via ServiceLoader (tracy, nvtx, itt, pix, signpost, jfr), and optionally streams JVM heap, direct-buffer, GC, and thread metrics:
Profiler.setThreadName("RenderThread");
ExecutorService workers = Executors.newFixedThreadPool(4);
Executor tracedWorkers = TracingExecutor.wrap(workers, "WorkerTask", 0xFFFFAA33);
try (JvmMetricsMonitor jvm = new JvmMetricsMonitor().start(250L)) {
try (ProfileScope frame = Profiler.zone("RenderFrame", 0xFF33AAFF)) {
tracedWorkers.execute(() -> updateSimulation());
Profiler.plot("DrawCalls", 128L);
renderFrame();
}
Profiler.frameMark();
}See each module's README for backend-specific features such as Tracy zero-allocation raw zones, GPU contexts, and frame thumbnails, NVTX/ITT domains, PIX GPU/timing captures, macOS os_signpost Instruments intervals, jdk.jfr Flight Recorder events, or NVIDIA Nsight Aftermath GPU crash dumps.
Each native module splits its Java-facing wrapper from a plain-C/C++ core through a declarative Kotlin specification (BindingSpecs) that generates all four transport layers in lockstep:
flowchart LR
Spec["Kotlin BindingSpec (build-logic)"] --> Gen["GenerateBindingsTask"]
Gen --> J8["*Natives.java (Java 8 JNI)"]
Gen --> J25["*Natives.java (Java 25 Panama FFM)"]
Gen --> JniC["jgdt_mod_jni.c (C11 JNI shell)"]
Gen --> CAbi["jgdt_mod.h (Plain-C ABI)"]
J8 -->|"JDK 8-24"| JniC
JniC --> Core["Handwritten C/C++ Core (Zig 0.17.1)"]
J25 -->|"JDK 25+ FFM downcalls"| Core
CAbi -.->|"Included by"| JniC
CAbi -.->|"Implements"| Core
- Plain-C core: Handwritten native code in
modules/<mod>/native/src/has zero dependency on<jni.h>and exportsJGDT_EXPORTsymbols matchingjgdt_<mod>.h. - Zero-copy / low-overhead marshalling:
native/common/jgdt_jni.huses stack buffers for typical UTF-8/UTF-16/OS-path strings, while Java 25 FFM appliesLinker.Option.critical(false)/critical(true)to non-blocking leaf functions.
| Property | Env Fallback | Default | Description |
|---|---|---|---|
-Djgdt.jni.path.<lib> |
— | — | Override extracted binary path for a specific library (e.g. jgdt.jni.path.jgdt_tracy) |
-Djgdt.jni.path |
— | — | Global native library file or directory override across all modules |
-Djgdt.cache.dir |
— | ${java.io.tmpdir}/jgdt-<user> |
Native extraction cache root (useful if /tmp is mounted noexec) |
-Djgdt.renderdoc.path |
JGDT_RENDERDOC_PATH, RENDERDOC_PATH |
OS discovery | Explicit path to renderdoc.dll / librenderdoc.so for RenderDoc.load() |
-Djgdt.nvtx.path |
NVTX_INJECTION64_PATH |
— | Explicit NVTX injection library path |
-Djgdt.itt.path |
INTEL_LIBITTNOTIFY64 |
— | Explicit Intel ITT collector library path |
-Djgdt.pix.path |
JGDT_PIX_PATH, PIX_PATH |
OS discovery | Explicit path to WinPixEventRuntime.dll or parent directory |
-Djgdt.signpost.subsystem |
— | net.morphismmc.jgdt |
Subsystem passed to os_log_create for Signpost.defaultLog() |
-Djgdt.signpost.category |
— | PointsOfInterest |
Category passed to os_log_create for Signpost.defaultLog() |
-Djgdt.aftermath.path |
JGDT_AFTERMATH_PATH, AFTERMATH_PATH, NVSDK_AFTERMATH_DIR |
OS discovery | Explicit path to GFSDK_Aftermath_Lib binary or SDK directory |
-Djgdt.aftermath.apiVersion |
— | Auto-negotiated | Override GFSDK_Aftermath_Version enum value (e.g. 0x219) |
-Djgdt.profiler.backends |
— | auto |
Comma-separated backend filter: auto, none, or e.g. tracy,nvtx,jfr |
| Property | Default | Description |
|---|---|---|
-Pjgdt.allTargets=true |
false |
Cross-compile every target platform configured for each module |
-Pjgdt.targets=<csv> |
Host target | Compile a subset of targets (e.g. windows-x86_64,linux-x86_64) |
-Pjgdt.zigExecutable=<path> |
Auto-managed | Use a local Zig executable instead of auto-downloading Zig 0.17.1 |
-Pjgdt.testJavaVersion=<ver> |
Gradle JDK | Run tests on a specific JDK toolchain (e.g. 8 to verify the JNI path) |
-Pjgdt.sampleJavaHome=<path> |
Current JVM | Java 8 runtime path for :samples:lwjgl2-opengl:run |
Note
Building requires a JDK 25 toolchain (for compiling META-INF/versions/25 Panama FFM classes while targeting --release 8 for main artifacts). Gradle automatically downloads, SHA-256 verifies, and caches Zig 0.17.1 for native cross-compilation.
# Build host platform natives and run all checks & tests
./gradlew build
# Cross-compile all targets across all modules
./gradlew build -Pjgdt.allTargets=true
# Verify the Java 8 JNI path (without Panama FFM)
./gradlew test -Pjgdt.testJavaVersion=8
# Publish all multi-target artifacts to the local Maven repository
./gradlew publishToMavenLocal -Pjgdt.allTargets=trueSee the Samples Guide for full CLI flags, keyboard controls, and profiler attachment details:
samples/lwjgl2-opengl: Java 8 + LWJGL2.9.3with explicit OpenGL 3.2 Core Profile (new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true)), required by RenderDoc on LWJGL 2:./gradlew :samples:lwjgl2-opengl:run -Pjgdt.sampleJavaHome=/path/to/jdk8
samples/lwjgl3-vulkan: LWJGL3.3.6demonstratingRenderDoc.enableVulkanImplicitLayer()andAftermath.load()beforevkCreateInstance,RenderDoc.devicePointerFromVkInstance(...), multithreadedTracyzones/plots/memory pools,Nvtxcolored ranges, andJfrevents:./gradlew :samples:lwjgl3-vulkan:run --args="--headless-verify"
- Contributing Guide — toolchain setup,
BindingSpecsworkflow, Spotless formatting, and release tagging - Agent Guidelines — repository invariants and conventions for AI coding agents
- Security Policy — supported versions,
NativeLoadertrust boundaries, and private vulnerability reporting - Changelog — per-module release history
Licensed under the Apache License, Version 2.0. See NOTICE for upstream third-party SDK headers and licenses.