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