From a1b34ddc1fa39095714c35ebb24c5c2c38e76475 Mon Sep 17 00:00:00 2001 From: squid233 <60126026+squid233@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:43:58 +0800 Subject: [PATCH] Update usage of SegmentAllocator --- build.gradle.kts | 2 +- .../java/overrungl/FunctionDescriptors.java | 8 +- .../overrungl/internal/RuntimeHelper.java | 18 +- .../src/main/java/overrungl/glfw/GLFW.java | 16 +- .../java/overrungl/glfw/GLFWGammaRamp.java | 4 +- .../main/java/overrungl/glfw/GLFWImage.java | 5 +- .../main/java/overrungl/glfw/GLFWNative.java | 8 +- .../main/java/overrungl/glfw/GLFWVidMode.java | 14 +- .../src/main/java/overrungl/glfw/Handles.java | 4 +- .../overrungl/opengl/OpenGLGenerator.kt | 4 +- .../opengl/DrawArraysIndirectCommand.java | 4 +- .../opengl/DrawElementsIndirectCommand.java | 4 +- .../src/main/java/overrungl/opengl/GL10.java | 238 +++++++++--------- .../src/main/java/overrungl/opengl/GL10C.java | 48 ++-- .../src/main/java/overrungl/opengl/GL11.java | 60 ++--- .../src/main/java/overrungl/opengl/GL11C.java | 12 +- .../src/main/java/overrungl/opengl/GL12C.java | 24 +- .../src/main/java/overrungl/opengl/GL13.java | 42 ++-- .../src/main/java/overrungl/opengl/GL14.java | 52 ++-- .../src/main/java/overrungl/opengl/GL14C.java | 26 +- .../src/main/java/overrungl/opengl/GL15C.java | 46 ++-- .../src/main/java/overrungl/opengl/GL20C.java | 134 +++++----- .../src/main/java/overrungl/opengl/GL21C.java | 14 +- .../src/main/java/overrungl/opengl/GL30C.java | 84 +++---- .../src/main/java/overrungl/opengl/GL31C.java | 35 ++- .../src/main/java/overrungl/opengl/GL32C.java | 52 ++-- .../src/main/java/overrungl/opengl/GL33C.java | 30 +-- .../src/main/java/overrungl/opengl/GL40C.java | 54 ++-- .../src/main/java/overrungl/opengl/GL42C.java | 18 +- .../src/main/java/overrungl/opengl/GL43C.java | 42 ++-- .../src/main/java/overrungl/opengl/GL44C.java | 26 +- .../src/main/java/overrungl/opengl/GL45C.java | 164 ++++++------ .../src/main/java/overrungl/opengl/GL46C.java | 6 +- .../main/java/overrungl/opengl/GLExtCaps.java | 2 +- .../java/overrungl/opengl/GLExtFinder.java | 2 +- .../src/main/java/overrungl/stb/Handles.java | 4 +- .../main/java/overrungl/stb/STBEasyFont.java | 4 +- .../src/main/java/overrungl/stb/STBImage.java | 16 +- .../java/overrungl/stb/STBImageResize.java | 28 +-- 39 files changed, 679 insertions(+), 675 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b7510dcc..aec93e61 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -250,7 +250,7 @@ allprojects { options { if (this is CoreJavadocOptions) { if (jdkEnablePreview.toBoolean()) { - addBooleanOption("-enable-preview") + addBooleanOption("-enable-preview", true) } addStringOption("source", targetJavaVersion.toString()) if (this is StandardJavadocDocletOptions) { diff --git a/modules/overrungl.core/src/main/java/overrungl/FunctionDescriptors.java b/modules/overrungl.core/src/main/java/overrungl/FunctionDescriptors.java index d24cf3b6..64902c46 100644 --- a/modules/overrungl.core/src/main/java/overrungl/FunctionDescriptors.java +++ b/modules/overrungl.core/src/main/java/overrungl/FunctionDescriptors.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -17,6 +17,7 @@ package overrungl; import overrungl.internal.Exceptions; +import overrungl.internal.RuntimeHelper; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.ValueLayout; @@ -42,7 +43,9 @@ * * @author squid233 * @since 0.1.0 + * @deprecated This class is going to be removed (but is not marked as removal). */ +@Deprecated(since = "0.1.0") public enum FunctionDescriptors { // 1 D, F, I, J, P, p, V, @@ -121,8 +124,9 @@ public static ValueLayout ofValue(char c) throws IllegalArgumentException { case 'F' -> JAVA_FLOAT; case 'D' -> JAVA_DOUBLE; case 'P' -> ADDRESS; + case 'p' -> RuntimeHelper.ADDRESS_UNBOUNDED; default -> - throw Exceptions.IAE. "Invalid argument c: expected one of B, S, I, J, C, Z, F, D or P; got '\{ c }'" ; + throw Exceptions.IAE."Invalid argument c: expected one of B, S, I, J, C, Z, F, D or P; got '\{c}'"; }; } diff --git a/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java b/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java index ce6f85db..83b6b8fb 100644 --- a/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java +++ b/modules/overrungl.core/src/main/java/overrungl/internal/RuntimeHelper.java @@ -78,7 +78,7 @@ private static MemorySegment reinterpreting(MemorySegment pointerToPointer, int * @return the string. */ public static String unboundPointerString(MemorySegment segment) { - return reinterpreting(segment, 0, MemoryUtil::strlen).getString(0); + return unboundPointerString(segment, 0); } /** @@ -89,7 +89,7 @@ public static String unboundPointerString(MemorySegment segment) { * @return the string. */ public static String unboundPointerString(MemorySegment segment, int index) { - return reinterpreting(segment, index, MemoryUtil::strlen).getString(0); + return reinterpreting(segment, index, str -> MemoryUtil.strlen(str) + 1).getString(0); } /** @@ -99,7 +99,7 @@ public static String unboundPointerString(MemorySegment segment, int index) { * @return the string */ public static String getString(MemorySegment segment) { - return segment.reinterpret(MemoryUtil.strlen(segment)).getString(0); + return segment.reinterpret(MemoryUtil.strlen(segment) + 1).getString(0); } /** @@ -120,7 +120,7 @@ public static String unknownToken(int token) { * @return the string is formatted in {@code STR."\{description} [0x\{toHexString(token)}]"}. */ public static String unknownToken(String description, int token) { - return STR. "\{ description } [0x\{ Integer.toHexString(token) }]" ; + return STR."\{description} [0x\{Integer.toHexString(token)}]"; } /** @@ -144,7 +144,7 @@ public static SymbolLookup load(String module, String basename, String version) uri = localFile.toURI(); } else { // 2. Load from classpath - var file = new File(tmpdir, STR. "overrungl\{ System.getProperty("user.name") }" ); + var file = new File(tmpdir, STR."overrungl\{System.getProperty("user.name")}"); if (!file.exists()) { // Create directory file.mkdir(); @@ -154,15 +154,15 @@ public static SymbolLookup load(String module, String basename, String version) // Create directory file.mkdir(); } - var libFile = new File(file, STR. "\{ basename }-\{ version }\{ suffix }" ); + var libFile = new File(file, STR."\{basename}-\{version}\{suffix}"); if (!libFile.exists()) { // Extract - final String fromPath = STR. "\{ module }/\{ os.familyName() }/\{ Architecture.current() }/\{ path }" ; + final String fromPath = STR."\{module}/\{os.familyName()}/\{Architecture.current()}/\{path}"; try (var is = STACK_WALKER.getCallerClass().getClassLoader().getResourceAsStream(fromPath)) { - Files.copy(Objects.requireNonNull(is, STR. "File not found: \{ fromPath }" ), + Files.copy(Objects.requireNonNull(is, STR."File not found: \{fromPath}"), Path.of(libFile.getAbsolutePath())); } catch (Exception e) { - throw new IllegalStateException(STR. "File not found: \{ file }; try setting property -Doverrungl.natives to a valid path" , e); + throw new IllegalStateException(STR."File not found: \{file}; try setting property -Doverrungl.natives to a valid path", e); } } uri = libFile.toURI(); 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 58071b71..134a1ca2 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFW.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -1091,7 +1091,7 @@ public static MemorySegment ngetVersionString() { * @see #ngetVersionString() ngetVersionString */ public static String getVersionString() { - return ngetVersionString().getUtf8String(0); + return ngetVersionString().getString(0); } /** @@ -1630,7 +1630,7 @@ public static MemorySegment ngetMonitorName(MemorySegment monitor) { @Nullable public static String getMonitorName(MemorySegment monitor) { var pName = ngetMonitorName(monitor); - return RuntimeHelper.isNullptr(pName) ? null : pName.getUtf8String(0); + return RuntimeHelper.isNullptr(pName) ? null : pName.getString(0); } /** @@ -4136,7 +4136,7 @@ public static MemorySegment ngetKeyName(int key, int scancode) { @Nullable public static String getKeyName(int key, int scancode) { var pName = ngetKeyName(key, scancode); - return RuntimeHelper.isNullptr(pName) ? null : pName.getUtf8String(0); + return RuntimeHelper.isNullptr(pName) ? null : pName.getString(0); } /** @@ -5064,7 +5064,7 @@ public static MemorySegment ngetJoystickName(int jid) { @Nullable public static String getJoystickName(int jid) { var pName = ngetJoystickName(jid); - return RuntimeHelper.isNullptr(pName) ? null : pName.getUtf8String(0); + return RuntimeHelper.isNullptr(pName) ? null : pName.getString(0); } /** @@ -5117,7 +5117,7 @@ public static MemorySegment ngetJoystickGUID(int jid) { @Nullable public static String getJoystickGUID(int jid) { var pGUID = ngetJoystickGUID(jid); - return RuntimeHelper.isNullptr(pGUID) ? null : pGUID.getUtf8String(0); + return RuntimeHelper.isNullptr(pGUID) ? null : pGUID.getString(0); } /** @@ -5334,7 +5334,7 @@ public static MemorySegment ngetGamepadName(int jid) { @Nullable public static String getGamepadName(int jid) { var pName = ngetGamepadName(jid); - return RuntimeHelper.isNullptr(pName) ? null : pName.getUtf8String(0); + return RuntimeHelper.isNullptr(pName) ? null : pName.getString(0); } /** @@ -5464,7 +5464,7 @@ public static MemorySegment ngetClipboardString() { @Nullable public static String getClipboardString(@Deprecated MemorySegment window) { var pString = ngetClipboardString(); - return RuntimeHelper.isNullptr(pString) ? null : pString.getUtf8String(0); + return RuntimeHelper.isNullptr(pString) ? null : pString.getString(0); } /** diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWGammaRamp.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWGammaRamp.java index 08cfa935..b059aaaa 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWGammaRamp.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWGammaRamp.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -42,7 +42,7 @@ * @since 0.1.0 */ public final class GLFWGammaRamp extends Struct { - private static final AddressLayout SHORT_ARRAY = ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(JAVA_SHORT)); + private static final AddressLayout SHORT_ARRAY = ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(Long.MAX_VALUE / JAVA_SHORT.byteSize(), JAVA_SHORT)); /** * The struct layout. */ diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWImage.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWImage.java index e865c0e9..10a19d2b 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWImage.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWImage.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -18,6 +18,7 @@ import overrungl.ArrayPointer; import overrungl.Struct; +import overrungl.internal.RuntimeHelper; import java.lang.foreign.*; import java.lang.foreign.MemoryLayout.PathElement; @@ -47,7 +48,7 @@ public sealed class GLFWImage extends Struct { public static final StructLayout LAYOUT = MemoryLayout.structLayout( JAVA_INT.withName("width"), JAVA_INT.withName("height"), - ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(JAVA_BYTE)).withName("pixels") + ADDRESS.withTargetLayout(RuntimeHelper.ADDRESS_UNBOUNDED).withName("pixels") ); private static final VarHandle pWidth = LAYOUT.varHandle(PathElement.groupElement("width")), 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 787b02bf..a9ff37fd 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2023 Overrun Organization + * Copyright (c) 2023-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -68,7 +68,7 @@ public static MemorySegment ngetWin32Adapter(MemorySegment monitor) { * @see #ngetWin32Adapter(MemorySegment) ngetWin32Adapter */ public static String getWin32Adapter(MemorySegment monitor) { - return ngetWin32Adapter(monitor).getUtf8String(0); + return ngetWin32Adapter(monitor).getString(0); } /** @@ -100,7 +100,7 @@ public static MemorySegment ngetWin32Monitor(MemorySegment monitor) { * @see #ngetWin32Monitor(MemorySegment) ngetWin32Monitor */ public static String getWin32Monitor(MemorySegment monitor) { - return ngetWin32Monitor(monitor).getUtf8String(0); + return ngetWin32Monitor(monitor).getString(0); } /** @@ -343,7 +343,7 @@ public static MemorySegment ngetX11SelectionString() { */ public static String getX11SelectionString() { final MemorySegment seg = ngetX11SelectionString(); - return seg != null ? seg.getUtf8String(0) : null; + return seg != null ? seg.getString(0) : null; } /** diff --git a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVidMode.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVidMode.java index 3c6937e1..8aecb2f7 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVidMode.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVidMode.java @@ -65,7 +65,7 @@ public sealed class GLFWVidMode extends Struct { /** * Create a {@code GLFWvidmode} instance. * - * @param address the address. + * @param address the address. */ public GLFWVidMode(MemorySegment address) { super(address, LAYOUT); @@ -120,42 +120,42 @@ public Value value() { * {@return the width, in screen coordinates, of the video mode} */ public int width() { - return (int) pWidth.get(segment()); + return (int) pWidth.get(segment(), 0L); } /** * {@return the height, in screen coordinates, of the video mode} */ public int height() { - return (int) pHeight.get(segment()); + return (int) pHeight.get(segment(), 0L); } /** * {@return the bit depth of the red channel of the video mode} */ public int redBits() { - return (int) pRedBits.get(segment()); + return (int) pRedBits.get(segment(), 0L); } /** * {@return the bit depth of the green channel of the video mode} */ public int greenBits() { - return (int) pGreenBits.get(segment()); + return (int) pGreenBits.get(segment(), 0L); } /** * {@return the bit depth of the blue channel of the video mode} */ public int blueBits() { - return (int) pBlueBits.get(segment()); + return (int) pBlueBits.get(segment(), 0L); } /** * {@return the refresh rate, in Hz, of the video mode} */ public int refreshRate() { - return (int) pRefreshRate.get(segment()); + return (int) pRefreshRate.get(segment(), 0L); } /** 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 16004308..c3ff845f 100644 --- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java +++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/Handles.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -214,7 +214,7 @@ private static MethodHandle downcall(String name, private static MethodHandle downcallTrivial(String name, FunctionDescriptors function) { - return downcall(name, function, Linker.Option.isTrivial()); + return downcall(name, function, Linker.Option.critical(false)); } private static MethodHandle downcallNative(String name, diff --git a/modules/overrungl.opengl/src/generator/kotlin/overrungl/opengl/OpenGLGenerator.kt b/modules/overrungl.opengl/src/generator/kotlin/overrungl/opengl/OpenGLGenerator.kt index 5c9b98a8..874187e4 100644 --- a/modules/overrungl.opengl/src/generator/kotlin/overrungl/opengl/OpenGLGenerator.kt +++ b/modules/overrungl.opengl/src/generator/kotlin/overrungl/opengl/OpenGLGenerator.kt @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2023 Overrun Organization + * Copyright (c) 2023-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -3224,7 +3224,7 @@ fun glExtCaps() { | var pExtsI = new MemorySegment[1]; | if (!getExtensions(allocator, version, pExts, pNumExtsI, pExtsI, caps)) return false; | - | String exts = pExts.getUtf8String(0); + | String exts = pExts.getString(0); | int numExtsI = pNumExtsI.get(JAVA_INT, 0); | var extsI = pExtsI[0]; | diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawArraysIndirectCommand.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawArraysIndirectCommand.java index 485c1dec..62bf8372 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawArraysIndirectCommand.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawArraysIndirectCommand.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -98,7 +98,7 @@ public static DrawArraysIndirectCommand create(SegmentAllocator allocator) { * @return the instance */ public static Buffer create(SegmentAllocator allocator, long count) { - return new Buffer(allocator.allocateArray(LAYOUT, count), count); + return new Buffer(allocator.allocate(LAYOUT, count), count); } /** diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawElementsIndirectCommand.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawElementsIndirectCommand.java index 9b18ca61..9c49802b 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawElementsIndirectCommand.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/DrawElementsIndirectCommand.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -101,7 +101,7 @@ public static DrawElementsIndirectCommand create(SegmentAllocator allocator) { * @return the instance */ public static Buffer create(SegmentAllocator allocator, long count) { - return new Buffer(allocator.allocateArray(LAYOUT, count), count); + return new Buffer(allocator.allocate(LAYOUT, count), count); } /** diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10.java index c62d601b..4a7aec96 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -378,7 +378,7 @@ public static void clipPlane(int plane, MemorySegment equation) { } public static void clipPlane(SegmentAllocator allocator, int plane, double[] equation) { - clipPlane(plane, allocator.allocateArray(JAVA_DOUBLE, equation)); + clipPlane(plane, allocator.allocateFrom(JAVA_DOUBLE, equation)); } @@ -401,7 +401,7 @@ public static void color3bv(MemorySegment v) { } public static void color3bv(SegmentAllocator allocator, byte[] v) { - color3bv(allocator.allocateArray(JAVA_BYTE, v)); + color3bv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void color3d(double red, double green, double blue) { @@ -423,7 +423,7 @@ public static void color3dv(MemorySegment v) { } public static void color3dv(SegmentAllocator allocator, double[] v) { - color3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + color3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void color3f(float red, float green, float blue) { @@ -445,7 +445,7 @@ public static void color3fv(MemorySegment v) { } public static void color3fv(SegmentAllocator allocator, float[] v) { - color3fv(allocator.allocateArray(JAVA_FLOAT, v)); + color3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void color3i(int red, int green, int blue) { @@ -467,7 +467,7 @@ public static void color3iv(MemorySegment v) { } public static void color3iv(SegmentAllocator allocator, int[] v) { - color3iv(allocator.allocateArray(JAVA_INT, v)); + color3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void color3s(short red, short green, short blue) { @@ -489,7 +489,7 @@ public static void color3sv(MemorySegment v) { } public static void color3sv(SegmentAllocator allocator, short[] v) { - color3sv(allocator.allocateArray(JAVA_SHORT, v)); + color3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void color3ub(byte red, byte green, byte blue) { @@ -511,7 +511,7 @@ public static void color3ubv(MemorySegment v) { } public static void color3ubv(SegmentAllocator allocator, byte[] v) { - color3ubv(allocator.allocateArray(JAVA_BYTE, v)); + color3ubv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void color3ui(int red, int green, int blue) { @@ -533,7 +533,7 @@ public static void color3uiv(MemorySegment v) { } public static void color3uiv(SegmentAllocator allocator, int[] v) { - color3uiv(allocator.allocateArray(JAVA_INT, v)); + color3uiv(allocator.allocateFrom(JAVA_INT, v)); } public static void color3us(short red, short green, short blue) { @@ -555,7 +555,7 @@ public static void color3usv(MemorySegment v) { } public static void color3usv(SegmentAllocator allocator, short[] v) { - color3usv(allocator.allocateArray(JAVA_SHORT, v)); + color3usv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void color4b(byte red, byte green, byte blue, byte alpha) { @@ -577,7 +577,7 @@ public static void color4bv(MemorySegment v) { } public static void color4bv(SegmentAllocator allocator, byte[] v) { - color4bv(allocator.allocateArray(JAVA_BYTE, v)); + color4bv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void color4d(double red, double green, double blue, double alpha) { @@ -599,7 +599,7 @@ public static void color4dv(MemorySegment v) { } public static void color4dv(SegmentAllocator allocator, double[] v) { - color4dv(allocator.allocateArray(JAVA_DOUBLE, v)); + color4dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void color4f(float red, float green, float blue, float alpha) { @@ -621,7 +621,7 @@ public static void color4fv(MemorySegment v) { } public static void color4fv(SegmentAllocator allocator, float[] v) { - color4fv(allocator.allocateArray(JAVA_FLOAT, v)); + color4fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void color4i(int red, int green, int blue, int alpha) { @@ -643,7 +643,7 @@ public static void color4iv(MemorySegment v) { } public static void color4iv(SegmentAllocator allocator, int[] v) { - color4iv(allocator.allocateArray(JAVA_INT, v)); + color4iv(allocator.allocateFrom(JAVA_INT, v)); } public static void color4s(short red, short green, short blue, short alpha) { @@ -665,7 +665,7 @@ public static void color4sv(MemorySegment v) { } public static void color4sv(SegmentAllocator allocator, short[] v) { - color4sv(allocator.allocateArray(JAVA_SHORT, v)); + color4sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void color4ub(byte red, byte green, byte blue, byte alpha) { @@ -687,7 +687,7 @@ public static void color4ubv(MemorySegment v) { } public static void color4ubv(SegmentAllocator allocator, byte[] v) { - color4ubv(allocator.allocateArray(JAVA_BYTE, v)); + color4ubv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void color4ui(int red, int green, int blue, int alpha) { @@ -709,7 +709,7 @@ public static void color4uiv(MemorySegment v) { } public static void color4uiv(SegmentAllocator allocator, int[] v) { - color4uiv(allocator.allocateArray(JAVA_INT, v)); + color4uiv(allocator.allocateFrom(JAVA_INT, v)); } public static void color4us(short red, short green, short blue, short alpha) { @@ -731,7 +731,7 @@ public static void color4usv(MemorySegment v) { } public static void color4usv(SegmentAllocator allocator, short[] v) { - color4usv(allocator.allocateArray(JAVA_SHORT, v)); + color4usv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void colorMaterial(int face, int mode) { @@ -789,7 +789,7 @@ public static void edgeFlagv(MemorySegment flag) { } public static void edgeFlagv(SegmentAllocator allocator, boolean[] flag) { - var pFlag = allocator.allocateArray(JAVA_BOOLEAN, flag.length); + var pFlag = allocator.allocate(JAVA_BOOLEAN, flag.length); for (int i = 0; i < flag.length; i++) { pFlag.set(JAVA_BOOLEAN, i, flag[i]); } @@ -833,7 +833,7 @@ public static void evalCoord1dv(MemorySegment u) { } public static void evalCoord1dv(SegmentAllocator allocator, double[] u) { - evalCoord1dv(allocator.allocateArray(JAVA_DOUBLE, u)); + evalCoord1dv(allocator.allocateFrom(JAVA_DOUBLE, u)); } public static void evalCoord1f(float u) { @@ -855,7 +855,7 @@ public static void evalCoord1fv(MemorySegment u) { } public static void evalCoord1fv(SegmentAllocator allocator, float[] u) { - evalCoord1fv(allocator.allocateArray(JAVA_FLOAT, u)); + evalCoord1fv(allocator.allocateFrom(JAVA_FLOAT, u)); } public static void evalCoord2d(double u, double v) { @@ -877,7 +877,7 @@ public static void evalCoord2dv(MemorySegment u) { } public static void evalCoord2dv(SegmentAllocator allocator, double[] u) { - evalCoord2dv(allocator.allocateArray(JAVA_DOUBLE, u)); + evalCoord2dv(allocator.allocateFrom(JAVA_DOUBLE, u)); } public static void evalCoord2f(float u, float v) { @@ -899,7 +899,7 @@ public static void evalCoord2fv(MemorySegment u) { } public static void evalCoord2fv(SegmentAllocator allocator, float[] u) { - evalCoord2fv(allocator.allocateArray(JAVA_FLOAT, u)); + evalCoord2fv(allocator.allocateFrom(JAVA_FLOAT, u)); } public static void evalMesh1(int mode, int i1, int i2) { @@ -948,7 +948,7 @@ public static void feedbackBuffer(int size, int type, MemorySegment buffer) { } public static void feedbackBuffer(SegmentAllocator allocator, int type, float[] buffer) { - var pBuffer = allocator.allocateArray(JAVA_FLOAT, buffer.length); + var pBuffer = allocator.allocateFrom(JAVA_FLOAT, buffer); feedbackBuffer(buffer.length, type, pBuffer); RuntimeHelper.toArray(pBuffer, buffer); } @@ -972,7 +972,7 @@ public static void fogfv(int pname, MemorySegment params) { } public static void fogfv(SegmentAllocator allocator, int pname, float[] params) { - fogfv(pname, allocator.allocateArray(JAVA_FLOAT, params)); + fogfv(pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void fogi(int pname, int param) { @@ -994,7 +994,7 @@ public static void fogiv(int pname, MemorySegment params) { } public static void fogiv(SegmentAllocator allocator, int pname, int[] params) { - fogiv(pname, allocator.allocateArray(JAVA_INT, params)); + fogiv(pname, allocator.allocateFrom(JAVA_INT, params)); } public static void frustum(double left, double right, double bottom, double top, double zNear, double zFar) { @@ -1046,7 +1046,7 @@ public static void getLightfv(int light, int pname, MemorySegment params) { } public static void getLightfv(SegmentAllocator allocator, int light, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getLightfv(light, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1073,7 +1073,7 @@ public static void getLightiv(int light, int pname, MemorySegment params) { } public static void getLightiv(SegmentAllocator allocator, int light, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getLightiv(light, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1100,7 +1100,7 @@ public static void getMapdv(int target, int query, MemorySegment v) { } public static void getMapdv(SegmentAllocator allocator, int target, int query, double[] v) { - var pv = allocator.allocateArray(JAVA_DOUBLE, v.length); + var pv = allocator.allocateFrom(JAVA_DOUBLE, v); getMapdv(target, query, pv); RuntimeHelper.toArray(pv, v); } @@ -1127,7 +1127,7 @@ public static void getMapfv(int target, int query, MemorySegment v) { } public static void getMapfv(SegmentAllocator allocator, int target, int query, float[] v) { - var pv = allocator.allocateArray(JAVA_FLOAT, v.length); + var pv = allocator.allocateFrom(JAVA_FLOAT, v); getMapfv(target, query, pv); RuntimeHelper.toArray(pv, v); } @@ -1154,7 +1154,7 @@ public static void getMapiv(int target, int query, MemorySegment v) { } public static void getMapiv(SegmentAllocator allocator, int target, int query, int[] v) { - var pv = allocator.allocateArray(JAVA_INT, v.length); + var pv = allocator.allocateFrom(JAVA_INT, v); getMapiv(target, query, pv); RuntimeHelper.toArray(pv, v); } @@ -1181,7 +1181,7 @@ public static void getMaterialfv(int face, int pname, MemorySegment params) { } public static void getMaterialfv(SegmentAllocator allocator, int face, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getMaterialfv(face, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1208,7 +1208,7 @@ public static void getMaterialiv(int face, int pname, MemorySegment params) { } public static void getMaterialiv(SegmentAllocator allocator, int face, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getMaterialiv(face, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1235,7 +1235,7 @@ public static void getPixelMapfv(int map, MemorySegment values) { } public static void getPixelMapfv(SegmentAllocator allocator, int map, float[] values) { - var pValues = allocator.allocateArray(JAVA_FLOAT, values.length); + var pValues = allocator.allocateFrom(JAVA_FLOAT, values); getPixelMapfv(map, pValues); RuntimeHelper.toArray(pValues, values); } @@ -1250,7 +1250,7 @@ public static void getPixelMapuiv(int map, MemorySegment values) { } public static void getPixelMapuiv(SegmentAllocator allocator, int map, int[] values) { - var pValues = allocator.allocateArray(JAVA_INT, values.length); + var pValues = allocator.allocateFrom(JAVA_INT, values); getPixelMapuiv(map, pValues); RuntimeHelper.toArray(pValues, values); } @@ -1265,7 +1265,7 @@ public static void getPixelMapusv(int map, MemorySegment values) { } public static void getPixelMapusv(SegmentAllocator allocator, int map, short[] values) { - var pValues = allocator.allocateArray(JAVA_SHORT, values.length); + var pValues = allocator.allocateFrom(JAVA_SHORT, values); getPixelMapusv(map, pValues); RuntimeHelper.toArray(pValues, values); } @@ -1280,7 +1280,7 @@ public static void getPolygonStipple(MemorySegment mask) { } public static void getPolygonStipple(SegmentAllocator allocator, byte[] mask) { - var pMask = allocator.allocateArray(JAVA_BYTE, mask.length); + var pMask = allocator.allocateFrom(JAVA_BYTE, mask); getPolygonStipple(pMask); RuntimeHelper.toArray(pMask, mask); } @@ -1295,7 +1295,7 @@ public static void getTexEnvfv(int target, int pname, MemorySegment params) { } public static void getTexEnvfv(SegmentAllocator allocator, int target, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getTexEnvfv(target, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1322,7 +1322,7 @@ public static void getTexEnviv(int target, int pname, MemorySegment params) { } public static void getTexEnviv(SegmentAllocator allocator, int target, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getTexEnviv(target, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1349,7 +1349,7 @@ public static void getTexGendv(int coord, int pname, MemorySegment params) { } public static void getTexGendv(SegmentAllocator allocator, int coord, int pname, double[] params) { - var pParams = allocator.allocateArray(JAVA_DOUBLE, params.length); + var pParams = allocator.allocateFrom(JAVA_DOUBLE, params); getTexGendv(coord, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1364,7 +1364,7 @@ public static void getTexGenfv(int coord, int pname, MemorySegment params) { } public static void getTexGenfv(SegmentAllocator allocator, int coord, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getTexGenfv(coord, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1379,7 +1379,7 @@ public static void getTexGeniv(int coord, int pname, MemorySegment params) { } public static void getTexGeniv(SegmentAllocator allocator, int coord, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getTexGeniv(coord, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1412,7 +1412,7 @@ public static void indexdv(MemorySegment c) { } public static void indexdv(SegmentAllocator allocator, double[] c) { - indexdv(allocator.allocateArray(JAVA_DOUBLE, c)); + indexdv(allocator.allocateFrom(JAVA_DOUBLE, c)); } public static void indexf(float c) { @@ -1434,7 +1434,7 @@ public static void indexfv(MemorySegment c) { } public static void indexfv(SegmentAllocator allocator, float[] c) { - indexfv(allocator.allocateArray(JAVA_FLOAT, c)); + indexfv(allocator.allocateFrom(JAVA_FLOAT, c)); } public static void indexi(int c) { @@ -1456,7 +1456,7 @@ public static void indexiv(MemorySegment c) { } public static void indexiv(SegmentAllocator allocator, int[] c) { - indexiv(allocator.allocateArray(JAVA_INT, c)); + indexiv(allocator.allocateFrom(JAVA_INT, c)); } public static void indexs(short c) { @@ -1478,7 +1478,7 @@ public static void indexsv(MemorySegment c) { } public static void indexsv(SegmentAllocator allocator, short[] c) { - indexsv(allocator.allocateArray(JAVA_SHORT, c)); + indexsv(allocator.allocateFrom(JAVA_SHORT, c)); } public static void initNames() { @@ -1518,7 +1518,7 @@ public static void lightModelfv(int pname, MemorySegment params) { } public static void lightModelfv(SegmentAllocator allocator, int pname, float[] params) { - lightModelfv(pname, allocator.allocateArray(JAVA_FLOAT, params)); + lightModelfv(pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void lightModeli(int pname, int param) { @@ -1540,7 +1540,7 @@ public static void lightModeliv(int pname, MemorySegment params) { } public static void lightModeliv(SegmentAllocator allocator, int pname, int[] params) { - lightModeliv(pname, allocator.allocateArray(JAVA_INT, params)); + lightModeliv(pname, allocator.allocateFrom(JAVA_INT, params)); } public static void lightf(int light, int pname, float param) { @@ -1562,7 +1562,7 @@ public static void lightfv(int light, int pname, MemorySegment params) { } public static void lightfv(SegmentAllocator allocator, int light, int pname, float[] params) { - lightfv(light, pname, allocator.allocateArray(JAVA_FLOAT, params)); + lightfv(light, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void lighti(int light, int pname, int param) { @@ -1584,7 +1584,7 @@ public static void lightiv(int light, int pname, MemorySegment params) { } public static void lightiv(SegmentAllocator allocator, int light, int pname, int[] params) { - lightiv(light, pname, allocator.allocateArray(JAVA_INT, params)); + lightiv(light, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void lineStipple(int factor, short pattern) { @@ -1624,7 +1624,7 @@ public static void loadMatrixd(MemorySegment m) { } public static void loadMatrixd(SegmentAllocator allocator, double[] m) { - loadMatrixd(allocator.allocateArray(JAVA_DOUBLE, m)); + loadMatrixd(allocator.allocateFrom(JAVA_DOUBLE, m)); } public static void loadMatrixf(MemorySegment m) { @@ -1637,7 +1637,7 @@ public static void loadMatrixf(MemorySegment m) { } public static void loadMatrixf(SegmentAllocator allocator, float[] m) { - loadMatrixf(allocator.allocateArray(JAVA_FLOAT, m)); + loadMatrixf(allocator.allocateFrom(JAVA_FLOAT, m)); } public static void loadName(int name) { @@ -1659,7 +1659,7 @@ public static void map1d(int target, double u1, double u2, int stride, int order } public static void map1d(SegmentAllocator allocator, int target, double u1, double u2, int stride, int order, double[] points) { - map1d(target, u1, u2, stride, order, allocator.allocateArray(JAVA_DOUBLE, points)); + map1d(target, u1, u2, stride, order, allocator.allocateFrom(JAVA_DOUBLE, points)); } public static void map1f(int target, float u1, float u2, int stride, int order, MemorySegment points) { @@ -1672,7 +1672,7 @@ public static void map1f(int target, float u1, float u2, int stride, int order, } public static void map1f(SegmentAllocator allocator, int target, float u1, float u2, int stride, int order, float[] points) { - map1f(target, u1, u2, stride, order, allocator.allocateArray(JAVA_FLOAT, points)); + map1f(target, u1, u2, stride, order, allocator.allocateFrom(JAVA_FLOAT, points)); } public static void map2d(int target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, MemorySegment points) { @@ -1685,7 +1685,7 @@ public static void map2d(int target, double u1, double u2, int ustride, int uord } public static void map2d(SegmentAllocator allocator, int target, double u1, double u2, int ustride, int uorder, double v1, double v2, int vstride, int vorder, double[] points) { - map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, allocator.allocateArray(JAVA_DOUBLE, points)); + map2d(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, allocator.allocateFrom(JAVA_DOUBLE, points)); } public static void map2f(int target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, MemorySegment points) { @@ -1698,7 +1698,7 @@ public static void map2f(int target, float u1, float u2, int ustride, int uorder } public static void map2f(SegmentAllocator allocator, int target, float u1, float u2, int ustride, int uorder, float v1, float v2, int vstride, int vorder, float[] points) { - map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, allocator.allocateArray(JAVA_FLOAT, points)); + map2f(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, allocator.allocateFrom(JAVA_FLOAT, points)); } public static void mapGrid1d(int un, double u1, double u2) { @@ -1756,7 +1756,7 @@ public static void materialfv(int face, int pname, MemorySegment params) { } public static void materialfv(SegmentAllocator allocator, int face, int pname, float[] params) { - materialfv(face, pname, allocator.allocateArray(JAVA_FLOAT, params)); + materialfv(face, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void materiali(int face, int pname, int param) { @@ -1778,7 +1778,7 @@ public static void materialiv(int face, int pname, MemorySegment params) { } public static void materialiv(SegmentAllocator allocator, int face, int pname, int[] params) { - materialiv(face, pname, allocator.allocateArray(JAVA_INT, params)); + materialiv(face, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void matrixMode(int mode) { @@ -1800,7 +1800,7 @@ public static void multMatrixd(MemorySegment m) { } public static void multMatrixd(SegmentAllocator allocator, double[] m) { - multMatrixd(allocator.allocateArray(JAVA_DOUBLE, m)); + multMatrixd(allocator.allocateFrom(JAVA_DOUBLE, m)); } public static void multMatrixf(MemorySegment m) { @@ -1813,7 +1813,7 @@ public static void multMatrixf(MemorySegment m) { } public static void multMatrixf(SegmentAllocator allocator, float[] m) { - multMatrixf(allocator.allocateArray(JAVA_FLOAT, m)); + multMatrixf(allocator.allocateFrom(JAVA_FLOAT, m)); } public static void newList(int list, int mode) { @@ -1844,7 +1844,7 @@ public static void normal3bv(MemorySegment v) { } public static void normal3bv(SegmentAllocator allocator, byte[] v) { - normal3bv(allocator.allocateArray(JAVA_BYTE, v)); + normal3bv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void normal3d(double nx, double ny, double nz) { @@ -1866,7 +1866,7 @@ public static void normal3dv(MemorySegment v) { } public static void normal3dv(SegmentAllocator allocator, double[] v) { - normal3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + normal3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void normal3f(float nx, float ny, float nz) { @@ -1888,7 +1888,7 @@ public static void normal3fv(MemorySegment v) { } public static void normal3fv(SegmentAllocator allocator, float[] v) { - normal3fv(allocator.allocateArray(JAVA_FLOAT, v)); + normal3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void normal3i(int nx, int ny, int nz) { @@ -1910,7 +1910,7 @@ public static void normal3iv(MemorySegment v) { } public static void normal3iv(SegmentAllocator allocator, int[] v) { - normal3iv(allocator.allocateArray(JAVA_INT, v)); + normal3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void normal3s(short nx, short ny, short nz) { @@ -1932,7 +1932,7 @@ public static void normal3sv(MemorySegment v) { } public static void normal3sv(SegmentAllocator allocator, short[] v) { - normal3sv(allocator.allocateArray(JAVA_SHORT, v)); + normal3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void ortho(double left, double right, double bottom, double top, double zNear, double zFar) { @@ -1963,7 +1963,7 @@ public static void pixelMapfv(int map, int mapSize, MemorySegment values) { } public static void pixelMapfv(SegmentAllocator allocator, int map, float[] values) { - pixelMapfv(map, values.length, allocator.allocateArray(JAVA_FLOAT, values)); + pixelMapfv(map, values.length, allocator.allocateFrom(JAVA_FLOAT, values)); } public static void pixelMapuiv(int map, int mapSize, MemorySegment values) { @@ -1976,7 +1976,7 @@ public static void pixelMapuiv(int map, int mapSize, MemorySegment values) { } public static void pixelMapuiv(SegmentAllocator allocator, int map, int[] values) { - pixelMapuiv(map, values.length, allocator.allocateArray(JAVA_INT, values)); + pixelMapuiv(map, values.length, allocator.allocateFrom(JAVA_INT, values)); } public static void pixelMapusv(int map, int mapSize, MemorySegment values) { @@ -1989,7 +1989,7 @@ public static void pixelMapusv(int map, int mapSize, MemorySegment values) { } public static void pixelMapusv(SegmentAllocator allocator, int map, short[] values) { - pixelMapusv(map, values.length, allocator.allocateArray(JAVA_SHORT, values)); + pixelMapusv(map, values.length, allocator.allocateFrom(JAVA_SHORT, values)); } public static void pixelTransferf(int pname, float param) { @@ -2029,7 +2029,7 @@ public static void polygonStipple(MemorySegment mask) { } public static void polygonStipple(SegmentAllocator allocator, byte[] mask) { - polygonStipple(allocator.allocateArray(JAVA_BYTE, mask)); + polygonStipple(allocator.allocateFrom(JAVA_BYTE, mask)); } public static void popAttrib() { @@ -2105,7 +2105,7 @@ public static void rasterPos2dv(MemorySegment v) { } public static void rasterPos2dv(SegmentAllocator allocator, double[] v) { - rasterPos2dv(allocator.allocateArray(JAVA_DOUBLE, v)); + rasterPos2dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void rasterPos2f(float x, float y) { @@ -2127,7 +2127,7 @@ public static void rasterPos2fv(MemorySegment v) { } public static void rasterPos2fv(SegmentAllocator allocator, float[] v) { - rasterPos2fv(allocator.allocateArray(JAVA_FLOAT, v)); + rasterPos2fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void rasterPos2i(int x, int y) { @@ -2149,7 +2149,7 @@ public static void rasterPos2iv(MemorySegment v) { } public static void rasterPos2iv(SegmentAllocator allocator, int[] v) { - rasterPos2iv(allocator.allocateArray(JAVA_INT, v)); + rasterPos2iv(allocator.allocateFrom(JAVA_INT, v)); } public static void rasterPos2s(short x, short y) { @@ -2171,7 +2171,7 @@ public static void rasterPos2sv(MemorySegment v) { } public static void rasterPos2sv(SegmentAllocator allocator, short[] v) { - rasterPos2sv(allocator.allocateArray(JAVA_SHORT, v)); + rasterPos2sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void rasterPos3d(double x, double y, double z) { @@ -2193,7 +2193,7 @@ public static void rasterPos3dv(MemorySegment v) { } public static void rasterPos3dv(SegmentAllocator allocator, double[] v) { - rasterPos3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + rasterPos3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void rasterPos3f(float x, float y, float z) { @@ -2215,7 +2215,7 @@ public static void rasterPos3fv(MemorySegment v) { } public static void rasterPos3fv(SegmentAllocator allocator, float[] v) { - rasterPos3fv(allocator.allocateArray(JAVA_FLOAT, v)); + rasterPos3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void rasterPos3i(int x, int y, int z) { @@ -2237,7 +2237,7 @@ public static void rasterPos3iv(MemorySegment v) { } public static void rasterPos3iv(SegmentAllocator allocator, int[] v) { - rasterPos3iv(allocator.allocateArray(JAVA_INT, v)); + rasterPos3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void rasterPos3s(short x, short y, short z) { @@ -2259,7 +2259,7 @@ public static void rasterPos3sv(MemorySegment v) { } public static void rasterPos3sv(SegmentAllocator allocator, short[] v) { - rasterPos3sv(allocator.allocateArray(JAVA_SHORT, v)); + rasterPos3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void rasterPos4d(double x, double y, double z, double w) { @@ -2281,7 +2281,7 @@ public static void rasterPos4dv(MemorySegment v) { } public static void rasterPos4dv(SegmentAllocator allocator, double[] v) { - rasterPos4dv(allocator.allocateArray(JAVA_DOUBLE, v)); + rasterPos4dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void rasterPos4f(float x, float y, float z, float w) { @@ -2303,7 +2303,7 @@ public static void rasterPos4fv(MemorySegment v) { } public static void rasterPos4fv(SegmentAllocator allocator, float[] v) { - rasterPos4fv(allocator.allocateArray(JAVA_FLOAT, v)); + rasterPos4fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void rasterPos4i(int x, int y, int z, int w) { @@ -2325,7 +2325,7 @@ public static void rasterPos4iv(MemorySegment v) { } public static void rasterPos4iv(SegmentAllocator allocator, int[] v) { - rasterPos4iv(allocator.allocateArray(JAVA_INT, v)); + rasterPos4iv(allocator.allocateFrom(JAVA_INT, v)); } public static void rasterPos4s(short x, short y, short z, short w) { @@ -2347,7 +2347,7 @@ public static void rasterPos4sv(MemorySegment v) { } public static void rasterPos4sv(SegmentAllocator allocator, short[] v) { - rasterPos4sv(allocator.allocateArray(JAVA_SHORT, v)); + rasterPos4sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void rectd(double x1, double y1, double x2, double y2) { @@ -2369,7 +2369,7 @@ public static void rectdv(MemorySegment v1, MemorySegment v2) { } public static void rectdv(SegmentAllocator allocator, double[] v1, double[] v2) { - rectdv(allocator.allocateArray(JAVA_DOUBLE, v1), allocator.allocateArray(JAVA_DOUBLE, v2)); + rectdv(allocator.allocateFrom(JAVA_DOUBLE, v1), allocator.allocateFrom(JAVA_DOUBLE, v2)); } public static void rectf(float x1, float y1, float x2, float y2) { @@ -2391,7 +2391,7 @@ public static void rectfv(MemorySegment v1, MemorySegment v2) { } public static void rectfv(SegmentAllocator allocator, float[] v1, float[] v2) { - rectfv(allocator.allocateArray(JAVA_FLOAT, v1), allocator.allocateArray(JAVA_FLOAT, v2)); + rectfv(allocator.allocateFrom(JAVA_FLOAT, v1), allocator.allocateFrom(JAVA_FLOAT, v2)); } public static void recti(int x1, int y1, int x2, int y2) { @@ -2413,7 +2413,7 @@ public static void rectiv(MemorySegment v1, MemorySegment v2) { } public static void rectiv(SegmentAllocator allocator, int[] v1, int[] v2) { - rectiv(allocator.allocateArray(JAVA_INT, v1), allocator.allocateArray(JAVA_INT, v2)); + rectiv(allocator.allocateFrom(JAVA_INT, v1), allocator.allocateFrom(JAVA_INT, v2)); } public static void rects(short x1, short y1, short x2, short y2) { @@ -2435,7 +2435,7 @@ public static void rectsv(MemorySegment v1, MemorySegment v2) { } public static void rectsv(SegmentAllocator allocator, short[] v1, short[] v2) { - rectsv(allocator.allocateArray(JAVA_SHORT, v1), allocator.allocateArray(JAVA_SHORT, v2)); + rectsv(allocator.allocateFrom(JAVA_SHORT, v1), allocator.allocateFrom(JAVA_SHORT, v2)); } public static int renderMode(int mode) { @@ -2493,7 +2493,7 @@ public static void selectBuffer(int size, MemorySegment buffer) { } public static void selectBuffer(SegmentAllocator allocator, int[] buffer) { - var seg = allocator.allocateArray(JAVA_INT, buffer.length); + var seg = allocator.allocateFrom(JAVA_INT, buffer); selectBuffer(buffer.length, seg); RuntimeHelper.toArray(seg, buffer); } @@ -2526,7 +2526,7 @@ public static void texCoord1dv(MemorySegment v) { } public static void texCoord1dv(SegmentAllocator allocator, double[] v) { - texCoord1dv(allocator.allocateArray(JAVA_DOUBLE, v)); + texCoord1dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void texCoord1f(float s) { @@ -2548,7 +2548,7 @@ public static void texCoord1fv(MemorySegment v) { } public static void texCoord1fv(SegmentAllocator allocator, float[] v) { - texCoord1fv(allocator.allocateArray(JAVA_FLOAT, v)); + texCoord1fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void texCoord1i(int s) { @@ -2570,7 +2570,7 @@ public static void texCoord1iv(MemorySegment v) { } public static void texCoord1iv(SegmentAllocator allocator, int[] v) { - texCoord1iv(allocator.allocateArray(JAVA_INT, v)); + texCoord1iv(allocator.allocateFrom(JAVA_INT, v)); } public static void texCoord1s(short s) { @@ -2592,7 +2592,7 @@ public static void texCoord1sv(MemorySegment v) { } public static void texCoord1sv(SegmentAllocator allocator, short[] v) { - texCoord1sv(allocator.allocateArray(JAVA_SHORT, v)); + texCoord1sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void texCoord2d(double s, double t) { @@ -2614,7 +2614,7 @@ public static void texCoord2dv(MemorySegment v) { } public static void texCoord2dv(SegmentAllocator allocator, double[] v) { - texCoord2dv(allocator.allocateArray(JAVA_DOUBLE, v)); + texCoord2dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void texCoord2f(float s, float t) { @@ -2636,7 +2636,7 @@ public static void texCoord2fv(MemorySegment v) { } public static void texCoord2fv(SegmentAllocator allocator, float[] v) { - texCoord2fv(allocator.allocateArray(JAVA_FLOAT, v)); + texCoord2fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void texCoord2i(int s, int t) { @@ -2658,7 +2658,7 @@ public static void texCoord2iv(MemorySegment v) { } public static void texCoord2iv(SegmentAllocator allocator, int[] v) { - texCoord2iv(allocator.allocateArray(JAVA_INT, v)); + texCoord2iv(allocator.allocateFrom(JAVA_INT, v)); } public static void texCoord2s(short s, short t) { @@ -2680,7 +2680,7 @@ public static void texCoord2sv(MemorySegment v) { } public static void texCoord2sv(SegmentAllocator allocator, short[] v) { - texCoord2sv(allocator.allocateArray(JAVA_SHORT, v)); + texCoord2sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void texCoord3d(double s, double t, double r) { @@ -2702,7 +2702,7 @@ public static void texCoord3dv(MemorySegment v) { } public static void texCoord3dv(SegmentAllocator allocator, double[] v) { - texCoord3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + texCoord3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void texCoord3f(float s, float t, float r) { @@ -2724,7 +2724,7 @@ public static void texCoord3fv(MemorySegment v) { } public static void texCoord3fv(SegmentAllocator allocator, float[] v) { - texCoord3fv(allocator.allocateArray(JAVA_FLOAT, v)); + texCoord3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void texCoord3i(int s, int t, int r) { @@ -2746,7 +2746,7 @@ public static void texCoord3iv(MemorySegment v) { } public static void texCoord3iv(SegmentAllocator allocator, int[] v) { - texCoord3iv(allocator.allocateArray(JAVA_INT, v)); + texCoord3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void texCoord3s(short s, short t, short r) { @@ -2768,7 +2768,7 @@ public static void texCoord3sv(MemorySegment v) { } public static void texCoord3sv(SegmentAllocator allocator, short[] v) { - texCoord3sv(allocator.allocateArray(JAVA_SHORT, v)); + texCoord3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void texCoord4d(double s, double t, double r, double q) { @@ -2790,7 +2790,7 @@ public static void texCoord4dv(MemorySegment v) { } public static void texCoord4dv(SegmentAllocator allocator, double[] v) { - texCoord4dv(allocator.allocateArray(JAVA_DOUBLE, v)); + texCoord4dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void texCoord4f(float s, float t, float r, float q) { @@ -2812,7 +2812,7 @@ public static void texCoord4fv(MemorySegment v) { } public static void texCoord4fv(SegmentAllocator allocator, float[] v) { - texCoord4fv(allocator.allocateArray(JAVA_FLOAT, v)); + texCoord4fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void texCoord4i(int s, int t, int r, int q) { @@ -2834,7 +2834,7 @@ public static void texCoord4iv(MemorySegment v) { } public static void texCoord4iv(SegmentAllocator allocator, int[] v) { - texCoord4iv(allocator.allocateArray(JAVA_INT, v)); + texCoord4iv(allocator.allocateFrom(JAVA_INT, v)); } public static void texCoord4s(short s, short t, short r, short q) { @@ -2856,7 +2856,7 @@ public static void texCoord4sv(MemorySegment v) { } public static void texCoord4sv(SegmentAllocator allocator, short[] v) { - texCoord4sv(allocator.allocateArray(JAVA_SHORT, v)); + texCoord4sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void texEnvf(int target, int pname, float param) { @@ -2878,7 +2878,7 @@ public static void texEnvfv(int target, int pname, MemorySegment params) { } public static void texEnvfv(SegmentAllocator allocator, int target, int pname, float[] params) { - texEnvfv(target, pname, allocator.allocateArray(JAVA_FLOAT, params)); + texEnvfv(target, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void texEnvi(int target, int pname, int param) { @@ -2900,7 +2900,7 @@ public static void texEnviv(int target, int pname, MemorySegment params) { } public static void texEnviv(SegmentAllocator allocator, int target, int pname, int[] params) { - texEnviv(target, pname, allocator.allocateArray(JAVA_INT, params)); + texEnviv(target, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void texGend(int coord, int pname, double param) { @@ -2922,7 +2922,7 @@ public static void texGendv(int coord, int pname, MemorySegment params) { } public static void texGendv(SegmentAllocator allocator, int coord, int pname, double[] params) { - texGendv(coord, pname, allocator.allocateArray(JAVA_DOUBLE, params)); + texGendv(coord, pname, allocator.allocateFrom(JAVA_DOUBLE, params)); } public static void texGenf(int coord, int pname, float param) { @@ -2944,7 +2944,7 @@ public static void texGenfv(int coord, int pname, MemorySegment params) { } public static void texGenfv(SegmentAllocator allocator, int coord, int pname, float[] params) { - texGenfv(coord, pname, allocator.allocateArray(JAVA_FLOAT, params)); + texGenfv(coord, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void texGeni(int coord, int pname, int param) { @@ -2966,7 +2966,7 @@ public static void texGeniv(int coord, int pname, MemorySegment params) { } public static void texGeniv(SegmentAllocator allocator, int coord, int pname, int[] params) { - texGeniv(coord, pname, allocator.allocateArray(JAVA_INT, params)); + texGeniv(coord, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void translated(double x, double y, double z) { @@ -3006,7 +3006,7 @@ public static void vertex2dv(MemorySegment v) { } public static void vertex2dv(SegmentAllocator allocator, double[] v) { - vertex2dv(allocator.allocateArray(JAVA_DOUBLE, v)); + vertex2dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertex2f(float x, float y) { @@ -3028,7 +3028,7 @@ public static void vertex2fv(MemorySegment v) { } public static void vertex2fv(SegmentAllocator allocator, float[] v) { - vertex2fv(allocator.allocateArray(JAVA_FLOAT, v)); + vertex2fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertex2i(int x, int y) { @@ -3050,7 +3050,7 @@ public static void vertex2iv(MemorySegment v) { } public static void vertex2iv(SegmentAllocator allocator, int[] v) { - vertex2iv(allocator.allocateArray(JAVA_INT, v)); + vertex2iv(allocator.allocateFrom(JAVA_INT, v)); } public static void vertex2s(short x, short y) { @@ -3072,7 +3072,7 @@ public static void vertex2sv(MemorySegment v) { } public static void vertex2sv(SegmentAllocator allocator, short[] v) { - vertex2sv(allocator.allocateArray(JAVA_SHORT, v)); + vertex2sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertex3d(double x, double y, double z) { @@ -3094,7 +3094,7 @@ public static void vertex3dv(MemorySegment v) { } public static void vertex3dv(SegmentAllocator allocator, double[] v) { - vertex3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + vertex3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertex3f(float x, float y, float z) { @@ -3116,7 +3116,7 @@ public static void vertex3fv(MemorySegment v) { } public static void vertex3fv(SegmentAllocator allocator, float[] v) { - vertex3fv(allocator.allocateArray(JAVA_FLOAT, v)); + vertex3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertex3i(int x, int y, int z) { @@ -3138,7 +3138,7 @@ public static void vertex3iv(MemorySegment v) { } public static void vertex3iv(SegmentAllocator allocator, int[] v) { - vertex3iv(allocator.allocateArray(JAVA_INT, v)); + vertex3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void vertex3s(short x, short y, short z) { @@ -3160,7 +3160,7 @@ public static void vertex3sv(MemorySegment v) { } public static void vertex3sv(SegmentAllocator allocator, short[] v) { - vertex3sv(allocator.allocateArray(JAVA_SHORT, v)); + vertex3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertex4d(double x, double y, double z, double w) { @@ -3182,7 +3182,7 @@ public static void vertex4dv(MemorySegment v) { } public static void vertex4dv(SegmentAllocator allocator, double[] v) { - vertex4dv(allocator.allocateArray(JAVA_DOUBLE, v)); + vertex4dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertex4f(float x, float y, float z, float w) { @@ -3204,7 +3204,7 @@ public static void vertex4fv(MemorySegment v) { } public static void vertex4fv(SegmentAllocator allocator, float[] v) { - vertex4fv(allocator.allocateArray(JAVA_FLOAT, v)); + vertex4fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertex4i(int x, int y, int z, int w) { @@ -3226,7 +3226,7 @@ public static void vertex4iv(MemorySegment v) { } public static void vertex4iv(SegmentAllocator allocator, int[] v) { - vertex4iv(allocator.allocateArray(JAVA_INT, v)); + vertex4iv(allocator.allocateFrom(JAVA_INT, v)); } public static void vertex4s(short x, short y, short z, short w) { @@ -3248,6 +3248,6 @@ public static void vertex4sv(MemorySegment v) { } public static void vertex4sv(SegmentAllocator allocator, short[] v) { - vertex4sv(allocator.allocateArray(JAVA_SHORT, v)); + vertex4sv(allocator.allocateFrom(JAVA_SHORT, v)); } } 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 51eb83a9..0e53af2c 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL10C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -428,7 +428,7 @@ public static void getBooleanv(int pname, MemorySegment data) { } public static void getBooleanv(SegmentAllocator allocator, int pname, boolean[] data) { - var pData = allocator.allocateArray(JAVA_BOOLEAN, data.length); + var pData = allocator.allocate(JAVA_BOOLEAN, data.length); getBooleanv(pname, pData); RuntimeHelper.toArray(pData, data); } @@ -455,7 +455,7 @@ public static void getDoublev(int pname, MemorySegment data) { } public static void getDoublev(SegmentAllocator allocator, int pname, double[] data) { - var pData = allocator.allocateArray(JAVA_DOUBLE, data.length); + var pData = allocator.allocate(JAVA_DOUBLE, data.length); getDoublev(pname, pData); RuntimeHelper.toArray(pData, data); } @@ -491,7 +491,7 @@ public static void getFloatv(int pname, MemorySegment data) { } public static void getFloatv(SegmentAllocator allocator, int pname, float[] data) { - var pData = allocator.allocateArray(JAVA_FLOAT, data.length); + var pData = allocator.allocate(JAVA_FLOAT, data.length); getFloatv(pname, pData); RuntimeHelper.toArray(pData, data); } @@ -518,7 +518,7 @@ public static void getIntegerv(int pname, MemorySegment data) { } public static void getIntegerv(SegmentAllocator allocator, int pname, int[] data) { - var pData = allocator.allocateArray(JAVA_INT, data.length); + var pData = allocator.allocate(JAVA_INT, data.length); getIntegerv(pname, pData); RuntimeHelper.toArray(pData, data); } @@ -547,7 +547,7 @@ public static MemorySegment ngetString(int name) { @Nullable public static String getString(int name) { var pStr = ngetString(name); - return RuntimeHelper.isNullptr(pStr) ? null : pStr.getUtf8String(0); + return RuntimeHelper.isNullptr(pStr) ? null : pStr.getString(0); } public static void getTexImage(int target, int level, int format, int type, MemorySegment pixels) { @@ -569,7 +569,7 @@ public static void getTexLevelParameterfv(int target, int level, int pname, Memo } public static void getTexLevelParameterfv(SegmentAllocator allocator, int target, int level, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocate(JAVA_FLOAT, params.length); getTexLevelParameterfv(target, level, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -596,7 +596,7 @@ public static void getTexLevelParameteriv(int target, int level, int pname, Memo } public static void getTexLevelParameteriv(SegmentAllocator allocator, int target, int level, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocate(JAVA_INT, params.length); getTexLevelParameteriv(target, level, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -623,7 +623,7 @@ public static void getTexParameterfv(int target, int pname, MemorySegment params } public static void getTexParameterfv(SegmentAllocator allocator, int target, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocate(JAVA_FLOAT, params.length); getTexParameterfv(target, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -650,7 +650,7 @@ public static void getTexParameteriv(int target, int pname, MemorySegment params } public static void getTexParameteriv(SegmentAllocator allocator, int target, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocate(JAVA_INT, params.length); getTexParameteriv(target, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -758,25 +758,25 @@ public static void readPixels(int x, int y, int width, int height, int format, i } public static void readPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, byte[] pixels) { - var seg = allocator.allocateArray(JAVA_BYTE, pixels.length); + var seg = allocator.allocate(JAVA_BYTE, pixels.length); readPixels(x, y, width, height, format, type, seg); RuntimeHelper.toArray(seg, pixels); } public static void readPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, short[] pixels) { - var seg = allocator.allocateArray(JAVA_SHORT, pixels.length); + var seg = allocator.allocate(JAVA_SHORT, pixels.length); readPixels(x, y, width, height, format, type, seg); RuntimeHelper.toArray(seg, pixels); } public static void readPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, int[] pixels) { - var seg = allocator.allocateArray(JAVA_INT, pixels.length); + var seg = allocator.allocate(JAVA_INT, pixels.length); readPixels(x, y, width, height, format, type, seg); RuntimeHelper.toArray(seg, pixels); } public static void readPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, float[] pixels) { - var seg = allocator.allocateArray(JAVA_FLOAT, pixels.length); + var seg = allocator.allocate(JAVA_FLOAT, pixels.length); readPixels(x, y, width, height, format, type, seg); RuntimeHelper.toArray(seg, pixels); } @@ -827,19 +827,19 @@ public static void texImage1D(int target, int level, int internalFormat, int wid } public static void texImage1D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int border, int format, int type, byte[] pixels) { - texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void texImage1D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int border, int format, int type, short[] pixels) { - texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void texImage1D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int border, int format, int type, int[] pixels) { - texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateArray(JAVA_INT, pixels)); + texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void texImage1D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int border, int format, int type, float[] pixels) { - texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + texImage1D(target, level, internalFormat, width, border, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void texImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, MemorySegment pixels) { @@ -852,19 +852,19 @@ public static void texImage2D(int target, int level, int internalFormat, int wid } public static void texImage2D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int border, int format, int type, byte[] pixels) { - texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void texImage2D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int border, int format, int type, short[] pixels) { - texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void texImage2D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int border, int format, int type, int[] pixels) { - texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateArray(JAVA_INT, pixels)); + texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void texImage2D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int border, int format, int type, float[] pixels) { - texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + texImage2D(target, level, internalFormat, width, height, border, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void texParameterf(int target, int pname, float param) { @@ -886,7 +886,7 @@ public static void texParameterfv(int target, int pname, MemorySegment params) { } public static void texParameterfv(SegmentAllocator allocator, int target, int pname, float[] params) { - texParameterfv(target, pname, allocator.allocateArray(JAVA_FLOAT, params)); + texParameterfv(target, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void texParameteri(int target, int pname, int param) { @@ -908,7 +908,7 @@ public static void texParameteriv(int target, int pname, MemorySegment params) { } public static void texParameteriv(SegmentAllocator allocator, int target, int pname, int[] params) { - texParameteriv(target, pname, allocator.allocateArray(JAVA_INT, params)); + texParameteriv(target, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void viewport(int x, int y, int width, int height) { diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11.java index 450c8d79..3fae162b 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -391,8 +391,8 @@ public static boolean areTexturesResident(int n, MemorySegment textures, MemoryS public static boolean areTexturesResident(SegmentAllocator allocator, int[] textures, boolean[] residences) { final int n = textures.length; - var pTex = allocator.allocateArray(JAVA_INT, n); - var pRes = allocator.allocateArray(JAVA_BOOLEAN, n); + var pTex = allocator.allocate(JAVA_INT, n); + var pRes = allocator.allocate(JAVA_BOOLEAN, n); boolean b = areTexturesResident(n, pTex, pRes); for (int i = 0; i < n; i++) { textures[i] = pTex.getAtIndex(JAVA_INT, i); @@ -420,23 +420,23 @@ public static void colorPointer(int size, int type, int stride, MemorySegment po } public static void colorPointer(SegmentAllocator allocator, int size, int type, int stride, byte[] pointer) { - colorPointer(size, type, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + colorPointer(size, type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void colorPointer(SegmentAllocator allocator, int size, int type, int stride, short[] pointer) { - colorPointer(size, type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + colorPointer(size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void colorPointer(SegmentAllocator allocator, int size, int type, int stride, int[] pointer) { - colorPointer(size, type, stride, allocator.allocateArray(JAVA_INT, pointer)); + colorPointer(size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void colorPointer(SegmentAllocator allocator, int size, int type, int stride, float[] pointer) { - colorPointer(size, type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + colorPointer(size, type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void colorPointer(SegmentAllocator allocator, int size, int type, int stride, double[] pointer) { - colorPointer(size, type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + colorPointer(size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void disableClientState(int array) { @@ -476,23 +476,23 @@ public static void indexPointer(int type, int stride, MemorySegment pointer) { } public static void indexPointer(SegmentAllocator allocator, int type, int stride, byte[] pointer) { - indexPointer(type, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + indexPointer(type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void indexPointer(SegmentAllocator allocator, int type, int stride, short[] pointer) { - indexPointer(type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + indexPointer(type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void indexPointer(SegmentAllocator allocator, int type, int stride, int[] pointer) { - indexPointer(type, stride, allocator.allocateArray(JAVA_INT, pointer)); + indexPointer(type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void indexPointer(SegmentAllocator allocator, int type, int stride, float[] pointer) { - indexPointer(type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + indexPointer(type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void indexPointer(SegmentAllocator allocator, int type, int stride, double[] pointer) { - indexPointer(type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + indexPointer(type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void indexub(byte c) { @@ -514,7 +514,7 @@ public static void indexubv(MemorySegment c) { } public static void indexubv(SegmentAllocator allocator, byte[] c) { - var pc = allocator.allocateArray(JAVA_BYTE, c); + var pc = allocator.allocateFrom(JAVA_BYTE, c); indexubv(pc); } @@ -528,7 +528,7 @@ public static void interleavedArrays(int format, int stride, MemorySegment point } public static void interleavedArrays(SegmentAllocator allocator, int format, int stride, float[] pointer) { - var pp = allocator.allocateArray(JAVA_FLOAT, pointer); + var pp = allocator.allocateFrom(JAVA_FLOAT, pointer); interleavedArrays(format, stride, pp); } @@ -542,23 +542,23 @@ public static void normalPointer(int type, int stride, MemorySegment pointer) { } public static void normalPointer(SegmentAllocator allocator, int type, int stride, byte[] pointer) { - normalPointer(type, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + normalPointer(type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void normalPointer(SegmentAllocator allocator, int type, int stride, short[] pointer) { - normalPointer(type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + normalPointer(type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void normalPointer(SegmentAllocator allocator, int type, int stride, int[] pointer) { - normalPointer(type, stride, allocator.allocateArray(JAVA_INT, pointer)); + normalPointer(type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void normalPointer(SegmentAllocator allocator, int type, int stride, float[] pointer) { - normalPointer(type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + normalPointer(type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void normalPointer(SegmentAllocator allocator, int type, int stride, double[] pointer) { - normalPointer(type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + normalPointer(type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void popClientAttrib() { @@ -581,8 +581,8 @@ public static void prioritizeTextures(int n, MemorySegment textures, MemorySegme public static void prioritizeTextures(SegmentAllocator allocator, int[] textures, float[] priorities) { final int n = textures.length; - var pTex = allocator.allocateArray(JAVA_INT, n); - var pPri = allocator.allocateArray(JAVA_FLOAT, n); + var pTex = allocator.allocate(JAVA_INT, n); + var pPri = allocator.allocate(JAVA_FLOAT, n); for (int i = 0; i < n; i++) { pTex.setAtIndex(JAVA_INT, i, textures[i]); pPri.setAtIndex(JAVA_FLOAT, i, priorities[i]); @@ -609,19 +609,19 @@ public static void texCoordPointer(int size, int type, int stride, MemorySegment } public static void texCoordPointer(SegmentAllocator allocator, int size, int type, int stride, short[] pointer) { - texCoordPointer(size, type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + texCoordPointer(size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void texCoordPointer(SegmentAllocator allocator, int size, int type, int stride, int[] pointer) { - texCoordPointer(size, type, stride, allocator.allocateArray(JAVA_INT, pointer)); + texCoordPointer(size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void texCoordPointer(SegmentAllocator allocator, int size, int type, int stride, float[] pointer) { - texCoordPointer(size, type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + texCoordPointer(size, type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void texCoordPointer(SegmentAllocator allocator, int size, int type, int stride, double[] pointer) { - texCoordPointer(size, type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + texCoordPointer(size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void vertexPointer(int size, int type, int stride, MemorySegment pointer) { @@ -634,18 +634,18 @@ public static void vertexPointer(int size, int type, int stride, MemorySegment p } public static void vertexPointer(SegmentAllocator allocator, int size, int type, int stride, short[] pointer) { - vertexPointer(size, type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + vertexPointer(size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void vertexPointer(SegmentAllocator allocator, int size, int type, int stride, int[] pointer) { - vertexPointer(size, type, stride, allocator.allocateArray(JAVA_INT, pointer)); + vertexPointer(size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void vertexPointer(SegmentAllocator allocator, int size, int type, int stride, float[] pointer) { - vertexPointer(size, type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + vertexPointer(size, type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void vertexPointer(SegmentAllocator allocator, int size, int type, int stride, double[] pointer) { - vertexPointer(size, type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + vertexPointer(size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11C.java index d5d96aa8..0145d20c 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL11C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -143,7 +143,7 @@ public static void deleteTextures(int n, MemorySegment textures) { } public static void deleteTextures(SegmentAllocator allocator, int[] textures) { - deleteTextures(textures.length, allocator.allocateArray(JAVA_INT, textures)); + deleteTextures(textures.length, allocator.allocateFrom(JAVA_INT, textures)); } public static void deleteTexture(int texture) { @@ -175,17 +175,17 @@ public static void drawElements(int mode, int count, int type, MemorySegment ind } public static void drawElements(SegmentAllocator allocator, int mode, int count, int type, byte[] indices) { - var seg = allocator.allocateArray(JAVA_BYTE, indices); + var seg = allocator.allocateFrom(JAVA_BYTE, indices); drawElements(mode, count, type, seg); } public static void drawElements(SegmentAllocator allocator, int mode, int count, int type, short[] indices) { - var seg = allocator.allocateArray(JAVA_SHORT, indices); + var seg = allocator.allocateFrom(JAVA_SHORT, indices); drawElements(mode, count, type, seg); } public static void drawElements(SegmentAllocator allocator, int mode, int count, int type, int[] indices) { - var seg = allocator.allocateArray(JAVA_INT, indices); + var seg = allocator.allocateFrom(JAVA_INT, indices); drawElements(mode, count, type, seg); } @@ -200,7 +200,7 @@ public static void genTextures(int n, MemorySegment textures) { public static void genTextures(SegmentAllocator allocator, int[] textures) { final int n = textures.length; - var pTex = allocator.allocateArray(JAVA_INT, n); + var pTex = allocator.allocate(JAVA_INT, n); genTextures(n, pTex); RuntimeHelper.toArray(pTex, textures); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL12C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL12C.java index 459700fe..6aaf560b 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL12C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL12C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -96,15 +96,15 @@ public static void drawRangeElements(int mode, int start, int end, int count, in } public static void drawRangeElements(SegmentAllocator allocator, int mode, int start, int end, int count, int type, byte[] indices) { - drawRangeElements(mode, start, end, count, type, allocator.allocateArray(JAVA_BYTE, indices)); + drawRangeElements(mode, start, end, count, type, allocator.allocateFrom(JAVA_BYTE, indices)); } public static void drawRangeElements(SegmentAllocator allocator, int mode, int start, int end, int count, int type, short[] indices) { - drawRangeElements(mode, start, end, count, type, allocator.allocateArray(JAVA_SHORT, indices)); + drawRangeElements(mode, start, end, count, type, allocator.allocateFrom(JAVA_SHORT, indices)); } public static void drawRangeElements(SegmentAllocator allocator, int mode, int start, int end, int count, int type, int[] indices) { - drawRangeElements(mode, start, end, count, type, allocator.allocateArray(JAVA_INT, indices)); + drawRangeElements(mode, start, end, count, type, allocator.allocateFrom(JAVA_INT, indices)); } public static void texImage3D(int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, MemorySegment pixels) { @@ -117,19 +117,19 @@ public static void texImage3D(int target, int level, int internalFormat, int wid } public static void texImage3D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, byte[] pixels) { - texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void texImage3D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, short[] pixels) { - texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void texImage3D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, int[] pixels) { - texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateArray(JAVA_INT, pixels)); + texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void texImage3D(SegmentAllocator allocator, int target, int level, int internalFormat, int width, int height, int depth, int border, int format, int type, float[] pixels) { - texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + texImage3D(target, level, internalFormat, width, height, depth, border, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void texSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, MemorySegment pixels) { @@ -142,18 +142,18 @@ public static void texSubImage3D(int target, int level, int xoffset, int yoffset } public static void texSubImage3D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, byte[] pixels) { - texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void texSubImage3D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, short[] pixels) { - texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void texSubImage3D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int[] pixels) { - texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_INT, pixels)); + texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void texSubImage3D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, float[] pixels) { - texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL13.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL13.java index 6070c386..f3e2b76f 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL13.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL13.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -136,7 +136,7 @@ public static void loadTransposeMatrixd(MemorySegment m) { } public static void loadTransposeMatrixd(SegmentAllocator allocator, double[] m) { - loadTransposeMatrixd(allocator.allocateArray(JAVA_DOUBLE, m)); + loadTransposeMatrixd(allocator.allocateFrom(JAVA_DOUBLE, m)); } public static void loadTransposeMatrixf(MemorySegment m) { @@ -149,7 +149,7 @@ public static void loadTransposeMatrixf(MemorySegment m) { } public static void loadTransposeMatrixf(SegmentAllocator allocator, float[] m) { - loadTransposeMatrixf(allocator.allocateArray(JAVA_FLOAT, m)); + loadTransposeMatrixf(allocator.allocateFrom(JAVA_FLOAT, m)); } public static void multTransposeMatrixd(MemorySegment m) { @@ -162,7 +162,7 @@ public static void multTransposeMatrixd(MemorySegment m) { } public static void multTransposeMatrixd(SegmentAllocator allocator, double[] m) { - multTransposeMatrixd(allocator.allocateArray(JAVA_DOUBLE, m)); + multTransposeMatrixd(allocator.allocateFrom(JAVA_DOUBLE, m)); } public static void multTransposeMatrixf(MemorySegment m) { @@ -175,7 +175,7 @@ public static void multTransposeMatrixf(MemorySegment m) { } public static void multTransposeMatrixf(SegmentAllocator allocator, float[] m) { - multTransposeMatrixf(allocator.allocateArray(JAVA_FLOAT, m)); + multTransposeMatrixf(allocator.allocateFrom(JAVA_FLOAT, m)); } public static void multiTexCoord1d(int target, double s) { @@ -197,7 +197,7 @@ public static void multiTexCoord1dv(int target, MemorySegment v) { } public static void multiTexCoord1dv(SegmentAllocator allocator, int target, double[] v) { - multiTexCoord1dv(target, allocator.allocateArray(JAVA_DOUBLE, v)); + multiTexCoord1dv(target, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void multiTexCoord1f(int target, float s) { @@ -219,7 +219,7 @@ public static void multiTexCoord1fv(int target, MemorySegment v) { } public static void multiTexCoord1fv(SegmentAllocator allocator, int target, float[] v) { - multiTexCoord1fv(target, allocator.allocateArray(JAVA_FLOAT, v)); + multiTexCoord1fv(target, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void multiTexCoord1i(int target, int s) { @@ -241,7 +241,7 @@ public static void multiTexCoord1iv(int target, MemorySegment v) { } public static void multiTexCoord1iv(SegmentAllocator allocator, int target, int[] v) { - multiTexCoord1iv(target, allocator.allocateArray(JAVA_INT, v)); + multiTexCoord1iv(target, allocator.allocateFrom(JAVA_INT, v)); } public static void multiTexCoord1s(int target, short s) { @@ -263,7 +263,7 @@ public static void multiTexCoord1sv(int target, MemorySegment v) { } public static void multiTexCoord1sv(SegmentAllocator allocator, int target, short[] v) { - multiTexCoord1sv(target, allocator.allocateArray(JAVA_SHORT, v)); + multiTexCoord1sv(target, allocator.allocateFrom(JAVA_SHORT, v)); } public static void multiTexCoord2d(int target, double s, double t) { @@ -285,7 +285,7 @@ public static void multiTexCoord2dv(int target, MemorySegment v) { } public static void multiTexCoord2dv(SegmentAllocator allocator, int target, double[] v) { - multiTexCoord2dv(target, allocator.allocateArray(JAVA_DOUBLE, v)); + multiTexCoord2dv(target, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void multiTexCoord2f(int target, float s, float t) { @@ -307,7 +307,7 @@ public static void multiTexCoord2fv(int target, MemorySegment v) { } public static void multiTexCoord2fv(SegmentAllocator allocator, int target, float[] v) { - multiTexCoord2fv(target, allocator.allocateArray(JAVA_FLOAT, v)); + multiTexCoord2fv(target, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void multiTexCoord2i(int target, int s, int t) { @@ -329,7 +329,7 @@ public static void multiTexCoord2iv(int target, MemorySegment v) { } public static void multiTexCoord2iv(SegmentAllocator allocator, int target, int[] v) { - multiTexCoord2iv(target, allocator.allocateArray(JAVA_INT, v)); + multiTexCoord2iv(target, allocator.allocateFrom(JAVA_INT, v)); } public static void multiTexCoord2s(int target, short s, short t) { @@ -351,7 +351,7 @@ public static void multiTexCoord2sv(int target, MemorySegment v) { } public static void multiTexCoord2sv(SegmentAllocator allocator, int target, short[] v) { - multiTexCoord2sv(target, allocator.allocateArray(JAVA_SHORT, v)); + multiTexCoord2sv(target, allocator.allocateFrom(JAVA_SHORT, v)); } public static void multiTexCoord3d(int target, double s, double t, double r) { @@ -373,7 +373,7 @@ public static void multiTexCoord3dv(int target, MemorySegment v) { } public static void multiTexCoord3dv(SegmentAllocator allocator, int target, double[] v) { - multiTexCoord3dv(target, allocator.allocateArray(JAVA_DOUBLE, v)); + multiTexCoord3dv(target, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void multiTexCoord3f(int target, float s, float t, float r) { @@ -395,7 +395,7 @@ public static void multiTexCoord3fv(int target, MemorySegment v) { } public static void multiTexCoord3fv(SegmentAllocator allocator, int target, float[] v) { - multiTexCoord3fv(target, allocator.allocateArray(JAVA_FLOAT, v)); + multiTexCoord3fv(target, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void multiTexCoord3i(int target, int s, int t, int r) { @@ -417,7 +417,7 @@ public static void multiTexCoord3iv(int target, MemorySegment v) { } public static void multiTexCoord3iv(SegmentAllocator allocator, int target, int[] v) { - multiTexCoord3iv(target, allocator.allocateArray(JAVA_INT, v)); + multiTexCoord3iv(target, allocator.allocateFrom(JAVA_INT, v)); } public static void multiTexCoord3s(int target, short s, short t, short r) { @@ -439,7 +439,7 @@ public static void multiTexCoord3sv(int target, MemorySegment v) { } public static void multiTexCoord3sv(SegmentAllocator allocator, int target, short[] v) { - multiTexCoord3sv(target, allocator.allocateArray(JAVA_SHORT, v)); + multiTexCoord3sv(target, allocator.allocateFrom(JAVA_SHORT, v)); } public static void multiTexCoord4d(int target, double s, double t, double r, double q) { @@ -461,7 +461,7 @@ public static void multiTexCoord4dv(int target, MemorySegment v) { } public static void multiTexCoord4dv(SegmentAllocator allocator, int target, double[] v) { - multiTexCoord4dv(target, allocator.allocateArray(JAVA_DOUBLE, v)); + multiTexCoord4dv(target, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void multiTexCoord4f(int target, float s, float t, float r, float q) { @@ -483,7 +483,7 @@ public static void multiTexCoord4fv(int target, MemorySegment v) { } public static void multiTexCoord4fv(SegmentAllocator allocator, int target, float[] v) { - multiTexCoord4fv(target, allocator.allocateArray(JAVA_FLOAT, v)); + multiTexCoord4fv(target, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void multiTexCoord4i(int target, int s, int t, int r, int q) { @@ -505,7 +505,7 @@ public static void multiTexCoord4iv(int target, MemorySegment v) { } public static void multiTexCoord4iv(SegmentAllocator allocator, int target, int[] v) { - multiTexCoord4iv(target, allocator.allocateArray(JAVA_INT, v)); + multiTexCoord4iv(target, allocator.allocateFrom(JAVA_INT, v)); } public static void multiTexCoord4s(int target, short s, short t, short r, short q) { @@ -527,6 +527,6 @@ public static void multiTexCoord4sv(int target, MemorySegment v) { } public static void multiTexCoord4sv(SegmentAllocator allocator, int target, short[] v) { - multiTexCoord4sv(target, allocator.allocateArray(JAVA_SHORT, v)); + multiTexCoord4sv(target, allocator.allocateFrom(JAVA_SHORT, v)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14.java index 596d064c..6f7e53a3 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -88,11 +88,11 @@ public static void fogCoordPointer(int type, int stride, MemorySegment pointer) } public static void fogCoordPointer(SegmentAllocator allocator, int type, int stride, float[] pointer) { - fogCoordPointer(type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + fogCoordPointer(type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void fogCoordPointer(SegmentAllocator allocator, int type, int stride, double[] pointer) { - fogCoordPointer(type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + fogCoordPointer(type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void fogCoordd(double coord) { @@ -114,7 +114,7 @@ public static void fogCoorddv(MemorySegment coord) { } public static void fogCoorddv(SegmentAllocator allocator, double[] coord) { - fogCoorddv(allocator.allocateArray(JAVA_DOUBLE, coord)); + fogCoorddv(allocator.allocateFrom(JAVA_DOUBLE, coord)); } public static void fogCoordf(float coord) { @@ -136,7 +136,7 @@ public static void fogCoordfv(MemorySegment coord) { } public static void fogCoordfv(SegmentAllocator allocator, float[] coord) { - fogCoordfv(allocator.allocateArray(JAVA_FLOAT, coord)); + fogCoordfv(allocator.allocateFrom(JAVA_FLOAT, coord)); } public static void secondaryColor3b(byte red, byte green, byte blue) { @@ -158,7 +158,7 @@ public static void secondaryColor3bv(MemorySegment v) { } public static void secondaryColor3bv(SegmentAllocator allocator, byte[] v) { - secondaryColor3bv(allocator.allocateArray(JAVA_BYTE, v)); + secondaryColor3bv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void secondaryColor3d(double red, double green, double blue) { @@ -180,7 +180,7 @@ public static void secondaryColor3dv(MemorySegment v) { } public static void secondaryColor3dv(SegmentAllocator allocator, double[] v) { - secondaryColor3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + secondaryColor3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void secondaryColor3f(float red, float green, float blue) { @@ -202,7 +202,7 @@ public static void secondaryColor3fv(MemorySegment v) { } public static void secondaryColor3fv(SegmentAllocator allocator, float[] v) { - secondaryColor3fv(allocator.allocateArray(JAVA_FLOAT, v)); + secondaryColor3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void secondaryColor3i(int red, int green, int blue) { @@ -224,7 +224,7 @@ public static void secondaryColor3iv(MemorySegment v) { } public static void secondaryColor3iv(SegmentAllocator allocator, int[] v) { - secondaryColor3iv(allocator.allocateArray(JAVA_INT, v)); + secondaryColor3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void secondaryColor3s(short red, short green, short blue) { @@ -246,7 +246,7 @@ public static void secondaryColor3sv(MemorySegment v) { } public static void secondaryColor3sv(SegmentAllocator allocator, short[] v) { - secondaryColor3sv(allocator.allocateArray(JAVA_SHORT, v)); + secondaryColor3sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void secondaryColor3ub(byte red, byte green, byte blue) { @@ -268,7 +268,7 @@ public static void secondaryColor3ubv(MemorySegment v) { } public static void secondaryColor3ubv(SegmentAllocator allocator, byte[] v) { - secondaryColor3ubv(allocator.allocateArray(JAVA_BYTE, v)); + secondaryColor3ubv(allocator.allocateFrom(JAVA_BYTE, v)); } public static void secondaryColor3ui(int red, int green, int blue) { @@ -290,7 +290,7 @@ public static void secondaryColor3uiv(MemorySegment v) { } public static void secondaryColor3uiv(SegmentAllocator allocator, int[] v) { - secondaryColor3uiv(allocator.allocateArray(JAVA_INT, v)); + secondaryColor3uiv(allocator.allocateFrom(JAVA_INT, v)); } public static void secondaryColor3us(short red, short green, short blue) { @@ -312,7 +312,7 @@ public static void secondaryColor3usv(MemorySegment v) { } public static void secondaryColor3usv(SegmentAllocator allocator, short[] v) { - secondaryColor3usv(allocator.allocateArray(JAVA_SHORT, v)); + secondaryColor3usv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void secondaryColorPointer(int size, int type, int stride, MemorySegment pointer) { @@ -325,23 +325,23 @@ public static void secondaryColorPointer(int size, int type, int stride, MemoryS } public static void secondaryColorPointer(SegmentAllocator allocator, int size, int type, int stride, byte[] pointer) { - secondaryColorPointer(size, type, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + secondaryColorPointer(size, type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void secondaryColorPointer(SegmentAllocator allocator, int size, int type, int stride, short[] pointer) { - secondaryColorPointer(size, type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + secondaryColorPointer(size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void secondaryColorPointer(SegmentAllocator allocator, int size, int type, int stride, int[] pointer) { - secondaryColorPointer(size, type, stride, allocator.allocateArray(JAVA_INT, pointer)); + secondaryColorPointer(size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void secondaryColorPointer(SegmentAllocator allocator, int size, int type, int stride, float[] pointer) { - secondaryColorPointer(size, type, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + secondaryColorPointer(size, type, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void secondaryColorPointer(SegmentAllocator allocator, int size, int type, int stride, double[] pointer) { - secondaryColorPointer(size, type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + secondaryColorPointer(size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } public static void windowPos2d(double x, double y) { @@ -363,7 +363,7 @@ public static void windowPos2dv(MemorySegment v) { } public static void windowPos2dv(SegmentAllocator allocator, double[] v) { - windowPos2dv(allocator.allocateArray(JAVA_DOUBLE, v)); + windowPos2dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void windowPos2f(float x, float y) { @@ -385,7 +385,7 @@ public static void windowPos2fv(MemorySegment v) { } public static void windowPos2fv(SegmentAllocator allocator, float[] v) { - windowPos2fv(allocator.allocateArray(JAVA_FLOAT, v)); + windowPos2fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void windowPos2i(int x, int y) { @@ -407,7 +407,7 @@ public static void windowPos2iv(MemorySegment v) { } public static void windowPos2iv(SegmentAllocator allocator, int[] v) { - windowPos2iv(allocator.allocateArray(JAVA_INT, v)); + windowPos2iv(allocator.allocateFrom(JAVA_INT, v)); } public static void windowPos2s(short x, short y) { @@ -429,7 +429,7 @@ public static void windowPos2sv(MemorySegment v) { } public static void windowPos2sv(SegmentAllocator allocator, short[] v) { - windowPos2sv(allocator.allocateArray(JAVA_SHORT, v)); + windowPos2sv(allocator.allocateFrom(JAVA_SHORT, v)); } public static void windowPos3d(double x, double y, double z) { @@ -451,7 +451,7 @@ public static void windowPos3dv(MemorySegment v) { } public static void windowPos3dv(SegmentAllocator allocator, double[] v) { - windowPos3dv(allocator.allocateArray(JAVA_DOUBLE, v)); + windowPos3dv(allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void windowPos3f(float x, float y, float z) { @@ -473,7 +473,7 @@ public static void windowPos3fv(MemorySegment v) { } public static void windowPos3fv(SegmentAllocator allocator, float[] v) { - windowPos3fv(allocator.allocateArray(JAVA_FLOAT, v)); + windowPos3fv(allocator.allocateFrom(JAVA_FLOAT, v)); } public static void windowPos3i(int x, int y, int z) { @@ -495,7 +495,7 @@ public static void windowPos3iv(MemorySegment v) { } public static void windowPos3iv(SegmentAllocator allocator, int[] v) { - windowPos3iv(allocator.allocateArray(JAVA_INT, v)); + windowPos3iv(allocator.allocateFrom(JAVA_INT, v)); } public static void windowPos3s(short x, short y, short z) { @@ -517,6 +517,6 @@ public static void windowPos3sv(MemorySegment v) { } public static void windowPos3sv(SegmentAllocator allocator, short[] v) { - windowPos3sv(allocator.allocateArray(JAVA_SHORT, v)); + windowPos3sv(allocator.allocateFrom(JAVA_SHORT, v)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14C.java index c656e322..11d61147 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL14C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -124,7 +124,7 @@ public static void multiDrawArrays(int mode, MemorySegment first, MemorySegment } public static void multiDrawArrays(SegmentAllocator allocator, int mode, int[] first, int[] count, int drawCount) { - multiDrawArrays(mode, allocator.allocateArray(JAVA_INT, first), allocator.allocateArray(JAVA_INT, count), drawCount); + multiDrawArrays(mode, allocator.allocateFrom(JAVA_INT, first), allocator.allocateFrom(JAVA_INT, count), drawCount); } public static void multiDrawArrays(SegmentAllocator allocator, int mode, int[] first, int[] count) { @@ -141,11 +141,11 @@ public static void multiDrawElements(int mode, MemorySegment count, int type, Me } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, byte[][] indices, int drawCount) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_BYTE, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_BYTE, indices[i])); } - multiDrawElements(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount); + multiDrawElements(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount); } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, byte[][] indices) { @@ -153,11 +153,11 @@ public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, short[][] indices, int drawCount) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_SHORT, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_SHORT, indices[i])); } - multiDrawElements(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount); + multiDrawElements(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount); } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, short[][] indices) { @@ -165,11 +165,11 @@ public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, int[][] indices, int drawCount) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_INT, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_INT, indices[i])); } - multiDrawElements(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount); + multiDrawElements(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount); } public static void multiDrawElements(SegmentAllocator allocator, int mode, int[] count, int type, int[][] indices) { @@ -195,7 +195,7 @@ public static void pointParameterfv(int pname, MemorySegment params) { } public static void pointParameterfv(SegmentAllocator allocator, int pname, float[] params) { - pointParameterfv(pname, allocator.allocateArray(JAVA_FLOAT, params)); + pointParameterfv(pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void pointParameteri(int pname, int param) { @@ -217,6 +217,6 @@ public static void pointParameteriv(int pname, MemorySegment params) { } public static void pointParameteriv(SegmentAllocator allocator, int pname, int[] params) { - pointParameteriv(pname, allocator.allocateArray(JAVA_INT, params)); + pointParameteriv(pname, allocator.allocateFrom(JAVA_INT, params)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL15C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL15C.java index a1aefc42..97c79447 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL15C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL15C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -134,27 +134,27 @@ public static void bufferData(int target, long size, int usage) { } public static void bufferData(SegmentAllocator allocator, int target, byte[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data), usage); } public static void bufferData(SegmentAllocator allocator, int target, short[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data), usage); } public static void bufferData(SegmentAllocator allocator, int target, int[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data), usage); } public static void bufferData(SegmentAllocator allocator, int target, long[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data), usage); } public static void bufferData(SegmentAllocator allocator, int target, float[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data), usage); } public static void bufferData(SegmentAllocator allocator, int target, double[] data, int usage) { - bufferData(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data), usage); + bufferData(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data), usage); } public static void bufferSubData(int target, long offset, long size, MemorySegment data) { @@ -171,27 +171,27 @@ public static void bufferSubData(int target, long offset, MemorySegment data) { } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, byte[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data)); } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, short[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data)); } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, int[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data)); } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, long[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data)); } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, float[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data)); } public static void bufferSubData(SegmentAllocator allocator, int target, long offset, double[] data) { - bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data)); + bufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data)); } public static void deleteBuffers(int n, MemorySegment buffers) { @@ -204,7 +204,7 @@ public static void deleteBuffers(int n, MemorySegment buffers) { } public static void deleteBuffers(SegmentAllocator allocator, int[] buffers) { - deleteBuffers(buffers.length, allocator.allocateArray(JAVA_INT, buffers)); + deleteBuffers(buffers.length, allocator.allocateFrom(JAVA_INT, buffers)); } public static void deleteBuffer(int buffer) { @@ -227,7 +227,7 @@ public static void deleteQueries(int n, MemorySegment ids) { } public static void deleteQueries(SegmentAllocator allocator, int[] ids) { - deleteQueries(ids.length, allocator.allocateArray(JAVA_INT, ids)); + deleteQueries(ids.length, allocator.allocateFrom(JAVA_INT, ids)); } public static void deleteQuery(int id) { @@ -259,7 +259,7 @@ public static void genBuffers(int n, MemorySegment buffers) { } public static void genBuffers(SegmentAllocator allocator, int[] buffers) { - var seg = allocator.allocateArray(JAVA_INT, buffers.length); + var seg = allocator.allocateFrom(JAVA_INT, buffers.length); genBuffers(buffers.length, seg); RuntimeHelper.toArray(seg, buffers); } @@ -286,7 +286,7 @@ public static void genQueries(int n, MemorySegment ids) { } public static void genQueries(SegmentAllocator allocator, int[] ids) { - var seg = allocator.allocateArray(JAVA_INT, ids.length); + var seg = allocator.allocateFrom(JAVA_INT, ids.length); genQueries(ids.length, seg); RuntimeHelper.toArray(seg, ids); } @@ -355,37 +355,37 @@ public static void getBufferSubData(int target, long offset, long size, MemorySe } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, byte[] data) { - var seg = allocator.allocateArray(JAVA_BYTE, data.length); + var seg = allocator.allocate(JAVA_BYTE, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length), seg); RuntimeHelper.toArray(seg, data); } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, short[] data) { - var seg = allocator.allocateArray(JAVA_SHORT, data.length); + var seg = allocator.allocate(JAVA_SHORT, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 1, seg); RuntimeHelper.toArray(seg, data); } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, int[] data) { - var seg = allocator.allocateArray(JAVA_INT, data.length); + var seg = allocator.allocate(JAVA_INT, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, seg); RuntimeHelper.toArray(seg, data); } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, long[] data) { - var seg = allocator.allocateArray(JAVA_LONG, data.length); + var seg = allocator.allocate(JAVA_LONG, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, seg); RuntimeHelper.toArray(seg, data); } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, float[] data) { - var seg = allocator.allocateArray(JAVA_FLOAT, data.length); + var seg = allocator.allocate(JAVA_FLOAT, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 2, seg); RuntimeHelper.toArray(seg, data); } public static void getBufferSubData(SegmentAllocator allocator, int target, long offset, double[] data) { - var seg = allocator.allocateArray(JAVA_DOUBLE, data.length); + var seg = allocator.allocate(JAVA_DOUBLE, data.length); getBufferSubData(target, offset, Integer.toUnsignedLong(data.length) << 3, seg); RuntimeHelper.toArray(seg, data); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java index ea4e76d8..f8dfe744 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -353,7 +353,7 @@ public static void drawBuffers(int n, MemorySegment bufs) { } public static void drawBuffers(SegmentAllocator allocator, int[] bufs) { - drawBuffers(bufs.length, allocator.allocateArray(JAVA_INT, bufs)); + drawBuffers(bufs.length, allocator.allocateFrom(JAVA_INT, bufs)); } public static void enableVertexAttribArray(int index) { @@ -378,14 +378,14 @@ public static void getActiveAttrib(SegmentAllocator allocator, int program, int var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; var pSz = allocator.allocate(JAVA_INT); var pType = allocator.allocate(JAVA_INT); - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveAttrib(program, index, bufSize, pLen, pSz, pType, pName); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } size[0] = pSz.get(JAVA_INT, 0); type[0] = pType.get(JAVA_INT, 0); - name[0] = pName.getUtf8String(0); + name[0] = pName.getString(0); } public static void getActiveUniform(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { @@ -401,14 +401,14 @@ public static void getActiveUniform(SegmentAllocator allocator, int program, int var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; var pSz = allocator.allocate(JAVA_INT); var pType = allocator.allocate(JAVA_INT); - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniform(program, index, bufSize, pLen, pSz, pType, pName); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } size[0] = pSz.get(JAVA_INT, 0); type[0] = pType.get(JAVA_INT, 0); - name[0] = pName.getUtf8String(0); + name[0] = pName.getString(0); } public static void getAttachedShaders(int program, int maxCount, MemorySegment count, MemorySegment shaders) { @@ -422,7 +422,7 @@ public static void getAttachedShaders(int program, int maxCount, MemorySegment c public static void getAttachedShaders(SegmentAllocator allocator, int program, int @Nullable [] count, int[] shaders) { var pCount = count != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pShaders = allocator.allocateArray(JAVA_INT, shaders.length); + var pShaders = allocator.allocate(JAVA_INT, shaders.length); getAttachedShaders(program, shaders.length, pCount, pShaders); if (count != null && count.length > 0) { count[0] = pCount.get(JAVA_INT, 0); @@ -465,12 +465,12 @@ public static String getProgramInfoLog(int program, int bufSize, int @Nullable [ var pLen = length != null ? stack.calloc(JAVA_INT) : MemorySegment.NULL; final Arena allocator = stack.getPointer() < bufSize ? Arena.ofConfined() : stack; try { - var pLog = allocator.allocateArray(JAVA_BYTE, bufSize); + var pLog = allocator.allocate(JAVA_BYTE, bufSize); getProgramInfoLog(program, bufSize, pLen, pLog); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return pLog.getUtf8String(0); + return pLog.getString(0); } finally { if (!(allocator instanceof MemoryStack)) allocator.close(); } @@ -493,7 +493,7 @@ public static void getProgramiv(int program, int pname, MemorySegment params) { } public static void getProgramiv(SegmentAllocator allocator, int program, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocate(JAVA_INT, params.length); getProgramiv(program, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -526,12 +526,12 @@ public static String getShaderInfoLog(int shader, int bufSize, int @Nullable [] var pLen = length != null ? stack.callocInt() : MemorySegment.NULL; final Arena allocator = stack.getPointer() < bufSize ? Arena.ofConfined() : stack; try { - var pLog = allocator.allocateArray(JAVA_BYTE, bufSize); + var pLog = allocator.allocate(JAVA_BYTE, bufSize); getShaderInfoLog(shader, bufSize, pLen, pLog); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return pLog.getUtf8String(0); + return pLog.getString(0); } finally { if (!(allocator instanceof MemoryStack)) allocator.close(); } @@ -555,12 +555,12 @@ public static void getShaderSource(int shader, int bufSize, MemorySegment length public static String getShaderSource(SegmentAllocator allocator, int shader, int bufSize, int @Nullable [] length) { var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pSrc = allocator.allocateArray(JAVA_BYTE, bufSize); + var pSrc = allocator.allocate(JAVA_BYTE, bufSize); getShaderSource(shader, bufSize, pLen, pSrc); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return pSrc.getUtf8String(0); + return pSrc.getString(0); } public static String getShaderSource(SegmentAllocator allocator, int shader) { @@ -577,7 +577,7 @@ public static void getShaderiv(int shader, int pname, MemorySegment params) { } public static void getShaderiv(SegmentAllocator allocator, int shader, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocate(JAVA_INT, params.length); getShaderiv(shader, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -623,7 +623,7 @@ public static void getUniformfv(int program, int location, MemorySegment params) } public static void getUniformfv(SegmentAllocator allocator, int program, int location, float[] params) { - var seg = allocator.allocateArray(JAVA_FLOAT, params.length); + var seg = allocator.allocate(JAVA_FLOAT, params.length); getUniformfv(program, location, seg); RuntimeHelper.toArray(seg, params); } @@ -650,7 +650,7 @@ public static void getUniformiv(int program, int location, MemorySegment params) } public static void getUniformiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocate(JAVA_INT, params.length); getUniformiv(program, location, seg); RuntimeHelper.toArray(seg, params); } @@ -677,31 +677,31 @@ public static void getVertexAttribPointerv(int index, int pname, MemorySegment p } public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, byte[] pointer) { - var seg = allocator.allocateArray(JAVA_BYTE, pointer.length); + var seg = allocator.allocate(JAVA_BYTE, pointer.length); getVertexAttribPointerv(index, pname, seg); RuntimeHelper.toArray(seg, pointer); } public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, short[] pointer) { - var seg = allocator.allocateArray(JAVA_SHORT, pointer.length); + var seg = allocator.allocate(JAVA_SHORT, pointer.length); getVertexAttribPointerv(index, pname, seg); RuntimeHelper.toArray(seg, pointer); } public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, int[] pointer) { - var seg = allocator.allocateArray(JAVA_INT, pointer.length); + var seg = allocator.allocate(JAVA_INT, pointer.length); getVertexAttribPointerv(index, pname, seg); RuntimeHelper.toArray(seg, pointer); } public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, float[] pointer) { - var seg = allocator.allocateArray(JAVA_FLOAT, pointer.length); + var seg = allocator.allocate(JAVA_FLOAT, pointer.length); getVertexAttribPointerv(index, pname, seg); RuntimeHelper.toArray(seg, pointer); } public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, double[] pointer) { - var seg = allocator.allocateArray(JAVA_DOUBLE, pointer.length); + var seg = allocator.allocate(JAVA_DOUBLE, pointer.length); getVertexAttribPointerv(index, pname, seg); RuntimeHelper.toArray(seg, pointer); } @@ -716,7 +716,7 @@ public static void getVertexAttribdv(int index, int pname, MemorySegment params) } public static void getVertexAttribdv(SegmentAllocator allocator, int index, int pname, double[] params) { - var seg = allocator.allocateArray(JAVA_DOUBLE, params.length); + var seg = allocator.allocate(JAVA_DOUBLE, params.length); getVertexAttribdv(index, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -743,7 +743,7 @@ public static void getVertexAttribfv(int index, int pname, MemorySegment params) } public static void getVertexAttribfv(SegmentAllocator allocator, int index, int pname, float[] params) { - var seg = allocator.allocateArray(JAVA_FLOAT, params.length); + var seg = allocator.allocate(JAVA_FLOAT, params.length); getVertexAttribfv(index, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -770,7 +770,7 @@ public static void getVertexAttribiv(int index, int pname, MemorySegment params) } public static void getVertexAttribiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocate(JAVA_INT, params.length); getVertexAttribiv(index, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -824,8 +824,8 @@ public static void shaderSource(int shader, int count, MemorySegment string, Mem } public static void shaderSource(SegmentAllocator allocator, int shader, String[] string) { - var pStr = allocator.allocateArray(ADDRESS, string.length); - var pLen = allocator.allocateArray(JAVA_INT, string.length); + var pStr = allocator.allocate(ADDRESS, string.length); + var pLen = allocator.allocate(JAVA_INT, string.length); for (int i = 0; i < string.length; i++) { pStr.setAtIndex(ADDRESS, i, allocator.allocateFrom(string[i])); pLen.setAtIndex(JAVA_INT, i, string[i].length()); @@ -837,7 +837,7 @@ public static void shaderSource(int shader, String string) { final MemoryStack stack = MemoryStack.stackGet(); final long stackPointer = stack.getPointer(); try { - shaderSource(shader, 1, stack.allocate(ADDRESS, stack.allocateFrom(string)), stack.allocateFrom(JAVA_INT, string.length())); + shaderSource(shader, 1, stack.allocateFrom(ADDRESS, stack.allocateFrom(string)), stack.allocateFrom(JAVA_INT, string.length())); } finally { stack.setPointer(stackPointer); } @@ -889,7 +889,7 @@ public static void uniform1fv(int location, int count, MemorySegment value) { } public static void uniform1fv(SegmentAllocator allocator, int location, float[] value) { - uniform1fv(location, value.length, allocator.allocateArray(JAVA_FLOAT, value)); + uniform1fv(location, value.length, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniform1i(int location, int v0) { @@ -911,7 +911,7 @@ public static void uniform1iv(int location, int count, MemorySegment value) { } public static void uniform1iv(SegmentAllocator allocator, int location, int[] value) { - uniform1iv(location, value.length, allocator.allocateArray(JAVA_INT, value)); + uniform1iv(location, value.length, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform2f(int location, float v0, float v1) { @@ -933,7 +933,7 @@ public static void uniform2fv(int location, int count, MemorySegment value) { } public static void uniform2fv(SegmentAllocator allocator, int location, float[] value) { - uniform2fv(location, value.length >> 1, allocator.allocateArray(JAVA_FLOAT, value)); + uniform2fv(location, value.length >> 1, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniform2i(int location, int v0, int v1) { @@ -955,7 +955,7 @@ public static void uniform2iv(int location, int count, MemorySegment value) { } public static void uniform2iv(SegmentAllocator allocator, int location, int[] value) { - uniform2iv(location, value.length >> 1, allocator.allocateArray(JAVA_INT, value)); + uniform2iv(location, value.length >> 1, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform3f(int location, float v0, float v1, float v2) { @@ -977,7 +977,7 @@ public static void uniform3fv(int location, int count, MemorySegment value) { } public static void uniform3fv(SegmentAllocator allocator, int location, float[] value) { - uniform3fv(location, value.length / 3, allocator.allocateArray(JAVA_FLOAT, value)); + uniform3fv(location, value.length / 3, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniform3i(int location, int v0, int v1, int v2) { @@ -999,7 +999,7 @@ public static void uniform3iv(int location, int count, MemorySegment value) { } public static void uniform3iv(SegmentAllocator allocator, int location, int[] value) { - uniform3iv(location, value.length / 3, allocator.allocateArray(JAVA_INT, value)); + uniform3iv(location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform4f(int location, float v0, float v1, float v2, float v3) { @@ -1021,7 +1021,7 @@ public static void uniform4fv(int location, int count, MemorySegment value) { } public static void uniform4fv(SegmentAllocator allocator, int location, float[] value) { - uniform4fv(location, value.length >> 2, allocator.allocateArray(JAVA_FLOAT, value)); + uniform4fv(location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniform4i(int location, int v0, int v1, int v2, int v3) { @@ -1043,7 +1043,7 @@ public static void uniform4iv(int location, int count, MemorySegment value) { } public static void uniform4iv(SegmentAllocator allocator, int location, int[] value) { - uniform4iv(location, value.length >> 2, allocator.allocateArray(JAVA_INT, value)); + uniform4iv(location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); } public static void uniformMatrix2fv(int location, int count, boolean transpose, MemorySegment value) { @@ -1056,7 +1056,7 @@ public static void uniformMatrix2fv(int location, int count, boolean transpose, } public static void uniformMatrix2fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix2fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix2fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix2fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -1073,7 +1073,7 @@ public static void uniformMatrix3fv(int location, int count, boolean transpose, } public static void uniformMatrix3fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix3fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix3fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix3fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -1090,7 +1090,7 @@ public static void uniformMatrix4fv(int location, int count, boolean transpose, } public static void uniformMatrix4fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix4fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix4fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix4fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -1134,7 +1134,7 @@ public static void vertexAttrib1dv(int index, MemorySegment v) { } public static void vertexAttrib1dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib1dv(index, allocator.allocateArray(JAVA_DOUBLE, v)); + vertexAttrib1dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertexAttrib1f(int index, float x) { @@ -1156,7 +1156,7 @@ public static void vertexAttrib1fv(int index, MemorySegment v) { } public static void vertexAttrib1fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib1fv(index, allocator.allocateArray(JAVA_FLOAT, v)); + vertexAttrib1fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertexAttrib1s(int index, short x) { @@ -1178,7 +1178,7 @@ public static void vertexAttrib1sv(int index, MemorySegment v) { } public static void vertexAttrib1sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib1sv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib1sv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib2d(int index, double x, double y) { @@ -1200,7 +1200,7 @@ public static void vertexAttrib2dv(int index, MemorySegment v) { } public static void vertexAttrib2dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib2dv(index, allocator.allocateArray(JAVA_DOUBLE, v)); + vertexAttrib2dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertexAttrib2f(int index, float x, float y) { @@ -1222,7 +1222,7 @@ public static void vertexAttrib2fv(int index, MemorySegment v) { } public static void vertexAttrib2fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib2fv(index, allocator.allocateArray(JAVA_FLOAT, v)); + vertexAttrib2fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertexAttrib2s(int index, short x, short y) { @@ -1244,7 +1244,7 @@ public static void vertexAttrib2sv(int index, MemorySegment v) { } public static void vertexAttrib2sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib2sv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib2sv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib3d(int index, double x, double y, double z) { @@ -1266,7 +1266,7 @@ public static void vertexAttrib3dv(int index, MemorySegment v) { } public static void vertexAttrib3dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib3dv(index, allocator.allocateArray(JAVA_DOUBLE, v)); + vertexAttrib3dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertexAttrib3f(int index, float x, float y, float z) { @@ -1288,7 +1288,7 @@ public static void vertexAttrib3fv(int index, MemorySegment v) { } public static void vertexAttrib3fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib3fv(index, allocator.allocateArray(JAVA_FLOAT, v)); + vertexAttrib3fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertexAttrib3s(int index, short x, short y, short z) { @@ -1310,7 +1310,7 @@ public static void vertexAttrib3sv(int index, MemorySegment v) { } public static void vertexAttrib3sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib3sv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib3sv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib4Nbv(int index, MemorySegment v) { @@ -1323,7 +1323,7 @@ public static void vertexAttrib4Nbv(int index, MemorySegment v) { } public static void vertexAttrib4Nbv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4Nbv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttrib4Nbv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttrib4Niv(int index, MemorySegment v) { @@ -1336,7 +1336,7 @@ public static void vertexAttrib4Niv(int index, MemorySegment v) { } public static void vertexAttrib4Niv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4Niv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttrib4Niv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttrib4Nsv(int index, MemorySegment v) { @@ -1349,7 +1349,7 @@ public static void vertexAttrib4Nsv(int index, MemorySegment v) { } public static void vertexAttrib4Nsv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4Nsv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib4Nsv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib4Nub(int index, byte x, byte y, byte z, byte w) { @@ -1371,7 +1371,7 @@ public static void vertexAttrib4Nubv(int index, MemorySegment v) { } public static void vertexAttrib4Nubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4Nubv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttrib4Nubv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttrib4Nuiv(int index, MemorySegment v) { @@ -1384,7 +1384,7 @@ public static void vertexAttrib4Nuiv(int index, MemorySegment v) { } public static void vertexAttrib4Nuiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4Nuiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttrib4Nuiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttrib4Nusv(int index, MemorySegment v) { @@ -1397,7 +1397,7 @@ public static void vertexAttrib4Nusv(int index, MemorySegment v) { } public static void vertexAttrib4Nusv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4Nusv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib4Nusv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib4bv(int index, MemorySegment v) { @@ -1410,7 +1410,7 @@ public static void vertexAttrib4bv(int index, MemorySegment v) { } public static void vertexAttrib4bv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4bv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttrib4bv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttrib4d(int index, double x, double y, double z, double w) { @@ -1432,7 +1432,7 @@ public static void vertexAttrib4dv(int index, MemorySegment v) { } public static void vertexAttrib4dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib4dv(index, allocator.allocateArray(JAVA_DOUBLE, v)); + vertexAttrib4dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); } public static void vertexAttrib4f(int index, float x, float y, float z, float w) { @@ -1454,7 +1454,7 @@ public static void vertexAttrib4fv(int index, MemorySegment v) { } public static void vertexAttrib4fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib4fv(index, allocator.allocateArray(JAVA_FLOAT, v)); + vertexAttrib4fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); } public static void vertexAttrib4iv(int index, MemorySegment v) { @@ -1467,7 +1467,7 @@ public static void vertexAttrib4iv(int index, MemorySegment v) { } public static void vertexAttrib4iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4iv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttrib4iv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttrib4s(int index, short x, short y, short z, short w) { @@ -1489,7 +1489,7 @@ public static void vertexAttrib4sv(int index, MemorySegment v) { } public static void vertexAttrib4sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4sv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib4sv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttrib4ubv(int index, MemorySegment v) { @@ -1502,7 +1502,7 @@ public static void vertexAttrib4ubv(int index, MemorySegment v) { } public static void vertexAttrib4ubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4ubv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttrib4ubv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttrib4uiv(int index, MemorySegment v) { @@ -1515,7 +1515,7 @@ public static void vertexAttrib4uiv(int index, MemorySegment v) { } public static void vertexAttrib4uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4uiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttrib4uiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttrib4usv(int index, MemorySegment v) { @@ -1528,7 +1528,7 @@ public static void vertexAttrib4usv(int index, MemorySegment v) { } public static void vertexAttrib4usv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4usv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttrib4usv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, MemorySegment pointer) { @@ -1541,22 +1541,22 @@ public static void vertexAttribPointer(int index, int size, int type, boolean no } public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, byte[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, short[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, int[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateArray(JAVA_INT, pointer)); + vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_INT, pointer)); } public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, float[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateArray(JAVA_FLOAT, pointer)); + vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); } public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, double[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateArray(JAVA_DOUBLE, pointer)); + vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL21C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL21C.java index 41a01416..dcd436b4 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL21C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL21C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -77,7 +77,7 @@ public static void uniformMatrix2x3fv(int location, int count, boolean transpose } public static void uniformMatrix2x3fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix2x3fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix2x3fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix2x3fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -94,7 +94,7 @@ public static void uniformMatrix2x4fv(int location, int count, boolean transpose } public static void uniformMatrix2x4fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix2x4fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix2x4fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix2x4fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -111,7 +111,7 @@ public static void uniformMatrix3x2fv(int location, int count, boolean transpose } public static void uniformMatrix3x2fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix3x2fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix3x2fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix3x2fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -128,7 +128,7 @@ public static void uniformMatrix3x4fv(int location, int count, boolean transpose } public static void uniformMatrix3x4fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix3x4fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix3x4fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix3x4fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -145,7 +145,7 @@ public static void uniformMatrix4x2fv(int location, int count, boolean transpose } public static void uniformMatrix4x2fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix4x2fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix4x2fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix4x2fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { @@ -162,7 +162,7 @@ public static void uniformMatrix4x3fv(int location, int count, boolean transpose } public static void uniformMatrix4x3fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix4x3fv(location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value)); + uniformMatrix4x3fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void uniformMatrix4x3fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { 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 a7d1d412..22afb3fe 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -509,7 +509,7 @@ public static void clearBufferfv(int buffer, int drawBuffer, MemorySegment value } public static void clearBufferfv(SegmentAllocator allocator, int buffer, int drawBuffer, float[] value) { - clearBufferfv(buffer, drawBuffer, allocator.allocateArray(JAVA_FLOAT, value)); + clearBufferfv(buffer, drawBuffer, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void clearBufferiv(int buffer, int drawBuffer, MemorySegment value) { @@ -522,7 +522,7 @@ public static void clearBufferiv(int buffer, int drawBuffer, MemorySegment value } public static void clearBufferiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { - clearBufferiv(buffer, drawBuffer, allocator.allocateArray(JAVA_INT, value)); + clearBufferiv(buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); } public static void clearBufferuiv(int buffer, int drawBuffer, MemorySegment value) { @@ -535,7 +535,7 @@ public static void clearBufferuiv(int buffer, int drawBuffer, MemorySegment valu } public static void clearBufferuiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { - clearBufferuiv(buffer, drawBuffer, allocator.allocateArray(JAVA_INT, value)); + clearBufferuiv(buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); } public static void colorMaski(int index, boolean r, boolean g, boolean b, boolean a) { @@ -557,7 +557,7 @@ public static void deleteFramebuffers(int n, MemorySegment framebuffers) { } public static void deleteFramebuffers(SegmentAllocator allocator, int[] framebuffers) { - deleteFramebuffers(framebuffers.length, allocator.allocateArray(JAVA_INT, framebuffers)); + deleteFramebuffers(framebuffers.length, allocator.allocateFrom(JAVA_INT, framebuffers)); } public static void deleteFramebuffer(int framebuffer) { @@ -580,7 +580,7 @@ public static void deleteRenderbuffers(int n, MemorySegment renderbuffers) { } public static void deleteRenderbuffers(SegmentAllocator allocator, int[] renderbuffers) { - deleteRenderbuffers(renderbuffers.length, allocator.allocateArray(JAVA_INT, renderbuffers)); + deleteRenderbuffers(renderbuffers.length, allocator.allocateFrom(JAVA_INT, renderbuffers)); } public static void deleteRenderbuffer(int renderbuffer) { @@ -603,7 +603,7 @@ public static void deleteVertexArrays(int n, MemorySegment arrays) { } public static void deleteVertexArrays(SegmentAllocator allocator, int[] arrays) { - deleteVertexArrays(arrays.length, allocator.allocateArray(JAVA_INT, arrays)); + deleteVertexArrays(arrays.length, allocator.allocateFrom(JAVA_INT, arrays)); } public static void deleteVertexArray(int array) { @@ -716,7 +716,7 @@ public static void genFramebuffers(int n, MemorySegment framebuffers) { } public static void genFramebuffers(SegmentAllocator allocator, int[] framebuffers) { - var seg = allocator.allocateArray(JAVA_INT, framebuffers.length); + var seg = allocator.allocateFrom(JAVA_INT, framebuffers); genFramebuffers(framebuffers.length, seg); RuntimeHelper.toArray(seg, framebuffers); } @@ -743,7 +743,7 @@ public static void genRenderbuffers(int n, MemorySegment renderbuffers) { } public static void genRenderbuffers(SegmentAllocator allocator, int[] renderbuffers) { - var seg = allocator.allocateArray(JAVA_INT, renderbuffers.length); + var seg = allocator.allocateFrom(JAVA_INT, renderbuffers); genRenderbuffers(renderbuffers.length, seg); RuntimeHelper.toArray(seg, renderbuffers); } @@ -770,7 +770,7 @@ public static void genVertexArrays(int n, MemorySegment arrays) { } public static void genVertexArrays(SegmentAllocator allocator, int[] arrays) { - var seg = allocator.allocateArray(JAVA_INT, arrays.length); + var seg = allocator.allocateFrom(JAVA_INT, arrays); genVertexArrays(arrays.length, seg); RuntimeHelper.toArray(seg, arrays); } @@ -806,7 +806,7 @@ public static void getBooleani_v(int target, int index, MemorySegment data) { } public static void getBooleani_v(SegmentAllocator allocator, int target, int index, boolean[] data) { - var seg = allocator.allocateArray(JAVA_BOOLEAN, data.length); + var seg = allocator.allocate(JAVA_BOOLEAN, data.length); getBooleani_v(target, index, seg); RuntimeHelper.toArray(seg, data); } @@ -873,7 +873,7 @@ public static void getIntegeri_v(int target, int index, MemorySegment data) { } public static void getIntegeri_v(SegmentAllocator allocator, int target, int index, int[] data) { - var seg = allocator.allocateArray(JAVA_INT, data.length); + var seg = allocator.allocateFrom(JAVA_INT, data); getIntegeri_v(target, index, seg); RuntimeHelper.toArray(seg, data); } @@ -935,7 +935,7 @@ public static MemorySegment ngetStringi(int pname, int index) { @Nullable public static String getStringi(int pname, int index) { var pStr = ngetStringi(pname, index); - return RuntimeHelper.isNullptr(pStr) ? null : pStr.getUtf8String(0); + return RuntimeHelper.isNullptr(pStr) ? null : pStr.getString(0); } public static void getTexParameterIiv(int target, int pname, MemorySegment params) { @@ -948,7 +948,7 @@ public static void getTexParameterIiv(int target, int pname, MemorySegment param } public static void getTexParameterIiv(SegmentAllocator allocator, int target, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getTexParameterIiv(target, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -975,7 +975,7 @@ public static void getTexParameterIuiv(int target, int pname, MemorySegment para } public static void getTexParameterIuiv(SegmentAllocator allocator, int target, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getTexParameterIuiv(target, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -1005,14 +1005,14 @@ public static void getTransformFeedbackVarying(SegmentAllocator allocator, int p var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; var pSz = allocator.allocate(JAVA_INT); var pType = allocator.allocate(JAVA_INT); - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getTransformFeedbackVarying(program, index, bufSize, pLen, pSz, pType, pName); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } size[0] = pSz.get(JAVA_INT, 0); type[0] = pType.get(JAVA_INT, 0); - name[0] = pName.getUtf8String(0); + name[0] = pName.getString(0); } public static void getUniformuiv(int program, int location, MemorySegment params) { @@ -1025,7 +1025,7 @@ public static void getUniformuiv(int program, int location, MemorySegment params } public static void getUniformuiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getUniformuiv(program, location, seg); RuntimeHelper.toArray(seg, params); } @@ -1052,7 +1052,7 @@ public static void getVertexAttribIiv(int index, int pname, MemorySegment params } public static void getVertexAttribIiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getVertexAttribIiv(index, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -1079,7 +1079,7 @@ public static void getVertexAttribIuiv(int index, int pname, MemorySegment param } public static void getVertexAttribIuiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getVertexAttribIuiv(index, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -1169,7 +1169,7 @@ public static void texParameterIiv(int target, int pname, MemorySegment params) } public static void texParameterIiv(SegmentAllocator allocator, int target, int pname, int[] params) { - texParameterIiv(target, pname, allocator.allocateArray(JAVA_INT, params)); + texParameterIiv(target, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void texParameterIuiv(int target, int pname, MemorySegment params) { @@ -1182,7 +1182,7 @@ public static void texParameterIuiv(int target, int pname, MemorySegment params) } public static void texParameterIuiv(SegmentAllocator allocator, int target, int pname, int[] params) { - texParameterIuiv(target, pname, allocator.allocateArray(JAVA_INT, params)); + texParameterIuiv(target, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void transformFeedbackVaryings(int program, int count, MemorySegment varyings, int bufferMode) { @@ -1195,7 +1195,7 @@ public static void transformFeedbackVaryings(int program, int count, MemorySegme } public static void transformFeedbackVaryings(SegmentAllocator allocator, int program, String[] varyings, int bufferMode) { - var seg = allocator.allocateArray(ADDRESS, varyings.length); + var seg = allocator.allocate(ADDRESS, varyings.length); for (int i = 0; i < varyings.length; i++) { seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(varyings[i])); } @@ -1221,7 +1221,7 @@ public static void uniform1uiv(int location, int count, MemorySegment value) { } public static void uniform1uiv(SegmentAllocator allocator, int location, int[] value) { - uniform1uiv(location, value.length, allocator.allocateArray(JAVA_INT, value)); + uniform1uiv(location, value.length, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform2ui(int location, int v0, int v1) { @@ -1243,7 +1243,7 @@ public static void uniform2uiv(int location, int count, MemorySegment value) { } public static void uniform2uiv(SegmentAllocator allocator, int location, int[] value) { - uniform2uiv(location, value.length >> 1, allocator.allocateArray(JAVA_INT, value)); + uniform2uiv(location, value.length >> 1, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform3ui(int location, int v0, int v1, int v2) { @@ -1265,7 +1265,7 @@ public static void uniform3uiv(int location, int count, MemorySegment value) { } public static void uniform3uiv(SegmentAllocator allocator, int location, int[] value) { - uniform3uiv(location, value.length / 3, allocator.allocateArray(JAVA_INT, value)); + uniform3uiv(location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); } public static void uniform4ui(int location, int v0, int v1, int v2, int v3) { @@ -1287,7 +1287,7 @@ public static void uniform4uiv(int location, int count, MemorySegment value) { } public static void uniform4uiv(SegmentAllocator allocator, int location, int[] value) { - uniform4uiv(location, value.length >> 2, allocator.allocateArray(JAVA_INT, value)); + uniform4uiv(location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); } public static void vertexAttribI1i(int index, int x) { @@ -1309,7 +1309,7 @@ public static void vertexAttribI1iv(int index, MemorySegment v) { } public static void vertexAttribI1iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI1iv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI1iv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI1ui(int index, int x) { @@ -1331,7 +1331,7 @@ public static void vertexAttribI1uiv(int index, MemorySegment v) { } public static void vertexAttribI1uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI1uiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI1uiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI2i(int index, int x, int y) { @@ -1353,7 +1353,7 @@ public static void vertexAttribI2iv(int index, MemorySegment v) { } public static void vertexAttribI2iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI2iv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI2iv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI2ui(int index, int x, int y) { @@ -1375,7 +1375,7 @@ public static void vertexAttribI2uiv(int index, MemorySegment v) { } public static void vertexAttribI2uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI2uiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI2uiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI3i(int index, int x, int y, int z) { @@ -1397,7 +1397,7 @@ public static void vertexAttribI3iv(int index, MemorySegment v) { } public static void vertexAttribI3iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI3iv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI3iv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI3ui(int index, int x, int y, int z) { @@ -1419,7 +1419,7 @@ public static void vertexAttribI3uiv(int index, MemorySegment v) { } public static void vertexAttribI3uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI3uiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI3uiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI4bv(int index, MemorySegment v) { @@ -1432,7 +1432,7 @@ public static void vertexAttribI4bv(int index, MemorySegment v) { } public static void vertexAttribI4bv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttribI4bv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttribI4bv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttribI4i(int index, int x, int y, int z, int w) { @@ -1454,7 +1454,7 @@ public static void vertexAttribI4iv(int index, MemorySegment v) { } public static void vertexAttribI4iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI4iv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI4iv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI4sv(int index, MemorySegment v) { @@ -1467,7 +1467,7 @@ public static void vertexAttribI4sv(int index, MemorySegment v) { } public static void vertexAttribI4sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttribI4sv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttribI4sv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttribI4ubv(int index, MemorySegment v) { @@ -1480,7 +1480,7 @@ public static void vertexAttribI4ubv(int index, MemorySegment v) { } public static void vertexAttribI4ubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttribI4ubv(index, allocator.allocateArray(JAVA_BYTE, v)); + vertexAttribI4ubv(index, allocator.allocateFrom(JAVA_BYTE, v)); } public static void vertexAttribI4ui(int index, int x, int y, int z, int w) { @@ -1502,7 +1502,7 @@ public static void vertexAttribI4uiv(int index, MemorySegment v) { } public static void vertexAttribI4uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI4uiv(index, allocator.allocateArray(JAVA_INT, v)); + vertexAttribI4uiv(index, allocator.allocateFrom(JAVA_INT, v)); } public static void vertexAttribI4usv(int index, MemorySegment v) { @@ -1515,7 +1515,7 @@ public static void vertexAttribI4usv(int index, MemorySegment v) { } public static void vertexAttribI4usv(SegmentAllocator allocator, int index, short[] v) { - vertexAttribI4usv(index, allocator.allocateArray(JAVA_SHORT, v)); + vertexAttribI4usv(index, allocator.allocateFrom(JAVA_SHORT, v)); } public static void vertexAttribIPointer(int index, int size, int type, int stride, MemorySegment pointer) { @@ -1528,14 +1528,14 @@ public static void vertexAttribIPointer(int index, int size, int type, int strid } public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, byte[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateArray(JAVA_BYTE, pointer)); + vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); } public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, short[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateArray(JAVA_SHORT, pointer)); + vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); } public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, int[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateArray(JAVA_INT, pointer)); + vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL31C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL31C.java index 180e6cb3..9d7c1e63 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL31C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL31C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -155,15 +155,15 @@ public static void drawElementsInstanced(int mode, int count, int type, MemorySe } public static void drawElementsInstanced(SegmentAllocator allocator, int mode, int count, int type, byte[] indices, int instanceCount) { - drawElementsInstanced(mode, count, type, allocator.allocateArray(JAVA_BYTE, indices), instanceCount); + drawElementsInstanced(mode, count, type, allocator.allocateFrom(JAVA_BYTE, indices), instanceCount); } public static void drawElementsInstanced(SegmentAllocator allocator, int mode, int count, int type, short[] indices, int instanceCount) { - drawElementsInstanced(mode, count, type, allocator.allocateArray(JAVA_SHORT, indices), instanceCount); + drawElementsInstanced(mode, count, type, allocator.allocateFrom(JAVA_SHORT, indices), instanceCount); } public static void drawElementsInstanced(SegmentAllocator allocator, int mode, int count, int type, int[] indices, int instanceCount) { - drawElementsInstanced(mode, count, type, allocator.allocateArray(JAVA_INT, indices), instanceCount); + drawElementsInstanced(mode, count, type, allocator.allocateFrom(JAVA_INT, indices), instanceCount); } public static void getActiveUniformBlockName(int program, int uniformBlockIndex, int bufSize, MemorySegment length, MemorySegment uniformBlockName) { @@ -177,18 +177,18 @@ public static void getActiveUniformBlockName(int program, int uniformBlockIndex, public static void getActiveUniformBlockName(SegmentAllocator allocator, int program, int uniformBlockIndex, int bufSize, int @Nullable [] length, String[] uniformBlockName) { var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniformBlockName(program, uniformBlockIndex, bufSize, pLen, pName); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - uniformBlockName[0] = pName.getUtf8String(0); + uniformBlockName[0] = pName.getString(0); } public static String getActiveUniformBlockName(SegmentAllocator allocator, int program, int uniformBlockIndex, int bufSize) { - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniformBlockName(program, uniformBlockIndex, bufSize, MemorySegment.NULL, pName); - return pName.getUtf8String(0); + return pName.getString(0); } public static void getActiveUniformBlockiv(int program, int uniformBlockIndex, int pname, MemorySegment params) { @@ -201,7 +201,7 @@ public static void getActiveUniformBlockiv(int program, int uniformBlockIndex, i } public static void getActiveUniformBlockiv(SegmentAllocator allocator, int program, int uniformBlockIndex, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getActiveUniformBlockiv(program, uniformBlockIndex, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -217,18 +217,18 @@ public static void getActiveUniformName(int program, int uniformIndex, int bufSi public static void getActiveUniformName(SegmentAllocator allocator, int program, int uniformIndex, int bufSize, int @Nullable [] length, String[] uniformName) { var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniformName(program, uniformIndex, bufSize, pLen, pName); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - uniformName[0] = pName.getUtf8String(0); + uniformName[0] = pName.getString(0); } public static String getActiveUniformName(SegmentAllocator allocator, int program, int uniformIndex, int bufSize) { - var pName = allocator.allocateArray(JAVA_BYTE, bufSize); + var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniformName(program, uniformIndex, bufSize, MemorySegment.NULL, pName); - return pName.getUtf8String(0); + return pName.getString(0); } public static void getActiveUniformsiv(int program, int uniformCount, MemorySegment uniformIndices, int pname, MemorySegment params) { @@ -241,9 +241,8 @@ public static void getActiveUniformsiv(int program, int uniformCount, MemorySegm } public static void getActiveUniformsiv(SegmentAllocator allocator, int program, int[] uniformIndices, int pname, int[] params) { - final int count = uniformIndices.length; - var seg = allocator.allocateArray(JAVA_INT, count); - getActiveUniformsiv(program, count, allocator.allocateArray(JAVA_INT, uniformIndices), pname, seg); + var seg = allocator.allocateFrom(JAVA_INT, params); + getActiveUniformsiv(program, uniformIndices.length, allocator.allocateFrom(JAVA_INT, uniformIndices), pname, seg); RuntimeHelper.toArray(seg, params); } @@ -289,11 +288,11 @@ public static void getUniformIndices(int program, int uniformCount, MemorySegmen public static void getUniformIndices(SegmentAllocator allocator, int program, String[] uniformNames, int[] uniformIndices) { final int count = uniformNames.length; - var pNames = allocator.allocateArray(ADDRESS, count); + var pNames = allocator.allocate(ADDRESS, count); for (int i = 0; i < count; i++) { pNames.setAtIndex(ADDRESS, i, allocator.allocateFrom(uniformNames[i])); } - var pIndices = allocator.allocateArray(JAVA_INT, count); + var pIndices = allocator.allocate(JAVA_INT, count); getUniformIndices(program, count, pNames, pIndices); RuntimeHelper.toArray(pIndices, uniformIndices); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL32C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL32C.java index 318fdc5c..83adbc16 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL32C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL32C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -163,15 +163,15 @@ public static void drawElementsBaseVertex(int mode, int count, int type, MemoryS } public static void drawElementsBaseVertex(SegmentAllocator allocator, int mode, int count, int type, byte[] indices, int baseVertex) { - drawElementsBaseVertex(mode, count, type, allocator.allocateArray(JAVA_BYTE, indices), baseVertex); + drawElementsBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_BYTE, indices), baseVertex); } public static void drawElementsBaseVertex(SegmentAllocator allocator, int mode, int count, int type, short[] indices, int baseVertex) { - drawElementsBaseVertex(mode, count, type, allocator.allocateArray(JAVA_SHORT, indices), baseVertex); + drawElementsBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_SHORT, indices), baseVertex); } public static void drawElementsBaseVertex(SegmentAllocator allocator, int mode, int count, int type, int[] indices, int baseVertex) { - drawElementsBaseVertex(mode, count, type, allocator.allocateArray(JAVA_INT, indices), baseVertex); + drawElementsBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_INT, indices), baseVertex); } public static void drawElementsInstancedBaseVertex(int mode, int count, int type, MemorySegment indices, int instanceCount, int baseVertex) { @@ -184,15 +184,15 @@ public static void drawElementsInstancedBaseVertex(int mode, int count, int type } public static void drawElementsInstancedBaseVertex(SegmentAllocator allocator, int mode, int count, int type, byte[] indices, int instanceCount, int baseVertex) { - drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateArray(JAVA_BYTE, indices), instanceCount, baseVertex); + drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_BYTE, indices), instanceCount, baseVertex); } public static void drawElementsInstancedBaseVertex(SegmentAllocator allocator, int mode, int count, int type, short[] indices, int instanceCount, int baseVertex) { - drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateArray(JAVA_SHORT, indices), instanceCount, baseVertex); + drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_SHORT, indices), instanceCount, baseVertex); } public static void drawElementsInstancedBaseVertex(SegmentAllocator allocator, int mode, int count, int type, int[] indices, int instanceCount, int baseVertex) { - drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateArray(JAVA_INT, indices), instanceCount, baseVertex); + drawElementsInstancedBaseVertex(mode, count, type, allocator.allocateFrom(JAVA_INT, indices), instanceCount, baseVertex); } public static void drawRangeElementsBaseVertex(int mode, int start, int end, int count, int type, MemorySegment indices, int baseVertex) { @@ -205,15 +205,15 @@ public static void drawRangeElementsBaseVertex(int mode, int start, int end, int } public static void drawRangeElementsBaseVertex(SegmentAllocator allocator, int mode, int start, int end, int count, int type, byte[] indices, int baseVertex) { - drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateArray(JAVA_BYTE, indices), baseVertex); + drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateFrom(JAVA_BYTE, indices), baseVertex); } public static void drawRangeElementsBaseVertex(SegmentAllocator allocator, int mode, int start, int end, int count, int type, short[] indices, int baseVertex) { - drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateArray(JAVA_SHORT, indices), baseVertex); + drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateFrom(JAVA_SHORT, indices), baseVertex); } public static void drawRangeElementsBaseVertex(SegmentAllocator allocator, int mode, int start, int end, int count, int type, int[] indices, int baseVertex) { - drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateArray(JAVA_INT, indices), baseVertex); + drawRangeElementsBaseVertex(mode, start, end, count, type, allocator.allocateFrom(JAVA_INT, indices), baseVertex); } public static MemorySegment fenceSync(int condition, int flags) { @@ -265,7 +265,7 @@ public static void getInteger64i_v(int target, int index, MemorySegment data) { } public static void getInteger64i_v(SegmentAllocator allocator, int target, int index, long[] data) { - var seg = allocator.allocateArray(JAVA_LONG, data.length); + var seg = allocator.allocateFrom(JAVA_LONG, data); getInteger64i_v(target, index, seg); RuntimeHelper.toArray(seg, data); } @@ -292,7 +292,7 @@ public static void getInteger64v(int pname, MemorySegment data) { } public static void getInteger64v(SegmentAllocator allocator, int pname, long[] data) { - var pData = allocator.allocateArray(JAVA_LONG, data.length); + var pData = allocator.allocateFrom(JAVA_LONG, data); getInteger64v(pname, pData); RuntimeHelper.toArray(pData, data); } @@ -319,13 +319,13 @@ public static void getMultisamplefv(int pname, int index, MemorySegment val) { } public static void getMultisamplefv(SegmentAllocator allocator, int pname, int index, float[] val) { - var seg = allocator.allocateArray(JAVA_FLOAT, val.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, val); getMultisamplefv(pname, index, seg); RuntimeHelper.toArray(seg, val); } public static float[] getMultisamplefv(SegmentAllocator allocator, int pname, int index) { - var seg = allocator.allocateArray(JAVA_FLOAT, 2); + var seg = allocator.allocate(JAVA_FLOAT, 2); getMultisamplefv(pname, index, seg); return new float[]{seg.get(JAVA_FLOAT, 0), seg.getAtIndex(JAVA_FLOAT, 1)}; } @@ -341,7 +341,7 @@ public static void getSynciv(MemorySegment sync, int pname, int count, MemorySeg public static void getSynciv(SegmentAllocator allocator, MemorySegment sync, int pname, int @Nullable [] length, int[] values) { var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pVal = allocator.allocateArray(JAVA_INT, values.length); + var pVal = allocator.allocateFrom(JAVA_INT, values); getSynciv(sync, pname, values.length, pLen, pVal); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); @@ -380,35 +380,35 @@ public static void multiDrawElementsBaseVertex(int mode, MemorySegment count, in } public static void multiDrawElementsBaseVertex(SegmentAllocator allocator, int mode, int[] count, int type, MemorySegment[] indices, int drawCount, int[] baseVertex) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { seg.setAtIndex(ADDRESS, i, indices[i]); } - multiDrawElementsBaseVertex(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount, allocator.allocateArray(JAVA_INT, baseVertex)); + multiDrawElementsBaseVertex(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount, allocator.allocateFrom(JAVA_INT, baseVertex)); } public static void multiDrawElementsBaseVertex(SegmentAllocator allocator, int mode, int[] count, int type, byte[][] indices, int drawCount, int[] baseVertex) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_BYTE, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_BYTE, indices[i])); } - multiDrawElementsBaseVertex(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount, allocator.allocateArray(JAVA_INT, baseVertex)); + multiDrawElementsBaseVertex(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount, allocator.allocateFrom(JAVA_INT, baseVertex)); } public static void multiDrawElementsBaseVertex(SegmentAllocator allocator, int mode, int[] count, int type, short[][] indices, int drawCount, int[] baseVertex) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_SHORT, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_SHORT, indices[i])); } - multiDrawElementsBaseVertex(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount, allocator.allocateArray(JAVA_INT, baseVertex)); + multiDrawElementsBaseVertex(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount, allocator.allocateFrom(JAVA_INT, baseVertex)); } public static void multiDrawElementsBaseVertex(SegmentAllocator allocator, int mode, int[] count, int type, int[][] indices, int drawCount, int[] baseVertex) { - var seg = allocator.allocateArray(ADDRESS, indices.length); + var seg = allocator.allocate(ADDRESS, indices.length); for (int i = 0; i < indices.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateArray(JAVA_INT, indices[i])); + seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(JAVA_INT, indices[i])); } - multiDrawElementsBaseVertex(mode, allocator.allocateArray(JAVA_INT, count), type, seg, drawCount, allocator.allocateArray(JAVA_INT, baseVertex)); + multiDrawElementsBaseVertex(mode, allocator.allocateFrom(JAVA_INT, count), type, seg, drawCount, allocator.allocateFrom(JAVA_INT, baseVertex)); } public static void provokingVertex(int mode) { diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL33C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL33C.java index ee209fb3..9f6ebca3 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL33C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL33C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -137,7 +137,7 @@ public static void deleteSamplers(int count, MemorySegment samplers) { } public static void deleteSamplers(SegmentAllocator allocator, int[] samplers) { - deleteSamplers(samplers.length, allocator.allocateArray(JAVA_INT, samplers)); + deleteSamplers(samplers.length, allocator.allocateFrom(JAVA_INT, samplers)); } public static void deleteSampler(int sampler) { @@ -160,7 +160,7 @@ public static void genSamplers(int count, MemorySegment samplers) { } public static void genSamplers(SegmentAllocator allocator, int[] samplers) { - var seg = allocator.allocateArray(JAVA_INT, samplers.length); + var seg = allocator.allocateFrom(JAVA_INT, samplers); genSamplers(samplers.length, seg); RuntimeHelper.toArray(seg, samplers); } @@ -248,7 +248,7 @@ public static void getSamplerParameterIiv(int sampler, int pname, MemorySegment } public static void getSamplerParameterIiv(SegmentAllocator allocator, int sampler, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getSamplerParameterIiv(sampler, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -275,7 +275,7 @@ public static void getSamplerParameterIuiv(int sampler, int pname, MemorySegment } public static void getSamplerParameterIuiv(SegmentAllocator allocator, int sampler, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getSamplerParameterIuiv(sampler, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -302,7 +302,7 @@ public static void getSamplerParameterfv(int sampler, int pname, MemorySegment p } public static void getSamplerParameterfv(SegmentAllocator allocator, int sampler, int pname, float[] params) { - var seg = allocator.allocateArray(JAVA_FLOAT, params.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, params); getSamplerParameterfv(sampler, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -329,7 +329,7 @@ public static void getSamplerParameteriv(int sampler, int pname, MemorySegment p } public static void getSamplerParameteriv(SegmentAllocator allocator, int sampler, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getSamplerParameteriv(sampler, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -374,7 +374,7 @@ public static void samplerParameterIiv(int sampler, int pname, MemorySegment par } public static void samplerParameterIiv(SegmentAllocator allocator, int sampler, int pname, int[] param) { - samplerParameterIiv(sampler, pname, allocator.allocateArray(JAVA_INT, param)); + samplerParameterIiv(sampler, pname, allocator.allocateFrom(JAVA_INT, param)); } public static void samplerParameterIuiv(int sampler, int pname, MemorySegment param) { @@ -387,7 +387,7 @@ public static void samplerParameterIuiv(int sampler, int pname, MemorySegment pa } public static void samplerParameterIuiv(SegmentAllocator allocator, int sampler, int pname, int[] param) { - samplerParameterIuiv(sampler, pname, allocator.allocateArray(JAVA_INT, param)); + samplerParameterIuiv(sampler, pname, allocator.allocateFrom(JAVA_INT, param)); } public static void samplerParameterf(int sampler, int pname, int param) { @@ -409,7 +409,7 @@ public static void samplerParameterfv(int sampler, int pname, MemorySegment para } public static void samplerParameterfv(SegmentAllocator allocator, int sampler, int pname, int[] param) { - samplerParameterfv(sampler, pname, allocator.allocateArray(JAVA_INT, param)); + samplerParameterfv(sampler, pname, allocator.allocateFrom(JAVA_INT, param)); } public static void samplerParameteri(int sampler, int pname, int param) { @@ -431,7 +431,7 @@ public static void samplerParameteriv(int sampler, int pname, MemorySegment para } public static void samplerParameteriv(SegmentAllocator allocator, int sampler, int pname, int[] param) { - samplerParameteriv(sampler, pname, allocator.allocateArray(JAVA_INT, param)); + samplerParameteriv(sampler, pname, allocator.allocateFrom(JAVA_INT, param)); } public static void vertexAttribDivisor(int index, int divisor) { @@ -462,7 +462,7 @@ public static void vertexAttribP1uiv(int index, int type, boolean normalized, Me } public static void vertexAttribP1uiv(SegmentAllocator allocator, int index, int type, boolean normalized, int[] value) { - vertexAttribP1uiv(index, type, normalized, allocator.allocateArray(JAVA_INT, value)); + vertexAttribP1uiv(index, type, normalized, allocator.allocateFrom(JAVA_INT, value)); } public static void vertexAttribP2ui(int index, int type, boolean normalized, int value) { @@ -484,7 +484,7 @@ public static void vertexAttribP2uiv(int index, int type, boolean normalized, Me } public static void vertexAttribP2uiv(SegmentAllocator allocator, int index, int type, boolean normalized, int[] value) { - vertexAttribP2uiv(index, type, normalized, allocator.allocateArray(JAVA_INT, value)); + vertexAttribP2uiv(index, type, normalized, allocator.allocateFrom(JAVA_INT, value)); } public static void vertexAttribP3ui(int index, int type, boolean normalized, int value) { @@ -506,7 +506,7 @@ public static void vertexAttribP3uiv(int index, int type, boolean normalized, Me } public static void vertexAttribP3uiv(SegmentAllocator allocator, int index, int type, boolean normalized, int[] value) { - vertexAttribP3uiv(index, type, normalized, allocator.allocateArray(JAVA_INT, value)); + vertexAttribP3uiv(index, type, normalized, allocator.allocateFrom(JAVA_INT, value)); } public static void vertexAttribP4ui(int index, int type, boolean normalized, int value) { @@ -528,6 +528,6 @@ public static void vertexAttribP4uiv(int index, int type, boolean normalized, Me } public static void vertexAttribP4uiv(SegmentAllocator allocator, int index, int type, boolean normalized, int[] value) { - vertexAttribP4uiv(index, type, normalized, allocator.allocateArray(JAVA_INT, value)); + vertexAttribP4uiv(index, type, normalized, allocator.allocateFrom(JAVA_INT, value)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL40C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL40C.java index a13dad7c..c1a36a3a 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL40C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL40C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -253,7 +253,7 @@ public static void deleteTransformFeedbacks(int n, MemorySegment ids) { } public static void deleteTransformFeedbacks(SegmentAllocator allocator, int[] ids) { - deleteTransformFeedbacks(ids.length, allocator.allocateArray(JAVA_INT, ids)); + deleteTransformFeedbacks(ids.length, allocator.allocateFrom(JAVA_INT, ids)); } public static void deleteTransformFeedback(int id) { @@ -280,7 +280,7 @@ public static void drawArraysIndirect(int mode, DrawArraysIndirectCommand indire } public static void drawArraysIndirect(SegmentAllocator allocator, int mode, int[] indirect) { - drawArraysIndirect(mode, allocator.allocateArray(JAVA_INT, indirect)); + drawArraysIndirect(mode, allocator.allocateFrom(JAVA_INT, indirect)); } public static void drawElementsIndirect(int mode, int type, MemorySegment indirect) { @@ -297,7 +297,7 @@ public static void drawElementsIndirect(int mode, int type, DrawElementsIndirect } public static void drawElementsIndirect(SegmentAllocator allocator, int mode, int type, int[] indirect) { - drawElementsIndirect(mode, type, allocator.allocateArray(JAVA_INT, indirect)); + drawElementsIndirect(mode, type, allocator.allocateFrom(JAVA_INT, indirect)); } public static void drawTransformFeedback(int mode, int id) { @@ -337,7 +337,7 @@ public static void genTransformFeedbacks(int n, MemorySegment ids) { } public static void genTransformFeedbacks(SegmentAllocator allocator, int[] ids) { - var seg = allocator.allocateArray(JAVA_INT, ids.length); + var seg = allocator.allocateFrom(JAVA_INT, ids); genTransformFeedbacks(ids.length, seg); RuntimeHelper.toArray(seg, ids); } @@ -364,9 +364,9 @@ public static void getActiveSubroutineName(int program, int shaderType, int inde } public static String getActiveSubroutineName(SegmentAllocator allocator, int program, int shaderType, int index, int bufSize) { - var seg = allocator.allocateArray(JAVA_BYTE, bufSize); + var seg = allocator.allocate(JAVA_BYTE, bufSize); getActiveSubroutineName(program, shaderType, index, bufSize, MemorySegment.NULL, seg); - return seg.getUtf8String(0); + return seg.getString(0); } public static void getActiveSubroutineUniformName(int program, int shaderType, int index, int bufSize, MemorySegment length, MemorySegment name) { @@ -379,9 +379,9 @@ public static void getActiveSubroutineUniformName(int program, int shaderType, i } public static String getActiveSubroutineUniformName(SegmentAllocator allocator, int program, int shaderType, int index, int bufSize) { - var seg = allocator.allocateArray(JAVA_BYTE, bufSize); + var seg = allocator.allocate(JAVA_BYTE, bufSize); getActiveSubroutineUniformName(program, shaderType, index, bufSize, MemorySegment.NULL, seg); - return seg.getUtf8String(0); + return seg.getString(0); } public static void getActiveSubroutineUniformiv(int program, int shaderType, int index, int pname, MemorySegment values) { @@ -394,7 +394,7 @@ public static void getActiveSubroutineUniformiv(int program, int shaderType, int } public static void getActiveSubroutineUniformiv(SegmentAllocator allocator, int program, int shaderType, int index, int pname, int[] values) { - var seg = allocator.allocateArray(JAVA_INT, values.length); + var seg = allocator.allocateFrom(JAVA_INT, values); getActiveSubroutineUniformiv(program, shaderType, index, pname, seg); RuntimeHelper.toArray(seg, values); } @@ -501,7 +501,7 @@ public static void getUniformSubroutineuiv(int shaderType, int location, MemoryS } public static void getUniformSubroutineuiv(SegmentAllocator allocator, int shaderType, int location, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getUniformSubroutineuiv(shaderType, location, seg); RuntimeHelper.toArray(seg, params); } @@ -516,7 +516,7 @@ public static void getUniformdv(int program, int location, MemorySegment params) } public static void getUniformdv(SegmentAllocator allocator, int program, int location, double[] params) { - var seg = allocator.allocateArray(JAVA_DOUBLE, params.length); + var seg = allocator.allocateFrom(JAVA_DOUBLE, params); getUniformdv(program, location, seg); RuntimeHelper.toArray(seg, params); } @@ -561,7 +561,7 @@ public static void patchParameterfv(int pname, MemorySegment values) { } public static void patchParameterfv(SegmentAllocator allocator, int pname, float[] values) { - patchParameterfv(pname, allocator.allocateArray(JAVA_FLOAT, values)); + patchParameterfv(pname, allocator.allocateFrom(JAVA_FLOAT, values)); } public static void patchParameteri(int pname, int value) { @@ -610,7 +610,7 @@ public static void uniform1dv(int location, int count, MemorySegment value) { } public static void uniform1dv(SegmentAllocator allocator, int location, double[] value) { - uniform1dv(location, value.length, allocator.allocateArray(JAVA_DOUBLE, value)); + uniform1dv(location, value.length, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniform2d(int location, double x, double y) { @@ -632,7 +632,7 @@ public static void uniform2dv(int location, int count, MemorySegment value) { } public static void uniform2dv(SegmentAllocator allocator, int location, double[] value) { - uniform2dv(location, value.length >> 1, allocator.allocateArray(JAVA_DOUBLE, value)); + uniform2dv(location, value.length >> 1, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniform3d(int location, double x, double y, double z) { @@ -654,7 +654,7 @@ public static void uniform3dv(int location, int count, MemorySegment value) { } public static void uniform3dv(SegmentAllocator allocator, int location, double[] value) { - uniform3dv(location, value.length / 3, allocator.allocateArray(JAVA_DOUBLE, value)); + uniform3dv(location, value.length / 3, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniform4d(int location, double x, double y, double z, double w) { @@ -676,7 +676,7 @@ public static void uniform4dv(int location, int count, MemorySegment value) { } public static void uniform4dv(SegmentAllocator allocator, int location, double[] value) { - uniform4dv(location, value.length >> 2, allocator.allocateArray(JAVA_DOUBLE, value)); + uniform4dv(location, value.length >> 2, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix2dv(int location, int count, boolean transpose, MemorySegment value) { @@ -689,7 +689,7 @@ public static void uniformMatrix2dv(int location, int count, boolean transpose, } public static void uniformMatrix2dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix2dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix2dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix2dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -706,7 +706,7 @@ public static void uniformMatrix2x3dv(int location, int count, boolean transpose } public static void uniformMatrix2x3dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix2x3dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix2x3dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix2x3dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -723,7 +723,7 @@ public static void uniformMatrix2x4dv(int location, int count, boolean transpose } public static void uniformMatrix2x4dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix2x4dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix2x4dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix2x4dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -740,7 +740,7 @@ public static void uniformMatrix3dv(int location, int count, boolean transpose, } public static void uniformMatrix3dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix3dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix3dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix3dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -757,7 +757,7 @@ public static void uniformMatrix3x2dv(int location, int count, boolean transpose } public static void uniformMatrix3x2dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix3x2dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix3x2dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix3x2dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -774,7 +774,7 @@ public static void uniformMatrix3x4dv(int location, int count, boolean transpose } public static void uniformMatrix3x4dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix3x4dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix3x4dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix3x4dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -791,7 +791,7 @@ public static void uniformMatrix4dv(int location, int count, boolean transpose, } public static void uniformMatrix4dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix4dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix4dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix4dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -808,7 +808,7 @@ public static void uniformMatrix4x2dv(int location, int count, boolean transpose } public static void uniformMatrix4x2dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix4x2dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix4x2dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix4x2dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -825,7 +825,7 @@ public static void uniformMatrix4x3dv(int location, int count, boolean transpose } public static void uniformMatrix4x3dv(SegmentAllocator allocator, int location, int count, boolean transpose, double[] value) { - uniformMatrix4x3dv(location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value)); + uniformMatrix4x3dv(location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); } public static void uniformMatrix4x3dv(SegmentAllocator allocator, int location, boolean transpose, double[] value) { @@ -842,6 +842,6 @@ public static void uniformSubroutinesuiv(int shaderType, int count, MemorySegmen } public static void uniformSubroutinesuiv(SegmentAllocator allocator, int shaderType, int[] indices) { - uniformSubroutinesuiv(shaderType, indices.length, allocator.allocateArray(JAVA_INT, indices)); + uniformSubroutinesuiv(shaderType, indices.length, allocator.allocateFrom(JAVA_INT, indices)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL42C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL42C.java index 950b0073..b405e452 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL42C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL42C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -206,15 +206,15 @@ public static void drawElementsInstancedBaseInstance(int mode, int count, int ty } public static void drawElementsInstancedBaseInstance(SegmentAllocator allocator, int mode, int count, int type, byte[] indices, int instanceCount, int baseInstance) { - drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateArray(JAVA_BYTE, indices), instanceCount, baseInstance); + drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_BYTE, indices), instanceCount, baseInstance); } public static void drawElementsInstancedBaseInstance(SegmentAllocator allocator, int mode, int count, int type, short[] indices, int instanceCount, int baseInstance) { - drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateArray(JAVA_SHORT, indices), instanceCount, baseInstance); + drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_SHORT, indices), instanceCount, baseInstance); } public static void drawElementsInstancedBaseInstance(SegmentAllocator allocator, int mode, int count, int type, int[] indices, int instanceCount, int baseInstance) { - drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateArray(JAVA_INT, indices), instanceCount, baseInstance); + drawElementsInstancedBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_INT, indices), instanceCount, baseInstance); } public static void drawElementsInstancedBaseVertexBaseInstance(int mode, int count, int type, MemorySegment indices, int instanceCount, int baseVertex, int baseInstance) { @@ -227,15 +227,15 @@ public static void drawElementsInstancedBaseVertexBaseInstance(int mode, int cou } public static void drawElementsInstancedBaseVertexBaseInstance(SegmentAllocator allocator, int mode, int count, int type, byte[] indices, int instanceCount, int baseVertex, int baseInstance) { - drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateArray(JAVA_BYTE, indices), instanceCount, baseVertex, baseInstance); + drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_BYTE, indices), instanceCount, baseVertex, baseInstance); } public static void drawElementsInstancedBaseVertexBaseInstance(SegmentAllocator allocator, int mode, int count, int type, short[] indices, int instanceCount, int baseVertex, int baseInstance) { - drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateArray(JAVA_SHORT, indices), instanceCount, baseVertex, baseInstance); + drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_SHORT, indices), instanceCount, baseVertex, baseInstance); } public static void drawElementsInstancedBaseVertexBaseInstance(SegmentAllocator allocator, int mode, int count, int type, int[] indices, int instanceCount, int baseVertex, int baseInstance) { - drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateArray(JAVA_INT, indices), instanceCount, baseVertex, baseInstance); + drawElementsInstancedBaseVertexBaseInstance(mode, count, type, allocator.allocateFrom(JAVA_INT, indices), instanceCount, baseVertex, baseInstance); } public static void drawTransformFeedbackInstanced(int mode, int id, int instanceCount) { @@ -266,7 +266,7 @@ public static void getActiveAtomicCounterBufferiv(int program, int bufferIndex, } public static void getActiveAtomicCounterBufferiv(SegmentAllocator allocator, int program, int bufferIndex, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getActiveAtomicCounterBufferiv(program, bufferIndex, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -293,7 +293,7 @@ public static void getInternalformativ(int target, int internalFormat, int pname } public static void getInternalformativ(SegmentAllocator allocator, int target, int internalFormat, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getInternalformativ(target, internalFormat, pname, params.length, seg); RuntimeHelper.toArray(seg, params); } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL43C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL43C.java index 3218077d..94d70f19 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL43C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL43C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -432,7 +432,7 @@ public static void debugMessageControl(int source, int type, int severity, int c } public static void debugMessageControl(SegmentAllocator allocator, int source, int type, int severity, int count, int[] ids, boolean enabled) { - debugMessageControl(source, type, severity, count, allocator.allocateArray(JAVA_INT, ids), enabled); + debugMessageControl(source, type, severity, count, allocator.allocateFrom(JAVA_INT, ids), enabled); } public static void debugMessageInsert(int source, int type, int id, int severity, int length, MemorySegment buf) { @@ -495,19 +495,19 @@ public static int getDebugMessageLog(int count, MemorySegment sources, MemorySeg } public static int getDebugMessageLog(SegmentAllocator allocator, int count, int bufSize, int[] sources, int[] types, int[] ids, int[] severities, int[] lengths, String[] messageLog) { - var pSrc = allocator.allocateArray(JAVA_INT, sources.length); - var pTypes = allocator.allocateArray(JAVA_INT, types.length); - var pIds = allocator.allocateArray(JAVA_INT, ids.length); - var pSvr = allocator.allocateArray(JAVA_INT, severities.length); - var pLen = allocator.allocateArray(JAVA_INT, lengths.length); - var pLog = allocator.allocateArray(JAVA_BYTE, bufSize); + var pSrc = allocator.allocateFrom(JAVA_INT, sources); + var pTypes = allocator.allocateFrom(JAVA_INT, types); + var pIds = allocator.allocateFrom(JAVA_INT, ids); + var pSvr = allocator.allocateFrom(JAVA_INT, severities); + var pLen = allocator.allocateFrom(JAVA_INT, lengths); + var pLog = allocator.allocate(JAVA_BYTE, bufSize); int num = getDebugMessageLog(count, bufSize, pSrc, pTypes, pIds, pSvr, pLen, pLog); RuntimeHelper.toArray(pSrc, sources); RuntimeHelper.toArray(pTypes, types); RuntimeHelper.toArray(pIds, ids); RuntimeHelper.toArray(pSvr, severities); RuntimeHelper.toArray(pLen, lengths); - messageLog[0] = pLog.getUtf8String(0); + messageLog[0] = pLog.getString(0); return num; } @@ -542,7 +542,7 @@ public static void getInternalformati64v(int target, int internalFormat, int pna } public static void getInternalformati64v(SegmentAllocator allocator, int target, int internalFormat, int pname, long[] params) { - var seg = allocator.allocateArray(JAVA_LONG, params.length); + var seg = allocator.allocateFrom(JAVA_LONG, params); getInternalformati64v(target, internalFormat, pname, params.length, seg); RuntimeHelper.toArray(seg, params); } @@ -573,13 +573,13 @@ public static void getObjectLabel(int identifier, int name, MemorySegment length } public static String getObjectLabel(SegmentAllocator allocator, int identifier, int name, int bufSize, int @Nullable [] length) { - var seg = allocator.allocateArray(JAVA_BYTE, bufSize); + var seg = allocator.allocate(JAVA_BYTE, bufSize); var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; getObjectLabel(identifier, name, bufSize, seg, pLen); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return seg.getUtf8String(0); + return seg.getString(0); } public static String getObjectLabel(SegmentAllocator allocator, int identifier, int name, int @Nullable [] length) { @@ -600,13 +600,13 @@ public static void getObjectPtrLabel(MemorySegment ptr, MemorySegment length, Me } public static String getObjectPtrLabel(SegmentAllocator allocator, MemorySegment ptr, int bufSize, int @Nullable [] length) { - var seg = allocator.allocateArray(JAVA_BYTE, bufSize); + var seg = allocator.allocate(JAVA_BYTE, bufSize); var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; getObjectPtrLabel(ptr, bufSize, seg, pLen); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return seg.getUtf8String(0); + return seg.getString(0); } public static String getObjectPtrLabel(SegmentAllocator allocator, MemorySegment ptr, int @Nullable [] length) { @@ -705,13 +705,13 @@ public static void getProgramResourceName(int program, int programInterface, int } public static String getProgramResourceName(SegmentAllocator allocator, int program, int programInterface, int index, int bufSize, int @Nullable [] length) { - var seg = allocator.allocateArray(JAVA_BYTE, bufSize); + var seg = allocator.allocate(JAVA_BYTE, bufSize); var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; getProgramResourceName(program, programInterface, index, bufSize, pLen, seg); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } - return seg.getUtf8String(0); + return seg.getString(0); } public static String getProgramResourceName(SegmentAllocator allocator, int program, int programInterface, int index, int @Nullable [] length) { @@ -732,9 +732,9 @@ public static void getProgramResourceiv(int program, int programInterface, int i } public static void getProgramResourceiv(SegmentAllocator allocator, int program, int programInterface, int index, int[] props, int @Nullable [] length, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - getProgramResourceiv(program, programInterface, index, props.length, allocator.allocateArray(JAVA_INT, props), params.length, pLen, seg); + getProgramResourceiv(program, programInterface, index, props.length, allocator.allocateFrom(JAVA_INT, props), params.length, pLen, seg); if (length != null && length.length > 0) { length[0] = pLen.get(JAVA_INT, 0); } @@ -743,7 +743,7 @@ public static void getProgramResourceiv(SegmentAllocator allocator, int program, public static int getProgramResourceiv(SegmentAllocator allocator, int program, int programInterface, int index, int[] props) { var seg = allocator.allocate(JAVA_INT); - getProgramResourceiv(program, programInterface, index, props.length, allocator.allocateArray(JAVA_INT, props), 1, MemorySegment.NULL, seg); + getProgramResourceiv(program, programInterface, index, props.length, allocator.allocateFrom(JAVA_INT, props), 1, MemorySegment.NULL, seg); return seg.get(JAVA_INT, 0); } @@ -775,7 +775,7 @@ public static void invalidateFramebuffer(int target, int numAttachments, MemoryS } public static void invalidateFramebuffer(SegmentAllocator allocator, int target, int[] attachments) { - invalidateFramebuffer(target, attachments.length, allocator.allocateArray(JAVA_INT, attachments)); + invalidateFramebuffer(target, attachments.length, allocator.allocateFrom(JAVA_INT, attachments)); } public static void invalidateFramebuffer(int target, int attachment) { @@ -798,7 +798,7 @@ public static void invalidateSubFramebuffer(int target, int numAttachments, Memo } public static void invalidateSubFramebuffer(SegmentAllocator allocator, int target, int[] attachments, int x, int y, int width, int height) { - invalidateSubFramebuffer(target, attachments.length, allocator.allocateArray(JAVA_INT, attachments), x, y, width, height); + invalidateSubFramebuffer(target, attachments.length, allocator.allocateFrom(JAVA_INT, attachments), x, y, width, height); } public static void invalidateSubFramebuffer(int target, int attachment, int x, int y, int width, int height) { diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL44C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL44C.java index ffc67f46..9ffb207a 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL44C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL44C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -84,7 +84,7 @@ public static void bindBuffersBase(int target, int first, int count, MemorySegme } public static void bindBuffersBase(SegmentAllocator allocator, int target, int first, int count, int[] buffers) { - bindBuffersBase(target, first, count, allocator.allocateArray(JAVA_INT, buffers)); + bindBuffersBase(target, first, count, allocator.allocateFrom(JAVA_INT, buffers)); } public static void bindBuffersRange(int target, int first, int count, MemorySegment buffers, MemorySegment offsets, MemorySegment sizes) { @@ -97,7 +97,7 @@ public static void bindBuffersRange(int target, int first, int count, MemorySegm } public static void bindBuffersRange(SegmentAllocator allocator, int target, int first, int count, int[] buffers, long[] offsets, long[] sizes) { - bindBuffersRange(target, first, count, allocator.allocateArray(JAVA_INT, buffers), allocator.allocateArray(JAVA_LONG, offsets), allocator.allocateArray(JAVA_LONG, sizes)); + bindBuffersRange(target, first, count, allocator.allocateFrom(JAVA_INT, buffers), allocator.allocateFrom(JAVA_LONG, offsets), allocator.allocateFrom(JAVA_LONG, sizes)); } public static void bindImageTextures(int first, int count, MemorySegment textures) { @@ -110,7 +110,7 @@ public static void bindImageTextures(int first, int count, MemorySegment texture } public static void bindImageTextures(SegmentAllocator allocator, int first, int count, int[] textures) { - bindImageTextures(first, count, allocator.allocateArray(JAVA_INT, textures)); + bindImageTextures(first, count, allocator.allocateFrom(JAVA_INT, textures)); } public static void bindSamplers(int first, int count, MemorySegment samplers) { @@ -123,7 +123,7 @@ public static void bindSamplers(int first, int count, MemorySegment samplers) { } public static void bindSamplers(SegmentAllocator allocator, int first, int count, int[] samplers) { - bindSamplers(first, count, allocator.allocateArray(JAVA_INT, samplers)); + bindSamplers(first, count, allocator.allocateFrom(JAVA_INT, samplers)); } public static void bindTextures(int first, int count, MemorySegment textures) { @@ -136,7 +136,7 @@ public static void bindTextures(int first, int count, MemorySegment textures) { } public static void bindTextures(SegmentAllocator allocator, int first, int count, int[] textures) { - bindTextures(first, count, allocator.allocateArray(JAVA_INT, textures)); + bindTextures(first, count, allocator.allocateFrom(JAVA_INT, textures)); } public static void bindVertexBuffers(int first, int count, MemorySegment buffers, MemorySegment offsets, MemorySegment strides) { @@ -149,7 +149,7 @@ public static void bindVertexBuffers(int first, int count, MemorySegment buffers } public static void bindVertexBuffers(SegmentAllocator allocator, int first, int count, int[] buffers, long[] offsets, long[] strides) { - bindVertexBuffers(first, count, allocator.allocateArray(JAVA_INT, buffers), allocator.allocateArray(JAVA_LONG, offsets), allocator.allocateArray(JAVA_LONG, strides)); + bindVertexBuffers(first, count, allocator.allocateFrom(JAVA_INT, buffers), allocator.allocateFrom(JAVA_LONG, offsets), allocator.allocateFrom(JAVA_LONG, strides)); } public static void bufferStorage(int target, long size, MemorySegment data, int flags) { @@ -166,27 +166,27 @@ public static void bufferStorage(int target, long size, int flags) { } public static void bufferStorage(SegmentAllocator allocator, int target, byte[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data), flags); } public static void bufferStorage(SegmentAllocator allocator, int target, short[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data), flags); } public static void bufferStorage(SegmentAllocator allocator, int target, int[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data), flags); } public static void bufferStorage(SegmentAllocator allocator, int target, long[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data), flags); } public static void bufferStorage(SegmentAllocator allocator, int target, float[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data), flags); } public static void bufferStorage(SegmentAllocator allocator, int target, double[] data, int flags) { - bufferStorage(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data), flags); + bufferStorage(target, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data), flags); } public static void clearTexImage(int texture, int level, int format, int type, MemorySegment data) { diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL45C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL45C.java index 40796a95..5b89df3a 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL45C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL45C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -266,7 +266,7 @@ public static void clearNamedFramebufferfv(int framebuffer, int buffer, int draw } public static void clearNamedFramebufferfv(SegmentAllocator allocator, int framebuffer, int buffer, int drawBuffer, float[] value) { - clearNamedFramebufferfv(framebuffer, buffer, drawBuffer, allocator.allocateArray(JAVA_FLOAT, value)); + clearNamedFramebufferfv(framebuffer, buffer, drawBuffer, allocator.allocateFrom(JAVA_FLOAT, value)); } public static void clearNamedFramebufferiv(int framebuffer, int buffer, int drawBuffer, MemorySegment value) { @@ -279,7 +279,7 @@ public static void clearNamedFramebufferiv(int framebuffer, int buffer, int draw } public static void clearNamedFramebufferiv(SegmentAllocator allocator, int framebuffer, int buffer, int drawBuffer, int[] value) { - clearNamedFramebufferiv(framebuffer, buffer, drawBuffer, allocator.allocateArray(JAVA_INT, value)); + clearNamedFramebufferiv(framebuffer, buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); } public static void clearNamedFramebufferuiv(int framebuffer, int buffer, int drawBuffer, MemorySegment value) { @@ -292,7 +292,7 @@ public static void clearNamedFramebufferuiv(int framebuffer, int buffer, int dra } public static void clearNamedFramebufferuiv(SegmentAllocator allocator, int framebuffer, int buffer, int drawBuffer, int[] value) { - clearNamedFramebufferuiv(framebuffer, buffer, drawBuffer, allocator.allocateArray(JAVA_INT, value)); + clearNamedFramebufferuiv(framebuffer, buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); } public static void clipControl(int origin, int depth) { @@ -377,7 +377,7 @@ public static void createBuffers(int n, MemorySegment buffers) { } public static void createBuffers(SegmentAllocator allocator, int[] buffers) { - var seg = allocator.allocateArray(JAVA_INT, buffers.length); + var seg = allocator.allocateFrom(JAVA_INT, buffers); createBuffers(buffers.length, seg); RuntimeHelper.toArray(seg, buffers); } @@ -404,7 +404,7 @@ public static void createFramebuffers(int n, MemorySegment framebuffers) { } public static void createFramebuffers(SegmentAllocator allocator, int[] framebuffers) { - var seg = allocator.allocateArray(JAVA_INT, framebuffers.length); + var seg = allocator.allocateFrom(JAVA_INT, framebuffers); createFramebuffers(framebuffers.length, seg); RuntimeHelper.toArray(seg, framebuffers); } @@ -431,7 +431,7 @@ public static void createProgramPipelines(int n, MemorySegment pipelines) { } public static void createProgramPipelines(SegmentAllocator allocator, int[] pipelines) { - var seg = allocator.allocateArray(JAVA_INT, pipelines.length); + var seg = allocator.allocateFrom(JAVA_INT, pipelines.length); createProgramPipelines(pipelines.length, seg); RuntimeHelper.toArray(seg, pipelines); } @@ -458,7 +458,7 @@ public static void createQueries(int target, int n, MemorySegment ids) { } public static void createQueries(SegmentAllocator allocator, int target, int[] ids) { - var seg = allocator.allocateArray(JAVA_INT, ids.length); + var seg = allocator.allocateFrom(JAVA_INT, ids); createQueries(target, ids.length, seg); RuntimeHelper.toArray(seg, ids); } @@ -485,7 +485,7 @@ public static void createRenderbuffers(int n, MemorySegment renderbuffers) { } public static void createRenderbuffers(SegmentAllocator allocator, int[] renderbuffers) { - var seg = allocator.allocateArray(JAVA_INT, renderbuffers.length); + var seg = allocator.allocateFrom(JAVA_INT, renderbuffers); createRenderbuffers(renderbuffers.length, seg); RuntimeHelper.toArray(seg, renderbuffers); } @@ -512,7 +512,7 @@ public static void createSamplers(int n, MemorySegment samplers) { } public static void createSamplers(SegmentAllocator allocator, int[] samplers) { - var seg = allocator.allocateArray(JAVA_INT, samplers.length); + var seg = allocator.allocateFrom(JAVA_INT, samplers); createSamplers(samplers.length, seg); RuntimeHelper.toArray(seg, samplers); } @@ -540,7 +540,7 @@ public static void createTextures(int target, int n, MemorySegment textures) { public static void createTextures(SegmentAllocator allocator, int target, int[] textures) { final int n = textures.length; - var pTex = allocator.allocateArray(JAVA_INT, n); + var pTex = allocator.allocate(JAVA_INT, n); createTextures(target, n, pTex); RuntimeHelper.toArray(pTex, textures); } @@ -567,7 +567,7 @@ public static void createTransformFeedbacks(int n, MemorySegment ids) { } public static void createTransformFeedbacks(SegmentAllocator allocator, int[] ids) { - var seg = allocator.allocateArray(JAVA_INT, ids.length); + var seg = allocator.allocateFrom(JAVA_INT, ids); createTransformFeedbacks(ids.length, seg); RuntimeHelper.toArray(seg, ids); } @@ -594,7 +594,7 @@ public static void createVertexArrays(int n, MemorySegment arrays) { } public static void createVertexArrays(SegmentAllocator allocator, int[] arrays) { - var seg = allocator.allocateArray(JAVA_INT, arrays.length); + var seg = allocator.allocateFrom(JAVA_INT, arrays); createVertexArrays(arrays.length, seg); RuntimeHelper.toArray(seg, arrays); } @@ -747,37 +747,37 @@ public static void getNamedBufferSubData(int buffer, long offset, long size, Mem } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, byte[] data) { - var seg = allocator.allocateArray(JAVA_BYTE, data.length); + var seg = allocator.allocateFrom(JAVA_BYTE, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length), seg); RuntimeHelper.toArray(seg, data); } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, short[] data) { - var seg = allocator.allocateArray(JAVA_SHORT, data.length); + var seg = allocator.allocateFrom(JAVA_SHORT, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 1, seg); RuntimeHelper.toArray(seg, data); } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, int[] data) { - var seg = allocator.allocateArray(JAVA_INT, data.length); + var seg = allocator.allocateFrom(JAVA_INT, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, seg); RuntimeHelper.toArray(seg, data); } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, long[] data) { - var seg = allocator.allocateArray(JAVA_LONG, data.length); + var seg = allocator.allocateFrom(JAVA_LONG, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, seg); RuntimeHelper.toArray(seg, data); } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, float[] data) { - var seg = allocator.allocateArray(JAVA_FLOAT, data.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, seg); RuntimeHelper.toArray(seg, data); } public static void getNamedBufferSubData(SegmentAllocator allocator, int buffer, long offset, double[] data) { - var seg = allocator.allocateArray(JAVA_DOUBLE, data.length); + var seg = allocator.allocateFrom(JAVA_DOUBLE, data); getNamedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, seg); RuntimeHelper.toArray(seg, data); } @@ -912,7 +912,7 @@ public static void getTextureLevelParameterfv(int texture, int level, int pname, } public static void getTextureLevelParameterfv(SegmentAllocator allocator, int texture, int level, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getTextureLevelParameterfv(texture, level, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -939,7 +939,7 @@ public static void getTextureLevelParameteriv(int texture, int level, int pname, } public static void getTextureLevelParameteriv(SegmentAllocator allocator, int texture, int level, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getTextureLevelParameteriv(texture, level, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -966,7 +966,7 @@ public static void getTextureParameterIiv(int texture, int pname, MemorySegment } public static void getTextureParameterIiv(SegmentAllocator allocator, int texture, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getTextureParameterIiv(texture, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -993,7 +993,7 @@ public static void getTextureParameterIuiv(int texture, int pname, MemorySegment } public static void getTextureParameterIuiv(SegmentAllocator allocator, int texture, int pname, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getTextureParameterIuiv(texture, pname, seg); RuntimeHelper.toArray(seg, params); } @@ -1020,7 +1020,7 @@ public static void getTextureParameterfv(int texture, int pname, MemorySegment p } public static void getTextureParameterfv(SegmentAllocator allocator, int texture, int pname, float[] params) { - var pParams = allocator.allocateArray(JAVA_FLOAT, params.length); + var pParams = allocator.allocateFrom(JAVA_FLOAT, params); getTextureParameterfv(texture, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1047,7 +1047,7 @@ public static void getTextureParameteriv(int texture, int pname, MemorySegment p } public static void getTextureParameteriv(SegmentAllocator allocator, int texture, int pname, int[] params) { - var pParams = allocator.allocateArray(JAVA_INT, params.length); + var pParams = allocator.allocateFrom(JAVA_INT, params); getTextureParameteriv(texture, pname, pParams); RuntimeHelper.toArray(pParams, params); } @@ -1074,25 +1074,25 @@ public static void getTextureSubImage(int texture, int level, int xoffset, int y } public static void getTextureSubImage(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, byte[] pixels) { - var seg = allocator.allocateArray(JAVA_BYTE, pixels.length); + var seg = allocator.allocateFrom(JAVA_BYTE, pixels); getTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getTextureSubImage(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, short[] pixels) { - var seg = allocator.allocateArray(JAVA_SHORT, pixels.length); + var seg = allocator.allocateFrom(JAVA_SHORT, pixels); getTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getTextureSubImage(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int[] pixels) { - var seg = allocator.allocateArray(JAVA_INT, pixels.length); + var seg = allocator.allocateFrom(JAVA_INT, pixels); getTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getTextureSubImage(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, float[] pixels) { - var seg = allocator.allocateArray(JAVA_FLOAT, pixels.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, pixels); getTextureSubImage(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } @@ -1107,7 +1107,7 @@ public static void getTransformFeedbacki64_v(int xfb, int pname, int index, Memo } public static void getTransformFeedbacki64_v(SegmentAllocator allocator, int xfb, int pname, int index, long[] param) { - var seg = allocator.allocateArray(JAVA_LONG, param.length); + var seg = allocator.allocateFrom(JAVA_LONG, param); getTransformFeedbacki64_v(xfb, pname, index, seg); RuntimeHelper.toArray(seg, param); } @@ -1122,7 +1122,7 @@ public static void getTransformFeedbacki_v(int xfb, int pname, int index, Memory } public static void getTransformFeedbacki_v(SegmentAllocator allocator, int xfb, int pname, int index, int[] param) { - var seg = allocator.allocateArray(JAVA_INT, param.length); + var seg = allocator.allocateFrom(JAVA_INT, param); getTransformFeedbacki_v(xfb, pname, index, seg); RuntimeHelper.toArray(seg, param); } @@ -1137,7 +1137,7 @@ public static void getTransformFeedbackiv(int xfb, int pname, MemorySegment para } public static void getTransformFeedbackiv(SegmentAllocator allocator, int xfb, int pname, int[] param) { - var seg = allocator.allocateArray(JAVA_INT, param.length); + var seg = allocator.allocateFrom(JAVA_INT, param); getTransformFeedbackiv(xfb, pname, seg); RuntimeHelper.toArray(seg, param); } @@ -1232,25 +1232,25 @@ public static void getnTexImage(int target, int level, int format, int type, Mem } public static void getnTexImage(SegmentAllocator allocator, int target, int level, int format, int type, byte[] pixels) { - var seg = allocator.allocateArray(JAVA_BYTE, pixels.length); + var seg = allocator.allocateFrom(JAVA_BYTE, pixels); getnTexImage(target, level, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getnTexImage(SegmentAllocator allocator, int target, int level, int format, int type, short[] pixels) { - var seg = allocator.allocateArray(JAVA_SHORT, pixels.length); + var seg = allocator.allocateFrom(JAVA_SHORT, pixels); getnTexImage(target, level, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getnTexImage(SegmentAllocator allocator, int target, int level, int format, int type, int[] pixels) { - var seg = allocator.allocateArray(JAVA_INT, pixels.length); + var seg = allocator.allocateFrom(JAVA_INT, pixels); getnTexImage(target, level, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } public static void getnTexImage(SegmentAllocator allocator, int target, int level, int format, int type, float[] pixels) { - var seg = allocator.allocateArray(JAVA_FLOAT, pixels.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, pixels); getnTexImage(target, level, format, type, pixels.length, seg); RuntimeHelper.toArray(seg, pixels); } @@ -1269,7 +1269,7 @@ public static void getnUniformdv(int program, int location, MemorySegment params } public static void getnUniformdv(SegmentAllocator allocator, int program, int location, double[] params) { - var seg = allocator.allocateArray(JAVA_DOUBLE, params.length); + var seg = allocator.allocateFrom(JAVA_DOUBLE, params); getnUniformdv(program, location, params.length, seg); RuntimeHelper.toArray(seg, params); } @@ -1288,7 +1288,7 @@ public static void getnUniformfv(int program, int location, MemorySegment params } public static void getnUniformfv(SegmentAllocator allocator, int program, int location, float[] params) { - var seg = allocator.allocateArray(JAVA_FLOAT, params.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, params); getnUniformfv(program, location, params.length, seg); RuntimeHelper.toArray(seg, params); } @@ -1307,7 +1307,7 @@ public static void getnUniformiv(int program, int location, MemorySegment params } public static void getnUniformiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getnUniformiv(program, location, params.length, seg); RuntimeHelper.toArray(seg, params); } @@ -1326,7 +1326,7 @@ public static void getnUniformuiv(int program, int location, MemorySegment param } public static void getnUniformuiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocateArray(JAVA_INT, params.length); + var seg = allocator.allocateFrom(JAVA_INT, params); getnUniformuiv(program, location, params.length, seg); RuntimeHelper.toArray(seg, params); } @@ -1341,7 +1341,7 @@ public static void invalidateNamedFramebufferData(int framebuffer, int numAttach } public static void invalidateNamedFramebufferData(SegmentAllocator allocator, int framebuffer, int[] attachments) { - invalidateNamedFramebufferData(framebuffer, attachments.length, allocator.allocateArray(JAVA_INT, attachments)); + invalidateNamedFramebufferData(framebuffer, attachments.length, allocator.allocateFrom(JAVA_INT, attachments)); } public static void invalidateNamedFramebufferData(int framebuffer, int attachment) { @@ -1364,7 +1364,7 @@ public static void invalidateNamedFramebufferSubData(int framebuffer, int numAtt } public static void invalidateNamedFramebufferSubData(SegmentAllocator allocator, int framebuffer, int[] attachments, int x, int y, int width, int height) { - invalidateNamedFramebufferSubData(framebuffer, attachments.length, allocator.allocateArray(JAVA_INT, attachments), x, y, width, height); + invalidateNamedFramebufferSubData(framebuffer, attachments.length, allocator.allocateFrom(JAVA_INT, attachments), x, y, width, height); } public static void invalidateNamedFramebufferSubData(int framebuffer, int attachment, int x, int y, int width, int height) { @@ -1423,27 +1423,27 @@ public static void namedBufferData(int buffer, long size, int usage) { } public static void namedBufferData(SegmentAllocator allocator, int buffer, byte[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data), usage); } public static void namedBufferData(SegmentAllocator allocator, int buffer, short[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data), usage); } public static void namedBufferData(SegmentAllocator allocator, int buffer, int[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data), usage); } public static void namedBufferData(SegmentAllocator allocator, int buffer, long[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data), usage); } public static void namedBufferData(SegmentAllocator allocator, int buffer, float[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data), usage); } public static void namedBufferData(SegmentAllocator allocator, int buffer, double[] data, int usage) { - namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data), usage); + namedBufferData(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data), usage); } public static void namedBufferStorage(int buffer, long size, MemorySegment data, int flags) { @@ -1460,27 +1460,27 @@ public static void namedBufferStorage(int buffer, long size, int flags) { } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, byte[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data), flags); } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, short[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data), flags); } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, int[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data), flags); } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, long[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data), flags); } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, float[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data), flags); } public static void namedBufferStorage(SegmentAllocator allocator, int buffer, double[] data, int flags) { - namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data), flags); + namedBufferStorage(buffer, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data), flags); } public static void namedBufferSubData(int buffer, long offset, long size, MemorySegment data) { @@ -1497,27 +1497,27 @@ public static void namedBufferSubData(int buffer, long offset, MemorySegment dat } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, byte[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length), allocator.allocateArray(JAVA_BYTE, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length), allocator.allocateFrom(JAVA_BYTE, data)); } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, short[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 1, allocator.allocateArray(JAVA_SHORT, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 1, allocator.allocateFrom(JAVA_SHORT, data)); } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, int[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_INT, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_INT, data)); } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, long[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_LONG, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_LONG, data)); } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, float[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateArray(JAVA_FLOAT, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 2, allocator.allocateFrom(JAVA_FLOAT, data)); } public static void namedBufferSubData(SegmentAllocator allocator, int buffer, long offset, double[] data) { - namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateArray(JAVA_DOUBLE, data)); + namedBufferSubData(buffer, offset, Integer.toUnsignedLong(data.length) << 3, allocator.allocateFrom(JAVA_DOUBLE, data)); } public static void namedFramebufferDrawBuffer(int framebuffer, int buf) { @@ -1539,7 +1539,7 @@ public static void namedFramebufferDrawBuffers(int framebuffer, int n, MemorySeg } public static void namedFramebufferDrawBuffers(SegmentAllocator allocator, int framebuffer, int[] bufs) { - namedFramebufferDrawBuffers(framebuffer, bufs.length, allocator.allocateArray(JAVA_INT, bufs)); + namedFramebufferDrawBuffers(framebuffer, bufs.length, allocator.allocateFrom(JAVA_INT, bufs)); } public static void namedFramebufferParameteri(int framebuffer, int pname, int param) { @@ -1619,25 +1619,25 @@ public static void readnPixels(int x, int y, int width, int height, int format, } public static void readnPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, byte[] data) { - var seg = allocator.allocateArray(JAVA_BYTE, data.length); + var seg = allocator.allocateFrom(JAVA_BYTE, data); readnPixels(x, y, width, height, format, type, data.length, seg); RuntimeHelper.toArray(seg, data); } public static void readnPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, short[] data) { - var seg = allocator.allocateArray(JAVA_SHORT, data.length); + var seg = allocator.allocateFrom(JAVA_SHORT, data); readnPixels(x, y, width, height, format, type, data.length, seg); RuntimeHelper.toArray(seg, data); } public static void readnPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, int[] data) { - var seg = allocator.allocateArray(JAVA_INT, data.length); + var seg = allocator.allocateFrom(JAVA_INT, data); readnPixels(x, y, width, height, format, type, data.length, seg); RuntimeHelper.toArray(seg, data); } public static void readnPixels(SegmentAllocator allocator, int x, int y, int width, int height, int format, int type, float[] data) { - var seg = allocator.allocateArray(JAVA_FLOAT, data.length); + var seg = allocator.allocateFrom(JAVA_FLOAT, data); readnPixels(x, y, width, height, format, type, data.length, seg); RuntimeHelper.toArray(seg, data); } @@ -1679,7 +1679,7 @@ public static void textureParameterIiv(int texture, int pname, MemorySegment par } public static void textureParameterIiv(SegmentAllocator allocator, int texture, int pname, int[] params) { - textureParameterIiv(texture, pname, allocator.allocateArray(JAVA_INT, params)); + textureParameterIiv(texture, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void textureParameterIuiv(int texture, int pname, MemorySegment params) { @@ -1692,7 +1692,7 @@ public static void textureParameterIuiv(int texture, int pname, MemorySegment pa } public static void textureParameterIuiv(SegmentAllocator allocator, int texture, int pname, int[] params) { - textureParameterIuiv(texture, pname, allocator.allocateArray(JAVA_INT, params)); + textureParameterIuiv(texture, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void textureParameterf(int texture, int pname, float param) { @@ -1714,7 +1714,7 @@ public static void textureParameterfv(int texture, int pname, MemorySegment para } public static void textureParameterfv(SegmentAllocator allocator, int texture, int pname, float[] params) { - textureParameterfv(texture, pname, allocator.allocateArray(JAVA_FLOAT, params)); + textureParameterfv(texture, pname, allocator.allocateFrom(JAVA_FLOAT, params)); } public static void textureParameteri(int texture, int pname, int param) { @@ -1736,7 +1736,7 @@ public static void textureParameteriv(int texture, int pname, MemorySegment para } public static void textureParameteriv(SegmentAllocator allocator, int texture, int pname, int[] params) { - textureParameteriv(texture, pname, allocator.allocateArray(JAVA_INT, params)); + textureParameteriv(texture, pname, allocator.allocateFrom(JAVA_INT, params)); } public static void textureStorage1D(int texture, int levels, int internalFormat, int width) { @@ -1794,19 +1794,19 @@ public static void textureSubImage1D(int texture, int level, int xoffset, int wi } public static void textureSubImage1D(SegmentAllocator allocator, int texture, int level, int xoffset, int width, int format, int type, byte[] pixels) { - textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void textureSubImage1D(SegmentAllocator allocator, int texture, int level, int xoffset, int width, int format, int type, short[] pixels) { - textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void textureSubImage1D(SegmentAllocator allocator, int texture, int level, int xoffset, int width, int format, int type, int[] pixels) { - textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateArray(JAVA_INT, pixels)); + textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void textureSubImage1D(SegmentAllocator allocator, int texture, int level, int xoffset, int width, int format, int type, float[] pixels) { - textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + textureSubImage1D(texture, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void textureSubImage2D(int texture, int level, int xoffset, int yoffset, int width, int height, int format, int type, MemorySegment pixels) { @@ -1819,19 +1819,19 @@ public static void textureSubImage2D(int texture, int level, int xoffset, int yo } public static void textureSubImage2D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int width, int height, int format, int type, byte[] pixels) { - textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void textureSubImage2D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int width, int height, int format, int type, short[] pixels) { - textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void textureSubImage2D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int width, int height, int format, int type, int[] pixels) { - textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_INT, pixels)); + textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void textureSubImage2D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int width, int height, int format, int type, float[] pixels) { - textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + textureSubImage2D(texture, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void textureSubImage3D(int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, MemorySegment pixels) { @@ -1844,19 +1844,19 @@ public static void textureSubImage3D(int texture, int level, int xoffset, int yo } public static void textureSubImage3D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, byte[] pixels) { - textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_BYTE, pixels)); + textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_BYTE, pixels)); } public static void textureSubImage3D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, short[] pixels) { - textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_SHORT, pixels)); + textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_SHORT, pixels)); } public static void textureSubImage3D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int[] pixels) { - textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_INT, pixels)); + textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_INT, pixels)); } public static void textureSubImage3D(SegmentAllocator allocator, int texture, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, float[] pixels) { - textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateArray(JAVA_FLOAT, pixels)); + textureSubImage3D(texture, level, xoffset, yoffset, zoffset, width, height, depth, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels)); } public static void transformFeedbackBufferBase(int xfb, int index, int buffer) { @@ -1959,6 +1959,6 @@ public static void vertexArrayVertexBuffers(int vaobj, int first, int count, Mem } public static void vertexArrayVertexBuffers(SegmentAllocator allocator, int vaobj, int first, int count, int[] buffers, long[] offsets, int[] strides) { - vertexArrayVertexBuffers(vaobj, first, count, allocator.allocateArray(JAVA_INT, buffers), allocator.allocateArray(JAVA_LONG, offsets), allocator.allocateArray(JAVA_INT, strides)); + vertexArrayVertexBuffers(vaobj, first, count, allocator.allocateFrom(JAVA_INT, buffers), allocator.allocateFrom(JAVA_LONG, offsets), allocator.allocateFrom(JAVA_INT, strides)); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL46C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL46C.java index 7fd1984c..ebf81994 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL46C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL46C.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -120,8 +120,8 @@ public static void specializeShader(SegmentAllocator allocator, int shader, @Nul specializeShader(shader, pEntryPoint != null ? allocator.allocateFrom(pEntryPoint) : MemorySegment.NULL, pConstantIndex != null ? pConstantIndex.length : (pConstantValue != null ? pConstantValue.length : 0), - pConstantIndex != null ? allocator.allocateArray(ValueLayout.JAVA_INT, pConstantIndex) : MemorySegment.NULL, - pConstantValue != null ? allocator.allocateArray(ValueLayout.JAVA_INT, pConstantValue) : MemorySegment.NULL); + pConstantIndex != null ? allocator.allocateFrom(ValueLayout.JAVA_INT, pConstantIndex) : MemorySegment.NULL, + pConstantValue != null ? allocator.allocateFrom(ValueLayout.JAVA_INT, pConstantValue) : MemorySegment.NULL); } public static void specializeShader(int shader, @Nullable String pEntryPoint) { diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtCaps.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtCaps.java index 344bc8b7..700721e6 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtCaps.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtCaps.java @@ -445,7 +445,7 @@ boolean findExtensionsGL(int version, SegmentAllocator allocator) { var pExtsI = new MemorySegment[1]; if (!getExtensions(allocator, version, pExts, pNumExtsI, pExtsI, caps)) return false; - String exts = pExts.getUtf8String(0); + String exts = pExts.getString(0); int numExtsI = pNumExtsI.get(JAVA_INT, 0); var extsI = pExtsI[0]; diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtFinder.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtFinder.java index 22f30f71..7a66c34e 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtFinder.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLExtFinder.java @@ -49,7 +49,7 @@ static boolean getExtensions(SegmentAllocator allocator, int numExtsI = GL10C.getInteger(GL30C.NUM_EXTENSIONS); var extsI = MemorySegment.NULL; if (numExtsI > 0) { - extsI = allocator.allocateArray(ADDRESS, numExtsI); + extsI = allocator.allocate(ADDRESS, numExtsI); } if (RuntimeHelper.isNullptr(extsI)) { return false; 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 ff35af8b..4b462487 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/Handles.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022-2023 Overrun Organization + * Copyright (c) 2022-2024 Overrun Organization * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -53,6 +53,6 @@ static MethodHandle downcall(String name, static MethodHandle downcallTrivial(String name, FunctionDescriptors function) { - return downcall(name, function, Linker.Option.isTrivial()); + return downcall(name, function, Linker.Option.critical(false)); } } diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBEasyFont.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBEasyFont.java index 8dd6a000..cbd74d06 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBEasyFont.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBEasyFont.java @@ -80,7 +80,7 @@ public static int ndrawSegs(float x, float y, MemorySegment segs, int numSegs, b } public static int drawSegs(SegmentAllocator allocator, float x, float y, byte[] segs, boolean vertical, byte[] c, MemorySegment vbuf, int vbufSize, int offset) { - return ndrawSegs(x, y, allocator.allocateArray(ValueLayout.JAVA_BYTE, segs), segs.length, vertical, allocator.allocateArray(ValueLayout.JAVA_BYTE, c), vbuf, vbufSize, offset); + return ndrawSegs(x, y, allocator.allocateFrom(ValueLayout.JAVA_BYTE, segs), segs.length, vertical, allocator.allocateFrom(ValueLayout.JAVA_BYTE, c), vbuf, vbufSize, offset); } public static float getSpacing() { @@ -108,7 +108,7 @@ public static int nprint(float x, float y, MemorySegment text, MemorySegment col } public static int print(SegmentAllocator allocator, float x, float y, String text, byte[] color, MemorySegment vertexBuffer, int vbufSize) { - return nprint(x, y, allocator.allocateFrom(text), allocator.allocateArray(ValueLayout.JAVA_BYTE, color), vertexBuffer, vbufSize); + return nprint(x, y, allocator.allocateFrom(text), allocator.allocateFrom(ValueLayout.JAVA_BYTE, color), vertexBuffer, vbufSize); } public static int nwidth(MemorySegment text) { 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 e40e2ffa..f0bae4b9 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImage.java @@ -123,7 +123,7 @@ public static MemorySegment nfailureReason() { @Nullable public static String failureReason() { var pReason = nfailureReason(); - return RuntimeHelper.isNullptr(pReason) ? null : pReason.getUtf8String(0); + return RuntimeHelper.isNullptr(pReason) ? null : pReason.getString(0); } public static void hdrToLdrGamma(float gamma) { @@ -244,7 +244,7 @@ public static boolean infoFromMemory(SegmentAllocator allocator, byte[] buffer, var px = stack.callocInt(); var py = stack.callocInt(); var pc = stack.callocInt(); - boolean b = infoFromMemory(allocator.allocateArray(JAVA_BYTE, buffer), px, py, pc); + boolean b = infoFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer), px, py, pc); x[0] = px.get(JAVA_INT, 0); y[0] = py.get(JAVA_INT, 0); comp[0] = pc.get(JAVA_INT, 0); @@ -305,7 +305,7 @@ public static boolean is16BitFromMemory(MemorySegment buffer) { } public static boolean is16BitFromMemory(SegmentAllocator allocator, byte[] buffer) { - return is16BitFromMemory(allocator.allocateArray(JAVA_BYTE, buffer)); + return is16BitFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer)); } public static boolean nisHdr(MemorySegment filename) { @@ -359,7 +359,7 @@ public static boolean isHdrFromMemory(MemorySegment buffer) { } public static boolean isHdrFromMemory(SegmentAllocator allocator, byte[] buffer) { - return isHdrFromMemory(allocator.allocateArray(JAVA_BYTE, buffer)); + return isHdrFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer)); } public static void ldrToHdrGamma(float gamma) { @@ -469,7 +469,7 @@ public static MemorySegment load16FromMemory(SegmentAllocator allocator, byte[] var px = allocator.allocate(JAVA_INT); var py = allocator.allocate(JAVA_INT); var pc = allocator.allocate(JAVA_INT); - var addr = load16FromMemory(allocator.allocateArray(JAVA_BYTE, buffer), px, py, pc, desiredChannels); + var addr = load16FromMemory(allocator.allocateFrom(JAVA_BYTE, buffer), px, py, pc, desiredChannels); x[0] = px.get(JAVA_INT, 0); y[0] = py.get(JAVA_INT, 0); channelsInFile[0] = pc.get(JAVA_INT, 0); @@ -567,7 +567,7 @@ public static MemorySegment loadFromMemory(SegmentAllocator allocator, byte[] bu var px = allocator.allocate(JAVA_INT); var py = allocator.allocate(JAVA_INT); var pc = allocator.allocate(JAVA_INT); - var addr = nloadFromMemory(allocator.allocateArray(JAVA_BYTE, buffer), buffer.length, px, py, pc, desiredChannels); + var addr = nloadFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer), buffer.length, px, py, pc, desiredChannels); x[0] = px.get(JAVA_INT, 0); y[0] = py.get(JAVA_INT, 0); channelsInFile[0] = pc.get(JAVA_INT, 0); @@ -592,7 +592,7 @@ public static MemorySegment loadGifFromMemory(SegmentAllocator allocator, byte[] var py = allocator.allocate(JAVA_INT); var pz = allocator.allocate(JAVA_INT); var pc = allocator.allocate(JAVA_INT); - var addr = loadGifFromMemory(allocator.allocateArray(JAVA_BYTE, buffer), pd, px, py, pz, pc, reqComp); + var addr = loadGifFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer), pd, px, py, pz, pc, reqComp); x[0] = px.get(JAVA_INT, 0); y[0] = py.get(JAVA_INT, 0); final int layers = pz.get(JAVA_INT, 0); @@ -693,7 +693,7 @@ public static MemorySegment loadfFromMemory(SegmentAllocator allocator, byte[] b var px = allocator.allocate(JAVA_INT); var py = allocator.allocate(JAVA_INT); var pc = allocator.allocate(JAVA_INT); - var addr = nloadfFromMemory(allocator.allocateArray(JAVA_BYTE, buffer), buffer.length, px, py, pc, desiredChannels); + var addr = nloadfFromMemory(allocator.allocateFrom(JAVA_BYTE, buffer), buffer.length, px, py, pc, desiredChannels); x[0] = px.get(JAVA_INT, 0); y[0] = py.get(JAVA_INT, 0); channelsInFile[0] = pc.get(JAVA_INT, 0); diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageResize.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageResize.java index de1a6782..1b2aa331 100644 --- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageResize.java +++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageResize.java @@ -65,8 +65,8 @@ public static boolean resizeUint8(SegmentAllocator allocator, byte[] inputPixels, int inputW, int inputH, int inputStrideInBytes, byte[] outputPixels, int outputW, int outputH, int outputStrideInBytes, int numChannels) { - var seg = allocator.allocateArray(JAVA_BYTE, outputPixels.length); - boolean b = resizeUint8(allocator.allocateArray(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_BYTE, outputPixels); + boolean b = resizeUint8(allocator.allocateFrom(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels); RuntimeHelper.toArray(seg, outputPixels); @@ -89,8 +89,8 @@ public static boolean resizeFloat(SegmentAllocator allocator, float[] inputPixels, int inputW, int inputH, int inputStrideInBytes, float[] outputPixels, int outputW, int outputH, int outputStrideInBytes, int numChannels) { - var seg = allocator.allocateArray(JAVA_FLOAT, outputPixels.length); - boolean b = resizeFloat(allocator.allocateArray(JAVA_FLOAT, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_FLOAT, outputPixels); + boolean b = resizeFloat(allocator.allocateFrom(JAVA_FLOAT, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels); RuntimeHelper.toArray(seg, outputPixels); @@ -113,8 +113,8 @@ public static boolean resizeUint8Srgb(SegmentAllocator allocator, byte[] inputPixels, int inputW, int inputH, int inputStrideInBytes, byte[] outputPixels, int outputW, int outputH, int outputStrideInBytes, int numChannels, int alphaChannel, int flags) { - var seg = allocator.allocateArray(JAVA_BYTE, outputPixels.length); - boolean b = resizeUint8Srgb(allocator.allocateArray(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_BYTE, outputPixels); + boolean b = resizeUint8Srgb(allocator.allocateFrom(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels, alphaChannel, flags); RuntimeHelper.toArray(seg, outputPixels); @@ -140,8 +140,8 @@ public static boolean resizeUint8SrgbEdgemode(SegmentAllocator allocator, byte[] outputPixels, int outputW, int outputH, int outputStrideInBytes, int numChannels, int alphaChannel, int flags, STBIREdge edgeWrapMode) { - var seg = allocator.allocateArray(JAVA_BYTE, outputPixels.length); - boolean b = resizeUint8SrgbEdgemode(allocator.allocateArray(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_BYTE, outputPixels); + boolean b = resizeUint8SrgbEdgemode(allocator.allocateFrom(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels, alphaChannel, flags, edgeWrapMode.getValue()); @@ -171,8 +171,8 @@ public static boolean resizeUint8Generic(SegmentAllocator allocator, int numChannels, int alphaChannel, int flags, STBIREdge edgeWrapMode, STBIRFilter filter, STBIRColorspace space, MemorySegment allocContext) { - var seg = allocator.allocateArray(JAVA_BYTE, outputPixels.length); - boolean b = resizeUint8Generic(allocator.allocateArray(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_BYTE, outputPixels); + boolean b = resizeUint8Generic(allocator.allocateFrom(JAVA_BYTE, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels, alphaChannel, flags, edgeWrapMode.getValue(), filter.getValue(), space.ordinal(), @@ -203,8 +203,8 @@ public static boolean resizeUint16Generic(SegmentAllocator allocator, int numChannels, int alphaChannel, int flags, STBIREdge edgeWrapMode, STBIRFilter filter, STBIRColorspace space, MemorySegment allocContext) { - var seg = allocator.allocateArray(JAVA_SHORT, outputPixels.length); - boolean b = resizeUint16Generic(allocator.allocateArray(JAVA_SHORT, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_SHORT, outputPixels); + boolean b = resizeUint16Generic(allocator.allocateFrom(JAVA_SHORT, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels, alphaChannel, flags, edgeWrapMode.getValue(), filter.getValue(), space.ordinal(), @@ -235,8 +235,8 @@ public static boolean resizeFloatGeneric(SegmentAllocator allocator, int numChannels, int alphaChannel, int flags, STBIREdge edgeWrapMode, STBIRFilter filter, STBIRColorspace space, MemorySegment allocContext) { - var seg = allocator.allocateArray(JAVA_FLOAT, outputPixels.length); - boolean b = resizeFloatGeneric(allocator.allocateArray(JAVA_FLOAT, inputPixels), inputW, inputH, inputStrideInBytes, + var seg = allocator.allocateFrom(JAVA_FLOAT, outputPixels); + boolean b = resizeFloatGeneric(allocator.allocateFrom(JAVA_FLOAT, inputPixels), inputW, inputH, inputStrideInBytes, seg, outputW, outputH, outputStrideInBytes, numChannels, alphaChannel, flags, edgeWrapMode.getValue(), filter.getValue(), space.ordinal(),