]> git.notmuchmail.org Git - apitrace/commitdiff
d3dretrace: Cope with _MAP_FLAG_DO_NOT_WAIT flags.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 19 Feb 2013 13:29:26 +0000 (13:29 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 22 Feb 2013 09:59:03 +0000 (09:59 +0000)
If the map succeeded in the original trace, then we must wait.

retrace/dxgiretrace.py
specs/stdapi.py

index 69bc3bac0966fe27c4cd08a5bacba013dd197ec8..6a51a4d4e3c5360128398e6cf184dab4ecbf13a2 100644 (file)
@@ -244,8 +244,17 @@ createWindow(DXGI_SWAP_CHAIN_DESC *pSwapChainDesc) {
             '''
             print r'    _result = _this->CreateTexture2D(&Desc, &InitialData, (ID3D10Texture2D**)ppResource);'
             self.checkResult(method.type)
-        else:
-            Retracer.invokeInterfaceMethod(self, interface, method)
+            return
+
+        if method.name == 'Map':
+            # Reset _DO_NOT_WAIT flags. Otherwise they may fail, and we have no
+            # way to cope with it (other than retry).
+            mapFlagsArg = method.getArgByName('MapFlags')
+            for flag in mapFlagsArg.type.values:
+                if flag.endswith('_MAP_FLAG_DO_NOT_WAIT'):
+                    print r'    MapFlags &= ~%s;' % flag
+
+        Retracer.invokeInterfaceMethod(self, interface, method)
 
         # process events after presents
         if method.name == 'Present':
index b86668bd13be9d2a44b34227fbf5d06eee7733f5..c652736a8383e9156e5bd7e88af34dde79760382 100644 (file)
@@ -385,6 +385,12 @@ class Function:
     def argNames(self):
         return [arg.name for arg in self.args]
 
+    def getArgByName(self, name):
+        for arg in self.args:
+            if arg.name == name:
+                return arg
+        return None
+
 
 def StdFunction(*args, **kwargs):
     kwargs.setdefault('call', '__stdcall')