generator) {
- for (int i = 0; i < arr.length; i++) {
- arr[i] = generator.apply(seg.getAtIndex(ADDRESS_UNBOUNDED, i));
- }
- return arr;
- }
-
/**
* Gets the addresses from an address array.
*
@@ -295,12 +266,15 @@ public static MemorySegment[] toArray(MemorySegment seg, MemorySegment[] arr) {
/**
* Gets the strings from an unbounded address array.
*
- * @param seg the memory segment contained strings. native type: {@code char**}
+ * @param seg the memory segment contained strings
* @param arr the array to hold the result
* @return arr
*/
- public static String[] toUnboundedArray(MemorySegment seg, String[] arr) {
- return toUnboundedArray(seg, arr, p -> p.getUtf8String(0));
+ public static String[] toUnboundedArray(@NativeType("char**") MemorySegment seg, String[] arr) {
+ for (int i = 0; i < arr.length; i++) {
+ arr[i] = unboundPointerString(seg, i);
+ }
+ return arr;
}
/**
diff --git a/modules/overrungl.core/src/main/java/overrungl/util/DebugAllocator.java b/modules/overrungl.core/src/main/java/overrungl/util/DebugAllocator.java
index 28d6309d..62d44085 100644
--- a/modules/overrungl.core/src/main/java/overrungl/util/DebugAllocator.java
+++ b/modules/overrungl.core/src/main/java/overrungl/util/DebugAllocator.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
@@ -45,16 +45,16 @@ final class DebugAllocator {
for (Allocation allocation : ALLOCATIONS.keySet()) {
StringBuilder sb = new StringBuilder(512);
- sb.append(STR. """
- [OverrunGL] \{ allocation.size } bytes leaked,\
- thread \{ allocation.threadId } (\{ THREADS.get(allocation.threadId) }),\
- address: 0x\{ Long.toHexString(allocation.address).toUpperCase() }
- """ );
+ sb.append(STR."""
+ [OverrunGL] \{allocation.size} bytes leaked,\
+ thread \{allocation.threadId} (\{THREADS.get(allocation.threadId)}),\
+ address: 0x\{Long.toHexString(allocation.address).toUpperCase()}
+ """);
StackTraceElement[] stackTrace = allocation.getElements();
if (stackTrace != null) {
for (Object el : stackTrace) {
- sb.append(STR. "\tat \{ el.toString() }\n" );
+ sb.append(STR."\tat \{el.toString()}\n");
}
} else {
missingStacktrace = true;
@@ -99,22 +99,22 @@ private static void trackAbort(long address, Allocation allocationOld, Allocatio
trackAbortPrint(allocationOld, "Old", addressHex);
trackAbortPrint(allocationNew, "New", addressHex);
- throw Exceptions.ISE. "The memory address specified is already being tracked: 0x\{ addressHex }" ;
+ throw Exceptions.ISE."The memory address specified is already being tracked: 0x\{addressHex}";
}
private static void trackAbortPrint(Allocation allocation, String name, String address) {
StringBuilder sb = new StringBuilder(512);
- sb.append(STR. """
- [OverrunGL] \{ name } allocation with size \{ allocation.size },\
- thread \{ allocation.threadId } (\{ THREADS.get(allocation.threadId) }),\
- address: 0x\{ address }
- """ );
+ sb.append(STR."""
+ [OverrunGL] \{name} allocation with size \{allocation.size},\
+ thread \{allocation.threadId} (\{THREADS.get(allocation.threadId)}),\
+ address: 0x\{address}
+ """);
StackTraceElement[] stackTrace = allocation.getElements();
if (stackTrace != null) {
for (Object el : stackTrace) {
- sb.append(STR. "\tat \{ el.toString() }\n" );
+ sb.append(STR."\tat \{el.toString()}\n");
}
}
@@ -138,7 +138,7 @@ static long untrack(long address) {
private static void untrackAbort(long address) {
String addressHex = Long.toHexString(address).toUpperCase();
- throw Exceptions.ISE. "The memory address specified is not being tracked: 0x\{ addressHex }" ;
+ throw Exceptions.ISE."The memory address specified is not being tracked: 0x\{addressHex}";
}
private record Allocation(long address, long size, long threadId, @Nullable Object[] stacktrace) {
@@ -147,10 +147,11 @@ private StackTraceElement[] getElements() {
return stacktrace == null ? null : StackWalkUtil.stackWalkArray(stacktrace);
}
- @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
- public boolean equals(Object obj) {
- return address == ((Allocation) obj).address;
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof Allocation that)) return false;
+ return address == that.address;
}
@Override
diff --git a/modules/overrungl.core/src/main/java/overrungl/util/MemoryUtil.java b/modules/overrungl.core/src/main/java/overrungl/util/MemoryUtil.java
index f6956525..1085bfda 100644
--- a/modules/overrungl.core/src/main/java/overrungl/util/MemoryUtil.java
+++ b/modules/overrungl.core/src/main/java/overrungl/util/MemoryUtil.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,14 +18,14 @@
import org.jetbrains.annotations.Nullable;
import overrungl.Configurations;
-import overrungl.FunctionDescriptors;
import overrungl.internal.RuntimeHelper;
import java.lang.foreign.*;
import java.lang.invoke.MethodHandle;
import java.util.Objects;
-import static overrungl.FunctionDescriptors.*;
+import static java.lang.foreign.FunctionDescriptor.of;
+import static java.lang.foreign.ValueLayout.ADDRESS;
/**
* The standard-C memory allocator.
@@ -34,26 +34,23 @@
* @since 0.1.0
*/
public final class MemoryUtil {
- /**
- * An unbounded address layout.
- */
- public static final AddressLayout ADDRESS_UNBOUNDED = ValueLayout.ADDRESS.withTargetLayout(MemoryLayout.sequenceLayout(ValueLayout.JAVA_BYTE));
private static final SymbolLookup LOOKUP = RuntimeHelper.LINKER.defaultLookup();
private static final MethodHandle
- m_malloc = downcall("malloc", JP),
- m_calloc = downcall("calloc", JJP),
- m_realloc = downcall("realloc", PJP),
- m_free = downcall("free", PV),
- m_memcpy = downcall("memcpy", PPJP),
- m_memmove = downcall("memmove", PPJP),
- m_memset = downcall("memset", PIJP);
+ m_malloc = downcall("malloc", of(ADDRESS, RuntimeHelper.SIZE_T)),
+ m_calloc = downcall("calloc", of(ADDRESS, RuntimeHelper.SIZE_T, RuntimeHelper.SIZE_T)),
+ m_realloc = downcall("realloc", of(ADDRESS, ADDRESS, RuntimeHelper.SIZE_T)),
+ m_free = downcall("free", FunctionDescriptor.ofVoid(ADDRESS)),
+ m_memcpy = downcall("memcpy", of(ADDRESS, ADDRESS, ADDRESS, RuntimeHelper.SIZE_T)),
+ m_memmove = downcall("memmove", of(ADDRESS, ADDRESS, ADDRESS, RuntimeHelper.SIZE_T)),
+ m_memset = downcall("memset", of(ADDRESS, ADDRESS, ValueLayout.JAVA_INT, RuntimeHelper.SIZE_T)),
+ strlen = downcall("strlen", of(RuntimeHelper.SIZE_T, ADDRESS));
private static final boolean DEBUG = Configurations.DEBUG_MEM_UTIL.get();
/**
* The address of {@code NULL}.
*/
public static final long NULL = 0x0L;
- private static MethodHandle downcall(String name, FunctionDescriptors function) {
+ private static MethodHandle downcall(String name, FunctionDescriptor function) {
return RuntimeHelper.downcallThrow(LOOKUP.find(name), function);
}
@@ -67,7 +64,7 @@ private MemoryUtil() {
* @param segment the segment.
*/
public static boolean isNullptr(@Nullable MemorySegment segment) {
- return segment == null || segment.equals(MemorySegment.NULL);
+ return RuntimeHelper.isNullptr(segment);
}
/**
@@ -272,7 +269,7 @@ public static void free(@Nullable MemorySegment memblock) {
*/
public static MemorySegment memcpy(MemorySegment dest, MemorySegment src, long count) {
try {
- RuntimeHelper.consume((MemorySegment) m_memcpy.invokeExact(dest, src, count));
+ final var _ = (MemorySegment) m_memcpy.invokeExact(dest, src, count);
return dest;
} catch (Throwable e) {
throw new AssertionError("should not reach here", e);
@@ -297,7 +294,7 @@ public static MemorySegment memcpy(MemorySegment dest, MemorySegment src, long c
*/
public static MemorySegment memmove(MemorySegment dest, MemorySegment src, long count) {
try {
- RuntimeHelper.consume((MemorySegment) m_memmove.invokeExact(dest, src, count));
+ final var _ = (MemorySegment) m_memmove.invokeExact(dest, src, count);
return dest;
} catch (Throwable e) {
throw new AssertionError("should not reach here", e);
@@ -320,13 +317,32 @@ public static MemorySegment memmove(MemorySegment dest, MemorySegment src, long
*/
public static MemorySegment memset(MemorySegment dest, int c, long count) {
try {
- RuntimeHelper.consume((MemorySegment) m_memset.invokeExact(dest, c, count));
+ final var _ = (MemorySegment) m_memset.invokeExact(dest, c, count);
return dest;
} catch (Throwable e) {
throw new AssertionError("should not reach here", e);
}
}
+ /**
+ * Gets the length of a string, by using the current locale or a specified locale.
+ *
+ * {@code strlen} interprets the string as a single-byte character string,
+ * so its return value is always equal to the number of bytes,
+ * even if the string contains multibyte characters.
+ *
+ * @param str Null-terminated string.
+ * @return the number of characters in {@code str}, excluding the terminal null.
+ * No return value is reserved to indicate an error.
+ */
+ public static long strlen(MemorySegment str) {
+ try {
+ return (long) strlen.invokeExact(str);
+ } catch (Throwable e) {
+ throw new AssertionError("should not reach here", e);
+ }
+ }
+
/**
* Creates a segment allocator with the given arena.
*
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 dc2aad7d..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
@@ -19,6 +19,7 @@
import org.jetbrains.annotations.Nullable;
import overrungl.internal.RuntimeHelper;
import overrungl.util.MemoryStack;
+import overrungl.util.MemoryUtil;
import overrungl.util.value.Pair;
import overrungl.util.value.Quad;
import overrungl.util.value.Triplet;
@@ -1090,7 +1091,7 @@ public static MemorySegment ngetVersionString() {
* @see #ngetVersionString() ngetVersionString
*/
public static String getVersionString() {
- return ngetVersionString().getUtf8String(0);
+ return ngetVersionString().getString(0);
}
/**
@@ -1629,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);
}
/**
@@ -2045,7 +2046,7 @@ public static void windowHintString(int hint, String value) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- nwindowHintString(hint, stack.allocateUtf8String(value));
+ nwindowHintString(hint, stack.allocateFrom(value));
} finally {
stack.setPointer(stackPointer);
}
@@ -2230,7 +2231,7 @@ public static MemorySegment createWindow(int width, int height, String title, Me
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return ncreateWindow(width, height, stack.allocateUtf8String(title), monitor, share);
+ return ncreateWindow(width, height, stack.allocateFrom(title), monitor, share);
} finally {
stack.setPointer(stackPointer);
}
@@ -2335,7 +2336,7 @@ public static void setWindowTitle(MemorySegment window, String title) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- nsetWindowTitle(window, stack.allocateUtf8String(title));
+ nsetWindowTitle(window, stack.allocateFrom(title));
} finally {
stack.setPointer(stackPointer);
}
@@ -4135,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);
}
/**
@@ -5063,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);
}
/**
@@ -5116,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);
}
/**
@@ -5285,7 +5286,7 @@ public static boolean updateGamepadMappings(String string) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nupdateGamepadMappings(stack.allocateUtf8String(string));
+ return nupdateGamepadMappings(stack.allocateFrom(string));
} finally {
stack.setPointer(stackPointer);
}
@@ -5333,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);
}
/**
@@ -5419,7 +5420,7 @@ public static void setClipboardString(String string) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- nsetClipboardString(stack.allocateUtf8String(string));
+ nsetClipboardString(stack.allocateFrom(string));
} finally {
stack.setPointer(stackPointer);
}
@@ -5463,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);
}
/**
@@ -5749,7 +5750,7 @@ public static boolean extensionSupported(String extension) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nextensionSupported(stack.allocateUtf8String(extension));
+ return nextensionSupported(stack.allocateFrom(extension));
} finally {
stack.setPointer(stackPointer);
}
@@ -5807,7 +5808,7 @@ public static MemorySegment getProcAddress(String procName) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return ngetProcAddress(stack.allocateUtf8String(procName));
+ return ngetProcAddress(stack.allocateFrom(procName));
} finally {
stack.setPointer(stackPointer);
}
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 4f4d81b7..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.
*/
@@ -95,7 +95,7 @@ public static GLFWGammaRamp create(SegmentAllocator allocator) {
* @return this
*/
public GLFWGammaRamp red(SegmentAllocator allocator, short[] reds) {
- ppRed.set(segment(), allocator.allocateArray(JAVA_SHORT, reds));
+ ppRed.set(segment(), allocator.allocateFrom(JAVA_SHORT, reds));
return this;
}
@@ -107,7 +107,7 @@ public GLFWGammaRamp red(SegmentAllocator allocator, short[] reds) {
* @return this
*/
public GLFWGammaRamp green(SegmentAllocator allocator, short[] greens) {
- ppGreen.set(segment(), allocator.allocateArray(JAVA_SHORT, greens));
+ ppGreen.set(segment(), allocator.allocateFrom(JAVA_SHORT, greens));
return this;
}
@@ -119,7 +119,7 @@ public GLFWGammaRamp green(SegmentAllocator allocator, short[] greens) {
* @return this
*/
public GLFWGammaRamp blue(SegmentAllocator allocator, short[] blues) {
- ppBlue.set(segment(), allocator.allocateArray(JAVA_SHORT, blues));
+ ppBlue.set(segment(), allocator.allocateFrom(JAVA_SHORT, blues));
return this;
}
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 d4119be3..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")),
@@ -98,7 +99,7 @@ public static GLFWImage 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.glfw/src/main/java/overrungl/glfw/GLFWNative.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWNative.java
index 611c9e6f..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);
}
/**
@@ -303,7 +303,7 @@ public static void setX11SelectionString(String string) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- nsetX11SelectionString(stack.allocateUtf8String(string));
+ nsetX11SelectionString(stack.allocateFrom(string));
} finally {
stack.setPointer(stackPointer);
}
@@ -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 68523fa5..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);
@@ -106,7 +106,7 @@ public static GLFWVidMode 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);
}
/**
@@ -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/GLFWVulkan.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java
index 5242d451..5ac28dc3 100644
--- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java
+++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/GLFWVulkan.java
@@ -92,7 +92,7 @@ public static MemorySegment glfwGetInstanceProcAddress(MemorySegment instance, S
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nglfwGetInstanceProcAddress(instance, stack.allocateUtf8String(procName));
+ return nglfwGetInstanceProcAddress(instance, stack.allocateFrom(procName));
} finally {
stack.setPointer(stackPointer);
}
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.glfw/src/main/java/overrungl/glfw/IGLFWErrorFun.java b/modules/overrungl.glfw/src/main/java/overrungl/glfw/IGLFWErrorFun.java
index 474cbc64..fb4cc1be 100644
--- a/modules/overrungl.glfw/src/main/java/overrungl/glfw/IGLFWErrorFun.java
+++ b/modules/overrungl.glfw/src/main/java/overrungl/glfw/IGLFWErrorFun.java
@@ -17,6 +17,7 @@
package overrungl.glfw;
import overrungl.Callback;
+import overrungl.NativeType;
import overrungl.internal.RuntimeHelper;
import java.lang.foreign.FunctionDescriptor;
@@ -44,7 +45,7 @@
*/
@FunctionalInterface
public interface IGLFWErrorFun extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.ofVoid(ValueLayout.JAVA_INT, RuntimeHelper.ADDRESS_UNBOUNDED);
+ FunctionDescriptor DESC = FunctionDescriptor.ofVoid(ValueLayout.JAVA_INT, ValueLayout.ADDRESS);
MethodType MTYPE = DESC.toMethodType();
/**
@@ -55,8 +56,8 @@ public interface IGLFWErrorFun extends Callback {
*/
void invoke(int errorCode, String description);
- default void ninvoke(int errorCode, MemorySegment description) {
- invoke(errorCode, description.getUtf8String(0));
+ default void ninvoke(int errorCode, @NativeType("const char*") MemorySegment description) {
+ invoke(errorCode, RuntimeHelper.getString(description));
}
/**
diff --git a/modules/overrungl.nfd/build.gradle.kts b/modules/overrungl.nfd/build.gradle.kts
deleted file mode 100644
index 0a130665..00000000
--- a/modules/overrungl.nfd/build.gradle.kts
+++ /dev/null
@@ -1,5 +0,0 @@
-val overrunPlatformVersion: String by rootProject
-
-dependencies {
- implementation("io.github.over-run:platform:$overrunPlatformVersion")
-}
diff --git a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java
index 0b111880..06055881 100644
--- a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java
+++ b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFD.java
@@ -27,6 +27,7 @@
import java.lang.foreign.*;
import java.lang.invoke.MethodHandle;
+import java.nio.charset.StandardCharsets;
import java.util.function.Supplier;
import static java.lang.foreign.ValueLayout.*;
@@ -66,8 +67,8 @@
* new Pair<>("Image file", "png,jpg"));
* var result = NFD.openDialogN(outPath, filterItem, null);
* switch (result) {
- * case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
- * case OKAY -> System.out.println(STR. "Success! \{ outPath[0] }" );
+ * case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
+ * case OKAY -> System.out.println(STR."Success! \{outPath[0]}");
* case CANCEL -> System.out.println("User pressed cancel.");
* }
* }
@@ -174,10 +175,6 @@ private static MethodHandle downcall(String name, FunctionDescriptors function,
return RuntimeHelper.downcallThrow(LOOKUP.find(name), function, options);
}
- private static MethodHandle downcallTrivial(String name, FunctionDescriptors function) {
- return downcall(name, function, Linker.Option.isTrivial());
- }
-
private static MethodHandle downcall(String name, FunctionDescriptor function) {
return RuntimeHelper.downcallThrow(LOOKUP.find(name), function);
}
@@ -186,10 +183,6 @@ private static MethodHandle downcallSafe(String name, FunctionDescriptors functi
return RuntimeHelper.downcallSafe(LOOKUP.find(name).orElse(MemorySegment.NULL), function, options);
}
- private static MethodHandle downcallSafeTrivial(String name, FunctionDescriptors function) {
- return downcallSafe(name, function, Linker.Option.isTrivial());
- }
-
private static MethodHandle downcallSafe(String name, FunctionDescriptor function) {
return RuntimeHelper.downcallSafe(LOOKUP.find(name).orElse(MemorySegment.NULL), function);
}
@@ -198,16 +191,17 @@ static MemorySegment allocateString(String str) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- if (isOsWin) return RuntimeHelper.allocateUtf16LEString(stack, str);
- return stack.allocateUtf8String(str);
+ if (isOsWin) return stack.allocateFrom(str, StandardCharsets.UTF_16LE);
+ return stack.allocateFrom(str);
} finally {
stack.setPointer(stackPointer);
}
}
static String getString(MemorySegment segment, long offset) {
- if (isOsWin) return RuntimeHelper.getUtf16LEString(segment, offset);
- return segment.getUtf8String(offset);
+ final MemorySegment segment1 = segment.byteSize() == 0 ? segment.reinterpret(Long.MAX_VALUE) : segment;
+ if (isOsWin) return segment1.getString(offset, StandardCharsets.UTF_16LE);
+ return segment1.getString(offset);
}
/**
@@ -287,7 +281,7 @@ public static NFDResult openDialogN(String[] outPath, NFDNFilterItem.Buffer filt
filterList != null ? Math.toIntExact(filterList.elementCount()) : 0,
defaultPath != null ? allocateString(defaultPath) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
outPath[0] = getString(path, 0);
freePathN(path);
}
@@ -372,7 +366,7 @@ public static NFDResult saveDialogN(String[] outPath, NFDNFilterItem.Buffer filt
defaultPath != null ? allocateString(defaultPath) : MemorySegment.NULL,
defaultName != null ? allocateString(defaultName) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
outPath[0] = getString(path, 0);
freePathN(path);
}
@@ -413,7 +407,7 @@ public static NFDResult pickFolderN(String[] outPath, String defaultPath) {
final MemorySegment seg = stack.callocPointer();
final NFDResult result = npickFolderN(seg, defaultPath != null ? allocateString(defaultPath) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
outPath[0] = getString(path, 0);
freePathN(path);
}
@@ -448,7 +442,7 @@ public static NFDResult pickFolderN(String[] outPath, String defaultPath) {
*/
public static String getError() {
final MemorySegment seg = ngetError();
- return RuntimeHelper.isNullptr(seg) ? null : seg.getUtf8String(0);
+ return RuntimeHelper.isNullptr(seg) ? null : seg.getString(0);
}
/**
@@ -566,7 +560,7 @@ public static NFDResult pathSetGetPathN(@NativeType("const nfdpathset_t*") Memor
final MemorySegment seg = stack.callocPointer();
final NFDResult result = npathSetGetPathN(pathSet, index, seg);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
outPath[0] = getString(path, 0);
pathSetFreePathN(path);
}
@@ -655,7 +649,7 @@ public static NFDResult pathSetEnumNextN(@NativeType("nfdpathsetenum_t*") Memory
final MemorySegment seg = stack.callocPointer();
final NFDResult result = npathSetEnumNextN(enumerator, seg);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
if (!RuntimeHelper.isNullptr(path)) {
outPath[0] = getString(path, 0);
pathSetFreePathN(path);
@@ -732,10 +726,10 @@ public static NFDResult openDialogU8(String[] outPath, NFDU8FilterItem.Buffer fi
final NFDResult result = nopenDialogU8(seg,
filterList != null ? filterList.address() : MemorySegment.NULL,
filterList != null ? Math.toIntExact(filterList.elementCount()) : 0,
- defaultPath != null ? stack.allocateUtf8String(defaultPath) : MemorySegment.NULL);
+ defaultPath != null ? stack.allocateFrom(defaultPath) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
- outPath[0] = path.getUtf8String(0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
+ outPath[0] = RuntimeHelper.getString(path);
freePathU8(path);
}
return result;
@@ -781,7 +775,7 @@ public static NFDResult openDialogMultipleU8(@NativeType("const nfdpathset_t**")
return nopenDialogMultipleU8(outPaths,
filterList != null ? filterList.address() : MemorySegment.NULL,
filterList != null ? Math.toIntExact(filterList.elementCount()) : 0,
- defaultPath != null ? stack.allocateUtf8String(defaultPath) : MemorySegment.NULL);
+ defaultPath != null ? stack.allocateFrom(defaultPath) : MemorySegment.NULL);
} finally {
stack.setPointer(stackPointer);
}
@@ -826,11 +820,11 @@ public static NFDResult saveDialogU8(String[] outPath, NFDU8FilterItem.Buffer fi
final NFDResult result = nsaveDialogU8(seg,
filterList != null ? filterList.address() : MemorySegment.NULL,
filterList != null ? Math.toIntExact(filterList.elementCount()) : 0,
- defaultPath != null ? stack.allocateUtf8String(defaultPath) : MemorySegment.NULL,
- defaultName != null ? stack.allocateUtf8String(defaultName) : MemorySegment.NULL);
+ defaultPath != null ? stack.allocateFrom(defaultPath) : MemorySegment.NULL,
+ defaultName != null ? stack.allocateFrom(defaultName) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
- outPath[0] = path.getUtf8String(0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
+ outPath[0] = RuntimeHelper.getString(path);
freePathU8(path);
}
return result;
@@ -870,10 +864,10 @@ public static NFDResult pickFolderU8(String[] outPath, String defaultPath) {
final long stackPointer = stack.getPointer();
try {
final MemorySegment seg = stack.callocPointer();
- final NFDResult result = npickFolderU8(seg, defaultPath != null ? stack.allocateUtf8String(defaultPath) : MemorySegment.NULL);
+ final NFDResult result = npickFolderU8(seg, defaultPath != null ? stack.allocateFrom(defaultPath) : MemorySegment.NULL);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
- outPath[0] = path.getUtf8String(0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
+ outPath[0] = RuntimeHelper.getString(path);
freePathU8(path);
}
return result;
@@ -922,8 +916,8 @@ public static NFDResult pathSetGetPathU8(@NativeType("const nfdpathset_t*") Memo
final MemorySegment seg = stack.callocPointer();
final NFDResult result = npathSetGetPathU8(pathSet, index, seg);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
- outPath[0] = path.getUtf8String(0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
+ outPath[0] = RuntimeHelper.getString(path);
pathSetFreePathU8(path);
}
return result;
@@ -968,9 +962,9 @@ public static NFDResult pathSetEnumNextU8(@NativeType("nfdpathsetenum_t*") Memor
final MemorySegment seg = stack.callocPointer();
final NFDResult result = npathSetEnumNextU8(enumerator, seg);
if (result == NFDResult.OKAY) {
- final MemorySegment path = seg.get(RuntimeHelper.ADDRESS_UNBOUNDED, 0);
+ final MemorySegment path = seg.get(ADDRESS, 0);
if (!RuntimeHelper.isNullptr(path)) {
- outPath[0] = path.getUtf8String(0);
+ outPath[0] = RuntimeHelper.getString(path);
pathSetFreePathU8(path);
}
}
diff --git a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDNFilterItem.java b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDNFilterItem.java
index 95de19fd..9246b1de 100644
--- a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDNFilterItem.java
+++ b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDNFilterItem.java
@@ -97,7 +97,7 @@ public static NFDNFilterItem create(SegmentAllocator allocator, String name, Str
*/
@SafeVarargs
public static Buffer create(SegmentAllocator allocator, Pair... items) {
- final Buffer buffer = new Buffer(allocator.allocateArray(LAYOUT, items.length), items.length);
+ final Buffer buffer = new Buffer(allocator.allocate(LAYOUT, items.length), items.length);
for (int i = 0, len = items.length; i < len; i++) {
Pair item = items[i];
buffer.pName.set(buffer.segment(), (long) i, NFD.allocateString(item.key()));
diff --git a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDU8FilterItem.java b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDU8FilterItem.java
index f0ef323f..fc624e2f 100644
--- a/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDU8FilterItem.java
+++ b/modules/overrungl.nfd/src/main/java/overrungl/nfd/NFDU8FilterItem.java
@@ -83,8 +83,8 @@ public static long sizeof() {
*/
public static NFDU8FilterItem create(SegmentAllocator allocator, String name, String spec) {
final NFDU8FilterItem item = new NFDU8FilterItem(allocator.allocate(LAYOUT));
- pName.set(item.segment(), allocator.allocateUtf8String(name));
- pSpec.set(item.segment(), allocator.allocateUtf8String(spec));
+ pName.set(item.segment(), allocator.allocateFrom(name));
+ pSpec.set(item.segment(), allocator.allocateFrom(spec));
return item;
}
@@ -97,11 +97,11 @@ public static NFDU8FilterItem create(SegmentAllocator allocator, String name, St
*/
@SafeVarargs
public static Buffer create(SegmentAllocator allocator, Pair... items) {
- final Buffer buffer = new Buffer(allocator.allocateArray(LAYOUT, items.length), items.length);
+ final Buffer buffer = new Buffer(allocator.allocate(LAYOUT, items.length), items.length);
for (int i = 0, len = items.length; i < len; i++) {
Pair item = items[i];
- buffer.pName.set(buffer.segment(), (long) i, allocator.allocateUtf8String(item.key()));
- buffer.pSpec.set(buffer.segment(), (long) i, allocator.allocateUtf8String(item.value()));
+ buffer.pName.set(buffer.segment(), (long) i, allocator.allocateFrom(item.key()));
+ buffer.pSpec.set(buffer.segment(), (long) i, allocator.allocateFrom(item.value()));
}
return buffer;
}
@@ -119,7 +119,7 @@ public MemorySegment nname() {
* @see #nname()
*/
public String name() {
- return nname().getUtf8String(0);
+ return nname().getString(0);
}
/**
@@ -135,7 +135,7 @@ public MemorySegment nspec() {
* @see #nspec()
*/
public String spec() {
- return nspec().getUtf8String(0);
+ return nspec().getString(0);
}
/**
@@ -172,7 +172,7 @@ public MemorySegment nnameAt(long index) {
* @param index the index
*/
public String nameAt(long index) {
- return nnameAt(index).getUtf8String(0);
+ return nnameAt(index).getString(0);
}
/**
@@ -190,7 +190,7 @@ public MemorySegment nspecAt(long index) {
* @param index the index
*/
public String specAt(long index) {
- return nspecAt(index).getUtf8String(0);
+ return nspecAt(index).getString(0);
}
@Override
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 5571a51a..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);
}
@@ -266,19 +266,19 @@ public static void texSubImage1D(int target, int level, int xoffset, int width,
}
public static void texSubImage1D(SegmentAllocator allocator, int target, int level, int xoffset, int width, int format, int type, byte[] pixels) {
- texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateArray(JAVA_BYTE, pixels));
+ texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_BYTE, pixels));
}
public static void texSubImage1D(SegmentAllocator allocator, int target, int level, int xoffset, int width, int format, int type, short[] pixels) {
- texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateArray(JAVA_SHORT, pixels));
+ texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_SHORT, pixels));
}
public static void texSubImage1D(SegmentAllocator allocator, int target, int level, int xoffset, int width, int format, int type, int[] pixels) {
- texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateArray(JAVA_INT, pixels));
+ texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_INT, pixels));
}
public static void texSubImage1D(SegmentAllocator allocator, int target, int level, int xoffset, int width, int format, int type, float[] pixels) {
- texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateArray(JAVA_FLOAT, pixels));
+ texSubImage1D(target, level, xoffset, width, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels));
}
public static void texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, MemorySegment pixels) {
@@ -291,18 +291,18 @@ public static void texSubImage2D(int target, int level, int xoffset, int yoffset
}
public static void texSubImage2D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, byte[] pixels) {
- texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_BYTE, pixels));
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_BYTE, pixels));
}
public static void texSubImage2D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, short[] pixels) {
- texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_SHORT, pixels));
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_SHORT, pixels));
}
public static void texSubImage2D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, int[] pixels) {
- texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_INT, pixels));
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_INT, pixels));
}
public static void texSubImage2D(SegmentAllocator allocator, int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, float[] pixels) {
- texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateArray(JAVA_FLOAT, pixels));
+ texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, allocator.allocateFrom(JAVA_FLOAT, pixels));
}
}
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 e7ea4684..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
@@ -265,7 +265,7 @@ public static void bindAttribLocation(int program, int index, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- bindAttribLocation(program, index, stack.allocateUtf8String(name));
+ bindAttribLocation(program, index, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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);
@@ -443,7 +443,7 @@ public static int getAttribLocation(int program, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getAttribLocation(program, stack.allocateUtf8String(name));
+ return getAttribLocation(program, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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);
}
@@ -607,7 +607,7 @@ public static int getUniformLocation(int program, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getUniformLocation(program, stack.allocateUtf8String(name));
+ return getUniformLocation(program, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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,10 +824,10 @@ 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.allocateUtf8String(string[i]));
+ pStr.setAtIndex(ADDRESS, i, allocator.allocateFrom(string[i]));
pLen.setAtIndex(JAVA_INT, i, string[i].length());
}
shaderSource(shader, string.length, pStr, pLen);
@@ -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.allocateUtf8String(string)), stack.allocate(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 8b6d06c1..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
@@ -430,7 +430,7 @@ public static void bindFragDataLocation(int program, int color, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- bindFragDataLocation(program, color, stack.allocateUtf8String(name));
+ bindFragDataLocation(program, color, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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);
}
@@ -836,7 +836,7 @@ public static int getFragDataLocation(int program, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getFragDataLocation(program, stack.allocateUtf8String(name));
+ return getFragDataLocation(program, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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,9 +1195,9 @@ 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.allocateUtf8String(varyings[i]));
+ seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(varyings[i]));
}
transformFeedbackVaryings(program, varyings.length, seg, bufferMode);
}
@@ -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 e093b03c..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);
}
@@ -272,7 +271,7 @@ public static int getUniformBlockIndex(int program, String uniformBlockName) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getUniformBlockIndex(program, stack.allocateUtf8String(uniformBlockName));
+ return getUniformBlockIndex(program, stack.allocateFrom(uniformBlockName));
} finally {
stack.setPointer(stackPointer);
}
@@ -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.allocateUtf8String(uniformNames[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);
}
@@ -303,7 +302,7 @@ public static int getUniformIndex(int program, String uniformName) {
final long stackPointer = stack.getPointer();
try {
var seg = stack.allocate(JAVA_INT);
- getUniformIndices(program, 1, stack.allocateUtf8String(uniformName), seg);
+ getUniformIndices(program, 1, stack.allocateFrom(uniformName), seg);
return seg.get(JAVA_INT, 0);
} finally {
stack.setPointer(stackPointer);
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 1c0eece5..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
@@ -112,7 +112,7 @@ public static void bindFragDataLocationIndexed(int program, int colorNumber, int
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- bindFragDataLocationIndexed(program, colorNumber, index, stack.allocateUtf8String(name));
+ bindFragDataLocationIndexed(program, colorNumber, index, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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);
}
@@ -190,7 +190,7 @@ public static int getFragDataIndex(int program, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getFragDataIndex(program, stack.allocateUtf8String(name));
+ return getFragDataIndex(program, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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 a3889377..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);
}
@@ -466,7 +466,7 @@ public static int getSubroutineIndex(int program, int shaderType, String name) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getSubroutineIndex(program, shaderType, stack.allocateUtf8String(name));
+ return getSubroutineIndex(program, shaderType, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -485,7 +485,7 @@ public static int getSubroutineUniformLocation(int program, int shaderType, Stri
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getSubroutineUniformLocation(program, shaderType, stack.allocateUtf8String(name));
+ return getSubroutineUniformLocation(program, shaderType, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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/GL41C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java
index c60265f1..d855141b 100644
--- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java
+++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java
@@ -226,9 +226,9 @@ public static int createShaderProgramv(int type, int count, MemorySegment string
}
public static int createShaderProgramv(SegmentAllocator allocator, int type, String[] strings) {
- var seg = allocator.allocateArray(ADDRESS, strings.length);
+ var seg = allocator.allocate(ADDRESS, strings.length);
for (int i = 0; i < strings.length; i++) {
- seg.setAtIndex(ADDRESS, i, allocator.allocateUtf8String(strings[i]));
+ seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(strings[i]));
}
return createShaderProgramv(type, strings.length, seg);
}
@@ -237,7 +237,7 @@ public static int createShaderProgram(int type, String string) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return createShaderProgramv(type, 1, stack.allocate(ADDRESS, stack.allocateUtf8String(string)));
+ return createShaderProgramv(type, 1, stack.allocateFrom(ADDRESS, stack.allocateFrom(string)));
} finally {
stack.setPointer(stackPointer);
}
@@ -253,7 +253,7 @@ public static void deleteProgramPipelines(int n, MemorySegment pipelines) {
}
public static void deleteProgramPipelines(SegmentAllocator allocator, int[] pipelines) {
- deleteProgramPipelines(pipelines.length, allocator.allocateArray(JAVA_INT, pipelines));
+ deleteProgramPipelines(pipelines.length, allocator.allocateFrom(JAVA_INT, pipelines));
}
public static void deleteProgramPipeline(int pipeline) {
@@ -276,7 +276,7 @@ public static void depthRangeArrayv(int first, int count, MemorySegment v) {
}
public static void depthRangeArrayv(SegmentAllocator allocator, int first, double[] v) {
- depthRangeArrayv(first, v.length, allocator.allocateArray(JAVA_DOUBLE, v));
+ depthRangeArrayv(first, v.length, allocator.allocateFrom(JAVA_DOUBLE, v));
}
public static void depthRangeIndexed(int index, double n, double f) {
@@ -307,7 +307,7 @@ public static void genProgramPipelines(int n, MemorySegment pipelines) {
}
public static void genProgramPipelines(SegmentAllocator allocator, int[] pipelines) {
- var seg = allocator.allocateArray(JAVA_INT, pipelines.length);
+ var seg = allocator.allocate(JAVA_INT, pipelines.length);
genProgramPipelines(pipelines.length, seg);
RuntimeHelper.toArray(seg, pipelines);
}
@@ -334,7 +334,7 @@ public static void getDoublei_v(int target, int index, MemorySegment data) {
}
public static void getDoublei_v(SegmentAllocator allocator, int target, int index, double[] data) {
- var seg = allocator.allocateArray(JAVA_DOUBLE, data.length);
+ var seg = allocator.allocate(JAVA_DOUBLE, data.length);
getDoublei_v(target, index, seg);
RuntimeHelper.toArray(seg, data);
}
@@ -361,7 +361,7 @@ public static void getFloati_v(int target, int index, MemorySegment data) {
}
public static void getFloati_v(SegmentAllocator allocator, int target, int index, float[] data) {
- var seg = allocator.allocateArray(JAVA_FLOAT, data.length);
+ var seg = allocator.allocate(JAVA_FLOAT, data.length);
getFloati_v(target, index, seg);
RuntimeHelper.toArray(seg, data);
}
@@ -418,19 +418,19 @@ public static void getProgramPipelineInfoLog(int pipeline, int bufSize, MemorySe
public static void getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline, int bufSize, int @Nullable [] length, String[] infoLog) {
var pl = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL;
- var pi = allocator.allocateArray(JAVA_BYTE, bufSize);
+ var pi = allocator.allocate(JAVA_BYTE, bufSize);
getProgramPipelineInfoLog(pipeline, bufSize, pl, pi);
if (length != null && length.length > 0) {
length[0] = pl.get(JAVA_INT, 0);
}
- infoLog[0] = pi.getUtf8String(0);
+ infoLog[0] = pi.getString(0);
}
public static String getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline) {
final int sz = getProgramPipelinei(pipeline, INFO_LOG_LENGTH);
- var pi = allocator.allocateArray(JAVA_BYTE, sz);
+ var pi = allocator.allocate(JAVA_BYTE, sz);
getProgramPipelineInfoLog(pipeline, sz, MemorySegment.NULL, pi);
- return pi.getUtf8String(0);
+ return pi.getString(0);
}
public static void getProgramPipelineiv(int pipeline, int pname, MemorySegment params) {
@@ -464,7 +464,7 @@ public static void getShaderPrecisionFormat(int shaderType, int precisionType, M
}
public static void getShaderPrecisionFormat(SegmentAllocator allocator, int shaderType, int precisionType, int[] range, int[] precision) {
- var pr = allocator.allocateArray(JAVA_INT, range.length);
+ var pr = allocator.allocate(JAVA_INT, range.length);
var pp = allocator.allocate(JAVA_INT);
getShaderPrecisionFormat(shaderType, precisionType, pr, pp);
RuntimeHelper.toArray(pr, range);
@@ -481,7 +481,7 @@ public static void getVertexAttribLdv(int index, int pname, MemorySegment params
}
public static void getVertexAttribLdv(SegmentAllocator allocator, int index, int pname, double[] params) {
- var seg = allocator.allocateArray(JAVA_DOUBLE, params.length);
+ var seg = allocator.allocate(JAVA_DOUBLE, params.length);
getVertexAttribLdv(index, pname, seg);
RuntimeHelper.toArray(seg, params);
}
@@ -536,7 +536,7 @@ public static void programUniform1dv(int program, int location, int count, Memor
}
public static void programUniform1dv(SegmentAllocator allocator, int program, int location, double[] value) {
- programUniform1dv(program, location, value.length, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniform1dv(program, location, value.length, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniform1f(int program, int location, float v0) {
@@ -558,7 +558,7 @@ public static void programUniform1fv(int program, int location, int count, Memor
}
public static void programUniform1fv(SegmentAllocator allocator, int program, int location, float[] value) {
- programUniform1fv(program, location, value.length, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniform1fv(program, location, value.length, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniform1i(int program, int location, int v0) {
@@ -580,7 +580,7 @@ public static void programUniform1iv(int program, int location, int count, Memor
}
public static void programUniform1iv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform1iv(program, location, value.length, allocator.allocateArray(JAVA_INT, value));
+ programUniform1iv(program, location, value.length, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform1ui(int program, int location, int v0) {
@@ -602,7 +602,7 @@ public static void programUniform1uiv(int program, int location, int count, Memo
}
public static void programUniform1uiv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform1uiv(program, location, value.length, allocator.allocateArray(JAVA_INT, value));
+ programUniform1uiv(program, location, value.length, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform2d(int program, int location, double v0, double v1) {
@@ -624,7 +624,7 @@ public static void programUniform2dv(int program, int location, int count, Memor
}
public static void programUniform2dv(SegmentAllocator allocator, int program, int location, double[] value) {
- programUniform2dv(program, location, value.length >> 2, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniform2dv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniform2f(int program, int location, float v0, float v1) {
@@ -646,7 +646,7 @@ public static void programUniform2fv(int program, int location, int count, Memor
}
public static void programUniform2fv(SegmentAllocator allocator, int program, int location, float[] value) {
- programUniform2fv(program, location, value.length >> 2, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniform2fv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniform2i(int program, int location, int v0, int v1) {
@@ -668,7 +668,7 @@ public static void programUniform2iv(int program, int location, int count, Memor
}
public static void programUniform2iv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform2iv(program, location, value.length >> 2, allocator.allocateArray(JAVA_INT, value));
+ programUniform2iv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform2ui(int program, int location, int v0, int v1) {
@@ -690,7 +690,7 @@ public static void programUniform2uiv(int program, int location, int count, Memo
}
public static void programUniform2uiv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform2uiv(program, location, value.length >> 2, allocator.allocateArray(JAVA_INT, value));
+ programUniform2uiv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform3d(int program, int location, double v0, double v1, double v2) {
@@ -712,7 +712,7 @@ public static void programUniform3dv(int program, int location, int count, Memor
}
public static void programUniform3dv(SegmentAllocator allocator, int program, int location, double[] value) {
- programUniform3dv(program, location, value.length / 3, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniform3dv(program, location, value.length / 3, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniform3f(int program, int location, float v0, float v1, float v2) {
@@ -734,7 +734,7 @@ public static void programUniform3fv(int program, int location, int count, Memor
}
public static void programUniform3fv(SegmentAllocator allocator, int program, int location, float[] value) {
- programUniform3fv(program, location, value.length / 3, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniform3fv(program, location, value.length / 3, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniform3i(int program, int location, int v0, int v1, int v2) {
@@ -756,7 +756,7 @@ public static void programUniform3iv(int program, int location, int count, Memor
}
public static void programUniform3iv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform3iv(program, location, value.length / 3, allocator.allocateArray(JAVA_INT, value));
+ programUniform3iv(program, location, value.length / 3, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform3ui(int program, int location, int v0, int v1, int v2) {
@@ -778,7 +778,7 @@ public static void programUniform3uiv(int program, int location, int count, Memo
}
public static void programUniform3uiv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform3uiv(program, location, value.length / 3, allocator.allocateArray(JAVA_INT, value));
+ programUniform3uiv(program, location, value.length / 3, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform4d(int program, int location, double v0, double v1, double v2, double v3) {
@@ -800,7 +800,7 @@ public static void programUniform4dv(int program, int location, int count, Memor
}
public static void programUniform4dv(SegmentAllocator allocator, int program, int location, double[] value) {
- programUniform4dv(program, location, value.length >> 2, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniform4dv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniform4f(int program, int location, float v0, float v1, float v2, float v3) {
@@ -822,7 +822,7 @@ public static void programUniform4fv(int program, int location, int count, Memor
}
public static void programUniform4fv(SegmentAllocator allocator, int program, int location, float[] value) {
- programUniform4fv(program, location, value.length >> 2, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniform4fv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniform4i(int program, int location, int v0, int v1, int v2, int v3) {
@@ -844,7 +844,7 @@ public static void programUniform4iv(int program, int location, int count, Memor
}
public static void programUniform4iv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform4iv(program, location, value.length >> 2, allocator.allocateArray(JAVA_INT, value));
+ programUniform4iv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniform4ui(int program, int location, int v0, int v1, int v2, int v3) {
@@ -866,7 +866,7 @@ public static void programUniform4uiv(int program, int location, int count, Memo
}
public static void programUniform4uiv(SegmentAllocator allocator, int program, int location, int[] value) {
- programUniform4uiv(program, location, value.length >> 2, allocator.allocateArray(JAVA_INT, value));
+ programUniform4uiv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value));
}
public static void programUniformMatrix2dv(int program, int location, int count, boolean transpose, MemorySegment value) {
@@ -879,7 +879,7 @@ public static void programUniformMatrix2dv(int program, int location, int count,
}
public static void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix2dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -896,7 +896,7 @@ public static void programUniformMatrix2fv(int program, int location, int count,
}
public static void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix2fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -913,7 +913,7 @@ public static void programUniformMatrix2x3dv(int program, int location, int coun
}
public static void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix2x3dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix2x3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -930,7 +930,7 @@ public static void programUniformMatrix2x3fv(int program, int location, int coun
}
public static void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix2x3fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix2x3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -947,7 +947,7 @@ public static void programUniformMatrix2x4dv(int program, int location, int coun
}
public static void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix2x4dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix2x4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -964,7 +964,7 @@ public static void programUniformMatrix2x4fv(int program, int location, int coun
}
public static void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix2x4fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix2x4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -981,7 +981,7 @@ public static void programUniformMatrix3dv(int program, int location, int count,
}
public static void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix3dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -998,7 +998,7 @@ public static void programUniformMatrix3fv(int program, int location, int count,
}
public static void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix3fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1015,7 +1015,7 @@ public static void programUniformMatrix3x2dv(int program, int location, int coun
}
public static void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix3x2dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix3x2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -1032,7 +1032,7 @@ public static void programUniformMatrix3x2fv(int program, int location, int coun
}
public static void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix3x2fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix3x2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1049,7 +1049,7 @@ public static void programUniformMatrix3x4dv(int program, int location, int coun
}
public static void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix3x4dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix3x4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -1066,7 +1066,7 @@ public static void programUniformMatrix3x4fv(int program, int location, int coun
}
public static void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix3x4fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix3x4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1083,7 +1083,7 @@ public static void programUniformMatrix4dv(int program, int location, int count,
}
public static void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix4dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -1100,7 +1100,7 @@ public static void programUniformMatrix4fv(int program, int location, int count,
}
public static void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix4fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1117,7 +1117,7 @@ public static void programUniformMatrix4x2dv(int program, int location, int coun
}
public static void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix4x2dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix4x2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -1134,7 +1134,7 @@ public static void programUniformMatrix4x2fv(int program, int location, int coun
}
public static void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix4x2fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix4x2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1151,7 +1151,7 @@ public static void programUniformMatrix4x3dv(int program, int location, int coun
}
public static void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) {
- programUniformMatrix4x3dv(program, location, count, transpose, allocator.allocateArray(JAVA_DOUBLE, value));
+ programUniformMatrix4x3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value));
}
public static void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) {
@@ -1168,7 +1168,7 @@ public static void programUniformMatrix4x3fv(int program, int location, int coun
}
public static void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) {
- programUniformMatrix4x3fv(program, location, count, transpose, allocator.allocateArray(JAVA_FLOAT, value));
+ programUniformMatrix4x3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value));
}
public static void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) {
@@ -1194,7 +1194,7 @@ public static void scissorArrayv(int first, int count, MemorySegment v) {
}
public static void scissorArrayv(SegmentAllocator allocator, int first, int count, int[] v) {
- scissorArrayv(first, count, allocator.allocateArray(JAVA_INT, v));
+ scissorArrayv(first, count, allocator.allocateFrom(JAVA_INT, v));
}
public static void scissorIndexed(int index, int left, int bottom, int width, int height) {
@@ -1216,7 +1216,7 @@ public static void scissorIndexedv(int index, MemorySegment v) {
}
public static void scissorIndexedv(SegmentAllocator allocator, int index, int[] v) {
- scissorIndexedv(index, allocator.allocateArray(JAVA_INT, v));
+ scissorIndexedv(index, allocator.allocateFrom(JAVA_INT, v));
}
public static void shaderBinary(int count, MemorySegment shaders, int binaryFormat, MemorySegment binary, int length) {
@@ -1229,7 +1229,7 @@ public static void shaderBinary(int count, MemorySegment shaders, int binaryForm
}
public static void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary, int length) {
- shaderBinary(shaders.length, allocator.allocateArray(JAVA_INT, shaders), binaryFormat, binary, length);
+ shaderBinary(shaders.length, allocator.allocateFrom(JAVA_INT, shaders), binaryFormat, binary, length);
}
public static void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary) {
@@ -1273,7 +1273,7 @@ public static void vertexAttribL1dv(int index, MemorySegment v) {
}
public static void vertexAttribL1dv(SegmentAllocator allocator, int index, double[] v) {
- vertexAttribL1dv(index, allocator.allocateArray(JAVA_DOUBLE, v));
+ vertexAttribL1dv(index, allocator.allocateFrom(JAVA_DOUBLE, v));
}
public static void vertexAttribL2d(int index, double x, double y) {
@@ -1295,7 +1295,7 @@ public static void vertexAttribL2dv(int index, MemorySegment v) {
}
public static void vertexAttribL2dv(SegmentAllocator allocator, int index, double[] v) {
- vertexAttribL2dv(index, allocator.allocateArray(JAVA_DOUBLE, v));
+ vertexAttribL2dv(index, allocator.allocateFrom(JAVA_DOUBLE, v));
}
public static void vertexAttribL3d(int index, double x, double y, double z) {
@@ -1317,7 +1317,7 @@ public static void vertexAttribL3dv(int index, MemorySegment v) {
}
public static void vertexAttribL3dv(SegmentAllocator allocator, int index, double[] v) {
- vertexAttribL3dv(index, allocator.allocateArray(JAVA_DOUBLE, v));
+ vertexAttribL3dv(index, allocator.allocateFrom(JAVA_DOUBLE, v));
}
public static void vertexAttribL4d(int index, double x, double y, double z, double w) {
@@ -1339,7 +1339,7 @@ public static void vertexAttribL4dv(int index, MemorySegment v) {
}
public static void vertexAttribL4dv(SegmentAllocator allocator, int index, double[] v) {
- vertexAttribL4dv(index, allocator.allocateArray(JAVA_DOUBLE, v));
+ vertexAttribL4dv(index, allocator.allocateFrom(JAVA_DOUBLE, v));
}
public static void vertexAttribLPointer(int index, int size, int type, int stride, MemorySegment pointer) {
@@ -1352,7 +1352,7 @@ public static void vertexAttribLPointer(int index, int size, int type, int strid
}
public static void vertexAttribLPointer(SegmentAllocator allocator, int index, int size, int type, int stride, double[] pointer) {
- vertexAttribLPointer(index, size, type, stride, allocator.allocateArray(JAVA_DOUBLE, pointer));
+ vertexAttribLPointer(index, size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer));
}
public static void viewportArrayv(int first, int count, MemorySegment v) {
@@ -1365,7 +1365,7 @@ public static void viewportArrayv(int first, int count, MemorySegment v) {
}
public static void viewportArrayv(SegmentAllocator allocator, int first, int count, float[] v) {
- viewportArrayv(first, count, allocator.allocateArray(JAVA_FLOAT, v));
+ viewportArrayv(first, count, allocator.allocateFrom(JAVA_FLOAT, v));
}
public static void viewportIndexedf(int index, float x, float y, float w, float h) {
@@ -1387,6 +1387,6 @@ public static void viewportIndexedfv(int index, MemorySegment v) {
}
public static void viewportIndexedfv(SegmentAllocator allocator, int index, float[] v) {
- viewportIndexedfv(index, allocator.allocateArray(JAVA_FLOAT, v));
+ viewportIndexedfv(index, allocator.allocateFrom(JAVA_FLOAT, v));
}
}
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 ef05dc51..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) {
@@ -448,7 +448,7 @@ public static void debugMessageInsert(int source, int type, int id, int severity
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- debugMessageInsert(source, type, id, severity, buf.length(), stack.allocateUtf8String(buf));
+ debugMessageInsert(source, type, id, severity, buf.length(), stack.allocateFrom(buf));
} finally {
stack.setPointer(stackPointer);
}
@@ -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) {
@@ -647,7 +647,7 @@ public static int getProgramResourceIndex(int program, int programInterface, Str
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getProgramResourceIndex(program, programInterface, stack.allocateUtf8String(name));
+ return getProgramResourceIndex(program, programInterface, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -666,7 +666,7 @@ public static int getProgramResourceLocation(int program, int programInterface,
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getProgramResourceLocation(program, programInterface, stack.allocateUtf8String(name));
+ return getProgramResourceLocation(program, programInterface, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -685,7 +685,7 @@ public static int getProgramResourceLocationIndex(int program, int programInterf
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return getProgramResourceLocationIndex(program, programInterface, stack.allocateUtf8String(name));
+ return getProgramResourceLocationIndex(program, programInterface, stack.allocateFrom(name));
} finally {
stack.setPointer(stackPointer);
}
@@ -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) {
@@ -868,7 +868,7 @@ public static void objectLabel(int identifier, int name, String label) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- objectLabel(identifier, name, label.length(), stack.allocateUtf8String(label));
+ objectLabel(identifier, name, label.length(), stack.allocateFrom(label));
} finally {
stack.setPointer(stackPointer);
}
@@ -887,7 +887,7 @@ public static void objectPtrLabel(MemorySegment ptr, String label) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- objectPtrLabel(ptr, label.length(), stack.allocateUtf8String(label));
+ objectPtrLabel(ptr, label.length(), stack.allocateFrom(label));
} finally {
stack.setPointer(stackPointer);
}
@@ -915,7 +915,7 @@ public static void pushDebugGroup(int source, int id, String message) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- pushDebugGroup(source, id, message.length(), stack.allocateUtf8String(message));
+ pushDebugGroup(source, id, message.length(), stack.allocateFrom(message));
} finally {
stack.setPointer(stackPointer);
}
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 6004b5c2..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
@@ -118,10 +118,10 @@ public static void specializeShader(int shader, MemorySegment pEntryPoint, int n
public static void specializeShader(SegmentAllocator allocator, int shader, @Nullable String pEntryPoint, int @Nullable [] pConstantIndex, int @Nullable [] pConstantValue) {
specializeShader(shader,
- pEntryPoint != null ? allocator.allocateUtf8String(pEntryPoint) : MemorySegment.NULL,
+ 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) {
@@ -129,7 +129,7 @@ public static void specializeShader(int shader, @Nullable String pEntryPoint) {
final long stackPointer = stack.getPointer();
try {
specializeShader(shader,
- pEntryPoint != null ? stack.allocateUtf8String(pEntryPoint) : MemorySegment.NULL,
+ pEntryPoint != null ? stack.allocateFrom(pEntryPoint) : MemorySegment.NULL,
0,
MemorySegment.NULL,
MemorySegment.NULL);
diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLDebugProc.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLDebugProc.java
index ff57aeed..0f054355 100644
--- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLDebugProc.java
+++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLDebugProc.java
@@ -17,7 +17,6 @@
package overrungl.opengl;
import overrungl.Callback;
-import overrungl.internal.RuntimeHelper;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.MemorySegment;
@@ -36,7 +35,7 @@
*/
@FunctionalInterface
public interface GLDebugProc extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.ofVoid(JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, ADDRESS, RuntimeHelper.ADDRESS_UNBOUNDED);
+ FunctionDescriptor DESC = FunctionDescriptor.ofVoid(JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, ADDRESS, ADDRESS);
MethodType MTYPE = DESC.toMethodType();
/**
@@ -53,7 +52,7 @@ public interface GLDebugProc extends Callback {
void invoke(int source, int type, int id, int severity, String message, MemorySegment userParam);
default void ninvoke(int source, int type, int id, int severity, int length, MemorySegment message, MemorySegment userParam) {
- invoke(source, type, id, severity, message.reinterpret(length + 1).getUtf8String(0), userParam);
+ invoke(source, type, id, severity, message.reinterpret(length + 1).getString(0), userParam.reinterpret(Long.MAX_VALUE));
}
@Override
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 07e0cba5..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,14 +49,14 @@ 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;
}
for (int index = 0; index < numExtsI; index++) {
var glStrTmp = GL30C.getStringi(GL10C.EXTENSIONS, index);
- extsI.setAtIndex(ADDRESS, index, allocator.allocateUtf8String(glStrTmp));
+ extsI.setAtIndex(ADDRESS, index, allocator.allocateFrom(glStrTmp));
}
outNumExtsI.set(JAVA_INT, 0, numExtsI);
outExtsI[0] = extsI;
diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/ext/amd/GLDebugProcAMD.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/ext/amd/GLDebugProcAMD.java
index 4a5b5c80..af855e69 100644
--- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/ext/amd/GLDebugProcAMD.java
+++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/ext/amd/GLDebugProcAMD.java
@@ -36,7 +36,7 @@
*/
@FunctionalInterface
public interface GLDebugProcAMD extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.ofVoid(JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, ADDRESS, RuntimeHelper.ADDRESS_UNBOUNDED);
+ FunctionDescriptor DESC = FunctionDescriptor.ofVoid(JAVA_INT, JAVA_INT, JAVA_INT, JAVA_INT, ADDRESS, ADDRESS);
MethodType MTYPE = DESC.toMethodType();
/**
@@ -52,7 +52,7 @@ public interface GLDebugProcAMD extends Callback {
void invoke(int id, int category, int severity, String message, MemorySegment userParam);
default void ninvoke(int id, int category, int severity, int length, MemorySegment message, MemorySegment userParam) {
- invoke(id, category, severity, message.reinterpret(length + 1).getUtf8String(0), userParam);
+ invoke(id, category, severity, message.reinterpret(length + 1).getString(0), userParam.reinterpret(Long.MAX_VALUE));
}
@Override
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 c64a9643..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.allocateUtf8String(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) {
@@ -123,7 +123,7 @@ public static int width(String text) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nwidth(stack.allocateUtf8String(text));
+ return nwidth(stack.allocateFrom(text));
} finally {
stack.setPointer(stackPointer);
}
@@ -141,7 +141,7 @@ public static int height(String text) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nheight(stack.allocateUtf8String(text));
+ return nheight(stack.allocateFrom(text));
} finally {
stack.setPointer(stackPointer);
}
diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBIIoCallbacks.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBIIoCallbacks.java
index 2710be90..b32e0197 100644
--- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBIIoCallbacks.java
+++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBIIoCallbacks.java
@@ -72,9 +72,18 @@ public STBIIoCallbacks(MemorySegment address) {
*/
@FunctionalInterface
public interface Read extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.of(ValueLayout.JAVA_INT, RuntimeHelper.ADDRESS_UNBOUNDED, RuntimeHelper.ADDRESS_UNBOUNDED, ValueLayout.JAVA_INT);
+ FunctionDescriptor DESC = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT);
MethodType MTYPE = DESC.toMethodType();
+ /**
+ * Fill {@code data} with {@code size} bytes.
+ *
+ * @param user userdata
+ * @param data data buffer to be filled
+ * @return number of bytes actually read
+ */
+ int invoke(MemorySegment user, MemorySegment data);
+
/**
* Fill {@code data} with {@code size} bytes.
*
@@ -83,7 +92,9 @@ public interface Read extends Callback {
* @param size byte size to fill
* @return number of bytes actually read
*/
- int invoke(MemorySegment user, MemorySegment data, int size);
+ default int ninvoke(MemorySegment user, MemorySegment data, int size) {
+ return invoke(user.reinterpret(Long.MAX_VALUE), data.reinterpret(size));
+ }
@Override
default FunctionDescriptor descriptor() {
@@ -92,7 +103,7 @@ default FunctionDescriptor descriptor() {
@Override
default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodException, IllegalAccessException {
- return lookup.findVirtual(Read.class, "invoke", MTYPE);
+ return lookup.findVirtual(Read.class, "ninvoke", MTYPE);
}
}
@@ -104,7 +115,7 @@ default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodExce
*/
@FunctionalInterface
public interface Skip extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.ofVoid(RuntimeHelper.ADDRESS_UNBOUNDED, ValueLayout.JAVA_INT);
+ FunctionDescriptor DESC = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_INT);
MethodType MTYPE = DESC.toMethodType();
/**
@@ -115,6 +126,16 @@ public interface Skip extends Callback {
*/
void invoke(MemorySegment user, int n);
+ /**
+ * Skip the next {@code n} bytes, or “unget” the last {@code -n} bytes if negative
+ *
+ * @param user userdata
+ * @param n byte size to skip
+ */
+ default void ninvoke(MemorySegment user, int n) {
+ invoke(user.reinterpret(Long.MAX_VALUE), n);
+ }
+
@Override
default FunctionDescriptor descriptor() {
return DESC;
@@ -122,7 +143,7 @@ default FunctionDescriptor descriptor() {
@Override
default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodException, IllegalAccessException {
- return lookup.findVirtual(Skip.class, "invoke", MTYPE);
+ return lookup.findVirtual(Skip.class, "ninvoke", MTYPE);
}
}
@@ -134,7 +155,7 @@ default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodExce
*/
@FunctionalInterface
public interface Eof extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.of(ValueLayout.JAVA_INT, RuntimeHelper.ADDRESS_UNBOUNDED);
+ FunctionDescriptor DESC = FunctionDescriptor.of(ValueLayout.JAVA_INT, ValueLayout.ADDRESS);
MethodType MTYPE = DESC.toMethodType();
/**
@@ -144,6 +165,15 @@ public interface Eof extends Callback {
*/
int invoke(MemorySegment user);
+ /**
+ * {@return nonzero if we are at end of file/data}
+ *
+ * @param user userdata
+ */
+ default int ninvoke(MemorySegment user) {
+ return invoke(user.reinterpret(Long.MAX_VALUE));
+ }
+
@Override
default FunctionDescriptor descriptor() {
return DESC;
@@ -151,7 +181,7 @@ default FunctionDescriptor descriptor() {
@Override
default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodException, IllegalAccessException {
- return lookup.findVirtual(Eof.class, "invoke", MTYPE);
+ return lookup.findVirtual(Eof.class, "ninvoke", MTYPE);
}
}
diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBIWriteFunc.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBIWriteFunc.java
index a39307bd..eced09bf 100644
--- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBIWriteFunc.java
+++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBIWriteFunc.java
@@ -17,7 +17,6 @@
package overrungl.stb;
import overrungl.Callback;
-import overrungl.internal.RuntimeHelper;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.MemorySegment;
@@ -34,10 +33,14 @@
*/
@FunctionalInterface
public interface STBIWriteFunc extends Callback {
- FunctionDescriptor DESC = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, RuntimeHelper.ADDRESS_UNBOUNDED, ValueLayout.JAVA_INT);
+ FunctionDescriptor DESC = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT);
MethodType MTYPE = DESC.toMethodType();
- void invoke(MemorySegment context, MemorySegment data, int size);
+ void invoke(MemorySegment context, MemorySegment data);
+
+ default void ninvoke(MemorySegment context, MemorySegment data, int size) {
+ invoke(context, data.reinterpret(size));
+ }
@Override
default FunctionDescriptor descriptor() {
@@ -46,6 +49,6 @@ default FunctionDescriptor descriptor() {
@Override
default MethodHandle handle(MethodHandles.Lookup lookup) throws NoSuchMethodException, IllegalAccessException {
- return lookup.findVirtual(STBIWriteFunc.class, "invoke", MTYPE);
+ return lookup.findVirtual(STBIWriteFunc.class, "ninvoke", MTYPE);
}
}
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 40cf44a5..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) {
@@ -165,7 +165,7 @@ public static boolean info(String filename, int[] x, int[] y, int[] comp) {
var px = stack.allocate(JAVA_INT);
var py = stack.allocate(JAVA_INT);
var pc = stack.allocate(JAVA_INT);
- boolean b = ninfo(stack.allocateUtf8String(filename), px, py, pc);
+ boolean b = ninfo(stack.allocateFrom(filename), px, py, pc);
x[0] = px.get(JAVA_INT, 0);
y[0] = py.get(JAVA_INT, 0);
comp[0] = pc.get(JAVA_INT, 0);
@@ -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);
@@ -266,7 +266,7 @@ public static boolean is16Bit(String filename) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nis16Bit(stack.allocateUtf8String(filename));
+ return nis16Bit(stack.allocateFrom(filename));
} finally {
stack.setPointer(stackPointer);
}
@@ -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) {
@@ -320,7 +320,7 @@ public static boolean isHdr(String filename) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nisHdr(stack.allocateUtf8String(filename));
+ return nisHdr(stack.allocateFrom(filename));
} finally {
stack.setPointer(stackPointer);
}
@@ -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) {
@@ -393,7 +393,7 @@ public static MemorySegment load(String filename, int[] x, int[] y, int[] channe
var px = stack.allocate(JAVA_INT);
var py = stack.allocate(JAVA_INT);
var pc = stack.allocate(JAVA_INT);
- var addr = nload(stack.allocateUtf8String(filename), px, py, pc, desiredChannels);
+ var addr = nload(stack.allocateFrom(filename), 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);
@@ -418,7 +418,7 @@ public static MemorySegment load16(String filename, int[] x, int[] y, int[] chan
var px = stack.allocate(JAVA_INT);
var py = stack.allocate(JAVA_INT);
var pc = stack.allocate(JAVA_INT);
- var addr = nload16(stack.allocateUtf8String(filename), px, py, pc, desiredChannels);
+ var addr = nload16(stack.allocateFrom(filename), 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);
@@ -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);
@@ -617,7 +617,7 @@ public static MemorySegment loadf(String filename, int[] x, int[] y, int[] chann
var px = stack.allocate(JAVA_INT);
var py = stack.allocate(JAVA_INT);
var pc = stack.allocate(JAVA_INT);
- var addr = nloadf(stack.allocateUtf8String(filename), px, py, pc, desiredChannels);
+ var addr = nloadf(stack.allocateFrom(filename), 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);
@@ -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(),
diff --git a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java
index 10e45017..22902258 100644
--- a/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java
+++ b/modules/overrungl.stb/src/main/java/overrungl/stb/STBImageWrite.java
@@ -152,7 +152,7 @@ public static boolean png(String filename, int w, int h, int comp, MemorySegment
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return npng(stack.allocateUtf8String(filename), w, h, comp, data, strideInBytes);
+ return npng(stack.allocateFrom(filename), w, h, comp, data, strideInBytes);
} finally {
stack.setPointer(stackPointer);
}
@@ -162,7 +162,7 @@ public static boolean bmp(String filename, int w, int h, int comp, MemorySegment
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return nbmp(stack.allocateUtf8String(filename), w, h, comp, data);
+ return nbmp(stack.allocateFrom(filename), w, h, comp, data);
} finally {
stack.setPointer(stackPointer);
}
@@ -172,21 +172,21 @@ public static boolean tga(String filename, int w, int h, int comp, MemorySegment
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return ntga(stack.allocateUtf8String(filename), w, h, comp, data);
+ return ntga(stack.allocateFrom(filename), w, h, comp, data);
} finally {
stack.setPointer(stackPointer);
}
}
public static boolean hdr(SegmentAllocator allocator, String filename, int w, int h, int comp, float[] data) {
- return nhdr(allocator.allocateUtf8String(filename), w, h, comp, allocator.allocateArray(JAVA_FLOAT, data));
+ return nhdr(allocator.allocateFrom(filename), w, h, comp, allocator.allocateFrom(JAVA_FLOAT, data));
}
public static boolean jpg(String filename, int x, int y, int comp, MemorySegment data, int quality) {
final MemoryStack stack = MemoryStack.stackGet();
final long stackPointer = stack.getPointer();
try {
- return njpg(stack.allocateUtf8String(filename), x, y, comp, data, quality);
+ return njpg(stack.allocateFrom(filename), x, y, comp, data, quality);
} finally {
stack.setPointer(stackPointer);
}
@@ -245,7 +245,7 @@ public static boolean tgaToFunc(Arena arena, STBIWriteFunc func, MemorySegment c
}
public static boolean hdrToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int w, int h, int comp, float[] data) {
- return nhdrToFunc(func.address(arena), context, w, h, comp, arena.allocateArray(JAVA_FLOAT, data));
+ return nhdrToFunc(func.address(arena), context, w, h, comp, arena.allocateFrom(JAVA_FLOAT, data));
}
public static boolean jpgToFunc(Arena arena, STBIWriteFunc func, MemorySegment context, int x, int y, int comp, MemorySegment data, int quality) {
@@ -270,7 +270,7 @@ public static MemorySegment npngToMem(MemorySegment pixels, int strideInBytes, i
public static byte[] pngToMem(SegmentAllocator allocator, byte[] pixels, int strideInBytes, int x, int y, int n, int[] outLen) {
var pl = allocator.allocate(JAVA_INT);
- var p = npngToMem(allocator.allocateArray(JAVA_BYTE, pixels), strideInBytes, x, y, n, pl);
+ var p = npngToMem(allocator.allocateFrom(JAVA_BYTE, pixels), strideInBytes, x, y, n, pl);
final int len = pl.get(JAVA_INT, 0);
outLen[0] = len;
return RuntimeHelper.toArray(p, new byte[len]);
@@ -286,7 +286,7 @@ public static MemorySegment nzlibCompress(MemorySegment data, int dataLen, Memor
public static byte[] zlibCompress(SegmentAllocator allocator, byte[] data, int[] outLen, int quality) {
var pl = allocator.allocate(JAVA_INT);
- var p = nzlibCompress(allocator.allocateArray(JAVA_BYTE, data), data.length, pl, quality);
+ var p = nzlibCompress(allocator.allocateFrom(JAVA_BYTE, data), data.length, pl, quality);
final int len = pl.get(JAVA_INT, 0);
outLen[0] = len;
return RuntimeHelper.toArray(p, new byte[len]);
diff --git a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWJoystickTest.java b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWJoystickTest.java
index 0ec93a2d..4292a3a4 100644
--- a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWJoystickTest.java
+++ b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWJoystickTest.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
@@ -54,7 +54,7 @@ private void init() {
GLFW.windowHint(GLFW.CLIENT_API, GLFW.NO_API);
window = GLFW.createWindow(200, 100, "Holder", MemorySegment.NULL, MemorySegment.NULL);
CheckUtil.checkNotNullptr(window, "Failed to create the GLFW window");
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
diff --git a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java
index debe9522..fb7f580d 100644
--- a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java
+++ b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.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
@@ -82,12 +82,12 @@ private void init(Arena arena) {
throw new RuntimeException(e);
}
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
});
- GLFW.setFramebufferSizeCallback(window, (handle, width, height) ->
+ GLFW.setFramebufferSizeCallback(window, (_, width, height) ->
GL.viewport(0, 0, width, height));
var vidMode = GLFW.getVideoMode(GLFW.getPrimaryMonitor());
if (vidMode != null) {
diff --git a/modules/samples/src/test/java/overrungl/demo/nfd/NFDTest.java b/modules/samples/src/test/java/overrungl/demo/nfd/NFDTest.java
index 7374f897..64fb54cc 100644
--- a/modules/samples/src/test/java/overrungl/demo/nfd/NFDTest.java
+++ b/modules/samples/src/test/java/overrungl/demo/nfd/NFDTest.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
@@ -50,8 +50,8 @@ private static void openDialog() {
final NFDResult result = NFD.openDialogN(outPath, filterItem, null);
switch (result) {
- case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
- case OKAY -> System.out.println(STR. "Success! \{ outPath[0] }" );
+ case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
+ case OKAY -> System.out.println(STR."Success! \{outPath[0]}");
case CANCEL -> System.out.println("User pressed cancel.");
}
}
@@ -81,13 +81,13 @@ private static void openDialogMultiple() {
MemorySegment outPaths = pOutPaths.get(ValueLayout.ADDRESS, 0);
switch (result) {
- case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
+ case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
case OKAY -> {
System.out.println("Success!");
for (long i = 0, numPaths = NFD.pathSetGetCount(outPaths).y(); i < numPaths; i++) {
NFD.pathSetGetPathN(outPaths, i, outPath);
- System.out.println(STR. "Path \{ i }: \{ outPath[0] }" );
+ System.out.println(STR."Path \{i}: \{outPath[0]}");
}
// remember to free the path-set memory (since NFDResult::OKAY is returned)
@@ -121,14 +121,14 @@ private static void openDialogMultipleEnum() {
MemorySegment outPaths = pOutPaths.get(ValueLayout.ADDRESS, 0);
switch (result) {
- case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
+ case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
case OKAY -> {
System.out.println("Success!");
try (NFDEnumerator enumerator = NFDEnumerator.fromPathSetN(stack, outPaths).y()) {
int i = 0;
for (String path : enumerator) {
- System.out.println(STR. "Path \{ i }: \{ path }" );
+ System.out.println(STR."Path \{i}: \{path}");
i++;
}
}
@@ -151,16 +151,14 @@ private static void pickFolder() {
// or before/after every time you want to show a file dialog.
NFD.init();
- try (MemoryStack stack = MemoryStack.stackPush()) {
- String[] outPath = new String[1];
+ String[] outPath = new String[1];
- // show the dialog
- final NFDResult result = NFD.pickFolderN(outPath, null);
- switch (result) {
- case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
- case OKAY -> System.out.println(STR. "Success! \{ outPath[0] }" );
- case CANCEL -> System.out.println("User pressed cancel.");
- }
+ // show the dialog
+ final NFDResult result = NFD.pickFolderN(outPath, null);
+ switch (result) {
+ case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
+ case OKAY -> System.out.println(STR."Success! \{outPath[0]}");
+ case CANCEL -> System.out.println("User pressed cancel.");
}
// Quit NFD
@@ -185,8 +183,8 @@ private static void saveDialog() {
// show the dialog
final NFDResult result = NFD.saveDialogN(savePath, filterItem, null, "Untitled.java");
switch (result) {
- case ERROR -> System.err.println(STR. "Error: \{ NFD.getError() }" );
- case OKAY -> System.out.println(STR. "Success! \{ savePath[0] }" );
+ case ERROR -> System.err.println(STR."Error: \{NFD.getError()}");
+ case OKAY -> System.out.println(STR."Success! \{savePath[0]}");
case CANCEL -> System.out.println("User pressed cancel.");
}
}
diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java
index 98b5774f..4dbf2a8e 100644
--- a/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java
+++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.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
@@ -56,12 +56,12 @@ private void init() {
GLFW.windowHint(GLFW.RESIZABLE, true);
window = GLFW.createWindow(300, 300, "Hello World!", MemorySegment.NULL, MemorySegment.NULL);
CheckUtil.checkNotNullptr(window, "Failed to create the GLFW window");
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
});
- GLFW.setFramebufferSizeCallback(window, (handle, width, height) ->
+ GLFW.setFramebufferSizeCallback(window, (_, width, height) ->
GL.viewport(0, 0, width, height));
var vidMode = GLFW.getVideoMode(GLFW.getPrimaryMonitor());
if (vidMode != null) {
diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java
index 0b099931..6b3b2d92 100644
--- a/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java
+++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.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
@@ -68,12 +68,12 @@ private void init() {
GLFW.windowHint(GLFW.RESIZABLE, true);
window = GLFW.createWindow(640, 480, "OpenGL 1.5", MemorySegment.NULL, MemorySegment.NULL);
CheckUtil.checkNotNullptr(window, "Failed to create the GLFW window");
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
});
- GLFW.setFramebufferSizeCallback(window, (handle, width, height) ->
+ GLFW.setFramebufferSizeCallback(window, (_, width, height) ->
GL.viewport(0, 0, width, height));
var vidMode = GLFW.getVideoMode(GLFW.getPrimaryMonitor());
if (vidMode != null) {
diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java
index e18537d6..b47a87f7 100644
--- a/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java
+++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.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
@@ -74,12 +74,12 @@ private void init() {
GLFW.windowHint(GLFW.RESIZABLE, true);
window = GLFW.createWindow(640, 480, "OpenGL 3.0", MemorySegment.NULL, MemorySegment.NULL);
CheckUtil.checkNotNullptr(window, "Failed to create the GLFW window");
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
});
- GLFW.setFramebufferSizeCallback(window, (handle, width, height) ->
+ GLFW.setFramebufferSizeCallback(window, (_, width, height) ->
GL.viewport(0, 0, width, height));
var vidMode = GLFW.getVideoMode(GLFW.getPrimaryMonitor());
if (vidMode != null) {
diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java
index 751463b9..420a0ad9 100644
--- a/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java
+++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.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
@@ -86,12 +86,12 @@ private void init() {
GLFW.windowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE);
window = GLFW.createWindow(640, 480, WND_TITLE, MemorySegment.NULL, MemorySegment.NULL);
CheckUtil.checkNotNullptr(window, "Failed to create the GLFW window");
- GLFW.setKeyCallback(window, (handle, key, scancode, action, mods) -> {
+ GLFW.setKeyCallback(window, (_, key, _, action, _) -> {
if (key == GLFW.KEY_ESCAPE && action == GLFW.RELEASE) {
GLFW.setWindowShouldClose(window, true);
}
});
- GLFW.setFramebufferSizeCallback(window, (handle, width, height) ->
+ GLFW.setFramebufferSizeCallback(window, (_, width, height) ->
GL.viewport(0, 0, width, height));
var vidMode = GLFW.getVideoMode(GLFW.getPrimaryMonitor());
if (vidMode != null) {
diff --git a/modules/samples/src/test/java/overrungl/demo/stb/STBPerlinTest.java b/modules/samples/src/test/java/overrungl/demo/stb/STBPerlinTest.java
index 61027d11..28897d9f 100644
--- a/modules/samples/src/test/java/overrungl/demo/stb/STBPerlinTest.java
+++ b/modules/samples/src/test/java/overrungl/demo/stb/STBPerlinTest.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
@@ -18,7 +18,6 @@
import overrungl.stb.STBImage;
import overrungl.stb.STBImageWrite;
-import overrungl.util.MemoryStack;
import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
@@ -43,9 +42,7 @@ private static void write(Arena arena, float[][] noise, String fileName) {
buf.set(ValueLayout.JAVA_BYTE, y * HEIGHT + x, (byte) ((noise[y][x] + 1f) * .5f * 255f));
}
}
- try (MemoryStack stack = MemoryStack.stackPush()) {
- STBImageWrite.png(fileName, WIDTH, HEIGHT, STBImage.GREY, buf, WIDTH);
- }
+ STBImageWrite.png(fileName, WIDTH, HEIGHT, STBImage.GREY, buf, WIDTH);
}
public static void main(String[] args) {
diff --git a/modules/samples/src/test/java/overrungl/demo/util/IOUtil.java b/modules/samples/src/test/java/overrungl/demo/util/IOUtil.java
index 2a4ee874..f2336550 100644
--- a/modules/samples/src/test/java/overrungl/demo/util/IOUtil.java
+++ b/modules/samples/src/test/java/overrungl/demo/util/IOUtil.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
@@ -55,7 +55,7 @@ public static MemorySegment ioResourceToSegment(Arena arena, String resource, lo
final boolean isHttp = resource.startsWith("http");
final Path path = isHttp ? null : Path.of(resource);
- // Check whether on local
+ // Check if the path is on local
if (path != null && Files.isReadable(path)) {
try (var fc = FileChannel.open(path)) {
return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size(), arena);
diff --git a/pom.xml b/pom.xml
index 95e7539e..86ff285e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
0.1.0-SNAPSHOT
OverrunGL
- Overrun Game Library is a set of C/C++ library bindings and native accessor.
+ Overrun Game Library is a high-performance library, which enables cross-platform access to a set of C/C++ library bindings, and provides some useful utilities.
https://github.com/Over-Run/overrungl