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__); 24ae2ec3febedfc29376b9104413fb4042028f1265David Gross#define REDUCE_API_LEVEL 24 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"); 305abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.SetNativeLibDir == nullptr) { 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"); 43c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.AllocationAdapterCreate = (AllocationAdapterCreateFnPtr)dlsym(handle, "rsAllocationAdapterCreate"); 44c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.AllocationAdapterOffset = (AllocationAdapterOffsetFnPtr)dlsym(handle, "rsAllocationAdapterOffset"); 455b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange"); 465b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange"); 475b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap"); 485b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap"); 495b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped"); 505b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationCubeCreateFromBitmap = (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap"); 515b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationElementData = (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData"); 525b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationElementRead = (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead"); 535b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps"); 545b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"); 555b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"); 5648d2eae90f08dc33754a9d280337249690a954d6Miao Wang dispatchTab.AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"); 575b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationIoReceive = (AllocationIoReceiveFnPtr)dlsym(handle, "rsAllocationIoReceive"); 585b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationIoSend = (AllocationIoSendFnPtr)dlsym(handle, "rsAllocationIoSend"); 595b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"); 605b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"); 615b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"); 62c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.AllocationSetupBufferQueue = (AllocationSetupBufferQueueFnPtr)dlsym(handle, "rsAllocationSetupBufferQueue"); 63c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.AllocationShareBufferQueue = (AllocationShareBufferQueueFnPtr)dlsym(handle, "rsAllocationShareBufferQueue"); 645b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"); 655b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName"); 665b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate"); 675b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg"); 685b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"); 695b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextCreate = (ContextCreateFnPtr)dlsym(handle, "rsContextCreate");; 705b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient"); 715b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"); 725b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump"); 735b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish"); 745b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextGetMessage = (ContextGetMessageFnPtr)dlsym(handle, "rsContextGetMessage"); 755b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextInitToClient = (ContextInitToClientFnPtr)dlsym(handle, "rsContextInitToClient"); 765b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextPeekMessage = (ContextPeekMessageFnPtr)dlsym(handle, "rsContextPeekMessage"); 775b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"); 785b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"); 79c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextSetCacheDir = (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"); 805b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.DeviceCreate = (DeviceCreateFnPtr)dlsym(handle, "rsDeviceCreate"); 815b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.DeviceDestroy = (DeviceDestroyFnPtr)dlsym(handle, "rsDeviceDestroy"); 825b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.DeviceSetConfig = (DeviceSetConfigFnPtr)dlsym(handle, "rsDeviceSetConfig"); 835b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"); 845b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"); 855b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"); 865b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"); 875b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName");; 885b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"); 895b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"); 905b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.SamplerCreate = (SamplerCreateFnPtr)dlsym(handle, "rsSamplerCreate"); 915b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"); 925b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate"); 935b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"); 945b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptForEach = (ScriptForEachFnPtr)dlsym(handle, "rsScriptForEach"); 955b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"); 965b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV"); 975b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"); 985b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGroupCreate = (ScriptGroupCreateFnPtr)dlsym(handle, "rsScriptGroupCreate"); 995b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"); 1005b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"); 1015b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"); 1025b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"); 1035b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"); 1045b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"); 1055b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"); 1065b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptKernelIDCreate = (ScriptKernelIDCreateFnPtr)dlsym(handle, "rsScriptKernelIDCreate"); 1075b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptReduce = (ScriptReduceFnPtr)dlsym(handle, "rsScriptReduce"); 1085b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetTimeZone = (ScriptSetTimeZoneFnPtr)dlsym(handle, "rsScriptSetTimeZone"); 1095b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarD = (ScriptSetVarDFnPtr)dlsym(handle, "rsScriptSetVarD"); 1105b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarF = (ScriptSetVarFFnPtr)dlsym(handle, "rsScriptSetVarF"); 1115b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarI = (ScriptSetVarIFnPtr)dlsym(handle, "rsScriptSetVarI"); 1125b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarJ = (ScriptSetVarJFnPtr)dlsym(handle, "rsScriptSetVarJ"); 1135b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarObj = (ScriptSetVarObjFnPtr)dlsym(handle, "rsScriptSetVarObj"); 1145b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarV = (ScriptSetVarVFnPtr)dlsym(handle, "rsScriptSetVarV"); 1155b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.ScriptSetVarVE = (ScriptSetVarVEFnPtr)dlsym(handle, "rsScriptSetVarVE"); 1165b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.TypeCreate = (TypeCreateFnPtr)dlsym(handle, "rsTypeCreate"); 1175b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dispatchTab.TypeGetNativeData = (TypeGetNativeDataFnPtr)dlsym(handle, "rsaTypeGetNativeData"); 1185b042ca38df2185548fc2bd905d2c460a073598eMiao Wang 119c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang // Load graphics APIs 120c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextCreateGL = (ContextCreateGLFnPtr)dlsym(handle, "rsContextCreateGL"); 121c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextSetSurface = (ContextSetSurfaceFnPtr)dlsym(handle, "rsContextSetSurface"); 122c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextPause = (ContextPauseFnPtr)dlsym(handle, "rsContextPause"); 123c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextResume = (ContextResumeFnPtr)dlsym(handle, "rsContextResume"); 124c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindProgramStore = (ContextBindProgramStoreFnPtr)dlsym(handle, "rsContextBindProgramStore"); 125c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindProgramFragment = (ContextBindProgramFragmentFnPtr)dlsym(handle, "rsContextBindProgramFragment"); 126c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindProgramVertex = (ContextBindProgramVertexFnPtr)dlsym(handle, "rsContextBindProgramVertex"); 127c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindProgramRaster = (ContextBindProgramRasterFnPtr)dlsym(handle, "rsContextBindProgramRaster"); 128c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindFont = (ContextBindFontFnPtr)dlsym(handle, "rsContextBindFont"); 129c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ContextBindRootScript = (ContextBindRootScriptFnPtr)dlsym(handle, "rsContextBindRootScript"); 130c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang 131c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramStoreCreate = (ProgramStoreCreateFnPtr)dlsym(handle, "rsProgramStoreCreate"); 132c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramRasterCreate = (ProgramRasterCreateFnPtr)dlsym(handle, "rsProgramRasterCreate"); 133c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramBindConstants = (ProgramBindConstantsFnPtr)dlsym(handle, "rsProgramBindConstants"); 134c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramBindTexture = (ProgramBindTextureFnPtr)dlsym(handle, "rsProgramBindTexture"); 135c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramBindSampler = (ProgramBindSamplerFnPtr)dlsym(handle, "rsProgramBindSampler"); 136c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramFragmentCreate = (ProgramFragmentCreateFnPtr)dlsym(handle, "rsProgramFragmentCreate"); 137c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.ProgramVertexCreate = (ProgramVertexCreateFnPtr)dlsym(handle, "rsProgramVertexCreate"); 138c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FontCreateFromFile = (FontCreateFromFileFnPtr)dlsym(handle, "rsFontCreateFromFile"); 139c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FontCreateFromMemory = (FontCreateFromMemoryFnPtr)dlsym(handle, "rsFontCreateFromMemory"); 140c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.MeshCreate = (MeshCreateFnPtr)dlsym(handle, "rsMeshCreate"); 141c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.MeshGetVertexBufferCount = (MeshGetVertexBufferCountFnPtr)dlsym(handle, "rsaMeshGetVertexBufferCount"); 142c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.MeshGetIndexCount = (MeshGetIndexCountFnPtr)dlsym(handle, "rsaMeshGetIndexCount"); 143c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.MeshGetVertices = (MeshGetVerticesFnPtr)dlsym(handle, "rsaMeshGetVertices"); 144c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.MeshGetIndices = (MeshGetIndicesFnPtr)dlsym(handle, "rsaMeshGetIndices"); 145c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DGetEntryByIndex = (FileA3DGetEntryByIndexFnPtr)dlsym(handle, "rsaFileA3DGetEntryByIndex"); 146c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DGetNumIndexEntries = (FileA3DGetNumIndexEntriesFnPtr)dlsym(handle, "rsaFileA3DGetNumIndexEntries"); 147c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DGetIndexEntries = (FileA3DGetIndexEntriesFnPtr)dlsym(handle, "rsaFileA3DGetIndexEntries"); 148c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DCreateFromMemory = (FileA3DCreateFromMemoryFnPtr)dlsym(handle, "rsaFileA3DCreateFromMemory"); 149c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DCreateFromAsset = (FileA3DCreateFromAssetFnPtr)dlsym(handle, "rsaFileA3DCreateFromAsset"); 150c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang dispatchTab.FileA3DCreateFromFile = (FileA3DCreateFromFileFnPtr)dlsym(handle, "rsaFileA3DCreateFromFile"); 151c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang 1525b042ca38df2185548fc2bd905d2c460a073598eMiao Wang // Clear error buffer for later operations. 1535b042ca38df2185548fc2bd905d2c460a073598eMiao Wang dlerror(); 1545b042ca38df2185548fc2bd905d2c460a073598eMiao Wang 1555abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationGetType == nullptr) { 15662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationGetType"); 15748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 15848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1595abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.TypeGetNativeData == nullptr) { 16062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.TypeGetNativeData"); 16148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 16248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1635abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ElementGetNativeData == nullptr) { 16462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ElementGetNativeData"); 16548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 16648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1675abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ElementGetSubElements == nullptr) { 16862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ElementGetSubElements"); 16948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 17048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1715abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.DeviceCreate == nullptr) { 17262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.DeviceCreate"); 17348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 17448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1755abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.DeviceDestroy == nullptr) { 17662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.DeviceDestroy"); 17748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 17848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1795abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.DeviceSetConfig == nullptr) { 18062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.DeviceSetConfig"); 18148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 18248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1835abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextCreate == nullptr) { 18462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextCreate"); 18548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 18648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1875abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.GetName == nullptr) { 18862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.GetName"); 18948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 19048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1915abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextDestroy == nullptr) { 19262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextDestroy"); 19348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 19448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1955abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextGetMessage == nullptr) { 19662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextGetMessage"); 19748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 19848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 1995abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextPeekMessage == nullptr) { 20062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextPeekMessage"); 20148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 20248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2035abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextSendMessage == nullptr) { 20462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextSendMessage"); 20548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 20648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2075abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextInitToClient == nullptr) { 20862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextInitToClient"); 20948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 21048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2115abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextDeinitToClient == nullptr) { 21262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextDeinitToClient"); 21348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 21448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2155abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.TypeCreate == nullptr) { 21662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.TypeCreate"); 21748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 21848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2195abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCreateTyped == nullptr) { 22062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateTyped"); 22148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 22248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2235abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCreateFromBitmap == nullptr) { 22462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateFromBitmap"); 22548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 22648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2275abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCubeCreateFromBitmap == nullptr) { 22862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCubeCreateFromBitmap"); 22948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 23048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2315abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationGetSurface == nullptr) { 23262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationGetSurface"); 23348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 23448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2355abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationSetSurface == nullptr) { 23662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationSetSurface"); 23748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 23848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2395abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextFinish == nullptr) { 24062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextFinish"); 24148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 24248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2435abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextDump == nullptr) { 24462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextDump"); 24548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 24648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2475abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ContextSetPriority == nullptr) { 24862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ContextSetPriority"); 24948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 25048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2515abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AssignName == nullptr) { 25262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AssignName"); 25348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 25448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2555abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ObjDestroy == nullptr) { 25662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ObjDestroy"); 25748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 25848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2595abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ElementCreate == nullptr) { 26062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ElementCreate"); 26148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 26248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2635abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ElementCreate2 == nullptr) { 26462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ElementCreate2"); 26548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 26648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2675abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCopyToBitmap == nullptr) { 26862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCopyToBitmap"); 26948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 27048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2715abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation1DData == nullptr) { 27262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation1DData"); 27348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 27448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2755abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation1DElementData == nullptr) { 27662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation1DElementData"); 27748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 27848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2795abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation2DData == nullptr) { 28062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation2DData"); 28148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 28248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2835abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation3DData == nullptr) { 28462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation3DData"); 28548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 28648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2875abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationGenerateMipmaps == nullptr) { 28862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationGenerateMipmaps"); 28948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 29048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2915abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationRead == nullptr) { 29262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationRead"); 29348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 29448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2955abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation1DRead == nullptr) { 29662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation1DRead"); 29748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 29848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 2995abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation2DRead == nullptr) { 30062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation2DRead"); 30148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 30248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3035abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationSyncAll == nullptr) { 30462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationSyncAll"); 30548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 30648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3075abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationResize1D == nullptr) { 30862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationResize1D"); 30948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 31048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3115abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCopy2DRange == nullptr) { 31262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy2DRange"); 31348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 31448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3155abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationCopy3DRange == nullptr) { 31662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy3DRange"); 31748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 31848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3195abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.SamplerCreate == nullptr) { 32062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.SamplerCreate"); 32148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 32248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3235abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptBindAllocation == nullptr) { 32462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptBindAllocation"); 32548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 32648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3275abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetTimeZone == nullptr) { 32862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetTimeZone"); 32948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 33048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3315abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptInvoke == nullptr) { 33262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptInvoke"); 33348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 33448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3355abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptInvokeV == nullptr) { 33662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeV"); 33748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 33848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3395abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptForEach == nullptr) { 34062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptForEach"); 34148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 34248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3435abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarI == nullptr) { 34462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarI"); 34548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 34648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3475abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarObj == nullptr) { 34862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarObj"); 34948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 35048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3515abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarJ == nullptr) { 35262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarJ"); 35348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 35448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3555abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarF == nullptr) { 35662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarF"); 35748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 35848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3595abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarD == nullptr) { 36062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarD"); 36148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 36248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3635abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarV == nullptr) { 36462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarV"); 36548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 36648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3675abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGetVarV == nullptr) { 36862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGetVarV"); 36948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 37048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3715abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptSetVarVE == nullptr) { 37262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarVE"); 37348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 37448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3755abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptCCreate == nullptr) { 37662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptCCreate"); 37748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 37848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3795abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptIntrinsicCreate == nullptr) { 38062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptIntrinsicCreate"); 38148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 38248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3835abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptKernelIDCreate == nullptr) { 38462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptKernelIDCreate"); 38548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 38648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3875abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptFieldIDCreate == nullptr) { 38862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptFieldIDCreate"); 38948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 39048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3915abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGroupCreate == nullptr) { 39262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupCreate"); 39348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 39448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3955abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGroupSetOutput == nullptr) { 39662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetOutput"); 39748d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 39848d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 3995abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGroupSetInput == nullptr) { 40062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetInput"); 40148d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 40248d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 4035abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGroupExecute == nullptr) { 40462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupExecute"); 40548d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 40648d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 4075abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationIoSend == nullptr) { 40862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationIoSend"); 40948d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 41048d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 4115abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationIoReceive == nullptr) { 41262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationIoReceive"); 41348d2eae90f08dc33754a9d280337249690a954d6Miao Wang return false; 41448d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 4150245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang // API_21 functions 4165b042ca38df2185548fc2bd905d2c460a073598eMiao Wang if (targetApiLevel >= 21) { 4175abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationGetPointer == nullptr) { 41862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationGetPointer"); 4190245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang return false; 4200245c71170202d2a372916ab9bd8aafd17f619a6Miao Wang } 42148d2eae90f08dc33754a9d280337249690a954d6Miao Wang } 4228a6a71757f64f02058a50778c75033546a79f2b5Miao Wang // API_23 functions 4235b042ca38df2185548fc2bd905d2c460a073598eMiao Wang if (targetApiLevel >= 23) { 424cf067b8c4d1e53bc4768fbad239851c579717f2cMiao Wang // ScriptGroup V2 functions 4255abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptInvokeIDCreate == nullptr) { 42662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeIDCreate"); 4278a6a71757f64f02058a50778c75033546a79f2b5Miao Wang return false; 4288a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 4295abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ClosureCreate == nullptr) { 43062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ClosureCreate"); 4318a6a71757f64f02058a50778c75033546a79f2b5Miao Wang return false; 4328a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 4335abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.InvokeClosureCreate == nullptr) { 43462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.InvokeClosureCreate"); 435974ca28675268310b1abb29c6ce95b57fa079e2aMiao Wang return false; 436974ca28675268310b1abb29c6ce95b57fa079e2aMiao Wang } 4375abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ClosureSetArg == nullptr) { 43862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ClosureSetArg"); 4398a6a71757f64f02058a50778c75033546a79f2b5Miao Wang return false; 4408a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 4415abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ClosureSetGlobal == nullptr) { 44262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ClosureSetGlobal"); 4438a6a71757f64f02058a50778c75033546a79f2b5Miao Wang return false; 4448a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 4455abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptGroup2Create == nullptr) { 44662e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptGroup2Create"); 4478a6a71757f64f02058a50778c75033546a79f2b5Miao Wang return false; 4488a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 4495abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationElementData == nullptr) { 45062e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationElementData"); 451cc8cea7477352898921044483a6c803e25d02665Miao Wang return false; 452cc8cea7477352898921044483a6c803e25d02665Miao Wang } 4535abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.AllocationElementRead == nullptr) { 45462e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.AllocationElementRead"); 455cc8cea7477352898921044483a6c803e25d02665Miao Wang return false; 456cc8cea7477352898921044483a6c803e25d02665Miao Wang } 4575abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.Allocation3DRead == nullptr) { 45862e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.Allocation3DRead"); 459cc8cea7477352898921044483a6c803e25d02665Miao Wang return false; 460cc8cea7477352898921044483a6c803e25d02665Miao Wang } 4615abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (dispatchTab.ScriptForEachMulti == nullptr) { 46262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptForEachMulti"); 463a8a9a679cb7f7bcce72d0d487b6912125a1c936bMiao Wang return false; 464a8a9a679cb7f7bcce72d0d487b6912125a1c936bMiao Wang } 4658a6a71757f64f02058a50778c75033546a79f2b5Miao Wang } 466ae2ec3febedfc29376b9104413fb4042028f1265David Gross 4675b042ca38df2185548fc2bd905d2c460a073598eMiao Wang if (targetApiLevel >= REDUCE_API_LEVEL) { 468394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala if (dispatchTab.ScriptReduce == nullptr) { 46962e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize dispatchTab.ScriptReduce"); 470394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala return false; 471394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala } 472394e9a6e1b10229cf0465c50a679dda539c30876Matt Wala } 4738a6a71757f64f02058a50778c75033546a79f2b5Miao Wang 47448d2eae90f08dc33754a9d280337249690a954d6Miao Wang return true; 4758a6a71757f64f02058a50778c75033546a79f2b5Miao Wang 47648d2eae90f08dc33754a9d280337249690a954d6Miao Wang} 47748d2eae90f08dc33754a9d280337249690a954d6Miao Wang 4782bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang 4792bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wangbool loadIOSuppSyms(void* handleIO, ioSuppDT& ioDispatch){ 4802bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang ioDispatch.sAllocationSetSurface = (sAllocationSetSurfaceFnPtr)dlsym(handleIO, "AllocationSetSurface"); 4815abfd9b62b3173a371c42fc92ca8cf978420d694Miao Wang if (ioDispatch.sAllocationSetSurface == nullptr) { 48262e9af7113ca5a33e6da4608470034f691c792b9Miao Wang LOG_ERR("Couldn't initialize ioDispatch.sAllocationSetSurface"); 4832bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang return false; 4842bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang } 4852bd78f2d3e0a94a98dc03502decadfd2e17a70c8Miao Wang return true; 486c020bdd35e30a0478c1d642a64abb26ccd1d372cMiao Wang}