Skip to content

Releases: club-doki7/vulkan4j

v0.4.4

11 Jul 19:47
4260e16

Choose a tag to compare

Upgrade ffm-plus to v0.2.7, and other wrapper modules to v0.4.4.

New bindings

  • (@CousinZe) Added stb_vorbis support in stb module, which provides bindings for stb_vorbis.h.

Functionality updates

  • (@CousinZe) Added STBUtil.freeMemory method to free memory allocated by stb libraries.
  • (@CousinZe) Added LibcArena.freeNonAllocated method to free memory allocated by libc allocator but not via LibcArena.allocate method. This is an alternative to library specific Util.freeMemory methods with some risk.

Quality of Life updates

  • Supported auto-initialization of nested structures (#147). Now structures like VkComputePipelineCreateInfo will 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 union types incorrectly have struct in their layout documentation.

v0.4.3

02 Jul 13:36
9ff11b2

Choose a tag to compare

Upgrade wrapper modules to v0.4.3.

Quality of Life updates

  • (@HoshinoTented + @chuigda) Implemented function pointer auto-wrapping mechanism, also setter shorthand 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 upcall MethodHandles.

    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 long types were incorrectly generated. Since only X11 relevant APIs have been using long type as input and return types, this issue have little impact on most users.

v0.4.2

28 Jun 16:48
5c7ce75

Choose a tag to compare

Upgrade ffm-plus to v0.2.6, and other wrapper modules to v0.4.2.

Breaking changes

  • Added full support for wchar_t: now wchar_t* types are represented with WCharPtr instead of raw MemorySegments. This will break some existing code but our new WCharPtr should be easy enough to use.

New bindings

  • Added webgpu module, 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 for IntPtr, LongPtr, DoublePtr, WCharPtr and CLongPtr to reduce boxing-unboxing overhead.
  • Deprecated WindowsUtil.getLastError method. Please use the Java's officially recommended Linker.Option.captureCallState instead.

Bugfixes

  • Fixed a bug in CLongPtr::read(index) and CLongPtr::write(index, value) methods, which did not correctly calculate the byte offset for input index.
  • Returned pointers and handles are now correctly marked as @Nullable by default, providing much better null-safety.
  • Fixed issue #126 by using Linker.Option.captureCallState to retrieve GetLastError code.
  • In the static initializer of UnixLibraryLoader, UnixUtil.forceLoad is now called automatically to ensure that result of dlerror won't be overwritten by the loading of dlerror function itself.
  • LibcArena now will fall back to malloc + manual alignment calculation if aligned_alloc is not available. This allows LibcArena to work on Windows platform.

v0.4.1

25 Jun 16:03
6870e6b

Choose a tag to compare

Upgrade ffm-plus to v0.2.5, and other wrapper modules to v0.4.1.

New bindings

  • Added openxr module, 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

  • allocate functions now have a allocate(Arena, Collection<T>) overloading.
  • StructureType.Ptr.at and StructureType.arrayField methods now also have an overloading accepting a Consumer<T>, thus also supporting LWJGL-alike set style methods. For example:
    struct StructureType { int field1; int field2; } structures[2];
    structures[0].field1 = value00;
    structures[0].field2 = value01;
    structures[1].field1 = value10;
    structures[1].field2 = value11;
    can now be written as:
    StructureType.Ptr structures = StructureType.allocate(arena, 2)
        .at(0, it -> it.field1(value00).field2(value01))
        .at(1, it -> it.field2(value10).field2(value11));
    while
    struct StructureType { int arrayField[2] } structure;
    structure.arrayField[0] = value0;
    structure.arrayField[1] = value1;
    can now be written as:
    StructureType structure = StructureType.allocate(arena)
        .arrayField(it -> {
            it.write(0, value0);
            it.write(1, value1);
        });
  • Added a handy writeString method for BytePtr.
  • Added a handy allocateStrings method for PointerPtr for conveniently allocating char const** arrays. Such arrays are widely used in Vulkan and OpenXR APIs.
  • For array fields of structures, accessor structure.field(PtrType ptr) only copies ptr.segment().byteSize() bytes from ptr to 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.checked which was not previously marked as static.

Minor changes

  • LibcArena and a few singleton library loaders are now implemented in terms of enum instead of class, in order to support well-behaved serialization.

v0.4.0

21 Jun 18:57
27e83e5

Choose a tag to compare

Upgrade ffm-plus to v0.2.4, and other wrapper modules to v0.4.0.

Breaking changes

  • Add new annotation @Bitmask and use it to mark bitmask types. Original @EnumType annotation 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 @NotNull by default. APIs previously accepts null MemorySegment will now throw NullPointerException if you pass null. Always use MemorySegment.NULL.
  • Deprecated Loader class and its methods. If you need to load basic functions (like libc functions) from "global" scope, use JavaSystemLibrary.INSTANCE.load instead; if you need to load functions from a specific library, use ILibraryLoader and ISharedLibrary interface instead.
  • Updated VulkanLoader, GLFWLoader, VMAJavaTraceUtil and STBJavaTraceUtil APIs to use ILibraryLoader and ISharedLibrary accordingly.

New bindings

  • Added stb module, which provides bindings for stb libraries. 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 ILibraryLoader and ISharedLibrary interface to reduce global System.load/System.loadLibrary calls. This allows you to load libraries in a more controlled manner.
    • This feature uses LoadLibraryW + GetProcAddress on Windows platform, dlopen + dlsym on Linux/FreeBSD/macOS platform.
    • macOS library bundle (.framework) is not supported yet.

Quality of Life update

  • PVOID type field setters accepting MemorySegments now also returns this to allow chaining.
  • Added ALLoader class to automatically deal with platform library name difference (OpenAL32.dll on Windows vs libopenal.so on Linux).

Known issues

  • LibcArena does not work on Windows platform due to the lack of aligned_alloc support. ShadercUtil using LibcArena is also affected.

v0.3.4 Functionality update & bugfixing release

16 Jun 16:36
a28bfbc

Choose a tag to compare

Upgrade ffm-plus to v0.2.2, and other wrapper modules to v0.3.4.

New bindings

  • Added shaderc module, which provides bindings for libshaderc.

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

06 Jun 15:06
0860648

Choose a tag to compare

  • Fixed a issue (#93) causing incorrect generation of HandleType.Ptr.Iter.next series methods.

v0.3.2 Quality-of-Life update

05 Jun 06:04
5b620dd

Choose a tag to compare

Upgrade ffm-plus to v0.2.1, and other wrapper modules to v0.3.2

Breaking changes

  • Made all the Iter types private to reduce disruptions in JavaDoc pages. Most code should not be affected. Existing code that really uses T.Iter type can migrate to Iterator<T> interface.

New bindings

  • Added opengl module, which provides bindings for OpenGL 1.0 - 4.6 (both Core and Compatibility profiles).
  • Added openal module, which provides bindings based on OpenAL-soft (1.2).

Quality of Life updates

  • Added allocateV and writeV series functions for Ptr types (both ffm-plus and other generated code), utilizing Java varargs to simplify specific write operations.
  • Supported chaining set methods for structure types.
  • Supported LWJGL-alike set style methods for structure member of structure types. For example:
    struct { struct { int a; int b; } inner; } outer;
    outer.inner.a = 1;
    outer.inner.b = 2;
    can now be written as:
    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

31 May 07:31
d83ea5c

Choose a tag to compare

v0.3.1 is a bug-fixing version, no API changes are made.

  • Fixed a issue (#63) causing incorrect generation of StructureType.Ptr.reinterpret series methods. Structure.Ptr.reinterpret series methods are less used in practice so we did not figure out this issue before publishing 0.3.0.
  • Fixed a documentation issue in vma module.

v0.3.0

29 May 03:39
35c4b33

Choose a tag to compare

We are proudly announcing the v0.3.0 version of vulkan4j release!