Expose vulkan layer registration in renderdoccmd on win32. Closes #1690

* This is needed so that the functional tests can elevate and run renderdoccmd
  to register the vulkan layer, if needed.
* At the same time remove the old spammy message and ignore flag - this dates
  back to before the UI existed, and that should be the way users run RenderDoc
  generally and it has a good UI for walking through layer registration if
  needed.
* The command is always available, but will only show up in help if attention is
  needed.
* Also fix registering installs on shared drives.
This commit is contained in:
baldurk
2020-01-20 11:46:48 +00:00
parent 78c68d643a
commit 42841e23be
7 changed files with 292 additions and 221 deletions
-151
View File
@@ -48,153 +48,6 @@ void Daemonise()
daemon(1, 0);
}
struct VulkanRegisterCommand : public Command
{
VulkanRegisterCommand(const GlobalEnvironment &env) : Command(env) {}
virtual void AddOptions(cmdline::parser &parser)
{
parser.add("ignore", 'i', "Do nothing and don't warn about Vulkan layer issues.");
parser.add(
"system", '\0',
"Install layer registration to /etc instead of $HOME/.local (requires root privileges)");
}
virtual const char *Description()
{
return "Attempt to automatically fix Vulkan layer registration issues";
}
virtual bool IsInternalOnly() { return false; }
virtual bool IsCaptureCommand() { return false; }
virtual int Execute(cmdline::parser &parser, const CaptureOptions &)
{
bool ignore = (parser.exist("ignore"));
if(ignore)
{
std::cout << "Not fixing vulkan layer issues, and suppressing future warnings." << std::endl;
std::cout << "To undo, remove '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;
std::string ignorePath = std::string(getenv("HOME")) + "/.renderdoc/";
mkdir(ignorePath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
ignorePath += "ignore_vulkan_layer";
FILE *f = fopen(ignorePath.c_str(), "w");
if(f)
{
fputs("This file suppresses any checks for vulkan layer issues.\n", f);
fputs("Delete this file to restore default checking.\n", f);
fclose(f);
}
else
{
std::cerr << "Couldn't create '$HOME/.renderdoc/ignore_vulkan_layer_issues'." << std::endl;
}
return 0;
}
RENDERDOC_UpdateVulkanLayerRegistration(parser.exist("system"));
return 0;
}
};
void VerifyVulkanLayer(const GlobalEnvironment &env, int argc, char *argv[])
{
VulkanLayerRegistrationInfo info;
bool needUpdate = RENDERDOC_NeedVulkanLayerRegistration(&info);
if(!needUpdate)
{
if(!(info.flags & VulkanLayerFlags::Unfixable))
add_command("vulkanregister", new VulkanRegisterCommand(env));
return;
}
std::cerr << "*************************************************************************"
<< std::endl;
std::cerr << "** Warning: Vulkan capture possibly not configured. **"
<< std::endl;
std::cerr << std::endl;
if(info.flags & VulkanLayerFlags::OtherInstallsRegistered)
std::cerr << "Multiple RenderDoc layers are registered, possibly from different builds."
<< std::endl;
if(!(info.flags & VulkanLayerFlags::ThisInstallRegistered))
std::cerr << "This build's RenderDoc layer is not registered." << std::endl;
std::cerr << "To fix this, the following actions must take place: " << std::endl << std::endl;
const bool registerAll = bool(info.flags & VulkanLayerFlags::RegisterAll);
const bool updateAllowed = bool(info.flags & VulkanLayerFlags::UpdateAllowed);
for(const rdcstr &j : info.otherJSONs)
std::cerr << (updateAllowed ? "Unregister/update: " : "Unregister: ") << j.c_str() << std::endl;
if(!(info.flags & VulkanLayerFlags::ThisInstallRegistered))
{
if(registerAll)
{
for(const rdcstr &j : info.myJSONs)
std::cerr << (updateAllowed ? "Register/update: " : "Register: ") << j.c_str() << std::endl;
}
else
{
std::cerr << (updateAllowed ? "Register one of:" : "Register/update one of:") << std::endl;
for(const rdcstr &j : info.myJSONs)
std::cerr << " -- " << j.c_str() << "\n";
}
}
std::cerr << std::endl;
if(info.flags & VulkanLayerFlags::Unfixable)
{
std::cerr << "NOTE: The renderdoc layer registered in /usr is reserved for distribution"
<< std::endl;
std::cerr << "controlled packages. RenderDoc cannot automatically unregister this even"
<< std::endl;
std::cerr << "with root permissions, you must fix this conflict manually." << std::endl
<< std::endl;
std::cerr << "*************************************************************************"
<< std::endl;
std::cerr << std::endl;
return;
}
std::cerr << "NOTE: Automatically removing or changing the layer registered in /etc" << std::endl;
std::cerr << "will require root privileges." << std::endl << std::endl;
std::cerr << "To fix these issues run the 'vulkanregister' command." << std::endl;
std::cerr << "Use 'vulkanregister --help' to see more information." << std::endl;
std::cerr << std::endl;
std::cerr << "By default 'vulkanregister' will register the layer to your $HOME folder."
<< std::endl;
std::cerr << "This does not require root permissions." << std::endl;
std::cerr << std::endl;
std::cerr << "If you want to install to the system, run 'vulkanregister --system'." << std::endl;
std::cerr << "This requires root permissions to write to /etc/vulkan/." << std::endl;
// just in case there's a strange install that is misdetected or something then allow
// users to suppress this message and just say "I know what I'm doing".
std::cerr << std::endl;
std::cerr << "To suppress this warning in future, run 'vulkanregister --ignore'." << std::endl;
std::cerr << "*************************************************************************"
<< std::endl;
std::cerr << std::endl;
add_command("vulkanregister", new VulkanRegisterCommand(env));
}
static Display *display = NULL;
WindowingData DisplayRemoteServerPreview(bool active, const rdcarray<WindowingSystem> &systems)
@@ -486,10 +339,6 @@ int main(int argc, char *argv[])
display = env.xlibDisplay = XOpenDisplay(NULL);
#endif
#if defined(RENDERDOC_SUPPORT_VULKAN)
VerifyVulkanLayer(env, argc, argv);
#endif
// add compiled-in support to version line
{
std::string support = "APIs supported at compile-time: ";