Class Checks
Internal class, don't use.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanRuntime checks flag.static final booleanDebug mode flag.static final booleanDebug functions flag. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheck(byte[] buf, int size) Helper method to ensure a array has enough capacity.static voidcheck(double[] buf, int size) Helper method to ensure a array has enough capacity.static voidcheck(float[] buf, int size) Helper method to ensure a array has enough capacity.static voidcheck(int[] buf, int size) Helper method to ensure a array has enough capacity.static longcheck(int index, int length) static longcheck(long pointer) Ensures that the specified pointer is notNULL(0L).static voidcheck(long[] buf, int size) Helper method to ensure a array has enough capacity.static voidcheck(short[] buf, int size) Helper method to ensure a array has enough capacity.static voidcheck(CharSequence text, int size) Helper method to ensure a CharSequence has enough characters.static voidstatic voidHelper method to ensure a buffer has enough capacity.static voidstatic voidcheck(CustomBuffer<?> buf, int size) Helper method to ensure aCustomBufferhas enough capacity.static voidcheck(CustomBuffer<?> buf, long size) static booleancheckFunctions(long... functions) Checks if any of the specified functions pointers isNULL.static booleancheckFunctions(FunctionProviderLocal provider, long handle, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static booleancheckFunctions(FunctionProvider provider, long[] caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static booleancheckFunctions(FunctionProvider provider, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static voidstatic voidcheckGT(CustomBuffer<?> buf, int size) static voidcheckNT(float[] buf) Ensures that the specified array is null-terminated.static voidcheckNT(int[] buf) Ensures that the specified array is null-terminated.static voidcheckNT(int[] buf, int terminator) Ensures that the specified array is terminated with the specified terminator.static voidcheckNT(long[] buf) Ensures that the specified array is null-terminated.static voidcheckNT(FloatBuffer buf) Ensures that the specified FloatBuffer is null-terminated.static voidEnsures that the specified IntBuffer is null-terminated.static voidEnsures that the specified IntBuffer is terminated with the specified terminator.static voidcheckNT(LongBuffer buf) Ensures that the specified LongBuffer is null-terminated.static voidcheckNT(PointerBuffer buf) Ensures that the specified PointerBuffer is null-terminated.static voidcheckNT(PointerBuffer buf, long terminator) Ensures that the specified PointerBuffer is terminated with the specified terminator.static voidcheckNT1(ByteBuffer buf) Ensures that the specified ByteBuffer is null-terminated (last byte equal to 0).static voidcheckNT1Safe(@Nullable ByteBuffer buf) static voidcheckNT2(ByteBuffer buf) Ensures that the specified ByteBuffer is null-terminated (last 2 bytes equal to 0).static voidcheckNT2Safe(@Nullable ByteBuffer buf) static voidcheckNTSafe(float @Nullable [] buf) static voidcheckNTSafe(int @Nullable [] buf) static voidcheckNTSafe(int @Nullable [] buf, int terminator) static voidcheckNTSafe(long @Nullable [] buf) static voidcheckNTSafe(@Nullable FloatBuffer buf) static voidcheckNTSafe(@Nullable IntBuffer buf) static voidcheckNTSafe(@Nullable IntBuffer buf, int terminator) static voidcheckNTSafe(@Nullable LongBuffer buf) static voidcheckNTSafe(@Nullable PointerBuffer buf) static voidcheckNTSafe(@Nullable PointerBuffer buf, long terminator) static voidcheckSafe(double @Nullable [] buf, int size) static voidcheckSafe(float @Nullable [] buf, int size) static voidcheckSafe(int @Nullable [] buf, int size) static voidcheckSafe(long @Nullable [] buf, int size) static voidcheckSafe(short @Nullable [] buf, int size) static voidstatic voidstatic voidcheckSafe(@Nullable CustomBuffer<?> buf, int size) static voidcheckSafe(@Nullable CustomBuffer<?> buf, long size) static intlengthSafe(double @Nullable [] array) static intlengthSafe(float @Nullable [] array) static intlengthSafe(int @Nullable [] array) static intlengthSafe(long @Nullable [] array) static intlengthSafe(short @Nullable [] array) static intremainingSafe(@Nullable Buffer buffer) static intremainingSafe(@Nullable CustomBuffer<?> buffer) static booleanreportMissing(String api, String extension)
-
Field Details
-
CHECKS
public static final boolean CHECKSRuntime checks flag.When enabled, LWJGL will perform basic checks during its operation, mainly to avoid crashes in native code. Examples of such checks are: context-specific function address validation, buffer capacity checks, null-termination checks, etc. These checks are generally low-overhead and should not have a measurable effect on performance, so its recommended to have them enabled both during development and in production releases.
If maximum performance is required, they can be disabled by setting
Configuration.DISABLE_CHECKSto true. -
DEBUG
public static final boolean DEBUGDebug mode flag.When enabled, LWJGL will perform additional checks during its operation. These checks are more expensive than the ones enabled with
CHECKSand will have a noticeable effect on performance, so they are disabled by default. Examples of such checks are: buffer object binding state check (GL), buffer capacity checks for texture images (GL & CL), etc. LWJGL will also print additional information, mainly during start-up.Can be enabled by setting
Configuration.DEBUGto true. -
DEBUG_FUNCTIONS
public static final boolean DEBUG_FUNCTIONSDebug functions flag.When enabled, a warning message will be output to the debug stream when LWJGL fails to retrieve a function pointer.
Can be enabled by setting
Configuration.DEBUG_FUNCTIONSto true.
-
-
Method Details
-
lengthSafe
public static int lengthSafe(short @Nullable [] array) -
lengthSafe
public static int lengthSafe(int @Nullable [] array) -
lengthSafe
public static int lengthSafe(long @Nullable [] array) -
lengthSafe
public static int lengthSafe(float @Nullable [] array) -
lengthSafe
public static int lengthSafe(double @Nullable [] array) -
remainingSafe
-
remainingSafe
-
checkFunctions
public static boolean checkFunctions(long... functions) Checks if any of the specified functions pointers isNULL.- Parameters:
functions- the function pointers to check- Returns:
- true if all function pointers are valid, false otherwise.
-
checkFunctions
public static boolean checkFunctions(FunctionProvider provider, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.- Parameters:
provider- the function address providercaps- the function address bufferindices- the function indicesfunctions- the function names- Returns:
- true if all functions are available, false otherwise
-
checkFunctions
public static boolean checkFunctions(FunctionProviderLocal provider, long handle, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.- Parameters:
provider- the function address providerhandle- the handle to a platform/device/contextcaps- the function address bufferindices- the function indicesfunctions- the function names- Returns:
- true if all functions are available, false otherwise
-
checkFunctions
public static boolean checkFunctions(FunctionProvider provider, long[] caps, int[] indices, String... functions) Checks if all functions are available in the function provider.- Parameters:
provider- the function address providercaps- the function address bufferindices- the function indicesfunctions- the function names- Returns:
- true if all functions are available, false otherwise
-
reportMissing
-
check
public static long check(long pointer) Ensures that the specified pointer is notNULL(0L).- Parameters:
pointer- the pointer to check- Throws:
NullPointerException- ifpointerisNULL
-
checkNT
public static void checkNT(int[] buf) Ensures that the specified array is null-terminated. -
checkNT
public static void checkNT(int[] buf, int terminator) Ensures that the specified array is terminated with the specified terminator. -
checkNT
public static void checkNT(long[] buf) Ensures that the specified array is null-terminated. -
checkNT
public static void checkNT(float[] buf) Ensures that the specified array is null-terminated. -
checkNT1
Ensures that the specified ByteBuffer is null-terminated (last byte equal to 0). -
checkNT2
Ensures that the specified ByteBuffer is null-terminated (last 2 bytes equal to 0). -
checkNT
Ensures that the specified IntBuffer is null-terminated. -
checkNT
Ensures that the specified IntBuffer is terminated with the specified terminator. -
checkNT
Ensures that the specified LongBuffer is null-terminated. -
checkNT
Ensures that the specified FloatBuffer is null-terminated. -
checkNT
Ensures that the specified PointerBuffer is null-terminated. -
checkNT
Ensures that the specified PointerBuffer is terminated with the specified terminator. -
checkNTSafe
public static void checkNTSafe(int @Nullable [] buf) -
checkNTSafe
public static void checkNTSafe(int @Nullable [] buf, int terminator) -
checkNTSafe
public static void checkNTSafe(long @Nullable [] buf) -
checkNTSafe
public static void checkNTSafe(float @Nullable [] buf) -
checkNT1Safe
-
checkNT2Safe
-
checkNTSafe
-
checkNTSafe
-
checkNTSafe
-
checkNTSafe
-
checkNTSafe
-
checkNTSafe
-
check
public static void check(byte[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
public static void check(short[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
public static void check(int[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
public static void check(long[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
public static void check(float[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
public static void check(double[] buf, int size) Helper method to ensure a array has enough capacity.- Parameters:
buf- the array to checksize- the minimum array capacity- Throws:
IllegalArgumentException- ifbuf.length < size
-
check
Helper method to ensure a CharSequence has enough characters.- Parameters:
text- the text to checksize- the minimum number of characters- Throws:
IllegalArgumentException- iftext.length() < size
-
check
Helper method to ensure a buffer has enough capacity.- Parameters:
buf- the buffer to checksize- the minimum buffer capacity- Throws:
IllegalArgumentException- ifbuf.remaining() < size
-
check
- See Also:
-
check
Helper method to ensure aCustomBufferhas enough capacity.- Parameters:
buf- the buffer to checksize- the minimum buffer capacity- Throws:
IllegalArgumentException- ifbuf.remaining() < size
-
check
- See Also:
-
checkSafe
public static void checkSafe(short @Nullable [] buf, int size) -
checkSafe
public static void checkSafe(int @Nullable [] buf, int size) -
checkSafe
public static void checkSafe(long @Nullable [] buf, int size) -
checkSafe
public static void checkSafe(float @Nullable [] buf, int size) -
checkSafe
public static void checkSafe(double @Nullable [] buf, int size) -
checkSafe
-
checkSafe
-
checkSafe
-
checkSafe
-
check
-
checkGT
-
checkGT
-
check
public static long check(int index, int length)
-