rsScriptC.h revision fb6b614bcea88a587a7ea4530be45ff0ffa0210e
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 24struct BCCscript; 25 26// --------------------------------------------------------------------------- 27namespace android { 28namespace renderscript { 29 30 31 32class ScriptC : public Script 33{ 34public: 35 typedef int (*RunScript_t)(); 36 typedef void (*VoidFunc_t)(); 37 38 ScriptC(Context *); 39 virtual ~ScriptC(); 40 41 struct Program_t { 42 int mVersionMajor; 43 int mVersionMinor; 44 45 RunScript_t mRoot; 46 VoidFunc_t mInit; 47 }; 48 49 Program_t mProgram; 50 51 BCCscript* mBccScript; 52 53 const Allocation *ptrToAllocation(const void *) const; 54 55 void setTLS(); 56 void clearTLS(); 57 58 virtual void Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len); 59 60 virtual void setupScript(); 61 virtual uint32_t run(Context *, uint32_t launchID); 62 63 virtual void serialize(OStream *stream) const { } 64 virtual A3DClassID getClassId() const { return A3D_CLASS_ID_SCRIPT_C; } 65 static Type *createFromStream(Context *rsc, IStream *stream) { return NULL; } 66}; 67 68class ScriptCState 69{ 70public: 71 ScriptCState(); 72 ~ScriptCState(); 73 74 ScriptC *mScript; 75 76 ObjectBaseRef<const Type> mConstantBufferTypes[MAX_SCRIPT_BANKS]; 77 //String8 mSlotNames[MAX_SCRIPT_BANKS]; 78 bool mSlotWritable[MAX_SCRIPT_BANKS]; 79 //String8 mInvokableNames[MAX_SCRIPT_BANKS]; 80 81 void clear(); 82 void runCompiler(Context *rsc, ScriptC *s); 83 84 struct SymbolTable_t { 85 const char * mName; 86 void * mPtr; 87 }; 88 //static SymbolTable_t gSyms[]; 89 static const SymbolTable_t * lookupSymbol(const char *); 90 static const SymbolTable_t * lookupSymbolCL(const char *); 91 static const SymbolTable_t * lookupSymbolGL(const char *); 92}; 93 94 95} 96} 97#endif 98 99 100 101