private int getString(long object, int arg, int param_name, APIBuffer __buffer) { // Get string length int errcode = get(object, arg, param_name, 0, NULL, __buffer.address()); if (DEBUG) checkCLError(errcode); int bytes = (int) __buffer.pointerValue(0); __buffer.bufferParam(bytes + POINTER_SIZE); // Get string errcode = get(object, arg, param_name, bytes, __buffer.address(), NULL); if (DEBUG) checkCLError(errcode); return bytes - 1; // all OpenCL char[] parameters are null-terminated }
/** Single return value version of: {@link #glGetBufferPointerv GetBufferPointerv} */ public static long glGetBufferPointer(int target, int pname) { APIBuffer __buffer = apiBuffer(); int params = __buffer.pointerParam(); nglGetBufferPointerv(target, pname, __buffer.address(params)); return __buffer.pointerValue(params); }
/** * Returns the pointer value for the specified {@code param_name}. * * <p>This method should also be used for integer parameters that may be 32 or 64 bits (e.g. * {@code size_t}). * * @param object the object to query * @param arg an integer argument * @param param_name the parameter to query * @return the parameter's pointer value */ long getPointer(long object, int arg, int param_name) { APIBuffer __buffer = apiBuffer(); int errcode = get(object, arg, param_name, POINTER_SIZE, __buffer.address(), NULL); if (DEBUG) checkCLError(errcode); return __buffer.pointerValue(0); }