cpp-vulkan-setup/src/ShaderLoader.h

35 lines
987 B
C
Raw Normal View History

2022-01-18 20:28:25 +00:00
#ifndef VULKANCPPSETUP_SHADERLOADER_H
#define VULKANCPPSETUP_SHADERLOADER_H
#include <array>
#include <qvulkanfunctions.h>
#include <string>
#include <vector>
#include <vulkan/vulkan_core.h>
class ShaderLoader {
private:
std::vector<VkShaderModule> loadedShaders{};
2022-01-18 20:28:25 +00:00
public:
ShaderLoader() = default;
~ShaderLoader() = default;
std::vector<VkShaderModule>
loadShaders(VkDevice device, QVulkanDeviceFunctions *deviceFunctions,
std::string const *shaderFilenames,
std::size_t shaderFilenameCount);
template <std::size_t amount>
std::vector<VkShaderModule>
loadShaders(VkDevice device, QVulkanDeviceFunctions *deviceFunctions,
const std::array<std::string, amount> &shaderFilenames) {
return loadShaders(device, deviceFunctions, shaderFilenames.data(),
shaderFilenames.size());
}
void destroyShaders(VkDevice device, QVulkanDeviceFunctions *devFuncs);
};
#endif // VULKANCPPSETUP_SHADERLOADER_H