45 std::vector<char> code =
readFile(filename);
59 std::vector<char> code =
readFile(filename);
71 if (!file.is_open())
throw std::runtime_error(
"Unable to open the file "+filename);
72 size_t fileSize =
static_cast<size_t>(file.tellg());
73 std::vector<char> code(fileSize);
75 file.read(code.data(), fileSize);
85 vk::ShaderModuleCreateInfo createInfo(vk::ShaderModuleCreateFlags(), code.size(),
86 reinterpret_cast<const uint32_t*
>(code.data()));
105 return vk::ShaderStageFlagBits::eVertex;
107 return vk::ShaderStageFlagBits::eFragment;
109 throw std::runtime_error(
"Invalid Shader Type");
118 vk::PipelineShaderStageCreateInfo createInfo;
120 createInfo.module =
shader.get();
121 createInfo.pName =
"main";
std::string getAssetFolderPath() const
virtual void freeResources(bool remove=true)
virtual void init(Parent &parent)
vk::UniqueDevice logicalDevice
vk::UniqueShaderModule shader
std::vector< char > readFile(const std::string &filename) const
vk::PipelineShaderStageCreateInfo getShaderPipelineInfo() const
vk::ShaderStageFlagBits getShaderStage() const
void freeResources(bool remove=true) override
void createShaderModule(const std::vector< char > &code)
void init(const std::string &filename, ShaderType type, Device &device)