diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-09-14 09:50:43 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-09-14 09:50:43 -0700 |
commit | c984dd73c6f96d16e11813ae433ef70f7648ae77 (patch) | |
tree | a40cb9dc5d1b3020e4cf33f575714e72ef3e805f /libs/rs/rsElement.cpp | |
parent | bcd3387eed8910c540d92f26fb6680e9e0ce0588 (diff) | |
download | frameworks_base-c984dd73c6f96d16e11813ae433ef70f7648ae77.zip frameworks_base-c984dd73c6f96d16e11813ae433ef70f7648ae77.tar.gz frameworks_base-c984dd73c6f96d16e11813ae433ef70f7648ae77.tar.bz2 |
Shader changes to allow for more flexible constant binding.
Change-Id: Ic66e6e2a371c6e3d5dce1b00f63acab8c09bd110
Diffstat (limited to 'libs/rs/rsElement.cpp')
-rw-r--r-- | libs/rs/rsElement.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index 0b7bb27..d0909c8 100644 --- a/libs/rs/rsElement.cpp +++ b/libs/rs/rsElement.cpp @@ -314,6 +314,11 @@ void Element::decRefs(const void *ptr) const ElementState::ElementState() { + const uint32_t initialCapacity = 32; + mBuilderElements.setCapacity(initialCapacity); + mBuilderNameStrings.setCapacity(initialCapacity); + mBuilderNameLengths.setCapacity(initialCapacity); + mBuilderArrays.setCapacity(initialCapacity); } ElementState::~ElementState() @@ -321,6 +326,29 @@ ElementState::~ElementState() rsAssert(!mElements.size()); } +void ElementState::elementBuilderBegin() { + mBuilderElements.clear(); + mBuilderNameStrings.clear(); + mBuilderNameLengths.clear(); + mBuilderArrays.clear(); +} + +void ElementState::elementBuilderAdd(const Element *e, const char *nameStr, uint32_t arraySize) { + mBuilderElements.push(e); + mBuilderNameStrings.push(nameStr); + mBuilderNameLengths.push(strlen(nameStr)); + mBuilderArrays.push(arraySize); + +} + +const Element *ElementState::elementBuilderCreate(Context *rsc) { + return Element::create(rsc, mBuilderElements.size(), + &(mBuilderElements.editArray()[0]), + &(mBuilderNameStrings.editArray()[0]), + mBuilderNameLengths.editArray(), + mBuilderArrays.editArray()); +} + ///////////////////////////////////////// // |