Skip to content

Commit

Permalink
fix(opencl): missing errcode_ret parameter. Close #560
Browse files Browse the repository at this point in the history
  • Loading branch information
Spasi committed May 22, 2020
1 parent 1b7e21e commit 30db58b
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 11 deletions.
1 change: 1 addition & 0 deletions doc/notes/3.2.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ This build includes the following changes:
#### Fixes

- GLFW: Fixed main thread check. Setting `GLFW_CHECK_THREAD0` to `false` is now required for offscreen interop. (#538)
- OpenCL: Added missing `errcode_ret` parameter to `clLinkProgram`. (#560)
- Vulkan: Fixed GLFW configuration for MoltenVK. (#502)
- Vulkan: Fixed `vkGetInstanceProcAddr` to work with `null` instance arguments.
- Vulkan: Fixed unsigned arithmetic in `VK_VERSION_MAJOR` and `VK_VERSION_MINOR` macros.
Expand Down
11 changes: 9 additions & 2 deletions modules/lwjgl/core/src/generated/c/org_lwjgl_system_JNI.c
Original file line number Diff line number Diff line change
Expand Up @@ -2319,9 +2319,9 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPP__JIJJJJJJ(JNIEnv *
UNUSED_PARAMS(__env, clazz)
return (jlong)((intptr_t (APIENTRY *) (intptr_t, jint, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t))(intptr_t)__functionAddress)((intptr_t)param0, param1, (intptr_t)param2, (intptr_t)param3, (intptr_t)param4, (intptr_t)param5, (intptr_t)param6);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPP__JIJJIJJJJ(JNIEnv *__env, jclass clazz, jlong param0, jint param1, jlong param2, jlong param3, jint param4, jlong param5, jlong param6, jlong param7, jlong __functionAddress) {
JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPPP__JIJJIJJJJJ(JNIEnv *__env, jclass clazz, jlong param0, jint param1, jlong param2, jlong param3, jint param4, jlong param5, jlong param6, jlong param7, jlong param8, jlong __functionAddress) {
UNUSED_PARAMS(__env, clazz)
return (jlong)((intptr_t (APIENTRY *) (intptr_t, jint, intptr_t, intptr_t, jint, intptr_t, intptr_t, intptr_t))(intptr_t)__functionAddress)((intptr_t)param0, param1, (intptr_t)param2, (intptr_t)param3, param4, (intptr_t)param5, (intptr_t)param6, (intptr_t)param7);
return (jlong)((intptr_t (APIENTRY *) (intptr_t, jint, intptr_t, intptr_t, jint, intptr_t, intptr_t, intptr_t, intptr_t))(intptr_t)__functionAddress)((intptr_t)param0, param1, (intptr_t)param2, (intptr_t)param3, param4, (intptr_t)param5, (intptr_t)param6, (intptr_t)param7, (intptr_t)param8);
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPPP__IJJIIIIJJJIJJJ(JNIEnv *__env, jclass clazz, jint param0, jlong param1, jlong param2, jint param3, jint param4, jint param5, jint param6, jlong param7, jlong param8, jlong param9, jint param10, jlong param11, jlong param12, jlong __functionAddress) {
UNUSED_PARAMS(__env, clazz)
Expand Down Expand Up @@ -5164,6 +5164,13 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPP__JIJJJ_3I_3IJ(JNIE
if (param5 != NULL) { (*__env)->ReleaseIntArrayElements(__env, param5, paramArray5, 0); }
return __result;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPPP__JIJJIJJJ_3IJ(JNIEnv *__env, jclass clazz, jlong param0, jint param1, jlong param2, jlong param3, jint param4, jlong param5, jlong param6, jlong param7, jintArray param8, jlong __functionAddress) {
UNUSED_PARAMS(__env, clazz)
void *paramArray8 = param8 == NULL ? NULL : (*__env)->GetIntArrayElements(__env, param8, NULL);
jlong __result = (jlong)((intptr_t (APIENTRY *) (intptr_t, jint, intptr_t, intptr_t, jint, intptr_t, intptr_t, intptr_t, intptr_t))(intptr_t)__functionAddress)((intptr_t)param0, param1, (intptr_t)param2, (intptr_t)param3, param4, (intptr_t)param5, (intptr_t)param6, (intptr_t)param7, (intptr_t)paramArray8);
if (param8 != NULL) { (*__env)->ReleaseIntArrayElements(__env, param8, paramArray8, 0); }
return __result;
}
JNIEXPORT jlong JNICALL Java_org_lwjgl_system_JNI_callPPPPPPPP__I_3I_3JIIIIJJJI_3I_3JJ(JNIEnv *__env, jclass clazz, jint param0, jintArray param1, jlongArray param2, jint param3, jint param4, jint param5, jint param6, jlong param7, jlong param8, jlong param9, jint param10, jintArray param11, jlongArray param12, jlong __functionAddress) {
UNUSED_PARAMS(__env, clazz)
void *paramArray1 = param1 == NULL ? NULL : (*__env)->GetIntArrayElements(__env, param1, NULL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ private JNI() {}
public static native long callPJPPPPP(long param0, long param1, long param2, long param3, long param4, long param5, long __functionAddress);
public static native long callPPPJPPP(long param0, long param1, long param2, long param3, long param4, long param5, long __functionAddress);
public static native long callPPPPPPP(long param0, int param1, long param2, long param3, long param4, long param5, long param6, long __functionAddress);
public static native long callPPPPPPP(long param0, int param1, long param2, long param3, int param4, long param5, long param6, long param7, long __functionAddress);
public static native long callPPPPPPPP(long param0, int param1, long param2, long param3, int param4, long param5, long param6, long param7, long param8, long __functionAddress);
public static native long callPPPPPPPP(int param0, long param1, long param2, int param3, int param4, int param5, int param6, long param7, long param8, long param9, int param10, long param11, long param12, long __functionAddress);
public static native long callPJPPPPPPP(long param0, long param1, long param2, long param3, long param4, long param5, long param6, long param7, long __functionAddress);
public static native long callPPJPPPPPP(long param0, long param1, int param2, long param3, long param4, long param5, int param6, long param7, long param8, long param9, long __functionAddress);
Expand Down Expand Up @@ -1145,6 +1145,7 @@ private JNI() {}
public static native long callPJPPPPP(long param0, long param1, long param2, long param3, @Nullable short[] param4, @Nullable int[] param5, long __functionAddress);
public static native long callPPPJPPP(long param0, long param1, long param2, long param3, long param4, @Nullable int[] param5, long __functionAddress);
public static native long callPPPPPPP(long param0, int param1, long param2, long param3, long param4, @Nullable int[] param5, @Nullable int[] param6, long __functionAddress);
public static native long callPPPPPPPP(long param0, int param1, long param2, long param3, int param4, long param5, long param6, long param7, @Nullable int[] param8, long __functionAddress);
public static native long callPPPPPPPP(int param0, @Nullable int[] param1, @Nullable long[] param2, int param3, int param4, int param5, int param6, long param7, long param8, long param9, int param10, @Nullable int[] param11, @Nullable long[] param12, long __functionAddress);
public static native long callPJPPPPPPP(long param0, long param1, long param2, long param3, long param4, long param5, long param6, @Nullable int[] param7, long __functionAddress);
public static native long callPJPPPPPPP(long param0, long param1, long param2, long param3, long param4, long param5, @Nullable float[] param6, @Nullable int[] param7, long __functionAddress);
Expand Down
66 changes: 58 additions & 8 deletions modules/lwjgl/opencl/src/generated/java/org/lwjgl/opencl/CL12.java
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,13 @@ public static int clCompileProgram(@NativeType("cl_program") long program, @Null
* @param num_devices the number of devices listed in {@code device_list}
* @param num_input_programs the number of programs in array referenced by {@code input_programs}
*/
public static long nclLinkProgram(long context, int num_devices, long device_list, long options, int num_input_programs, long input_programs, long pfn_notify, long user_data) {
public static long nclLinkProgram(long context, int num_devices, long device_list, long options, int num_input_programs, long input_programs, long pfn_notify, long user_data, long errcode_ret) {
long __functionAddress = CL.getICD().clLinkProgram;
if (CHECKS) {
check(__functionAddress);
check(context);
}
return callPPPPPPP(context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, __functionAddress);
return callPPPPPPPP(context, num_devices, device_list, options, num_input_programs, input_programs, pfn_notify, user_data, errcode_ret, __functionAddress);
}

/**
Expand Down Expand Up @@ -1062,6 +1062,7 @@ public static long nclLinkProgram(long context, int num_devices, long device_lis
*
* <p>If {@code pfn_notify} is {@code NULL}, {@code clLinkProgram} does not return until the linker has completed.</p>
* @param user_data will be passed as an argument when {@code pfn_notify} is called. {@code user_data} can be {@code NULL}.
* @param errcode_ret will return an appropriate error code. If {@code errcode_ret} is {@code NULL}, no error code is returned.
*
* @return a valid non-zero program object, if the linking operation can begin. The linking operation can begin if the context, list of devices, input programs and
* linker options specified are all valid and appropriate host and device resources needed to perform the link are available.
Expand Down Expand Up @@ -1099,11 +1100,12 @@ public static long nclLinkProgram(long context, int num_devices, long device_lis
* @see <a target="_blank" href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clLinkProgram.html">Reference Page</a>
*/
@NativeType("cl_program")
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") ByteBuffer options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data) {
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") ByteBuffer options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data, @Nullable @NativeType("cl_int *") IntBuffer errcode_ret) {
if (CHECKS) {
checkNT1(options);
checkSafe(errcode_ret, 1);
}
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), memAddress(options), remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data);
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), memAddress(options), remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data, memAddressSafe(errcode_ret));
}

/**
Expand Down Expand Up @@ -1140,6 +1142,7 @@ public static long clLinkProgram(@NativeType("cl_context") long context, @Nullab
*
* <p>If {@code pfn_notify} is {@code NULL}, {@code clLinkProgram} does not return until the linker has completed.</p>
* @param user_data will be passed as an argument when {@code pfn_notify} is called. {@code user_data} can be {@code NULL}.
* @param errcode_ret will return an appropriate error code. If {@code errcode_ret} is {@code NULL}, no error code is returned.
*
* @return a valid non-zero program object, if the linking operation can begin. The linking operation can begin if the context, list of devices, input programs and
* linker options specified are all valid and appropriate host and device resources needed to perform the link are available.
Expand Down Expand Up @@ -1177,12 +1180,15 @@ public static long clLinkProgram(@NativeType("cl_context") long context, @Nullab
* @see <a target="_blank" href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clLinkProgram.html">Reference Page</a>
*/
@NativeType("cl_program")
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") CharSequence options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data) {
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") CharSequence options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data, @Nullable @NativeType("cl_int *") IntBuffer errcode_ret) {
if (CHECKS) {
checkSafe(errcode_ret, 1);
}
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
stack.nASCII(options, true);
long optionsEncoded = stack.getPointerAddress();
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), optionsEncoded, remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data);
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), optionsEncoded, remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data, memAddressSafe(errcode_ret));
} finally {
stack.setPointer(stackPointer);
}
Expand Down Expand Up @@ -1212,6 +1218,7 @@ public static long clLinkProgram(@NativeType("cl_context") long context, @Nullab
*
* <p>If {@code pfn_notify} is {@code NULL}, {@code clLinkProgram} does not return until the linker has completed.</p>
* @param user_data will be passed as an argument when {@code pfn_notify} is called. {@code user_data} can be {@code NULL}.
* @param errcode_ret will return an appropriate error code. If {@code errcode_ret} is {@code NULL}, no error code is returned.
*
* @return a valid non-zero program object, if the linking operation can begin. The linking operation can begin if the context, list of devices, input programs and
* linker options specified are all valid and appropriate host and device resources needed to perform the link are available.
Expand Down Expand Up @@ -1249,13 +1256,16 @@ public static long clLinkProgram(@NativeType("cl_context") long context, @Nullab
* @see <a target="_blank" href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clLinkProgram.html">Reference Page</a>
*/
@NativeType("cl_program")
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") CharSequence options, @NativeType("cl_program const *") long input_program, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data) {
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") CharSequence options, @NativeType("cl_program const *") long input_program, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data, @Nullable @NativeType("cl_int *") IntBuffer errcode_ret) {
if (CHECKS) {
checkSafe(errcode_ret, 1);
}
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
stack.nASCII(options, true);
long optionsEncoded = stack.getPointerAddress();
PointerBuffer input_programs = stack.pointers(input_program);
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), optionsEncoded, 1, memAddress(input_programs), memAddressSafe(pfn_notify), user_data);
return nclLinkProgram(context, remainingSafe(device_list), memAddressSafe(device_list), optionsEncoded, 1, memAddress(input_programs), memAddressSafe(pfn_notify), user_data, memAddressSafe(errcode_ret));
} finally {
stack.setPointer(stackPointer);
}
Expand Down Expand Up @@ -1964,6 +1974,46 @@ public static long clCreateProgramWithBuiltInKernels(@NativeType("cl_context") l
}
}

