rsDispatch.cpp revision 5b042ca38df2185548fc2bd905d2c460a073598e
148d2eae90f08dc33754a9d280337249690a954d6Miao Wang/*
248d2eae90f08dc33754a9d280337249690a954d6Miao Wang * Copyright (C) 2011-2012 The Android Open Source Project
348d2eae90f08dc33754a9d280337249690a954d6Miao Wang *
448d2eae90f08dc33754a9d280337249690a954d6Miao Wang * Licensed under the Apache License, Version 2.0 (the "License");
548d2eae90f08dc33754a9d280337249690a954d6Miao Wang * you may not use this file except in compliance with the License.
648d2eae90f08dc33754a9d280337249690a954d6Miao Wang * You may obtain a copy of the License at
748d2eae90f08dc33754a9d280337249690a954d6Miao Wang *
848d2eae90f08dc33754a9d280337249690a954d6Miao Wang *      http://www.apache.org/licenses/LICENSE-2.0
948d2eae90f08dc33754a9d280337249690a954d6Miao Wang *
1048d2eae90f08dc33754a9d280337249690a954d6Miao Wang * Unless required by applicable law or agreed to in writing, software
1148d2eae90f08dc33754a9d280337249690a954d6Miao Wang * distributed under the License is distributed on an "AS IS" BASIS,
1248d2eae90f08dc33754a9d280337249690a954d6Miao Wang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1348d2eae90f08dc33754a9d280337249690a954d6Miao Wang * See the License for the specific language governing permissions and
1448d2eae90f08dc33754a9d280337249690a954d6Miao Wang * limitations under the License.
1548d2eae90f08dc33754a9d280337249690a954d6Miao Wang */
1648d2eae90f08dc33754a9d280337249690a954d6Miao Wang#define LOG_TAG "libDispatch"
1748d2eae90f08dc33754a9d280337249690a954d6Miao Wang#include <android/log.h>
1848d2eae90f08dc33754a9d280337249690a954d6Miao Wang
1948d2eae90f08dc33754a9d280337249690a954d6Miao Wang#include "rsDispatch.h"
2048d2eae90f08dc33754a9d280337249690a954d6Miao Wang#include <dlfcn.h>
21394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala#include <limits.h>
2248d2eae90f08dc33754a9d280337249690a954d6Miao Wang
2362e9af7113ca5a33e6da4608470034f691c792b9Miao Wang#define LOG_ERR(...) __android_log_print(ANDROID_LOG_ERROR, "RS Dispatch", __VA_ARGS__);
24394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala#define REDUCE_API_LEVEL INT_MAX
2548d2eae90f08dc33754a9d280337249690a954d6Miao Wang
265b042ca38df2185548fc2bd905d2c460a073598eMiao Wangbool loadSymbols(void* handle, dispatchTable& dispatchTab, int targetApiLevel) {
27f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang#ifdef __LP64__
28cf067b8c4d1e53bc4768fbad239851c579717f2cMiao Wang    // Function to set the native lib path for 64bit compat lib.
29f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang    dispatchTab.SetNativeLibDir = (SetNativeLibDirFnPtr)dlsym(handle, "rsaContextSetNativeLibDir");
30f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang    if (dispatchTab.SetNativeLibDir == NULL) {
3162e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.SetNativeLibDir");
32f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang        return false;
33f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang    }
34f3213d7fd648da98bb3b03204eaf90f03c31926bMiao Wang#endif
355b042ca38df2185548fc2bd905d2c460a073598eMiao Wang
365b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation1DData = (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData");
375b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation1DElementData = (Allocation1DElementDataFnPtr)dlsym(handle, "rsAllocation1DElementData");
385b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation1DRead = (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead");
395b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation2DData = (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData");
405b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation2DRead = (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead");
415b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation3DData = (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData");
425b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.Allocation3DRead = (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead");
435b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange");
445b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange");
455b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap");
465b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap");
475b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped");
485b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationCubeCreateFromBitmap = (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap");
495b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationElementData = (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData");
505b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationElementRead = (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead");
515b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps");
525b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer");
535b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface");
5448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    dispatchTab.AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType");
555b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationIoReceive = (AllocationIoReceiveFnPtr)dlsym(handle, "rsAllocationIoReceive");
565b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationIoSend = (AllocationIoSendFnPtr)dlsym(handle, "rsAllocationIoSend");
575b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead");
585b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D");
595b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface");
605b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll");
615b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName");
625b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate");
635b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg");
645b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal");
655b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextCreate = (ContextCreateFnPtr)dlsym(handle, "rsContextCreate");;
665b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient");
675b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy");
685b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump");
695b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish");
705b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextGetMessage = (ContextGetMessageFnPtr)dlsym(handle, "rsContextGetMessage");
715b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextInitToClient = (ContextInitToClientFnPtr)dlsym(handle, "rsContextInitToClient");
725b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextPeekMessage = (ContextPeekMessageFnPtr)dlsym(handle, "rsContextPeekMessage");
735b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage");
745b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority");
755b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.DeviceCreate = (DeviceCreateFnPtr)dlsym(handle, "rsDeviceCreate");
765b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.DeviceDestroy = (DeviceDestroyFnPtr)dlsym(handle, "rsDeviceDestroy");
775b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.DeviceSetConfig = (DeviceSetConfigFnPtr)dlsym(handle, "rsDeviceSetConfig");
785b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate");
795b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2");
805b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData");
815b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements");
825b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName");;
835b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate");
845b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy");
855b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.SamplerCreate = (SamplerCreateFnPtr)dlsym(handle, "rsSamplerCreate");
865b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation");
875b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate");
885b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate");
895b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptForEach = (ScriptForEachFnPtr)dlsym(handle, "rsScriptForEach");
905b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti");
915b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV");
925b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create");
935b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGroupCreate = (ScriptGroupCreateFnPtr)dlsym(handle, "rsScriptGroupCreate");
945b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute");
955b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput");
965b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput");
975b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate");
985b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke");
995b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate");
1005b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV");
1015b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptKernelIDCreate = (ScriptKernelIDCreateFnPtr)dlsym(handle, "rsScriptKernelIDCreate");
1025b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptReduce = (ScriptReduceFnPtr)dlsym(handle, "rsScriptReduce");
1035b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetTimeZone = (ScriptSetTimeZoneFnPtr)dlsym(handle, "rsScriptSetTimeZone");
1045b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarD = (ScriptSetVarDFnPtr)dlsym(handle, "rsScriptSetVarD");
1055b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarF = (ScriptSetVarFFnPtr)dlsym(handle, "rsScriptSetVarF");
1065b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarI = (ScriptSetVarIFnPtr)dlsym(handle, "rsScriptSetVarI");
1075b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarJ = (ScriptSetVarJFnPtr)dlsym(handle, "rsScriptSetVarJ");
1085b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarObj = (ScriptSetVarObjFnPtr)dlsym(handle, "rsScriptSetVarObj");
1095b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarV = (ScriptSetVarVFnPtr)dlsym(handle, "rsScriptSetVarV");
1105b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.ScriptSetVarVE = (ScriptSetVarVEFnPtr)dlsym(handle, "rsScriptSetVarVE");
1115b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.TypeCreate = (TypeCreateFnPtr)dlsym(handle, "rsTypeCreate");
1125b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dispatchTab.TypeGetNativeData = (TypeGetNativeDataFnPtr)dlsym(handle, "rsaTypeGetNativeData");
1135b042ca38df2185548fc2bd905d2c460a073598eMiao Wang
1145b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    // Clear error buffer for later operations.
1155b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    dlerror();
1165b042ca38df2185548fc2bd905d2c460a073598eMiao Wang
11748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationGetType == NULL) {
11862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationGetType");
11948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
12048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
12148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.TypeGetNativeData == NULL) {
12262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.TypeGetNativeData");
12348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
12448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
12548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ElementGetNativeData == NULL) {
12662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ElementGetNativeData");
12748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
12848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
12948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ElementGetSubElements == NULL) {
13062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ElementGetSubElements");
13148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
13248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
13348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.DeviceCreate == NULL) {
13462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.DeviceCreate");
13548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
13648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
13748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.DeviceDestroy == NULL) {
13862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.DeviceDestroy");
13948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
14048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
14148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.DeviceSetConfig == NULL) {
14262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.DeviceSetConfig");
14348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
14448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
14548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextCreate == NULL) {
14662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextCreate");
14748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
14848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
14948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.GetName == NULL) {
15062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.GetName");
15148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
15248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
15348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextDestroy == NULL) {
15462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextDestroy");
15548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
15648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
15748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextGetMessage == NULL) {
15862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextGetMessage");
15948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
16048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
16148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextPeekMessage == NULL) {
16262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextPeekMessage");
16348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
16448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
16548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextSendMessage == NULL) {
16662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextSendMessage");
16748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
16848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
16948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextInitToClient == NULL) {
17062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextInitToClient");
17148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
17248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
17348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextDeinitToClient == NULL) {
17462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextDeinitToClient");
17548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
17648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
17748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.TypeCreate == NULL) {
17862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.TypeCreate");
17948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
18048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
18148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCreateTyped == NULL) {
18262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateTyped");
18348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
18448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
18548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCreateFromBitmap == NULL) {
18662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateFromBitmap");
18748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
18848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
18948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCubeCreateFromBitmap == NULL) {
19062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCubeCreateFromBitmap");
19148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
19248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
19348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationGetSurface == NULL) {
19462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationGetSurface");
19548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
19648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
19748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationSetSurface == NULL) {
19862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationSetSurface");
19948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
20048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
20148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextFinish == NULL) {
20262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextFinish");
20348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
20448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
20548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextDump == NULL) {
20662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextDump");
20748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
20848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
20948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ContextSetPriority == NULL) {
21062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ContextSetPriority");
21148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
21248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
21348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AssignName == NULL) {
21462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AssignName");
21548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
21648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
21748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ObjDestroy == NULL) {
21862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ObjDestroy");
21948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
22048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
22148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ElementCreate == NULL) {
22262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ElementCreate");
22348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
22448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
22548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ElementCreate2 == NULL) {
22662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ElementCreate2");
22748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
22848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
22948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCopyToBitmap == NULL) {
23062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCopyToBitmap");
23148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
23248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
23348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation1DData == NULL) {
23462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation1DData");
23548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
23648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
23748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation1DElementData == NULL) {
23862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation1DElementData");
23948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
24048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
24148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation2DData == NULL) {
24262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation2DData");
24348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
24448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
24548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation3DData == NULL) {
24662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation3DData");
24748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
24848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
24948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationGenerateMipmaps == NULL) {
25062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationGenerateMipmaps");
25148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
25248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
25348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationRead == NULL) {
25462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationRead");
25548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
25648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
25748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation1DRead == NULL) {
25862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation1DRead");
25948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
26048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
26148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.Allocation2DRead == NULL) {
26262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.Allocation2DRead");
26348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
26448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
26548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationSyncAll == NULL) {
26662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationSyncAll");
26748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
26848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
26948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationResize1D == NULL) {
27062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationResize1D");
27148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
27248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
27348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCopy2DRange == NULL) {
27462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy2DRange");
27548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
27648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
27748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationCopy3DRange == NULL) {
27862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy3DRange");
27948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
28048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
28148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.SamplerCreate == NULL) {
28262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.SamplerCreate");
28348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
28448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
28548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptBindAllocation == NULL) {
28662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptBindAllocation");
28748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
28848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
28948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetTimeZone == NULL) {
29062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetTimeZone");
29148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
29248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
29348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptInvoke == NULL) {
29462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptInvoke");
29548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
29648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
29748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptInvokeV == NULL) {
29862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeV");
29948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
30048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
30148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptForEach == NULL) {
30262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptForEach");
30348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
30448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
30548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarI == NULL) {
30662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarI");
30748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
30848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
30948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarObj == NULL) {
31062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarObj");
31148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
31248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
31348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarJ == NULL) {
31462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarJ");
31548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
31648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
31748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarF == NULL) {
31862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarF");
31948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
32048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
32148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarD == NULL) {
32262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarD");
32348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
32448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
32548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarV == NULL) {
32662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarV");
32748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
32848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
32948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptGetVarV == NULL) {
33062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptGetVarV");
33148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
33248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
33348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptSetVarVE == NULL) {
33462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarVE");
33548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
33648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
33748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptCCreate == NULL) {
33862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptCCreate");
33948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
34048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
34148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptIntrinsicCreate == NULL) {
34262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptIntrinsicCreate");
34348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
34448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
34548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptKernelIDCreate == NULL) {
34662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptKernelIDCreate");
34748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
34848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
34948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptFieldIDCreate == NULL) {
35062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptFieldIDCreate");
35148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
35248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
35348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptGroupCreate == NULL) {
35462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupCreate");
35548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
35648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
35748d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptGroupSetOutput == NULL) {
35862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetOutput");
35948d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
36048d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
36148d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptGroupSetInput == NULL) {
36262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetInput");
36348d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
36448d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
36548d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.ScriptGroupExecute == NULL) {
36662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupExecute");
36748d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
36848d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
36948d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationIoSend == NULL) {
37062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationIoSend");
37148d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
37248d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
37348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    if (dispatchTab.AllocationIoReceive == NULL) {
37462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize dispatchTab.AllocationIoReceive");
37548d2eae90f08dc33754a9d280337249690a954d6Miao Wang        return false;
37648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
3770245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang    // API_21 functions
3785b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    if (targetApiLevel >= 21) {
3790245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang        if (dispatchTab.AllocationGetPointer == NULL) {
38062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.AllocationGetPointer");
3810245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang            return false;
3820245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang        }
38348d2eae90f08dc33754a9d280337249690a954d6Miao Wang    }
3848a6a71757f64f02058a50778c75033546a79f2b5Miao Wang    // API_23 functions
3855b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    if (targetApiLevel >= 23) {
386cf067b8c4d1e53bc4768fbad239851c579717f2cMiao Wang        // ScriptGroup V2 functions
3878a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        if (dispatchTab.ScriptInvokeIDCreate == NULL) {
38862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeIDCreate");
3898a6a71757f64f02058a50778c75033546a79f2b5Miao Wang            return false;
3908a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        }
3918a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        if (dispatchTab.ClosureCreate == NULL) {
39262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ClosureCreate");
3938a6a71757f64f02058a50778c75033546a79f2b5Miao Wang            return false;
3948a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        }
395974ca28675268310b1abb29c6ce95b57fa079e2aMiao Wang        if (dispatchTab.InvokeClosureCreate == NULL) {
39662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.InvokeClosureCreate");
397974ca28675268310b1abb29c6ce95b57fa079e2aMiao Wang            return false;
398974ca28675268310b1abb29c6ce95b57fa079e2aMiao Wang        }
3998a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        if (dispatchTab.ClosureSetArg == NULL) {
40062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ClosureSetArg");
4018a6a71757f64f02058a50778c75033546a79f2b5Miao Wang            return false;
4028a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        }
4038a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        if (dispatchTab.ClosureSetGlobal == NULL) {
40462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ClosureSetGlobal");
4058a6a71757f64f02058a50778c75033546a79f2b5Miao Wang            return false;
4068a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        }
4078a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        if (dispatchTab.ScriptGroup2Create == NULL) {
40862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ScriptGroup2Create");
4098a6a71757f64f02058a50778c75033546a79f2b5Miao Wang            return false;
4108a6a71757f64f02058a50778c75033546a79f2b5Miao Wang        }
411cc8cea7477352898921044483a6c803e25d02665Miao Wang        if (dispatchTab.AllocationElementData == NULL) {
41262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.AllocationElementData");
413cc8cea7477352898921044483a6c803e25d02665Miao Wang            return false;
414cc8cea7477352898921044483a6c803e25d02665Miao Wang        }
415cc8cea7477352898921044483a6c803e25d02665Miao Wang        if (dispatchTab.AllocationElementRead == NULL) {
41662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.AllocationElementRead");
417cc8cea7477352898921044483a6c803e25d02665Miao Wang            return false;
418cc8cea7477352898921044483a6c803e25d02665Miao Wang        }
419cc8cea7477352898921044483a6c803e25d02665Miao Wang        if (dispatchTab.Allocation3DRead == NULL) {
42062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.Allocation3DRead");
421cc8cea7477352898921044483a6c803e25d02665Miao Wang            return false;
422cc8cea7477352898921044483a6c803e25d02665Miao Wang        }
423a8a9a679cb7f7bcce72d0d487b6912125a1c936bMiao Wang        if (dispatchTab.ScriptForEachMulti == NULL) {
42462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ScriptForEachMulti");
425a8a9a679cb7f7bcce72d0d487b6912125a1c936bMiao Wang            return false;
426a8a9a679cb7f7bcce72d0d487b6912125a1c936bMiao Wang        }
4278a6a71757f64f02058a50778c75033546a79f2b5Miao Wang    }
428394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala    // TODO: Update the API level when reduce is added.
4295b042ca38df2185548fc2bd905d2c460a073598eMiao Wang    if (targetApiLevel >= REDUCE_API_LEVEL) {
430394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala        if (dispatchTab.ScriptReduce == nullptr) {
43162e9af7113ca5a33e6da4608470034f691c792b9Miao Wang            LOG_ERR("Couldn't initialize dispatchTab.ScriptReduce");
432394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala            return false;
433394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala        }
434394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala    }
4358a6a71757f64f02058a50778c75033546a79f2b5Miao Wang
43648d2eae90f08dc33754a9d280337249690a954d6Miao Wang    return true;
4378a6a71757f64f02058a50778c75033546a79f2b5Miao Wang
43848d2eae90f08dc33754a9d280337249690a954d6Miao Wang}
43948d2eae90f08dc33754a9d280337249690a954d6Miao Wang
4402bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang
4412bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wangbool loadIOSuppSyms(void* handleIO, ioSuppDT& ioDispatch){
4422bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang    ioDispatch.sAllocationSetSurface = (sAllocationSetSurfaceFnPtr)dlsym(handleIO, "AllocationSetSurface");
4432bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang    if (ioDispatch.sAllocationSetSurface == NULL) {
44462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang        LOG_ERR("Couldn't initialize ioDispatch.sAllocationSetSurface");
4452bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang        return false;
4462bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang    }
4472bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang    return true;
4482bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang}
449