Minor code cleanup
This commit is contained in:
parent
49f380ea1f
commit
4d91720ccc
3 changed files with 5 additions and 15 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Assorted commonly used Vulkan helper functions
|
* Assorted commonly used Vulkan helper functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
|
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
|
||||||
*
|
*
|
||||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
// iOS & macOS: getAssetPath() and getShaderBasePath() implemented externally for access to Obj-C++ path utilities
|
// iOS & macOS: getAssetPath() and getShaderBasePath() implemented externally for access to Obj-C++ path utilities
|
||||||
const std::string getAssetPath()
|
const std::string getAssetPath()
|
||||||
{
|
{
|
||||||
if(vks::tools::resourcePathSet){
|
if (vks::tools::resourcePath != "") {
|
||||||
return vks::tools::resourcePath + "/assets/";
|
return vks::tools::resourcePath + "/assets/";
|
||||||
}
|
}
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
|
|
@ -24,15 +24,9 @@ if(vks::tools::resourcePathSet){
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setResourcePath(std::string path)
|
|
||||||
{
|
|
||||||
vks::tools::resourcePath = path;
|
|
||||||
vks::tools::resourcePathSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string getShaderBasePath()
|
const std::string getShaderBasePath()
|
||||||
{
|
{
|
||||||
if(vks::tools::resourcePathSet){
|
if (vks::tools::resourcePath != "") {
|
||||||
return vks::tools::resourcePath + "/shaders/";
|
return vks::tools::resourcePath + "/shaders/";
|
||||||
}
|
}
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
|
|
@ -50,7 +44,6 @@ namespace vks
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
bool errorModeSilent = false;
|
bool errorModeSilent = false;
|
||||||
bool resourcePathSet = false;
|
|
||||||
std::string resourcePath = "";
|
std::string resourcePath = "";
|
||||||
|
|
||||||
std::string errorString(VkResult errorCode)
|
std::string errorString(VkResult errorCode)
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const std::string getAssetPath();
|
const std::string getAssetPath();
|
||||||
void setResourcePath(std::string path);
|
|
||||||
const std::string getShaderBasePath();
|
const std::string getShaderBasePath();
|
||||||
|
|
||||||
namespace vks
|
namespace vks
|
||||||
{
|
{
|
||||||
namespace tools
|
namespace tools
|
||||||
{
|
{
|
||||||
/** @brief Variables for Command Line Resource Path */
|
/** @brief Setting this path chnanges the place where the samples looks for assets and shaders */
|
||||||
extern std::string resourcePath;
|
extern std::string resourcePath;
|
||||||
extern bool resourcePathSet;
|
|
||||||
|
|
||||||
/** @brief Disable message boxes on fatal errors */
|
/** @brief Disable message boxes on fatal errors */
|
||||||
extern bool errorModeSilent;
|
extern bool errorModeSilent;
|
||||||
|
|
|
||||||
|
|
@ -856,8 +856,7 @@ VulkanExampleBase::VulkanExampleBase()
|
||||||
}
|
}
|
||||||
#if (!(defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)))
|
#if (!(defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)))
|
||||||
if(commandLineParser.isSet("resourcepath")) {
|
if(commandLineParser.isSet("resourcepath")) {
|
||||||
std::string path = commandLineParser.getValueAsString("resourcepath", "");
|
vks::tools::resourcePath = commandLineParser.getValueAsString("resourcepath", "");
|
||||||
setResourcePath(path);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue