Releases: club-doki7/vulkan4j
v0.4.4
Upgrade ffm-plus to v0.2.7, and other wrapper modules to v0.4.4.
New bindings
- (@CousinZe) Added
stb_vorbissupport instbmodule, which provides bindings forstb_vorbis.h.
Functionality updates
- (@CousinZe) Added
STBUtil.freeMemorymethod to free memory allocated bystblibraries. - (@CousinZe) Added
LibcArena.freeNonAllocatedmethod to free memory allocated by libc allocator but not viaLibcArena.allocatemethod. This is an alternative to library specificUtil.freeMemorymethods with some risk.
Quality of Life updates
-
Supported auto-initialization of nested structures (#147). Now structures like
VkComputePipelineCreateInfowill have their nested structures automatically initialized:VkComputePipelineCreateInfo createInfo = VkComputePipelineCreateInfo.allocate(arena) .stage(it -> it // .sType(VkStructureType.PIPELINE_SHADER_STAGE_CREATE_INFO) // <-- no more needed .stage(VkShaderStageFlags.COMPUTE) .module(computeShader.handle) .pName(entryName) .pSpecializationInfo(specInfo)) .layout(layout.handle);
Bugfixes
- Fixed a JavaDoc generation issue #158, where
uniontypes incorrectly havestructin their layout documentation.
v0.4.3
Upgrade wrapper modules to v0.4.3.
Quality of Life updates
-
(@HoshinoTented + @chuigda) Implemented function pointer auto-wrapping mechanism, also
settershorthand methods for function pointer fields, and auto-wrapping for function-pointer type command parameters. This allows you to directly pass Java functions and lambdas to C function pointer fields and parameters, without needing to manually create an upcallMethodHandles.Before:
private static final void callback(...) { ... } MethodHandle mh = MethodHandles.lookup().findStatic(...); MemorySegment segment = Linker.nativeLinker().upcallStub(...); library.commandThatUsesFunctionPointer(segment);
After:
private static final void callback(...) { ... } library.commandThatUsesFunctionPointer(callback); // or just: library.commandThatUsesFunctionPointer((...) -> { ... });
Bugfixes
- (@HoshinoTented + @chuigda) Fixed issue #131, where functions accepting and returning C
longtypes were incorrectly generated. Since only X11 relevant APIs have been usinglongtype as input and return types, this issue have little impact on most users.
v0.4.2
Upgrade ffm-plus to v0.2.6, and other wrapper modules to v0.4.2.
Breaking changes
- Added full support for
wchar_t: nowwchar_t*types are represented withWCharPtrinstead of rawMemorySegments. This will break some existing code but our newWCharPtrshould be easy enough to use.
New bindings
- Added
webgpumodule, which provides bindings for wgpu-rs 25.0.2.1. This module is generated from the official WebGPU YML IDL files. We are able to do dog feeding via an offscreen rendering example. This module is marked as experimental due to the unstable status of WebGPU Native APIs. Please read the module level documentation for more details.
Functionality updates
PrimitiveIterators are used forIntPtr,LongPtr,DoublePtr,WCharPtrandCLongPtrto reduce boxing-unboxing overhead.- Deprecated
WindowsUtil.getLastErrormethod. Please use the Java's officially recommendedLinker.Option.captureCallStateinstead.
Bugfixes
- Fixed a bug in
CLongPtr::read(index)andCLongPtr::write(index, value)methods, which did not correctly calculate the byte offset for input index. - Returned pointers and handles are now correctly marked as
@Nullableby default, providing much better null-safety. - Fixed issue #126 by using
Linker.Option.captureCallStateto retrieveGetLastErrorcode. - In the static initializer of
UnixLibraryLoader,UnixUtil.forceLoadis now called automatically to ensure that result ofdlerrorwon't be overwritten by the loading ofdlerrorfunction itself. LibcArenanow will fall back tomalloc+ manual alignment calculation ifaligned_allocis not available. This allowsLibcArenato work on Windows platform.
v0.4.1
Upgrade ffm-plus to v0.2.5, and other wrapper modules to v0.4.1.
New bindings
- Added
openxrmodule, which provides bindings for OpenXR 1.0 - 1.1. This module is generated from the official OpenXR XML registry files. However, our team haven't tested it out thoroughly by writing a complete dog feeding OpenXR application due to lacking VR development experience. This module may contain bugs. Issus and PRs are welcome!
Quality of Life updates
allocatefunctions now have aallocate(Arena, Collection<T>)overloading.StructureType.Ptr.atandStructureType.arrayFieldmethods now also have an overloading accepting aConsumer<T>, thus also supporting LWJGL-alikesetstyle methods. For example:can now be written as:struct StructureType { int field1; int field2; } structures[2]; structures[0].field1 = value00; structures[0].field2 = value01; structures[1].field1 = value10; structures[1].field2 = value11;
whileStructureType.Ptr structures = StructureType.allocate(arena, 2) .at(0, it -> it.field1(value00).field2(value01)) .at(1, it -> it.field2(value10).field2(value11));
can now be written as:struct StructureType { int arrayField[2] } structure; structure.arrayField[0] = value0; structure.arrayField[1] = value1;
StructureType structure = StructureType.allocate(arena) .arrayField(it -> { it.write(0, value0); it.write(1, value1); });
- Added a handy
writeStringmethod forBytePtr. - Added a handy
allocateStringsmethod forPointerPtrfor conveniently allocatingchar const**arrays. Such arrays are widely used in Vulkan and OpenXR APIs. - For array fields of structures, accessor
structure.field(PtrType ptr)only copiesptr.segment().byteSize()bytes fromptrto the field, instead of attempting to copy the whole array. This makes it easier to work with C-style null-terminated strings, which would cause an overflow in previous versions.
Bugfixes
- Fixed
BytePtr.checkedwhich was not previously marked asstatic.
Minor changes
LibcArenaand a few singleton library loaders are now implemented in terms ofenuminstead ofclass, in order to support well-behaved serialization.
v0.4.0
Upgrade ffm-plus to v0.2.4, and other wrapper modules to v0.4.0.
Breaking changes
- Add new annotation
@Bitmaskand use it to mark bitmask types. Original@EnumTypeannotation should only be applied to non-composable enums. This won't break build, but you'll see IDE warnings if you are using our ffm-plus-inspection plugin. - All
MemorySegments are now@NotNullby default. APIs previously acceptsnullMemorySegmentwill now throwNullPointerExceptionif you passnull. Always useMemorySegment.NULL. - Deprecated
Loaderclass and its methods. If you need to load basic functions (likelibcfunctions) from "global" scope, useJavaSystemLibrary.INSTANCE.loadinstead; if you need to load functions from a specific library, useILibraryLoaderandISharedLibraryinterface instead. - Updated
VulkanLoader,GLFWLoader,VMAJavaTraceUtilandSTBJavaTraceUtilAPIs to useILibraryLoaderandISharedLibraryaccordingly.
New bindings
- Added
stbmodule, which provides bindings forstblibraries. Currently the following components are supported:stb.image(stb_image.h): Image loading library.stb.imagewrite(stb_image_write.h): Image writing library.stb.imageresize(stb_image_resize2.h): Image resizing library.stb.truetype(stb_truetype.h): TrueType font rendering library.
Functionality updates
- Added
ILibraryLoaderandISharedLibraryinterface to reduce globalSystem.load/System.loadLibrarycalls. This allows you to load libraries in a more controlled manner.- This feature uses
LoadLibraryW+GetProcAddresson Windows platform,dlopen+dlsymon Linux/FreeBSD/macOS platform. - macOS library bundle (
.framework) is not supported yet.
- This feature uses
Quality of Life update
- PVOID type field setters accepting
MemorySegments now also returnsthisto allow chaining. - Added
ALLoaderclass to automatically deal with platform library name difference (OpenAL32.dllon Windows vslibopenal.soon Linux).
Known issues
LibcArenadoes not work on Windows platform due to the lack ofaligned_allocsupport.ShadercUtilusingLibcArenais also affected.
v0.3.4 Functionality update & bugfixing release
Upgrade ffm-plus to v0.2.2, and other wrapper modules to v0.3.4.
New bindings
- Added
shadercmodule, which provides bindings forlibshaderc.
Bugfixes
- Fixed a issue causing memory allocation failure of
LibcArena. - Fixed a issue causing incorrect generation of return value retrieval for commands that returns
size_t.
v0.3.3 Bugfixing release
- Fixed a issue (#93) causing incorrect generation of
HandleType.Ptr.Iter.nextseries methods.
v0.3.2 Quality-of-Life update
Upgrade ffm-plus to v0.2.1, and other wrapper modules to v0.3.2
Breaking changes
- Made all the
Itertypes private to reduce disruptions in JavaDoc pages. Most code should not be affected. Existing code that really usesT.Itertype can migrate toIterator<T>interface.
New bindings
- Added
openglmodule, which provides bindings for OpenGL 1.0 - 4.6 (both Core and Compatibility profiles). - Added
openalmodule, which provides bindings based on OpenAL-soft (1.2).
Quality of Life updates
- Added
allocateVandwriteVseries functions forPtrtypes (bothffm-plusand other generated code), utilizing Java varargs to simplify specific write operations. - Supported chaining
setmethods for structure types. - Supported LWJGL-alike
setstyle methods for structure member of structure types. For example:can now be written as:struct { struct { int a; int b; } inner; } outer; outer.inner.a = 1; outer.inner.b = 2;
outer.inner(it -> it.a(1).b(2));
- For OpenGL, OpenAL and GLFW, we now allow accessing global constants via command wrapper classes (
GLConstants.COLOR_BUFFER_BIT->GL.COLOR_BUFFER_BIT, etc.) to avoid repetitive strain injury.
Bugfixes
- Fixed issue (#12), where some instance level commands are wrongly categorized as device commands.
v0.3.1
v0.3.1 is a bug-fixing version, no API changes are made.
- Fixed a issue (#63) causing incorrect generation of
StructureType.Ptr.reinterpretseries methods.Structure.Ptr.reinterpretseries methods are less used in practice so we did not figure out this issue before publishing 0.3.0. - Fixed a documentation issue in
vmamodule.