Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 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 | |
| 17 | #ifndef ANDROID_RSDISPATCH_H |
| 18 | #define ANDROID_RSDISPATCH_H |
| 19 | |
Jason Sams | 66f0a16 | 2014-11-11 13:46:38 -0800 | [diff] [blame] | 20 | #include "rsInternalDefines.h" |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 21 | |
| 22 | typedef const void* (*AllocationGetTypeFnPtr)(RsContext con, RsAllocation va); |
Ashok Bhat | 6c59e3c | 2014-02-11 11:36:45 +0000 | [diff] [blame] | 23 | typedef void (*TypeGetNativeDataFnPtr)(RsContext, RsType, uintptr_t *typeData, uint32_t typeDataSize); |
| 24 | typedef void (*ElementGetNativeDataFnPtr)(RsContext, RsElement, uintptr_t *elemData, uint32_t elemDataSize); |
| 25 | typedef void (*ElementGetSubElementsFnPtr)(RsContext, RsElement, uintptr_t *ids, const char **names, uint32_t *arraySizes, uint32_t dataSize); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 26 | typedef RsDevice (*DeviceCreateFnPtr) (); |
| 27 | typedef void (*DeviceDestroyFnPtr) (RsDevice dev); |
| 28 | typedef void (*DeviceSetConfigFnPtr) (RsDevice dev, RsDeviceParam p, int32_t value); |
Tim Murray | 84e3dea | 2013-09-09 16:12:51 -0700 | [diff] [blame] | 29 | typedef RsContext (*ContextCreateFnPtr)(RsDevice vdev, uint32_t version, uint32_t sdkVersion, RsContextType ct, uint32_t flags); |
Tim Murray | 4a92d12 | 2013-07-22 10:56:18 -0700 | [diff] [blame] | 30 | typedef void (*GetNameFnPtr)(RsContext, void * obj, const char **name); |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame^] | 31 | typedef RsClosure (*ClosureCreateFnPtr)(RsContext, RsScriptKernelID, RsAllocation, RsScriptFieldID*, size_t, uintptr_t*, size_t, size_t*, size_t, RsClosure*, size_t, RsScriptFieldID*, size_t); |
| 32 | typedef void (*ClosureSetArgFnPtr)(RsContext, RsClosure, uint32_t, uintptr_t, size_t); |
| 33 | typedef void (*ClosureSetGlobalFnPtr)(RsContext, RsClosure, RsScriptFieldID, uintptr_t, size_t); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 34 | typedef void (*ContextDestroyFnPtr) (RsContext); |
| 35 | typedef RsMessageToClientType (*ContextGetMessageFnPtr) (RsContext, void*, size_t, size_t*, size_t, uint32_t*, size_t); |
| 36 | typedef RsMessageToClientType (*ContextPeekMessageFnPtr) (RsContext, size_t*, size_t, uint32_t*, size_t); |
| 37 | typedef void (*ContextSendMessageFnPtr) (RsContext, uint32_t, const uint8_t*, size_t); |
| 38 | typedef void (*ContextInitToClientFnPtr) (RsContext); |
| 39 | typedef void (*ContextDeinitToClientFnPtr) (RsContext); |
| 40 | typedef RsType (*TypeCreateFnPtr) (RsContext, RsElement, uint32_t, uint32_t, uint32_t, bool, bool, uint32_t); |
| 41 | typedef RsAllocation (*AllocationCreateTypedFnPtr) (RsContext, RsType, RsAllocationMipmapControl, uint32_t, uintptr_t); |
| 42 | typedef RsAllocation (*AllocationCreateFromBitmapFnPtr) (RsContext, RsType, RsAllocationMipmapControl, const void*, size_t, uint32_t); |
| 43 | typedef RsAllocation (*AllocationCubeCreateFromBitmapFnPtr) (RsContext, RsType, RsAllocationMipmapControl, const void*, size_t, uint32_t); |
| 44 | typedef RsNativeWindow (*AllocationGetSurfaceFnPtr) (RsContext, RsAllocation); |
| 45 | typedef void (*AllocationSetSurfaceFnPtr) (RsContext, RsAllocation, RsNativeWindow); |
| 46 | typedef void (*ContextFinishFnPtr) (RsContext); |
| 47 | typedef void (*ContextDumpFnPtr) (RsContext, int32_t); |
| 48 | typedef void (*ContextSetPriorityFnPtr) (RsContext, int32_t); |
| 49 | typedef void (*AssignNameFnPtr) (RsContext, RsObjectBase, const char*, size_t); |
| 50 | typedef void (*ObjDestroyFnPtr) (RsContext, RsAsyncVoidPtr); |
| 51 | typedef RsElement (*ElementCreateFnPtr) (RsContext, RsDataType, RsDataKind, bool, uint32_t); |
| 52 | typedef RsElement (*ElementCreate2FnPtr) (RsContext, const RsElement*, size_t, const char**, size_t, const size_t*, const uint32_t*, size_t); |
| 53 | typedef void (*AllocationCopyToBitmapFnPtr) (RsContext, RsAllocation, void*, size_t); |
| 54 | typedef void (*Allocation1DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, const void*, size_t); |
| 55 | typedef void (*Allocation1DElementDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, const void*, size_t, size_t); |
| 56 | typedef void (*Allocation2DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, RsAllocationCubemapFace, uint32_t, uint32_t, const void*, size_t, size_t); |
| 57 | typedef void (*Allocation3DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const void*, size_t, size_t); |
| 58 | typedef void (*AllocationGenerateMipmapsFnPtr) (RsContext, RsAllocation); |
| 59 | typedef void (*AllocationReadFnPtr) (RsContext, RsAllocation, void*, size_t); |
| 60 | typedef void (*Allocation1DReadFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, void*, size_t); |
| 61 | typedef void (*Allocation2DReadFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, RsAllocationCubemapFace, uint32_t, uint32_t, void*, size_t, size_t); |
| 62 | typedef void (*AllocationSyncAllFnPtr) (RsContext, RsAllocation, RsAllocationUsageType); |
| 63 | typedef void (*AllocationResize1DFnPtr) (RsContext, RsAllocation, uint32_t); |
| 64 | typedef void (*AllocationCopy2DRangeFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t); |
| 65 | typedef void (*AllocationCopy3DRangeFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t); |
| 66 | typedef RsSampler (*SamplerCreateFnPtr) (RsContext, RsSamplerValue, RsSamplerValue, RsSamplerValue, RsSamplerValue, RsSamplerValue, float); |
| 67 | typedef void (*ScriptBindAllocationFnPtr) (RsContext, RsScript, RsAllocation, uint32_t); |
| 68 | typedef void (*ScriptSetTimeZoneFnPtr) (RsContext, RsScript, const char*, size_t); |
| 69 | typedef void (*ScriptInvokeFnPtr) (RsContext, RsScript, uint32_t); |
| 70 | typedef void (*ScriptInvokeVFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t); |
| 71 | typedef void (*ScriptForEachFnPtr) (RsContext, RsScript, uint32_t, RsAllocation, RsAllocation, const void*, size_t, const RsScriptCall*, size_t); |
| 72 | typedef void (*ScriptSetVarIFnPtr) (RsContext, RsScript, uint32_t, int); |
| 73 | typedef void (*ScriptSetVarObjFnPtr) (RsContext, RsScript, uint32_t, RsObjectBase); |
| 74 | typedef void (*ScriptSetVarJFnPtr) (RsContext, RsScript, uint32_t, int64_t); |
| 75 | typedef void (*ScriptSetVarFFnPtr) (RsContext, RsScript, uint32_t, float); |
| 76 | typedef void (*ScriptSetVarDFnPtr) (RsContext, RsScript, uint32_t, double); |
| 77 | typedef void (*ScriptSetVarVFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t); |
| 78 | typedef void (*ScriptGetVarVFnPtr) (RsContext, RsScript, uint32_t, void*, size_t); |
Stephen Hines | ac8d146 | 2014-06-25 00:01:23 -0700 | [diff] [blame] | 79 | typedef void (*ScriptSetVarVEFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t, RsElement, const uint32_t*, size_t); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 80 | typedef RsScript (*ScriptCCreateFnPtr) (RsContext, const char*, size_t, const char*, size_t, const char*, size_t); |
| 81 | typedef RsScript (*ScriptIntrinsicCreateFnPtr) (RsContext, uint32_t id, RsElement); |
| 82 | typedef RsScriptKernelID (*ScriptKernelIDCreateFnPtr) (RsContext, RsScript, int, int); |
| 83 | typedef RsScriptFieldID (*ScriptFieldIDCreateFnPtr) (RsContext, RsScript, int); |
| 84 | typedef RsScriptGroup (*ScriptGroupCreateFnPtr) (RsContext, RsScriptKernelID*, size_t, RsScriptKernelID*, size_t, RsScriptKernelID*, size_t, RsScriptFieldID*, size_t, const RsType*, size_t); |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame^] | 85 | typedef RsScriptGroup2 (*ScriptGroup2CreateFnPtr)(RsContext, RsClosure*, size_t); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 86 | typedef void (*ScriptGroupSetOutputFnPtr) (RsContext, RsScriptGroup, RsScriptKernelID, RsAllocation); |
| 87 | typedef void (*ScriptGroupSetInputFnPtr) (RsContext, RsScriptGroup, RsScriptKernelID, RsAllocation); |
| 88 | typedef void (*ScriptGroupExecuteFnPtr) (RsContext, RsScriptGroup); |
| 89 | typedef void (*AllocationIoSendFnPtr) (RsContext, RsAllocation); |
| 90 | typedef void (*AllocationIoReceiveFnPtr) (RsContext, RsAllocation); |
Jason Sams | b8a94e2 | 2014-02-24 17:52:32 -0800 | [diff] [blame] | 91 | typedef void * (*AllocationGetPointerFnPtr) (RsContext, RsAllocation, uint32_t lod, RsAllocationCubemapFace face, uint32_t z, uint32_t array, size_t *stride); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 92 | |
Jason Sams | 66f0a16 | 2014-11-11 13:46:38 -0800 | [diff] [blame] | 93 | struct dispatchTable { |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 94 | // inserted by hand from rs.h |
| 95 | AllocationGetTypeFnPtr AllocationGetType; |
| 96 | TypeGetNativeDataFnPtr TypeGetNativeData; |
| 97 | ElementGetNativeDataFnPtr ElementGetNativeData; |
| 98 | ElementGetSubElementsFnPtr ElementGetSubElements; |
| 99 | |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 100 | DeviceCreateFnPtr DeviceCreate; |
| 101 | DeviceDestroyFnPtr DeviceDestroy; |
| 102 | DeviceSetConfigFnPtr DeviceSetConfig; |
| 103 | ContextCreateFnPtr ContextCreate; |
Tim Murray | 4a92d12 | 2013-07-22 10:56:18 -0700 | [diff] [blame] | 104 | GetNameFnPtr GetName; |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 105 | |
| 106 | // generated from rs.spec |
| 107 | ContextDestroyFnPtr ContextDestroy; |
| 108 | ContextGetMessageFnPtr ContextGetMessage; |
| 109 | ContextPeekMessageFnPtr ContextPeekMessage; |
| 110 | ContextSendMessageFnPtr ContextSendMessage; |
| 111 | ContextInitToClientFnPtr ContextInitToClient; |
| 112 | ContextDeinitToClientFnPtr ContextDeinitToClient; |
| 113 | TypeCreateFnPtr TypeCreate; |
| 114 | AllocationCreateTypedFnPtr AllocationCreateTyped; |
| 115 | AllocationCreateFromBitmapFnPtr AllocationCreateFromBitmap; |
| 116 | AllocationCubeCreateFromBitmapFnPtr AllocationCubeCreateFromBitmap; |
| 117 | AllocationGetSurfaceFnPtr AllocationGetSurface; |
| 118 | AllocationSetSurfaceFnPtr AllocationSetSurface; |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame^] | 119 | ClosureCreateFnPtr ClosureCreate; |
| 120 | ClosureSetArgFnPtr ClosureSetArg; |
| 121 | ClosureSetGlobalFnPtr ClosureSetGlobal; |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 122 | ContextFinishFnPtr ContextFinish; |
| 123 | ContextDumpFnPtr ContextDump; |
| 124 | ContextSetPriorityFnPtr ContextSetPriority; |
| 125 | AssignNameFnPtr AssignName; |
| 126 | ObjDestroyFnPtr ObjDestroy; |
| 127 | ElementCreateFnPtr ElementCreate; |
| 128 | ElementCreate2FnPtr ElementCreate2; |
| 129 | AllocationCopyToBitmapFnPtr AllocationCopyToBitmap; |
| 130 | Allocation1DDataFnPtr Allocation1DData; |
| 131 | Allocation1DElementDataFnPtr Allocation1DElementData; |
| 132 | Allocation2DDataFnPtr Allocation2DData; |
| 133 | Allocation3DDataFnPtr Allocation3DData; |
| 134 | AllocationGenerateMipmapsFnPtr AllocationGenerateMipmaps; |
| 135 | AllocationReadFnPtr AllocationRead; |
| 136 | Allocation1DReadFnPtr Allocation1DRead; |
| 137 | Allocation2DReadFnPtr Allocation2DRead; |
| 138 | AllocationSyncAllFnPtr AllocationSyncAll; |
| 139 | AllocationResize1DFnPtr AllocationResize1D; |
| 140 | AllocationCopy2DRangeFnPtr AllocationCopy2DRange; |
| 141 | AllocationCopy3DRangeFnPtr AllocationCopy3DRange; |
| 142 | SamplerCreateFnPtr SamplerCreate; |
| 143 | ScriptBindAllocationFnPtr ScriptBindAllocation; |
| 144 | ScriptSetTimeZoneFnPtr ScriptSetTimeZone; |
| 145 | ScriptInvokeFnPtr ScriptInvoke; |
| 146 | ScriptInvokeVFnPtr ScriptInvokeV; |
| 147 | ScriptForEachFnPtr ScriptForEach; |
| 148 | ScriptSetVarIFnPtr ScriptSetVarI; |
| 149 | ScriptSetVarObjFnPtr ScriptSetVarObj; |
| 150 | ScriptSetVarJFnPtr ScriptSetVarJ; |
| 151 | ScriptSetVarFFnPtr ScriptSetVarF; |
| 152 | ScriptSetVarDFnPtr ScriptSetVarD; |
| 153 | ScriptSetVarVFnPtr ScriptSetVarV; |
| 154 | ScriptGetVarVFnPtr ScriptGetVarV; |
| 155 | ScriptSetVarVEFnPtr ScriptSetVarVE; |
| 156 | ScriptCCreateFnPtr ScriptCCreate; |
| 157 | ScriptIntrinsicCreateFnPtr ScriptIntrinsicCreate; |
| 158 | ScriptKernelIDCreateFnPtr ScriptKernelIDCreate; |
| 159 | ScriptFieldIDCreateFnPtr ScriptFieldIDCreate; |
| 160 | ScriptGroupCreateFnPtr ScriptGroupCreate; |
Yang Ni | 1ffd86b | 2015-01-07 09:16:40 -0800 | [diff] [blame^] | 161 | ScriptGroup2CreateFnPtr ScriptGroup2Create; |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 162 | ScriptGroupSetOutputFnPtr ScriptGroupSetOutput; |
| 163 | ScriptGroupSetInputFnPtr ScriptGroupSetInput; |
| 164 | ScriptGroupExecuteFnPtr ScriptGroupExecute; |
| 165 | AllocationIoSendFnPtr AllocationIoSend; |
| 166 | AllocationIoReceiveFnPtr AllocationIoReceive; |
Jason Sams | b8a94e2 | 2014-02-24 17:52:32 -0800 | [diff] [blame] | 167 | AllocationGetPointerFnPtr AllocationGetPointer; |
Jason Sams | 66f0a16 | 2014-11-11 13:46:38 -0800 | [diff] [blame] | 168 | }; |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 169 | |
Miao Wang | 48d2eae | 2014-10-16 11:48:28 -0700 | [diff] [blame] | 170 | bool loadSymbols(void* handle, dispatchTable& dispatchTab); |
Tim Murray | a423096 | 2013-07-17 16:50:10 -0700 | [diff] [blame] | 171 | #endif |