Adding-Command-Line-Argument-rp-for-Non-Mac-iOS-platforms helping in (#1166)

dynamically locating directory where shaders and assets folders present.

Co-authored-by: Shivank Agrahari <sagrahar@qti.qualcomm.com>
This commit is contained in:
quic-sagrahar 2024-11-23 19:31:17 +05:30 committed by GitHub
parent 2871b76a0f
commit 49f380ea1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 22 deletions

View file

@ -12,6 +12,9 @@
// iOS & macOS: getAssetPath() and getShaderBasePath() implemented externally for access to Obj-C++ path utilities
const std::string getAssetPath()
{
if(vks::tools::resourcePathSet){
return vks::tools::resourcePath + "/assets/";
}
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
return "";
#elif defined(VK_EXAMPLE_ASSETS_DIR)
@ -21,8 +24,17 @@ const std::string getAssetPath()
#endif
}
void setResourcePath(std::string path)
{
vks::tools::resourcePath = path;
vks::tools::resourcePathSet = true;
}
const std::string getShaderBasePath()
{
if(vks::tools::resourcePathSet){
return vks::tools::resourcePath + "/shaders/";
}
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
return "shaders/";
#elif defined(VK_EXAMPLE_SHADERS_DIR)
@ -38,6 +50,8 @@ namespace vks
namespace tools
{
bool errorModeSilent = false;
bool resourcePathSet = false;
std::string resourcePath = "";
std::string errorString(VkResult errorCode)
{