Skip to content

Commit 4d91720

Browse files
committed
Minor code cleanup
1 parent 49f380e commit 4d91720

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

base/VulkanTools.cpp

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Assorted commonly used Vulkan helper functions
33
*
4-
* Copyright (C) 2016-2023 by Sascha Willems - www.saschawillems.de
4+
* Copyright (C) 2016-2024 by Sascha Willems - www.saschawillems.de
55
*
66
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
77
*/
@@ -12,7 +12,7 @@
1212
// iOS & macOS: getAssetPath() and getShaderBasePath() implemented externally for access to Obj-C++ path utilities
1313
const std::string getAssetPath()
1414
{
15-
if(vks::tools::resourcePathSet){
15+
if (vks::tools::resourcePath != "") {
1616
return vks::tools::resourcePath + "/assets/";
1717
}
1818
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
@@ -24,15 +24,9 @@ if(vks::tools::resourcePathSet){
2424
#endif
2525
}
2626

27-
void setResourcePath(std::string path)
28-
{
29-
vks::tools::resourcePath = path;
30-
vks::tools::resourcePathSet = true;
31-
}
32-
3327
const std::string getShaderBasePath()
3428
{
35-
if(vks::tools::resourcePathSet){
29+
if (vks::tools::resourcePath != "") {
3630
return vks::tools::resourcePath + "/shaders/";
3731
}
3832
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
@@ -50,7 +44,6 @@ namespace vks
5044
namespace tools
5145
{
5246
bool errorModeSilent = false;
53-
bool resourcePathSet = false;
5447
std::string resourcePath = "";
5548

5649
std::string errorString(VkResult errorCode)

base/VulkanTools.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,14 @@
6161
#endif
6262

6363
const std::string getAssetPath();
64-
void setResourcePath(std::string path);
6564
const std::string getShaderBasePath();
6665

6766
namespace vks
6867
{
6968
namespace tools
7069
{
71-
/** @brief Variables for Command Line Resource Path */
70+
/** @brief Setting this path chnanges the place where the samples looks for assets and shaders */
7271
extern std::string resourcePath;
73-
extern bool resourcePathSet;
7472

7573
/** @brief Disable message boxes on fatal errors */
7674
extern bool errorModeSilent;

base/vulkanexamplebase.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -856,8 +856,7 @@ VulkanExampleBase::VulkanExampleBase()
856856
}
857857
#if (!(defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_MACOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)))
858858
if(commandLineParser.isSet("resourcepath")) {
859-
std::string path = commandLineParser.getValueAsString("resourcepath", "");
860-
setResourcePath(path);
859+
vks::tools::resourcePath = commandLineParser.getValueAsString("resourcepath", "");
861860
}
862861
#endif
863862

0 commit comments

Comments
 (0)