diff options
Diffstat (limited to 'libs/rs/rsElement.h')
-rw-r--r-- | libs/rs/rsElement.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h index 02a1ca2..50bca85 100644 --- a/libs/rs/rsElement.h +++ b/libs/rs/rsElement.h @@ -40,9 +40,11 @@ public: return (getSizeBits() + 7) >> 3; } - size_t getFieldOffsetBits(uint32_t componentNumber) const; + size_t getFieldOffsetBits(uint32_t componentNumber) const { + return mFields[componentNumber].offsetBits; + } size_t getFieldOffsetBytes(uint32_t componentNumber) const { - return (getFieldOffsetBits(componentNumber) + 7) >> 3; + return mFields[componentNumber].offsetBits >> 3; } uint32_t getFieldCount() const {return mFieldCount;} @@ -54,16 +56,23 @@ public: RsDataKind getKind() const {return mComponent.getKind();} uint32_t getBits() const {return mBits;} - String8 getCType(uint32_t indent=0) const; - String8 getCStructBody(uint32_t indent=0) const; String8 getGLSLType(uint32_t indent=0) const; void dumpLOGV(const char *prefix) const; + virtual void serialize(OStream *stream) const; + virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ELEMENT; } + static Element *createFromStream(Context *rsc, IStream *stream); static const Element * create(Context *rsc, RsDataType dt, RsDataKind dk, bool isNorm, uint32_t vecSize); static const Element * create(Context *rsc, size_t count, const Element **, - const char **, const size_t * lengths); + const char **, const size_t * lengths, const uint32_t *asin); + + void incRefs(const void *) const; + void decRefs(const void *) const; + bool getHasReferences() const {return mHasReference;} + + bool isEqual(const Element *other) const; protected: // deallocate any components that are part of this element. @@ -72,9 +81,12 @@ protected: typedef struct { String8 name; ObjectBaseRef<const Element> e; + uint32_t offsetBits; + uint32_t arraySize; } ElementField_t; ElementField_t *mFields; size_t mFieldCount; + bool mHasReference; Element(Context *); @@ -89,8 +101,17 @@ public: ElementState(); ~ElementState(); + void elementBuilderBegin(); + void elementBuilderAdd(const Element *e, const char *nameStr, uint32_t arraySize); + const Element *elementBuilderCreate(Context *rsc); + // Cache of all existing elements. - Vector<const Element *> mElements; + Vector<Element *> mElements; +private: + Vector<const Element *> mBuilderElements; + Vector<const char*> mBuilderNameStrings; + Vector<size_t> mBuilderNameLengths; + Vector<uint32_t> mBuilderArrays; }; |