Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 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 RENDER_SCRIPT_H |
| 18 | #define RENDER_SCRIPT_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame^] | 27 | #include "RenderScriptDefines.h" |
Jason Sams | 11c8af9 | 2010-10-13 15:31:10 -0700 | [diff] [blame] | 28 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 29 | RsDevice rsDeviceCreate(); |
| 30 | void rsDeviceDestroy(RsDevice); |
Jason Sams | ebfb436 | 2009-09-23 13:57:02 -0700 | [diff] [blame] | 31 | void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 32 | |
Jason Sams | 704ff64 | 2010-02-09 16:05:07 -0800 | [diff] [blame] | 33 | RsContext rsContextCreate(RsDevice, uint32_t version); |
Alex Sakhartchouk | 2c74ad9 | 2011-03-16 19:28:25 -0700 | [diff] [blame] | 34 | RsContext rsContextCreateGL(RsDevice, uint32_t version, |
| 35 | RsSurfaceConfig sc, uint32_t dpi); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 36 | void rsContextDestroy(RsContext); |
| 37 | |
Jason Sams | 1c41517 | 2010-11-08 17:06:46 -0800 | [diff] [blame] | 38 | RsMessageToClientType rsContextGetMessage(RsContext vrsc, void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen, bool wait); |
| 39 | RsMessageToClientType rsContextPeekMessage(RsContext vrsc, size_t *receiveLen, uint32_t *subID, bool wait); |
Jason Sams | 516c319 | 2009-10-06 13:58:47 -0700 | [diff] [blame] | 40 | void rsContextInitToClient(RsContext); |
| 41 | void rsContextDeinitToClient(RsContext); |
| 42 | |
Jason Sams | e4a06c5 | 2011-03-16 16:29:28 -0700 | [diff] [blame^] | 43 | // |
Alex Sakhartchouk | 581cc64 | 2010-10-27 14:10:07 -0700 | [diff] [blame] | 44 | // A3D loading and object update code. |
| 45 | // Should only be called at object creation, not thread safe |
| 46 | RsObjectBase rsaFileA3DGetEntryByIndex(RsContext, uint32_t idx, RsFile); |
Alex Sakhartchouk | b0253ea | 2011-01-07 11:12:08 -0800 | [diff] [blame] | 47 | RsFile rsaFileA3DCreateFromMemory(RsContext, const void *data, uint32_t len); |
| 48 | RsFile rsaFileA3DCreateFromAsset(RsContext, void *asset); |
| 49 | RsFile rsaFileA3DCreateFromFile(RsContext, const char *path); |
Alex Sakhartchouk | 581cc64 | 2010-10-27 14:10:07 -0700 | [diff] [blame] | 50 | void rsaFileA3DGetNumIndexEntries(RsContext, int32_t *numEntries, RsFile); |
| 51 | void rsaFileA3DGetIndexEntries(RsContext, RsFileIndexEntry *fileEntries,uint32_t numEntries, RsFile); |
| 52 | void rsaGetName(RsContext, void * obj, const char **name); |
| 53 | // Mesh update functions |
| 54 | void rsaMeshGetVertexBufferCount(RsContext, RsMesh, int32_t *vtxCount); |
| 55 | void rsaMeshGetIndexCount(RsContext, RsMesh, int32_t *idxCount); |
| 56 | void rsaMeshGetVertices(RsContext, RsMesh, RsAllocation *vtxData, uint32_t vtxDataCount); |
| 57 | void rsaMeshGetIndices(RsContext, RsMesh, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount); |
| 58 | // Allocation update |
| 59 | const void* rsaAllocationGetType(RsContext con, RsAllocation va); |
| 60 | // Type update |
| 61 | void rsaTypeGetNativeData(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize); |
| 62 | // Element update |
| 63 | void rsaElementGetNativeData(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize); |
| 64 | void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **names, uint32_t dataSize); |
Jason Sams | 11c8af9 | 2010-10-13 15:31:10 -0700 | [diff] [blame] | 65 | |
Jason Sams | 3b9c52a | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 66 | // Async commands for returning new IDS |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 67 | RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimX, uint32_t dimY, |
| 68 | uint32_t dimZ, bool mips, bool faces); |
| 69 | RsAllocation rsaAllocationCreateTyped(RsContext rsc, RsType vtype, |
Jason Sams | d4b23b5 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 70 | RsAllocationMipmapControl mips, |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 71 | uint32_t usages); |
| 72 | RsAllocation rsaAllocationCreateFromBitmap(RsContext con, RsType vtype, |
Jason Sams | d4b23b5 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 73 | RsAllocationMipmapControl mips, |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 74 | const void *data, uint32_t usages); |
| 75 | RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype, |
Jason Sams | d4b23b5 | 2010-12-13 15:32:35 -0800 | [diff] [blame] | 76 | RsAllocationMipmapControl mips, |
Jason Sams | 5476b45 | 2010-12-08 16:14:36 -0800 | [diff] [blame] | 77 | const void *data, uint32_t usages); |
Alex Sakhartchouk | d0f5bd1 | 2011-01-31 14:53:24 -0800 | [diff] [blame] | 78 | #ifdef ANDROID_RS_SERIALIZE |
Alex Sakhartchouk | a3b5960 | 2011-01-28 09:31:47 -0800 | [diff] [blame] | 79 | #define NO_RS_FUNCS |
| 80 | #endif |
Jason Sams | 3b9c52a | 2010-10-14 17:48:46 -0700 | [diff] [blame] | 81 | |
Jason Sams | 7eecbf2 | 2010-02-23 15:27:51 -0800 | [diff] [blame] | 82 | #ifndef NO_RS_FUNCS |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 83 | #include "rsgApiFuncDecl.h" |
Jason Sams | 7eecbf2 | 2010-02-23 15:27:51 -0800 | [diff] [blame] | 84 | #endif |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 85 | |
| 86 | #ifdef __cplusplus |
| 87 | }; |
| 88 | #endif |
| 89 | |
| 90 | #endif // RENDER_SCRIPT_H |
| 91 | |
| 92 | |
| 93 | |