vOOlkan
An object oriented approach to Vulkan
Shader.h
Go to the documentation of this file.
1#ifndef VULKAN_SHADER
2#define VULKAN_SHADER
3
4#include <vulkan/vulkan.h>
5#include <fstream>
6#include <vector>
7#include <string>
8
9
10namespace Vulkan { class LogicalDevice; namespace PipelineOptions { class Shader; } }
11
16 public:
17
26 Shader(const LogicalDevice& virtualGpu, std::string spirvFileName, VkShaderStageFlagBits shaderType, std::string entrypoint = "main");
27
28 Shader(const Shader&) = delete;
29 Shader(Shader&&) = delete;
30 Shader& operator=(const Shader&) = delete;
31 Shader& operator=(Shader&&) = delete;
32
33 ~Shader();
34
40 const VkPipelineShaderStageCreateInfo& operator+() const;
41
42
43 private:
44
45 //reads the SPIR-V code and outputs it as a vector of bytes
46 static std::vector<char> readSpirvFile(std::string fileName);
47
48
49 VkShaderModule shaderModule;
50 VkPipelineShaderStageCreateInfo shaderStageInfo;
51 const LogicalDevice& virtualGpu;
52 std::string entrypoint;
53};
54
55#endif
A logical device is an abstraction of the physical GPU which we can mainly use to send commands.
Definition: LogicalDevice.h:15
A Shader is a program which runs on the GPU and performs graphics.
Definition: Shader.h:15
Shader(const Shader &)=delete
const VkPipelineShaderStageCreateInfo & operator+() const
Returns the underlying VkPipelineShaderStageCreateInfo struct.
Definition: Shader.cpp:32
Shader(const LogicalDevice &virtualGpu, std::string spirvFileName, VkShaderStageFlagBits shaderType, std::string entrypoint="main")
Creates a shader starting from the SPIR-V code.
Definition: Shader.cpp:6
~Shader()
Definition: Shader.cpp:27
Shader & operator=(const Shader &)=delete
Shader & operator=(Shader &&)=delete
Types of queue families.
Definition: Animations.h:17