blob: cb6d7e05ebdb25795ee518dcb356ad5185faac72 [file] [log] [blame]
Jason Samsd19f10d2009-05-22 14:03:28 -07001/*
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
24extern "C" {
25#endif
26
Jason Samse4a06c52011-03-16 16:29:28 -070027#include "RenderScriptDefines.h"
Jason Sams11c8af92010-10-13 15:31:10 -070028
Jason Samsd19f10d2009-05-22 14:03:28 -070029RsDevice rsDeviceCreate();
30void rsDeviceDestroy(RsDevice);
Jason Samsebfb4362009-09-23 13:57:02 -070031void rsDeviceSetConfig(RsDevice, RsDeviceParam, int32_t value);
Jason Samsd19f10d2009-05-22 14:03:28 -070032
Jason Sams704ff642010-02-09 16:05:07 -080033RsContext rsContextCreate(RsDevice, uint32_t version);
Alex Sakhartchouk2c74ad92011-03-16 19:28:25 -070034RsContext rsContextCreateGL(RsDevice, uint32_t version,
35 RsSurfaceConfig sc, uint32_t dpi);
Jason Samsd19f10d2009-05-22 14:03:28 -070036void rsContextDestroy(RsContext);
37
Jason Sams1c415172010-11-08 17:06:46 -080038RsMessageToClientType rsContextGetMessage(RsContext vrsc, void *data, size_t *receiveLen, uint32_t *subID, size_t bufferLen, bool wait);
39RsMessageToClientType rsContextPeekMessage(RsContext vrsc, size_t *receiveLen, uint32_t *subID, bool wait);
Jason Sams516c3192009-10-06 13:58:47 -070040void rsContextInitToClient(RsContext);
41void rsContextDeinitToClient(RsContext);
42
Jason Samse4a06c52011-03-16 16:29:28 -070043//
Alex Sakhartchouk581cc642010-10-27 14:10:07 -070044// A3D loading and object update code.
45// Should only be called at object creation, not thread safe
46RsObjectBase rsaFileA3DGetEntryByIndex(RsContext, uint32_t idx, RsFile);
Alex Sakhartchoukb0253ea2011-01-07 11:12:08 -080047RsFile rsaFileA3DCreateFromMemory(RsContext, const void *data, uint32_t len);
48RsFile rsaFileA3DCreateFromAsset(RsContext, void *asset);
49RsFile rsaFileA3DCreateFromFile(RsContext, const char *path);
Alex Sakhartchouk581cc642010-10-27 14:10:07 -070050void rsaFileA3DGetNumIndexEntries(RsContext, int32_t *numEntries, RsFile);
51void rsaFileA3DGetIndexEntries(RsContext, RsFileIndexEntry *fileEntries,uint32_t numEntries, RsFile);
52void rsaGetName(RsContext, void * obj, const char **name);
53// Mesh update functions
54void rsaMeshGetVertexBufferCount(RsContext, RsMesh, int32_t *vtxCount);
55void rsaMeshGetIndexCount(RsContext, RsMesh, int32_t *idxCount);
56void rsaMeshGetVertices(RsContext, RsMesh, RsAllocation *vtxData, uint32_t vtxDataCount);
57void rsaMeshGetIndices(RsContext, RsMesh, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount);
58// Allocation update
59const void* rsaAllocationGetType(RsContext con, RsAllocation va);
60// Type update
61void rsaTypeGetNativeData(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize);
62// Element update
63void rsaElementGetNativeData(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize);
64void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **names, uint32_t dataSize);
Jason Sams11c8af92010-10-13 15:31:10 -070065
Jason Sams3b9c52a2010-10-14 17:48:46 -070066// Async commands for returning new IDS
Jason Sams5476b452010-12-08 16:14:36 -080067RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimX, uint32_t dimY,
68 uint32_t dimZ, bool mips, bool faces);
69RsAllocation rsaAllocationCreateTyped(RsContext rsc, RsType vtype,
Jason Samsd4b23b52010-12-13 15:32:35 -080070 RsAllocationMipmapControl mips,
Jason Sams5476b452010-12-08 16:14:36 -080071 uint32_t usages);
72RsAllocation rsaAllocationCreateFromBitmap(RsContext con, RsType vtype,
Jason Samsd4b23b52010-12-13 15:32:35 -080073 RsAllocationMipmapControl mips,
Jason Sams5476b452010-12-08 16:14:36 -080074 const void *data, uint32_t usages);
75RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype,
Jason Samsd4b23b52010-12-13 15:32:35 -080076 RsAllocationMipmapControl mips,
Jason Sams5476b452010-12-08 16:14:36 -080077 const void *data, uint32_t usages);
Alex Sakhartchoukd0f5bd12011-01-31 14:53:24 -080078#ifdef ANDROID_RS_SERIALIZE
Alex Sakhartchouka3b59602011-01-28 09:31:47 -080079#define NO_RS_FUNCS
80#endif
Jason Sams3b9c52a2010-10-14 17:48:46 -070081
Jason Sams7eecbf22010-02-23 15:27:51 -080082#ifndef NO_RS_FUNCS
Jason Samsd19f10d2009-05-22 14:03:28 -070083#include "rsgApiFuncDecl.h"
Jason Sams7eecbf22010-02-23 15:27:51 -080084#endif
Jason Samsd19f10d2009-05-22 14:03:28 -070085
86#ifdef __cplusplus
87};
88#endif
89
90#endif // RENDER_SCRIPT_H
91
92
93