aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils.cpp
diff options
context:
space:
mode:
authorladevieq <qladevie@wanadev.fr>2021-04-01 09:15:10 +0200
committerladevieq <qladevie@wanadev.fr>2021-04-01 14:33:10 +0200
commitb4c2ce16c660c27dbfdeef12a55a0c7d448a83d2 (patch)
tree5dd5cad3f53109a4aceef684979d9b8dab2f0897 /src/utils.cpp
parent790f5ca6413fb14a232ed7a9dc74461a21007996 (diff)
Fix linux build
Diffstat (limited to 'src/utils.cpp')
-rw-r--r--src/utils.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/utils.cpp b/src/utils.cpp
index b228e82..eb119e8 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -4,16 +4,26 @@
#include <cstring>
#include <iostream>
+#include "defines.hpp"
#include "material.hpp"
std::vector<uint8_t> get_shader_code(const char* path) {
+#if defined(WINDOWS)
FILE* f = nullptr;
errno_t err = fopen_s(&f, path, "rb");
if (err != 0) {
- std::cerr << "Cannot open compute shader file !" << std::endl;
+ std::cerr << "Cannot open shader file !" << std::endl;
return {};
}
+#elif defined(LINUX)
+ FILE* f = fopen(path, "rb");
+
+ if (!f) {
+ std::cerr << "Cannot open shader file !" << std::endl;
+ return {};
+ }
+#endif
if (fseek(f, 0, SEEK_END) != 0) {
return {};