python/retrace: Try to cope with failures creating textures.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 8 Apr 2009 20:13:57 +0000 (21:13 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 8 Apr 2009 20:41:04 +0000 (21:41 +0100)
src/gallium/state_trackers/python/retrace/interpreter.py

index 0f1c56075af9245414afe979adfa8a94f1e8cb5f..5ea07724a501da5639273b041b14012627c36299 100755 (executable)
@@ -286,6 +286,8 @@ class Screen(Object):
         pass
 
     def get_tex_surface(self, texture, face, level, zslice, usage):
+        if texture is None:
+            return None
         return texture.get_surface(face, level, zslice)
     
     def tex_surface_destroy(self, surface):
@@ -295,16 +297,22 @@ class Screen(Object):
         pass
 
     def surface_write(self, surface, data, stride, size):
+        if surface is None:
+            return
         assert surface.nblocksy * stride == size 
         surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
 
     def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
+        if texture is None:
+            return None
         return Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
     
     def tex_transfer_destroy(self, transfer):
         self.interpreter.unregister_object(transfer)
 
     def transfer_write(self, transfer, stride, data, size):
+        if transfer is None:
+            return
         transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride)
 
     def user_buffer_create(self, data, size):
@@ -650,6 +658,8 @@ class Interpreter(parser.TraceDumper):
         ret = method(**dict(args))
         
         if call.ret and isinstance(call.ret, model.Pointer):
+            if ret is None:
+                sys.stderr.write('warning: NULL returned\n')
             self.register_object(call.ret.address, ret)
 
         self.call_no = None