Update shader loading
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <fstream>
|
||||
|
||||
#endif
|
||||
|
||||
namespace openVulkanoCpp
|
||||
@@ -24,4 +26,16 @@ namespace openVulkanoCpp
|
||||
pthread_setname_np(pthread_self(), name.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
Array<char> Utils::ReadFile(const std::string& filePath)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::ate | std::ios::binary);
|
||||
if (!file.is_open()) throw std::runtime_error("Failed to open file '" + filePath + "'!");
|
||||
const size_t fileSize = static_cast<size_t>(file.tellg());
|
||||
Array<char> data(fileSize);
|
||||
file.seekg(0);
|
||||
file.read(data.Data(), fileSize);
|
||||
file.close();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user