Wait for the API to be presenting before android package is "started"

* This closely resembles the behaviour before, when at least for vulkan
  the library wouldn't be loaded and open the connection until the
  instance is created and the layer is loaded.
* When injecting our libraries, the connection is made very early but it
  may be some time before the program initialises vulkan - we can't
  setprop debug.vulkan.layers back to empty until it has, so instead we
  wait for the API to be presenting.
This commit is contained in:
baldurk
2018-01-31 14:39:06 +00:00
parent 1778e4028d
commit b7aa522769
+20 -6
View File
@@ -213,8 +213,25 @@ uint32_t StartAndroidPackageForCapture(const char *host, const char *package)
ITargetControl *control = RENDERDOC_CreateTargetControl(host, ret, "testConnection", false);
if(control)
{
std::string api;
// allow a few messages to come in, to see the reported active API
for(int i = 0; i < 4; i++)
{
Threading::Sleep(5);
control->ReceiveMessage();
api = control->GetAPI();
if(!api.empty())
break;
}
control->Shutdown();
break;
if(!api.empty())
break;
else
RDCDEBUG("Connection established, but no API initialised yet. Waiting...");
}
// check to see if the PID is still there. If it was before and isn't now, the APK has exited
@@ -231,11 +248,8 @@ uint32_t StartAndroidPackageForCapture(const char *host, const char *package)
elapsed += 1000;
}
// we might open the connection early, when the library is first injected, before the vulkan
// loader completes .
Threading::Sleep(1000);
// Let the app pickup the setprop before we turn it back off for replaying.
// We've ensured above that the app picked up the setprop before we turn it back off for
// replaying.
adbExecCommand(deviceID, "shell setprop debug.vulkan.layers :");
return ret;