summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-12-03 16:15:46 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2009-12-03 16:15:46 -0800
commit5c49a9080df9e46193efa8326318c86bc8976eea (patch)
tree6c893da9ec2f59ddfd43d2df0f832006368407b2
parent5d0806c9c3e0e6c8673ac4238f8ec2e0f82ad7e6 (diff)
parentc73ec39bd0e9ff983eb2fc17a863100825721d49 (diff)
Merge change Ic73ec39b into eclair
* changes: DO NOT MERGE. Implement WAR which should prevent the white square bug from appearing on user devices. If we see a 0 texture id during bind for rendering, attempt to re-upload. If this fails log debug info and restart the app.
-rw-r--r--libs/rs/rsProgramFragment.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 708a0e0f5957..5f2dfae6b2c9 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -65,6 +65,20 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state)
}
glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, mPointSpriteEnable);
}
+
+ rsAssert(mTextures[ct]->getTextureID() != 0);
+ if (mTextures[ct]->getTextureID() == 0) {
+ // This is a hack for eclair to try to fix the white squares bug.
+ Allocation *a = (Allocation *)mTextures[ct].get();
+ a->uploadToTexture((Context *)rsc, 0);
+ if (mTextures[ct]->getTextureID() == 0) {
+ // At this point we are screwed. Crash to restart the app.
+ rsc->dumpDebug();
+ LOGE("Multiple failures during texture upload. Driver appears wedged.");
+ ((char *)0)[0] = 0;
+ }
+
+ }
glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID());
switch(mEnvModes[ct]) {