+ if interface.name.startswith('ID3D10Device') and method.name == 'OpenSharedResource':
+ print r' retrace::warning(call) << "replacing shared resource with checker pattern\n";'
+ print r' D3D10_TEXTURE2D_DESC Desc;'
+ print r' memset(&Desc, 0, sizeof Desc);'
+ print r' Desc.Width = 8;'
+ print r' Desc.Height = 8;'
+ print r' Desc.MipLevels = 1;'
+ print r' Desc.ArraySize = 1;'
+ print r' Desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;'
+ print r' Desc.SampleDesc.Count = 1;'
+ print r' Desc.SampleDesc.Quality = 0;'
+ print r' Desc.Usage = D3D10_USAGE_DEFAULT;'
+ print r' Desc.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET;'
+ print r' Desc.CPUAccessFlags = 0x0;'
+ print r' Desc.MiscFlags = 0 /* D3D10_RESOURCE_MISC_SHARED */;'
+ print r'''
+ const DWORD Checker[8][8] = {
+ { 0, ~0, 0, ~0, 0, ~0, 0, ~0, },
+ {~0, 0, ~0, 0, ~0, 0, ~0, 0, },
+ { 0, ~0, 0, ~0, 0, ~0, 0, ~0, },
+ {~0, 0, ~0, 0, ~0, 0, ~0, 0, },
+ { 0, ~0, 0, ~0, 0, ~0, 0, ~0, },
+ {~0, 0, ~0, 0, ~0, 0, ~0, 0, },
+ { 0, ~0, 0, ~0, 0, ~0, 0, ~0, },
+ {~0, 0, ~0, 0, ~0, 0, ~0, 0, }
+ };
+ const D3D10_SUBRESOURCE_DATA InitialData = {Checker, sizeof Checker[0], sizeof Checker};
+ '''
+ print r' _result = _this->CreateTexture2D(&Desc, &InitialData, (ID3D10Texture2D**)ppResource);'
+ self.checkResult(method.type)
+ 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
+