diff options
author | Abdiel Janulgue <abdiel.janulgue@linux.intel.com> | 2012-10-12 11:51:03 +0300 |
---|---|---|
committer | Andreas Boll <andreas.boll.dev@gmail.com> | 2013-01-20 15:08:26 +0100 |
commit | a5848562b501f67e4f51013277b12157d9c7fb18 (patch) | |
tree | 2f0d5517bd661e7a369cfe9667c47c34bd8638d1 | |
parent | 19c1e7c664a3dfef7d40dd5ecc4173c80821dc1f (diff) |
mesa: Fix a crash in update_texture_state() for external texture type
NOTE: This is a candidate for the stable branch.
Signed-off-by: Abdiel <abdiel.janulgue@intel.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit bcb10ca17221833b2502970fb94ff52cf328ee30)
-rw-r--r-- | src/mesa/main/texobj.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 513f3bb0567..224d8a825dc 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -769,6 +769,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) target = GL_TEXTURE_BUFFER; break; case TEXTURE_EXTERNAL_INDEX: + dims = 2; + target = GL_TEXTURE_EXTERNAL_OES; + break; default: /* no-op */ return NULL; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index fa1fef27eac..dcb8e436b4f 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -600,6 +600,13 @@ update_texture_state( struct gl_context *ctx ) texTarget = (gl_texture_index) (ffs(enabledTargets) - 1); texObj = _mesa_get_fallback_texture(ctx, texTarget); + + assert(texObj); + if (!texObj) { + /* invalid fallback texture: don't enable the texture unit */ + continue; + } + _mesa_reference_texobj(&texUnit->_Current, texObj); texUnit->_ReallyEnabled = 1 << texTarget; } |