[Mesa-dev] Fix a crash in update_texture_state() when requesting a fallback for external texture target

Abdiel Janulgue abdiel.janulgue at linux.intel.com
Fri Oct 12 01:51:03 PDT 2012



    mesa: Fix a crash in update_texture_state() when requesting a fallback for
    an external texture target.
    
    NOTE: This is a candidate for the stable branch.
    
    Signed-off-by: Abdiel <abdiel.janulgue at intel.com>

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 513f3bb..224d8a8 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 1fd09e9..3bfd4a9 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -600,6 +600,12 @@ 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: make sure to disable texture unit 
*/
+               continue;
+            
             _mesa_reference_texobj(&texUnit->_Current, texObj);
             texUnit->_ReallyEnabled = 1 << texTarget;
          }


More information about the mesa-dev mailing list