Make RENDERDOC_NeedVulkanLayerRegistration feasible to call from python

This commit is contained in:
baldurk
2018-11-26 16:39:00 +00:00
parent 8ed9670601
commit 26511c546c
4 changed files with 52 additions and 47 deletions
+16 -18
View File
@@ -148,7 +148,7 @@ CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallba
// Set up warning for host layer config
initWarning(ui->vulkanLayerWarn);
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL, NULL, NULL));
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL));
QObject::connect(ui->vulkanLayerWarn, &RDLabel::clicked, this,
&CaptureDialog::vulkanLayerWarn_mouseClick);
@@ -283,26 +283,24 @@ void CaptureDialog::vulkanLayerWarn_mouseClick()
{
QString caption = tr("Configure Vulkan layer settings in registry?");
VulkanLayerFlags flags = VulkanLayerFlags::NoFlags;
rdcarray<rdcstr> myJSONs;
rdcarray<rdcstr> otherJSONs;
VulkanLayerRegistrationInfo info;
RENDERDOC_NeedVulkanLayerRegistration(&flags, &myJSONs, &otherJSONs);
RENDERDOC_NeedVulkanLayerRegistration(&info);
const bool hasOtherJSON = bool(flags & VulkanLayerFlags::OtherInstallsRegistered);
const bool thisRegistered = bool(flags & VulkanLayerFlags::ThisInstallRegistered);
const bool needElevation = bool(flags & VulkanLayerFlags::NeedElevation);
const bool couldElevate = bool(flags & VulkanLayerFlags::CouldElevate);
const bool registerAll = bool(flags & VulkanLayerFlags::RegisterAll);
const bool updateAllowed = bool(flags & VulkanLayerFlags::UpdateAllowed);
const bool hasOtherJSON = bool(info.flags & VulkanLayerFlags::OtherInstallsRegistered);
const bool thisRegistered = bool(info.flags & VulkanLayerFlags::ThisInstallRegistered);
const bool needElevation = bool(info.flags & VulkanLayerFlags::NeedElevation);
const bool couldElevate = bool(info.flags & VulkanLayerFlags::CouldElevate);
const bool registerAll = bool(info.flags & VulkanLayerFlags::RegisterAll);
const bool updateAllowed = bool(info.flags & VulkanLayerFlags::UpdateAllowed);
if(flags & VulkanLayerFlags::Unfixable)
if(info.flags & VulkanLayerFlags::Unfixable)
{
QString msg =
tr("There is an unfixable problem with your vulkan layer configuration. Please consult the "
"RenderDoc documentation, or package/distribution documentation on linux\n\n");
for(const rdcstr &j : otherJSONs)
for(const rdcstr &j : info.otherJSONs)
msg += j + lit("\n");
RDDialog::critical(this, tr("Unfixable vulkan layer configuration"), msg);
@@ -314,7 +312,7 @@ void CaptureDialog::vulkanLayerWarn_mouseClick()
if(hasOtherJSON)
{
if(otherJSONs.size() > 1)
if(info.otherJSONs.size() > 1)
msg +=
tr("there are other RenderDoc builds registered already. They must be disabled so that "
"capture can happen without nasty clashes.");
@@ -339,7 +337,7 @@ void CaptureDialog::vulkanLayerWarn_mouseClick()
if(hasOtherJSON)
{
for(const rdcstr &j : otherJSONs)
for(const rdcstr &j : info.otherJSONs)
msg += (updateAllowed ? tr("Unregister/update: %1\n") : tr("Unregister: %1\n")).arg(j);
msg += lit("\n");
@@ -349,13 +347,13 @@ void CaptureDialog::vulkanLayerWarn_mouseClick()
{
if(registerAll)
{
for(const rdcstr &j : myJSONs)
for(const rdcstr &j : info.myJSONs)
msg += (updateAllowed ? tr("Register/update: %1\n") : tr("Register: %1\n")).arg(j);
}
else
{
msg += updateAllowed ? tr("Register one of:\n") : tr("Register/update one of:\n");
for(const rdcstr &j : myJSONs)
for(const rdcstr &j : info.myJSONs)
msg += tr(" -- %1\n").arg(j);
}
@@ -454,7 +452,7 @@ void CaptureDialog::vulkanLayerWarn_mouseClick()
}
}
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL, NULL, NULL));
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL));
}
}
+15 -2
View File
@@ -2144,9 +2144,22 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EndSelfHostCapture(const ch
// Vulkan layer handling
//////////////////////////////////////////////////////////////////////////
DOCUMENT("Structure containing all the information about vulkan layer registration");
struct VulkanLayerRegistrationInfo
{
DOCUMENT(":class:`VulkanLayerFlags` detailing the current registration.");
VulkanLayerFlags flags;
DOCUMENT("A list of jsons that should be registered");
rdcarray<rdcstr> myJSONs;
DOCUMENT("A list of jsons that should be unregistered / updated");
rdcarray<rdcstr> otherJSONs;
};
DOCUMENT("Internal function for determining vulkan layer registration status.");
extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration(
VulkanLayerFlags *flags, rdcarray<rdcstr> *myJSONs, rdcarray<rdcstr> *otherJSONs);
extern "C" RENDERDOC_API bool RENDERDOC_CC
RENDERDOC_NeedVulkanLayerRegistration(VulkanLayerRegistrationInfo *info);
DOCUMENT("Internal function for updating vulkan layer registration.");
extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_UpdateVulkanLayerRegistration(bool systemLevel);
+9 -13
View File
@@ -485,8 +485,8 @@ extern "C" RENDERDOC_API void RENDERDOC_CC RENDERDOC_EndSelfHostCapture(const ch
rdoc->EndFrameCapture(NULL, NULL);
}
extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration(
VulkanLayerFlags *flagsPtr, rdcarray<rdcstr> *myJSONsPtr, rdcarray<rdcstr> *otherJSONsPtr)
extern "C" RENDERDOC_API bool RENDERDOC_CC
RENDERDOC_NeedVulkanLayerRegistration(VulkanLayerRegistrationInfo *info)
{
VulkanLayerFlags flags = VulkanLayerFlags::NoFlags;
std::vector<std::string> myJSONs;
@@ -494,21 +494,17 @@ extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration
bool ret = RenderDoc::Inst().NeedVulkanLayerRegistration(flags, myJSONs, otherJSONs);
if(flagsPtr)
*flagsPtr = flags;
if(myJSONsPtr)
if(info)
{
myJSONsPtr->resize(myJSONs.size());
info->flags = flags;
info->myJSONs.resize(myJSONs.size());
for(size_t i = 0; i < myJSONs.size(); i++)
(*myJSONsPtr)[i] = myJSONs[i];
}
info->myJSONs[i] = myJSONs[i];
if(otherJSONsPtr)
{
otherJSONsPtr->resize(otherJSONs.size());
info->otherJSONs.resize(otherJSONs.size());
for(size_t i = 0; i < otherJSONs.size(); i++)
(*otherJSONsPtr)[i] = otherJSONs[i];
info->otherJSONs[i] = otherJSONs[i];
}
return ret;
+12 -14
View File
@@ -107,15 +107,13 @@ struct VulkanRegisterCommand : public Command
void VerifyVulkanLayer(const GlobalEnvironment &env, int argc, char *argv[])
{
VulkanLayerFlags flags = VulkanLayerFlags::NoFlags;
rdcarray<rdcstr> myJSONs;
rdcarray<rdcstr> otherJSONs;
VulkanLayerRegistrationInfo info;
bool needUpdate = RENDERDOC_NeedVulkanLayerRegistration(&flags, &myJSONs, &otherJSONs);
bool needUpdate = RENDERDOC_NeedVulkanLayerRegistration(&info);
if(!needUpdate)
{
if(!(flags & VulkanLayerFlags::Unfixable))
if(!(info.flags & VulkanLayerFlags::Unfixable))
add_command("vulkanregister", new VulkanRegisterCommand(env));
return;
}
@@ -126,39 +124,39 @@ void VerifyVulkanLayer(const GlobalEnvironment &env, int argc, char *argv[])
<< std::endl;
std::cerr << std::endl;
if(flags & VulkanLayerFlags::OtherInstallsRegistered)
if(info.flags & VulkanLayerFlags::OtherInstallsRegistered)
std::cerr << "Multiple RenderDoc layers are registered, possibly from different builds."
<< std::endl;
if(!(flags & VulkanLayerFlags::ThisInstallRegistered))
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(flags & VulkanLayerFlags::RegisterAll);
const bool updateAllowed = bool(flags & VulkanLayerFlags::UpdateAllowed);
const bool registerAll = bool(info.flags & VulkanLayerFlags::RegisterAll);
const bool updateAllowed = bool(info.flags & VulkanLayerFlags::UpdateAllowed);
for(const rdcstr &j : otherJSONs)
for(const rdcstr &j : info.otherJSONs)
std::cerr << (updateAllowed ? "Unregister/update: " : "Unregister: ") << j.c_str() << std::endl;
if(!(flags & VulkanLayerFlags::ThisInstallRegistered))
if(!(info.flags & VulkanLayerFlags::ThisInstallRegistered))
{
if(registerAll)
{
for(const rdcstr &j : myJSONs)
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 : myJSONs)
for(const rdcstr &j : info.myJSONs)
std::cerr << " -- " << j.c_str() << "\n";
}
}
std::cerr << std::endl;
if(flags & VulkanLayerFlags::Unfixable)
if(info.flags & VulkanLayerFlags::Unfixable)
{
std::cerr << "NOTE: The renderdoc layer registered in /usr is reserved for distribution"
<< std::endl;