diff options
Diffstat (limited to 'libs/rs/rsProgram.cpp')
-rw-r--r-- | libs/rs/rsProgram.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp index 33eb422..4178aa5 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; |