rsDispatch.h revision a423096c0d49e5cfe13a400b4323a76f89c6885c
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
20#include "rsDefines.h"
21
22typedef const void* (*AllocationGetTypeFnPtr)(RsContext con, RsAllocation va);
23typedef void (*TypeGetNativeDataFnPtr)(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize);
24typedef void (*ElementGetNativeDataFnPtr)(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize);
25typedef void (*ElementGetSubElementsFnPtr)(RsContext, RsElement, uint32_t *ids, const char **names, uint32_t *arraySizes, uint32_t dataSize);
26typedef RsDevice (*DeviceCreateFnPtr) ();
27typedef void (*DeviceDestroyFnPtr) (RsDevice dev);
28typedef void (*DeviceSetConfigFnPtr) (RsDevice dev, RsDeviceParam p, int32_t value);
29typedef RsContext (*ContextCreateFnPtr)(RsDevice vdev, uint32_t version, uint32_t sdkVersion, RsContextType ct, bool forceCpu, bool synchronous);
30typedef void (*ContextDestroyFnPtr) (RsContext);
31typedef RsMessageToClientType (*ContextGetMessageFnPtr) (RsContext, void*, size_t, size_t*, size_t, uint32_t*, size_t);
32typedef RsMessageToClientType (*ContextPeekMessageFnPtr) (RsContext, size_t*, size_t, uint32_t*, size_t);
33typedef void (*ContextSendMessageFnPtr) (RsContext, uint32_t, const uint8_t*, size_t);
34typedef void (*ContextInitToClientFnPtr) (RsContext);
35typedef void (*ContextDeinitToClientFnPtr) (RsContext);
36typedef RsType (*TypeCreateFnPtr) (RsContext, RsElement, uint32_t, uint32_t, uint32_t, bool, bool, uint32_t);
37typedef RsAllocation (*AllocationCreateTypedFnPtr) (RsContext, RsType, RsAllocationMipmapControl, uint32_t, uintptr_t);
38typedef RsAllocation (*AllocationCreateFromBitmapFnPtr) (RsContext, RsType, RsAllocationMipmapControl, const void*, size_t, uint32_t);
39typedef RsAllocation (*AllocationCubeCreateFromBitmapFnPtr) (RsContext, RsType, RsAllocationMipmapControl, const void*, size_t, uint32_t);
40typedef RsNativeWindow (*AllocationGetSurfaceFnPtr) (RsContext, RsAllocation);
41typedef void (*AllocationSetSurfaceFnPtr) (RsContext, RsAllocation, RsNativeWindow);
42typedef void (*ContextFinishFnPtr) (RsContext);
43typedef void (*ContextDumpFnPtr) (RsContext, int32_t);
44typedef void (*ContextSetPriorityFnPtr) (RsContext, int32_t);
45typedef void (*AssignNameFnPtr) (RsContext, RsObjectBase, const char*, size_t);
46typedef void (*ObjDestroyFnPtr) (RsContext, RsAsyncVoidPtr);
47typedef RsElement (*ElementCreateFnPtr) (RsContext, RsDataType, RsDataKind, bool, uint32_t);
48typedef RsElement (*ElementCreate2FnPtr) (RsContext, const RsElement*, size_t, const char**, size_t, const size_t*, const uint32_t*, size_t);
49typedef void (*AllocationCopyToBitmapFnPtr) (RsContext, RsAllocation, void*, size_t);
50typedef void (*Allocation1DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, const void*, size_t);
51typedef void (*Allocation1DElementDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, const void*, size_t, size_t);
52typedef void (*Allocation2DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, RsAllocationCubemapFace, uint32_t, uint32_t, const void*, size_t, size_t);
53typedef void (*Allocation3DDataFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const void*, size_t, size_t);
54typedef void (*AllocationGenerateMipmapsFnPtr) (RsContext, RsAllocation);
55typedef void (*AllocationReadFnPtr) (RsContext, RsAllocation, void*, size_t);
56typedef void (*Allocation1DReadFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, void*, size_t);
57typedef void (*Allocation2DReadFnPtr) (RsContext, RsAllocation, uint32_t, uint32_t, uint32_t, RsAllocationCubemapFace, uint32_t, uint32_t, void*, size_t, size_t);
58typedef void (*AllocationSyncAllFnPtr) (RsContext, RsAllocation, RsAllocationUsageType);
59typedef void (*AllocationResize1DFnPtr) (RsContext, RsAllocation, uint32_t);
60typedef 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);
61typedef 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);
62typedef RsSampler (*SamplerCreateFnPtr) (RsContext, RsSamplerValue, RsSamplerValue, RsSamplerValue, RsSamplerValue, RsSamplerValue, float);
63typedef void (*ScriptBindAllocationFnPtr) (RsContext, RsScript, RsAllocation, uint32_t);
64typedef void (*ScriptSetTimeZoneFnPtr) (RsContext, RsScript, const char*, size_t);
65typedef void (*ScriptInvokeFnPtr) (RsContext, RsScript, uint32_t);
66typedef void (*ScriptInvokeVFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t);
67typedef void (*ScriptForEachFnPtr) (RsContext, RsScript, uint32_t, RsAllocation, RsAllocation, const void*, size_t, const RsScriptCall*, size_t);
68typedef void (*ScriptSetVarIFnPtr) (RsContext, RsScript, uint32_t, int);
69typedef void (*ScriptSetVarObjFnPtr) (RsContext, RsScript, uint32_t, RsObjectBase);
70typedef void (*ScriptSetVarJFnPtr) (RsContext, RsScript, uint32_t, int64_t);
71typedef void (*ScriptSetVarFFnPtr) (RsContext, RsScript, uint32_t, float);
72typedef void (*ScriptSetVarDFnPtr) (RsContext, RsScript, uint32_t, double);
73typedef void (*ScriptSetVarVFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t);
74typedef void (*ScriptGetVarVFnPtr) (RsContext, RsScript, uint32_t, void*, size_t);
75typedef void (*ScriptSetVarVEFnPtr) (RsContext, RsScript, uint32_t, const void*, size_t, RsElement, const size_t*, size_t);
76typedef RsScript (*ScriptCCreateFnPtr) (RsContext, const char*, size_t, const char*, size_t, const char*, size_t);
77typedef RsScript (*ScriptIntrinsicCreateFnPtr) (RsContext, uint32_t id, RsElement);
78typedef RsScriptKernelID (*ScriptKernelIDCreateFnPtr) (RsContext, RsScript, int, int);
79typedef RsScriptFieldID (*ScriptFieldIDCreateFnPtr) (RsContext, RsScript, int);
80typedef RsScriptGroup (*ScriptGroupCreateFnPtr) (RsContext, RsScriptKernelID*, size_t, RsScriptKernelID*, size_t, RsScriptKernelID*, size_t, RsScriptFieldID*, size_t, const RsType*, size_t);
81typedef void (*ScriptGroupSetOutputFnPtr) (RsContext, RsScriptGroup, RsScriptKernelID, RsAllocation);
82typedef void (*ScriptGroupSetInputFnPtr) (RsContext, RsScriptGroup, RsScriptKernelID, RsAllocation);
83typedef void (*ScriptGroupExecuteFnPtr) (RsContext, RsScriptGroup);
84typedef void (*AllocationIoSendFnPtr) (RsContext, RsAllocation);
85typedef void (*AllocationIoReceiveFnPtr) (RsContext, RsAllocation);
86
87typedef struct {
88    // inserted by hand from rs.h
89    AllocationGetTypeFnPtr AllocationGetType;
90    TypeGetNativeDataFnPtr TypeGetNativeData;
91    ElementGetNativeDataFnPtr ElementGetNativeData;
92    ElementGetSubElementsFnPtr ElementGetSubElements;
93
94
95    DeviceCreateFnPtr DeviceCreate;
96    DeviceDestroyFnPtr DeviceDestroy;
97    DeviceSetConfigFnPtr DeviceSetConfig;
98    ContextCreateFnPtr ContextCreate;
99
100    // generated from rs.spec
101    ContextDestroyFnPtr ContextDestroy;
102    ContextGetMessageFnPtr ContextGetMessage;
103    ContextPeekMessageFnPtr ContextPeekMessage;
104    ContextSendMessageFnPtr ContextSendMessage;
105    ContextInitToClientFnPtr ContextInitToClient;
106    ContextDeinitToClientFnPtr ContextDeinitToClient;
107    TypeCreateFnPtr TypeCreate;
108    AllocationCreateTypedFnPtr AllocationCreateTyped;
109    AllocationCreateFromBitmapFnPtr AllocationCreateFromBitmap;
110    AllocationCubeCreateFromBitmapFnPtr AllocationCubeCreateFromBitmap;
111    AllocationGetSurfaceFnPtr AllocationGetSurface;
112    AllocationSetSurfaceFnPtr AllocationSetSurface;
113    ContextFinishFnPtr ContextFinish;
114    ContextDumpFnPtr ContextDump;
115    ContextSetPriorityFnPtr ContextSetPriority;
116    AssignNameFnPtr AssignName;
117    ObjDestroyFnPtr ObjDestroy;
118    ElementCreateFnPtr ElementCreate;
119    ElementCreate2FnPtr ElementCreate2;
120    AllocationCopyToBitmapFnPtr AllocationCopyToBitmap;
121    Allocation1DDataFnPtr Allocation1DData;
122    Allocation1DElementDataFnPtr Allocation1DElementData;
123    Allocation2DDataFnPtr Allocation2DData;
124    Allocation3DDataFnPtr Allocation3DData;
125    AllocationGenerateMipmapsFnPtr AllocationGenerateMipmaps;
126    AllocationReadFnPtr AllocationRead;
127    Allocation1DReadFnPtr Allocation1DRead;
128    Allocation2DReadFnPtr Allocation2DRead;
129    AllocationSyncAllFnPtr AllocationSyncAll;
130    AllocationResize1DFnPtr AllocationResize1D;
131    AllocationCopy2DRangeFnPtr AllocationCopy2DRange;
132    AllocationCopy3DRangeFnPtr AllocationCopy3DRange;
133    SamplerCreateFnPtr SamplerCreate;
134    ScriptBindAllocationFnPtr ScriptBindAllocation;
135    ScriptSetTimeZoneFnPtr ScriptSetTimeZone;
136    ScriptInvokeFnPtr ScriptInvoke;
137    ScriptInvokeVFnPtr ScriptInvokeV;
138    ScriptForEachFnPtr ScriptForEach;
139    ScriptSetVarIFnPtr ScriptSetVarI;
140    ScriptSetVarObjFnPtr ScriptSetVarObj;
141    ScriptSetVarJFnPtr ScriptSetVarJ;
142    ScriptSetVarFFnPtr ScriptSetVarF;
143    ScriptSetVarDFnPtr ScriptSetVarD;
144    ScriptSetVarVFnPtr ScriptSetVarV;
145    ScriptGetVarVFnPtr ScriptGetVarV;
146    ScriptSetVarVEFnPtr ScriptSetVarVE;
147    ScriptCCreateFnPtr ScriptCCreate;
148    ScriptIntrinsicCreateFnPtr ScriptIntrinsicCreate;
149    ScriptKernelIDCreateFnPtr ScriptKernelIDCreate;
150    ScriptFieldIDCreateFnPtr ScriptFieldIDCreate;
151    ScriptGroupCreateFnPtr ScriptGroupCreate;
152    ScriptGroupSetOutputFnPtr ScriptGroupSetOutput;
153    ScriptGroupSetInputFnPtr ScriptGroupSetInput;
154    ScriptGroupExecuteFnPtr ScriptGroupExecute;
155    AllocationIoSendFnPtr AllocationIoSend;
156    AllocationIoReceiveFnPtr AllocationIoReceive;
157} dispatchTable;
158
159#endif
160