Skip to content

Commit 394b9a9

Browse files
committed
Fix vulkan shader path in vulkan sample
1 parent fdeb4fa commit 394b9a9

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

Src/Examples/Vulkan/VkColorCube/vkcolorcube.cpp

+4-21
Original file line numberDiff line numberDiff line change
@@ -1284,33 +1284,16 @@ bool AMDVulkanDemo::InitializeVulkan()
12841284
return false;
12851285
}
12861286

1287-
char modulepath[4096];
1288-
1289-
#ifdef _WIN32
1290-
::GetModuleFileNameA(NULL, modulepath, sizeof(modulepath));
1291-
#else
1292-
int len = readlink("/proc/self/exe", modulepath, 4096);
1293-
1294-
if (len <= 0)
1295-
{
1296-
return false;
1297-
}
1298-
1299-
#endif
1300-
1301-
std::string moduleString(modulepath);
1302-
size_t lastSlashPosition = moduleString.find_last_of('\\');
1303-
1304-
std::string m_executablePath = std::string(moduleString.begin(), moduleString.begin() + (lastSlashPosition + 1));
1305-
std::string vertexShaderFile = m_executablePath;
1287+
std::string executablePath = m_GpuPerfApiHelper.GetExecutablePath();
1288+
std::string vertexShaderFile = executablePath;
13061289
vertexShaderFile.append("vkcolorcubeshader.vert.spv");
13071290
m_vertexShaderModule = LoadShader(vertexShaderFile.c_str());
13081291

1309-
std::string fragmentShaderFile = m_executablePath;
1292+
std::string fragmentShaderFile = executablePath;
13101293
fragmentShaderFile.append("vkcolorcubeshader.frag.spv");
13111294
m_fragmentShaderModule = LoadShader(fragmentShaderFile.c_str());
13121295

1313-
std::string wireFrameShader = m_executablePath;
1296+
std::string wireFrameShader = executablePath;
13141297
wireFrameShader.append("vkcolorcubewireframeshader.frag.spv");
13151298
m_fragmentShaderWireframeModule = LoadShader(wireFrameShader.c_str());
13161299

0 commit comments

Comments
 (0)