1 /* 2 * Copyright (C) 2011-2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #define LOG_TAG "libDispatch" 17 #include <android/log.h> 18 19 #include "rsDispatch.h" 20 #include <dlfcn.h> 21 #include <limits.h> 22 23 #define LOG_ERR(...) __android_log_print(ANDROID_LOG_ERROR, "RS Dispatch", __VA_ARGS__); 24 #define REDUCE_API_LEVEL 24 25 26 bool loadSymbols(void* handle, dispatchTable& dispatchTab, int targetApiLevel) { 27 #ifdef __LP64__ 28 // Function to set the native lib path for 64bit compat lib. 29 dispatchTab.SetNativeLibDir = (SetNativeLibDirFnPtr)dlsym(handle, "rsaContextSetNativeLibDir"); 30 if (dispatchTab.SetNativeLibDir == nullptr) { 31 LOG_ERR("Couldn't initialize dispatchTab.SetNativeLibDir"); 32 return false; 33 } 34 #endif 35 36 dispatchTab.Allocation1DData = (Allocation1DDataFnPtr)dlsym(handle, "rsAllocation1DData"); 37 dispatchTab.Allocation1DElementData = (Allocation1DElementDataFnPtr)dlsym(handle, "rsAllocation1DElementData"); 38 dispatchTab.Allocation1DRead = (Allocation1DReadFnPtr)dlsym(handle, "rsAllocation1DRead"); 39 dispatchTab.Allocation2DData = (Allocation2DDataFnPtr)dlsym(handle, "rsAllocation2DData"); 40 dispatchTab.Allocation2DRead = (Allocation2DReadFnPtr)dlsym(handle, "rsAllocation2DRead"); 41 dispatchTab.Allocation3DData = (Allocation3DDataFnPtr)dlsym(handle, "rsAllocation3DData"); 42 dispatchTab.Allocation3DRead = (Allocation3DReadFnPtr)dlsym(handle, "rsAllocation3DRead"); 43 dispatchTab.AllocationAdapterCreate = (AllocationAdapterCreateFnPtr)dlsym(handle, "rsAllocationAdapterCreate"); 44 dispatchTab.AllocationAdapterOffset = (AllocationAdapterOffsetFnPtr)dlsym(handle, "rsAllocationAdapterOffset"); 45 dispatchTab.AllocationCopy2DRange = (AllocationCopy2DRangeFnPtr)dlsym(handle, "rsAllocationCopy2DRange"); 46 dispatchTab.AllocationCopy3DRange = (AllocationCopy3DRangeFnPtr)dlsym(handle, "rsAllocationCopy3DRange"); 47 dispatchTab.AllocationCopyToBitmap = (AllocationCopyToBitmapFnPtr)dlsym(handle, "rsAllocationCopyToBitmap"); 48 dispatchTab.AllocationCreateFromBitmap = (AllocationCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCreateFromBitmap"); 49 dispatchTab.AllocationCreateTyped = (AllocationCreateTypedFnPtr)dlsym(handle, "rsAllocationCreateTyped"); 50 dispatchTab.AllocationCubeCreateFromBitmap = (AllocationCubeCreateFromBitmapFnPtr)dlsym(handle, "rsAllocationCubeCreateFromBitmap"); 51 dispatchTab.AllocationElementData = (AllocationElementDataFnPtr)dlsym(handle, "rsAllocationElementData"); 52 dispatchTab.AllocationElementRead = (AllocationElementReadFnPtr)dlsym(handle, "rsAllocationElementRead"); 53 dispatchTab.AllocationGenerateMipmaps = (AllocationGenerateMipmapsFnPtr)dlsym(handle, "rsAllocationGenerateMipmaps"); 54 dispatchTab.AllocationGetPointer = (AllocationGetPointerFnPtr)dlsym(handle, "rsAllocationGetPointer"); 55 dispatchTab.AllocationGetSurface = (AllocationGetSurfaceFnPtr)dlsym(handle, "rsAllocationGetSurface"); 56 dispatchTab.AllocationGetType = (AllocationGetTypeFnPtr)dlsym(handle, "rsaAllocationGetType"); 57 dispatchTab.AllocationIoReceive = (AllocationIoReceiveFnPtr)dlsym(handle, "rsAllocationIoReceive"); 58 dispatchTab.AllocationIoSend = (AllocationIoSendFnPtr)dlsym(handle, "rsAllocationIoSend"); 59 dispatchTab.AllocationRead = (AllocationReadFnPtr)dlsym(handle, "rsAllocationRead"); 60 dispatchTab.AllocationResize1D = (AllocationResize1DFnPtr)dlsym(handle, "rsAllocationResize1D"); 61 dispatchTab.AllocationSetSurface = (AllocationSetSurfaceFnPtr)dlsym(handle, "rsAllocationSetSurface"); 62 dispatchTab.AllocationSetupBufferQueue = (AllocationSetupBufferQueueFnPtr)dlsym(handle, "rsAllocationSetupBufferQueue"); 63 dispatchTab.AllocationShareBufferQueue = (AllocationShareBufferQueueFnPtr)dlsym(handle, "rsAllocationShareBufferQueue"); 64 dispatchTab.AllocationSyncAll = (AllocationSyncAllFnPtr)dlsym(handle, "rsAllocationSyncAll"); 65 dispatchTab.AssignName = (AssignNameFnPtr)dlsym(handle, "rsAssignName"); 66 dispatchTab.ClosureCreate = (ClosureCreateFnPtr)dlsym(handle, "rsClosureCreate"); 67 dispatchTab.ClosureSetArg = (ClosureSetArgFnPtr)dlsym(handle, "rsClosureSetArg"); 68 dispatchTab.ClosureSetGlobal = (ClosureSetGlobalFnPtr)dlsym(handle, "rsClosureSetGlobal"); 69 dispatchTab.ContextCreate = (ContextCreateFnPtr)dlsym(handle, "rsContextCreate");; 70 dispatchTab.ContextDeinitToClient = (ContextDeinitToClientFnPtr)dlsym(handle, "rsContextDeinitToClient"); 71 dispatchTab.ContextDestroy = (ContextDestroyFnPtr)dlsym(handle, "rsContextDestroy"); 72 dispatchTab.ContextDump = (ContextDumpFnPtr)dlsym(handle, "rsContextDump"); 73 dispatchTab.ContextFinish = (ContextFinishFnPtr)dlsym(handle, "rsContextFinish"); 74 dispatchTab.ContextGetMessage = (ContextGetMessageFnPtr)dlsym(handle, "rsContextGetMessage"); 75 dispatchTab.ContextInitToClient = (ContextInitToClientFnPtr)dlsym(handle, "rsContextInitToClient"); 76 dispatchTab.ContextPeekMessage = (ContextPeekMessageFnPtr)dlsym(handle, "rsContextPeekMessage"); 77 dispatchTab.ContextSendMessage = (ContextSendMessageFnPtr)dlsym(handle, "rsContextSendMessage"); 78 dispatchTab.ContextSetPriority = (ContextSetPriorityFnPtr)dlsym(handle, "rsContextSetPriority"); 79 dispatchTab.ContextSetCacheDir = (ContextSetCacheDirFnPtr)dlsym(handle, "rsContextSetCacheDir"); 80 dispatchTab.DeviceCreate = (DeviceCreateFnPtr)dlsym(handle, "rsDeviceCreate"); 81 dispatchTab.DeviceDestroy = (DeviceDestroyFnPtr)dlsym(handle, "rsDeviceDestroy"); 82 dispatchTab.DeviceSetConfig = (DeviceSetConfigFnPtr)dlsym(handle, "rsDeviceSetConfig"); 83 dispatchTab.ElementCreate = (ElementCreateFnPtr)dlsym(handle, "rsElementCreate"); 84 dispatchTab.ElementCreate2 = (ElementCreate2FnPtr)dlsym(handle, "rsElementCreate2"); 85 dispatchTab.ElementGetNativeData = (ElementGetNativeDataFnPtr)dlsym(handle, "rsaElementGetNativeData"); 86 dispatchTab.ElementGetSubElements = (ElementGetSubElementsFnPtr)dlsym(handle, "rsaElementGetSubElements"); 87 dispatchTab.GetName = (GetNameFnPtr)dlsym(handle, "rsaGetName");; 88 dispatchTab.InvokeClosureCreate = (InvokeClosureCreateFnPtr)dlsym(handle, "rsInvokeClosureCreate"); 89 dispatchTab.ObjDestroy = (ObjDestroyFnPtr)dlsym(handle, "rsObjDestroy"); 90 dispatchTab.SamplerCreate = (SamplerCreateFnPtr)dlsym(handle, "rsSamplerCreate"); 91 dispatchTab.ScriptBindAllocation = (ScriptBindAllocationFnPtr)dlsym(handle, "rsScriptBindAllocation"); 92 dispatchTab.ScriptCCreate = (ScriptCCreateFnPtr)dlsym(handle, "rsScriptCCreate"); 93 dispatchTab.ScriptFieldIDCreate = (ScriptFieldIDCreateFnPtr)dlsym(handle, "rsScriptFieldIDCreate"); 94 dispatchTab.ScriptForEach = (ScriptForEachFnPtr)dlsym(handle, "rsScriptForEach"); 95 dispatchTab.ScriptForEachMulti = (ScriptForEachMultiFnPtr)dlsym(handle, "rsScriptForEachMulti"); 96 dispatchTab.ScriptGetVarV = (ScriptGetVarVFnPtr)dlsym(handle, "rsScriptGetVarV"); 97 dispatchTab.ScriptGroup2Create = (ScriptGroup2CreateFnPtr)dlsym(handle, "rsScriptGroup2Create"); 98 dispatchTab.ScriptGroupCreate = (ScriptGroupCreateFnPtr)dlsym(handle, "rsScriptGroupCreate"); 99 dispatchTab.ScriptGroupExecute = (ScriptGroupExecuteFnPtr)dlsym(handle, "rsScriptGroupExecute"); 100 dispatchTab.ScriptGroupSetInput = (ScriptGroupSetInputFnPtr)dlsym(handle, "rsScriptGroupSetInput"); 101 dispatchTab.ScriptGroupSetOutput = (ScriptGroupSetOutputFnPtr)dlsym(handle, "rsScriptGroupSetOutput"); 102 dispatchTab.ScriptIntrinsicCreate = (ScriptIntrinsicCreateFnPtr)dlsym(handle, "rsScriptIntrinsicCreate"); 103 dispatchTab.ScriptInvoke = (ScriptInvokeFnPtr)dlsym(handle, "rsScriptInvoke"); 104 dispatchTab.ScriptInvokeIDCreate = (ScriptInvokeIDCreateFnPtr)dlsym(handle, "rsScriptInvokeIDCreate"); 105 dispatchTab.ScriptInvokeV = (ScriptInvokeVFnPtr)dlsym(handle, "rsScriptInvokeV"); 106 dispatchTab.ScriptKernelIDCreate = (ScriptKernelIDCreateFnPtr)dlsym(handle, "rsScriptKernelIDCreate"); 107 dispatchTab.ScriptReduce = (ScriptReduceFnPtr)dlsym(handle, "rsScriptReduce"); 108 dispatchTab.ScriptSetTimeZone = (ScriptSetTimeZoneFnPtr)dlsym(handle, "rsScriptSetTimeZone"); 109 dispatchTab.ScriptSetVarD = (ScriptSetVarDFnPtr)dlsym(handle, "rsScriptSetVarD"); 110 dispatchTab.ScriptSetVarF = (ScriptSetVarFFnPtr)dlsym(handle, "rsScriptSetVarF"); 111 dispatchTab.ScriptSetVarI = (ScriptSetVarIFnPtr)dlsym(handle, "rsScriptSetVarI"); 112 dispatchTab.ScriptSetVarJ = (ScriptSetVarJFnPtr)dlsym(handle, "rsScriptSetVarJ"); 113 dispatchTab.ScriptSetVarObj = (ScriptSetVarObjFnPtr)dlsym(handle, "rsScriptSetVarObj"); 114 dispatchTab.ScriptSetVarV = (ScriptSetVarVFnPtr)dlsym(handle, "rsScriptSetVarV"); 115 dispatchTab.ScriptSetVarVE = (ScriptSetVarVEFnPtr)dlsym(handle, "rsScriptSetVarVE"); 116 dispatchTab.TypeCreate = (TypeCreateFnPtr)dlsym(handle, "rsTypeCreate"); 117 dispatchTab.TypeGetNativeData = (TypeGetNativeDataFnPtr)dlsym(handle, "rsaTypeGetNativeData"); 118 119 // Load graphics APIs 120 dispatchTab.ContextCreateGL = (ContextCreateGLFnPtr)dlsym(handle, "rsContextCreateGL"); 121 dispatchTab.ContextSetSurface = (ContextSetSurfaceFnPtr)dlsym(handle, "rsContextSetSurface"); 122 dispatchTab.ContextPause = (ContextPauseFnPtr)dlsym(handle, "rsContextPause"); 123 dispatchTab.ContextResume = (ContextResumeFnPtr)dlsym(handle, "rsContextResume"); 124 dispatchTab.ContextBindProgramStore = (ContextBindProgramStoreFnPtr)dlsym(handle, "rsContextBindProgramStore"); 125 dispatchTab.ContextBindProgramFragment = (ContextBindProgramFragmentFnPtr)dlsym(handle, "rsContextBindProgramFragment"); 126 dispatchTab.ContextBindProgramVertex = (ContextBindProgramVertexFnPtr)dlsym(handle, "rsContextBindProgramVertex"); 127 dispatchTab.ContextBindProgramRaster = (ContextBindProgramRasterFnPtr)dlsym(handle, "rsContextBindProgramRaster"); 128 dispatchTab.ContextBindFont = (ContextBindFontFnPtr)dlsym(handle, "rsContextBindFont"); 129 dispatchTab.ContextBindRootScript = (ContextBindRootScriptFnPtr)dlsym(handle, "rsContextBindRootScript"); 130 131 dispatchTab.ProgramStoreCreate = (ProgramStoreCreateFnPtr)dlsym(handle, "rsProgramStoreCreate"); 132 dispatchTab.ProgramRasterCreate = (ProgramRasterCreateFnPtr)dlsym(handle, "rsProgramRasterCreate"); 133 dispatchTab.ProgramBindConstants = (ProgramBindConstantsFnPtr)dlsym(handle, "rsProgramBindConstants"); 134 dispatchTab.ProgramBindTexture = (ProgramBindTextureFnPtr)dlsym(handle, "rsProgramBindTexture"); 135 dispatchTab.ProgramBindSampler = (ProgramBindSamplerFnPtr)dlsym(handle, "rsProgramBindSampler"); 136 dispatchTab.ProgramFragmentCreate = (ProgramFragmentCreateFnPtr)dlsym(handle, "rsProgramFragmentCreate"); 137 dispatchTab.ProgramVertexCreate = (ProgramVertexCreateFnPtr)dlsym(handle, "rsProgramVertexCreate"); 138 dispatchTab.FontCreateFromFile = (FontCreateFromFileFnPtr)dlsym(handle, "rsFontCreateFromFile"); 139 dispatchTab.FontCreateFromMemory = (FontCreateFromMemoryFnPtr)dlsym(handle, "rsFontCreateFromMemory"); 140 dispatchTab.MeshCreate = (MeshCreateFnPtr)dlsym(handle, "rsMeshCreate"); 141 dispatchTab.MeshGetVertexBufferCount = (MeshGetVertexBufferCountFnPtr)dlsym(handle, "rsaMeshGetVertexBufferCount"); 142 dispatchTab.MeshGetIndexCount = (MeshGetIndexCountFnPtr)dlsym(handle, "rsaMeshGetIndexCount"); 143 dispatchTab.MeshGetVertices = (MeshGetVerticesFnPtr)dlsym(handle, "rsaMeshGetVertices"); 144 dispatchTab.MeshGetIndices = (MeshGetIndicesFnPtr)dlsym(handle, "rsaMeshGetIndices"); 145 dispatchTab.FileA3DGetEntryByIndex = (FileA3DGetEntryByIndexFnPtr)dlsym(handle, "rsaFileA3DGetEntryByIndex"); 146 dispatchTab.FileA3DGetNumIndexEntries = (FileA3DGetNumIndexEntriesFnPtr)dlsym(handle, "rsaFileA3DGetNumIndexEntries"); 147 dispatchTab.FileA3DGetIndexEntries = (FileA3DGetIndexEntriesFnPtr)dlsym(handle, "rsaFileA3DGetIndexEntries"); 148 dispatchTab.FileA3DCreateFromMemory = (FileA3DCreateFromMemoryFnPtr)dlsym(handle, "rsaFileA3DCreateFromMemory"); 149 dispatchTab.FileA3DCreateFromAsset = (FileA3DCreateFromAssetFnPtr)dlsym(handle, "rsaFileA3DCreateFromAsset"); 150 dispatchTab.FileA3DCreateFromFile = (FileA3DCreateFromFileFnPtr)dlsym(handle, "rsaFileA3DCreateFromFile"); 151 152 // Clear error buffer for later operations. 153 dlerror(); 154 155 if (dispatchTab.AllocationGetType == nullptr) { 156 LOG_ERR("Couldn't initialize dispatchTab.AllocationGetType"); 157 return false; 158 } 159 if (dispatchTab.TypeGetNativeData == nullptr) { 160 LOG_ERR("Couldn't initialize dispatchTab.TypeGetNativeData"); 161 return false; 162 } 163 if (dispatchTab.ElementGetNativeData == nullptr) { 164 LOG_ERR("Couldn't initialize dispatchTab.ElementGetNativeData"); 165 return false; 166 } 167 if (dispatchTab.ElementGetSubElements == nullptr) { 168 LOG_ERR("Couldn't initialize dispatchTab.ElementGetSubElements"); 169 return false; 170 } 171 if (dispatchTab.DeviceCreate == nullptr) { 172 LOG_ERR("Couldn't initialize dispatchTab.DeviceCreate"); 173 return false; 174 } 175 if (dispatchTab.DeviceDestroy == nullptr) { 176 LOG_ERR("Couldn't initialize dispatchTab.DeviceDestroy"); 177 return false; 178 } 179 if (dispatchTab.DeviceSetConfig == nullptr) { 180 LOG_ERR("Couldn't initialize dispatchTab.DeviceSetConfig"); 181 return false; 182 } 183 if (dispatchTab.ContextCreate == nullptr) { 184 LOG_ERR("Couldn't initialize dispatchTab.ContextCreate"); 185 return false; 186 } 187 if (dispatchTab.GetName == nullptr) { 188 LOG_ERR("Couldn't initialize dispatchTab.GetName"); 189 return false; 190 } 191 if (dispatchTab.ContextDestroy == nullptr) { 192 LOG_ERR("Couldn't initialize dispatchTab.ContextDestroy"); 193 return false; 194 } 195 if (dispatchTab.ContextGetMessage == nullptr) { 196 LOG_ERR("Couldn't initialize dispatchTab.ContextGetMessage"); 197 return false; 198 } 199 if (dispatchTab.ContextPeekMessage == nullptr) { 200 LOG_ERR("Couldn't initialize dispatchTab.ContextPeekMessage"); 201 return false; 202 } 203 if (dispatchTab.ContextSendMessage == nullptr) { 204 LOG_ERR("Couldn't initialize dispatchTab.ContextSendMessage"); 205 return false; 206 } 207 if (dispatchTab.ContextInitToClient == nullptr) { 208 LOG_ERR("Couldn't initialize dispatchTab.ContextInitToClient"); 209 return false; 210 } 211 if (dispatchTab.ContextDeinitToClient == nullptr) { 212 LOG_ERR("Couldn't initialize dispatchTab.ContextDeinitToClient"); 213 return false; 214 } 215 if (dispatchTab.TypeCreate == nullptr) { 216 LOG_ERR("Couldn't initialize dispatchTab.TypeCreate"); 217 return false; 218 } 219 if (dispatchTab.AllocationCreateTyped == nullptr) { 220 LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateTyped"); 221 return false; 222 } 223 if (dispatchTab.AllocationCreateFromBitmap == nullptr) { 224 LOG_ERR("Couldn't initialize dispatchTab.AllocationCreateFromBitmap"); 225 return false; 226 } 227 if (dispatchTab.AllocationCubeCreateFromBitmap == nullptr) { 228 LOG_ERR("Couldn't initialize dispatchTab.AllocationCubeCreateFromBitmap"); 229 return false; 230 } 231 if (dispatchTab.AllocationGetSurface == nullptr) { 232 LOG_ERR("Couldn't initialize dispatchTab.AllocationGetSurface"); 233 return false; 234 } 235 if (dispatchTab.AllocationSetSurface == nullptr) { 236 LOG_ERR("Couldn't initialize dispatchTab.AllocationSetSurface"); 237 return false; 238 } 239 if (dispatchTab.ContextFinish == nullptr) { 240 LOG_ERR("Couldn't initialize dispatchTab.ContextFinish"); 241 return false; 242 } 243 if (dispatchTab.ContextDump == nullptr) { 244 LOG_ERR("Couldn't initialize dispatchTab.ContextDump"); 245 return false; 246 } 247 if (dispatchTab.ContextSetPriority == nullptr) { 248 LOG_ERR("Couldn't initialize dispatchTab.ContextSetPriority"); 249 return false; 250 } 251 if (dispatchTab.AssignName == nullptr) { 252 LOG_ERR("Couldn't initialize dispatchTab.AssignName"); 253 return false; 254 } 255 if (dispatchTab.ObjDestroy == nullptr) { 256 LOG_ERR("Couldn't initialize dispatchTab.ObjDestroy"); 257 return false; 258 } 259 if (dispatchTab.ElementCreate == nullptr) { 260 LOG_ERR("Couldn't initialize dispatchTab.ElementCreate"); 261 return false; 262 } 263 if (dispatchTab.ElementCreate2 == nullptr) { 264 LOG_ERR("Couldn't initialize dispatchTab.ElementCreate2"); 265 return false; 266 } 267 if (dispatchTab.AllocationCopyToBitmap == nullptr) { 268 LOG_ERR("Couldn't initialize dispatchTab.AllocationCopyToBitmap"); 269 return false; 270 } 271 if (dispatchTab.Allocation1DData == nullptr) { 272 LOG_ERR("Couldn't initialize dispatchTab.Allocation1DData"); 273 return false; 274 } 275 if (dispatchTab.Allocation1DElementData == nullptr) { 276 LOG_ERR("Couldn't initialize dispatchTab.Allocation1DElementData"); 277 return false; 278 } 279 if (dispatchTab.Allocation2DData == nullptr) { 280 LOG_ERR("Couldn't initialize dispatchTab.Allocation2DData"); 281 return false; 282 } 283 if (dispatchTab.Allocation3DData == nullptr) { 284 LOG_ERR("Couldn't initialize dispatchTab.Allocation3DData"); 285 return false; 286 } 287 if (dispatchTab.AllocationGenerateMipmaps == nullptr) { 288 LOG_ERR("Couldn't initialize dispatchTab.AllocationGenerateMipmaps"); 289 return false; 290 } 291 if (dispatchTab.AllocationRead == nullptr) { 292 LOG_ERR("Couldn't initialize dispatchTab.AllocationRead"); 293 return false; 294 } 295 if (dispatchTab.Allocation1DRead == nullptr) { 296 LOG_ERR("Couldn't initialize dispatchTab.Allocation1DRead"); 297 return false; 298 } 299 if (dispatchTab.Allocation2DRead == nullptr) { 300 LOG_ERR("Couldn't initialize dispatchTab.Allocation2DRead"); 301 return false; 302 } 303 if (dispatchTab.AllocationSyncAll == nullptr) { 304 LOG_ERR("Couldn't initialize dispatchTab.AllocationSyncAll"); 305 return false; 306 } 307 if (dispatchTab.AllocationResize1D == nullptr) { 308 LOG_ERR("Couldn't initialize dispatchTab.AllocationResize1D"); 309 return false; 310 } 311 if (dispatchTab.AllocationCopy2DRange == nullptr) { 312 LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy2DRange"); 313 return false; 314 } 315 if (dispatchTab.AllocationCopy3DRange == nullptr) { 316 LOG_ERR("Couldn't initialize dispatchTab.AllocationCopy3DRange"); 317 return false; 318 } 319 if (dispatchTab.SamplerCreate == nullptr) { 320 LOG_ERR("Couldn't initialize dispatchTab.SamplerCreate"); 321 return false; 322 } 323 if (dispatchTab.ScriptBindAllocation == nullptr) { 324 LOG_ERR("Couldn't initialize dispatchTab.ScriptBindAllocation"); 325 return false; 326 } 327 if (dispatchTab.ScriptSetTimeZone == nullptr) { 328 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetTimeZone"); 329 return false; 330 } 331 if (dispatchTab.ScriptInvoke == nullptr) { 332 LOG_ERR("Couldn't initialize dispatchTab.ScriptInvoke"); 333 return false; 334 } 335 if (dispatchTab.ScriptInvokeV == nullptr) { 336 LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeV"); 337 return false; 338 } 339 if (dispatchTab.ScriptForEach == nullptr) { 340 LOG_ERR("Couldn't initialize dispatchTab.ScriptForEach"); 341 return false; 342 } 343 if (dispatchTab.ScriptSetVarI == nullptr) { 344 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarI"); 345 return false; 346 } 347 if (dispatchTab.ScriptSetVarObj == nullptr) { 348 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarObj"); 349 return false; 350 } 351 if (dispatchTab.ScriptSetVarJ == nullptr) { 352 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarJ"); 353 return false; 354 } 355 if (dispatchTab.ScriptSetVarF == nullptr) { 356 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarF"); 357 return false; 358 } 359 if (dispatchTab.ScriptSetVarD == nullptr) { 360 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarD"); 361 return false; 362 } 363 if (dispatchTab.ScriptSetVarV == nullptr) { 364 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarV"); 365 return false; 366 } 367 if (dispatchTab.ScriptGetVarV == nullptr) { 368 LOG_ERR("Couldn't initialize dispatchTab.ScriptGetVarV"); 369 return false; 370 } 371 if (dispatchTab.ScriptSetVarVE == nullptr) { 372 LOG_ERR("Couldn't initialize dispatchTab.ScriptSetVarVE"); 373 return false; 374 } 375 if (dispatchTab.ScriptCCreate == nullptr) { 376 LOG_ERR("Couldn't initialize dispatchTab.ScriptCCreate"); 377 return false; 378 } 379 if (dispatchTab.ScriptIntrinsicCreate == nullptr) { 380 LOG_ERR("Couldn't initialize dispatchTab.ScriptIntrinsicCreate"); 381 return false; 382 } 383 if (dispatchTab.ScriptKernelIDCreate == nullptr) { 384 LOG_ERR("Couldn't initialize dispatchTab.ScriptKernelIDCreate"); 385 return false; 386 } 387 if (dispatchTab.ScriptFieldIDCreate == nullptr) { 388 LOG_ERR("Couldn't initialize dispatchTab.ScriptFieldIDCreate"); 389 return false; 390 } 391 if (dispatchTab.ScriptGroupCreate == nullptr) { 392 LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupCreate"); 393 return false; 394 } 395 if (dispatchTab.ScriptGroupSetOutput == nullptr) { 396 LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetOutput"); 397 return false; 398 } 399 if (dispatchTab.ScriptGroupSetInput == nullptr) { 400 LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupSetInput"); 401 return false; 402 } 403 if (dispatchTab.ScriptGroupExecute == nullptr) { 404 LOG_ERR("Couldn't initialize dispatchTab.ScriptGroupExecute"); 405 return false; 406 } 407 if (dispatchTab.AllocationIoSend == nullptr) { 408 LOG_ERR("Couldn't initialize dispatchTab.AllocationIoSend"); 409 return false; 410 } 411 if (dispatchTab.AllocationIoReceive == nullptr) { 412 LOG_ERR("Couldn't initialize dispatchTab.AllocationIoReceive"); 413 return false; 414 } 415 // API_21 functions 416 if (targetApiLevel >= 21) { 417 if (dispatchTab.AllocationGetPointer == nullptr) { 418 LOG_ERR("Couldn't initialize dispatchTab.AllocationGetPointer"); 419 return false; 420 } 421 } 422 // API_23 functions 423 if (targetApiLevel >= 23) { 424 // ScriptGroup V2 functions 425 if (dispatchTab.ScriptInvokeIDCreate == nullptr) { 426 LOG_ERR("Couldn't initialize dispatchTab.ScriptInvokeIDCreate"); 427 return false; 428 } 429 if (dispatchTab.ClosureCreate == nullptr) { 430 LOG_ERR("Couldn't initialize dispatchTab.ClosureCreate"); 431 return false; 432 } 433 if (dispatchTab.InvokeClosureCreate == nullptr) { 434 LOG_ERR("Couldn't initialize dispatchTab.InvokeClosureCreate"); 435 return false; 436 } 437 if (dispatchTab.ClosureSetArg == nullptr) { 438 LOG_ERR("Couldn't initialize dispatchTab.ClosureSetArg"); 439 return false; 440 } 441 if (dispatchTab.ClosureSetGlobal == nullptr) { 442 LOG_ERR("Couldn't initialize dispatchTab.ClosureSetGlobal"); 443 return false; 444 } 445 if (dispatchTab.ScriptGroup2Create == nullptr) { 446 LOG_ERR("Couldn't initialize dispatchTab.ScriptGroup2Create"); 447 return false; 448 } 449 if (dispatchTab.AllocationElementData == nullptr) { 450 LOG_ERR("Couldn't initialize dispatchTab.AllocationElementData"); 451 return false; 452 } 453 if (dispatchTab.AllocationElementRead == nullptr) { 454 LOG_ERR("Couldn't initialize dispatchTab.AllocationElementRead"); 455 return false; 456 } 457 if (dispatchTab.Allocation3DRead == nullptr) { 458 LOG_ERR("Couldn't initialize dispatchTab.Allocation3DRead"); 459 return false; 460 } 461 if (dispatchTab.ScriptForEachMulti == nullptr) { 462 LOG_ERR("Couldn't initialize dispatchTab.ScriptForEachMulti"); 463 return false; 464 } 465 } 466 467 if (targetApiLevel >= REDUCE_API_LEVEL) { 468 if (dispatchTab.ScriptReduce == nullptr) { 469 LOG_ERR("Couldn't initialize dispatchTab.ScriptReduce"); 470 return false; 471 } 472 } 473 474 return true; 475 476 } 477 478 479 bool loadIOSuppSyms(void* handleIO, ioSuppDT& ioDispatch){ 480 ioDispatch.sAllocationSetSurface = (sAllocationSetSurfaceFnPtr)dlsym(handleIO, "AllocationSetSurface"); 481 if (ioDispatch.sAllocationSetSurface == nullptr) { 482 LOG_ERR("Couldn't initialize ioDispatch.sAllocationSetSurface"); 483 return false; 484 } 485 return true; 486 }