PrismRHI is a Java 17 rendering interface for caller-owned Vulkan and OpenGL state. Applications construct a backend provider explicitly and keep ownership of the native instance, device, queues, surface, window, and current OpenGL context.
Published modules:
prism-rhi-coreprism-rhi-backend-opengl-commonprism-rhi-backend-opengl41prism-rhi-backend-opengl46prism-rhi-backend-vulkanprism-rhi-shaderc
VulkanExternalContext external = VulkanExternalContext.builder(vkInstance, vkPhysicalDevice, vkDevice)
.graphicsQueue(graphicsQueue, graphicsFamily, 0)
.computeQueue(computeQueue, computeFamily, 0)
.transferQueue(transferQueue, transferFamily, 0)
.enabledFeatures(Set.of(VulkanFeature.DYNAMIC_RENDERING))
.contextIdentity(identity)
.invalidation(invalidation)
.synchronization(lock::requireHeld)
.build();
var provider = new VulkanBackendProvider(external);
var instance = PrismRHI.createInstance(provider,
PRhiInstanceCreateInfo.builder().applicationName("Example").build());OpenGL callers pass the already-current capabilities, owner thread, identity, invalidation token, and a current-context predicate to OpenGlExternalContext, then construct Gl41BackendProvider or Gl46BackendProvider.
Shaders are explicit. OpenGL consumes OPENGL_SOURCE; Vulkan consumes SPIRV. The optional compiler is an ordinary object:
PRhiShaderDesc desc = new PRhiShaderDesc(PRhiShaderStage.VERTEX, "main", "vertex");
PRhiShaderBinary spirv = new ShadercCompiler().compile(desc, glslBytes, null);
PRhiShader shader = device.createShader(desc, PRhiShaderBinaryFormat.SPIRV, spirv.bytes());Compute pipelines and storage buffers are supported by Vulkan and OpenGL 4.6. See the Compute Shader and SSBO guide for pipeline creation, descriptor binding, dispatch, and synchronization. OpenGL 4.1 remains graphics-only.
Native access is typed:
long value = buffer.getNativeObject(VulkanNativeObjectTypes.BUFFER)
.orElseThrow()
.value();See the documentation index, Chinese documentation, quick start, and triangle demo. Local Maven consumption is supported during this migration; no public registry release is documented.
Use publishToMavenLocal for the default Maven Local repository. To publish the
same publications to a checked-out file-based Maven repository, pass
-PpublishRepository=D:\Dev\ChenMeng\maven-repository to publish.
PrismRHI is open source under the
GNU Lesser General Public License v3.0 only (LGPL-3.0-only).
The incorporated GNU GPL v3 terms are included in COPYING.