rsScriptC.h revision cdfdb8f2cdf4668c476cac842212892b2505ff3f
1/* 2 * Copyright (C) 2009 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_RS_SCRIPT_C_H 18#define ANDROID_RS_SCRIPT_C_H 19 20#include "rsScript.h" 21 22#include "RenderScriptEnv.h" 23 24 25// --------------------------------------------------------------------------- 26namespace android { 27namespace renderscript { 28 29 30class ScriptC : public Script { 31public: 32 typedef int (*RunScript_t)(); 33 typedef void (*VoidFunc_t)(); 34 35 ScriptC(Context *); 36 virtual ~ScriptC(); 37 38 39 const Allocation *ptrToAllocation(const void *) const; 40 41 42 virtual void Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len); 43 44 virtual uint32_t run(Context *); 45 46 virtual void runForEach(Context *rsc, 47 const Allocation * ain, 48 Allocation * aout, 49 const void * usr, 50 const RsScriptCall *sc = NULL); 51 52 virtual void serialize(OStream *stream) const { } 53 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SCRIPT_C; } 54 static Type *createFromStream(Context *rsc, IStream *stream) { return NULL; } 55 56 bool runCompiler(Context *rsc, const char *resName, const char *cacheDir, 57 const uint8_t *bitcode, size_t bitcodeLen); 58 59//protected: 60 void setupScript(Context *); 61 void setupGLState(Context *); 62 Script * setTLS(Script *); 63}; 64 65class ScriptCState { 66public: 67 ScriptCState(); 68 ~ScriptCState(); 69 70 char * mScriptText; 71 size_t mScriptLen; 72 73 struct SymbolTable_t { 74 const char * mName; 75 void * mPtr; 76 bool threadable; 77 }; 78 static const SymbolTable_t * lookupSymbol(const char *); 79 static const SymbolTable_t * lookupSymbolCL(const char *); 80 static const SymbolTable_t * lookupSymbolGL(const char *); 81}; 82 83 84} 85} 86#endif 87