From 1efe6fae29149628f2eead4172d1334d5c2e855a Mon Sep 17 00:00:00 2001 From: squid233 <60126026+squid233@users.noreply.github.com> Date: Thu, 29 Aug 2024 18:54:36 +0800 Subject: [PATCH] Bump to JDK 23 Update Marshal --- .github/workflows/gradle.yml | 2 +- .github/workflows/javadoc.yml | 2 +- README.md | 7 +-- gradle.properties | 6 +- modules/overrungl.core/build.gradle.kts | 2 - .../src/main/java/overrungl/glfw/GLFW.java | 37 +++++------ .../main/java/overrungl/glfw/GLFWNative.java | 10 +-- .../main/java/overrungl/glfw/GLFWVulkan.java | 4 +- .../src/main/java/overrungl/glfw/Handles.java | 8 +++ .../src/main/java/overrungl/nfd/NFD.java | 36 ++++++----- .../main/java/overrungl/nfd/NFDInternal.java | 14 +++++ .../src/main/java/overrungl/opengl/GL10C.java | 3 - .../src/main/java/overrungl/opengl/GL30C.java | 2 - .../main/java/overrungl/opengl/GLLoader.java | 6 ++ .../src/main/java/overrungl/stb/Handles.java | 18 ++++++ .../src/main/java/overrungl/stb/STBImage.java | 63 ++++++++++--------- .../java/overrungl/stb/STBImageWrite.java | 44 ++++++------- .../main/java/overrungl/stb/STBTrueType.java | 12 ++-- 18 files changed, 158 insertions(+), 118 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 48782553..8c426cce 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,7 +19,7 @@ jobs: strategy: matrix: java: [ - 22 + 23-ea ] os: [ ubuntu-latest, windows-latest, macos-latest ] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index 6c500a84..1ea6d31c 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-java@v4 with: java-version: | - 22 + 23-ea distribution: 'temurin' - name: Grant execute permission for gradlew if: ${{ runner.os != 'Windows' }} diff --git a/README.md b/README.md index 3a868f05..dc0d0730 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![License](https://img.shields.io/github/license/Over-Run/overrungl) -![Maven Central](https://img.shields.io/maven-central/v/io.github.over-run/overrungl) +[//]: # (![Maven Central](https://img.shields.io/maven-central/v/io.github.over-run/overrungl)) ![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/io.github.over-run/overrungl?server=https%3A%2F%2Fs01.oss.sonatype.org) [![Java CI with Gradle](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/Over-Run/overrungl/actions/workflows/gradle.yml) @@ -10,7 +10,7 @@ ## Introduction -Overrun Game Library is a high-performance library implemented with Java 22, +Overrun Game Library is a high-performance library implemented with Java 23, which enables cross-platform access to a set of C/C++ library bindings, and provides some useful utilities. ### OverrunGL vs. LWJGL @@ -29,8 +29,7 @@ the [samples](modules/samples/src/main/java/overrungl/demo). We provided a modules customizer [here](https://over-run.github.io/overrungl-gen/). -Currently, we are developing with the first version, -and it uses preview features, which prevent users from using newer JDKs, +Currently, OverrunGL uses preview features, which prevent users from using newer JDKs, so you have to use `-SNAPSHOT` version. You can import with `io.github.over-run:overrungl-bom:{the version}` and other submodules. diff --git a/gradle.properties b/gradle.properties index f4c19593..4b8e73b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ projName=overrungl projVersion=0.1.0-SNAPSHOT projLicenseYear=2022-2024 -jdkVersion=22 +jdkVersion=23 jdkEnablePreview=true -#jdkEarlyAccessDoc=jdk22 +jdkEarlyAccessDoc=jdk23 kotlinTargetJdkVersion=21 -overrunMarshalVersion=0.1.0-alpha.28-jdk22 +overrunMarshalVersion=0.1.0-alpha.30-jdk23 overrunPlatformVersion=1.0.0 jomlVersion=1.10.8 junitVersion=5.11.0 diff --git a/modules/overrungl.core/build.gradle.kts b/modules/overrungl.core/build.gradle.kts index c9ee25d3..5444dfe4 100644 --- a/modules/overrungl.core/build.gradle.kts +++ b/modules/overrungl.core/build.gradle.kts @@ -19,8 +19,6 @@ val targetJavaVersion = jdkVersion.toInt() dependencies { api("io.github.over-run:marshal:$overrunMarshalVersion") api("io.github.over-run:platform:$overrunPlatformVersion") - //TODO - api("io.github.over-run:memstack:0.2.0") } tasks.register("assembleJavadocArgs") { diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java index 4986f9bd..90c4e2ce 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java @@ -22,6 +22,7 @@ import overrun.marshal.Downcall; import overrun.marshal.Unmarshal; import overrun.marshal.gen.*; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import overrungl.internal.RuntimeHelper; import overrungl.util.value.Pair; import overrungl.util.value.Quad; @@ -1234,7 +1235,7 @@ static String getPlatformString(int platformCode) { * @see #initAllocator * @see #terminate */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwInit") boolean init(); @@ -1404,7 +1405,6 @@ default Triplet.OfInt getVersion() { * @see #ngetVersionString() ngetVersionString */ @Entrypoint("glfwGetVersionString") - @SizedSeg(Unmarshal.STR_SIZE) @StrCharset("US-ASCII") String getVersionString(); @@ -1527,7 +1527,7 @@ default MemorySegment setErrorCallback(@Nullable GLFWErrorFun callback) { * @glfw.thread_safety This function may be called from any thread. * @see #getPlatform */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwPlatformSupported") boolean platformSupported(int platform); @@ -1834,7 +1834,6 @@ default Pair.OfFloat getMonitorContentScale(MemorySegment monitor) { */ @Entrypoint("glfwGetMonitorName") @Nullable - @SizedSeg(Unmarshal.STR_SIZE) String getMonitorName(MemorySegment monitor); /** @@ -2147,7 +2146,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) { * @see #windowHint(int, int) */ @Entrypoint("glfwWindowHint") - void windowHint(int hint, @Convert(Type.INT) boolean value); + void windowHint(int hint, @Convert(BoolConvert.INT) boolean value); /** * Sets the specified window hint to the desired value. @@ -2394,7 +2393,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) { * @glfw.thread_safety This function may be called from any thread. Access is not * synchronized. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwWindowShouldClose") boolean windowShouldClose(MemorySegment window); @@ -2412,7 +2411,7 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) { * synchronized. */ @Entrypoint("glfwSetWindowShouldClose") - void setWindowShouldClose(MemorySegment window, @Convert(Type.INT) boolean value); + void setWindowShouldClose(MemorySegment window, @Convert(BoolConvert.INT) boolean value); /** * Returns the title of the specified window. @@ -2448,7 +2447,6 @@ default GLFWVidMode getVideoMode(MemorySegment monitor) { * @see #ngetWindowTitle(MemorySegment) */ @Entrypoint("glfwGetWindowTitle") - @SizedSeg(Unmarshal.STR_SIZE) String getWindowTitle(MemorySegment window); /** @@ -3296,7 +3294,7 @@ default Pair.OfFloat getWindowContentScale(MemorySegment window) { * @see #getWindowAttrib(MemorySegment, int) getWindowAttrib */ @Entrypoint("glfwSetWindowAttrib") - void setWindowAttrib(MemorySegment window, int attrib, @Convert(Type.INT) boolean value); + void setWindowAttrib(MemorySegment window, int attrib, @Convert(BoolConvert.INT) boolean value); /** * Sets the user pointer of the specified window. @@ -3901,7 +3899,7 @@ default MemorySegment setWindowContentScaleCallback(MemorySegment window, @Nulla * @glfw.thread_safety This function must only be called from the main thread. * @see #setInputMode(MemorySegment, int, int) setInputMode */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwRawMouseMotionSupported") boolean rawMouseMotionSupported(); @@ -4593,7 +4591,7 @@ default MemorySegment setDropCallback(MemorySegment window, @Nullable GLFWDropFu * {@link #INVALID_ENUM} and {@link #PLATFORM_ERROR}. * @glfw.thread_safety This function must only be called from the main thread. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwJoystickPresent") boolean joystickPresent(int jid); @@ -4901,7 +4899,7 @@ default byte[] getJoystickHats(int jid) { * @glfw.thread_safety This function must only be called from the main thread. * @see #ngetGamepadState(int, MemorySegment) getGamepadState */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwJoystickIsGamepad") boolean joystickIsGamepad(int jid); @@ -4972,7 +4970,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) { * @see #joystickIsGamepad(int) joystickIsGamepad * @see #ngetGamepadName(int) getGamepadName */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwUpdateGamepadMappings") boolean nupdateGamepadMappings(MemorySegment string); @@ -4984,7 +4982,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) { * error occurred. * @see #nupdateGamepadMappings(MemorySegment) nupdateGamepadMappings */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwUpdateGamepadMappings") boolean updateGamepadMappings(String string); @@ -5055,7 +5053,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) { * @see #nupdateGamepadMappings(MemorySegment) updateGamepadMappings * @see #joystickIsGamepad(int) joystickIsGamepad */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetGamepadState") boolean ngetGamepadState(int jid, MemorySegment state); @@ -5069,7 +5067,7 @@ default MemorySegment setJoystickCallback(@Nullable GLFWJoystickFun callback) { * occurred. * @see #ngetGamepadState(int, MemorySegment) ngetGamepadState */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetGamepadState") boolean getGamepadState(int jid, GLFWGamepadState state); @@ -5153,7 +5151,6 @@ default void setClipboardString(String string) { * @see #nsetClipboardString(MemorySegment) setClipboardString */ @Entrypoint("glfwGetClipboardString") - @SizedSeg(Unmarshal.STR_SIZE) MemorySegment ngetClipboardString(MemorySegment window); /** @@ -5417,7 +5414,7 @@ default String getClipboardString() { * @glfw.thread_safety This function may be called from any thread. * @see #ngetProcAddress */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwExtensionSupported") boolean nextensionSupported(MemorySegment extension); @@ -5429,7 +5426,7 @@ default String getClipboardString() { * otherwise. * @see #nextensionSupported(MemorySegment) nextensionSupported */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwExtensionSupported") boolean extensionSupported(@StrCharset("US-ASCII") String extension); @@ -5497,7 +5494,7 @@ default String getClipboardString() { * @glfw.errors Possible errors include {@link #NOT_INITIALIZED}. * @glfw.thread_safety This function may be called from any thread. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwVulkanSupported") boolean vulkanSupported(); diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java index ad60af7b..50e79757 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java @@ -22,7 +22,7 @@ import overrun.marshal.gen.Convert; import overrun.marshal.gen.Entrypoint; import overrun.marshal.gen.Ref; -import overrun.marshal.gen.Type; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import java.lang.foreign.MemorySegment; import java.lang.invoke.MethodHandles; @@ -455,7 +455,7 @@ default MemorySegment getEGLSurface(MemorySegment window) { * @glfw.thread_safety This function may be called from any thread. Access is not * synchronized. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetOSMesaColorBuffer") default boolean ngetOSMesaColorBuffer(MemorySegment window, MemorySegment width, MemorySegment height, MemorySegment format, MemorySegment buffer) { return false; @@ -475,7 +475,7 @@ default boolean ngetOSMesaColorBuffer(MemorySegment window, MemorySegment width, * error occurred. * @see #ngetOSMesaColorBuffer(MemorySegment, MemorySegment, MemorySegment, MemorySegment, MemorySegment) ngetOSMesaColorBuffer */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetOSMesaColorBuffer") default boolean getOSMesaColorBuffer(MemorySegment window, @Ref int @Nullable [] width, @Ref int @Nullable [] height, @Ref int @Nullable [] format, MemorySegment buffer) { return false; @@ -497,7 +497,7 @@ default boolean getOSMesaColorBuffer(MemorySegment window, @Ref int @Nullable [] * @glfw.thread_safety This function may be called from any thread. Access is not * synchronized. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetOSMesaDepthBuffer") default boolean ngetOSMesaDepthBuffer(MemorySegment window, MemorySegment width, MemorySegment height, MemorySegment bytesPerValue, MemorySegment buffer) { return false; @@ -517,7 +517,7 @@ default boolean ngetOSMesaDepthBuffer(MemorySegment window, MemorySegment width, * error occurred. * @see #ngetOSMesaDepthBuffer(MemorySegment, MemorySegment, MemorySegment, MemorySegment, MemorySegment) ngetOSMesaDepthBuffer */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetOSMesaDepthBuffer") default boolean getOSMesaDepthBuffer(MemorySegment window, @Ref int @Nullable [] width, @Ref int @Nullable [] height, @Ref int @Nullable [] bytesPerValue, MemorySegment buffer) { return false; diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java index 119e88c4..765fb6c5 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java @@ -21,7 +21,7 @@ import overrun.marshal.gen.Convert; import overrun.marshal.gen.Entrypoint; import overrun.marshal.gen.Ref; -import overrun.marshal.gen.Type; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import overrungl.NativeType; import java.lang.foreign.MemorySegment; @@ -149,7 +149,7 @@ public interface GLFWVulkan extends DirectAccess { * @glfw.thread_safety This function may be called from any thread. For * synchronization details of Vulkan objects, see the Vulkan specification. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("glfwGetPhysicalDevicePresentationSupport") boolean getPhysicalDevicePresentationSupport(MemorySegment instance, MemorySegment device, int queueFamily); diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java index 7b059bea..8479545d 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java @@ -23,6 +23,8 @@ import java.lang.foreign.SymbolLookup; import java.util.function.Supplier; +import static overrun.marshal.gen.processor.ProcessorTypes.registerStruct; + /** * The GLFW method handles. * @@ -33,6 +35,12 @@ final class Handles { static final SymbolLookup lookup; static { + registerStruct(GLFWAllocator.class, GLFWAllocator.OF); + registerStruct(GLFWGamepadState.class, GLFWGamepadState.OF); + registerStruct(GLFWGammaRamp.class, GLFWGammaRamp.OF); + registerStruct(GLFWImage.class, GLFWImage.OF); + registerStruct(GLFWVidMode.class, GLFWVidMode.OF); + final Supplier lib = () -> RuntimeHelper.load("glfw", "glfw", OverrunGL.GLFW_VERSION); final var function = Configurations.GLFW_SYMBOL_LOOKUP.get(); lookup = function != null ? function.apply(lib) : lib.get(); diff --git a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java index 9a5d3a3c..768c752f 100644 --- a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java +++ b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java @@ -16,9 +16,12 @@ package overrungl.nfd; -import overrun.marshal.*; +import io.github.overrun.memstack.MemoryStack; +import overrun.marshal.DirectAccess; +import overrun.marshal.Downcall; +import overrun.marshal.Marshal; +import overrun.marshal.Unmarshal; import overrun.marshal.gen.Entrypoint; -import overrun.marshal.gen.SizedSeg; import overrun.marshal.gen.Skip; import overrungl.NativeType; import overrungl.util.PlatformLayouts; @@ -234,7 +237,7 @@ public interface NFD extends DirectAccess { */ @Skip default int openDialogN(String[] outPath, NFDNFilterItem filterList, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = nopenDialogN(seg, filterList, @@ -273,7 +276,7 @@ default int openDialogN(String[] outPath, NFDNFilterItem filterList, String d */ @Skip default int openDialogU8(String[] outPath, NFDU8FilterItem filterList, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = nopenDialogU8(seg, filterList, @@ -325,7 +328,7 @@ default int openDialogU8(String[] outPath, NFDU8FilterItem filterList, String */ @Skip default int openDialogMultipleN(@NativeType("const nfdpathset_t**") MemorySegment outPaths, NFDNFilterItem filterList, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { return nopenDialogMultipleN(outPaths, filterList, filterList != null ? Math.toIntExact(filterList.elementCount()) : 0, @@ -358,7 +361,7 @@ default int openDialogMultipleN(@NativeType("const nfdpathset_t**") MemorySegmen */ @Skip default int openDialogMultipleU8(@NativeType("const nfdpathset_t**") MemorySegment outPaths, NFDU8FilterItem filterList, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { return nopenDialogMultipleU8(outPaths, filterList, filterList != null ? Math.toIntExact(filterList.elementCount()) : 0, @@ -404,7 +407,7 @@ default int openDialogMultipleU8(@NativeType("const nfdpathset_t**") MemorySegme */ @Skip default int saveDialogN(String[] outPath, NFDNFilterItem filterList, String defaultPath, String defaultName) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = nsaveDialogN(seg, filterList, @@ -446,7 +449,7 @@ default int saveDialogN(String[] outPath, NFDNFilterItem filterList, String d */ @Skip default int saveDialogU8(String[] outPath, NFDU8FilterItem filterList, String defaultPath, String defaultName) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = nsaveDialogU8(seg, filterList, @@ -495,7 +498,7 @@ default int saveDialogU8(String[] outPath, NFDU8FilterItem filterList, String */ @Skip default int pickFolderN(String[] outPath, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npickFolderN(seg, Marshal.marshal(stack, defaultPath, NFDInternal.nfdCharset)); if (result == OKAY) { @@ -528,7 +531,7 @@ default int pickFolderN(String[] outPath, String defaultPath) { */ @Skip default int pickFolderU8(String[] outPath, String defaultPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npickFolderU8(seg, Marshal.marshal(stack, defaultPath, NFDInternal.nfdCharset)); if (result == OKAY) { @@ -595,7 +598,6 @@ default int pickFolderU8(String[] outPath, String defaultPath) { * @see #ngetError() ngetError */ @Entrypoint("NFD_GetError") - @SizedSeg(Unmarshal.STR_SIZE) String getError(); /** @@ -627,7 +629,7 @@ default int pickFolderU8(String[] outPath, String defaultPath) { */ @Skip default int pathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegment pathSet, long[] count) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = stack.allocate(PATH_SET_SIZE); final int result = npathSetGetCount(pathSet, seg); count[0] = switch (PATH_SET_SIZE) { @@ -648,7 +650,7 @@ default int pathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegment pat */ @Skip default Tuple2.OfIntLong pathSetGetCount(@NativeType("const nfdpathset_t*") MemorySegment pathSet) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = stack.allocate(PATH_SET_SIZE); final int result = npathSetGetCount(pathSet, seg); return new Tuple2.OfIntLong(result, switch (PATH_SET_SIZE) { @@ -692,7 +694,7 @@ default int npathSetGetPathN(@NativeType("const nfdpathset_t*") MemorySegment pa */ @Skip default int pathSetGetPathN(@NativeType("const nfdpathset_t*") MemorySegment pathSet, long index, String[] outPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npathSetGetPathN(pathSet, index, seg); if (result == OKAY) { @@ -737,7 +739,7 @@ default int npathSetGetPathU8(@NativeType("const nfdpathset_t*") MemorySegment p */ @Skip default int pathSetGetPathU8(@NativeType("const nfdpathset_t*") MemorySegment pathSet, long index, String[] outPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npathSetGetPathU8(pathSet, index, seg); if (result == OKAY) { @@ -810,7 +812,7 @@ default int pathSetGetPathU8(@NativeType("const nfdpathset_t*") MemorySegment pa */ @Skip default int pathSetEnumNextN(@NativeType("nfdpathsetenum_t*") MemorySegment enumerator, String[] outPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npathSetEnumNextN(enumerator, seg); if (result == OKAY) { @@ -849,7 +851,7 @@ default int pathSetEnumNextN(@NativeType("nfdpathsetenum_t*") MemorySegment enum */ @Skip default int pathSetEnumNextU8(@NativeType("nfdpathsetenum_t*") MemorySegment enumerator, String[] outPath) { - try (MemoryStack stack = MemoryStack.stackPush()) { + try (MemoryStack stack = MemoryStack.pushLocal()) { final MemorySegment seg = Marshal.marshal(stack, outPath); final int result = npathSetEnumNextU8(enumerator, seg); if (result == OKAY) { diff --git a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDInternal.java b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDInternal.java index 4cbdf2be..09ec83f9 100644 --- a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDInternal.java +++ b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDInternal.java @@ -26,6 +26,8 @@ import java.nio.charset.StandardCharsets; import java.util.function.Supplier; +import static overrun.marshal.gen.processor.ProcessorTypes.registerStruct; + /** * internal * @@ -36,6 +38,18 @@ final class NFDInternal { static final SymbolLookup LOOKUP; static { + registerStruct(NFDNFilterItem.class, NFDNFilterItem.OF); + registerStruct(NFDNFilterItem.Mutable.class, NFDNFilterItem.Mutable.OF); + registerStruct(NFDOpenDialogNArgs.class, NFDOpenDialogNArgs.OF); + registerStruct(NFDOpenDialogU8Args.class, NFDOpenDialogU8Args.OF); + registerStruct(NFDPickFolderNArgs.class, NFDPickFolderNArgs.OF); + registerStruct(NFDPickFolderU8Args.class, NFDPickFolderU8Args.OF); + registerStruct(NFDSaveDialogNArgs.class, NFDSaveDialogNArgs.OF); + registerStruct(NFDSaveDialogU8Args.class, NFDSaveDialogU8Args.OF); + registerStruct(NFDU8FilterItem.class, NFDU8FilterItem.OF); + registerStruct(NFDU8FilterItem.Mutable.class, NFDU8FilterItem.Mutable.OF); + registerStruct(NFDWindowHandle.class, NFDWindowHandle.OF); + final Supplier lib = () -> RuntimeHelper.load("nfd", "nfd", OverrunGL.NFD_VERSION); final var function = Configurations.NFD_SYMBOL_LOOKUP.get(); LOOKUP = function != null ? function.apply(lib) : lib.get(); diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java index cb15adfe..6f65e5b4 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java @@ -19,10 +19,8 @@ import io.github.overrun.memstack.MemoryStack; import org.jetbrains.annotations.Nullable; import overrun.marshal.DirectAccess; -import overrun.marshal.Unmarshal; import overrun.marshal.gen.Entrypoint; import overrun.marshal.gen.Ref; -import overrun.marshal.gen.SizedSeg; import overrun.marshal.gen.Skip; import java.lang.foreign.MemorySegment; @@ -379,7 +377,6 @@ default MemorySegment ngetString(int name) { @Entrypoint("glGetString") @Nullable - @SizedSeg(Unmarshal.STR_SIZE) default String getString(int name) { throw new ContextException(); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java index e143d1a5..0b0ee5da 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java @@ -23,7 +23,6 @@ import overrun.marshal.Unmarshal; import overrun.marshal.gen.Entrypoint; import overrun.marshal.gen.Ref; -import overrun.marshal.gen.SizedSeg; import overrun.marshal.gen.Skip; import overrungl.opengl.ext.arb.GLARBColorBufferFloat; import overrungl.opengl.ext.arb.GLARBTextureFloat; @@ -625,7 +624,6 @@ default MemorySegment ngetStringi(int pname, int index) { @Entrypoint("glGetStringi") @Nullable - @SizedSeg(Unmarshal.STR_SIZE) default String getStringi(int pname, int index) { throw new ContextException(); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java index 41d16c2a..fc2b39c1 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java @@ -26,6 +26,7 @@ import java.util.Map; import static java.lang.foreign.ValueLayout.*; +import static overrun.marshal.gen.processor.ProcessorTypes.registerStruct; /** * This class must be used before any OpenGL function is called. It has the following responsibilities: @@ -54,6 +55,11 @@ public final class GLLoader { ); private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); + static { + registerStruct(DrawArraysIndirectCommand.class, DrawArraysIndirectCommand.OF); + registerStruct(DrawElementsIndirectCommand.class, DrawElementsIndirectCommand.OF); + } + /** * Loads OpenGL flags. * diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java b/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java index 676949e5..88e5745d 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java @@ -25,6 +25,8 @@ import java.lang.foreign.ValueLayout; import java.util.function.Supplier; +import static overrun.marshal.gen.processor.ProcessorTypes.registerStruct; + /** * The STB method handles. * @@ -38,6 +40,22 @@ final class Handles { stbi_write_force_png_filter; static { + registerStruct(STBIIoCallbacks.class, STBIIoCallbacks.OF); + registerStruct(STBIRRESIZE.class, STBIRRESIZE.OF); + registerStruct(STBRPContext.class, STBRPContext.OF); + registerStruct(STBRPNode.class, STBRPNode.OF); + registerStruct(STBRPRect.class, STBRPRect.OF); + registerStruct(STBTTAlignedQuad.class, STBTTAlignedQuad.OF); + registerStruct(STBTTBakedChar.class, STBTTBakedChar.OF); + registerStruct(STBTTFontInfo.class, STBTTFontInfo.OF); + registerStruct(STBTTKerningEntry.class, STBTTKerningEntry.OF); + registerStruct(STBTTPackedChar.class, STBTTPackedChar.OF); + registerStruct(STBTTPackRange.class, STBTTPackRange.OF); + registerStruct(STBTTVertex.class, STBTTVertex.OF); + registerStruct(STBVorbisAlloc.class, STBVorbisAlloc.OF); + registerStruct(STBVorbisComment.class, STBVorbisComment.OF); + registerStruct(STBVorbisInfo.class, STBVorbisInfo.OF); + final Supplier lib = () -> RuntimeHelper.load("stb", "stb", OverrunGL.STB_VERSION); final var function = Configurations.STB_SYMBOL_LOOKUP.get(); lookup = function != null ? function.apply(lib) : lib.get(); diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java index d06b73e5..f9ff5ee0 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java @@ -22,7 +22,11 @@ import overrun.marshal.Downcall; import overrun.marshal.Marshal; import overrun.marshal.Unmarshal; -import overrun.marshal.gen.*; +import overrun.marshal.gen.Convert; +import overrun.marshal.gen.Entrypoint; +import overrun.marshal.gen.Ref; +import overrun.marshal.gen.Skip; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; @@ -51,17 +55,16 @@ public interface STBImage extends DirectAccess { RGB_ALPHA = 4; @Entrypoint("stbi_convert_iphone_png_to_rgb") - void convertIphonePngToRgb(@Convert(Type.INT) boolean shouldConvert); + void convertIphonePngToRgb(@Convert(BoolConvert.INT) boolean shouldConvert); @Entrypoint("stbi_convert_iphone_png_to_rgb_thread") - void convertIphonePngToRgbThread(@Convert(Type.INT) boolean shouldConvert); + void convertIphonePngToRgbThread(@Convert(BoolConvert.INT) boolean shouldConvert); @Entrypoint("stbi_failure_reason") MemorySegment nfailureReason(); @Entrypoint("stbi_failure_reason") @Nullable - @SizedSeg(Unmarshal.STR_SIZE) String failureReason(); @Entrypoint("stbi_hdr_to_ldr_gamma") @@ -73,31 +76,31 @@ public interface STBImage extends DirectAccess { @Entrypoint("stbi_image_free") void free(MemorySegment retValFromLoad); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info") boolean ninfo(MemorySegment filename, MemorySegment x, MemorySegment y, MemorySegment comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info") boolean info(String filename, @Ref int[] x, @Ref int[] y, @Ref int[] comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_callbacks") boolean ninfoFromCallbacks(MemorySegment clbk, MemorySegment user, MemorySegment x, MemorySegment y, MemorySegment comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_callbacks") boolean infoFromCallbacks(STBIIoCallbacks clbk, MemorySegment user, @Ref int[] x, @Ref int[] y, @Ref int[] comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_file") boolean ninfoFromFile(MemorySegment f, MemorySegment x, MemorySegment y, MemorySegment comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_file") boolean infoFromFile(MemorySegment f, @Ref int[] x, @Ref int[] y, @Ref int[] comp); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_memory") boolean ninfoFromMemory(MemorySegment buffer, int len, MemorySegment x, MemorySegment y, MemorySegment comp); @@ -106,7 +109,7 @@ default boolean infoFromMemory(MemorySegment buffer, MemorySegment x, MemorySegm return ninfoFromMemory(buffer, Math.toIntExact(buffer.byteSize()), x, y, comp); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_info_from_memory") boolean infoFromMemory(SegmentAllocator allocator, int len, byte[] buffer, @Ref int[] x, @Ref int[] y, @Ref int[] comp); @@ -115,27 +118,27 @@ default boolean infoFromMemory(SegmentAllocator allocator, byte[] buffer, @Ref i return infoFromMemory(allocator, buffer.length, buffer, x, y, comp); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit") boolean nis16Bit(MemorySegment filename); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit") boolean nis16Bit(String filename); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit_from_callbacks") boolean nis16BitFromCallbacks(MemorySegment clbk, MemorySegment user); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit_from_callbacks") boolean nis16BitFromCallbacks(STBIIoCallbacks clbk, MemorySegment user); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit_from_file") boolean nis16BitFromFile(MemorySegment f); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit_from_memory") boolean nis16BitFromMemory(MemorySegment buffer, int len); @@ -144,7 +147,7 @@ default boolean is16BitFromMemory(MemorySegment buffer) { return nis16BitFromMemory(buffer, Math.toIntExact(buffer.byteSize())); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_16_bit_from_memory") boolean is16BitFromMemory(SegmentAllocator allocator, byte[] buffer, int len); @@ -153,27 +156,27 @@ default boolean is16BitFromMemory(SegmentAllocator allocator, byte[] buffer) { return is16BitFromMemory(allocator, buffer, buffer.length); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr") boolean isHdr(MemorySegment filename); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr") boolean isHdr(String filename); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr_from_callbacks") boolean nisHdrFromCallbacks(MemorySegment clbk, MemorySegment user); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr_from_callbacks") boolean isHdrFromCallbacks(STBIIoCallbacks clbk, MemorySegment user); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr_from_file") boolean isHdrFromFile(MemorySegment f); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr_from_memory") boolean nisHdrFromMemory(MemorySegment buffer, int len); @@ -182,7 +185,7 @@ default boolean isHdrFromMemory(MemorySegment buffer) { return nisHdrFromMemory(buffer, Math.toIntExact(buffer.byteSize())); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_is_hdr_from_memory") boolean isHdrFromMemory(SegmentAllocator allocator, byte[] buffer, int len); @@ -329,16 +332,16 @@ default MemorySegment loadfFromMemory(SegmentAllocator allocator, byte[] buffer, } @Entrypoint("stbi_set_flip_vertically_on_load") - void setFlipVerticallyOnLoad(@Convert(Type.INT) boolean shouldFlip); + void setFlipVerticallyOnLoad(@Convert(BoolConvert.INT) boolean shouldFlip); @Entrypoint("stbi_set_flip_vertically_on_load_thread") - void setFlipVerticallyOnLoadThread(@Convert(Type.INT) boolean shouldFlip); + void setFlipVerticallyOnLoadThread(@Convert(BoolConvert.INT) boolean shouldFlip); @Entrypoint("stbi_set_unpremultiply_on_load") - void nsetUnpremultiplyOnLoad(@Convert(Type.INT) boolean shouldUnpremultiply); + void nsetUnpremultiplyOnLoad(@Convert(BoolConvert.INT) boolean shouldUnpremultiply); @Entrypoint("stbi_set_unpremultiply_on_load_thread") - void nsetUnpremultiplyOnLoadThread(@Convert(Type.INT) boolean shouldUnpremultiply); + void nsetUnpremultiplyOnLoadThread(@Convert(BoolConvert.INT) boolean shouldUnpremultiply); @Entrypoint("stbi_zlib_decode_buffer") int zlibDecodeBuffer(MemorySegment obuffer, int olen, MemorySegment ibuffer, int ilen); diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java index 251c1263..c63e4071 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java @@ -21,7 +21,7 @@ import overrun.marshal.gen.Convert; import overrun.marshal.gen.Entrypoint; import overrun.marshal.gen.Skip; -import overrun.marshal.gen.Type; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; @@ -71,88 +71,88 @@ default void setWriteForcePngFilter(int filter) { Handles.stbi_write_force_png_filter.set(ValueLayout.JAVA_INT, 0L, filter); } - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_png") boolean npng(MemorySegment filename, int w, int h, int comp, MemorySegment data, int strideInBytes); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_bmp") boolean nbmp(MemorySegment filename, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_tga") boolean ntga(MemorySegment filename, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_hdr") boolean nhdr(MemorySegment filename, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_jpg") boolean njpg(MemorySegment filename, int x, int y, int comp, MemorySegment data, int quality); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_png") boolean png(String filename, int w, int h, int comp, MemorySegment data, int strideInBytes); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_bmp") boolean bmp(String filename, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_tga") boolean tga(String filename, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_hdr") boolean hdr(SegmentAllocator allocator, String filename, int w, int h, int comp, float[] data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_jpg") boolean jpg(String filename, int x, int y, int comp, MemorySegment data, int quality); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_png_to_func") boolean npngToFunc(MemorySegment func, MemorySegment context, int w, int h, int comp, MemorySegment data, int strideInBytes); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_bmp_to_func") boolean nbmpToFunc(MemorySegment func, MemorySegment context, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_tga_to_func") boolean ntgaToFunc(MemorySegment func, MemorySegment context, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_hdr_to_func") boolean nhdrToFunc(MemorySegment func, MemorySegment context, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_jpg_to_func") boolean njpgToFunc(MemorySegment func, MemorySegment context, int x, int y, int comp, MemorySegment data, int quality); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_png_to_func") boolean pngToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int w, int h, int comp, MemorySegment data, int strideInBytes); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_bmp_to_func") boolean bmpToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_tga_to_func") boolean tgaToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int w, int h, int comp, MemorySegment data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_hdr_to_func") boolean hdrToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int w, int h, int comp, float[] data); - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbi_write_jpg_to_func") boolean jpgToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int x, int y, int comp, MemorySegment data, int quality); @Entrypoint("stbi_flip_vertically_on_write") - void flipVerticallyOnWrite(@Convert(Type.INT) boolean flip); + void flipVerticallyOnWrite(@Convert(BoolConvert.INT) boolean flip); @Entrypoint("stbi_write_png_to_mem") MemorySegment npngToMem(MemorySegment pixels, int strideInBytes, int x, int y, int n, MemorySegment outLen); diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBTrueType.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBTrueType.java index c0382b73..831c3903 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBTrueType.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBTrueType.java @@ -20,7 +20,7 @@ import overrun.marshal.Downcall; import overrun.marshal.gen.Convert; import overrun.marshal.gen.Entrypoint; -import overrun.marshal.gen.Type; +import overrun.marshal.gen.processor.ProcessorType.BoolConvert; import overrungl.NativeType; import java.lang.foreign.MemorySegment; @@ -436,7 +436,7 @@ void getBakedQuad(STBTTBakedChar chardata, int pw, int ph, int char_index, @NativeType("float *") MemorySegment xpos, @NativeType("float *") MemorySegment ypos, STBTTAlignedQuad q, - @Convert(Type.INT) boolean opengl_fillrule); + @Convert(BoolConvert.INT) boolean opengl_fillrule); /** * Query the font vertical metrics without having to create a font first. @@ -573,7 +573,7 @@ int packFontRange(@NativeType("stbtt_pack_context *") MemorySegment spc, @Native * @param skip skip */ @Entrypoint("stbtt_PackSetSkipMissingCodepoints") - void packSetSkipMissingCodepoints(@NativeType("stbtt_pack_context *") MemorySegment spc, @Convert(Type.INT) boolean skip); + void packSetSkipMissingCodepoints(@NativeType("stbtt_pack_context *") MemorySegment spc, @Convert(BoolConvert.INT) boolean skip); /** * Calling these functions in sequence is roughly equivalent to calling @@ -706,7 +706,7 @@ void getPackedQuad(STBTTPackedChar chardata, int pw, int ph, * @param offset offset * @return {@code false} on failure. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbtt_InitFont") boolean initFont(STBTTFontInfo info, @NativeType("const unsigned char *") MemorySegment data, int offset); @@ -788,7 +788,7 @@ void getPackedQuad(STBTTPackedChar chardata, int pw, int ph, * @param typoLineGap typoLineGap * @return {@code true} on success (table present), {@code false} on failure. */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbtt_GetFontVMetricsOS2") boolean getFontVMetricsOS2(STBTTFontInfo info, @NativeType("int *") MemorySegment typoAscent, @NativeType("int *") MemorySegment typoDescent, @NativeType("int *") MemorySegment typoLineGap); @@ -913,7 +913,7 @@ void getPackedQuad(STBTTPackedChar chardata, int pw, int ph, * @param info info * @param glyph_index glyph_index */ - @Convert(Type.INT) + @Convert(BoolConvert.INT) @Entrypoint("stbtt_IsGlyphEmpty") boolean isGlyphEmpty(STBTTFontInfo info, int glyph_index);