Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [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_COMPONENT_H |
| 18 | #define ANDROID_COMPONENT_H |
| 19 | |
| 20 | #include "rsUtils.h" |
Alex Sakhartchouk | e23d239 | 2012-03-09 09:24:39 -0800 | [diff] [blame] | 21 | #include "rsDefines.h" |
Tim Murray | 0b575de | 2013-03-15 15:56:43 -0700 | [diff] [blame] | 22 | #include "rsStream.h" |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 23 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
| 27 | |
| 28 | // An element is a group of Components that occupies one cell in a structure. |
Alex Sakhartchouk | afb743a | 2010-11-09 17:00:54 -0800 | [diff] [blame] | 29 | class Component { |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 30 | public: |
| 31 | Component(); |
| 32 | ~Component(); |
| 33 | |
| 34 | void set(RsDataType dt, RsDataKind dk, bool norm, uint32_t vecSize=1); |
| 35 | |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 36 | void dumpLOGV(const char *prefix) const; |
| 37 | |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 38 | RsDataType getType() const {return mType;} |
| 39 | RsDataKind getKind() const {return mKind;} |
| 40 | bool getIsNormalized() const {return mNormalized;} |
| 41 | uint32_t getVectorSize() const {return mVectorSize;} |
| 42 | bool getIsFloat() const {return mIsFloat;} |
| 43 | bool getIsSigned() const {return mIsSigned;} |
| 44 | uint32_t getBits() const {return mBits;} |
Alex Sakhartchouk | 2d1220c | 2011-11-15 15:15:21 -0800 | [diff] [blame] | 45 | uint32_t getBitsUnpadded() const {return mBitsUnpadded;} |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 46 | |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 47 | // Helpers for reading / writing this class out |
| 48 | void serialize(OStream *stream) const; |
| 49 | void loadFromStream(IStream *stream); |
| 50 | |
Jason Sams | e3929c9 | 2010-08-09 18:13:33 -0700 | [diff] [blame] | 51 | bool isReference() const; |
| 52 | |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 53 | protected: |
| 54 | RsDataType mType; |
| 55 | RsDataKind mKind; |
| 56 | bool mNormalized; |
| 57 | uint32_t mVectorSize; |
| 58 | |
| 59 | // derived |
| 60 | uint32_t mBits; |
Alex Sakhartchouk | 2d1220c | 2011-11-15 15:15:21 -0800 | [diff] [blame] | 61 | uint32_t mBitsUnpadded; |
Jason Sams | d01d970 | 2009-12-23 14:35:29 -0800 | [diff] [blame] | 62 | uint32_t mTypeBits; |
| 63 | bool mIsFloat; |
| 64 | bool mIsSigned; |
| 65 | bool mIsPixel; |
| 66 | }; |
| 67 | |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | #endif |
| 72 | |