summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsElement.h
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-08-16 13:09:46 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-08-16 13:09:46 -0700
commit117abdbc67123654d0754b686c5bbdee6b44bcdd (patch)
tree7531e3083956f7fc2db9310253425c32e9743b8f /libs/rs/rsElement.h
parent065fa8deb178f00ad9957d3212ec2620c46f78e4 (diff)
downloadframeworks_base-117abdbc67123654d0754b686c5bbdee6b44bcdd.zip
frameworks_base-117abdbc67123654d0754b686c5bbdee6b44bcdd.tar.gz
frameworks_base-117abdbc67123654d0754b686c5bbdee6b44bcdd.tar.bz2
Fixing asynchronous performance issues.
Change-Id: I10f02cd37a33a6c655814d24e0a4291dc044fba3
Diffstat (limited to 'libs/rs/rsElement.h')
-rw-r--r--libs/rs/rsElement.h53
1 files changed, 43 insertions, 10 deletions
diff --git a/libs/rs/rsElement.h b/libs/rs/rsElement.h
index 26e2760..c3ef250 100644
--- a/libs/rs/rsElement.h
+++ b/libs/rs/rsElement.h
@@ -28,8 +28,17 @@ namespace renderscript {
// An element is a group of Components that occupies one cell in a structure.
class Element : public ObjectBase {
public:
- ~Element();
-
+ class Builder {
+ public:
+ void add(const Element *e, const char *nameStr, uint32_t arraySize);
+ ObjectBaseRef<const Element> create(Context *rsc);
+ private:
+ Vector<ObjectBaseRef<const Element> > mBuilderElementRefs;
+ Vector<const Element *> mBuilderElements;
+ Vector<const char*> mBuilderNameStrings;
+ Vector<size_t> mBuilderNameLengths;
+ Vector<uint32_t> mBuilderArrays;
+ };
uint32_t getGLType() const;
uint32_t getGLFormat() const;
@@ -55,24 +64,45 @@ public:
RsDataKind getKind() const {return mComponent.getKind();}
uint32_t getBits() const {return mBits;}
- 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 uint32_t *asin);
+ static ObjectBaseRef<const Element> createRef(Context *rsc,
+ RsDataType dt,
+ RsDataKind dk,
+ bool isNorm,
+ uint32_t vecSize);
+ static ObjectBaseRef<const Element> createRef(Context *rsc, size_t count,
+ const Element **,
+ const char **,
+ const size_t * lengths,
+ const uint32_t *asin);
+
+ static const Element* create(Context *rsc,
+ RsDataType dt,
+ RsDataKind dk,
+ bool isNorm,
+ uint32_t vecSize) {
+ ObjectBaseRef<const Element> elem = createRef(rsc, dt, dk, isNorm, vecSize);
+ elem->incUserRef();
+ return elem.get();
+ }
+ static const Element* create(Context *rsc, size_t count,
+ const Element **ein,
+ const char **nin,
+ const size_t * lengths,
+ const uint32_t *asin) {
+ ObjectBaseRef<const Element> elem = createRef(rsc, count, ein, nin, lengths, asin);
+ elem->incUserRef();
+ return elem.get();
+ }
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.
void clear();
@@ -88,12 +118,15 @@ protected:
bool mHasReference;
+ virtual ~Element();
Element(Context *);
Component mComponent;
uint32_t mBits;
void compute();
+
+ virtual void preDestroy() const;
};