Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 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_H |
| 18 | #define ANDROID_RS_SCRIPT_H |
| 19 | |
| 20 | #include "rsAllocation.h" |
| 21 | |
Jason Sams | 3eaa338 | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 22 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 23 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
Jason Sams | 3eaa338 | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 27 | class ProgramVertex; |
| 28 | class ProgramFragment; |
| 29 | class ProgramRaster; |
| 30 | class ProgramFragmentStore; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 31 | |
Jason Sams | 43ee0685 | 2009-08-12 17:54:11 -0700 | [diff] [blame] | 32 | #define MAX_SCRIPT_BANKS 16 |
| 33 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 34 | class Script : public ObjectBase |
| 35 | { |
| 36 | public: |
Jason Sams | be2e841 | 2009-09-16 15:04:38 -0700 | [diff] [blame^] | 37 | typedef void (* InvokeFunc_t)(void); |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 38 | |
| 39 | Script(); |
| 40 | virtual ~Script(); |
| 41 | |
| 42 | |
Jason Sams | 928f5cf | 2009-06-08 18:50:13 -0700 | [diff] [blame] | 43 | struct Enviroment_t { |
| 44 | bool mIsRoot; |
Jason Sams | 928f5cf | 2009-06-08 18:50:13 -0700 | [diff] [blame] | 45 | float mClearColor[4]; |
| 46 | float mClearDepth; |
| 47 | uint32_t mClearStencil; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 48 | |
Romain Guy | 584a375 | 2009-07-30 18:45:01 -0700 | [diff] [blame] | 49 | uint32_t mStartTimeMillis; |
| 50 | const char* mTimeZone; |
| 51 | |
Jason Sams | 3eaa338 | 2009-06-10 15:04:38 -0700 | [diff] [blame] | 52 | ObjectBaseRef<ProgramVertex> mVertex; |
| 53 | ObjectBaseRef<ProgramFragment> mFragment; |
| 54 | //ObjectBaseRef<ProgramRaster> mRaster; |
| 55 | ObjectBaseRef<ProgramFragmentStore> mFragmentStore; |
Jason Sams | be2e841 | 2009-09-16 15:04:38 -0700 | [diff] [blame^] | 56 | InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS]; |
| 57 | const char * mScriptText; |
| 58 | uint32_t mScriptTextLength; |
Jason Sams | 928f5cf | 2009-06-08 18:50:13 -0700 | [diff] [blame] | 59 | }; |
| 60 | Enviroment_t mEnviroment; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 61 | |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 62 | uint32_t mCounstantBufferCount; |
| 63 | |
Jason Sams | be2e841 | 2009-09-16 15:04:38 -0700 | [diff] [blame^] | 64 | |
Jason Sams | 43ee0685 | 2009-08-12 17:54:11 -0700 | [diff] [blame] | 65 | ObjectBaseRef<Allocation> mSlots[MAX_SCRIPT_BANKS]; |
Jason Sams | fbf0b9e | 2009-08-13 12:59:04 -0700 | [diff] [blame] | 66 | ObjectBaseRef<const Type> mTypes[MAX_SCRIPT_BANKS]; |
| 67 | String8 mSlotNames[MAX_SCRIPT_BANKS]; |
Jason Sams | 334ea0c | 2009-08-17 13:56:09 -0700 | [diff] [blame] | 68 | bool mSlotWritable[MAX_SCRIPT_BANKS]; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 69 | |
Jason Sams | be2e841 | 2009-09-16 15:04:38 -0700 | [diff] [blame^] | 70 | |
| 71 | |
Jason Sams | a09f11d | 2009-06-04 17:58:03 -0700 | [diff] [blame] | 72 | virtual bool run(Context *, uint32_t launchID) = 0; |
Jason Sams | d19f10d | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | |
| 76 | |
| 77 | } |
| 78 | } |
| 79 | #endif |
| 80 | |