Is there any way to create UsdImagingGLEngine with HgiVulkan hgi without setting the HGI_ENABLE_VULKAN env var? We’d like to enable Vulkan backend for HdStorm by default in our software, but not requre user to explicitly set the env var and would ideally also not set it on launch internally.
Currently we are explicitly creating the hgi, then the driver based on that and then the UsdImagingGLEngine, but if that env var is not set, it fails to create a working renderer instance. If set, everything works just fine.
Hgi creation part looks like this, hgiName argument would be “HgiVulkan”:
std::unique_ptr<pxr::Hgi> HydraRenderer::createHgi(const std::string& hgiName)
{
auto& plugReg = pxr::PlugRegistry::GetInstance();
const auto plugType = plugReg.FindDerivedTypeByName<pxr::Hgi>(hgiName.c_str());
auto plugin = plugReg.GetPluginForType(plugType);
if (!plugin || !plugin->Load())
throw std::runtime_error("USD Hydra Hgi plugin loading failed");
auto factory = plugType.GetFactory<pxr::HgiFactoryBase>();
if (!factory)
throw std::runtime_error("USD Hydra HgiFactory loading failed");
auto hgi = std::unique_ptr<pxr::Hgi>(factory->New());
if (!hgi)
throw std::runtime_error("USD Hydra Hgi creation failed");
return hgi;
}
We are using OpenUSD 24.11 on Windows.