// see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetProgramInfo.html func GetProgramInfo(prog Program, paramName ProgramInfo, paramValueSize uint64, paramValue unsafe.Pointer, paramValueSizeRet *uint64) ErrorCode { return ErrorCode(C.clGetProgramInfo(prog, C.cl_program_info(paramName), C.size_t(paramValueSize), paramValue, (*C.size_t)(paramValueSizeRet))) }
func CLGetProgramInfo(program CL_program, param_name CL_program_info, param_value_size CL_size_t, param_value *interface{}, param_value_size_ret *CL_size_t) CL_int { if (param_value_size == 0 || param_value == nil) && param_value_size_ret == nil { return CL_INVALID_VALUE } else { var c_param_value_size_ret C.size_t var c_errcode_ret C.cl_int if param_value_size == 0 || param_value == nil { c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), nil, &c_param_value_size_ret) } else { switch param_name { case CL_PROGRAM_SOURCE: value := make([]C.char, param_value_size) c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value[0]), &c_param_value_size_ret) *param_value = C.GoStringN(&value[0], C.int(c_param_value_size_ret-1)) case CL_PROGRAM_REFERENCE_COUNT, CL_PROGRAM_NUM_DEVICES: var value C.cl_uint c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value), &c_param_value_size_ret) case CL_PROGRAM_CONTEXT: var value C.cl_context c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value), &c_param_value_size_ret) case CL_PROGRAM_DEVICES: var param C.cl_device_id length := int(C.size_t(param_value_size) / C.size_t(unsafe.Sizeof(param))) value1 := make([]C.cl_device_id, length) value2 := make([]CL_device_id, length) c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value1[0]), &c_param_value_size_ret) for i := 0; i < length; i++ { value2[i].cl_device_id = value1[i] } *param_value = value2 case CL_PROGRAM_BINARY_SIZES: var param C.size_t length := int(C.size_t(param_value_size) / C.size_t(unsafe.Sizeof(param))) value1 := make([]C.size_t, length) value2 := make([]CL_size_t, length) c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value1[0]), &c_param_value_size_ret) for i := 0; i < length; i++ { value2[i] = CL_size_t(value1[i]) } *param_value = value2 case CL_PROGRAM_BINARIES: var param *C.uchar length := int(C.size_t(param_value_size) / C.size_t(unsafe.Sizeof(param))) value1 := make([]*C.uchar, length) value2 := make([]*CL_uchar, length) c_errcode_ret = C.clGetProgramInfo(program.cl_program, C.cl_program_info(param_name), C.size_t(param_value_size), unsafe.Pointer(&value1[0]), &c_param_value_size_ret) for i := 0; i < length; i++ { value2[i] = (*CL_uchar)(value1[i]) } *param_value = value2 default: return CL_INVALID_VALUE } } if param_value_size_ret != nil { *param_value_size_ret = CL_size_t(c_param_value_size_ret) } return CL_int(c_errcode_ret) } }