text: #ifndef SANDBOX_GRAPHICS_VULKAN_SHADER_VULKAN_SHADER_MODULE_H_
  #define SANDBOX_GRAPHICS_VULKAN_SHADER_VULKAN_SHADER_MODULE_H_
  
  #include "sandbox/Component.h"
  #include "sandbox/graphics/vulkan/VulkanDeviceRenderer.h"
  #include <fstream>
  
  namespace sandbox {
  
  class VulkanShaderModule : public VulkanRenderObject {
  public:
  	VulkanShaderModule(const std::string& filename, VkShaderStageFlagBits shaderStage) : shaderStage(shaderStage) { 
  		addType<VulkanShaderModule>(); 
  		code = readFile(filename);
  
  	}
  	virtual ~VulkanShaderModule() {}
  
  	VkShaderStageFlagBits getShaderStage() const { return shaderStage; }
  	VkShaderModule getShaderModule(const GraphicsContext& context) const { return contextHandler.getSharedState(context)->shaderModule; }
  
  protected:
  	void startRender(const GraphicsContext& context, VulkanDeviceState& state);
  	void finishRender(const GraphicsContext& context, VulkanDeviceState& state);
  
  
  private:
  	struct ShaderModuleState : public ContextState {
  		VkShaderModule shaderModule;
  	};
  
      static std::vector<char> readFile(const std::string& filename) {
          std::ifstream file(filename, std::ios::ate | std::ios::binary);
  
          if (!file.is_open()) {
              throw std::runtime_error("failed to open file!");
          }
  
          size_t fileSize = (size_t) file.tellg();
          std::vector<char> buffer(fileSize);
  
          file.seekg(0);
          file.read(buffer.data(), fileSize);
  
          file.close();
  
          return buffer;
      }
  
  	std::vector<char> code;
  	VkShaderStageFlagBits shaderStage;
  	GraphicsContextHandler<ShaderModuleState, ContextState> contextHandler;
  };
  
  
  }
  
  #endif