Class Checks
Internal class, don't use.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Runtime checks flag.static final boolean
Debug mode flag.static final boolean
Debug functions flag. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
check
(byte[] buf, int size) Helper method to ensure a array has enough capacity.static void
check
(double[] buf, int size) Helper method to ensure a array has enough capacity.static void
check
(float[] buf, int size) Helper method to ensure a array has enough capacity.static void
check
(int[] buf, int size) Helper method to ensure a array has enough capacity.static long
check
(int index, int length) static long
check
(long pointer) Ensures that the specified pointer is notNULL
(0L).static void
check
(long[] buf, int size) Helper method to ensure a array has enough capacity.static void
check
(short[] buf, int size) Helper method to ensure a array has enough capacity.static void
check
(CharSequence text, int size) Helper method to ensure a CharSequence has enough characters.static void
static void
Helper method to ensure a buffer has enough capacity.static void
static void
check
(CustomBuffer<?> buf, int size) Helper method to ensure aCustomBuffer
has enough capacity.static void
check
(CustomBuffer<?> buf, long size) static boolean
checkFunctions
(long... functions) Checks if any of the specified functions pointers isNULL
.static boolean
checkFunctions
(FunctionProviderLocal provider, long handle, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static boolean
checkFunctions
(FunctionProvider provider, long[] caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static boolean
checkFunctions
(FunctionProvider provider, PointerBuffer caps, int[] indices, String... functions) Checks if all functions are available in the function provider.static void
static void
checkGT
(CustomBuffer<?> buf, int size) static void
checkNT
(float[] buf) Ensures that the specified array is null-terminated.static void
checkNT
(int[] buf) Ensures that the specified array is null-terminated.static void
checkNT
(int[] buf, int terminator) Ensures that the specified array is terminated with the specified terminator.static void
checkNT
(long[] buf) Ensures that the specified array is null-terminated.static void
checkNT
(FloatBuffer buf) Ensures that the specified FloatBuffer is null-terminated.static void
Ensures that the specified IntBuffer is null-terminated.static void
Ensures that the specified IntBuffer is terminated with the specified terminator.static void
checkNT
(LongBuffer buf) Ensures that the specified LongBuffer is null-terminated.static void
checkNT
(PointerBuffer buf) Ensures that the specified PointerBuffer is null-terminated.static void
checkNT
(PointerBuffer buf, long terminator) Ensures that the specified PointerBuffer is terminated with the specified terminator.static void
checkNT1
(ByteBuffer buf) Ensures that the specified ByteBuffer is null-terminated (last byte equal to 0).static void
checkNT1Safe
(@Nullable ByteBuffer buf) static void
checkNT2
(ByteBuffer buf) Ensures that the specified ByteBuffer is null-terminated (last 2 bytes equal to 0).static void
checkNT2Safe
(@Nullable ByteBuffer buf) static void
checkNTSafe
(float @Nullable [] buf) static void
checkNTSafe
(int @Nullable [] buf) static void
checkNTSafe
(int @Nullable [] buf, int terminator) static void
checkNTSafe
(long @Nullable [] buf) static void
checkNTSafe
(@Nullable FloatBuffer buf) static void
checkNTSafe
(@Nullable IntBuffer buf) static void
checkNTSafe
(@Nullable IntBuffer buf, int terminator) static void
checkNTSafe
(@Nullable LongBuffer buf) static void
checkNTSafe
(@Nullable PointerBuffer buf) static void
checkNTSafe
(@Nullable PointerBuffer buf, long terminator) static void
checkSafe
(double @Nullable [] buf, int size) static void
checkSafe
(float @Nullable [] buf, int size) static void
checkSafe
(int @Nullable [] buf, int size) static void
checkSafe
(long @Nullable [] buf, int size) static void
checkSafe
(short @Nullable [] buf, int size) static void
static void
static void
checkSafe
(@Nullable CustomBuffer<?> buf, int size) static void
checkSafe
(@Nullable CustomBuffer<?> buf, long size) static int
lengthSafe
(double @Nullable [] array) static int
lengthSafe
(float @Nullable [] array) static int
lengthSafe
(int @Nullable [] array) static int
lengthSafe
(long @Nullable [] array) static int
lengthSafe
(short @Nullable [] array) static int
remainingSafe
(@Nullable Buffer buffer) static int
remainingSafe
(@Nullable CustomBuffer<?> buffer) static boolean
reportMissing
(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_CHECKS
to 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
CHECKS
and 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.DEBUG
to 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_FUNCTIONS
to 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
- ifpointer
isNULL
-
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 aCustomBuffer
has 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)
-