Skip to content

Commit

Permalink
avoid checking Vulkan version with a separate hgi instance
Browse files Browse the repository at this point in the history
  • Loading branch information
crescentyue74 committed Jan 5, 2024
1 parent bd3d1b1 commit c562276
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pxr/imaging/hgi/hgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,14 @@ _MakeNewPlatformDefaultHgi()
return nullptr;
}

#ifdef __ANDROID__
if (instance->IsBackendSupported())
return instance;
else
return nullptr;
#else
return instance;
#endif
}

static Hgi*
Expand Down Expand Up @@ -173,7 +180,14 @@ _MakeHgiOfChoice(const TfToken& type)
return nullptr;
}

#ifdef __ANDROID__
if (instance->IsBackendSupported())
return instance;
else
return nullptr;
#else
return instance;
#endif
}

Hgi*
Expand All @@ -200,6 +214,11 @@ Hgi::CreateHgiOfChoice(const TfToken& token)
bool
Hgi::IsSupported()
{
#ifdef __ANDROID__
// Generating a separate instance only for checking supports makes trouble for Android.
// Android does the check at the first time the instance is generated.
return true;
#endif
if (HgiUniquePtr const instance = CreatePlatformDefaultHgi()) {
return instance->IsBackendSupported();
}
Expand Down

0 comments on commit c562276

Please sign in to comment.