diff --git a/src/OpMult.cpp b/src/OpMult.cpp index 1b41948c7..f09a1eb3c 100644 --- a/src/OpMult.cpp +++ b/src/OpMult.cpp @@ -1,6 +1,8 @@ #ifndef OPMULT_CPP #define OPMULT_CPP +#include + #include "Tensor.hpp" #include @@ -98,9 +100,26 @@ OpMult::init(std::vector> tensors) this->mDevice, this->mCommandBuffer); +#if RELEASE std::vector shaderFileData( shader_data::shaders_glsl_opmult_comp_spv, - shader_data::shaders_glsl_opmult_comp_spv + shader_data::shaders_glsl_opmult_comp_spv_len); + shader_data::shaders_glsl_opmult_comp_spv + kp::shader_data::shaders_glsl_opmult_comp_spv_len); +#else + + // TODO: Move to utility function + std::string shaderFilePath = "shaders/glsl/opmult.comp.spv"; + std::ifstream fileStream(shaderFilePath, + std::ios::binary | std::ios::in | std::ios::ate); + + size_t shaderFileSize = fileStream.tellg(); + fileStream.seekg(0, std::ios::beg); + char* shaderDataRaw = new char[shaderFileSize]; + fileStream.read(shaderDataRaw, shaderFileSize); + fileStream.close(); + + std::vector shaderFileData(shaderDataRaw, shaderDataRaw + shaderFileSize); +#endif + this->mAlgorithm->init(shaderFileData, tensors); } diff --git a/src/OpMult.hpp b/src/OpMult.hpp index e3de9cdc4..96a2fdbc0 100644 --- a/src/OpMult.hpp +++ b/src/OpMult.hpp @@ -1,6 +1,6 @@ // Defining OPMULT_H to ensure cpp class doesn't reimport -#pragma once #define OPMULT_HPP +#pragma once #include #include