diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp index e51afa22a..aec1ff8a6 100644 --- a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp @@ -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 myJSONs; - rdcarray 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)); } } diff --git a/renderdoc/api/replay/renderdoc_replay.h b/renderdoc/api/replay/renderdoc_replay.h index 661f97558..c8404b682 100644 --- a/renderdoc/api/replay/renderdoc_replay.h +++ b/renderdoc/api/replay/renderdoc_replay.h @@ -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 myJSONs; + + DOCUMENT("A list of jsons that should be unregistered / updated"); + rdcarray otherJSONs; +}; + DOCUMENT("Internal function for determining vulkan layer registration status."); -extern "C" RENDERDOC_API bool RENDERDOC_CC RENDERDOC_NeedVulkanLayerRegistration( - VulkanLayerFlags *flags, rdcarray *myJSONs, rdcarray *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); diff --git a/renderdoc/replay/entry_points.cpp b/renderdoc/replay/entry_points.cpp index 409a122cf..ee1fb7141 100644 --- a/renderdoc/replay/entry_points.cpp +++ b/renderdoc/replay/entry_points.cpp @@ -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 *myJSONsPtr, rdcarray *otherJSONsPtr) +extern "C" RENDERDOC_API bool RENDERDOC_CC +RENDERDOC_NeedVulkanLayerRegistration(VulkanLayerRegistrationInfo *info) { VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; std::vector 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; diff --git a/renderdoccmd/renderdoccmd_linux.cpp b/renderdoccmd/renderdoccmd_linux.cpp index 64f014c89..a609d4ee7 100644 --- a/renderdoccmd/renderdoccmd_linux.cpp +++ b/renderdoccmd/renderdoccmd_linux.cpp @@ -107,15 +107,13 @@ struct VulkanRegisterCommand : public Command void VerifyVulkanLayer(const GlobalEnvironment &env, int argc, char *argv[]) { - VulkanLayerFlags flags = VulkanLayerFlags::NoFlags; - rdcarray myJSONs; - rdcarray 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;