/**
* Array version of: {@link #clLinkProgram LinkProgram}
*
* @see <a target="_blank" href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clLinkProgram.html">Reference Page</a>
*/
@NativeType("cl_program")
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") ByteBuffer options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data, @Nullable @NativeType("cl_int *") int[] errcode_ret) {
long __functionAddress = CL.getICD().clLinkProgram;
if (CHECKS) {
check(__functionAddress);
check(context);
checkNT1(options);
checkSafe(errcode_ret, 1);
}
return callPPPPPPPP(context, remainingSafe(device_list), memAddressSafe(device_list), memAddress(options), remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data, errcode_ret, __functionAddress);
}

/**
* Array version of: {@link #clLinkProgram LinkProgram}
*
* @see <a target="_blank" href="https://www.khronos.org/registry/OpenCL/sdk/2.1/docs/man/xhtml/clLinkProgram.html">Reference Page</a>
*/
@NativeType("cl_program")
public static long clLinkProgram(@NativeType("cl_context") long context, @Nullable @NativeType("cl_device_id const *") PointerBuffer device_list, @NativeType("cl_char const *") CharSequence options, @Nullable @NativeType("cl_program const *") PointerBuffer input_programs, @Nullable @NativeType("void (*) (cl_program, void *)") CLProgramCallbackI pfn_notify, @NativeType("void *") long user_data, @Nullable @NativeType("cl_int *") int[] errcode_ret) {
long __functionAddress = CL.getICD().clLinkProgram;
if (CHECKS) {
check(__functionAddress);
check(context);
checkSafe(errcode_ret, 1);
}
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
stack.nASCII(options, true);
long optionsEncoded = stack.getPointerAddress();
return callPPPPPPPP(context, remainingSafe(device_list), memAddressSafe(device_list), optionsEncoded, remainingSafe(input_programs), memAddressSafe(input_programs), memAddressSafe(pfn_notify), user_data, errcode_ret, __functionAddress);
} finally {
stack.setPointer(stackPointer);
}
}

/**
* Array version of: {@link #clGetKernelArgInfo GetKernelArgInfo}
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ val CL12 = "CL12".nativeClassCL("CL12") {
"""
),
nullable..opaque_p("user_data", "will be passed as an argument when {@code pfn_notify} is called. {@code user_data} can be #NULL."),
ERROR_RET,

returnDoc =
"""
Expand Down

0 comments on commit 30db58b

Please sign in to comment.