summaryrefslogtreecommitdiff
path: root/libs/rs/rsProgram.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2011-08-19 11:23:46 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-08-19 11:23:46 -0700
commit00c0dcb846e6b8574545e6682328e0197388d2ca (patch)
tree6add7c3808ea6d5110c4c48f10249f0db03af78e /libs/rs/rsProgram.cpp
parent7c670365ae5abf102da94be78cc9c064fd9d35e4 (diff)
parent777ec2662ef5ee8b0a501e0b8a9b2d7a2b84ffe7 (diff)
Merge "Fix issue with freeing allocation with circular references."
Diffstat (limited to 'libs/rs/rsProgram.cpp')
-rw-r--r--libs/rs/rsProgram.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index 33eb422e3354..4178aa5b547e 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -70,15 +70,8 @@ Program::Program(Context *rsc, const char * shaderText, uint32_t shaderLength,
}
Program::~Program() {
+ freeChildren();
- for (uint32_t ct=0; ct < mHal.state.constantsCount; ct++) {
- bindAllocation(NULL, NULL, ct);
- }
-
- for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
- bindTexture(NULL, ct, NULL);
- bindSampler(NULL, ct, NULL);
- }
delete[] mHal.state.textures;
delete[] mHal.state.samplers;
delete[] mHal.state.textureTargets;
@@ -90,6 +83,18 @@ Program::~Program() {
mHal.state.texturesCount = 0;
}
+bool Program::freeChildren() {
+ for (uint32_t ct=0; ct < mHal.state.constantsCount; ct++) {
+ bindAllocation(NULL, NULL, ct);
+ }
+
+ for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
+ bindTexture(NULL, ct, NULL);
+ bindSampler(NULL, ct, NULL);
+ }
+ return false;
+}
+
void Program::initMemberVars() {
mDirty = true;